/* ============================================================
   PEACOX HELPING HANDS — Shared Design System
   Vanilla CSS. No frameworks.
   Role accents: body[data-role="student" | "mentor" | "pm"]
   ============================================================ */

:root {
    /* Brand — primary accent is DEEP BLUE (2026-07-27, fourth iteration:
       original purple #5A2E8E too vivid, navy #212A52 too dull, indigo
       #5560C9 close; token names kept to avoid a mass rename) */
    --peacox-purple: #1E3A8A;
    --peacox-purple-dark: #16306E;   /* must stay DARKER than the base accent:
                                        gradients and hovers derive from it */
    /* Tints derived from the accent's own hue (224°) — the old values sat
       at 235°, reading faintly violet next to the blue */
    --peacox-purple-soft: #EEF2FB;
    --peacox-purple-border: #D4DCF2;
    --peacox-teal: #008080;
    --peacox-teal-dark: #066666;
    --peacox-teal-soft: #E9F7F5;
    --peacox-teal-border: #C4E9E3;
    /* Category hue for Major Events. It used to borrow --info, which after
       the deep-blue accent landed sat 3° from Community Engagement — the two
       categories were indistinguishable. Semantic tokens (info/ok/warn) no
       longer double as category colors. */
    --peacox-plum: #783E5D;
    --peacox-plum-soft: #F9F0F5;
    --peacox-plum-border: #EDD4E1;

    /* Goal tiers — shared by the goal rows and the bars they describe */
    --goal-monthly: #45825F;
    --goal-annual: #2F4F4F;

    /* Neutrals (slate) */
    --bg-color: #F6F7FB;
    --card-bg: #FFFFFF;
    --text-main: #17203A;
    --text-soft: #1F1F1F;   /* near-black 2026-07-27: neutral greys, no blue tint */
    --text-muted: #353535;  /* darker again — small text was still reading faded */
    --text-faint: #6F7899;  /* ≥3:1 on white (WCAG secondary-text floor) */
    --border-color: #E6E8F0;
    --border-strong: #D5D9E6;
    --hover-bg: #F2F3F9;

    /* Status */
    --ok: #0B845C;      --ok-soft: #E7F8F1;      --ok-border: #BCEBD8;
    --warn: #B45309;    --warn-soft: #FEF3E2;    --warn-border: #FBDDB0;
    --danger: #DC2626;  --danger-soft: #FDEDED;  --danger-border: #F8CACA;
    /* Muted steel blue: informational, and clearly subordinate to the
       deep-blue accent rather than competing with it */
    --info: #3A6491;    --info-soft: #EFF5FA;    --info-border: #D3E0EE;

    /* Effects */
    --glass-bg: rgba(255, 255, 255, 0.82);
    /* Two-layer shadows: a tight contact shadow plus a soft ambient one.
       Reads as depth rather than a diffuse glow — the single wide blurs
       these replaced made cards look like they were floating. */
    --shadow-xs: 0 1px 2px rgba(23, 32, 58, 0.05);
    --shadow-sm: 0 1px 3px rgba(23, 32, 58, 0.07), 0 1px 2px rgba(23, 32, 58, 0.04);
    --shadow-md: 0 4px 10px -2px rgba(23, 32, 58, 0.10), 0 2px 4px -2px rgba(23, 32, 58, 0.06);
    --shadow-lg: 0 14px 36px -10px rgba(23, 32, 58, 0.20), 0 4px 10px -4px rgba(23, 32, 58, 0.08);
    --ring: 0 0 0 3px rgba(30, 58, 138, 0.18);

    /* Shape & rhythm */
    /* One scale, four steps. The rule that matters: anything nested inside
       a card must be a SMALLER step than the card (--radius-lg), or the
       corners read wrong. Before this pass, inner panels were 12px inside
       11px cards. */
    --radius-xs: 4px;     /* chips, legend swatches, micro-badges */
    --radius-sm: 6px;     /* small controls, calendar days */
    --radius-md: 8px;     /* nested panels, buttons, inputs */
    --radius-lg: 11px;    /* top-level cards, modals */
    --radius-pill: 999px; /* tags, status pills */
    /* Spacing scale. Same discipline as the radius scale: a handful of
       steps instead of a continuum. Gaps previously used twelve different
       values between 0.25rem and 1.1rem, which is what made spacing read
       as improvised rather than designed. */
    --space-1: 0.25rem;   /* hairline gaps, icon-to-label */
    --space-2: 0.4rem;    /* tight stacks, chip rows */
    --space-3: 0.55rem;   /* default gap inside a card */
    --space-4: 0.75rem;   /* card header to body, section breaks */
    --space-5: 1rem;      /* between major blocks */

    /* NESTING RULE (mirrors the radius one): a panel inside an already
       padded card pads LESS than the card. They used to be near-equal
       (13px card + 12px panel), pushing text ~26px off the card edge and
       wasting ~13% of a card's width on two stacked paddings. */
    --pad-card: clamp(10px, 1vw, 16px);
    --pad-nested: 0.5rem;

    /* rem so sticky offsets track the fluid root size:
       0.75rem padding ×2 + 3.75rem avatar = 5.25rem (84px @16px root) */
    --header-h: 5.25rem;

    /* Shared page geometry: header, tabs, and main content all compute
       their inline padding from the same centered container, so they
       stay edge-aligned at every viewport width. */
    --content-max: 107.5rem;                 /* 1720px @16px root, scales with it */
    --board-max: 56.25rem;                   /* 900px: PM pane height cap — its inbox lists
                                                are unbounded so the pane can't size to
                                                content; student/mentor boards size to their
                                                natural content height instead */
    --content-pad: clamp(12px, 1.4vw, 24px);

    /* Type, three voices: Space Grotesk carries structure (titles, tabs,
       toggle labels, display numbers); IBM Plex Sans carries content (body,
       tables, forms); Atkinson Hyperlegible Next — the Braille Institute's
       low-vision face — carries READING rows where legibility matters most
       (goals list, session tile, event rows and their parallels). All body
       faces load capped at 700 so legacy 800/900 rules resolve to a true
       700; body font-size-adjust keeps optical sizes consistent across
       faces. Space Grotesk loads at 400/500/600 only. */
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'IBM Plex Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-reading: 'Atkinson Hyperlegible Next', 'IBM Plex Sans', system-ui, sans-serif;

    /* Default accent = purple */
    --accent: var(--peacox-purple);
    --accent-dark: var(--peacox-purple-dark);
    --accent-soft: var(--peacox-purple-soft);
    --accent-border: var(--peacox-purple-border);
    --accent-contrast: #FFFFFF;
}

body[data-role="mentor"] {
    --accent: var(--peacox-teal);
    --accent-dark: var(--peacox-teal-dark);
    --accent-soft: var(--peacox-teal-soft);
    --accent-border: var(--peacox-teal-border);
    --ring: 0 0 0 3px rgba(0, 128, 128, 0.18);
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Fluid root scale (desktop): rem-based sizes track viewport width so
   a 2560px monitor doesn't render a postage stamp and a 1280px
   effective viewport (150% OS scaling) doesn't render a poster.
   ≈15px root at 1344px → 16.2px at 1720px → 18.8px at 2560px. */
@media (min-width: 900px) {
    html { font-size: clamp(15px, 0.3125vw + 10.8px, 19px); }
}
body {
    font-family: var(--font-body);
    /* Plex's x-height (~0.516em) reads smaller than Inter's (~0.546) at the
       same declared size — normalize the optical size up to 0.55 so small
       text regains presence without touching any declared font-size.
       Display-face elements opt back out below (approved looks stay put). */
    font-size-adjust: 0.55;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 100% 0%, rgba(30, 58, 138, 0.045), transparent 480px),
        radial-gradient(circle at 0% 100%, rgba(0, 128, 128, 0.045), transparent 480px);
    /* NOTE: no background-attachment:fixed — it stalls Chromium's compositor
       when combined with backdrop-filter on sticky elements. */
    color: var(--text-main);
    font-size: 0.9375rem; /* 15px @16 root — rem so it follows the fluid scale */
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh; /* mobile browser chrome-aware */
    display: flex;
    flex-direction: column;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }

/* Keyboard users always get a visible focus indicator (WCAG 2.4.7).
   Inputs keep their own :focus treatment; everything else gets the ring. */
:is(button, a, select, summary, [role="button"], [tabindex]):focus-visible {
    outline: none;
    box-shadow: var(--ring);
}
.check-item:focus-within, .ctrl-opt:focus-within { box-shadow: var(--ring); }
a { color: var(--accent); }
img, svg { display: block; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CDD2E1; border-radius: var(--radius-pill); border: 2px solid var(--bg-color); }
::-webkit-scrollbar-thumb:hover { background: #B4BACF; }

/* ---------- Motion ---------- */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn    { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slideIn  { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes toastIn  { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pulse    { 0% { box-shadow: 0 0 0 0 rgba(14,159,110,.45); } 70% { box-shadow: 0 0 0 6px rgba(14,159,110,0); } 100% { box-shadow: 0 0 0 0 rgba(14,159,110,0); } }
@keyframes shimmer  { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.stagger-1 { animation: fadeUp .5s cubic-bezier(.16,1,.3,1) .05s both; }
.stagger-2 { animation: fadeUp .5s cubic-bezier(.16,1,.3,1) .12s both; }
.stagger-3 { animation: fadeUp .5s cubic-bezier(.16,1,.3,1) .19s both; }
.stagger-4 { animation: fadeUp .5s cubic-bezier(.16,1,.3,1) .26s both; }

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

.skeleton {
    background: linear-gradient(90deg, #EEF0F6 25%, #E2E5EF 50%, #EEF0F6 75%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
    color: transparent !important;
    border-color: transparent !important;
    user-select: none;
}
.skeleton * { visibility: hidden; }

/* ---------- Skip link (keyboard users bypass header/tabs) ---------- */
.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 500;
    background: var(--accent); color: #fff; font-weight: 700; font-size: 0.85rem;
    padding: 0.65rem 1.1rem; border-radius: 0 0 var(--radius-md) 0; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.app-header {
    position: sticky; top: 0; z-index: 100;
    display: flex; justify-content: space-between; align-items: center; gap: var(--space-5);
    min-height: var(--header-h);
    /* inline padding matches the centered content container exactly */
    padding: 0.75rem calc(max(0px, (100% - var(--content-max)) / 2) + var(--content-pad));
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
}
.header-profile { display: flex; align-items: center; gap: var(--space-5); min-width: 0; }
.header-info { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.header-info h1 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-sub { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.header-tags { display: flex; gap: var(--space-3); margin-top: 0.35rem; flex-wrap: wrap; }
.header-actions { display: flex; gap: var(--space-3); align-items: center; flex-shrink: 0; }
@media (max-width: 640px) {
    .app-header { flex-wrap: wrap; padding-bottom: 0.75rem; }
    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1; }
}

/* Negative block margin lets the portrait run larger than the bar's
   content row without adding a pixel of header height. */
.avatar-wrapper { position: relative; cursor: pointer; transition: transform .18s; flex-shrink: 0; margin-block: -0.5rem; }
.avatar-wrapper:hover { transform: scale(1.04); }
.avatar {
    width: 4.4rem; height: 4.4rem; border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff; display: flex; justify-content: center; align-items: center;
    font-weight: 800; font-size: 1.3rem; letter-spacing: 0.02em;
    background-size: cover; background-position: center;
    border: 2px solid #fff; box-shadow: var(--shadow-sm);
}
/* Camera badge retired 2026-07-17 — the photo-upload trigger lives in
   the side pane header (.side-avatar-btn) so nothing covers the portrait. */

/* ---------- Tags / chips / badges ---------- */
.tag {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: 0.22rem 0.6rem; border-radius: var(--radius-pill);
    font-size: 0.7rem; font-weight: 700; border: 1px solid; white-space: nowrap;
}
.tag-info    { background: var(--info-soft);   color: var(--info);   border-color: var(--info-border); }
.tag-success { background: var(--ok-soft);     color: var(--ok);     border-color: var(--ok-border); }
.tag-warn    { background: var(--warn-soft);   color: var(--warn);   border-color: var(--warn-border); }
.tag-alert   { background: var(--warn-soft);   color: var(--warn);   border-color: var(--warn-border); }
.tag-danger  { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.tag-accent  { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.tag-alert::before, .status-active::before {
    content: ""; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: currentColor;
}
.status-active {
    display: inline-flex; align-items: center; gap: var(--space-1);
    background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-border);
    font-size: 0.65rem; font-weight: 700; padding: 0.14rem 0.5rem; border-radius: var(--radius-pill);
}
.status-active::before { animation: pulse 2s infinite; }

.badge {
    display: inline-flex; align-items: center;
    padding: 0.14rem 0.5rem; border-radius: var(--radius-sm);
    font-size: 0.66rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
    color: #fff; white-space: nowrap;
}
.badge-ok { background: var(--ok); } .badge-warn { background: var(--warn); }
.badge-danger { background: var(--danger); } .badge-info { background: var(--info); }
.badge-accent { background: var(--accent); } .badge-muted { background: var(--text-muted); }

/* ---------- Layout: dashboard grid ---------- */
.dash {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(7px, 0.7vw, 13px);
    width: 100%;
    padding: var(--content-pad)
             calc(max(0px, (100% - var(--content-max)) / 2) + var(--content-pad));
    flex: 1;
    align-content: start;
}
.col-1 { grid-column: span 1; } .col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }

@media (max-width: 1180px) {
    .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .col-3, .col-4 { grid-column: span 2; }
}
@media (max-width: 720px) {
    .dash { grid-template-columns: 1fr; }
    .col-1, .col-2, .col-3, .col-4 { grid-column: span 1; }
    .header-tags { display: none; }
}

/* ---------- Site footer (trademark / copyright) ---------- */
.site-footer {
    flex-shrink: 0; margin-top: auto;
    padding: 0.4rem var(--content-pad) 0.55rem;
    text-align: center;
    font-size: 0.6rem; font-weight: 600; letter-spacing: 0.06em;
    color: var(--text-faint);
}
.site-footer .brand { color: var(--accent); font-weight: 800; letter-spacing: 0.09em; }

/* ---------- Cards ---------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--pad-card);
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-xs);
    transition: box-shadow .25s, border-color .25s, transform .25s;
    min-width: 0;
}
.card.hoverable:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--accent-border); }
.card-header {
    display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
    /* Tile titles: Space Grotesk semi-bold, Title Case (0.875rem = 14px @16px root) */
    font-family: var(--font-display);
    font-size: 0.875rem; font-weight: 600; line-height: 1.2;
    letter-spacing: 0; text-transform: none;
    color: #464D5C;
    margin-bottom: var(--space-3); flex-shrink: 0;
    flex-wrap: wrap; row-gap: var(--space-2);
}
/* Controls that live inside a card header keep the body font
   (toggle labels are NOT in this list — they take the display face) */
.card-header :is(.btn, .mini-btn, select, .filter-bar) {
    font-family: var(--font-body);
    font-size-adjust: 0.55;   /* re-apply: the exemption below inherits in */
}

/* Display-face elements render at their true metrics — the body's
   x-height normalization is for the Plex content voice only */
.card-header, .qp-nav .hint, .header-info h1, .modal-header h2,
.side-header h2, .form-section > h3, .tab-btn, .stat-val,
.progress-value, .login-card h1, .brand-name {
    font-size-adjust: none;
}
.card-header > h3 { white-space: nowrap; }
.card-header .hint { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--accent); }
/* Chevron-toggle labels & pager positions — the calm display style the
   rest of the type system keys off: display face, medium weight, quiet
   dark ink, no caps or tracking. Wins over .card-header .hint by order. */
.qp-nav .hint {
    font-family: var(--font-display);
    font-weight: 500; font-size: 0.875rem;
    text-transform: none; letter-spacing: 0;
    color: var(--text-main);
}
.card-accent-left   { border-left: 3px solid var(--accent); }
.card-accent-top    { border-top: 3px solid var(--accent); }
.card-accent-warn   { border-left: 3px solid var(--warn); }
/* Left-accented tiles get squared left edges so the accent bar reads as a solid strip */
.card-accent-left, .card-accent-warn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: 0.55rem 1rem; border-radius: var(--radius-md);
    font-weight: 700; font-size: 0.85rem; border: 1px solid transparent;
    transition: all .18s; white-space: nowrap; text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:not(:disabled):active { transform: translateY(0) scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: var(--accent-contrast); box-shadow: var(--shadow-xs); }
.btn-primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 3px 8px -2px color-mix(in srgb, var(--accent) 42%, transparent); }
.btn-outline { background: var(--card-bg); color: var(--accent); border-color: var(--accent-border); }
.btn-outline:not(:disabled):hover { background: var(--accent-soft); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border-color); }
.btn-ghost:not(:disabled):hover { background: var(--hover-bg); color: var(--text-main); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger-border); }
.btn-danger-ghost:not(:disabled):hover { background: var(--danger-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:not(:disabled):hover { background: #B91C1C; }
.btn-sm { padding: 0.32rem 0.65rem; font-size: 0.72rem; border-radius: var(--radius-md); }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.8rem; height: 1.8rem; border-radius: var(--radius-md);
    background: none; border: none; color: var(--text-muted); transition: all .15s;
}
.icon-btn:hover { background: var(--hover-bg); color: var(--accent); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn:active { transform: scale(0.92); }

/* Touch devices get full-size targets (44px floor) without inflating
   the pointer-precise desktop density. */
@media (pointer: coarse) {
    .icon-btn, .inbox-actions .icon-btn { width: 2.75rem; height: 2.75rem; }
    .modal-close { width: 2.75rem; height: 2.75rem; }
    .btn-sm { padding: 0.6rem 0.9rem; }
    .cal-nav { padding: 0.55rem 0.9rem; }
    .ctrl-btn { padding: 0.55rem 0.8rem; }
    .inbox-actions { gap: var(--space-3); }
}

/* ---------- Forms ---------- */
.field-label {
    display: block; font-size: 0.66rem; font-weight: 800; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.3rem;
}
.input-full {
    width: 100%; padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    background: var(--card-bg); font-size: 0.875rem;
    margin-bottom: 0.85rem; transition: border-color .15s, box-shadow .15s;
    resize: vertical;
}
.input-full:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input-full::placeholder { color: var(--text-faint); }
select.input-full { cursor: pointer; }
.input-inline { margin-bottom: 0; }
.select-compact {
    padding: 0.28rem 0.5rem; font-size: 0.72rem; font-weight: 700;
    border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--card-bg);
    color: var(--text-soft); cursor: pointer; max-width: 100%;
}
.select-compact:focus { outline: none; border-color: var(--accent); }

.form-section { margin-bottom: 1.4rem; }
.form-section:last-child { margin-bottom: 0; }
.form-section > h3 {
    font-family: var(--font-display); font-weight: 600;
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--accent); margin-bottom: 0.75rem; text-align: center;
    border-bottom: 2px solid var(--accent-soft); padding-bottom: 0.3rem;
}

/* Password input with a show/hide toggle */
.pw-field { position: relative; margin-bottom: 0.85rem; }
.pw-field .input-full { margin-bottom: 0; padding-right: 2.5rem; }
.pw-toggle {
    position: absolute; right: 0.3rem; top: 50%; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.8rem; height: 1.8rem; border-radius: var(--radius-md);
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; transition: color .15s;
}
.pw-toggle:hover { color: var(--text-main); }

/* Consistent gap between the last form section and the submit button */
.modal-content-pane form > .btn-block { margin-top: 1.4rem; }

/* Card-header control cluster: filter popover buttons + copy/export
   mini buttons (PM tables and the mentor mentee roster). */
.filter-bar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.mini-btn-group { display: flex; background: var(--bg-color); border: 1px solid var(--border-strong); border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; }
.mini-btn { display: flex; align-items: center; gap: var(--space-1); background: none; border: none; padding: 0.3rem 0.55rem; font-size: 0.7rem; font-weight: 700; color: var(--text-soft); transition: all .15s; }
.mini-btn + .mini-btn { border-left: 1px solid var(--border-strong); }
.mini-btn:hover { background: var(--accent-soft); color: var(--accent); }
.mini-btn.active { background: var(--accent-soft); color: var(--accent); }

/* Month event lists: cap at ~2.5 rows with snap scrolling and a
   bottom fade so long months stop distending the whole page. */
.event-scroll { max-height: 9.2rem; overflow-y: auto; scroll-snap-type: y proximity; }
.event-scroll .event-row { scroll-snap-align: start; }
.event-scroll::after {
    content: ''; position: sticky; bottom: 0; display: block;
    height: 20px; margin-top: -20px; pointer-events: none;
    background: linear-gradient(transparent, var(--card-bg));
}

/* Quarterly Performance + Goals tiles: header period nav, compact
   stats, per-stat line-pattern keys, and goal rows. */
.qp-nav { display: inline-flex; align-items: center; gap: 0.1rem; }
.qp-nav .cal-nav:disabled { opacity: 0.3; pointer-events: none; }
.qp-stats { flex: 0 0 auto; }
.qp-stats .stat-val { font-size: 1.35rem; }
.qp-key { text-align: center; line-height: 0; margin-top: 0.1rem; }
.qp-key svg { display: inline-block; vertical-align: middle; }

.goal-row { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-reading); }
.goal-row .goal-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.78rem; }
.goal-row .goal-count { font-size: 0.78rem; }
.goal-kind {
    flex-shrink: 0; width: 15px; height: 15px; border-radius: var(--radius-xs);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.56rem; font-weight: 900; line-height: 1;
    background: var(--hover-bg); color: var(--text-faint);
    border: 1px solid var(--border-color); cursor: default;
}
.goal-kind.annual { color: var(--goal-annual); border-color: var(--goal-annual); }
.goal-count { flex-shrink: 0; min-width: 1.6rem; text-align: right; }
.goal-check { flex-shrink: 0; width: 14px; height: 13px; display: inline-flex; align-items: center; line-height: 0; }

/* Capacity flag: quiet dot + tinted text beside a caseload line
   (PM mentor roster and the mentor dashboard header). */
.cap-flag { font-size: 0.64rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; margin-left: 0.4rem; white-space: nowrap; }
.cap-flag::before { content: '●'; font-size: 0.5rem; margin-right: 0.24rem; vertical-align: 1.5px; }
.cap-open { color: var(--ok); }
.cap-full { color: var(--warn); }
.cap-off { color: var(--text-faint); }

/* Session mode pills (mentor dash session tools + PM mentorship detail) */
.session-pill { font-size: 0.62rem; font-weight: 800; padding: 0.15rem 0.5rem; border-radius: var(--radius-pill); flex-shrink: 0; }
.pill-virtual { color: var(--peacox-purple); background: var(--peacox-purple-soft); }
.pill-inperson { color: var(--peacox-teal); background: var(--peacox-teal-soft); }
.form-row { display: flex; gap: 0.85rem; }
.form-row > * { flex: 1; min-width: 0; }
@media (max-width: 560px) { .form-row { flex-direction: column; gap: 0; } }

.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
@media (max-width: 560px) { .check-grid { grid-template-columns: 1fr; } }
.check-item {
    display: flex; align-items: center; gap: var(--space-3);
    font-size: 0.8rem; font-weight: 500; color: var(--text-main);
    padding: 0.5rem 0.6rem; background: var(--bg-color);
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    cursor: pointer; transition: all .15s;
}
.check-item:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.check-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.check-item input { width: 0.95rem; height: 0.95rem; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

.form-msg { text-align: center; margin-top: 0.9rem; font-weight: 700; font-size: 0.85rem; display: none; }
.form-msg.ok { color: var(--ok); display: block; }
.form-msg.err { color: var(--danger); display: block; }

/* ---------- Info boxes ---------- */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 560px) { .info-grid { grid-template-columns: 1fr; } }
.info-box { background: var(--bg-color); padding: var(--pad-nested) 0.7rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); min-width: 0; }
.info-label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 800; margin-bottom: 0.2rem; }
.info-val { font-size: 0.85rem; font-weight: 600; color: var(--text-main); overflow-wrap: break-word; }

/* ---------- Stats ---------- */
.stats-grid { display: flex; align-items: stretch; text-align: center; flex: 1; }
.stat-col { flex: 1; border-right: 1px solid var(--border-color); padding: 0.25rem 0.4rem; display: flex; flex-direction: column; justify-content: center; gap: var(--space-1); min-width: 0; }
.stat-col:last-child { border-right: none; }
.stat-label { font-size: 0.66rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-val { font-family: var(--font-display); font-size: clamp(1.5rem, 2vw, 2rem); font-weight: 600; color: var(--text-main); line-height: 1.05; letter-spacing: -0.01em; }

.delta-badge {
    display: inline-flex; align-items: center; gap: 2px; margin: 0 auto;
    padding: 0.14rem 0.5rem; border-radius: var(--radius-pill); font-size: 0.65rem; font-weight: 800;
}
.delta-good { background: var(--ok-soft); color: var(--ok); }
.delta-bad { background: var(--warn-soft); color: var(--warn); }
.delta-flat { background: var(--hover-bg); color: var(--text-muted); }

/* ---------- Tables ---------- */
.table-scroll { flex: 1; overflow-y: auto; overflow-x: auto; min-height: 0; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.78rem; }
.data-table thead { position: sticky; top: 0; background: var(--card-bg); z-index: 5; }
.data-table thead th {
    padding: 0.5rem; font-size: 0.66rem; font-weight: 800; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
    border-bottom: 2px solid var(--border-color); white-space: nowrap;
}
.data-table tbody td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--hover-bg); }
.data-table .cell-center { text-align: center; }
.row-link { text-decoration: none; color: var(--accent); font-weight: 700; }
.row-link:hover { text-decoration: underline; }
.row-select { cursor: pointer; }
.row-select.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- Lists ---------- */
.list-item {
    display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
    padding: 0.55rem 0.25rem; border-bottom: 1px solid var(--border-color);
}
.list-item:last-child { border-bottom: none; }
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
    padding: 1.4rem 1rem; color: var(--text-faint); text-align: center;
    font-size: 0.8rem; font-weight: 500; flex: 1;
}
.empty-state svg { opacity: 0.6; }

/* ---------- Progress ---------- */
.progress-track { width: 100%; height: 0.5rem; background: var(--hover-bg); border-radius: var(--radius-pill); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: var(--radius-pill); transition: width .5s cubic-bezier(.16,1,.3,1); }
.progress-fill.teal { background: var(--peacox-teal); }
.progress-fill.purple { background: var(--peacox-purple); }
.progress-group { display: flex; flex-direction: column; gap: var(--space-2); }
.progress-header { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.8rem; font-weight: 700; }

.circular-progress {
    position: relative; width: 84px; height: 84px; border-radius: 50%; flex-shrink: 0;
    display: flex; justify-content: center; align-items: center;
    background: conic-gradient(var(--accent) 0deg, var(--hover-bg) 0deg);
    transition: background .5s ease-out;
}
.circular-progress::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--card-bg); }
.progress-value { position: relative; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }

/* ---------- Calendar ---------- */
.calendar-wrapper { display: flex; flex-direction: column; min-height: 0; }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; font-weight: 800; font-size: 0.82rem; }
/* Period-nav chevrons (calendar months, quarter/month/event toggles):
   chip-styled so they read as controls at a glance. */
/* Chevron steppers: borderless at rest (the arrow carries the weight),
   border + tint surface on hover */
.cal-nav {
    background: transparent; border: 1px solid transparent; border-radius: var(--radius-md);
    color: var(--text-soft); font-size: 1.2rem; font-weight: 800; line-height: 1;
    padding: 0.1rem 0.5rem; transition: all .15s;
}
.cal-nav:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-day-header { text-align: center; font-size: 0.62rem; color: var(--text-faint); font-weight: 800; padding-bottom: 0.25rem; text-transform: uppercase; }
.cal-day {
    position: relative; aspect-ratio: 1.15; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 600; color: var(--text-soft);
    background: var(--bg-color); border: 1px solid transparent;
    cursor: pointer; transition: all .15s;
}
.cal-day:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.cal-day.today { border: 2px solid var(--accent); color: var(--accent-dark); font-weight: 800; }
.cal-day.empty { background: transparent; cursor: default; border: none; }
.cal-dots { position: absolute; bottom: 3px; display: flex; gap: 2px; justify-content: center; }
.cal-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--peacox-teal); }
.cal-dot.accent { background: var(--accent); }

.event-row {
    display: flex; align-items: flex-start; gap: var(--space-3);
    background: var(--bg-color); border: 1px solid var(--border-color);
    border-left: 3px solid var(--pill, var(--peacox-teal));
    padding: 0.4rem 0.55rem; border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.event-date {
    font-weight: 800; font-size: 0.66rem; padding: 0.2rem 0.4rem; border-radius: var(--radius-sm);
    min-width: 44px; text-align: center; flex-shrink: 0;
    background: color-mix(in srgb, var(--pill, var(--peacox-teal)) 12%, transparent);
    color: var(--pill, var(--peacox-teal));
}
.event-row h5 { font-family: var(--font-reading); font-size: 0.74rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-row p { font-family: var(--font-reading); font-size: 0.64rem; color: var(--text-muted); line-height: 1.25; }

/* ---------- Tabs ---------- */
.tabs-nav {
    display: flex; gap: var(--space-1); align-items: center;
    background: var(--glass-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    padding: 0 calc(max(0px, (100% - var(--content-max)) / 2) + var(--content-pad));
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: var(--header-h); z-index: 90;
    overflow-x: auto;
}
.tab-btn {
    background: none; border: none; padding: 0.8rem 1rem;
    font-family: var(--font-display);
    font-weight: 600; font-size: 0.8rem; color: var(--text-muted);
    border-bottom: 3px solid transparent; margin-bottom: -1px;
    transition: color .18s, border-color .18s; white-space: nowrap;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: grid; animation: fadeIn .25s ease both; }

/* ---------- Side pane (drawer) ---------- */
.side-overlay {
    position: fixed; inset: 0; background: rgba(15, 20, 40, 0.45);
    backdrop-filter: blur(3px); z-index: 140;
    opacity: 0; pointer-events: none; transition: opacity .25s;
}
.side-overlay.active { opacity: 1; pointer-events: auto; }
.side-pane {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(330px, 88vw);
    background: var(--card-bg); z-index: 150;
    transform: translateX(-102%); transition: transform .38s cubic-bezier(.16,1,.3,1);
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); border-right: 1px solid var(--border-color);
}
.side-pane.active { transform: translateX(0); }
.side-header { padding: 1.25rem 1.4rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.side-header h2 { font-family: var(--font-display); font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
/* Photo-upload trigger, top of the side pane (replaces the old camera badge) */
.side-avatar-btn {
    margin-left: auto; margin-right: 0.45rem; flex-shrink: 0;
    width: 2.15rem; height: 2.15rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent);
    border: 1px solid var(--accent-border);
    cursor: pointer; transition: all .15s;
}
.side-avatar-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.close-side { background: none; border: none; font-size: 1.1rem; color: var(--text-muted); padding: 0.25rem 0.5rem; border-radius: var(--radius-md); }
.close-side:hover { background: var(--hover-bg); color: var(--text-main); }
.menu-list { padding: 0.9rem; flex: 1; display: flex; flex-direction: column; gap: var(--space-2); overflow-y: auto; }
.menu-item {
    display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
    padding: 0.85rem 0.95rem; border-radius: var(--radius-md);
    background: var(--bg-color); border: 1px solid var(--border-color);
    font-weight: 700; font-size: 0.85rem; color: var(--text-main);
    cursor: pointer; transition: all .18s;
}
.menu-item:hover { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-dark); transform: translateX(4px); }
.menu-item .chev { color: var(--text-faint); transition: transform .18s; }
.menu-item:hover .chev { transform: translateX(2px); color: var(--accent); }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 20, 40, 0.5);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    display: none; justify-content: center; align-items: center;
    z-index: 200; padding: clamp(12px, 3vw, 28px);
}
.modal-overlay.open { display: flex; animation: fadeIn .18s ease both; }
.modal-container {
    background: var(--card-bg); width: 100%; max-width: 620px; max-height: 88vh; max-height: 88dvh;
    border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-color);
    animation: popIn .25s cubic-bezier(.16,1,.3,1) both;
}
.modal-container.wide { max-width: 860px; }
.modal-header {
    padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-shrink: 0;
}
.modal-header h2 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
/* Panes opted in with data-center-title="true"; the left margin mirrors
   the close button + gap so the text centers optically. */
.modal-container.center-title .modal-header h2 { flex: 1; text-align: center; margin-left: 2.65rem; }
.modal-close {
    background: var(--bg-color); border: 1px solid var(--border-color);
    width: 1.9rem; height: 1.9rem; border-radius: 50%;
    color: var(--text-muted); display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; transition: all .15s; flex-shrink: 0;
}
.modal-close:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.modal-body { padding: 1.4rem; overflow-y: auto; flex: 1; min-height: 0; }
.modal-content-pane { display: none; }
.modal-content-pane.open { display: block; }
.modal-content-pane.open[data-flex] { display: flex; flex-direction: column; gap: var(--space-5); min-height: 0; }
.modal-actions { display: flex; gap: var(--space-3); justify-content: flex-end; margin-top: 1rem; }

/* ---------- Toasts ---------- */
#toast-stack {
    position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; gap: var(--space-3); z-index: 400;
    width: min(420px, calc(100vw - 2rem));
}
.toast {
    display: flex; align-items: flex-start; gap: var(--space-3);
    background: var(--text-main); color: #fff;
    padding: 0.75rem 1rem; border-radius: var(--radius-md);
    font-size: 0.82rem; font-weight: 600; line-height: 1.35;
    box-shadow: var(--shadow-lg);
    animation: toastIn .3s cubic-bezier(.16,1,.3,1) both;
}
.toast .t-icon { flex-shrink: 0; margin-top: 1px; }
.toast.ok .t-icon { color: #4ADE80; }
.toast.err .t-icon { color: #F87171; }
.toast.info .t-icon { color: #7DD3FC; }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: all .25s; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 1.1rem; }
.timeline::before { content: ''; position: absolute; left: 0.32rem; top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--border-color); border-radius: 2px; }
.timeline-item { position: relative; padding-left: 1.1rem; margin-bottom: 0.85rem; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
    content: ''; position: absolute; left: -0.35rem; top: 0.85rem;
    width: 0.85rem; height: 0.85rem; border-radius: 50%;
    background: var(--card-bg); border: 3px solid var(--border-strong); z-index: 1; transition: all .25s;
}
.timeline-item.status-completed::before { background: var(--ok); border-color: var(--ok); }
.timeline-item.status-in_progress::before { background: var(--warn); border-color: var(--warn); }
.timeline-content {
    background: var(--bg-color); border: 1px solid var(--border-color); border-radius: var(--radius-md);
    padding: 0.8rem 0.95rem; display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
    transition: box-shadow .18s;
}
.timeline-content:hover { box-shadow: var(--shadow-sm); }
.timeline-category { font-size: 0.64rem; color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.timeline-title { font-weight: 700; font-size: 0.85rem; margin: 0.1rem 0; }
.timeline-date { font-size: 0.68rem; color: var(--text-muted); }

.status-select {
    padding: 0.3rem 0.5rem; border-radius: var(--radius-md); border: 1px solid var(--border-strong);
    font-size: 0.7rem; font-weight: 700; background: var(--card-bg); cursor: pointer; flex-shrink: 0;
}
.status-select.completed { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.status-select.in_progress { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.status-select.not_started { color: var(--text-muted); }

/* ---------- Sort / Filter popover controls ---------- */
.ctrl-wrap { position: relative; }
.ctrl-btn {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: 0.3rem 0.6rem; font-size: 0.72rem; font-weight: 700;
    color: var(--text-soft); background: var(--card-bg);
    border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    transition: all .15s; white-space: nowrap;
}
.ctrl-btn:hover, .ctrl-btn.open { border-color: var(--accent); color: var(--accent); }
.ctrl-count {
    background: var(--accent); color: #fff; border-radius: var(--radius-pill);
    font-size: 0.62rem; font-weight: 800; padding: 0.05rem 0.38rem; line-height: 1.3;
}
.ctrl-pop {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 130;
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); box-shadow: var(--shadow-md);
    padding: 0.6rem; min-width: 230px; max-height: 340px; overflow-y: auto;
    display: none; text-align: left; text-transform: none; letter-spacing: 0;
}
.ctrl-pop.open { display: block; animation: popIn .18s cubic-bezier(.16,1,.3,1) both; }
/* Phones: popovers become a viewport-clamped sheet above the bottom nav
   instead of an anchored panel that can bleed off-screen */
@media (max-width: 640px) {
    .ctrl-pop {
        position: fixed; left: 12px; right: 12px; top: auto;
        bottom: calc(78px + env(safe-area-inset-bottom));
        min-width: 0; max-height: 50vh; z-index: 220;
        box-shadow: var(--shadow-lg);
    }
}
.ctrl-group + .ctrl-group { margin-top: 0.55rem; padding-top: 0.55rem; border-top: 1px solid var(--border-color); }
.ctrl-group-label {
    font-size: 0.64rem; font-weight: 800; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.25rem;
}
.ctrl-opt {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 0.26rem 0.4rem; border-radius: var(--radius-md);
    font-size: 0.78rem; font-weight: 600; color: var(--text-soft); cursor: pointer;
}
.ctrl-opt:hover { background: var(--hover-bg); }
.ctrl-opt input { accent-color: var(--accent); cursor: pointer; }

/* ---------- Inbox items ---------- */
.inbox-actions { display: flex; align-items: center; gap: var(--space-1); flex-shrink: 0; }
.inbox-actions .icon-btn { width: 1.55rem; height: 1.55rem; }
.inbox-topic { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Mobile refinements ---------- */

/* Tab icons exist in markup but only show in the mobile bottom nav */
.tab-ico { display: none; }
.tab-short { display: none; }

@media (max-width: 640px) {
    /* Slimmer header; the wrapped actions row already goes full-width */
    .avatar { width: 3.6rem; height: 3.6rem; font-size: 1.2rem; }

    /* Tabs become a fixed bottom navigation bar (thumb-reachable),
       with icons + short labels and safe-area padding. */
    .tabs-nav {
        top: auto; bottom: 0; left: 0; right: 0; position: fixed;
        z-index: 120; overflow-x: visible;
        border-top: 1px solid var(--border-color); border-bottom: none;
        padding: 0.2rem 0.4rem calc(0.2rem + env(safe-area-inset-bottom));
        gap: 0; justify-content: space-around;
    }
    .tab-btn {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
        padding: 0.4rem 0.2rem; font-size: 0.62rem; letter-spacing: 0.02em;
        border-bottom: none; border-top: 3px solid transparent; margin-bottom: 0;
    }
    .tab-btn.active { border-top-color: var(--accent); border-bottom-color: transparent; }
    .tab-ico { display: block; }
    .tab-full { display: none; }
    .tab-short { display: inline; }

    /* iOS zooms the page when a focused control's font is under 16px */
    .input-full, .select-compact, .status-select, textarea, select,
    input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="date"], input[type="time"] {
        font-size: 16px;
    }
}

/* Bottom-sheet modals on phones: full-width, slide up, thumb-friendly */
@keyframes sheetIn { from { transform: translateY(46px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (max-width: 560px) {
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-container, .modal-container.wide {
        max-width: 100%; width: 100%; max-height: 92dvh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-left: none; border-right: none; border-bottom: none;
        animation: sheetIn .28s cubic-bezier(.16,1,.3,1) both;
    }
    .modal-header { padding: 0.9rem 1rem; }
    .modal-body { padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
}

/* Card layout for tables opted in with .cardable (labels via data-label) */
@media (max-width: 640px) {
    .data-table.cardable { display: block; }
    .data-table.cardable thead { display: none; }
    .data-table.cardable tbody { display: block; }
    .data-table.cardable tr {
        display: grid; grid-template-columns: 1fr 1fr 1fr;
        gap: 0.3rem 0.6rem; padding: 0.7rem 0.8rem; margin-bottom: 0.5rem;
        background: var(--card-bg); border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
    }
    .data-table.cardable tbody td {
        display: flex; flex-direction: column; gap: 1px;
        padding: 0; border-bottom: none; text-align: left;
    }
    .data-table.cardable td[data-label]::before {
        content: attr(data-label);
        font-size: 0.6rem; font-weight: 800; text-transform: uppercase;
        letter-spacing: 0.05em; color: var(--text-faint);
    }
    .data-table.cardable td[data-span] { grid-column: 1 / -1; }
    .data-table.cardable td[data-actions] {
        grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; align-items: center;
    }
}

/* ---------- Misc utilities ---------- */
.text-muted { color: var(--text-muted); } .text-faint { color: var(--text-faint); }
.text-accent { color: var(--accent); } .text-ok { color: var(--ok); }
.text-warn { color: var(--warn); } .text-danger { color: var(--danger); }
.text-xs { font-size: 0.72rem; } .text-sm { font-size: 0.82rem; }
.font-bold { font-weight: 700; } .font-black { font-weight: 900; }
.flex { display: flex; } .flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; min-width: 0; min-height: 0; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-2); } .gap-2 { gap: var(--space-3); } .gap-3 { gap: var(--space-5); }
.mt-1 { margin-top: 0.35rem; } .mt-2 { margin-top: 0.6rem; } .mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.35rem; } .mb-2 { margin-bottom: 0.6rem; } .mb-3 { margin-bottom: 1rem; }
.scroll-y { overflow-y: auto; min-height: 0; }
.divider-dashed { border: none; border-top: 1px dashed var(--border-strong); margin: 0.6rem 0; }
