/* ============================================================
   Shapes Community Club — Design System
   Dark navy dashboard, orange brand accent (from the logo),
   glassy full-bleed cards. Dark by default; light via toggle.
   ============================================================ */

:root {
  /* dark navy is the default look */
  --app-bg: radial-gradient(1100px 560px at 78% -12%, #26357f 0%, rgba(15,21,53,0) 55%),
            linear-gradient(180deg, #101740 0%, #0a0e29 100%);
  --page:       #0f1535;
  --content:    transparent;
  --surface:    #141b44;
  --surface-2:  #1b2356;
  --ink:        #ffffff;
  --ink-soft:   #a3aed0;
  --ink-faint:  #7079a8;
  --line:       #2a3268;
  --line-soft:  #212850;

  /* brand accent — the logo orange */
  --pine:       #e9572c;
  --pine-deep:  #cf4519;
  --pine-tint:  #2b1a12;
  --lime:       #f6a04a;   /* secondary warm accent */
  --lime-tint:  #2a1e10;

  /* semantics */
  --pos:        #01b574;   /* positive / balanced */
  --pos-tint:   #0e2a20;
  --blue:       #3f7bf6;
  --blue-tint:  #14224a;
  --brass:      #e2a13a;
  --brass-tint: #2a2110;
  --danger:     #ef5350;
  --danger-tint:#2c1618;
  --ok:         #01b574;

  /* primary button + sidebar */
  --coal:       #e9572c;
  --sidebar-bg: #0b1030;
  --sidebar-ink:#ffffff;
  --sidebar-mut:#8b95c9;

  /* module hues (vivid on dark) */
  --m-member:  #a78bfa;
  --m-fitness: #22d3ee;
  --m-food:    #fb923c;
  --m-pavilion:#f472b6;
  --m-sales:   #e9572c;

  --shadow-sm: 0 2px 8px rgba(3,7,25,.35);
  --shadow:    0 10px 34px rgba(3,7,25,.45);
  --shadow-lg: 0 24px 60px rgba(3,7,25,.6);
  --radius:    20px;
  --radius-sm: 14px;
  --pill:      999px;
  --sidebar-w: 260px;
  --sidebar-rail: 76px;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: var(--sans);
  --mono: "Cascadia Code", "SF Mono", ui-monospace, "Consolas", monospace;
}

/* Light alternative (via the topbar toggle) */
:root[data-theme="light"] {
  --app-bg: #eef0f8;
  --page:#eef0f8; --content:transparent; --surface:#ffffff; --surface-2:#f1f3fb;
  --ink:#141a3a; --ink-soft:#5b638a; --ink-faint:#8a90b0; --line:#e5e8f2; --line-soft:#eef0f7;
  --pine:#e9572c; --pine-deep:#cf4519; --pine-tint:#fdeee7; --lime:#e08829; --lime-tint:#fbf0e1;
  --pos:#0a9d6e; --pos-tint:#e3f5ee; --blue:#3f7bf6; --blue-tint:#e7effe;
  --brass:#c2851f; --brass-tint:#f7ecd6; --danger:#d64545; --danger-tint:#fbe6e6; --ok:#0a9d6e;
  --coal:#e9572c; --sidebar-bg:#111735; --sidebar-ink:#ffffff; --sidebar-mut:#9aa2c9;
  --m-member:#7c5cff; --m-fitness:#0e9aa7; --m-food:#e07b2a; --m-pavilion:#d1519a; --m-sales:#e9572c;
  --shadow-sm: 0 1px 2px rgba(20,26,58,.05), 0 4px 14px rgba(20,26,58,.06);
  --shadow: 0 2px 6px rgba(20,26,58,.06), 0 14px 36px rgba(20,26,58,.1);
  --shadow-lg: 0 18px 50px rgba(20,26,58,.16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--app-bg);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--pine); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0; }
.serif { font-family: var(--sans); font-weight: 700; letter-spacing: -.02em; }
.mono { font-family: var(--mono); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: .4rem .6rem;
    transition: transform .22s ease, width .18s ease;
    /* Keep the sidebar scrollable but hide the scrollbar chrome. */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* legacy Edge/IE */
}
.sidebar::-webkit-scrollbar { width: 0; height: 0; display: none; } /* Chrome/Safari */
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1rem; }
.brand .logo { display: none; }
.brand-logo { display: block; width: auto; height: auto; max-width: 100%; max-height: 40px; }
.brand .btxt { display: flex; flex-direction: column; line-height: 1; }
.brand .btxt b, .brand .wordmark {
  font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; color: var(--pine); text-transform: lowercase;
}
.brand .btxt span { font-size: .6rem; letter-spacing: .24em; text-transform: uppercase; color: var(--sidebar-mut); font-weight: 700; margin-top: .25rem; }

.nav-group { padding: .8rem .3rem .2rem; }
.nav-group .label {
  font-size: .64rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--sidebar-mut); font-weight: 700; padding: 0 .7rem .5rem;
}
.nav { list-style: none; margin: 0; padding: 0; }
.nav a {
  display: flex; align-items: center; gap: .8rem;
  padding: .68rem .8rem; margin: .18rem 0; border-radius: var(--radius-sm);
  color: var(--sidebar-ink); font-size: .9rem; font-weight: 500;
  text-decoration: none; transition: background .14s ease, color .14s ease;
}
.nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.nav a .ico-wrap {
  width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: rgba(255,255,255,.06); color: var(--sidebar-mut); transition: all .14s ease;
}
.nav a.active { background: rgba(255,255,255,.04); font-weight: 650; color: #fff; }
.nav a.active .ico-wrap { background: var(--pine); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--pine) 45%, transparent); }
.nav .ico { width: 18px; height: 18px; }
.nav .hue-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--pine)); opacity: .0; }
.nav a.active .hue-dot { opacity: 1; }

.sidebar-foot { margin-top: auto; padding: .7rem .4rem; }
.userpill { display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem; border-radius: var(--radius-sm); background: rgba(255,255,255,.04); }
.userpill .avatar {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: var(--pine); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.userpill .u { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.userpill .u b { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userpill .u span { font-size: .7rem; color: var(--sidebar-mut); }

/* ---------- Main column ---------- */
.main { display: flex; flex-direction: column; min-width: 0; background: var(--content); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: 1.1rem 2rem;
  background: color-mix(in srgb, var(--page) 70%, transparent);
  backdrop-filter: blur(12px);
}
.topbar .menu-btn { display: grid; }
.topbar .crumb { display: flex; flex-direction: column; line-height: 1.2; }
.topbar .crumb .eyebrow { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; }
.topbar .crumb h1 { font-family: var(--sans); font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.topbar .spacer { flex: 1; }
.iconbtn {
  width: 42px; height: 42px; border-radius: var(--pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  display: grid; place-items: center; cursor: pointer; transition: all .14s ease;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn svg { width: 18px; height: 18px; }

.content { padding: 1.4rem 2rem 3rem; width: 100%; }

/* ---------- Page header ---------- */
.page-head { margin-bottom: 1.4rem; }
.page-head h2 { font-family: var(--sans); font-size: 1.7rem; font-weight: 750; letter-spacing: -.025em; }
.page-head p { margin: .3rem 0 0; color: var(--ink-soft); max-width: 70ch; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.35rem 1.45rem;
}
.card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.card-head h3 { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.card-head .more { margin-left: auto; font-size: .82rem; }

.grid { display: grid; gap: 1.2rem; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* 12-column layout for dense dashboards */
.grid12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.2rem; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.2rem; }

/* ---------- Stat cards ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.35rem;
  display: flex; flex-direction: column; gap: .4rem;
}
.stat .top { display: flex; align-items: center; justify-content: space-between; }
.stat .top .ico {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--hue, var(--pine)), color-mix(in srgb, var(--hue, var(--pine)) 60%, #000));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--hue, var(--pine)) 35%, transparent);
}
.stat .top .ico svg { width: 20px; height: 20px; }
.stat .label { font-size: .74rem; color: var(--ink-faint); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; order: -1; }
.stat .value { font-size: 1.85rem; font-weight: 780; line-height: 1.05; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: .78rem; font-weight: 700; color: var(--ink-faint); }
.stat .delta.up { color: var(--pos); }
.stat .delta.down { color: var(--danger); }

/* ---------- Hero (welcome) ---------- */
.hero {
  border-radius: var(--radius); padding: 1.7rem 1.8rem; min-height: 210px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 90% 0%, color-mix(in srgb, var(--pine) 85%, #000) 0%, #12173f 60%);
  border: 1px solid var(--line);
}
.hero .ey { font-size: .8rem; color: rgba(255,255,255,.75); font-weight: 600; }
.hero h2 { font-size: 1.7rem; font-weight: 780; letter-spacing: -.02em; margin: .2rem 0 .5rem; }
.hero p { color: rgba(255,255,255,.8); max-width: 40ch; margin: 0; }
.hero .go { margin-top: 1rem; font-weight: 700; color: #fff; display: inline-flex; gap: .4rem; align-items: center; }

/* ---------- Bar chart ---------- */
.chart {
  display: flex; align-items: flex-end; gap: 1.1rem; height: 240px; padding-top: 1.4rem;
  border-bottom: 1.5px solid var(--line);
  background-image: linear-gradient(to top, var(--line-soft) 1px, transparent 1px);
  background-size: 100% 25%; background-position: 0 100%;
}
.chart .bar.zero { background: var(--line); box-shadow: none; opacity: .7; border-radius: 3px; min-height: 4px; }
.chart-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem; color: var(--ink-faint); align-self: center; }
.chart-empty svg { width: 40px; height: 40px; opacity: .6; }
.chart-empty p { margin: 0; font-size: .9rem; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .6rem; height: 100%; justify-content: flex-end; min-width: 0; }
.chart .bar {
  width: 60%; max-width: 46px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--pine), color-mix(in srgb, var(--pine) 45%, #0a0e29));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--pine) 30%, transparent);
  min-height: 6px; transition: height .3s ease;
}
.chart .clabel { font-size: .74rem; color: var(--ink-soft); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chart .cval { font-size: .72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.chart { transition: opacity .15s ease; }
.chart.loading { opacity: .35; }
.chart .col { cursor: default; }
/* dense mode for many buckets (e.g. 90 daily bars) */
.chart.dense { gap: .28rem; }
.chart.dense .bar { width: 82%; border-radius: 4px 4px 2px 2px; }
.chart .col.hide-label .clabel { visibility: hidden; }

/* revenue chart controls */
.rev-controls { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: .2rem 0 1.1rem; }
.rev-ctl { display: flex; flex-direction: column; gap: .35rem; }
.rev-ctl > span { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.rev-sel { min-height: 42px; min-width: 200px; font-size: .92rem; padding: .5rem 2.4rem .5rem .85rem; }
.rev-summary { font-size: .82rem; margin-top: .2rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--ink-soft);
  font: inherit; font-size: .82rem; font-weight: 650; padding: .32rem .72rem;
  border-radius: 8px; cursor: pointer; transition: background .15s ease, color .15s ease;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--pine); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--pine) 35%, transparent); }

/* ---------- Form layout helpers (full-width, roomy) ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.15rem 1.6rem; align-items: start; }
.form-grid .field { margin: 0; }
.form-grid .field.col-span-2 { grid-column: span 2; }
.form-grid .field.col-span-full { grid-column: 1 / -1; }
.form-grid .field label { margin-bottom: .45rem; }
.form-section { margin: 1.9rem 0 1rem; padding-top: 1.3rem; border-top: 1px solid var(--line); }
.form-section:first-of-type { border-top: 0; padding-top: 0; margin-top: .4rem; }
.form-section h3 { font-size: 1rem; margin: 0 0 .25rem; }
.form-section .sub { color: var(--ink-soft); font-size: .84rem; margin: 0; }
/* a touch more room inside form cards */
.card > form { padding: .2rem; }

/* ---------- Member photo upload ---------- */
.photo-upload { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.photo-preview {
  width: 104px; height: 104px; flex: none; border-radius: 16px; object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-faint); overflow: hidden;
}
.photo-preview svg { width: 40px; height: 40px; }
.photo-upload .pu-actions { display: flex; flex-direction: column; gap: .35rem; }
.photo-upload .req { color: var(--danger); }

/* ---------- Wizard / stepper ---------- */
.wizard-steps { display: flex; gap: .4rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.wizard-steps .step {
  flex: 1; min-width: 150px; display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1rem; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink-soft); cursor: default; user-select: none;
}
.wizard-steps .step .num {
  width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); font-size: .82rem; font-weight: 700;
}
.wizard-steps .step b { font-size: .9rem; font-weight: 650; }
.wizard-steps .step small { display: block; font-size: .72rem; opacity: .8; }
.wizard-steps .step.active { background: var(--pine); border-color: transparent; color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--pine) 32%, transparent); }
.wizard-steps .step.active .num { background: rgba(255,255,255,.2); border-color: transparent; color: #fff; }
.wizard-steps .step.done { color: var(--ink); cursor: pointer; }
.wizard-steps .step.done .num { background: color-mix(in srgb, var(--pos, #2fbf71) 20%, transparent); border-color: transparent; color: var(--pos, #2fbf71); }
.wizard-nav { display: flex; justify-content: space-between; gap: .6rem; margin-top: 1.4rem; }

/* CNIC / document upload tiles */
.doc-drop { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.doc-tile { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 1.1rem; text-align: center; background: var(--surface-2); }
.doc-tile h4 { margin: 0 0 .2rem; font-size: .9rem; }
.doc-tile .thumb { margin-top: .7rem; max-width: 100%; max-height: 180px; border-radius: 8px; display: none; }

/* ---------- Module cards ---------- */
.module {
  display: flex; flex-direction: column; gap: .5rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1.3rem 1.35rem;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.module:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--hue) 55%, var(--line)); text-decoration: none; }
.module .mtop { display: flex; align-items: center; gap: .7rem; }
.module .mico {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none;
  color: #fff; background: linear-gradient(135deg, var(--hue), color-mix(in srgb, var(--hue) 60%, #000));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--hue) 30%, transparent);
}
.module .mico svg { width: 22px; height: 22px; }
.module h3 { font-size: 1.02rem; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.module .dept { font-size: .64rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--hue); }
.module p { margin: .1rem 0 0; font-size: .84rem; color: var(--ink-soft); }
.module .go { margin-top: .4rem; font-size: .82rem; font-weight: 650; color: var(--hue); display: inline-flex; align-items: center; gap: .3rem; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .01em;
  padding: .3rem .68rem; border-radius: var(--pill);
  background: var(--surface-2); color: var(--ink-soft);
}
.badge.ok { background: var(--pos-tint); color: var(--pos); }
.badge.warn { background: var(--brass-tint); color: var(--brass); }
.badge.bad { background: var(--danger-tint); color: var(--danger); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font-family: inherit; font-size: .88rem; font-weight: 650;
  padding: .62rem 1.15rem; border-radius: var(--pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: all .14s ease; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: linear-gradient(135deg, var(--pine), var(--pine-deep)); border-color: transparent; color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--pine) 30%, transparent); }
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--pine), var(--pine-deep)); }
.btn-brass { background: var(--pos); border-color: var(--pos); color: #fff; }
.btn-brass:hover { filter: brightness(1.08); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table.data { border-collapse: collapse; width: 100%; font-size: .87rem; min-width: 520px; }
table.data th, table.data td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--line-soft); }
table.data thead th { background: var(--surface-2); font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--pine) 8%, transparent); }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Empty / placeholder ---------- */
.placeholder {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: .8rem; padding: 3.5rem 1.5rem;
  border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--surface);
}
.placeholder .pico {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--hue, var(--pine)), color-mix(in srgb, var(--hue, var(--pine)) 60%, #000));
}
.placeholder .pico svg { width: 30px; height: 30px; }
.placeholder h3 { font-size: 1.3rem; font-weight: 750; letter-spacing: -.02em; }
.placeholder p { margin: 0; color: var(--ink-soft); max-width: 46ch; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.15rem; }
.field label { display: block; font-size: .92rem; font-weight: 600; margin-bottom: .5rem; color: var(--ink); }
.input {
  width: 100%; font-family: inherit; font-size: 1rem; line-height: 1.4;
  min-height: 50px; padding: .82rem 1rem; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink);
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.input:hover { border-color: color-mix(in srgb, var(--pine) 35%, var(--line)); }
.input::placeholder { color: var(--ink-faint); }
.input:focus { outline: none; border-color: var(--pine); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 22%, transparent); }

/* selects: custom caret (appearance is reset below) */
select.input {
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a90b0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
}
/* larger, on-brand radios & checkboxes */
input[type="radio"], input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--pine); cursor: pointer; }
/* file inputs sit a little differently */
input[type="file"].input { padding: .6rem 1rem; }
input[type="file"].input::file-selector-button {
  font: inherit; font-weight: 600; margin-right: .8rem; cursor: pointer;
  padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth .brandside {
  background: radial-gradient(120% 130% at 85% 0%, color-mix(in srgb, var(--pine) 60%, #0a0e29) 0%, #0a0e29 60%);
  color: #fff; padding: clamp(2rem, 5vw, 4rem);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth .brandside .kick { font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; color: var(--pine); font-weight: 700; }
.auth .brandside h1 { font-family: var(--sans); font-size: clamp(1.8rem, 3.4vw, 2.7rem); font-weight: 780; letter-spacing: -.03em; margin: 1rem 0; line-height: 1.08; }
.auth .brandside p { color: rgba(255,255,255,.75); max-width: 46ch; }
.auth .brandside .heads { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; }
.auth .brandside .heads span { font-size: .74rem; font-weight: 600; padding: .32rem .75rem; border-radius: var(--pill); background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.auth .formside { display: grid; place-items: center; padding: 2rem; background: var(--app-bg); }
.auth .formcard { width: 100%; max-width: 380px; }
.auth .formcard h2 { font-family: var(--sans); font-size: 1.6rem; font-weight: 780; letter-spacing: -.02em; }
.auth .formcard .sub { color: var(--ink-soft); margin: .3rem 0 1.6rem; font-size: .9rem; }

/* ---------- Alerts ---------- */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .86rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-info { background: var(--blue-tint); color: color-mix(in srgb, var(--blue) 80%, #fff 20%); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.alert-success { background: var(--pos-tint); color: var(--pos); border-color: color-mix(in srgb, var(--pos) 30%, transparent); }

/* ---------- Toolbar / search / pager ---------- */
.toolbar { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.toolbar .spacer { flex: 1; }
.searchbox { position: relative; display: flex; align-items: center; }
.searchbox svg { position: absolute; left: .9rem; width: 17px; height: 17px; color: var(--ink-faint); pointer-events: none; }
.searchbox input { padding-left: 2.5rem; min-width: 280px; border-radius: var(--pill); }
.pager { display: flex; align-items: center; gap: .5rem; margin-top: 1.1rem; justify-content: flex-end; }
.pager .info { color: var(--ink-faint); font-size: .84rem; margin-right: auto; }
.pager a, .pager span.cur {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; font-weight: 650;
  padding: .5rem .9rem; border-radius: var(--pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.pager a:hover { background: var(--surface-2); text-decoration: none; }
.pager span.disabled { opacity: .4; pointer-events: none; }
.pager span.cur { background: linear-gradient(135deg, var(--pine), var(--pine-deep)); border-color: transparent; color: #fff; }

.linkcell { font-weight: 650; }
.subtle { color: var(--ink-faint); font-size: .8rem; }

/* ---------- Member profile ---------- */
.profile { display: flex; align-items: center; gap: 1.1rem; }
.profile .avatar-lg {
  width: 70px; height: 70px; border-radius: 20px; flex: none; display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 750; color: #fff;
  background: linear-gradient(135deg, var(--m-member), color-mix(in srgb, var(--m-member) 55%, #000));
}
.profile h2 { font-family: var(--sans); font-size: 1.55rem; font-weight: 780; letter-spacing: -.02em; }
.profile .meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .3rem; color: var(--ink-faint); font-size: .86rem; }
.profile .mono { color: var(--pine); font-weight: 700; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: .6rem 1rem; font-size: .9rem; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; color: var(--ink); }

.balance-big { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ---------- Forms: two-column rows ---------- */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
select.input { appearance: none; }
select.input option { background: var(--surface); color: var(--ink); }
.form-actions { display: flex; gap: .7rem; margin-top: 1.4rem; }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .3rem; display: block; }
.validation-summary-errors ul { margin: .2rem 0 0; padding-left: 1.1rem; }
/* Hide the (empty) validation summary box until the form actually has errors. */
.validation-summary-valid { display: none; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } .searchbox input { min-width: 0; width: 100%; } }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; top: 1rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .6rem; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: .7rem; padding: .85rem 1rem;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  border-left: 3px solid var(--pine);
  transform: translateX(120%); opacity: 0; transition: transform .28s ease, opacity .28s ease;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.ok { border-left-color: var(--pos); }
.toast.err { border-left-color: var(--danger); }
.toast .ti { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .8rem; font-weight: 800; }
.toast.ok .ti { background: var(--pos); }
.toast.err .ti { background: var(--danger); }
.toast .tmsg { font-size: .88rem; line-height: 1.4; }
.toast .tx { margin-left: auto; cursor: pointer; color: var(--ink-faint); background: none; border: none; font-size: 1.1rem; line-height: 1; padding: 0 .1rem; }

/* ---------- Modal (confirm dialogs) ---------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 150; display: none;
  background: rgba(3,7,25,.55); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 1.5rem;
}
.modal-scrim.show { display: flex; }
.modal-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.5rem;
  transform: translateY(10px) scale(.98); transition: transform .18s ease;
}
.modal-scrim.show .modal-card { transform: none; }
.modal-card .mic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 1rem;
  color: var(--danger); background: var(--danger-tint); }
.modal-card .mic svg { width: 24px; height: 24px; }
.modal-card h3 { font-size: 1.2rem; font-weight: 750; letter-spacing: -.02em; margin-bottom: .4rem; }
.modal-card p { color: var(--ink-soft); font-size: .92rem; margin-bottom: 1.3rem; }
.modal-card .macts { display: flex; gap: .6rem; justify-content: flex-end; }

/* ---------- Searchable select ---------- */
.ss { position: relative; }
.ss-input {
  cursor: pointer; display: flex; align-items: center; padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a90b0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
}
.ss-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); overflow: hidden; display: none;
}
.ss.open .ss-panel { display: block; }
.ss-search { padding: .5rem; border-bottom: 1px solid var(--line); }
.ss-search input { width: 100%; padding: .5rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-family: inherit; font-size: .9rem; }
.ss-search input:focus { outline: none; border-color: var(--pine); }
.ss-list { max-height: 240px; overflow-y: auto; }
.ss-opt { padding: .55rem .8rem; font-size: .9rem; cursor: pointer; color: var(--ink); }
.ss-opt:hover, .ss-opt.active { background: color-mix(in srgb, var(--pine) 14%, transparent); }
.ss-opt.sel { font-weight: 650; color: var(--pine); }
.ss-empty { padding: .8rem; color: var(--ink-faint); font-size: .85rem; text-align: center; }

/* ---------- Mobile ---------- */
.scrim { display: none; }
@media (max-width: 1180px) {
  .col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9 { grid-column: span 12; }
}
@media (max-width: 940px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; width: var(--sidebar-w); height: 100vh;
    transform: translateX(-105%); transition: transform .22s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); }
  .topbar .menu-btn { display: grid; }
}
/* Collapsible sidebar on desktop — the menu button shrinks it to an icon rail; hovering it
   expands back to the full panel as an overlay so labels & sub-menus stay reachable. */
@media (min-width: 941px) {
  body.sidebar-collapsed .app { grid-template-columns: var(--sidebar-rail) 1fr; }
  body.sidebar-collapsed .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-rail); z-index: 60;
  }
  /* The fixed sidebar leaves the grid flow, so pin the content to the 2nd (wide) column
     — otherwise it would fall back into the narrow rail track. */
  body.sidebar-collapsed .main { grid-column: 2; }
  body.sidebar-collapsed .sidebar:hover { width: var(--sidebar-w); box-shadow: var(--shadow-lg); }

  /* Rail look — icons only, shown while the rail is NOT hovered. */
  body.sidebar-collapsed .sidebar:not(:hover) .nav-group .label,
  body.sidebar-collapsed .sidebar:not(:hover) .nav > li > a > span:not(.ico-wrap),
  body.sidebar-collapsed .sidebar:not(:hover) .subnav,
  body.sidebar-collapsed .sidebar:not(:hover) .userpill .u,
  body.sidebar-collapsed .sidebar:not(:hover) .sidebar-foot .btn .label {
    display: none;
  }
  body.sidebar-collapsed .sidebar:not(:hover) .nav > li > a,
  body.sidebar-collapsed .sidebar:not(:hover) .userpill,
  body.sidebar-collapsed .sidebar:not(:hover) .sidebar-foot .btn { justify-content: center; padding-left: 0; padding-right: 0; }
  body.sidebar-collapsed .sidebar:not(:hover) .nav-group { padding-left: .3rem; padding-right: .3rem; }
  body.sidebar-collapsed .sidebar:not(:hover) .brand { justify-content: center; padding-left: .3rem; padding-right: .3rem; }
}
@media (max-width: 1080px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth .brandside { display: none; }
  .content { padding: 1.1rem 1.1rem 2.5rem; }
}

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; border-radius: 4px; }

/* ---------- Sidebar sub-navigation (e.g. Food › Fusion / Ravi) ---------- */
.nav .subnav { list-style: none; margin: .1rem 0 .35rem; padding: 0; display: none; }
.nav li.open > .subnav { display: block; }
.nav .chev { margin-left: auto; width: 15px; height: 15px; flex: none; color: var(--sidebar-mut); transition: transform .18s ease; }
.nav li.open > a .chev { transform: rotate(90deg); }
.nav a.active .chev { color: #fff; }
.nav .subnav > li { margin: 0; }
.nav .subnav a { display: flex; align-items: center; gap: .55rem; padding: .34rem .8rem .34rem 3rem; border-radius: 8px; font-size: .84rem; color: var(--sidebar-mut); text-decoration: none; }
.nav .subnav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav .subnav a.active { color: #fff; background: rgba(255,255,255,.06); font-weight: 600; }
.nav .subnav a.active .subdot { opacity: 1; background: var(--dot, var(--pine)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--pine)) 25%, transparent); }
.nav .subnav .subdot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; flex: none; }
.nav .subnav .sub-tag { margin-left: auto; font-size: .64rem; text-transform: uppercase; letter-spacing: .04em; opacity: .55; }
/* Second-level accordion (e.g. Food ▸ Fusion ▸ pages): deeper indent, chevron follows the tag */
.nav .subnav .subnav { margin: .1rem 0 .25rem; }
.nav .subnav .subnav a { padding-left: 3.9rem; font-size: .8rem; }
.nav .subnav a .chev { margin-left: .35rem; }

/* ---------- Print (report preview) ---------- */
.print-head { display: none; }
@page { margin: 14mm; }
@media print {
  /* Hide the app chrome so only the report content prints. */
  .sidebar, .topbar, .scrim, .modal-scrim, .no-print { display: none !important; }
  .app { display: block !important; }
  .main { background: #fff !important; }
  .content { padding: 0 !important; max-width: none !important; }
  body, .app, .main, .content { background: #fff !important; color: #111 !important; }

  /* Print-only letterhead at the top of the report. */
  .print-head {
    display: flex !important; justify-content: space-between; align-items: flex-end;
    border-bottom: 2px solid #333; padding-bottom: 8px; margin-bottom: 18px;
  }
  .print-head .ph-brand { font-size: 22px; font-weight: 800; color: #e9572c; letter-spacing: -.02em; }
  .print-head .ph-brand span { display: block; font-size: 10px; font-weight: 600; color: #555; text-transform: none; letter-spacing: .02em; }
  .print-head .ph-meta { text-align: right; font-size: 11px; color: #333; }
  .print-head .ph-meta b { display: block; font-size: 14px; color: #111; }

  /* Keep cards / tables from splitting awkwardly across pages. */
  .card, .stat, table, .grid > * { break-inside: avoid; }
  a { color: #111 !important; text-decoration: none !important; }
}

/* ---- Dashboard profit/loss chart (revenue vs expenses) ---- */
.pnl-chart { position:relative; display:flex; align-items:stretch; gap:.5rem; height:300px; padding:1.1rem .2rem .2rem; overflow-x:auto;
    background-image:repeating-linear-gradient(to top, var(--line-soft) 0 1px, transparent 1px 20%); background-position:0 -1px; }
.pnl-chart.loading { opacity:.4; }
.pnl-col { flex:1 0 36px; display:flex; flex-direction:column; align-items:center; gap:.25rem; min-width:0; }
.pnl-bars { flex:1; display:flex; align-items:flex-end; gap:3px; width:100%; justify-content:center; min-height:0; }
.pnl-bar { width:15px; border-radius:4px 4px 0 0; transition:height .3s ease, filter .12s; }
.pnl-bar.rev { background:var(--pos); }
.pnl-bar.exp { background:var(--danger); }
.pnl-col:hover .pnl-bar { filter:brightness(1.12); }
.pnl-lbl { font-size:.68rem; color:var(--ink-soft); white-space:nowrap; }
.pnl-net { font-size:.68rem; font-weight:700; white-space:nowrap; }
.pnl-ymax { position:absolute; top:.2rem; left:.2rem; font-size:.66rem; color:var(--ink-faint); }
.pnl-legend { display:flex; gap:1rem; align-items:center; font-size:.8rem; color:var(--ink-soft); }
.pnl-legend .sw { display:inline-block; width:11px; height:11px; border-radius:3px; margin-right:.35rem; vertical-align:middle; }

/* ---- Selected-person info card (department pickers) ---- */
.person-card {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  margin-top: .6rem;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  animation: pc-in .16s ease-out;
}
.person-card.loading { opacity: .5; }
@keyframes pc-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.person-card .pc-photo {
  width: 54px; height: 54px; flex: 0 0 54px;
  border-radius: 10px; object-fit: cover;
  border: 1px solid var(--line);
}
.person-card .pc-initials {
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; color: var(--ink-soft);
  background: var(--surface); text-transform: uppercase;
}
.person-card .pc-body { flex: 1 1 auto; min-width: 0; }
.person-card .pc-name { font-weight: 700; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.person-card .pc-meta { font-size: .85rem; margin-top: .15rem; }
.person-card .pc-reason {
  margin-top: .5rem; padding-top: .5rem;
  border-top: 1px dashed var(--line);
  font-size: .9rem;
}
.person-card .pc-label {
  display: inline-block; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em;
  color: var(--ink-faint); margin-right: .45rem;
}
.person-card .pc-checkin { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.person-card .pc-checkin-form { display: inline-flex; align-items: center; gap: .4rem; }
.person-card .pc-checkin-form .input { padding: .3rem .5rem; min-width: 180px; }
.btn-sm { padding: .28rem .7rem; font-size: .82rem; }
