/* ==========================================================================
   TRENEX INVESTOR PORTAL
   Design system — shared by the login screen and the dashboard.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;500;600;700&display=swap");

:root {
  /* Brand */
  --brand:        #03a4e6;
  --brand-bright: #35bdf5;
  --brand-deep:   #0177a8;
  --brand-ink:    #0b0b1a;

  /* Surfaces (dark) */
  --bg:        #07080f;
  --surface:   #0f1420;
  --surface-2: #141b2a;
  --surface-3: #1b2437;
  --line:      rgba(255, 255, 255, .085);
  --line-soft: rgba(255, 255, 255, .05);

  /* Ink */
  --text:      #f2f6fb;
  --text-2:    #a3b0c6;
  --text-3:    #6c7a92;

  /* Data colours — validated for colour-blind separation on --surface */
  --series-1: #0891c9;
  --series-2: #349d62;
  --series-3: #b37903;
  --series-4: #9970c4;
  --pos:      #35b57c;
  --neg:      #e05c5c;
  --warn:     #d9a441;

  /* Geometry */
  --r-sm: 6px;
  --r:    14px;
  --r-lg: 22px;
  --pad:  clamp(18px, 2.2vw, 30px);
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, .75);
  --ring:   0 0 0 1px var(--line);
}

* { box-sizing: border-box; }

/* Class-based display rules (.stack, .switcher, .grid …) outrank the browser's
   own [hidden] rule, so hiding a laid-out element needs this to stick. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  /* Use full-height figures everywhere, including numerals embedded in labels
     such as 3M and 12M. Individual financial values also add tabular spacing. */
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }

/* The sign-in page waits briefly while Supabase restores a saved session.
   That prevents returning app users from seeing the login form before they
   are taken straight to their dashboard. */
.auth-boot {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.auth-boot img { width: 54px; height: 54px; border-radius: 14px; box-shadow: 0 14px 32px -12px rgba(3, 164, 230, .6); }
.auth-boot .spinner { width: 20px; height: 20px; }
.auth-loading .auth-boot { opacity: 1; }
.auth-loading .auth-top,
.auth-loading .auth-card,
.auth-loading .auth-foot { visibility: hidden; pointer-events: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
p  { margin: 0; }
a  { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--brand); color: #fff; }

/* Financial figures should use lining numerals: old-style figures have
   ascenders/descenders, which makes adjacent digits look vertically uneven. */
.num {
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   1. LOGIN SCREEN
   ========================================================================== */

.auth-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px 20px 40px;
  isolation: isolate;
}

.auth-video, .auth-video video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -3;
}
.auth-video video { filter: saturate(.85) contrast(1.05); }

.auth-scrim {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 90% at 50% 0%,   rgba(3, 164, 230, .16) 0%, transparent 55%),
    radial-gradient(140% 110% at 50% 110%, rgba(11, 11, 26, .96) 0%, transparent 60%),
    linear-gradient(180deg, rgba(7, 8, 15, .72) 0%, rgba(7, 8, 15, .86) 55%, rgba(7, 8, 15, .95) 100%);
}

/* Fine grain so the video never bands on flat gradients */
.auth-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.auth-top {
  position: absolute;
  top: 26px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 54px);
  z-index: 2;
}
.auth-top .back-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: color .25s;
}
.auth-top .back-link:hover { color: #fff; }
.auth-top .back-link svg { width: 14px; height: 14px; }

.auth-card {
  position: relative;
  width: 100%;
  max-width: 452px;
  padding: clamp(30px, 4vw, 44px) clamp(24px, 3.4vw, 40px) clamp(28px, 3.4vw, 38px);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, .12);
  background: linear-gradient(165deg, rgba(20, 27, 42, .78) 0%, rgba(9, 12, 20, .86) 100%);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: rise .8s cubic-bezier(.16, 1, .3, 1) both;
}

/* Hairline of brand light along the top edge of the card */
.auth-card::before {
  content: "";
  position: absolute;
  top: -1px; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: .85;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.auth-logo { width: 168px; margin: 0 auto 26px; display: block; }
.auth-logo svg { width: 100%; height: auto; display: block; }

.auth-eyebrow {
  text-align: center;
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--brand-bright);
  margin-bottom: 8px;
}
.auth-title    { text-align: center; font-size: 25px; margin-bottom: 6px; }
.auth-subtitle { text-align: center; font-size: 14px; color: var(--text-2); margin-bottom: 26px; }

/* Segmented sign-in / request-access switch */
.seg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  margin-bottom: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
}
.seg-thumb {
  position: absolute;
  top: 4px; left: 4px; bottom: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-bright), var(--brand));
  box-shadow: 0 6px 18px -6px rgba(3, 164, 230, .9);
  transition: transform .42s cubic-bezier(.16, 1, .3, 1);
}
.seg[data-mode="request"] .seg-thumb { transform: translateX(100%); }
.seg button {
  position: relative;
  z-index: 1;
  padding: 10px 6px;
  border: 0;
  background: none;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--text-2);
  cursor: pointer;
  transition: color .3s;
}
.seg button[aria-selected="true"] { color: #fff; }

/* Fields */
.field { position: relative; margin-bottom: 14px; }
.field input {
  width: 100%;
  padding: 22px 15px 9px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  outline: none;
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.field input::placeholder { color: transparent; }
.field label {
  position: absolute;
  left: 16px;
  top: 15px;
  font-size: 14.5px;
  color: var(--text-3);
  pointer-events: none;
  transition: transform .22s cubic-bezier(.16, 1, .3, 1), font-size .22s, color .22s;
  transform-origin: left top;
}
.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label {
  transform: translateY(-9px);
  font-size: 10.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-2);
}
.field input:focus {
  border-color: rgba(3, 164, 230, .65);
  background: rgba(3, 164, 230, .07);
  box-shadow: 0 0 0 4px rgba(3, 164, 230, .12);
}
.field .peek {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  border: 0; background: none; cursor: pointer;
  color: var(--text-3);
  padding: 8px;
  border-radius: 8px;
  transition: color .2s;
}
.field .peek:hover { color: var(--text); }
.field .peek svg { width: 18px; height: 18px; display: block; }

.field-hint { font-size: 12px; color: var(--text-3); margin: -6px 0 14px 4px; }

/* The site's square CTA, rebuilt */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 20px;
  border: 0;
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--brand-bright) 0%, var(--brand) 55%, var(--brand-deep) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  overflow: hidden;
  transition: transform .18s cubic-bezier(.16, 1, .3, 1), box-shadow .25s, filter .25s;
  box-shadow: 0 14px 34px -14px rgba(3, 164, 230, .85);
}
.btn:hover:not(:disabled)  { transform: translateY(-1px); filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 17px; height: 17px; }

/* Sheen sweep on hover */
.btn::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  transform: translateX(-110%);
  transition: transform .8s cubic-bezier(.16, 1, .3, 1);
}
.btn:hover::after { transform: translateX(110%); }

/* Size modifier first, so the quiet variants below can clear its shadow. */
.btn.sm {
  width: auto;
  padding: 9px 15px;
  font-size: 13px;
  border-radius: 10px;
  box-shadow: 0 6px 16px -10px rgba(3, 164, 230, .8);
}

.btn.ghost {
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--text);
}
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .09); filter: none; }

.btn.danger {
  background: rgba(224, 92, 92, .12);
  border: 1px solid rgba(224, 92, 92, .35);
  color: #f0a3a3;
  box-shadow: none;
}
.btn.danger:hover:not(:disabled) { background: rgba(224, 92, 92, .2); filter: none; }

/* The sheen sweep is for the primary action only. */
.btn.ghost::after, .btn.danger::after { display: none; }

.monthly-history {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,.025);
}
.monthly-history > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  color: var(--text-2);
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.monthly-history > div:last-child { border-bottom: 0; }
.monthly-history strong { color: var(--pos); font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }
.monthly-history strong.negative { color: var(--neg); }
.override-history > div, .filed-history > div { gap: 8px; }
.override-history > div span, .filed-history > div span { margin-right: auto; }
.override-history > div small, .filed-history > div small { display: block; margin-top: 2px; color: var(--text-3); font-size: 10.5px; font-weight: 400; }
.override-history .btn.sm, .filed-history .btn.sm { padding: 5px 8px; font-size: 11px; }

.monthly-cycle-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.monthly-cycle-steps > div {
  display: flex;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(3, 164, 230, .045);
}
.monthly-cycle-steps span {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.monthly-cycle-steps p { color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.monthly-cycle-steps strong { display: block; margin-bottom: 3px; color: var(--text); font-size: 13px; }
@media (max-width: 760px) { .monthly-cycle-steps { grid-template-columns: 1fr; } }

.auth-alt {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}
.auth-alt button {
  border: 0; background: none; padding: 0;
  color: var(--brand-bright); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

.auth-foot {
  position: absolute;
  bottom: 22px; left: 0; right: 0;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: rgba(255, 255, 255, .32);
  padding: 0 20px;
}

/* Messages */
.msg {
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  line-height: 1.45;
  border: 1px solid transparent;
}
.msg.show    { display: flex; }
.msg.error   { background: rgba(224, 92, 92, .1);  border-color: rgba(224, 92, 92, .34);  color: #f2adad; }
.msg.success { background: rgba(53, 181, 124, .1); border-color: rgba(53, 181, 124, .34); color: #8fe0bb; }
.msg.info    { background: rgba(3, 164, 230, .1);  border-color: rgba(3, 164, 230, .32);  color: #9ad9f5; }
.msg svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* Awaiting-approval state */
.pending-panel { text-align: center; }
.pending-mark {
  width: 62px; height: 62px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(3, 164, 230, .12);
  border: 1px solid rgba(3, 164, 230, .34);
  color: var(--brand-bright);
  animation: pulse 2.6s ease-in-out infinite;
}
.pending-mark svg { width: 26px; height: 26px; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(3, 164, 230, .28); }
  50%      { box-shadow: 0 0 0 14px rgba(3, 164, 230, 0); }
}

/* ==========================================================================
   2. DASHBOARD SHELL
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* The mobile drawer backdrop must never occupy a grid slot on desktop. */
.scrim { display: none; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  /* In an installed iPhone/iPad app the viewport extends behind the status
     bar. Keep the logo and first menu action comfortably below it. */
  padding: calc(26px + env(safe-area-inset-top, 0px)) 16px max(20px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #0b0f19 0%, #080a12 100%);
  border-right: 1px solid var(--line);
  z-index: 40;
}
.sidebar-logo { width: 122px; margin: 0 8px 30px; }
.sidebar-logo svg { width: 100%; height: auto; display: block; color: #fff; }

.nav-group { margin-bottom: 22px; }
.nav-group-label {
  padding: 0 12px 9px;
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-3);
}
.nav-group.admin .nav-group-label { color: var(--brand-bright); }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 2px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-2);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.nav-item.active { background: rgba(3, 164, 230, .13); color: #fff; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.nav-item .badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

/* A count, not an alert — the access-requests badge stays brand-filled. */
.nav-item .badge.quiet {
  background: rgba(255, 255, 255, .1);
  color: var(--text-2);
  font-weight: 500;
}
.nav-item.active .badge.quiet { background: rgba(255, 255, 255, .18); color: #fff; }

.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.who { display: flex; align-items: center; gap: 11px; padding: 8px 10px 12px; }
.avatar {
  width: 36px; height: 36px;
  flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand-bright), var(--brand-deep));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}
.who-name { font-size: 13.5px; font-weight: 500; }
.who-role { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .12em; }
.who-text { min-width: 0; }
.who-text > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Main column */
/* clip, not hidden — hidden would create a scroll container and break the
   sticky topbar. */
.main { min-width: 0; display: flex; flex-direction: column; overflow-x: clip; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  /* The header background fills the status-bar area while the interactive
     menu and heading begin below it in standalone mobile app mode. */
  padding: calc(18px + env(safe-area-inset-top, 0px)) var(--pad) 18px;
  background: rgba(7, 8, 15, .78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: clamp(19px, 2.3vw, 25px); }
.topbar .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.burger {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  cursor: pointer;
  place-items: center;
}
.burger svg { width: 18px; height: 18px; }

.view { padding: var(--pad); display: none; animation: fade .45s cubic-bezier(.16, 1, .3, 1) both; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   3. CARDS, TILES, TABLES
   ========================================================================== */

.card {
  position: relative;
  padding: var(--pad);
  border-radius: var(--r);
  background: linear-gradient(168deg, var(--surface) 0%, #0b0f18 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.card-head h2 { font-size: 17px; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.card-head .spacer { margin-left: auto; }

.grid { display: grid; gap: 18px; }
/* Grid and flex children default to min-width:auto (their min-content), which
   lets a wide table or chart push the whole layout past the viewport. */
.grid > *, .stack > *, .main > *, .card > * { min-width: 0; }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.halves { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.folders { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stack { display: grid; gap: 18px; }

/* Hero figure — exactly one per view */
.hero-figure {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 3vw, 38px);
  border-radius: var(--r);
  border: 1px solid rgba(3, 164, 230, .28);
  background:
    radial-gradient(90% 140% at 85% 0%, rgba(3, 164, 230, .2) 0%, transparent 62%),
    linear-gradient(168deg, #101827 0%, #0a0d16 100%);
  box-shadow: var(--shadow);
}
.hero-figure .label {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-2);
}
.hero-figure .value {
  margin-top: 8px;
  font-size: clamp(40px, 6.4vw, 62px);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1;
}
.hero-figure .meta {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-2);
}

.tile {
  padding: 20px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color .25s, transform .25s;
}
.tile:hover { border-color: rgba(255, 255, 255, .16); }
.tile .label { font-size: 12px; color: var(--text-3); letter-spacing: .05em; }
.tile .value { margin-top: 7px; font-size: 27px; font-weight: 600; letter-spacing: -.03em; }
.tile .delta { margin-top: 7px; font-size: 12.5px; color: var(--text-3); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  border: 1px solid transparent;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.pos     { background: rgba(53, 181, 124, .13); border-color: rgba(53, 181, 124, .35); color: #6fd6a6; }
.pill.neg     { background: rgba(224, 92, 92, .13);  border-color: rgba(224, 92, 92, .35);  color: #ef9c9c; }
.pill.neutral { background: rgba(255, 255, 255, .06); border-color: var(--line);            color: var(--text-2); }
.pill.brand   { background: rgba(3, 164, 230, .14);  border-color: rgba(3, 164, 230, .35);  color: #6fcbf1; }
.pill.warn    { background: rgba(217, 164, 65, .13); border-color: rgba(217, 164, 65, .35); color: #e3bf7a; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 calc(var(--pad) * -1) calc(var(--pad) * -1); padding: 0 var(--pad) 4px; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th {
  text-align: left;
  padding: 0 14px 11px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tbody tr { transition: background .18s; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tbody tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
td .muted { color: var(--text-3); font-size: 12.5px; }
.row-actions { display: flex; gap: 7px; justify-content: flex-end; flex-wrap: wrap; }
.see-returns { white-space: nowrap; }
.mobile-see-returns { display: none; }

/* Member return history has its own summary and compact ledger, keeping the
   investment context clear without exposing administrative edit controls. */
.returns-modal { max-width: 620px; }
.returns-modal .modal-actions {
  position: sticky;
  bottom: -1px;
  z-index: 1;
  margin-top: 0;
  padding-top: 14px;
  background: linear-gradient(180deg, transparent 0, #0a0d16 28%);
}
.member-returns {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .022);
}
.member-returns-summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  padding: 21px 22px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(110% 150% at 100% 0%, rgba(3, 164, 230, .18), transparent 62%),
    rgba(3, 164, 230, .045);
}
.return-eyebrow {
  margin: 0 0 7px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.return-total {
  display: block;
  color: var(--pos);
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.045em;
}
.return-total.negative, .member-return-row strong.negative { color: var(--neg); }
.return-total.neutral { color: var(--text-2); }
.return-caption { margin-top: 9px; color: var(--text-2); font-size: 12.5px; }
.return-month-count {
  display: grid;
  gap: 3px;
  min-width: 104px;
  padding: 9px 0 9px 18px;
  border-left: 1px solid var(--line);
  text-align: right;
}
.return-month-count span {
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.return-month-count strong { color: var(--text); font-size: 21px; line-height: 1.1; }
.member-return-list { padding: 5px 22px 8px; }
.member-return-list-head, .member-return-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.member-return-list-head {
  padding: 10px 0 8px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.member-return-row {
  min-height: 57px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.member-return-row:last-child { border-bottom: 0; }
.return-month { color: var(--text-2); font-size: 14px; font-weight: 500; }
.member-return-row small { display: block; max-width: 380px; margin-top: 3px; color: var(--text-3); font-size: 11.5px; line-height: 1.35; }
.member-return-row strong { color: var(--pos); font-size: 14.5px; }
.member-returns-empty { padding: 26px 22px; }
.member-returns-empty .return-total { margin-bottom: 12px; }
.member-returns-empty > p:last-child { color: var(--text-2); font-size: 13px; line-height: 1.55; }

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}
.empty svg { width: 34px; height: 34px; margin-bottom: 12px; opacity: .45; display: inline-block; }

/* --------------------------------------------------------------------------
   Locked state — shown instead of a wall of zeroes and an empty graph when a
   member has nothing assigned yet. One calm panel, not four broken widgets.
   -------------------------------------------------------------------------- */

.locked {
  position: relative;
  overflow: hidden;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 14px;
  padding: clamp(38px, 6vw, 62px) 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(3, 164, 230, .09), transparent 62%),
    var(--surface);
  box-shadow: var(--ring);
}

/* Faint ghost of a chart behind the padlock, so the panel reads as "locked
   content", not "broken page". Purely decorative. */
.locked::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 58%;
  pointer-events: none;
  opacity: .5;
  background:
    linear-gradient(transparent, rgba(3, 164, 230, .05)),
    repeating-linear-gradient(to right, var(--line-soft) 0 1px, transparent 1px 82px),
    repeating-linear-gradient(to bottom, var(--line-soft) 0 1px, transparent 1px 46px);
  -webkit-mask-image: linear-gradient(transparent, #000 85%);
          mask-image: linear-gradient(transparent, #000 85%);
}

.locked > * { position: relative; }

.locked .lock-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--brand-bright);
  background: rgba(3, 164, 230, .11);
  border: 1px solid rgba(3, 164, 230, .3);
}
.locked .lock-mark svg { width: 26px; height: 26px; display: block; }

.locked h2 { font-size: clamp(17px, 2.2vw, 20px); }
.locked p  { max-width: 44ch; font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.locked .locked-note { font-size: 12.5px; color: var(--text-3); }

/* --------------------------------------------------------------------------
   Investment switcher — "All investments · 3" plus one chip per position.
   -------------------------------------------------------------------------- */

.switcher {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.switcher::-webkit-scrollbar { display: none; }

.switcher .chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, border-color .18s, color .18s, transform .18s;
}
.switcher .chip:hover { background: rgba(255, 255, 255, .08); color: var(--text); transform: translateY(-1px); }
.switcher .chip.active {
  background: rgba(3, 164, 230, .16);
  border-color: rgba(3, 164, 230, .45);
  color: #fff;
}
.switcher .chip .n {
  font-size: 11px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  color: var(--text-2);
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}
.switcher .chip.active .n { background: rgba(255, 255, 255, .17); color: #fff; }
.switcher .chip .ret { font-size: 11.5px; opacity: .75; font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }

/* ==========================================================================
   4. CHART
   ========================================================================== */

.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid    { stroke: rgba(255, 255, 255, .07); stroke-width: 1; }
.chart-axis    { fill: var(--text-3); font-size: 11px; font-family: Raleway, sans-serif; font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }
.chart-line    { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-hit     { fill: transparent; cursor: crosshair; }
.chart-cross   { stroke: rgba(255, 255, 255, .28); stroke-width: 1; }
.chart-dot     { stroke: var(--surface); stroke-width: 2; }
.chart-endlabel{ fill: var(--text); font-size: 12px; font-weight: 600; font-family: Raleway, sans-serif; font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }

.chart-tip {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -118%);
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(12, 16, 26, .97);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .9);
  font-size: 12.5px;
  white-space: nowrap;
  transition: opacity .14s;
  z-index: 5;
}
.chart-tip.show { opacity: 1; }
.chart-tip .t-date  { color: var(--text-3); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.chart-tip .t-value { font-weight: 600; margin-top: 3px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.legend-key  { width: 14px; height: 3px; border-radius: 2px; flex: none; }

.range-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.range-switch button {
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-3);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .22s, color .22s;
}
.range-switch button.active { background: rgba(3, 164, 230, .18); color: #fff; }

/* ==========================================================================
   5. DOCUMENT FOLDERS
   ========================================================================== */

.folder {
  position: relative;
  padding: 22px 20px 20px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  width: 100%;
  transition: transform .3s cubic-bezier(.16, 1, .3, 1), border-color .3s, background .3s;
}
.folder:hover { transform: translateY(-3px); border-color: rgba(3, 164, 230, .4); background: var(--surface-2); }
.folder .fico {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 16px;
  background: rgba(3, 164, 230, .12);
  color: var(--brand-bright);
}
.folder .fico svg { width: 20px; height: 20px; }
.folder .fname { font-size: 15.5px; font-weight: 600; }
.folder .fblurb {
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-2);
  max-width: 88%;
}
.folder .fcount {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--text-3);
}
.folder .farrow {
  position: absolute;
  right: 18px; bottom: 18px;
  color: var(--text-3);
  transition: transform .3s, color .3s;
}
.folder:hover .farrow { transform: translateX(3px); color: var(--brand-bright); }
.folder .farrow svg { width: 16px; height: 16px; display: block; }

.doc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line-soft);
}
.doc-row:last-child { border-bottom: 0; }
.doc-ico {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .05);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}
.doc-meta { min-width: 0; flex: 1; }
.doc-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 500;
  min-width: 0;
}
.doc-title span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-title .pill { flex: none; }
.doc-sub   { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* Storage meter — fill carries severity, track is a lighter step of the same
   ramp so the state reads across the whole bar. */
.meter-row { display: grid; gap: 10px; }
.meter {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(3, 164, 230, .14);
}
.meter-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-deep), var(--brand-bright));
  transition: width .6s cubic-bezier(.16, 1, .3, 1), background .3s;
}
.meter-fill.warn     { background: linear-gradient(90deg, #a8791f, var(--warn)); }
.meter-fill.critical { background: linear-gradient(90deg, #a33d3d, var(--neg)); }
.meter-label { font-size: 13px; color: var(--text-2); }
.meter-label strong { color: var(--text); font-weight: 600; }

.crumbs { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-3); margin-bottom: 18px; }
.crumbs button { border: 0; background: none; color: var(--brand-bright); cursor: pointer; padding: 0; font-size: 13px; }
.crumbs svg { width: 13px; height: 13px; flex: none; opacity: .55; }

/* Safety net: an inline SVG with no width/height attributes will otherwise
   expand to fill its container. Every icon in the portal is inline SVG. */
.view svg, .modal svg, .sidebar svg, .topbar svg { max-width: 100%; }

/* ==========================================================================
   6. FORMS, MODALS, TOASTS
   ========================================================================== */

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.inp-label {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.inp {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  outline: none;
  transition: border-color .22s, box-shadow .22s, background .22s;
}
.inp:focus {
  border-color: rgba(3, 164, 230, .6);
  background: rgba(3, 164, 230, .06);
  box-shadow: 0 0 0 4px rgba(3, 164, 230, .1);
}
textarea.inp { min-height: 84px; resize: vertical; }
select.inp {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c7a92' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
}
select.inp option { background: #0f1420; color: var(--text); }

.drop {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 28px 20px;
  border-radius: var(--r);
  border: 1.5px dashed var(--line);
  background: rgba(255, 255, 255, .02);
  text-align: center;
  cursor: pointer;
  transition: border-color .25s, background .25s;
}
.drop:hover, .drop.over { border-color: rgba(3, 164, 230, .6); background: rgba(3, 164, 230, .06); }
.drop svg { width: 26px; height: 26px; color: var(--brand-bright); }
.drop .d-main { font-size: 14px; }
.drop .d-sub  { font-size: 12px; color: var(--text-3); }

.modal-veil {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 5, 10, .74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-veil.show { display: flex; }
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: var(--r-lg);
  background: linear-gradient(168deg, #131a28 0%, #0a0d16 100%);
  border: 1px solid var(--line);
  box-shadow: 0 40px 90px -30px #000;
  animation: rise .4s cubic-bezier(.16, 1, .3, 1) both;
}
.modal.wide { max-width: 720px; }
.modal h3 { font-size: 19px; margin-bottom: 4px; }
.modal .m-sub { font-size: 13px; color: var(--text-3); margin-bottom: 22px; }

/* One member's positions, listed inside a modal so several can be managed
   in one sitting instead of hunting through the flat assignments table. */
.hold-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.hold-row:last-of-type { border-bottom: 0; }
.hold-main { min-width: 140px; flex: 1; }
.hold-name { font-size: 14.5px; font-weight: 600; }
.hold-sub  { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.hold-val  { text-align: right; font-size: 14px; font-weight: 600; }
.hold-val span { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-3); margin-top: 3px; }
.hold-total {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--text-2);
}
.hold-total strong { color: var(--text); font-size: 15px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }
.modal-actions .btn { width: auto; padding: 12px 20px; }

/* Home-screen install guidance. It is deliberately separate from the portal's
   working dialogs so it can appear immediately on both the sign-in and app
   screens without interfering with any account action. */
.install-veil {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: rgba(4, 5, 10, .78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.install-card {
  position: relative;
  width: min(100%, 420px);
  padding: 30px 26px 24px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 22px;
  background: linear-gradient(165deg, #182134, #0b0e17);
  box-shadow: 0 40px 100px -30px #000;
  animation: rise .35s cubic-bezier(.16, 1, .3, 1) both;
}
.install-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  color: var(--text-2);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.install-mark {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 0 12px 30px -10px rgba(3, 164, 230, .42);
}
.install-mark img { display: block; width: 100%; height: 100%; }
.install-eyebrow {
  margin-bottom: 6px;
  color: var(--brand-bright);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  text-align: center;
  text-transform: uppercase;
}
.install-card h2 { font-size: 22px; text-align: center; }
.install-copy { margin: 9px auto 20px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; text-align: center; }
.install-steps { display: grid; gap: 11px; margin: 0; padding: 16px 14px 16px 34px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, .035); color: var(--text-2); font-size: 13px; line-height: 1.45; }
.install-steps strong { color: var(--text); font-weight: 600; }
.install-native { margin-top: 16px; }
.install-not-now { display: block; width: 100%; margin-top: 14px; padding: 7px; border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 13px; }
.install-close:focus-visible, .install-not-now:focus-visible { outline: 2px solid var(--brand-bright); outline-offset: 2px; }

.toasts {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border-radius: 12px;
  background: rgba(16, 21, 33, .98);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px -18px #000;
  font-size: 13.5px;
  animation: slide .4s cubic-bezier(.16, 1, .3, 1) both;
}
.toast.ok  { border-color: rgba(53, 181, 124, .4); }
.toast.err { border-color: rgba(224, 92, 92, .4); }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.toast.ok  svg { color: #6fd6a6; }
.toast.err svg { color: #ef9c9c; }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* Loading */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .045) 25%, rgba(255, 255, 255, .085) 50%, rgba(255, 255, 255, .045) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity .4s;
}
.boot.gone { opacity: 0; pointer-events: none; }

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .burger { display: grid; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 274px;
    transform: translateX(-100%);
    transition: transform .38s cubic-bezier(.16, 1, .3, 1);
    box-shadow: 30px 0 70px -30px #000;
  }
  .sidebar.open { transform: none; }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(4, 5, 10, .68);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .nav-item.active::before { left: -16px; }
}

@media (max-width: 640px) {
  :root { --pad: 16px; }
  .auth-card { padding: 28px 20px 24px; border-radius: 18px; }
  .auth-logo { width: 140px; }
  .hero-figure .value { font-size: 40px; }
  .hero-figure .meta { font-size: 12.5px; gap: 10px; }

  /* Two tiles per row reads better than one tall column */
  .grid.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { padding: 15px 14px; }
  .tile .value { font-size: 20px; margin-top: 5px; }
  .tile .label { font-size: 11.5px; }
  .tile .delta { font-size: 11.5px; margin-top: 5px; }
  .grid.folders { grid-template-columns: 1fr; }
  .grid { gap: 14px; }
  .card + .card { margin-top: 14px; }
  .topbar { padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px; }
  /* Keep this action in the first, always-visible table column. The full
     desktop action column remains available on wider screens. */
  .desktop-returns-cell { display: none; }
  .mobile-see-returns { display: inline-flex; margin-top: 10px; }
  .modal { padding: 22px 18px; border-radius: 18px; }
  .modal-actions .btn { width: 100%; }
  .member-returns-summary { padding: 19px 18px; }
  .member-return-list { padding-right: 18px; padding-left: 18px; }
  .install-card { padding: 26px 20px 20px; border-radius: 18px; }
  .toasts { left: 14px; right: 14px; bottom: 14px; max-width: none; }

  /* The stage is a flex row on desktop; stack it so the footer sits under the
     card instead of beside it. */
  .auth-stage { flex-direction: column; justify-content: center; padding: 68px 16px 30px; }
  .auth-card { max-width: 100%; }
  .auth-top { top: 18px; }
  .auth-foot { position: static; width: 100%; margin-top: 24px; }
}

@media (max-width: 420px) {
  .member-returns-summary { grid-template-columns: 1fr; gap: 17px; }
  .return-month-count {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
    text-align: left;
  }
  .return-month-count strong { font-size: 19px; }
  .member-return-row small { max-width: 230px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
