/* MeroKalam.com official emi-calculator-nepal styles. Unauthorized copying or republication is not permitted. */
:root {
          --bg: #faf7f2;
          --bg-2: #f1f5f9;
          --white: #ffffff;
          --ink: #1c1c1c;
          --ink-2: #3a3a3a;
          --ink-3: #555;
          --ink-4: #888;
          --amber: #d97706;
          --amber-light: #fffbeb;
          --border: #e8e2d8;
          --blue: #2563eb;
          --blue-light: #eff6ff;
          --green: #059669;
          --teal: #e8872a;
          --radius: 14px;
          --shadow: 0 2px 8px rgba(0,0,0,.07), 0 6px 24px rgba(0,0,0,.05);
          --saffron: #e8872a;
          --red: #c0392b;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: 'DM Sans', -apple-system, sans-serif;
            background: var(--bg);
            color: var(--ink);
            line-height: 1.6;
            min-height: 100vh;
        }

        /* ── Navbar handled by .mk-nav in mk-shared.css ─────────────────── */

        /* ── Page layout ─────────────────────────────────────────────────── */
        .page { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem 5rem; }

        .page-header { text-align: left; margin-bottom: 2.5rem; }
        .page-slogan {
            font-size: 0.76rem;
            font-weight: 800;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: #94a3b8;
            margin-bottom: 0.45rem;
            width: max-content;
        }
        .page-header h1 {
            font-size: 2.5rem;
            font-weight: 800;
            background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            line-height: 1.2;
            margin-bottom: 0.6rem;
        }
        .page-header p { color: var(--ink-3); font-size: 0.95rem; max-width: 980px; margin: 0; line-height: 1.65; }

        /* ── Loan type tabs ──────────────────────────────────────────────── */
        .loan-tabs {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
            justify-content: center;
            margin-bottom: 2rem;
        }
        .loan-tab {
            padding: 0.55rem 1.15rem;
            border: 2px solid var(--border);
            background: var(--white);
            border-radius: 999px;
            cursor: pointer;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--ink-3);
            font-family: inherit;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }
        .loan-tab.active {
            background: var(--blue);
            color: var(--white);
            border-color: var(--blue);
            box-shadow: 0 4px 12px rgba(37,99,235,0.25);
        }
        .loan-tab:hover:not(.active) { border-color: var(--blue); color: var(--blue); }

        /* ── Main grid ───────────────────────────────────────────────────── */
        .main-grid {
            display: grid;
            grid-template-columns: 380px 1fr;
            gap: 1.5rem;
            align-items: start;
            margin-bottom: 1.5rem;
        }

        /* ── Card ────────────────────────────────────────────────────────── */
        .card {
            background: var(--white);
            border-radius: var(--radius);
            padding: 2rem;
            box-shadow: var(--shadow);
            border: 1px solid var(--border);
        }
        .card-title {
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--ink-4);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            margin-bottom: 1.5rem;
        }

        /* ── Inputs ──────────────────────────────────────────────────────── */
        .field { margin-bottom: 1.5rem; }
        .field-label {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.5rem;
        }
        .field-label label { font-weight: 600; color: var(--ink-2); font-size: 0.9rem; }
        .field-val {
            font-family: 'DM Mono', monospace;
            font-size: 0.9rem;
            font-weight: 500;
            color: var(--blue);
            background: var(--blue-light);
            padding: 0.2rem 0.6rem;
            border-radius: 0.375rem;
        }
        .field input[type="range"] {
            width: 100%;
            height: 6px;
            border-radius: 999px;
            appearance: none;
            background: linear-gradient(to right, var(--saffron) 0%, var(--border) 0%);
            outline: none;
            cursor: pointer;
            margin-bottom: 0.5rem;
        }
        .field input[type="range"]::-webkit-slider-thumb {
            appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: var(--saffron);
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(232,135,42,0.35);
            border: 3px solid var(--white);
        }
        .range-ends {
            display: flex;
            justify-content: space-between;
            font-size: 0.72rem;
            color: var(--ink-4);
            font-family: 'DM Mono', monospace;
        }

        .field input[type="number"], .field select {
            width: 100%;
            padding: 0.7rem 1rem;
            border: 2px solid var(--border);
            border-radius: 0.75rem;
            font-size: 0.95rem;
            font-family: inherit;
            color: var(--ink);
            background: var(--white);
            transition: border-color 0.2s;
        }
        .field input[type="number"]:focus,
        .field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

        .rate-hint {
            font-size: 0.76rem;
            color: var(--ink-4);
            margin-top: 0.35rem;
        }
        .rate-hint a { color: var(--blue); text-decoration: none; }

        .calc-btn {
            width: 100%;
            padding: 0.95rem;
            background: linear-gradient(135deg, var(--blue), var(--teal));
            color: var(--white);
            border: none;
            border-radius: 0.875rem;
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            box-shadow: 0 4px 16px rgba(37,99,235,0.3);
            font-family: inherit;
        }
        .calc-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37,99,235,0.4); }

        /* ── Results panel ───────────────────────────────────────────────── */
        .results-panel { display: none; }
        .results-panel.show { display: flex; flex-direction: column; gap: 1.5rem; }

        /* EMI hero */
        .emi-hero {
            background: linear-gradient(135deg, #b5311e 0%, #c0392b 28%, #cf5318 62%, #e8872a 100%);
            border-radius: var(--radius);
            padding: 2rem 2.25rem 1.85rem;
            color: var(--white);
            text-align: center;
            position: relative;
            overflow: hidden;
            box-shadow:
                0 1px 2px rgba(180,50,30,.12),
                0 6px 16px rgba(192,57,43,.22),
                0 20px 48px rgba(192,57,43,.18);
        }
        /* grain texture */
        .emi-hero::before {
            content: '';
            position: absolute;
            inset: 0;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
            background-size: 200px 200px;
            pointer-events: none;
            z-index: 0;
        }
        /* top highlight edge + right-side arc */
        .emi-hero::after {
            content: '';
            position: absolute;
            inset: 0;
            background:
                linear-gradient(180deg, rgba(255,255,255,.12) 0%, transparent 18%),
                radial-gradient(ellipse 60% 80% at 105% 50%, rgba(255,255,255,.08) 0%, transparent 60%);
            pointer-events: none;
            z-index: 0;
        }
        .emi-hero > * { position: relative; z-index: 1; }
        .emi-hero-label {
            font-size: 0.72rem; font-weight: 700;
            color: #ffffff !important; -webkit-text-fill-color: #ffffff !important;
            text-transform: uppercase; letter-spacing: 0.12em;
            margin-bottom: 0.55rem; opacity: 0.75;
        }
        .emi-hero-amount {
            font-size: 3rem;
            font-weight: 800;
            line-height: 1;
            font-family: 'DM Mono', monospace;
            margin-bottom: 0.6rem;
            color: #ffffff !important;
            -webkit-text-fill-color: #ffffff !important;
            text-shadow: 0 2px 12px rgba(0,0,0,.18);
        }
        .emi-hero .emi-hero-sub {
            font-size: 0.82rem;
            color: #ffffff !important; -webkit-text-fill-color: #ffffff !important;
            line-height: 1.55; font-weight: 500; opacity: 0.78;
            letter-spacing: 0.01em;
        }

        /* Stats row */
        .stats-row {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 1rem;
        }
        .stat {
            background: var(--white);
            border: 1px solid var(--border);
            border-radius: 1rem;
            padding: 1.25rem;
            text-align: center;
        }
        .stat-num {
            font-size: 1.3rem;
            font-weight: 800;
            font-family: 'DM Mono', monospace;
            display: block;
            line-height: 1.2;
        }
        .stat-num.blue { color: var(--blue); }
        .stat-num.red { color: var(--red); }
        .stat-num.green { color: var(--green); }
        .stat-label { font-size: 0.75rem; color: var(--ink-3); font-weight: 600; margin-top: 0.3rem; text-transform: uppercase; letter-spacing: 0.04em; }

        /* Donut chart */
        .chart-row {
            display: grid;
            grid-template-columns: 200px 1fr;
            gap: 2rem;
            align-items: center;
            background: var(--white);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 1.75rem 2rem;
        }
        .donut-wrap { position: relative; width: 160px; height: 160px; margin: 0 auto; }
        .donut-svg { width: 160px; height: 160px; transform: rotate(-90deg); }
        .donut-center {
            position: absolute;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
        }
        .donut-center-pct { font-size: 1.4rem; font-weight: 800; color: var(--ink); font-family: 'DM Mono', monospace; }
        .donut-center-label { font-size: 0.7rem; color: var(--ink-4); font-weight: 600; }
        .legend { display: flex; flex-direction: column; gap: 1rem; }
        .legend-item { display: flex; align-items: center; gap: 0.75rem; }
        .legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
        .legend-item-info { flex: 1; }
        .legend-item-label { font-size: 0.8rem; color: var(--ink-3); font-weight: 600; }
        .legend-item-val { font-size: 1rem; font-weight: 700; color: var(--ink); font-family: 'DM Mono', monospace; }

        /* Progress bars */
        .breakdown-card {
            background: var(--white);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 1.75rem 2rem;
        }
        .breakdown-title { font-size: 0.8rem; font-weight: 700; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 1.25rem; }
        .progress-item { margin-bottom: 1.1rem; }
        .progress-header { display: flex; justify-content: space-between; margin-bottom: 0.4rem; }
        .progress-label { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
        .progress-val { font-size: 0.85rem; font-weight: 700; color: var(--ink); font-family: 'DM Mono', monospace; }
        .progress-bar-bg { background: var(--bg-2); border-radius: 999px; height: 8px; overflow: hidden; }
        .progress-bar-fill { height: 100%; border-radius: 999px; transition: width 0.8s cubic-bezier(.4,0,.2,1); }

        /* Amortization table */
        .amort-card {
            background: var(--white);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            overflow: hidden;
        }
        .amort-header {
            padding: 1.25rem 1.75rem;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .amort-header-title { font-size: 0.8rem; font-weight: 700; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.06em; }
        .amort-toggle {
            font-size: 0.8rem;
            color: var(--blue);
            cursor: pointer;
            font-weight: 600;
            background: none;
            border: none;
            font-family: inherit;
        }
        .table-wrap { overflow-x: auto; }
        table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
        thead { background: var(--bg-2); }
        th {
            padding: 0.75rem 1rem;
            text-align: right;
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--ink-3);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            white-space: nowrap;
        }
        th:first-child { text-align: left; }
        td {
            padding: 0.65rem 1rem;
            text-align: right;
            color: var(--ink-2);
            border-bottom: 1px solid var(--bg-2);
            font-family: 'DM Mono', monospace;
            font-size: 0.82rem;
        }
        td:first-child { text-align: left; font-family: 'DM Sans', sans-serif; font-weight: 600; color: var(--ink); }
        td.interest-cell { color: var(--red); }
        td.principal-cell { color: var(--green); }
        tbody tr:hover { background: var(--blue-light); }
        tfoot td { font-weight: 700; color: var(--ink); border-top: 2px solid var(--border); border-bottom: none; }

        /* Empty state */
        .empty-state {
            text-align: center;
            padding: 3rem 2rem;
            color: var(--ink-4);
        }
        .empty-state .es-icon { font-size: 3rem; margin-bottom: 1rem; }
        .empty-state p { font-size: 0.9rem; }

        /* ── Nepal Bank Rates reference ──────────────────────────────────── */
        .rates-ref {
            background: #f5f9ff;
            border: 1.5px solid #bfdbfe;
            border-radius: var(--radius);
            padding: 1.5rem 1.75rem;
            margin-bottom: 1.5rem;
        }
        .rates-ref-title { font-size: 0.78rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 1rem; }
        .rates-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.75rem; }
        .rate-chip {
            background: var(--white);
            border: 1px solid #bfdbfe;
            border-radius: 0.75rem;
            padding: 0.75rem 1rem;
        }
        .rate-chip-name { font-size: 0.78rem; font-weight: 700; color: var(--ink-2); }
        .rate-chip-range { font-size: 1rem; font-weight: 800; color: var(--blue); font-family: 'DM Mono', monospace; }
        .rate-chip-note { font-size: 0.68rem; color: var(--ink-4); margin-top: 0.15rem; }
        .rates-disclaimer {
            font-size: 0.78rem;
            color: #1e3a8a;
            margin-top: 1rem;
            background: #eff6ff;
            border: 1px solid #bfdbfe;
            border-left: 3px solid var(--blue);
            border-radius: 0 8px 8px 0;
            padding: 0.65rem 0.9rem;
            line-height: 1.65;
            font-weight: 500;
        }

        /* ── SEO Article ─────────────────────────────────────────────────── */
        .article {
            background: var(--white);
            border-radius: var(--radius);
            padding: 2.5rem;
            box-shadow: var(--shadow);
            border: 1px solid var(--border);
            margin-top: 2rem;
        }
        .article-meta { display: flex; gap: 0.75rem; align-items: center; font-size: 0.78rem; color: var(--ink-4); margin-bottom: 1.25rem; flex-wrap: wrap; }
        .article h2 { font-size: 1.75rem; font-weight: 800; color: var(--ink); margin-bottom: 1rem; line-height: 1.3; }
        .article h3 { color: var(--ink); font-size: 1.05rem; font-weight: 700; margin-top: 2rem; margin-bottom: 0.6rem; padding-left: 0.85rem; border-left: 3px solid var(--blue); }
        .article p { color: #475569; line-height: 1.85; font-size: 0.95rem; margin-bottom: 0.9rem; }
        .article strong { color: var(--ink); }
        .article a { color: var(--blue); text-decoration: none; }

        .info-box {
            background: var(--blue-light);
            border-left: 4px solid var(--blue);
            border-radius: 0 0.75rem 0.75rem 0;
            padding: 1rem 1.25rem;
            margin: 1.25rem 0;
            font-size: 0.9rem;
            color: var(--ink-2);
            line-height: 1.7;
        }
        .info-box strong { color: var(--blue); }

        .loan-table {
            width: 100%;
            border-collapse: collapse;
            margin: 1.25rem 0;
            font-size: 0.85rem;
        }
        .loan-table th {
            background: var(--bg-2);
            padding: 0.65rem 1rem;
            text-align: left;
            font-weight: 700;
            color: var(--ink-2);
            border-bottom: 2px solid var(--border);
            font-size: 0.82rem;
        }
        .loan-table td {
            padding: 0.65rem 1rem;
            color: #475569;
            border-bottom: 1px solid var(--bg-2);
            text-align: left;
            font-family: inherit;
            font-size: 0.85rem;
        }
        .loan-table td:last-child { font-weight: 700; color: var(--blue); }
        .loan-table tr:hover td { background: var(--blue-light); }

        .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.25rem 0; }
        .tip-card {
            background: var(--bg);
            border: 1.5px solid var(--border);
            border-radius: 1rem;
            padding: 1.1rem 1.25rem;
        }
        .tip-card .tip-icon { font-size: 1.4rem; margin-bottom: 0.4rem; }
        .tip-card .tip-title { font-weight: 700; color: var(--ink); font-size: 0.88rem; margin-bottom: 0.3rem; }
        .tip-card .tip-text { color: var(--ink-3); font-size: 0.82rem; line-height: 1.55; }

        .faq-wrap { background: white; border: 1px solid #e8e2d8; border-radius: 1rem; overflow: hidden; margin-top: 1.5rem; }
        .faq-head { padding: 1rem 1.5rem; font-size: 1rem; font-weight: 800; color: #1c1c1c; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
        .faq-item { border-bottom: 1px solid #f1f5f9; }
        .faq-item:last-child { border-bottom: none; }
        .faq-q { width: 100%; padding: 0.9rem 1.25rem; background: white; border: none; text-align: left; font-family: inherit; font-size: 0.88rem; font-weight: 700; color: #1c1c1c; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; transition: background 0.15s; }
        .faq-q:hover { background: #f8fafc; }
        .faq-q.open { color: #2563eb; background: #eff6ff; }
        .faq-icon { font-size: 1rem; transition: transform 0.25s; flex-shrink: 0; }
        .faq-q.open .faq-icon { transform: rotate(45deg); }
        .faq-bd { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
        .faq-bd.open { max-height: 600px; }
        .faq-ans { padding: 0.1rem 1.25rem 1rem; font-size: 0.87rem; color: #374151; line-height: 1.75; }

        /* ── Responsive ──────────────────────────────────────────────────── */

        @media (max-width: 768px) {
            .main-grid { grid-template-columns: 1fr; }
            .chart-row { grid-template-columns: 1fr; text-align: center; }
            .legend { align-items: flex-start; }
            .two-col { grid-template-columns: 1fr; }
            .stats-row { grid-template-columns: repeat(3,1fr); gap: 0.6rem; }
            .page-header h1 { font-size: 1.9rem; }
            .emi-hero-amount { font-size: 2.2rem; }
            .article { padding: 1.5rem; }
            .card { padding: 1.5rem; }
            .rates-grid { grid-template-columns: repeat(3,1fr); }
            .loan-tabs { gap: 0.4rem; }
            .loan-tab { padding: 0.45rem 0.85rem; font-size: 0.8rem; }
            .chart-row { padding: 1.25rem; gap: 1.25rem; }
        }
        @media (max-width: 520px) {
            .stats-row { grid-template-columns: 1fr 1fr; }
            .stat-num { font-size: 1.1rem; }
            .rates-grid { grid-template-columns: 1fr 1fr; }
            .emi-hero-amount { font-size: 1.9rem; }
            .page-header h1 { font-size: 1.6rem; }
            .amort-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
            table { font-size: 0.78rem; }
            th, td { padding: 0.5rem 0.65rem; }
        }
        @media (max-width: 380px) {
            .loan-tab { font-size: 0.75rem; padding: 0.4rem 0.65rem; }
            .rates-grid { grid-template-columns: 1fr 1fr; }
            .emi-hero { padding: 1.5rem 1rem; }
        }
        /* ── Footer handled by footer rule in mk-shared.css ── */
        
        /* ── Global mobile polish ───────────────────────────────────── */
        @media (max-width: 480px) {
            button, .btn, [role=button] { min-height: 44px; }
            input, select, textarea { font-size: 16px !important; }
            .article p { font-size: 0.9rem !important; line-height: 1.75 !important; }
            .article h3 { font-size: 1rem !important; }
            body { overflow-x: hidden; }
        }
