/* TripLedger consolidated premium UI stylesheet. */
/* ==========================================================================
   TripLedger — Design Tokens
   Single source of truth. Change values here, not in components.
   ========================================================================== */

:root {
  /* ---- Color: core palette ---- */
  --color-paper:   #F6F5F1;  /* app background */
  --color-ink:     #17202A;  /* primary text */
  --color-harbor:  #0E5E6F;  /* primary action, brand */
  --color-tide:    #E8F1F2;  /* primary tint, selected states */
  --color-ember:   #C2552D;  /* money out: expenses, owed */
  --color-moss:    #2F7D5B;  /* money in: deposits, settled, received */

  /* ---- Color: neutrals ---- */
  --color-surface:      #FFFFFF;
  --color-surface-2:    #FBFAF7;
  --color-line:         #E4E1D8;
  --color-line-strong:  #CFCABD;
  --color-muted:        #6B7280;
  --color-faint:        #9AA1AB;

  /* ---- Color: semantic states ---- */
  --color-harbor-hover: #0A4D5C;
  --color-harbor-press: #083D4A;
  --color-ember-tint:   #F8E9E2;
  --color-moss-tint:    #E4F1EA;
  --color-amber:        #B7791F;
  --color-amber-tint:   #FBF1DE;
  --color-danger:       #B42318;
  --color-danger-tint:  #FCE8E6;
  --color-focus:        #0E5E6F;

  /* ---- Typography ---- */
  --font-display: "Newsreader", "Georgia", "Times New Roman", serif;
  --font-ui:      "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono-num: var(--font-ui); /* tabular figures via font-variant-numeric */

  /* Type scale (1.200 minor third, rounded to px for predictability) */
  --text-xs:   12px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   16px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;
  --text-3xl:  36px;
  --text-4xl:  48px;

  --leading-tight:  1.2;
  --leading-snug:   1.35;
  --leading-normal: 1.5;

  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semibold: 600;
  --weight-bold:    700;

  --tracking-tight: -0.015em;
  --tracking-normal: 0;

  /* ---- Spacing (4px base) ---- */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ---- Radius (deliberately few levels) ---- */
  --radius-sm: 6px;   /* inputs, chips */
  --radius-md: 10px;  /* buttons, small panels */
  --radius-lg: 14px;  /* panels, sheets */
  --radius-pill: 999px;

  /* ---- Elevation: borders first, shadows only for floating layers ---- */
  --shadow-float: 0 12px 32px -8px rgba(23, 32, 42, 0.18), 0 2px 6px rgba(23, 32, 42, 0.06);
  --shadow-menu:  0 6px 18px -6px rgba(23, 32, 42, 0.16);

  /* ---- Layout ---- */
  --rail-width: 232px;
  --content-max: 1200px;
  --topbar-height: 64px;
  --tabbar-height: 64px;
  --touch-min: 44px;

  /* ---- Motion ---- */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 320ms;
}

/* Dark theme token overrides (applied via [data-theme="dark"]) */
[data-theme="dark"] {
  --color-paper:   #0F1419;
  --color-ink:     #E8EBEF;
  --color-harbor:  #5FB6C6;
  --color-tide:    #15262B;
  --color-ember:   #E88A66;
  --color-moss:    #6CC29A;
  --color-surface:      #171E25;
  --color-surface-2:    #131A20;
  --color-line:         #26313B;
  --color-line-strong:  #34414D;
  --color-muted:        #98A2AE;
  --color-faint:        #6B7682;
  --color-harbor-hover: #7EC7D5;
  --color-ember-tint:   #2E1C15;
  --color-moss-tint:    #15281F;
  --color-amber:        #E0A94A;
  --color-amber-tint:   #2B2212;
  --color-danger:       #F07A6E;
  --color-danger-tint:  #2E1716;
  --color-focus:        #7EC7D5;
  --shadow-float: 0 12px 32px -8px rgba(0, 0, 0, 0.6);
  --shadow-menu:  0 6px 18px -6px rgba(0, 0, 0, 0.5);
}


/* ==========================================================================
   TripLedger — Base + Components
   Depends on tokens.css. Load tokens first.
   ========================================================================== */

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-ink);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--color-harbor); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: var(--leading-tight); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--color-line); margin: var(--space-6) 0; }

/* Visible focus for keyboard users */
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: 4px; }

/* Utility: monetary figures */
.num { font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1; white-space: nowrap; }
.in  { color: var(--color-moss); }
.out { color: var(--color-ember); }

/* Screen-reader only */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ==========================================================================
   Layout shell
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--rail-width) 1fr; min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: var(--space-8);
  padding: var(--space-6) var(--space-4);
  background: var(--color-surface);
  border-right: 1px solid var(--color-line);
}
.brand { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2); font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--color-ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 40px; padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-muted); font-weight: var(--weight-medium);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav-link:hover { background: var(--color-surface-2); color: var(--color-ink); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--color-tide); color: var(--color-harbor); }
.nav-link .icon { width: 18px; height: 18px; flex: none; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--color-ember); color: #fff; font-size: var(--text-xs); font-weight: var(--weight-semibold); display: inline-flex; align-items: center; justify-content: center; }
.nav-label { font-size: var(--text-xs); color: var(--color-faint); padding: var(--space-4) var(--space-3) var(--space-2); font-weight: var(--weight-medium); }

.rail-foot { margin-top: auto; padding-top: var(--space-4); border-top: 1px solid var(--color-line); }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-4);
  height: var(--topbar-height); padding: 0 var(--space-8);
  background: color-mix(in srgb, var(--color-paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--color-line);
}
.topbar-title { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }

.content { max-width: var(--content-max); margin: 0 auto; padding: var(--space-8); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-8); flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-medium); letter-spacing: -0.02em; }
.page-sub { color: var(--color-muted); margin-top: var(--space-2); }

/* Mobile tab bar: hidden on desktop */
.tabbar { display: none; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius-md);
  font-weight: var(--weight-medium); font-size: var(--text-base);
  text-decoration: none; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .icon { width: 18px; height: 18px; }

.btn-primary { background: var(--color-harbor); color: #fff; }
.btn-primary:hover { background: var(--color-harbor-hover); }
.btn-primary:active { background: var(--color-harbor-press); }

.btn-secondary { background: var(--color-surface); border-color: var(--color-line-strong); color: var(--color-ink); }
.btn-secondary:hover { background: var(--color-surface-2); border-color: var(--color-muted); }

.btn-ghost { background: transparent; color: var(--color-muted); }
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-ink); }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }

.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-sm); }
.btn-icon { width: 40px; padding: 0; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.field-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-ink); }
.field-hint { font-size: var(--text-xs); color: var(--color-muted); }
.field-error { font-size: var(--text-xs); color: var(--color-danger); }

.input, .select, .textarea {
  width: 100%; min-height: var(--touch-min); padding: 0 var(--space-3);
  background: var(--color-surface); border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.textarea { padding: var(--space-3); min-height: 96px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--color-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--color-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--color-harbor);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-harbor) 18%, transparent);
}
.input[aria-invalid="true"] { border-color: var(--color-danger); }

/* Money input: amount is right-aligned, currency fixed on the left */
.money-input { position: relative; }
.money-input .currency { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--color-muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.money-input .input { padding-left: 52px; text-align: right; font-variant-numeric: tabular-nums; font-size: var(--text-lg); font-weight: var(--weight-medium); }

.segmented { display: inline-grid; grid-auto-flow: column; padding: 3px; gap: 2px; background: var(--color-surface-2); border: 1px solid var(--color-line); border-radius: var(--radius-md); }
.segmented button { min-height: 34px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-muted); font-weight: var(--weight-medium); font-size: var(--text-sm); }
.segmented button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); border: 1px solid var(--color-line); }

.check { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--text-sm); }
.check input { width: 18px; height: 18px; accent-color: var(--color-harbor); }

/* ==========================================================================
   Surfaces & panels
   ========================================================================== */
.panel { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--color-line); }
.panel-title { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.panel-body { padding: var(--space-6); }
.panel-foot { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-line); color: var(--color-muted); font-size: var(--text-sm); }

/* ==========================================================================
   Badges, chips, avatars
   ========================================================================== */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--weight-semibold); background: var(--color-surface-2); color: var(--color-muted); border: 1px solid var(--color-line); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-open    { background: var(--color-amber-tint); color: var(--color-amber); border-color: transparent; }
.badge-settled { background: var(--color-moss-tint); color: var(--color-moss); border-color: transparent; }
.badge-owed    { background: var(--color-ember-tint); color: var(--color-ember); border-color: transparent; }
.badge-draft   { background: var(--color-surface-2); color: var(--color-muted); }

.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; background: var(--color-tide); color: var(--color-harbor); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: 0; }
.avatar-lg { width: 44px; height: 44px; font-size: var(--text-sm); }

/* ==========================================================================
   Tables (ledger-style financial rows)
   ========================================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-weight: var(--weight-medium); color: var(--color-muted); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); white-space: nowrap; }
.table td { padding: var(--space-4); border-bottom: 1px solid var(--color-line); vertical-align: middle; }
.table tbody tr:hover { background: var(--color-surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-num { text-align: right; }
.table tfoot td { font-weight: var(--weight-semibold); border-top: 1px solid var(--color-line-strong); border-bottom: 0; background: var(--color-surface-2); }

/* A ledger row: a thin colored rule on the left shows direction at a glance */
.ledger-row { position: relative; }
.ledger-row td:first-child { padding-left: calc(var(--space-4) + 6px); }
.ledger-row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--color-line-strong); }
.ledger-row.is-in::before  { background: var(--color-moss); }
.ledger-row.is-out::before { background: var(--color-ember); }

/* ==========================================================================
   Stat / figure blocks
   ========================================================================== */
.stat-label { font-size: var(--text-sm); color: var(--color-muted); }
.stat-value { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-medium); letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; }
.stat-delta { font-size: var(--text-xs); color: var(--color-muted); }

/* ==========================================================================
   Lists
   ========================================================================== */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--color-line); }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--color-surface-2); }
.list-main { min-width: 0; flex: 1; }
.list-title { font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { font-size: var(--text-sm); color: var(--color-muted); }

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty { text-align: center; padding: var(--space-12) var(--space-6); color: var(--color-muted); }
.empty-title { color: var(--color-ink); font-weight: var(--weight-semibold); margin-bottom: var(--space-2); }
.empty .btn { margin-top: var(--space-5); }

/* ==========================================================================
   Alerts & toasts
   ========================================================================== */
.alert { display: flex; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); border: 1px solid transparent; }
.alert-danger { background: var(--color-danger-tint); color: var(--color-danger); }
.alert-success { background: var(--color-moss-tint); color: var(--color-moss); }
.alert-info { background: var(--color-tide); color: var(--color-harbor); }

.toast { position: fixed; left: 50%; bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--color-ink); color: var(--color-paper); padding: var(--space-3) var(--space-5); border-radius: var(--radius-md); box-shadow: var(--shadow-float); transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); z-index: 100; font-size: var(--text-sm); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Modal / sheet
   ========================================================================== */
.scrim { position: fixed; inset: 0; background: rgba(15, 20, 25, 0.42); display: none; z-index: 50; }
.scrim.is-open { display: block; }
.sheet {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -48%); opacity: 0;
  width: min(480px, calc(100% - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float); display: none; z-index: 60;
}
.sheet.is-open { display: block; animation: sheet-in var(--dur-slow) var(--ease-out) forwards; }
@keyframes sheet-in { to { opacity: 1; transform: translate(-50%, -50%); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--color-line); }
.sheet-body { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); }
.sheet-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-line); }

/* ==========================================================================
   Skeleton loading
   ========================================================================== */
.skeleton { background: linear-gradient(90deg, var(--color-line) 25%, var(--color-surface-2) 50%, var(--color-line) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .content { padding: var(--space-6); }
}

@media (max-width: 720px) {
  :root { --topbar-height: 56px; }
  body { padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 0 var(--space-4); padding-top: env(safe-area-inset-top, 0px); height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px)); }
  .content { padding: var(--space-4); }
  .page-title { font-size: var(--text-2xl); }
  .stat-value { font-size: var(--text-2xl); }

  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--color-line);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--color-faint); font-size: 11px; font-weight: var(--weight-medium); min-height: var(--touch-min);
  }
  .tabbar a .icon { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--color-harbor); }
  .tabbar a:hover { text-decoration: none; }

  .sheet { top: auto; bottom: 0; left: 0; transform: none; width: 100%; max-height: 88vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; opacity: 1; }
  .sheet.is-open { animation: sheet-up var(--dur-slow) var(--ease-out) forwards; }
  @keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}


/* ==========================================================================
   TripLedger — Page-level composition
   Layout patterns used across screens. Components live in app.css.
   ========================================================================== */

/* ---- Auth screens (login / register) ---- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside { background: var(--color-harbor); color: #F6F5F1; padding: var(--space-12); display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside .brand { color: #F6F5F1; }
.auth-quote { font-family: var(--font-display); font-size: var(--text-3xl); line-height: 1.15; font-weight: var(--weight-regular); max-width: 16ch; }
.auth-quote-by { font-size: var(--text-sm); opacity: .75; margin-top: var(--space-4); }
.auth-main { display: grid; place-items: center; padding: var(--space-8); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--space-6); }
.auth-card h1 { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-medium); }
.auth-card .lead { color: var(--color-muted); margin-top: calc(var(--space-2) * -1); }
.auth-switch { text-align: center; color: var(--color-muted); font-size: var(--text-sm); }
.divider-text { display: flex; align-items: center; gap: var(--space-3); color: var(--color-faint); font-size: var(--text-xs); }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--color-line); }

@media (max-width: 880px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

/* ---- Dashboard: statement strip ---- */
.statement { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-8); padding: var(--space-8); margin-bottom: var(--space-6); }
.statement-figure { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: var(--weight-medium); letter-spacing: -0.02em; margin: var(--space-2) 0; line-height: 1; }
.statement-lines { margin: 0; display: flex; flex-direction: column; justify-content: center; }
.statement-lines > div { display: flex; justify-content: space-between; align-items: baseline; padding: var(--space-3) 0; border-bottom: 1px dashed var(--color-line-strong); }
.statement-lines > div:last-child { border-bottom: 0; }
.statement-lines dt { color: var(--color-muted); font-size: var(--text-sm); }
.statement-lines dd { margin: 0; font-weight: var(--weight-semibold); font-size: var(--text-md); }

/* ---- Counts row ---- */
.counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-bottom: var(--space-6); }
.count { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); }
.count-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--color-surface-2); color: var(--color-muted); }
.count-icon .icon { width: 18px; height: 18px; }
.count-value { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-medium); margin-top: 2px; }

/* ---- Dashboard grid ---- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.dash-wide { grid-column: 1 / -1; }
.dash-grid > .panel { display: flex; flex-direction: column; }
.dash-grid > .panel > .list, .dash-grid > .panel > .table-wrap { flex: 1; }

/* Split bar: spending categories */
.split-bar { display: flex; height: 12px; border-radius: var(--radius-pill); overflow: hidden; gap: 2px; background: var(--color-line); }
.split-bar span { display: block; height: 100%; }
.legend { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-6); font-size: var(--text-sm); color: var(--color-muted); }
.legend li { display: flex; align-items: center; gap: var(--space-2); }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.legend b { margin-left: auto; color: var(--color-ink); font-weight: var(--weight-semibold); }

/* Quick action + list icons */
.qa-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--color-tide); color: var(--color-harbor); }
.qa-icon .icon, .chev { width: 18px; height: 18px; }
.chev { color: var(--color-faint); }
.list-amt { font-weight: var(--weight-semibold); }
.list a.list-item { color: inherit; }
.list a.list-item:hover { text-decoration: none; }

/* Timeline (recent activity) */
.timeline { list-style: none; margin: 0; padding: var(--space-5) var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); position: relative; }
.timeline li { position: relative; padding-left: var(--space-5); }
.timeline li::before { content: ""; position: absolute; left: 0; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-harbor); box-shadow: 0 0 0 3px var(--color-tide); }
.timeline p { font-size: var(--text-sm); }
.timeline time { font-size: var(--text-xs); color: var(--color-faint); }
.timeline b { font-weight: var(--weight-semibold); }

/* ---- Trips overview ---- */
.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-5); }
.trip-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6); background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); color: inherit; transition: border-color var(--dur-fast) var(--ease-out); }
.trip-card:hover { border-color: var(--color-line-strong); text-decoration: none; }
.trip-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.trip-name { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-medium); }
.trip-dates { font-size: var(--text-sm); color: var(--color-muted); display: flex; align-items: center; gap: 6px; }
.trip-dates .icon { width: 14px; height: 14px; }
.trip-figs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-line); }
.trip-figs small { display: block; color: var(--color-muted); font-size: var(--text-xs); }
.trip-figs strong { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.progress { height: 4px; border-radius: var(--radius-pill); background: var(--color-line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--color-harbor); border-radius: inherit; }

/* ---- Create / edit trip & forms ---- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-6); align-items: start; }
.form-stack { display: flex; flex-direction: column; gap: var(--space-6); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-aside { position: sticky; top: calc(var(--topbar-height) + var(--space-6)); }
.form-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--color-line); }
.summary-list { display: flex; flex-direction: column; gap: var(--space-3); font-size: var(--text-sm); }
.summary-list div { display: flex; justify-content: space-between; gap: var(--space-3); }
.summary-list dt, .summary-list span:first-child { color: var(--color-muted); }

/* Member chips for selection */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: 0 var(--space-3) 0 6px; border: 1px solid var(--color-line-strong); border-radius: var(--radius-pill); background: var(--color-surface); font-size: var(--text-sm); cursor: pointer; }
.chip .avatar { width: 24px; height: 24px; font-size: 10px; }
.chip[aria-pressed="true"] { border-color: var(--color-harbor); background: var(--color-tide); color: var(--color-harbor); }

/* Split preview: who pays how much */
.split-list { display: flex; flex-direction: column; border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden; }
.split-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); background: var(--color-surface); }
.split-row:last-child { border-bottom: 0; }
.split-row .list-main { display: flex; flex-direction: column; }
.split-row .num { font-weight: var(--weight-semibold); }

/* ---- Member & deposit ---- */
.member-hero { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-6); }
.member-hero .avatar { width: 56px; height: 56px; font-size: var(--text-lg); }
.balance-tile { padding: var(--space-6); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-line); }
.balance-tile .stat-value { font-size: var(--text-2xl); }
.balance-tile.is-owed { background: var(--color-ember-tint); border-color: transparent; }
.balance-tile.is-owed .stat-value { color: var(--color-ember); }
.balance-tile.is-credit { background: var(--color-moss-tint); border-color: transparent; }
.balance-tile.is-credit .stat-value { color: var(--color-moss); }

/* ---- Expense: split type selector ---- */
.split-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.split-option { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4); border: 1px solid var(--color-line-strong); border-radius: var(--radius-md); background: var(--color-surface); text-align: left; min-height: 72px; }
.split-option strong { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.split-option small { color: var(--color-muted); font-size: var(--text-xs); }
.split-option[aria-pressed="true"] { border-color: var(--color-harbor); box-shadow: inset 0 0 0 1px var(--color-harbor); background: var(--color-tide); }

/* ---- Transactions: filter bar ---- */
.toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-5); }
.toolbar .input { max-width: 280px; }
.toolbar-spacer { flex: 1; }
.totals-strip { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: var(--color-surface); margin-bottom: var(--space-5); overflow: hidden; }
.totals-strip > div { padding: var(--space-4) var(--space-5); border-right: 1px solid var(--color-line); }
.totals-strip > div:last-child { border-right: 0; }

/* ---- Ledger: running balance ---- */
.ledger-table td.balance { font-weight: var(--weight-semibold); }
.ledger-table tr.is-opening td { color: var(--color-muted); font-style: normal; background: var(--color-surface-2); }
.ledger-table .sub { display: block; font-size: var(--text-xs); color: var(--color-faint); }

/* ---- Settlement ---- */
.settle-hero { display: grid; grid-template-columns: 1fr auto; gap: var(--space-6); align-items: center; padding: var(--space-8); }
.settle-hero h1 { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-medium); }
.transfer { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-4); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--color-line); }
.transfer:last-child { border-bottom: 0; }
.transfer-flow { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.transfer-line { flex: 1; height: 1px; background: repeating-linear-gradient(90deg, var(--color-line-strong) 0 6px, transparent 6px 12px); position: relative; min-width: 24px; }
.transfer-line::after { content: ""; position: absolute; right: -1px; top: -3px; border: 4px solid transparent; border-left: 6px solid var(--color-line-strong); border-right: 0; }
.transfer-amount { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-medium); }

/* ---- Notifications ---- */
.notice { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-4); align-items: start; padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--color-line); }
.notice:last-child { border-bottom: 0; }
.notice.is-unread { background: color-mix(in srgb, var(--color-tide) 55%, transparent); }
.notice-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-harbor); margin-top: 8px; }
.notice p { font-size: var(--text-sm); }
.notice time { font-size: var(--text-xs); color: var(--color-faint); white-space: nowrap; }

/* ---- Profile & settings ---- */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: var(--space-8); align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-height) + var(--space-6)); display: flex; flex-direction: column; gap: 2px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--color-line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row h3 { font-size: var(--text-base); font-weight: var(--weight-medium); }
.setting-row p { font-size: var(--text-sm); color: var(--color-muted); margin-top: 2px; }

/* Toggle switch */
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: var(--radius-pill); background: var(--color-line-strong); transition: background var(--dur-base) var(--ease-out); }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform var(--dur-base) var(--ease-out); }
.switch input:checked + span { background: var(--color-harbor); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ==========================================================================
   Responsive composition
   ========================================================================== */
@media (max-width: 1100px) {
  .counts { grid-template-columns: repeat(2, 1fr); }
  .form-layout { grid-template-columns: 1fr; }
  .form-aside { position: static; }
}

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
  .statement { grid-template-columns: 1fr; gap: var(--space-6); padding: var(--space-6); }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .totals-strip { grid-template-columns: 1fr; }
  .totals-strip > div { border-right: 0; border-bottom: 1px solid var(--color-line); }
  .totals-strip > div:last-child { border-bottom: 0; }
}

@media (max-width: 720px) {
  .statement-figure { font-size: var(--text-3xl); }
  .counts { gap: var(--space-3); }
  .count { padding: var(--space-3) var(--space-4); }
  .count-value { font-size: var(--text-lg); }
  .form-row { grid-template-columns: 1fr; }
  .split-options { grid-template-columns: 1fr; }
  .trip-grid { grid-template-columns: 1fr; }
  .transfer { grid-template-columns: 1fr; gap: var(--space-3); }
  .settle-hero { grid-template-columns: 1fr; }
  .toolbar .input { max-width: none; }
  .table th, .table td { padding: var(--space-3); }
}

/* ---- Late additions referenced by pages ---- */
.statement-main { display: flex; flex-direction: column; justify-content: center; }
.btn-lg { min-height: 48px; padding: 0 var(--space-6); font-size: var(--text-md); }
.member-cell { display: flex; gap: var(--space-3); align-items: center; }
.dash-grid .table-wrap { overflow: visible; }
.count-icon { color: var(--color-harbor); background: var(--color-tide); }
.page-head .toolbar { margin-bottom: 0; }



/* TripLedger PHP integration bridge: visual layer only */
:root{--ink:var(--color-ink);--muted:var(--color-muted);--line:var(--color-line);--bg:var(--color-paper)}
html,body{min-height:100%;} body{background:var(--color-paper);color:var(--color-ink);font-family:var(--font-ui)}
.redesign-app{min-height:100vh}.redesign-app .main{min-width:0}.redesign-app .content{max-width:1440px}
.redesign-app .container{max-width:none;margin:0;padding:0;min-height:0}
.redesign-app h1,.redesign-app h2,.redesign-app h3{font-family:var(--font-display);letter-spacing:-.025em}
.redesign-app p{line-height:1.6}.redesign-app .muted{color:var(--color-muted)}
.redesign-app .row{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:24px}
.redesign-app .grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:22px 0}
.redesign-app .grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.redesign-app .card,.redesign-app .panel{background:var(--color-surface);border:1px solid var(--color-line);border-radius:var(--radius-xl);padding:22px;box-shadow:var(--shadow-xs)}
.redesign-app .metric{font-size:28px;font-weight:700;color:var(--color-ink);margin-top:8px}
.redesign-app .metric-label,.redesign-app .help{font-size:13px;color:var(--color-muted)}
.redesign-app .btn{display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--radius-md);padding:11px 16px;background:var(--color-harbor);color:white;text-decoration:none;font-weight:600;cursor:pointer}
.redesign-app .btn.secondary{background:var(--color-surface);color:var(--color-ink);border-color:var(--color-line)}
.redesign-app .badge{display:inline-flex;border-radius:999px;padding:5px 9px;background:var(--color-mist);color:var(--color-harbor);font-size:12px;font-weight:600}
.redesign-app .table-wrap{overflow:auto;background:var(--color-surface);border:1px solid var(--color-line);border-radius:var(--radius-xl);margin:18px 0}
.redesign-app table{width:100%;border-collapse:collapse;min-width:620px}
.redesign-app th{font-size:11px;text-transform:uppercase;letter-spacing:.07em;color:var(--color-muted);background:var(--color-paper);font-weight:700}
.redesign-app th,.redesign-app td{padding:15px 18px;text-align:left;border-bottom:1px solid var(--color-line)}
.redesign-app tr:last-child td{border-bottom:0}.redesign-app td{font-size:14px}
.redesign-app .field{margin:0 0 18px}.redesign-app label{display:block;font-size:13px;font-weight:600;margin-bottom:7px;color:var(--color-ink)}
.redesign-app input,.redesign-app select,.redesign-app textarea{width:100%;border:1px solid var(--color-line);border-radius:var(--radius-md);padding:12px 14px;background:white;color:var(--color-ink);font:inherit;outline:none}
.redesign-app input:focus,.redesign-app select:focus,.redesign-app textarea:focus{border-color:var(--color-harbor);box-shadow:0 0 0 3px #0e5e6f18}
.redesign-app .alert{border-radius:var(--radius-md);padding:13px 16px;margin:0 0 18px;background:#fff4e7;color:#895516;border:1px solid #f2dfc4}
.redesign-app .alert.success{background:#eaf5ef;color:#226444}.redesign-app .alert.error{background:#fff0ef;color:#a43c35}
.redesign-app .auth{min-height:100vh}.redesign-auth{background:var(--color-paper)}
.redesign-auth .auth-aside{background:var(--color-harbor);color:#fff;padding:clamp(28px,6vw,76px);display:flex;flex-direction:column;justify-content:space-between}
.redesign-auth .auth-aside .brand{color:#fff}.redesign-auth .auth-aside-copy h2{font:500 clamp(38px,5vw,64px)/1.08 var(--font-display);margin:18px 0;letter-spacing:-.04em}
.redesign-auth .auth-aside-copy p{max-width:360px;color:#d7e5e5;line-height:1.7}
.redesign-auth .auth-main{display:grid;place-items:center;padding:32px}
.redesign-auth .auth-card{width:100%;max-width:440px}.redesign-auth .auth-card>.card{border:0;box-shadow:none;background:transparent;padding:0}
.redesign-auth .auth-card h1{font:500 38px var(--font-display)}
.redesign-auth .auth-card .btn{width:100%}
.rail-user{display:flex;align-items:center;gap:12px;padding:8px}.rail-user strong,.rail-user small{display:block}.rail-user strong{font-size:13px}.rail-user small{color:var(--color-muted);font-size:11px}
.rail .nav-link{text-decoration:none}
@media(max-width:900px){.redesign-app .grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:640px){.redesign-app .content{padding:20px 16px 40px}.redesign-app .row{align-items:flex-start;flex-direction:column}.redesign-app .grid,.redesign-app .grid.two{grid-template-columns:1fr 1fr;gap:10px}.redesign-app .card{padding:16px}.redesign-auth{grid-template-columns:1fr}.redesign-auth .auth-aside{display:none}.redesign-auth .auth-main{padding:24px 20px}}



/* TripLedger visual integration fix — loaded last to normalize legacy PHP page classes */
html, body { min-height:100%; }
body { margin:0; background:#f6f5f1; color:#17202a; font-family:Inter,system-ui,sans-serif; }
.redesign-app { display:grid !important; grid-template-columns:232px minmax(0,1fr) !important; min-height:100vh; }
.redesign-app > .rail { grid-column:1; grid-row:1; width:232px; min-height:100vh; height:100vh; position:sticky; top:0; box-sizing:border-box; }
.redesign-app > .main { grid-column:2; grid-row:1; min-width:0; width:100%; }
.redesign-app .main > .content { display:block; width:100%; max-width:1440px; margin:0 auto; padding:32px 40px 56px; box-sizing:border-box; }
.redesign-app .main > .topbar { width:100%; box-sizing:border-box; }
.redesign-app .content > .row { display:flex; align-items:center; justify-content:space-between; gap:20px; margin:0 0 24px; }
.redesign-app .content > .row h1 { margin:0 0 8px; font-size:36px; line-height:1.15; font-weight:600; letter-spacing:-1.2px; }
.redesign-app .content > .row h2 { margin:0; font-size:23px; line-height:1.25; }
.redesign-app .content > .row p { margin:5px 0 0; color:#68737d; }
.redesign-app .content > .grid { display:grid !important; grid-template-columns:repeat(4,minmax(0,1fr)) !important; gap:16px !important; margin:22px 0 30px !important; }
.redesign-app .content > .grid.two { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
.redesign-app .content .card,
.redesign-app .content .panel { display:block; min-width:0; padding:22px; background:#fff; border:1px solid #e4e1d8; border-radius:16px; box-shadow:0 2px 8px rgba(23,32,42,.04); }
.redesign-app .content .metric-label { color:#6b7280; font-size:13px; font-weight:600; }
.redesign-app .content .metric { margin-top:9px; color:#17202a; font-size:28px; line-height:1.25; font-weight:700; }
.redesign-app .content .badge { display:inline-flex; align-items:center; padding:5px 10px; border-radius:999px; background:#e8f1f2; color:#0e5e6f; font-size:12px; font-weight:700; }
.redesign-app .content .muted { color:#6b7280; }
.redesign-app .content h1,.redesign-app .content h2,.redesign-app .content h3 { color:#17202a; }
.redesign-app .content a:not(.btn) { color:#0e5e6f; font-weight:600; text-decoration:none; }
.redesign-app .content a:not(.btn):hover { text-decoration:underline; }
.redesign-app .content .btn { display:inline-flex; align-items:center; justify-content:center; min-height:42px; padding:0 17px; border:1px solid transparent; border-radius:10px; background:#0e5e6f; color:#fff; font-size:14px; font-weight:600; text-decoration:none; }
.redesign-app .content .btn.secondary { background:#fff; color:#0e5e6f; border-color:#d5dfe0; }
.redesign-app .content .table-wrap { width:100%; overflow:auto; margin:18px 0; border:1px solid #e4e1d8; border-radius:14px; background:#fff; }
.redesign-app .content table { width:100%; border-collapse:collapse; }
.redesign-app .content th,.redesign-app .content td { padding:14px 16px; border-bottom:1px solid #ece9e2; text-align:left; }
.redesign-app .content th { background:#faf9f6; color:#6b7280; font-size:11px; text-transform:uppercase; letter-spacing:.06em; }
.redesign-app .content .field { margin:0 0 18px; }
.redesign-app .content .field label { display:block; margin:0 0 7px; color:#28333c; font-size:13px; font-weight:600; }
.redesign-app .content .field input,.redesign-app .content .field select,.redesign-app .content .field textarea { width:100%; box-sizing:border-box; padding:12px 14px; border:1px solid #d9ddd9; border-radius:10px; background:#fff; color:#17202a; font:inherit; }
.redesign-app .content .alert { margin:0 0 18px; padding:14px 16px; border-radius:10px; }
.redesign-app .content .empty { padding:36px; text-align:center; color:#6b7280; }
.redesign-app .content .form { max-width:680px; }
@media(max-width:900px) {
 .redesign-app { grid-template-columns:76px minmax(0,1fr) !important; }
 .redesign-app > .rail { width:76px; padding:20px 10px; }
 .redesign-app .rail .brand span:not(.brand-mark), .redesign-app .rail .nav-link:not(:has([data-icon])) { display:none; }
 .redesign-app .main > .content { padding:26px 24px 44px; }
 .redesign-app .content > .grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
}
@media(max-width:640px) {
 .redesign-app { display:block !important; }
 .redesign-app > .rail { position:relative; width:100%; height:auto; min-height:0; padding:10px 14px; }
 .redesign-app > .rail .nav { display:flex; flex-direction:row; flex-wrap:wrap; }
 .redesign-app > .rail .rail-foot,.redesign-app > .rail .nav-label { display:none; }
 .redesign-app .main > .content { padding:22px 16px 40px; }
 .redesign-app .content > .row { align-items:flex-start; flex-direction:column; }
 .redesign-app .content > .grid,.redesign-app .content > .grid.two { grid-template-columns:1fr !important; }
 .redesign-app .content .card { padding:17px; }
}


/* Final shell/layout override for the existing PHP-rendered markup */
html,body{min-height:100%;margin:0}
body{background:#f6f5f1;color:#17202a;font-family:Inter,Arial,sans-serif}
.redesign-app{display:grid!important;grid-template-columns:232px minmax(0,1fr)!important;min-height:100vh;width:100%}
.redesign-app>.rail{grid-column:1;grid-row:1;width:232px;min-height:100vh;height:100vh;position:sticky;top:0;display:flex;flex-direction:column;box-sizing:border-box;background:#fff;border-right:1px solid #e4e1d8;padding:24px 16px}
.redesign-app>.main{grid-column:2;grid-row:1;min-width:0;width:100%;background:#f6f5f1}
.redesign-app>.main>.topbar{height:64px;width:100%;padding:0 32px;display:flex;align-items:center;box-sizing:border-box;background:rgba(246,245,241,.94);border-bottom:1px solid #e4e1d8}
.redesign-app>.main>.content{display:block;width:100%;max-width:1440px;margin:0 auto;padding:32px 40px 56px;box-sizing:border-box}
.redesign-app .content>.row{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:0 0 24px}
.redesign-app .content>.row h1{font-size:36px;line-height:1.15;margin:0 0 8px;font-weight:600}
.redesign-app .content>.row h2{font-size:23px;margin:0}
.redesign-app .content>.grid{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:16px!important;margin:22px 0 30px!important}
.redesign-app .content>.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))!important}
.redesign-app .content .card,.redesign-app .content .panel{display:block;min-width:0;padding:22px;background:#fff;border:1px solid #e4e1d8;border-radius:16px;box-shadow:0 2px 8px rgba(23,32,42,.04)}
.redesign-app .content .metric-label{color:#6b7280;font-size:13px;font-weight:600}
.redesign-app .content .metric{margin-top:9px;color:#17202a;font-size:28px;line-height:1.25;font-weight:700}
.redesign-app .content .btn{display:inline-flex;align-items:center;justify-content:center;min-height:42px;padding:0 17px;border:1px solid transparent;border-radius:10px;background:#0e5e6f;color:#fff;font-size:14px;font-weight:600;text-decoration:none}
.redesign-app .content .btn.secondary{background:#fff;color:#0e5e6f;border-color:#d5dfe0}
.redesign-app .content a:not(.btn){color:#0e5e6f;text-decoration:none}
.redesign-app .content .badge{display:inline-flex;padding:5px 10px;border-radius:999px;background:#e8f1f2;color:#0e5e6f;font-size:12px;font-weight:700}
.redesign-app .content .muted{color:#6b7280}
.redesign-app .content p{line-height:1.6}
.redesign-app .rail .brand{display:flex;align-items:center;gap:10px;color:#17202a;text-decoration:none;font-size:20px;font-weight:700}
.redesign-app .rail .brand-mark{width:34px;height:34px;border-radius:11px;background:#0e5e6f;color:#fff;display:grid;place-items:center}
.redesign-app .rail .nav{display:flex;flex-direction:column;gap:4px;margin-top:28px}
.redesign-app .rail .nav-link{display:flex;align-items:center;gap:12px;min-height:42px;padding:0 12px;border-radius:10px;color:#596574;text-decoration:none;font-weight:500}
.redesign-app .rail .nav-link:hover,.redesign-app .rail .nav-link[aria-current=page]{background:#e8f1f2;color:#0e5e6f}
.redesign-app .rail .rail-foot{margin-top:auto;border-top:1px solid #e4e1d8;padding-top:16px}
@media(max-width:900px){.redesign-app{grid-template-columns:76px minmax(0,1fr)!important}.redesign-app>.rail{width:76px;padding:18px 10px}.redesign-app>.main>.content{padding:26px 22px 44px}.redesign-app .content>.grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:640px){.redesign-app{display:block!important}.redesign-app>.rail{position:relative;width:100%;height:auto;min-height:0;padding:10px 14px}.redesign-app>.rail .nav{flex-direction:row;flex-wrap:wrap;margin-top:10px}.redesign-app>.rail .rail-foot{display:none}.redesign-app>.main>.content{padding:22px 16px 40px}.redesign-app .content>.row{align-items:flex-start;flex-direction:column}.redesign-app .content>.grid,.redesign-app .content>.grid.two{grid-template-columns:1fr!important}}
