/* Rory member web portal — the app's design language (app/lib/style.dart):
   Onest, roryBlue controls for every tenant, tenant palette only in the
   lockup and tinted chips, radii 12/16/20. Layout follows the servicing
   two-column shape (loan header, pay column left, payments right). */

:root {
  --rory-blue: #2e3dff;
  --rory-blue-deep: #1b24c4;
  --rory-periwinkle: #98a2ff;
  --rory-foam: #eaecff;
  --ink: #0a1029;
  --muted: #6e7391;
  --border: #e4e7f1;
  --border-subtle: #edeff7;
  --success: #17b26a;
  --success-deep: #0d8a52;
  --success-soft: #e6f7ef;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --tenant-brand: #1272b9;
  --tenant-soft: #eaf3fa;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.45;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 26px; background: var(--surface); border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; z-index: 5; }
.lockup { display: flex; align-items: center; gap: 12px; }
/* Initials tile is only the fallback; a real logo renders at its natural
   aspect ratio, untiled, and may take horizontal space. */
.fi-mark { width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--tenant-brand); color: #fff; font-weight: 800; font-size: 17px; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; }
.fi-mark.has-logo { width: auto; max-width: 180px; height: 42px; background: none; border-radius: 0; overflow: visible; }
.fi-mark.has-logo img { height: 100%; width: auto; max-width: 180px; object-fit: contain; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { border: 0; background: none; color: var(--ink); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--border-subtle); }
.member-chip { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--rory-foam); color: var(--rory-blue-deep); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-family: inherit; }

/* Profile menu */
.profile-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(10, 16, 41, 0.12); width: 230px; padding: 6px; z-index: 10; }
.menu-head { padding: 10px 12px; font-weight: 800; display: flex; flex-direction: column; border-bottom: 1px solid var(--border-subtle); margin-bottom: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: 10px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--rory-foam); color: var(--rory-blue-deep); }
.menu-item .ic { width: 16px; height: 16px; }

/* Layout */
.page { max-width: 1020px; margin: 0 auto; padding: 22px 20px 44px; }
.columns { display: flex; gap: 18px; margin-top: 18px; align-items: flex-start; }
.col-left { flex: 5; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.col-right { flex: 6; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Loan header */
.loan-head { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.loan-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.loan-provided { font-size: 17px; font-weight: 800; margin-top: 2px; }
.link { color: var(--rory-blue-deep); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link .ic { width: 15px; height: 15px; }
.link-btn { border: 0; background: none; color: var(--rory-blue-deep); font-weight: 700; font-size: 14px; cursor: pointer; padding: 4px; font-family: inherit; }

/* Pay card */
.pay-card { padding: 0; overflow: hidden; gap: 0; }
.status-banner { display: flex; align-items: center; gap: 10px; padding: 13px 20px; font-weight: 700; }
.status-banner.ok { background: var(--success-soft); color: var(--success-deep); }
.status-banner.due { background: var(--rory-foam); color: var(--rory-blue-deep); }
.pay-body { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.due-row { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.due-amount { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; }
.due-when { font-size: 15px; font-weight: 600; color: var(--muted); }
.scheduled { color: var(--muted); font-style: italic; }
.pay-points { text-align: center; color: var(--muted); font-size: 13px; }
.pay-points strong, .pts-strong, .streak-copy strong { color: var(--rory-blue-deep); }

/* Buttons */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 12px 18px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--rory-blue); border-color: var(--rory-blue); color: #fff; }
.btn.primary:hover { background: var(--rory-blue-deep); }
.btn.big { padding: 15px 18px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.outline { border-color: var(--rory-blue); color: var(--rory-blue-deep); background: none; }
.btn.ghost { border-style: dashed; color: var(--muted); background: none; }
.btn .ic { width: 16px; height: 16px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; width: fit-content; }
.ok-pill { background: var(--success-soft); color: var(--success-deep); }

/* Accordions */
.accordion { padding: 0; gap: 0; }
.accordion-head { width: 100%; display: flex; align-items: center; justify-content: space-between; border: 0; background: none; font: inherit; font-weight: 800; font-size: 16px; padding: 17px 20px; cursor: pointer; color: var(--ink); }
.accordion .chev { color: var(--muted); transition: transform 0.15s; }
.accordion.collapsed .chev { transform: rotate(-90deg); }
.accordion.collapsed .accordion-body { display: none; }
.accordion-body { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 12px; }

/* Payment methods */
.method-row { display: flex; align-items: center; gap: 12px; }
.method-ico { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--tenant-soft); color: var(--tenant-brand); display: flex; align-items: center; justify-content: center; flex: none; }
.method-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.method-name { font-weight: 700; }
.method-sub { color: var(--muted); font-size: 13px; }
.mask::before { content: "\2022\2022\2022\2022\00a0"; color: var(--muted); }
.check-address { font-weight: 700; line-height: 1.6; margin: 0; }

/* Payments ledger */
.payments-list { display: flex; flex-direction: column; }
.pay-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.pay-row:last-child { border-bottom: 0; }
.pay-ico { width: 38px; height: 38px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--border-subtle); color: var(--muted); }
.pay-ico.next { background: var(--rory-foam); color: var(--rory-blue-deep); }
.pay-ico .ic { width: 16px; height: 16px; }
.pay-label { flex: 1; min-width: 0; font-weight: 600; }
.pay-amount { font-weight: 800; font-variant-numeric: tabular-nums; }

/* Streak — the whole term as year rows of month cells, filling in over time */
.streak-copy { margin: 0; font-weight: 800; font-size: 16px; }
.streak-grid { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.streak-year { display: flex; align-items: center; gap: 8px; }
.streak-cells { display: flex; gap: 6px; flex: 1; }
.cell { width: 21px; height: 21px; border-radius: 50%; border: 2px solid var(--border); flex: none; display: flex; align-items: center; justify-content: center; color: #fff; }
.cell .ic { width: 12px; height: 12px; stroke-width: 3; }
.cell.done { background: var(--success); border-color: var(--success); }
.cell.now { border-color: var(--rory-blue); background: var(--rory-foam); }
.streak-label { font-size: 13px; font-weight: 600; color: var(--muted); width: 44px; text-align: right; flex: none; }

/* Footer */
.foot { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; color: var(--muted); font-size: 13px; }
.foot-brand { display: flex; align-items: center; gap: 8px; }
.foot-brand img { width: 22px; height: 22px; border-radius: 6px; }
.tenant-switch { display: flex; align-items: center; gap: 8px; }
.tenant-switch select { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font: inherit; background: var(--surface); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 16, 41, 0.45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: 440px; max-width: 100%; max-height: 90vh; overflow-y: auto; padding: 26px; position: relative; }
.modal-x { position: absolute; top: 14px; right: 14px; border: 0; background: var(--border-subtle); border-radius: 50%; width: 32px; height: 32px; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.modal-x .ic { width: 15px; height: 15px; }
.modal h3 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.modal .sub { color: var(--muted); margin: 0 0 18px; }
.choice { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 10px; cursor: pointer; font-weight: 700; }
.choice:hover { border-color: var(--rory-blue); }
.choice .sub-line { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.choice .pts { color: var(--rory-blue-deep); font-size: 13px; font-weight: 800; white-space: nowrap; }
.amount-input { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 14px; font-size: 22px; font-weight: 800; }
.amount-input input { border: 0; outline: 0; font: inherit; width: 100%; }
.confirm-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border-subtle); font-size: 14px; }
.confirm-row:last-of-type { border-bottom: 0; margin-bottom: 14px; }
.confirm-row .v { font-weight: 800; }
.success-img { width: 130px; margin: 0 auto 8px; display: block; }
.success-pts { text-align: center; background: var(--rory-foam); color: var(--rory-blue-deep); font-weight: 800; border-radius: 999px; padding: 8px 16px; width: fit-content; margin: 0 auto 18px; }
.center { text-align: center; }

/* Section modals (vehicle, rewards, journey from the profile menu) */
.section-img { width: 100%; border-radius: var(--r-md); object-fit: contain; margin-bottom: 10px; }
.stat-row { display: flex; gap: 10px; margin-bottom: 12px; }
.stat { flex: 1; background: var(--border-subtle); border-radius: var(--r-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-weight: 800; font-variant-numeric: tabular-nums; }
.ok-text { color: var(--success-deep); }
.mini-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-subtle); font-size: 14px; font-weight: 600; }
.mini-row:last-child { border-bottom: 0; }
.mini-row .pts { color: var(--rory-blue-deep); font-weight: 800; white-space: nowrap; }
.mini-row .done-label { color: var(--success-deep); }
.mini-row .q { display: flex; align-items: center; gap: 10px; }
.mini-row .q .ic { width: 15px; height: 15px; color: var(--rory-blue-deep); }
.insurance-line { display: flex; align-items: center; gap: 8px; color: var(--success-deep); font-weight: 700; font-size: 14px; }
.insurance-line .ic { width: 16px; height: 16px; }
.progress { height: 8px; border-radius: 999px; background: var(--border-subtle); overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--rory-blue); }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 30; font-weight: 600; }

@media (max-width: 860px) {
  .columns { flex-direction: column; }
  .loan-head { flex-direction: column; align-items: flex-start; }
}
