/* MarEmi Scheduler — fully tokenized theming. ALL colors come from CSS custom
   properties set by [data-theme] on <body>. Component rules never hardcode hex. */

/* ============================ THEMES ============================ */
:root, body[data-theme="electric"] {
  --bg: #0d1420; --surface: #141d2b; --surface-2: #0f1826; --surface-3: #1b2738;
  --border: #243047; --text: #eaf1fb; --muted: #9fb0c8; --muted-2: #687a96;
  --accent: #00E5C0; --accent-2: #3D7BFF; --on-accent: #04121f;
  --danger: #ff5d6c; --ok: #27d6a0; --warn: #ffb547; --info: #6aa8ff;
  --link: #7fd6ff; --scrim: rgba(3, 7, 15, .6);
}
body[data-theme="sunset"] {
  --bg: #16121d; --surface: #1d1726; --surface-2: #181221; --surface-3: #271c33;
  --border: #352940; --text: #f3eef7; --muted: #b6a6c4; --muted-2: #7d6b8c;
  --accent: #FF6B9D; --accent-2: #9B6BFF; --on-accent: #1a0f1f;
  --danger: #ff5d6c; --ok: #4ddba0; --warn: #FFB347; --info: #b08bff;
  --link: #ffa6c4; --scrim: rgba(10, 6, 15, .62);
}
body[data-theme="arcade"] {
  --bg: #0a0e1a; --surface: #10182c; --surface-2: #0c1322; --surface-3: #182338;
  --border: #213050; --text: #e9f0ff; --muted: #93a6c9; --muted-2: #5f7298;
  --accent: #2DE2C0; --accent-2: #4D8CFF; --on-accent: #04121f;
  --danger: #FF4D6D; --ok: #2DE2C0; --warn: #ffc14d; --info: #6aa8ff;
  --link: #7fd6ff; --scrim: rgba(3, 6, 14, .64);
}
body[data-theme="forest"] {
  --bg: #10160f; --surface: #181f15; --surface-2: #121810; --surface-3: #222b1d;
  --border: #2b3826; --text: #eaf2e6; --muted: #a7b89e; --muted-2: #6f8266;
  --accent: #4CC76A; --accent-2: #5DA9A0; --on-accent: #0a140a;
  --danger: #e2574f; --ok: #4CC76A; --warn: #E0982E; --info: #6abf9f;
  --link: #9fe0a8; --scrim: rgba(6, 10, 5, .62);
}
body[data-theme="daylight"] {
  --bg: #eef1f6; --surface: #ffffff; --surface-2: #f4f6fa; --surface-3: #eef2f8;
  --border: #dde3ec; --text: #1a2433; --muted: #5a6b82; --muted-2: #8a99ad;
  --accent: #00B894; --accent-2: #2F6BFF; --on-accent: #08243a;
  --danger: #d83a4d; --ok: #00a37a; --warn: #b9740f; --info: #2F6BFF;
  --link: #1f5fd6; --scrim: rgba(20, 28, 42, .42);
  --shadow: 0 12px 40px rgba(25, 40, 70, .15);
  --raise: color-mix(in srgb, var(--surface) 90%, var(--text) 10%);
}

/* --- broadcast-grade dark palettes (added; existing themes untouched) --- */
body[data-theme="nebula"] {
  --bg: #12101D; --surface: #1E1B2E; --surface-2: #181426; --surface-3: #2A2540;
  --border: #2F2A40; --text: #F1EEFA; --muted: #B3A9C8; --muted-2: #7E7596;
  --accent: #8B5CF6; --accent-2: #EC4899; --on-accent: #150826;
  --danger: #FB7185; --ok: #34D399; --warn: #FBBF24; --info: #93A4F9;
  --link: #C4B5FD; --scrim: rgba(8, 6, 15, .62);
  --grad: linear-gradient(90deg, var(--accent), var(--accent-2));
  color-scheme: dark;   /* unstyled controls/buttons follow dark mode (e.g. theme-card labels) */
}
body[data-theme="ember"] {
  --bg: #15100C; --surface: #231A12; --surface-2: #1C140D; --surface-3: #32261A;
  --border: #3A2A1C; --text: #FAF1E8; --muted: #C9B49E; --muted-2: #93826E;
  --accent: #F5A623; --accent-2: #FF5E3A; --on-accent: #2A1606;
  --danger: #FF6B6B; --ok: #5BD98B; --warn: #FACC15; --info: #FCA968;
  --link: #FFB088; --scrim: rgba(12, 7, 3, .62);
  --grad: linear-gradient(90deg, var(--accent), var(--accent-2));
  color-scheme: dark;
}
body[data-theme="ice"] {
  --bg: #0B1418; --surface: #14222A; --surface-2: #0F1B21; --surface-3: #1E3038;
  --border: #23363F; --text: #E6F4F9; --muted: #9DB6C0; --muted-2: #67838E;
  --accent: #22D3EE; --accent-2: #3B82F6; --on-accent: #04161C;
  --danger: #FB7185; --ok: #2DD4BF; --warn: #FBBF24; --info: #38BDF8;
  --link: #7DD3FC; --scrim: rgba(3, 8, 11, .62);
  --grad: linear-gradient(90deg, var(--accent), var(--accent-2));
  color-scheme: dark;
}
body[data-theme="circuit"] {
  --bg: #0C140D; --surface: #152017; --surface-2: #101A11; --surface-3: #20301F;
  --border: #243524; --text: #E8F4E6; --muted: #A6BFA2; --muted-2: #6E8A6C;
  --accent: #34D399; --accent-2: #A3E635; --on-accent: #06160A;
  --danger: #F87171; --ok: #34D399; --warn: #FBBF24; --info: #5EEAD4;
  --link: #86EFAC; --scrim: rgba(4, 9, 4, .62);
  --grad: linear-gradient(90deg, var(--accent), var(--accent-2));
  color-scheme: dark;
}

/* derived tokens (theme-independent) + legacy aliases so existing rules theme correctly */
:root {
  --font-fallback: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --app-font: var(--font-fallback);          /* overridden on <body> by the font picker */
  --grad: linear-gradient(90deg, var(--accent), var(--accent-2));
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --ring: color-mix(in srgb, var(--accent) 50%, transparent);
  --raise: color-mix(in srgb, var(--surface) 86%, var(--text) 14%);
  --teal: var(--accent); --blue: var(--accent-2); --ink: var(--bg);
  --panel: var(--surface); --panel-2: var(--surface-2); --card: var(--surface); --line: var(--border);
}

/* Accent-derived STATE tokens, resolved PER THEME. Declared on the themed <body> so
   var(--accent)/var(--surface)/var(--text) use THIS theme's values — a token declared on
   :root would freeze to the electric accent and inherit pre-resolved (the gotcha that made
   every theme's hover/active/selected states show electric teal). This single rule makes
   every accent/hover/active/selected/focus state correct + legible on all 9 themes.
     --grad        gradient for buttons / active nav / segments (text sits on --on-accent)
     --on-accent   per theme (dark) — see each theme block; AA-large on both gradient ends
     --ring        focus outline (this theme's accent)
     --raise       neutral surface lift for subtle hovers (text stays --text -> legible)
     --accent-soft selected/active TINT background (text stays --text -> legible every theme)
     --accent-hover slightly shifted accent for hover-on-accent */
body[data-theme] {
  --grad: linear-gradient(90deg, var(--accent), var(--accent-2));
  --ring: color-mix(in srgb, var(--accent) 55%, transparent);
  --raise: color-mix(in srgb, var(--surface) 86%, var(--text) 14%);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --accent-hover: color-mix(in srgb, var(--accent) 86%, var(--text) 14%);
}

/* ============================ BASE ============================ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 500px at 12% -8%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 60%),
    radial-gradient(1000px 520px at 100% 0%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--app-font); zoom: var(--ui-zoom, 1);
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.thin { font-weight: 400; color: var(--muted); }
a { color: var(--link); }

/* icons */
.ti { width: 18px; height: 18px; flex: none; vertical-align: -3px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ti-sm { width: 15px; height: 15px; vertical-align: -2px; }

/* ---- buttons & fields ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; border: 1px solid var(--border); background: var(--surface-3); color: var(--text);
  padding: 8px 15px; border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: transform .06s ease, background .15s ease, border-color .15s ease, filter .15s ease;
}
.btn:hover { background: var(--raise); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); color: var(--on-accent); border: 0; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--raise); }
.btn.small { min-height: 32px; padding: 5px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.btn.ok { background: transparent; border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); color: var(--ok); }
.btn.ok:hover { background: color-mix(in srgb, var(--ok) 14%, transparent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--muted); font-size: 12.5px; }
input, select, textarea {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 10px; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ring); border-color: transparent; }
input[type="color"] { padding: 4px; height: 42px; }
textarea { resize: vertical; }

/* ---- brand ---- */
.brand-row { display: flex; align-items: center; gap: 10px; }
.hex-mark svg { display: block; width: 100%; height: 100%; }
.hex-mark { filter: drop-shadow(0 1px 4px color-mix(in srgb, var(--accent) 30%, transparent));
  position: relative; width: 30px; height: 30px; display: inline-grid; place-items: center; }
.brand-name { font-weight: 800; letter-spacing: .3px; }
.brand-sub { color: var(--muted); font-size: 12px; }

/* ---- left sidebar layout ---- */
.app-shell { display: flex; align-items: stretch; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
  width: 248px; flex: none; display: flex; flex-direction: column; gap: 2px;
  padding: 16px 12px 14px; z-index: 40;
  background: var(--surface-2); border-right: 1px solid var(--border);
}
.sidebar-brand { padding: 4px 8px 12px; gap: 11px; }
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topstrip { display: none; }            /* desktop: sidebar is always visible */
.sidebar-scrim { display: none; }
/* nav: vertical, grouped sections */
.nav { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; gap: 2px;
  overflow-y: auto; align-items: stretch; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.nav-group:first-child { margin-top: 2px; }
.nav-group-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .9px;
  color: var(--muted-2); padding: 5px 12px 3px; }
.nav button {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 38px; width: 100%;
  background: transparent; border: 0; color: var(--muted); cursor: pointer; text-align: left;
  padding: 9px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  transition: background .18s ease, color .18s ease, transform .12s ease;
}
.nav button .ti { flex: none; transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.nav button::after { display: none; }   /* vertical nav: no sliding underline */
.nav button:hover { color: var(--text); background: var(--raise); }
.nav button:hover .ti { transform: translateY(-2px) scale(1.16); }   /* springy icon bounce */
.nav button:hover::after { transform: scaleX(1); }
.nav button:active { transform: scale(.95); }                          /* satisfying press */
.nav button.active { color: var(--on-accent); background: var(--grad); }
.nav button.active::after { transform: scaleX(0); }                    /* active already has accent bg */
.nav button.active .ti { transform: none; }

/* topbar right: Settings CTA + account avatar */
/* ---- sidebar foot: Settings + account (initials + role) ---- */
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.side-account { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; }
.side-account .avatar { width: 38px; height: 38px; flex: none; }
.side-account-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.side-account-name { font-size: 13px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-chip.side-role { align-self: flex-start; font-size: 9.5px; padding: 2px 7px; }
/* the single Settings entry — a gear right beside the account info */
.side-gear { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 0;
  border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .12s ease; }
.side-gear:hover { background: var(--raise); color: var(--text); }
.side-gear:active { transform: scale(.92); }
.side-gear .ti { width: 19px; height: 19px; }
.topstrip-brand { font-weight: 800; letter-spacing: .3px; font-size: 15px; }   /* mobile topstrip wordmark */
.avatar-wrap { position: relative; }
.avatar { position: relative; overflow: hidden; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--grad); color: var(--on-accent); font-weight: 800; font-size: 14px;
  display: grid; place-items: center; transition: transform .12s ease, box-shadow .15s ease; }
.avatar:hover { transform: scale(1.06); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.avatar:active { transform: scale(.93); }
.ava-ini { display: grid; place-items: center; width: 100%; height: 100%; }
.ava-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-menu { position: absolute; top: 50px; right: 0; z-index: 95; width: 224px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; }
/* in the sidebar foot the account menu opens UPWARD, left-aligned */
.side-account .avatar-menu { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; width: min(232px, 100%); }
.avatar-id { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.avatar-name { font-weight: 700; }
.avatar-id .role-chip { margin-top: 8px; display: inline-flex; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--text); border-radius: 9px; padding: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
.menu-item:hover { background: var(--raise); }
.role-chip {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  padding: 4px 9px; border-radius: 999px; color: var(--on-accent); background: var(--grad);
}
.role-chip.producer { background: color-mix(in srgb, var(--info) 24%, transparent); color: var(--info); }
.role-chip.editor { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.role-chip.manager { background: var(--grad); color: var(--on-accent); }

@media (prefers-reduced-motion: reduce) {
  .nav button, .nav button .ti, .nav button::after, .avatar, .settings-tab, .settings-tab::after, .theme-card { transition: none !important; }
  .nav button::after { display: none; }                 /* fall back to a simple color/bg change */
  .nav button:hover .ti, .nav button:active, .avatar:hover, .avatar:active { transform: none !important; box-shadow: none !important; }
}

/* ---- layout ---- */
#main { padding: 24px clamp(16px, 3vw, 36px) 64px; max-width: 1320px; margin: 0 auto; width: 100%; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 16px; flex-wrap: wrap; }
.view-head h2 { margin: 0; font-size: 20px; display: inline-flex; align-items: center; gap: 9px; }
.view-head h2 .ti { width: 21px; height: 21px; color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

/* ---- calendar ---- */
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav h2 { margin: 0; min-width: 190px; text-align: center; font-size: 19px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; }
.legend .lg { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; }

.cal-grid-head { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 8px; }
.cal-grid-head > div { color: var(--muted-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; padding-left: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.cal-cell {
  min-height: 116px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.cal-cell.out { opacity: .4; }
.cal-cell.today { border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent) inset; }
.cal-date { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.cal-cell.today .cal-date { color: var(--accent); }
.blocks { display: flex; flex-direction: column; gap: 5px; }
.block {
  border-left: 4px solid var(--block-c, var(--accent)); background: var(--block-bg, var(--surface-3));
  border-radius: 7px; padding: 5px 8px; cursor: pointer; font-size: 12px; line-height: 1.3;
}
.block:hover { filter: brightness(1.12); }
.block .b-ed { font-weight: 700; }
.block .b-meta { color: var(--muted); }
.block .b-h { float: right; font-weight: 700; color: var(--text); }

/* ---- workload ---- */
.wl-bars { display: flex; flex-direction: column; gap: 14px; }
.wl-row { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.wl-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.wl-name { font-weight: 700; }
.wl-stat { color: var(--muted); font-size: 13px; }
.wl-track { height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; display: flex; }
.wl-seg { height: 100%; }
.wl-scale { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 11px; margin-top: 5px; }

/* ---- forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.msg { font-size: 13px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

/* ---- requests + segmented controls / pills ---- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.seg button { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; color: var(--muted);
  padding: 8px 13px; min-height: 38px; cursor: pointer; font-size: 13px; font-weight: 600; }
.seg button.active { background: var(--grad); color: var(--on-accent); }
.requests-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.req-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.req-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.req-proj { font-weight: 800; font-size: 16px; }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 3px 9px; border-radius: 999px; }
.status.pending { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.status.approved { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.status.declined { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.req-meta { color: var(--muted); font-size: 13px; }
.req-meta b { color: var(--text); font-weight: 600; }
.req-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ---- detail / person panel ---- */
.detail-panel {
  position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 92vw);
  background: var(--surface); border-left: 1px solid var(--border); z-index: 60;
  box-shadow: var(--shadow); padding: 22px; overflow-y: auto;
  transform: translateX(0); transition: transform .22s ease;
}
.detail-panel.hidden { transform: translateX(100%); display: block !important; pointer-events: none; }
.detail-close { position: absolute; top: 12px; right: 14px; background: transparent; border: 0; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 55; }
.detail-title { font-size: 20px; font-weight: 800; margin: 6px 0 2px; }
.detail-code { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.chip-line { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 14px 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 600; }
.stat-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 16px 0; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.stat-card .n { font-size: 22px; font-weight: 800; }
.stat-card .l { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.brief-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; color: var(--text); white-space: pre-wrap; }
.link-btn { display: inline-block; margin-top: 12px; }

/* ---- modal ---- */
.modal-backdrop { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(6px); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.modal .brand-row { margin-bottom: 14px; }
.modal .field { margin: 16px 0; }
.hint { margin-top: 10px; font-size: 12.5px; min-height: 16px; color: var(--muted); }
.hint.err { color: var(--danger); }

/* ---- toast ---- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--border); color: var(--text); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); z-index: 120; max-width: 90vw; }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.toast.err { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

/* ---- responsive ---- */
@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .cal-grid, .cal-grid-head { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .cal-cell { min-height: 92px; padding: 5px; }
  .block { font-size: 11px; }
  .stat-cards { grid-template-columns: repeat(3,1fr); }
  .who-email { display: none; }
}
@media (max-width: 520px) {
  .cal-grid-head { display: none; }
  .cal-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: auto; }
  .cal-cell.out { display: none; }
  .cal-date::before { content: attr(data-label); color: var(--muted); font-weight: 600; }
}

/* ---- extension: directory, capacity, audit, etc. ---- */
.head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.search { min-width: 220px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-head h3 { margin: 0; }
.cal-cell.clickable { cursor: pointer; }
.cal-cell.clickable:hover { border-color: var(--accent); }

.cap-wrap { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 6px 12px 12px; margin-bottom: 14px; }
.cap-wrap > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 6px 0; list-style: none; }
.cap-wrap > summary::-webkit-details-marker { display: none; }
.cap-wrap > summary::before { content: "▸ "; }
.cap-wrap[open] > summary::before { content: "▾ "; }
.cap-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.cap-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; flex: 1 1 160px; min-width: 150px; }
.cap-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 6px; }
.cap-name { font-weight: 700; }
.cap-num { color: var(--muted); }
.cap-num.over { color: var(--danger); font-weight: 700; }
.cap-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.cap-fill { height: 100%; background: var(--grad); border-radius: 999px; }
.cap-fill.over { background: linear-gradient(90deg, var(--danger), var(--warn)); }

/* availability chips — colors come from theme tokens */
.av-chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 7px; padding: 4px 8px; font-size: 11.5px; font-weight: 700; text-transform: capitalize; }
.av-chip.available { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.av-chip.tentative { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.av-chip.pto { background: color-mix(in srgb, var(--info) 20%, transparent); color: var(--info); }
.av-chip.out { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.av-note { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* directory */
.dir-list { display: flex; flex-direction: column; gap: 6px; }
.dir-row { display: grid; grid-template-columns: 1.4fr 1.8fr 1.2fr .8fr; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; }
.dir-list.mgr .dir-row { grid-template-columns: 1.3fr 1.7fr 1.1fr .8fr .8fr .6fr 1.5fr; }
.dir-row.dir-head { background: transparent; border: 0; padding: 4px 14px; color: var(--muted-2);
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.dir-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; text-transform: capitalize; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--info) 20%, transparent); color: var(--info); }
.pill.active { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
/* role pill in the user list (Post Manager / Director of Content etc.) — accent-tinted */
.pill.role-tag { background: var(--accent-soft); color: var(--text); text-transform: none;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.pill.inactive { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
.dir-row.clickable { cursor: pointer; transition: border-color .12s ease, background .12s ease; }
.dir-row.clickable:hover { border-color: var(--accent); background: var(--raise); }

/* audit log */
.audit-list { display: flex; flex-direction: column; gap: 6px; }
.audit-row { display: grid; grid-template-columns: 160px 130px 1fr 180px; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.audit-target { font-weight: 600; }

/* conflict warnings */
.warn-box { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 38%, var(--border)); border-radius: 12px; padding: 12px 14px; }
.warn-title { color: var(--warn); font-weight: 800; margin-bottom: 6px; }
.warn-item { color: color-mix(in srgb, var(--warn) 65%, var(--text)); font-size: 13px; margin: 3px 0; }
.warn-actions { display: flex; gap: 8px; margin-top: 10px; }

@media (max-width: 760px) {
  .search { min-width: 0; flex: 1; }
  .audit-row { grid-template-columns: 1fr; gap: 4px; }
  .dir-row, .dir-list.mgr .dir-row { grid-template-columns: 1fr; gap: 4px; }
  .dir-row.dir-head { display: none; }
  .dir-row > div[data-l]::before { content: attr(data-l) ": "; color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
  .dir-actions { justify-content: flex-start; margin-top: 6px; }
}

/* empty / fatal states */
.empty-card { max-width: 460px; margin: 60px auto; text-align: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow); }
.empty-card h2 { margin: 0 0 8px; }
.empty-card .btn { margin-top: 16px; }
.empty-hint { background: var(--surface-2); border: 1px dashed var(--border); color: var(--muted);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; font-size: 13.5px; text-align: center; }

/* access control matrix */
.access-grid { display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.access-row { display: grid; grid-template-columns: 1.6fr .8fr .8fr .8fr; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.access-row.access-head { background: transparent; border: 0; padding: 4px 14px; color: var(--muted-2);
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.access-head > div:not(:first-child) { text-align: center; }
.access-field { font-weight: 600; }
.access-cell { display: flex; justify-content: center; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 999px; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + .track { background: var(--grad); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--on-accent); }
.switch.locked { cursor: not-allowed; }
.switch.locked .track { opacity: .6; }

/* auth forms */
#login-form .field, #pwchange-form .field { margin: 14px 0; }
#login-form .btn.block { margin-top: 8px; }
#pwchange-form .form-actions { margin-top: 6px; }

/* user accounts list (reuses .dir-row) */
.users-list .dir-row { grid-template-columns: 1.8fr 1.2fr .8fr 1.4fr 1.2fr; }
@media (max-width: 760px) { .users-list .dir-row { grid-template-columns: 1fr; } }

/* Trash list (reuses .dir-row): Item · Type · Deleted by · Deleted · Purges · actions */
.trash-list .dir-row { grid-template-columns: 1.7fr .9fr 1.5fr 1.2fr .9fr 1.5fr; }
@media (max-width: 760px) { .trash-list .dir-row { grid-template-columns: 1fr; } }

/* invites + pending approvals (reuse .dir-row / .pill / .card) */
.pill.pending  { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.pill.used     { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
.pill.revoked,
.pill.rejected { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.pill.expired  { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted-2); }

.pending-section { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.pending-list .dir-row { border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
.role-pick { background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 9px; font: inherit; min-height: 34px; }

.invite-gen-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.invite-gen-row .field { min-width: 130px; }
.invite-gen-row #invite-count { width: 92px; }
.invite-gen-row .btn.primary { min-height: 40px; }
.invite-result { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.invite-made-head { color: var(--ok); font-size: 13px; font-weight: 700; margin: 4px 0 2px; }
.invite-link { display: flex; gap: 8px; align-items: center; }
.invite-url { flex: 1; min-width: 0; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.invites-list .dir-row { grid-template-columns: 2.4fr 1fr 1.4fr .9fr .9fr; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* bulk invite (CSV) */
.bulk-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bulk-row input[type="file"] { flex: 1 1 240px; min-width: 0; padding: 8px 10px; font-size: 13px; }
.bulk-result { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.bulk-result:empty { display: none; }
.bulk-sec-head { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.bulk-sec-head.ok { color: var(--ok); }
.bulk-sec-head.warn { color: var(--warn); }
.bulk-list { display: flex; flex-direction: column; gap: 5px; }
.bulk-li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px; font-size: 13px; }
.bulk-li.problem { border-color: color-mix(in srgb, var(--warn) 42%, var(--border)); }
.bulk-li .mono { font-size: 12.5px; color: var(--muted); }
.bulk-rownum { font-size: 11px; font-weight: 800; color: var(--muted-2); text-transform: uppercase; letter-spacing: .4px; }
.bulk-reason { margin-left: auto; color: var(--warn); font-weight: 600; font-size: 12.5px; }
.bulk-confirm { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.bulk-confirm.warn { border-top: 1px solid var(--border); padding-top: 12px; }
.bulk-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.bulk-check input { width: auto; margin: 0; }
@media (max-width: 600px) { .bulk-reason { margin-left: 0; } .bulk-row .btn { flex: 1 1 auto; } }

/* ---- project management (Projects page + dashboard summary) ---- */
.proj-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 16px; }
.proj-controls .field { min-width: 150px; }
.proj-list { display: flex; flex-direction: column; gap: 8px; }
.proj-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  transition: border-color .18s ease, background .18s ease; }
.proj-row:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--raise); }
.proj-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.proj-main { flex: 1 1 auto; min-width: 0; }
.proj-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.proj-title b { font-size: 14.5px; }
.proj-code { font-size: 12px; color: var(--muted); }
.proj-sub { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 3px; }
.proj-budget { font-weight: 700; font-size: 13px; color: var(--text); white-space: nowrap; }
.proj-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.proj-status-pick { padding: 6px 8px; font-size: 12.5px; min-height: 34px; width: auto; }
/* status pills — color-coded, legible on all 9 themes via per-theme tokens */
.proj-status { display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; padding: 3px 9px; border-radius: 999px; white-space: nowrap; flex: none; }
.proj-status.status-active { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.proj-status.status-archived { color: var(--muted); background: color-mix(in srgb, var(--muted) 20%, transparent); }
.proj-status.status-done { color: var(--info); background: color-mix(in srgb, var(--info) 16%, transparent); }
/* dashboard projects summary */
.proj-dash { margin-bottom: 18px; }
.proj-dash-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.proj-dash-head h3 { margin: 0; }
.proj-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.proj-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  text-align: left; transition: border-color .18s ease, background .18s ease, transform .12s ease; }
.proj-stat:hover, .proj-stat:focus-visible { border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--raise); outline: none; }
.proj-stat:active { transform: scale(.98); }
.proj-stat-n { font-size: 28px; font-weight: 800; line-height: 1; color: var(--text); }
@media (max-width: 600px) {
  .proj-row { flex-wrap: wrap; }
  .proj-actions { width: 100%; }
  .proj-status-pick { flex: 1 1 auto; }
  .proj-summary { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .invites-list .dir-row { grid-template-columns: 1fr; }
  .invite-gen-row { flex-direction: column; align-items: stretch; }
  .invite-gen-row .field, .invite-gen-row #invite-count { width: 100%; }
}

/* standalone self-registration page (register.html) */
.register-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.register-card { width: min(460px, 100%); }
.register-card .field { margin: 14px 0; }
.reg-state.hidden { display: none; }

/* availability fast entry */
.grow { flex: 1 1 auto; }
.avail-monthnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.palette { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.pal-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface-3); color: var(--text);
  min-height: 34px; padding: 6px 11px; border-radius: 9px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.pal-btn::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--sw, var(--muted-2)); }
.pal-btn.available { --sw: var(--ok); } .pal-btn.tentative { --sw: var(--warn); }
.pal-btn.pto { --sw: var(--info); } .pal-btn.out { --sw: var(--danger); } .pal-btn.erase { --sw: var(--muted-2); }
.pal-btn.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pal-hours { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.pal-hours input { width: 72px; }
.av-hint { margin: 0 0 8px; }
.paint-grid { touch-action: none; user-select: none; -webkit-user-select: none; }
.paint-cell { cursor: pointer; }
.paint-cell:hover { border-color: var(--accent); }
.paint-cell.nopaint { opacity: .35; cursor: default; }
.paint-cell.nopaint:hover { border-color: var(--border); }
.av-cellchip { margin-top: 4px; }

.avail-list { display: flex; flex-direction: column; gap: 6px; }
.avl-row { display: grid; grid-template-columns: 1.4fr 1fr .7fr 2fr; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.avl-row.set { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.avl-date { font-weight: 600; }

.pattern-body { padding: 10px 2px 2px; }
.pattern-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pattern-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pat-col { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px; text-align: center; }
.pat-wd { font-weight: 700; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.pat-col select { margin-bottom: 5px; }
.pattern-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .avl-row { grid-template-columns: 1fr 1fr; }
  .avl-date { grid-column: 1 / -1; }
  .avl-note { grid-column: 1 / -1; }
  .pattern-grid { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .pat-col { padding: 6px 4px; }
  .pat-col select, .pat-col input { font-size: 12px; padding: 6px; }
}

/* person detail panel */
.person-sec { margin-top: 20px; }
.person-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.person-sec h4 { margin: 0 0 8px; font-size: 14px; }
.person-sec-head h4 { margin: 0; }
.person-sec .cal-nav { gap: 4px; }
.person-sec .cal-nav #pp-title { min-width: 96px; text-align: center; }
.person-sec .cal-grid-head { grid-template-columns: repeat(5, 1fr); gap: 4px; }
.person-sec .cal-grid-head > div { font-size: 10px; padding-left: 2px; }
.mini-grid { grid-template-columns: repeat(5, 1fr); gap: 4px; }
.mini-grid .cal-cell { min-height: 50px; padding: 4px; }
.mini-grid .cal-date { font-size: 11px; }
.mini-grid .av-cellchip { margin-top: 3px; }
.mini-grid .av-chip { font-size: 9.5px; padding: 2px 5px; }
.pp-asg { display: flex; flex-direction: column; gap: 6px; }
.pp-asg-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px; font-size: 13px; }
.pp-asg-proj { font-weight: 600; }
.pp-asg-day { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.pp-asg-h { font-weight: 700; }

/* ---- Settings hub: tabs + panels ---- */
.settings-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.settings-tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 42px;
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  padding: 10px 14px; font-size: 14px; font-weight: 600; transition: color .18s ease;
}
.settings-tab .ti { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.settings-tab::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0;
  background: var(--accent); transform: scaleX(0); transition: transform .22s ease;
}
.settings-tab:hover { color: var(--text); }
.settings-tab:hover .ti { transform: translateY(-2px) scale(1.12); }
.settings-tab.active { color: var(--text); }
.settings-tab.active::after { transform: scaleX(1); }
.set-panel { animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.set-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.set-panel-head h3 { margin: 0; font-size: 16px; }
.trash-empty { display: flex; align-items: center; gap: 14px; padding: 24px; }
.trash-empty .ti { width: 30px; height: 30px; color: var(--muted); flex: none; }

/* Appearance: theme cards */
.appearance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-width: 760px; }
.theme-card { display: flex; flex-direction: column; gap: 0; text-align: left; cursor: pointer; padding: 0; overflow: hidden;
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px; transition: transform .14s ease, border-color .15s ease, box-shadow .15s ease; }
.theme-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: var(--shadow); }
.theme-card.active { border-color: var(--accent); }
.theme-card-sw { height: 64px; display: grid; place-items: center; color: #fff; }
.theme-card-sw .ti { width: 26px; height: 26px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }
/* Card label uses the ACTIVE theme's text colour on EVERY theme (the label band is the
   theme's --surface, and --text is designed to read on it) — light on the dark themes,
   dark on daylight. Applied to all 9 theme cards AND the font cards, which reuse this
   class. Previously this was scoped to the 4 new themes only, so the 5 original themes'
   labels fell back to the browser's dark <button> default and washed out on dark bands. */
.theme-card-label { padding: 10px 12px; font-weight: 700; font-size: 13.5px; color: var(--text); }

/* font picker + text-size control (Appearance) */
.appearance-sub { font-size: 12px; font-weight: 700; margin: 26px 0 4px; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: .5px; }
.font-card { padding: 0; overflow: hidden; }
.font-card-prev { display: grid; place-items: center; height: 54px; width: 100%; font-size: 28px;
  font-weight: 800; background: var(--surface-2); color: var(--text); }
.size-seg button { min-width: 78px; justify-content: center; padding: 11px 18px; font-size: 13.5px; }

/* My Account */
/* editable profile card */
.profile-card { max-width: 520px; }
.profile-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.account-avatar { position: relative; overflow: hidden; width: 88px; height: 88px; border-radius: 50%;
  background: var(--grad); color: var(--on-accent); font-weight: 800; font-size: 28px; flex: none;
  display: grid; place-items: center; border: 2px solid transparent; transition: border-color .15s ease, transform .12s ease; }
.account-avatar.drop-target { cursor: pointer; }
.account-avatar.drag { border-color: var(--accent); transform: scale(1.04); }
.profile-meta { flex: 1 1 200px; min-width: 0; }
.profile-name { font-weight: 800; font-size: 18px; }
.profile-title { font-size: 13.5px; min-height: 18px; }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 6px; }
.avatar-note { display: flex; align-items: center; gap: 6px; }
.profile-form { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.profile-readonly { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.profile-readonly .ro-val { padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); background: var(--surface-2); }
#account-pwform { max-width: 440px; margin-top: 16px; }
#account-pwform h3 { margin: 0 0 6px; font-size: 15px; }
@media (max-width: 560px) { .profile-readonly { grid-template-columns: 1fr; } }

/* Activity logs */
.logs-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.logs-filter-field { flex: none; }
.logs-filter-field select { min-width: 180px; }
.audit-table { overflow-x: auto; }
.audit-rtable td.audit-when, .audit-rtable .audit-when { white-space: nowrap; color: var(--muted); font-size: 12.5px; }

@media (max-width: 640px) {
  .appearance-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ---- monthly report ---- */
.report-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }

/* ---- monthly report ---- */
.report-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.report-bar input[type="month"] { width: auto; min-width: 160px; }
.report-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.report-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.report-card h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.rtable { width: 100%; border-collapse: collapse; }
.rtable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted-2); padding: 7px 8px; border-bottom: 1px solid var(--border); }
.rtable td { padding: 8px; font-size: 13px; border-bottom: 1px solid var(--border); }
.rtable th.num, .rtable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rtable tr.total td { font-weight: 800; border-top: 2px solid var(--border); border-bottom: 0; }
.rtable td.na { color: var(--muted-2); }
.report-note { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
@media (max-width: 860px) { .report-tables { grid-template-columns: 1fr; } }

/* ===== EFG additions: location tags, skills editor, dashboard, booking form ===== */
.loc-tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; padding: 2px 8px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: .3px; }
.loc-tag.remote { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.loc-tag.onsite { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* skill / language list editor (My Account + Directory modal) */
.kv-editor { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.kv-row { display: grid; grid-template-columns: 1fr 140px auto; gap: 8px; align-items: center; }
.kv-row .kv-name, .kv-row .kv-level { background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font: inherit; min-height: 36px; }
.kv-del { min-width: 34px; }
.exp-head { font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
  font-size: 11.5px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }
.profile-expanded { margin-top: 6px; }
@media (max-width: 620px) { .kv-row { grid-template-columns: 1fr 110px auto; } }

/* read-only skill/language chips (person panel) */
.person-tags { margin: 10px 0; }
.pt-label { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.kv-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kv-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-3);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; }
.kv-tag .kv-lv { color: var(--accent); font-size: 11px; font-weight: 800; }

/* manager dashboard */
.dash-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.dash-ic { color: var(--accent); }
.dash-ic .ti { width: 22px; height: 22px; }
.dash-num { font-size: 30px; font-weight: 800; line-height: 1; }
.dash-lbl { color: var(--muted); font-size: 12.5px; }
.dash-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-panels h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.dash-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.dash-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-size: 13px; }
.dash-row b { font-weight: 700; }
.dash-row .ctx-kebab, .ms-row .ctx-kebab, .bh-meta .ctx-kebab { margin-left: auto; }
@media (max-width: 860px) { .dash-cards { grid-template-columns: 1fr 1fr; } .dash-panels { grid-template-columns: 1fr; } }

/* ---- interactivity: clickable dashboard + context menus / kebab ---- */
.dash-card-nav, .dash-row-nav { cursor: pointer; }
.dash-card-nav { transition: transform .1s ease, border-color .12s ease, box-shadow .12s ease; }
.dash-card-nav:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); transform: translateY(-2px); }
.dash-row-nav:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.dash-card-nav:focus-visible, .dash-row-nav:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.ctx-menu { position: fixed; z-index: 1000; min-width: 196px; max-width: 290px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 1px;
  animation: ctxpop .12s ease; }
@keyframes ctxpop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.ctx-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--text); padding: 9px 11px; border-radius: 8px;
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ctx-item:hover, .ctx-item:focus { background: var(--accent-soft); outline: none; }
.ctx-item .ti { flex: none; color: var(--muted); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger .ti { color: var(--danger); }
.ctx-item.danger:hover, .ctx-item.danger:focus { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 4px; }
.ctx-kebab { display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; min-height: 30px; padding: 0 0 4px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 19px; line-height: 1; }
.ctx-kebab:hover, .ctx-kebab:focus-visible { background: var(--raise); color: var(--text); border-color: var(--border); outline: none; }

/* EFG booking form */
.booking-form .form-grid { margin-top: 4px; }
.booking-doc { margin-top: 18px; }
.bk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  border-bottom: 2px solid var(--border); padding-bottom: 12px; margin-bottom: 14px; }
.bk-doc-title { font-size: 18px; font-weight: 800; }
.bk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.bk-field { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px dotted var(--border); }
.bk-label { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.bk-value { font-size: 14px; font-weight: 600; }
.bk-budget { margin-top: 16px; }
.bk-budget h4 { margin: 0 0 8px; }
.bk-money { width: 100%; border-collapse: collapse; max-width: 420px; }
.bk-money td { padding: 7px 10px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.bk-money td.num { text-align: right; font-variant-numeric: tabular-nums; }
.bk-money tr.sub td { font-weight: 700; border-top: 1px solid var(--border); }
.bk-money tr.grand td { font-weight: 800; font-size: 15px; border-top: 2px solid var(--accent); color: var(--text); }
.bk-notes { margin-top: 14px; }
@media (max-width: 620px) { .bk-grid { grid-template-columns: 1fr; } }

/* my-schedule remote/onsite list */
.ms-list { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.ms-list-head { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.ms-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 7px 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; font-size: 13px; }

/* print: isolate the booking document so "Save as PDF" yields a clean sheet */
@media print {
  body * { visibility: hidden; }
  #booking-doc, #booking-doc * { visibility: visible; }
  #booking-doc { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 0; background: #fff; color: #111; }
  #booking-doc .bk-label { color: #555; }
  #booking-doc .bk-value, #booking-doc .bk-doc-title, #booking-doc .bk-money td { color: #111; }
  .no-print { display: none !important; }
}

/* conflicts (booking output, dashboard, request submit) */
.conflict-banner { background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.conflict-banner ul { margin: 6px 0; padding-left: 20px; }
.conflict-banner b { color: var(--warn); }
.conflict-card h3 { color: var(--warn); }
.conflict-row { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)) !important; }
.conflict-inline { color: var(--warn); margin-top: 6px; font-size: 12.5px; }

/* booking history timeline (person panel) */
.bh-list { display: flex; flex-direction: column; gap: 6px; }
.bh-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.bh-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bh-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.bh-cost { color: var(--accent); font-weight: 800; }

/* calendar subscription (My Account) */
.calendar-card { margin-top: 16px; }
.cal-sub { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cal-sub .invite-link { width: 100%; }

/* forgot-password link + success hint */
.login-foot { margin-top: 12px; text-align: center; }
.link-btn { color: var(--accent); cursor: pointer; font-size: 13px; text-decoration: none; background: none; border: 0; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.hint.ok { color: var(--ok); }

/* directory filters + export bar */
.dir-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.dir-filters .field { min-width: 130px; }
.dir-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.export-bar { margin-top: -4px; }
@media (max-width: 620px) { .dir-filters .field { min-width: 0; flex: 1 1 45%; } }

/* ============ MODERN REFRESH (cosmetic; fully tokenized — works on all themes) ============ */
/* dashboard hero banner — gradient accent edge + greeting + primary action */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--grad); }
.hero::after { content: ""; position: absolute; right: -50px; top: -70px; width: 240px; height: 240px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 15%, transparent), transparent 70%); }
.hero-text { position: relative; min-width: 0; }
.hero-greet { font-size: 22px; font-weight: 800; letter-spacing: .2px; }
.hero-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.hero-cta { position: relative; white-space: nowrap; }

/* tidy metric cards: small label on top, big number below, semantic tone */
.dash-cards { gap: 14px; }
.dash-card { gap: 0; padding: 15px 16px; }
.dash-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dash-card-top .dash-lbl { color: var(--muted); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; }
.dash-card-top .ti { color: var(--accent); opacity: .75; width: 17px; height: 17px; }
.dash-num { font-size: 32px; font-weight: 800; line-height: 1; margin-top: 10px; }
.dash-card.tone-ok .dash-num { color: var(--ok); }
.dash-card.tone-warn .dash-num { color: var(--warn); }
.dash-card.tone-danger .dash-num { color: var(--danger); }

/* lighter header band on main views + more confident headings */
.view-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.view-head h2 { font-size: 22px; font-weight: 800; letter-spacing: .2px; }

/* tasteful accent left-stripe on key panels */
.panel-accent { position: relative; overflow: hidden; }
.panel-accent::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); }
.panel-accent h3 { padding-left: 4px; }

/* ============================================================ */
/* ---- collapse the sidebar to an off-canvas drawer on narrow screens (≤860px) ---- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 272px;
    transform: translateX(-100%); transition: transform .24s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .content { width: 100%; min-width: 0; }
  .topstrip {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    padding: 9px 12px; border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35;
    background: var(--scrim); backdrop-filter: blur(2px); }
  .sidebar-scrim.hidden { display: none; }
}

/* ============================================================ */
/* MOBILE POLISH (≤600px). CSS-only & additive — desktop (>600px) is untouched. */
/* ============================================================ */
@media (max-width: 600px) {
  /* layout: tighter spacing; clip stray overflow so the page never scrolls sideways */
  #main { padding: 14px 12px 56px; overflow-x: clip; }
  .view-head { margin: 2px 0 14px; }
  .view-head h2 { font-size: 18px; }
  .card { padding: 15px; border-radius: 14px; }
  .modal { padding: 20px; }

  /* tap targets ~44px + breathing room */
  .btn { min-height: 44px; padding: 11px 16px; }
  .btn.small { min-height: 40px; padding: 9px 13px; font-size: 13px; }
  .nav button { min-height: 44px; }
  .settings-tab { min-height: 46px; }
  .menu-item { min-height: 44px; padding: 12px 10px; font-size: 14px; }
  .kv-del { min-width: 40px; }

  /* inputs: 16px stops iOS zoom-on-focus; comfortable height */
  input, select, textarea { font-size: 16px; padding: 12px; }
  .field > span { font-size: 13px; }

  /* account menu (in the sidebar foot) stays within the screen edge */
  .side-account .avatar-menu { width: min(260px, calc(100vw - 28px)); }

  /* settings tabs -> single swipeable row */
  .settings-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; gap: 2px; }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tab { flex: 0 0 auto; white-space: nowrap; padding: 11px 13px; }

  /* dropdowns never run off the screen edge */
  .avatar-menu { width: min(260px, calc(100vw - 20px)); }

  /* --- dense report tables -> stacked label/value cards --- */
  .report-tables { gap: 12px; margin-top: 8px; }
  .report-card { padding: 12px; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; }
  .rtable thead { display: none; }
  .rtable tr { background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
  .rtable td { border: 0; padding: 6px 0; display: grid; grid-template-columns: auto 1fr;
    gap: 12px; align-items: baseline; text-align: right; font-size: 13.5px; }
  .rtable td::before { content: attr(data-label); text-align: left; color: var(--muted-2);
    font-size: 11px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
  .rtable td:empty { display: none; }                       /* hide blank total cells */
  .rtable td:first-child { display: block; text-align: left; font-weight: 800; font-size: 15.5px;
    color: var(--text); border-bottom: 1px solid var(--border); padding: 2px 0 8px; margin-bottom: 4px; }
  .rtable td:first-child::before { content: none; }
  .rtable tr.total { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
  .rtable tr.total td:first-child { color: var(--accent); }
  /* emphasize the All-in total (report tables only — not the audit log) */
  .report-card .rtable td:last-child { border-top: 1px solid var(--border);
    margin-top: 4px; padding-top: 8px; font-weight: 800; font-size: 15px; }
  .report-card .rtable td:last-child::before { color: var(--text); }
  .report-note { font-size: 12px; }

  /* --- booking budget breakdown: clean stack, prominent all-in --- */
  .bk-money { max-width: none; }
  .bk-money td { padding: 9px 0; font-size: 14px; }
  .bk-money tr.grand td { font-size: 16.5px; }
  .booking-doc { padding: 16px; }
  .bk-grid { gap: 4px 0; }

  /* booking history rows stack cleanly */
  .bh-row { flex-direction: column; align-items: stretch; gap: 5px; }
  .bh-meta { justify-content: flex-start; }

  /* head / search / filter / report bars go full-width for easy tapping */
  .head-right, .search { width: 100%; }
  .dir-filters .field { flex: 1 1 100%; }
  .report-bar, .export-bar, .dir-filters { gap: 8px; }
  .report-bar .btn, .export-bar .btn { flex: 1 1 auto; }
  .report-bar input[type="month"] { flex: 1 1 100%; min-width: 0; }

  /* access matrix: keep toggles tappable without overflowing */
  .access-row { grid-template-columns: 1.3fr .9fr .9fr .9fr; padding: 10px 8px; gap: 6px; }
}
