:root {
      --primary: #0044FC;
      --primary-dark: #0036C9;
      --primary-soft: #E8EEFF;
      --sidebar: #0B2A8F;
      --sidebar-dark: #071E6B;
      --navy: #0B1B4D;
      --bg: #F4F6FB;
      --surface: #FFFFFF;
      --text: #0F172A;
      --text-muted: #64748B;
      --border: #E2E8F0;
      --danger: #DC2626;
      --success: #059669;
      --green-btn: #22C55E;
      --radius: 14px;
      --radius-sm: 10px;
      --shadow: 0 8px 24px rgba(11, 27, 77, 0.08);
      --header-h: 56px;
      --footer-h: 88px;
      --portal-footer-h: 40px;
      --safe-b: env(safe-area-inset-bottom, 0px);
      --space-2: 8px;
      --space-3: 12px;
      --space-4: 16px;
      --space-5: 24px;
      --font: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
    }

    *, *::before, *::after { box-sizing: border-box; }
    html { -webkit-text-size-adjust: 100%; }
    body {
      margin: 0;
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      line-height: 1.45;
      overscroll-behavior: contain;
      min-height: 100dvh;
    }
    img { max-width: 100%; display: block; }
    button, input, select, textarea { font: inherit; }
    button { cursor: pointer; border: none; background: none; }
    a { color: inherit; text-decoration: none; }

    /* ========== PORTAL SHELL ========== */
    .portal {
      min-height: 100dvh;
      display: flex;
      flex-direction: column;
    }

    .portal-header {
      position: sticky;
      top: 0;
      z-index: 60;
      height: var(--header-h);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 0 12px 0 8px;
      background: #fff;
      border-bottom: 1px solid var(--border);
    }
    .portal-header__left {
      display: flex;
      align-items: center;
      gap: 4px;
      min-width: 0;
      flex: 1 1 auto;
      overflow: hidden;
    }
    .portal-header__menu {
      width: 44px;
      height: 44px;
      display: grid;
      place-items: center;
      border-radius: 10px;
      color: var(--navy);
      flex-shrink: 0;
    }
    .portal-header__menu:hover,
    .portal-header__menu:focus-visible {
      background: var(--primary-soft);
      outline: none;
    }
    .portal-header__menu svg { width: 22px; height: 22px; }
    .portal-header__logo {
      width: min(168px, calc(100vw - 188px));
      height: auto;
      max-height: 28px;
      object-fit: contain;
      object-position: left center;
      display: block;
    }
    .portal-header__right {
      display: flex;
      align-items: center;
      gap: 0;
      flex-shrink: 0;
    }
    .portal-link {
      display: none;
      align-items: center;
      gap: 6px;
      padding: 8px 10px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 500;
      color: #334155;
      white-space: nowrap;
      transition: background .2s ease;
    }
    .portal-link:hover { background: var(--bg); }
    .portal-link svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
    .portal-icon {
      width: 40px;
      height: 40px;
      display: grid;
      place-items: center;
      border-radius: 10px;
      color: #475569;
      position: relative;
    }
    .portal-icon:hover { background: var(--bg); }
    .portal-icon svg { width: 20px; height: 20px; }
    .portal-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: linear-gradient(135deg, #94A3B8, #CBD5E1);
      border: 2px solid #fff;
      box-shadow: 0 0 0 1px var(--border);
      flex-shrink: 0;
    }
    .portal-user {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: 6px;
    }
    .portal-user__greet {
      display: none;
      font-size: 13px;
      font-weight: 500;
      color: #334155;
      white-space: nowrap;
    }

    .portal-body {
      display: flex;
      flex: 1;
      min-height: 0;
      position: relative;
    }

    /* Portal sidebar (nav) */
    .portal-sidebar {
      position: fixed;
      inset: 0 auto 0 0;
      width: min(280px, 86vw);
      z-index: 80;
      background: var(--sidebar);
      color: #fff;
      transform: translateX(-105%);
      transition: transform .28s ease;
      display: flex;
      flex-direction: column;
      padding: 20px 14px;
      box-shadow: 8px 0 32px rgba(0,0,0,.2);
    }
    .portal.is-nav-open .portal-sidebar {
      transform: translateX(0);
    }
    .portal-sidebar__brand {
      padding: 4px 10px 20px;
      border-bottom: 1px solid rgba(255,255,255,.12);
      margin-bottom: 16px;
    }
    .portal-sidebar__portal-name {
      margin: 0;
      font-size: 15px;
      font-weight: 600;
      letter-spacing: -0.01em;
      line-height: 1.3;
      color: #fff;
    }
    .portal-sidebar__nav {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .portal-nav-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 12px;
      border-radius: 10px;
      color: rgba(255,255,255,.88);
      font-size: 14px;
      font-weight: 500;
      transition: background .2s ease;
      text-align: left;
      width: 100%;
    }
    .portal-nav-item svg {
      width: 20px;
      height: 20px;
      flex-shrink: 0;
      opacity: .9;
    }
    .portal-nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
    .portal-nav-item.is-active {
      background: rgba(255,255,255,.16);
      color: #fff;
      font-weight: 600;
    }
    .nav-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, .45);
      z-index: 70;
    }
    .portal.is-nav-open .nav-overlay { display: block; }

    .portal-main {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      background: var(--bg);
    }

    .page-head {
      display: none;
    }

    .site-footer {
      margin-top: auto;
      padding: 14px 16px calc(14px + var(--safe-b));
      text-align: center;
      font-size: 12px;
      color: var(--text-muted);
      background: #fff;
      border-top: 1px solid var(--border);
    }
    .site-footer strong { color: var(--navy); font-weight: 600; }
    .site-footer a {
      color: inherit;
      text-decoration: none;
    }
    .site-footer a:hover { text-decoration: underline; }

    /* ========== LOAN APP (inner) ========== */
    .app {
      width: 100%;
      max-width: 480px;
      margin: 0 auto;
      background: var(--bg);
      position: relative;
      padding-bottom: calc(var(--footer-h) + var(--safe-b));
      flex: 1;
    }

    .desktop-only { display: none !important; }
    .mobile-only { display: block; }

    .cards-row > .card,
    .loan-layout > .card {
      margin-bottom: var(--space-4);
    }

    .progress {
      padding: var(--space-4) var(--space-4) var(--space-3);
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      position: sticky;
      top: var(--header-h);
      z-index: 40;
    }
    .progress__meta {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      margin-bottom: var(--space-3);
      gap: var(--space-3);
    }
    .progress__title {
      font-size: 15px;
      font-weight: 600;
      color: var(--navy);
      margin: 0;
    }
    .progress__count {
      font-size: 13px;
      font-weight: 500;
      color: var(--text-muted);
      white-space: nowrap;
    }
    .progress__track {
      height: 6px;
      background: var(--border);
      border-radius: 999px;
      overflow: hidden;
    }
    .progress__bar {
      height: 100%;
      width: 16.66%;
      background: linear-gradient(90deg, var(--primary), #3B6BFF);
      border-radius: inherit;
      transition: width .35s ease;
    }
    .progress__steps {
      display: flex;
      gap: 4px;
      margin-top: var(--space-3);
      overflow-x: auto;
      scrollbar-width: none;
      padding-bottom: 2px;
    }
    .progress__steps::-webkit-scrollbar { display: none; }
    .step-chip {
      flex: 0 0 auto;
      font-size: 12px;
      font-weight: 500;
      padding: 6px 10px;
      border-radius: 999px;
      color: var(--text-muted);
      background: var(--bg);
      border: 1px solid transparent;
      white-space: nowrap;
      cursor: pointer;
    }
    .step-chip.is-active {
      color: var(--primary);
      background: var(--primary-soft);
      border-color: #C7D4FF;
    }
    .step-chip.is-done {
      color: var(--success);
      background: #ECFDF5;
    }

    .main { padding: var(--space-4); }

    .panel { display: none; animation: fadeUp .35s ease both; }
    .panel.is-active { display: block; }

    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(10px); }
      to { opacity: 1; transform: translateY(0); }
    }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
      }
    }

    .hero-card {
      background: linear-gradient(145deg, #0044FC 0%, #0030B8 55%, #0B1B4D 100%);
      color: #fff;
      border-radius: 18px;
      padding: var(--space-5);
      margin: var(--space-4) var(--space-4) 0;
      position: relative;
      overflow: hidden;
      box-shadow: 0 12px 28px rgba(0, 68, 252, 0.28);
    }
    .hero-card::after {
      content: "";
      position: absolute;
      right: -40px;
      top: -40px;
      width: 160px;
      height: 160px;
      border-radius: 50%;
      background: rgba(255,255,255,.08);
    }
    .hero-card__eyebrow {
      font-size: 12px;
      font-weight: 500;
      opacity: .85;
      margin: 0 0 6px;
    }
    .hero-card__title {
      margin: 0 0 8px;
      font-size: 22px;
      font-weight: 700;
      letter-spacing: -0.02em;
      position: relative;
      z-index: 1;
    }
    .hero-card__desc {
      margin: 0;
      font-size: 14px;
      opacity: .9;
      max-width: 28ch;
      position: relative;
      z-index: 1;
    }

    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: var(--space-4);
      margin-bottom: var(--space-4);
      box-shadow: var(--shadow);
    }
    .card__head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--space-3);
      margin-bottom: var(--space-4);
    }
    .card__title {
      margin: 0;
      font-size: 16px;
      font-weight: 700;
      color: var(--navy);
    }
    .card__sub {
      margin: 4px 0 0;
      font-size: 13px;
      color: var(--text-muted);
    }
    .badge {
      font-size: 11px;
      font-weight: 600;
      padding: 4px 8px;
      border-radius: 999px;
      background: var(--primary-soft);
      color: var(--primary);
      white-space: nowrap;
    }

    .field { margin-bottom: var(--space-4); }
    .field:last-child { margin-bottom: 0; }
    .field__label {
      display: block;
      font-size: 13px;
      font-weight: 600;
      color: var(--navy);
      margin-bottom: 6px;
    }
    .field__label .req { color: var(--danger); margin-left: 2px; }
    .field__hint {
      margin: 6px 0 0;
      font-size: 12px;
      color: var(--text-muted);
    }
    .field__error {
      display: none;
      margin: 6px 0 0;
      font-size: 12px;
      color: var(--danger);
      font-weight: 500;
    }
    .field.is-invalid .control,
    .field.is-invalid .segment,
    .field.is-invalid .upload { border-color: var(--danger); }
    .field.is-invalid .field__error { display: block; }

    .control {
      width: 100%;
      min-height: 48px;
      padding: 12px 14px;
      border: 1.5px solid var(--border);
      border-radius: var(--radius-sm);
      background: #fff;
      color: var(--text);
      transition: border-color .2s ease, box-shadow .2s ease;
      appearance: none;
      -webkit-appearance: none;
    }
    .control::placeholder { color: #94A3B8; }
    .control:hover { border-color: #CBD5E1; }
    .control:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(0, 68, 252, 0.16);
    }
    select.control {
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 12px center;
      padding-right: 40px;
    }
    .control--readonly {
      background: #F8FAFC;
      color: var(--text-muted);
    }

    .row-2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: var(--space-3);
    }

    .segment {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      padding: 4px;
      background: var(--bg);
      border: 1.5px solid var(--border);
      border-radius: var(--radius-sm);
    }
    .segment__item { position: relative; }
    .segment__item input {
      position: absolute;
      opacity: 0;
      inset: 0;
      cursor: pointer;
    }
    .segment__item span {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 44px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      color: var(--text-muted);
      transition: all .2s ease;
    }
    .segment__item input:checked + span {
      background: #fff;
      color: var(--primary);
      box-shadow: 0 2px 8px rgba(11, 27, 77, 0.1);
    }
    .segment__item input:focus-visible + span {
      outline: 2px solid var(--primary);
      outline-offset: 2px;
    }

    .upload-grid { display: grid; gap: var(--space-3); }
    .upload {
      border: 1.5px dashed #B6C4E8;
      border-radius: var(--radius);
      background: linear-gradient(180deg, #F8FAFF, #F1F5FF);
      padding: var(--space-4);
      text-align: center;
      min-height: 112px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      position: relative;
      transition: border-color .2s ease, background .2s ease;
    }
    .upload:hover, .upload:focus-within {
      border-color: var(--primary);
      background: var(--primary-soft);
    }
    .upload input {
      position: absolute;
      inset: 0;
      opacity: 0;
      cursor: pointer;
    }
    .upload__icon {
      width: 40px;
      height: 40px;
      border-radius: 12px;
      background: #fff;
      display: grid;
      place-items: center;
      color: var(--primary);
      box-shadow: 0 2px 8px rgba(0,68,252,.12);
    }
    .upload__icon svg { width: 20px; height: 20px; }
    .upload__title {
      font-size: 14px;
      font-weight: 600;
      color: var(--navy);
      margin: 0;
    }
    .upload__hint {
      font-size: 12px;
      color: var(--text-muted);
      margin: 0;
    }
    .upload.is-filled {
      border-style: solid;
      border-color: #A7F3D0;
      background: #ECFDF5;
    }
    .upload.is-filled .upload__title { color: var(--success); }

    .otp-row {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      align-items: start;
    }
    .btn-ghost {
      min-height: 48px;
      padding: 0 14px;
      border-radius: var(--radius-sm);
      border: 1.5px solid var(--border);
      background: #fff;
      color: var(--primary);
      font-weight: 600;
      font-size: 13px;
      white-space: nowrap;
    }
    .btn-ghost:hover, .btn-ghost:focus-visible {
      background: var(--primary-soft);
      border-color: #C7D4FF;
      outline: none;
    }

    .summary { display: grid; gap: 10px; }
    .summary__row {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      font-size: 14px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--border);
    }
    .summary__row:last-child { border-bottom: 0; padding-bottom: 0; }
    .summary__row dt { color: var(--text-muted); margin: 0; }
    .summary__row dd {
      margin: 0;
      font-weight: 600;
      color: var(--navy);
      text-align: right;
    }
    .emi-box {
      margin-top: var(--space-4);
      padding: var(--space-4);
      border-radius: var(--radius);
      background: var(--primary-soft);
      border: 1px solid #C7D4FF;
    }
    .emi-box__label {
      font-size: 12px;
      font-weight: 600;
      color: var(--primary);
      margin: 0 0 4px;
      text-transform: uppercase;
      letter-spacing: .04em;
    }
    .emi-box__value {
      margin: 0;
      font-size: 28px;
      font-weight: 700;
      color: var(--navy);
      letter-spacing: -0.03em;
    }
    .emi-box__note {
      margin: 4px 0 0;
      font-size: 12px;
      color: var(--text-muted);
    }

    .dealer-chip {
      display: flex;
      gap: 12px;
      align-items: flex-start;
      padding: 12px;
      border-radius: var(--radius-sm);
      background: var(--bg);
      border: 1px solid var(--border);
      margin-bottom: var(--space-4);
    }
    .dealer-chip__icon {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      background: var(--primary-soft);
      color: var(--primary);
      display: grid;
      place-items: center;
      flex-shrink: 0;
    }
    .dealer-chip__icon svg { width: 20px; height: 20px; }
    .dealer-chip__name {
      margin: 0;
      font-size: 14px;
      font-weight: 600;
      color: var(--navy);
    }
    .dealer-chip__addr {
      margin: 2px 0 0;
      font-size: 12px;
      color: var(--text-muted);
    }

    .ref-block + .ref-block {
      margin-top: var(--space-4);
      padding-top: var(--space-4);
      border-top: 1px dashed var(--border);
    }
    .ref-block__title {
      margin: 0 0 var(--space-3);
      font-size: 13px;
      font-weight: 700;
      color: var(--primary);
    }

    .check {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      font-size: 13px;
      color: var(--text-muted);
      line-height: 1.4;
    }
    .check input {
      width: 20px;
      height: 20px;
      margin-top: 1px;
      accent-color: var(--primary);
      flex-shrink: 0;
    }

    .toolbar {
      display: none;
    }

    .footer {
      position: fixed;
      left: 50%;
      transform: translateX(-50%);
      bottom: 0;
      width: 100%;
      max-width: 480px;
      z-index: 50;
      padding: 12px 16px calc(12px + var(--safe-b));
      background: rgba(255,255,255,.96);
      backdrop-filter: blur(12px);
      border-top: 1px solid var(--border);
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 10px;
    }
    .btn {
      min-height: 52px;
      border-radius: 14px;
      font-weight: 700;
      font-size: 15px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: transform .15s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease;
    }
    .btn:active { transform: scale(0.98); }
    .btn:focus-visible {
      outline: 2px solid var(--primary);
      outline-offset: 2px;
    }
    .btn--secondary {
      min-width: 96px;
      padding: 0 16px;
      background: #fff;
      border: 1.5px solid var(--border);
      color: var(--navy);
    }
    .btn--secondary:hover { background: var(--bg); }
    .btn--secondary[disabled] {
      opacity: .4;
      pointer-events: none;
    }
    .btn--primary {
      background: var(--primary);
      color: #fff;
      box-shadow: 0 8px 20px rgba(0, 68, 252, 0.35);
    }
    .btn--primary:hover { background: var(--primary-dark); }
    .btn--primary svg { width: 18px; height: 18px; }
    .btn--save {
      min-height: 44px;
      padding: 0 14px;
      border-radius: 10px;
      border: 1.5px solid var(--border);
      background: #fff;
      color: var(--navy);
      font-weight: 600;
      font-size: 13px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .btn--save:hover { background: var(--bg); }
    .btn--save svg { width: 16px; height: 16px; }

    .toast {
      position: fixed;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      bottom: calc(var(--footer-h) + 12px + var(--safe-b));
      max-width: calc(480px - 32px);
      width: calc(100% - 32px);
      background: var(--navy);
      color: #fff;
      padding: 12px 16px;
      border-radius: 12px;
      font-size: 14px;
      font-weight: 500;
      opacity: 0;
      pointer-events: none;
      transition: opacity .25s ease, transform .25s ease;
      z-index: 90;
      text-align: center;
    }
    .toast.is-show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    .success-screen {
      text-align: center;
      padding: 48px 16px 24px;
    }
    .success-screen__icon {
      width: 72px;
      height: 72px;
      margin: 0 auto 16px;
      border-radius: 50%;
      background: #ECFDF5;
      color: var(--success);
      display: grid;
      place-items: center;
    }
    .success-screen__icon svg { width: 36px; height: 36px; }
    .success-screen h2 {
      margin: 0 0 8px;
      font-size: 22px;
      color: var(--navy);
    }
    .success-screen p {
      margin: 0;
      color: var(--text-muted);
      font-size: 14px;
    }

    /* Tablet */
    @media (min-width: 768px) {
      .app { max-width: 720px; }
      .main { padding: var(--space-5); }
      .upload-grid { grid-template-columns: repeat(3, 1fr); }
      .hero-card__title { font-size: 26px; }
      .footer { max-width: 720px; }
      .toast { max-width: calc(720px - 32px); }
      .site-footer { padding-left: 24px; padding-right: 24px; }
    }

    /* Laptop / Desktop — portal chrome like screenshot */
    @media (min-width: 1024px) {
      :root { --header-h: 64px; }

      .portal-header {
        padding: 0 28px 0 0;
        height: var(--header-h);
      }
      .portal-header__menu { display: none; }
      .portal-header__logo {
        width: auto;
        height: 32px;
        max-height: none;
        margin-left: 24px;
      }
      .portal-link { display: inline-flex; }
      .portal-header__right { gap: 4px; }
      .portal-user__greet { display: inline; }

      .nav-overlay { display: none !important; }
      .portal-sidebar {
        position: sticky;
        top: var(--header-h);
        height: calc(100dvh - var(--header-h));
        width: 240px;
        flex-shrink: 0;
        transform: none !important;
        box-shadow: none;
        z-index: 1;
        padding: 24px 16px;
      }

      .portal-body { align-items: stretch; }

      .page-head {
        display: block;
        padding: 20px 28px 0;
      }
      .page-head__crumb {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        color: var(--text-muted);
        margin: 0 0 6px;
      }
      .page-head__crumb svg { width: 14px; height: 14px; }
      .page-head__title {
        margin: 0;
        font-size: 26px;
        font-weight: 700;
        color: #0f172a;
        letter-spacing: -0.02em;
      }

      .app {
        max-width: none;
        margin: 0;
        padding-bottom: 0;
        display: flex;
        flex-direction: column;
        flex: 1;
      }

      .toolbar {
        display: flex;
        justify-content: flex-end;
        padding: 0 28px;
        margin-top: 8px;
      }

      .hero-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
        padding: 28px 32px;
        margin: 12px 28px 0;
      }

      .progress {
        position: static;
        margin: 16px 28px 0;
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 16px 18px;
        box-shadow: var(--shadow);
      }

      .main {
        padding: 20px 28px 24px;
        flex: 1;
      }
      .hero-card__title { font-size: 28px; }
      .hero-card__desc { max-width: 42ch; font-size: 15px; }

      .card {
        padding: 24px;
        margin-bottom: 20px;
        border-radius: 16px;
      }
      .card__title { font-size: 17px; }

      .form-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px 20px;
      }
      .form-grid-2 > .field { margin-bottom: 0; }
      .form-span-2 { grid-column: span 2; }

      .cards-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        align-items: start;
      }
      .cards-row > .card { margin-bottom: 0; }

      .upload-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
      }
      .upload { min-height: 140px; }

      .ref-blocks {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
      }
      .ref-block + .ref-block {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
        padding-left: 20px;
        border-left: 1px dashed var(--border);
      }

      .loan-layout {
        display: grid;
        grid-template-columns: 1.4fr 1fr;
        gap: 20px;
        align-items: start;
      }
      .loan-layout > .card { margin-bottom: 0; }
      .emi-box__value { font-size: 32px; }

      .footer {
        position: sticky;
        left: auto;
        transform: none;
        bottom: 0;
        max-width: none;
        width: 100%;
        grid-template-columns: auto auto 1fr;
        padding: 16px 28px;
        box-shadow: 0 -8px 24px rgba(11, 27, 77, 0.04);
      }
      .btn { min-height: 48px; min-width: 120px; }
      .btn--primary { min-width: 160px; }

      .site-footer {
        padding: 12px 28px;
        text-align: left;
      }

      .toast {
        left: auto;
        right: 28px;
        transform: translateY(12px);
        bottom: 110px;
        width: auto;
        max-width: 360px;
        text-align: left;
      }
      .toast.is-show { transform: translateY(0); }

      .success-screen { padding: 64px 24px 16px; }
    }

    @media (min-width: 1280px) {
      .portal-sidebar { width: 260px; }
      .main { padding-left: 32px; padding-right: 32px; }
    }

@media (max-width: 1023px) {
  .portal.is-loan-view .site-footer {
    margin-bottom: calc(var(--footer-h) + var(--safe-b));
  }
}

/* Language toggle — always visible */
.portal-lang {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
  transition: background .2s ease;
  flex-shrink: 0;
}
.portal-lang:hover { background: var(--bg); }
.portal-lang svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
.portal-lang__code {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.portal-lang__label { display: none; }
@media (max-width: 1023px) {
  .portal-lang {
    padding: 6px;
    gap: 0;
  }
  .portal-lang svg { display: none; }
  .portal-icon {
    width: 36px;
    height: 36px;
  }
  .portal-avatar {
    width: 32px;
    height: 32px;
  }
  .portal-user { margin-left: 2px; gap: 6px; }
}
@media (max-width: 380px) {
  .portal-header__logo {
    width: min(120px, calc(100vw - 168px));
    max-height: 24px;
  }
  .portal-header__menu {
    width: 40px;
    height: 40px;
  }
}
@media (min-width: 1024px) {
  .portal-lang__label { display: inline; }
}

/* ========== VIEWS ========== */
.view[hidden] { display: none !important; }
.view-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
@media (min-width: 1024px) {
  .view-body { padding: 16px 28px 28px; }
}

/* Search filters */
.filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px 16px;
}
.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: end;
  padding-top: 4px;
}
.filter-actions .btn {
  min-height: 44px;
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.filter-actions .btn svg { width: 18px; height: 18px; }
@media (min-width: 720px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .filter-actions { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .filter-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Data table */
.table-card__head { margin-bottom: 12px; }
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 860px;
}
.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th {
  background: #F8FAFC;
  color: #475569;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #F8FAFF; }
.data-table .mono {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--navy);
}
.table-empty {
  margin: 20px 0 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.table-empty[hidden] { display: none; }
.btn-link {
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  padding: 4px 0;
}
.btn-link:hover { text-decoration: underline; }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}
.status-pill--draft { background: #F1F5F9; color: #475569; }
.status-pill--pending { background: #FEF3C7; color: #B45309; }
.status-pill--review { background: #DBEAFE; color: #1D4ED8; }
.status-pill--approved { background: #D1FAE5; color: #047857; }
.status-pill--rejected { background: #FEE2E2; color: #B91C1C; }
.status-pill--disbursed { background: #E0E7FF; color: #3730A3; }

/* Incoming / upcoming */
.stat-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .stat-row { grid-template-columns: repeat(3, 1fr); }
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-card__label {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-card__value {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.upcoming-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 16px 4px;
  border-bottom: 1px solid var(--border);
}
.upcoming-item:last-child { border-bottom: 0; }
.upcoming-item__date {
  text-align: center;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 12px;
  padding: 8px 6px;
  line-height: 1.15;
}
.upcoming-item__day {
  display: block;
  font-size: 20px;
  font-weight: 700;
}
.upcoming-item__month {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.upcoming-item__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.upcoming-item__meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.upcoming-item__time {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .upcoming-item {
    grid-template-columns: 64px 1fr;
  }
  .upcoming-item__time {
    grid-column: 2;
  }
}

/* ========== LOGIN ========== */
.login-page {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(0, 68, 252, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(11, 27, 77, 0.1), transparent 50%),
    var(--bg);
}
.login {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  gap: 20px;
}
.login__card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px 28px;
  box-shadow: 0 16px 40px rgba(11, 27, 77, 0.1);
}
.login__brand {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.login__logo {
  height: 36px;
  width: auto;
  margin: 0 auto 12px;
}
.login__portal {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.login__title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
  text-align: center;
}
.login__desc {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}
.login__form .field { margin-bottom: 20px; }
.login__submit {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}
.login__submit:hover { background: var(--primary-dark); }
.login__footer {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.login__footer strong { color: var(--navy); font-weight: 600; }
.login__footer a {
  color: inherit;
  text-decoration: none;
}
.login__footer a:hover { text-decoration: underline; }

/* Compare chip → UI v2 (investor A/B) */
.compare-chip {
  position: fixed;
  left: 12px;
  bottom: calc(12px + var(--safe-b));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(11, 27, 77, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.compare-chip:hover { background: #071433; }
.site-footer__sep {
  margin: 0 6px;
  color: var(--text-muted);
}
.site-footer__compare {
  color: var(--primary) !important;
  font-weight: 600;
  text-decoration: none;
}
.site-footer__compare:hover { text-decoration: underline; }
@media (min-width: 1024px) {
  .compare-chip {
    bottom: 16px;
    left: 16px;
  }
  .portal.is-loan-view .compare-chip {
    bottom: 16px;
  }
}
@media (max-width: 1023px) {
  .portal.is-loan-view .compare-chip {
    bottom: calc(var(--footer-h) + 12px + var(--safe-b));
  }
}
