/* ─────────────────────────────────────────────
   GymSync CRM — styles
   Light by default (reference layout), dark mode via [data-theme="dark"] or the OS setting.
   Brand accent = GymSync lime; in light mode a deep lime is used so text/bars stay readable.
   ───────────────────────────────────────────── */
:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f1f1ec;
  --line: #e4e3dc;
  --line-2: #d6d4cb;
  --text: #17170f;
  --muted: #6b6a60;
  --faint: #9c9a8e;
  --ink: #17170f;           /* primary buttons */
  --ink-text: #ffffff;
  --accent: #4d7c0f;        /* lime 700 — bars, active nav, links */
  --accent-soft: #eef7d6;
  --accent-bright: #d4ff3a; /* brand lime for small marks */
  --bar: #65a30d;
  --bar-2: #c7e38a;         /* upcoming / secondary step of the same hue */
  --bar-today: #365314;     /* today — darkest step so it stands out */
  /* status — reserved, always shipped with a text label */
  --st-confirmed: #1d4ed8; --st-confirmed-bg: #e8eefc;
  --st-attended: #15803d;  --st-attended-bg: #e4f5ea;
  --st-noshow: #b45309;    --st-noshow-bg: #fcf1e1;
  --st-cancelled: #b91c1c; --st-cancelled-bg: #fbe9e9;
  --shadow: 0 1px 2px rgba(20, 20, 10, .05), 0 1px 1px rgba(20, 20, 10, .03);
  --shadow-lg: 0 18px 50px rgba(20, 20, 10, .18);
  --radius: 14px;
  --side-w: 260px;
  --top-h: 62px;
  --body: "Archivo", system-ui, -apple-system, sans-serif;
  --display: "Anton", "Arial Narrow", Impact, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0c; --surface: #171714; --surface-2: #1f1f1b; --line: #2a2a25; --line-2: #3a3a33;
    --text: #f1efe8; --muted: #a3a194; --faint: #77756a; --ink: #d4ff3a; --ink-text: #0e0e0c;
    --accent: #d4ff3a; --accent-soft: #2a3310; --bar: #93b82a; --bar-2: #4d5e1c; --bar-today: #f1efe8;
    --st-confirmed: #93b4ff; --st-confirmed-bg: #1c2540; --st-attended: #6fdc98; --st-attended-bg: #16301f;
    --st-noshow: #f5b863; --st-noshow-bg: #36270f; --st-cancelled: #f59a9a; --st-cancelled-bg: #3a1a1a;
    --shadow: none; --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0c; --surface: #171714; --surface-2: #1f1f1b; --line: #2a2a25; --line-2: #3a3a33;
  --text: #f1efe8; --muted: #a3a194; --faint: #77756a; --ink: #d4ff3a; --ink-text: #0e0e0c;
  --accent: #d4ff3a; --accent-soft: #2a3310; --bar: #93b82a; --bar-2: #4d5e1c; --bar-today: #f1efe8;
  --st-confirmed: #93b4ff; --st-confirmed-bg: #1c2540; --st-attended: #6fdc98; --st-attended-bg: #16301f;
  --st-noshow: #f5b863; --st-noshow-bg: #36270f; --st-cancelled: #f59a9a; --st-cancelled-bg: #3a1a1a;
  --shadow: none; --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 14.5px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
code { font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.logo { line-height: 0; }
.logo img { display: block; height: 34px; width: auto; }

/* ── Buttons & inputs ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; transition: background .2s, border-color .2s, transform .2s var(--ease); color: var(--text); text-decoration: none; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.btn--primary:hover { border-color: var(--ink); filter: brightness(1.12); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--st-cancelled); }
.btn--danger.btn--primary { background: var(--st-cancelled); border-color: var(--st-cancelled); color: #fff; }
.btn--sm { height: 32px; padding: 0 11px; font-size: .84rem; border-radius: 8px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; color: var(--muted); position: relative; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn--sm { width: 30px; height: 30px; border-radius: 7px; }
.icon-btn--sm svg { width: 16px; height: 16px; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field > legend { font-size: .8rem; font-weight: 600; color: var(--muted); }
.input, .field input, .field select, .field textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); outline: none; transition: border-color .2s, box-shadow .2s;
}
.field textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .is-invalid, .input.is-invalid { border-color: var(--st-cancelled); }
select.input, .field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6a60' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-error { color: var(--st-cancelled); font-size: .86rem; min-height: 1.2em; }

/* ── Login ── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login__brand { background: #0e0e0c; color: #f1efe8; padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login__brand h1 { font: 400 clamp(2rem, 4vw, 3.4rem)/1 var(--display); text-transform: uppercase; max-width: 14ch; }
.login__brand p:last-child { color: #a3a194; max-width: 40ch; }
.login__form { align-self: center; justify-self: center; width: min(380px, 100% - 32px); display: grid; gap: 16px; }
.login__form h2 { font-size: 1.5rem; }

/* ── App shell ── */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; transition: grid-template-columns .3s var(--ease); }
.is-collapsed .app { --side-w: 76px; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--bg); padding: 12px; overflow: hidden; }
.side__brand { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; }
.side__mark { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: #0e0e0c; }
.side__mark img { display: block; width: 28px; height: 28px; }
.side__name { display: grid; line-height: 1.2; min-width: 0; }
.side__name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__name small { color: var(--muted); }
.side__nav { flex: 1; overflow-y: auto; margin: 10px -4px 0; padding: 0 4px; scrollbar-width: thin; }
.side__group { margin: 18px 10px 6px; font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.side__link { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; text-decoration: none !important; white-space: nowrap; position: relative; }
.side__link svg { width: 20px; height: 20px; }
.side__link:hover { background: var(--surface-2); color: var(--text); }
.side__link.is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); outline: 1px solid var(--line); }
.side__link.is-active svg { color: var(--accent); }
.side__link .count { margin-left: auto; font-size: .72rem; font-weight: 700; background: var(--ink); color: var(--ink-text); border-radius: 99px; padding: 1px 7px; }
.side__foot { border-top: 1px solid var(--line); margin: 8px -12px -12px; padding: 10px 14px; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.mode-pill { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-right: 4px; }
.is-collapsed .side__name, .is-collapsed .side__group, .is-collapsed .side__link span, .is-collapsed .side__foot { display: none; }
.is-collapsed .side__link { justify-content: center; }
.is-collapsed .side__link .count { position: absolute; top: 2px; right: 4px; }
.is-collapsed .side__brand { justify-content: center; padding: 8px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 20px 0 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top__title { font-size: 1.15rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top__actions { display: flex; align-items: center; gap: 4px; }
.badge { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--st-cancelled); color: #fff; font-size: .66rem; font-weight: 700; display: grid; place-items: center; }
.bell, .user { position: relative; }
.bell__menu, .user__menu { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 40; }
.user__menu { width: 220px; display: grid; gap: 2px; }
.user__menu p { padding: 6px 10px; word-break: break-all; }
.user__menu a, .user__menu button { display: block; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--text); cursor: pointer; text-decoration: none; }
.user__menu a:hover, .user__menu button:hover { background: var(--surface-2); }
.user__btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 12px 3px 3px; cursor: pointer; font-weight: 600; margin-left: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: .82rem; flex: none; }
.avatar--lg { width: 48px; height: 48px; font-size: 1.05rem; }
.demo-banner { margin: 16px 24px 0; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: .86rem; }
.view { padding: 24px; outline: none; display: grid; gap: 20px; align-content: start; }
.view > * { animation: rise .35s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.side-scrim { display: none; }

/* ── Cards, tiles ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card__head h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.card__head h2 svg { color: var(--accent); }
.card__head p { font-size: .82rem; color: var(--muted); }
.card__head .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.tile { display: flex; flex-direction: column; gap: 6px; text-decoration: none !important; color: var(--text); transition: border-color .2s, transform .25s var(--ease); }
a.tile:hover { border-color: var(--line-2); transform: translateY(-2px); }
.tile__top { display: flex; justify-content: space-between; align-items: flex-start; font-size: .84rem; color: var(--muted); font-weight: 500; }
.tile__icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile__value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile__sub { font-size: .8rem; color: var(--muted); }
.section-title { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.section-title h2 { font-size: 1.2rem; }
.section-title p { color: var(--muted); font-size: .86rem; }
.section-title .spacer { flex: 1; }

/* ── Charts ── */
.vbars { display: flex; align-items: flex-end; gap: 2px; height: 190px; padding-top: 18px; border-bottom: 1px solid var(--line); position: relative; }
.vbars__col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; cursor: default; }
.vbars__col::before { content: ""; position: absolute; inset: 0 -1px; border-radius: 6px; }
.vbars__col:hover::before { background: var(--surface-2); }
.vbars__bar { position: relative; width: min(70%, 22px); background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .6s var(--ease); }
.vbars__bar.is-future { background: var(--bar-2); }
.vbars__col.is-today .vbars__bar { background: var(--bar-today); }
.vbars__val { position: absolute; bottom: 100%; margin-bottom: 3px; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.vbars__axis { display: flex; gap: 2px; margin-top: 6px; }
.vbars__axis span { flex: 1; text-align: center; font-size: .66rem; color: var(--faint); white-space: nowrap; overflow: hidden; }
.vbars__axis span.is-today { color: var(--text); font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; gap: 5px; }
.hbar__row { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; }
.hbar__row b { font-variant-numeric: tabular-nums; }
.hbar__track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hbar__fill { height: 100%; border-radius: 99px; background: var(--bar); transition: width .7s var(--ease); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--bar); border-radius: 99px; }
.meter.is-full span { background: var(--st-noshow); }
.empty { display: grid; place-items: center; gap: 6px; text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { width: 30px; height: 30px; color: var(--faint); }
.empty b { color: var(--text); }

/* ── Status badges (colour + text + icon, never colour alone) ── */
.st { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st--confirmed { color: var(--st-confirmed); background: var(--st-confirmed-bg); }
.st--attended { color: var(--st-attended); background: var(--st-attended-bg); }
.st--no_show { color: var(--st-noshow); background: var(--st-noshow-bg); }
.st--cancelled { color: var(--st-cancelled); background: var(--st-cancelled-bg); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill--accent { background: var(--accent-soft); color: var(--accent); }

/* ── Toolbar / filters ── */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .input { width: auto; min-width: 150px; height: 38px; }
.toolbar .search { flex: 1 1 240px; }
.toolbar .spacer { flex: 1; }
.chipset { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 500; font-size: .84rem; color: var(--muted); }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.chip small { opacity: .7; margin-left: 4px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .84rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.seg button svg { width: 15px; height: 15px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--accent-soft); border-radius: 10px; font-size: .88rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--text); }
.table th .arrow { margin-left: 3px; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-clickable { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .cb { width: 36px; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: .78rem; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); flex-wrap: wrap; }
.pager__btns { display: flex; gap: 6px; align-items: center; }

/* ── Kanban ── */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.kcol { background: var(--surface-2); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 240px; transition: outline-color .2s; outline: 2px dashed transparent; }
.kcol.is-over { outline-color: var(--accent); }
.kcol__head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 6px; font-weight: 600; font-size: .9rem; }
.kcol__head .pill { margin-left: auto; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; cursor: grab; box-shadow: var(--shadow); font-size: .86rem; }
.kcard:active { cursor: grabbing; }
.kcard.is-dragging { opacity: .4; }
.kcard__title { font-weight: 600; }
.kcard__meta { font-size: .78rem; color: var(--muted); }

/* ── Calendar ── */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head h2 { font-size: 1.15rem; min-width: 170px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal__dow { background: var(--surface); padding: 8px 10px; font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.cal__day { background: var(--surface); min-height: 112px; padding: 8px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: background .15s; min-width: 0; border: 0; text-align: left; }
.cal__day:hover { background: var(--surface-2); }
.cal__day.is-other { background: color-mix(in srgb, var(--surface) 55%, var(--bg)); color: var(--faint); }
.cal__day.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal__num { font-size: .82rem; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.cal__day.is-today .cal__num b { background: var(--ink); color: var(--ink-text); border-radius: 99px; padding: 0 7px; }
.cal__num .pill { font-size: .68rem; padding: 0 6px; }
.cal__ev { font-size: .74rem; padding: 2px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--bar); }
.cal__ev.is-full { border-left-color: var(--st-noshow); }
.cal__more { font-size: .72rem; color: var(--muted); padding-left: 6px; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 10px; overflow-x: auto; }
.week__col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.week__head { padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: .86rem; display: flex; justify-content: space-between; }
.week__head.is-today { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.sess { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; display: grid; gap: 5px; cursor: pointer; text-align: left; box-shadow: var(--shadow); transition: border-color .2s, transform .2s var(--ease); width: 100%; }
.sess:hover { border-color: var(--accent); transform: translateY(-1px); }
.sess.is-past { opacity: .65; }
.sess__time { font-size: .76rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.sess__name { font-weight: 600; font-size: .88rem; }
.sess__meta { font-size: .76rem; color: var(--muted); display: flex; justify-content: space-between; }
.list { display: grid; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.list-item__main { flex: 1; min-width: 0; }
.list-item__main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item__main span { font-size: .8rem; color: var(--muted); }
.list-item.is-clickable { cursor: pointer; }
.list-item.is-clickable:hover { border-color: var(--line-2); background: var(--surface-2); }

/* ── Timetable editor ── */
.tt { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; }
.tt__slot { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 10px; font-size: .84rem; }
.tt__slot div { flex: 1; min-width: 0; }
.tt__slot b { display: block; }
.tt__slot span { color: var(--muted); font-size: .76rem; }
.tt__slot.is-off { opacity: .5; }

/* ── Entity cards (classes, coaches) ── */
.ecard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ecard__img { aspect-ratio: 16 / 9; background: var(--surface-2) center / cover no-repeat; }
.ecard__img.is-portrait { aspect-ratio: 4 / 3; }
.ecard__body { padding: 16px; display: grid; gap: 8px; flex: 1; align-content: start; }
.ecard__body h3 { font-size: 1.05rem; }
.ecard__body p { font-size: .86rem; color: var(--muted); }
.ecard__foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: center; }
.ecard.is-off { opacity: .6; }

/* ── Modal / drawer / toast / tooltip ── */
.modal { border: 0; padding: 0; background: transparent; max-width: min(640px, calc(100vw - 24px)); width: 100%; color: var(--text); }
.modal::backdrop { background: rgba(10, 10, 5, .45); backdrop-filter: blur(3px); }
.modal[open] { animation: pop .25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal__box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal__head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal__head h2 { font-size: 1.1rem; flex: 1; }
.modal__body { padding: 20px; overflow-y: auto; display: grid; gap: 14px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.slot-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: .86rem; display: grid; text-align: left; }
.slot-chip small { font-weight: 500; color: var(--muted); font-size: .74rem; }
.slot-chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.slot-chip[disabled] { opacity: .45; cursor: not-allowed; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(460px, 100vw); z-index: 70; transform: translateX(100%); transition: transform .35s var(--ease); visibility: hidden; }
.drawer.is-open { transform: none; visibility: visible; }
.drawer__box { height: 100%; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.drawer__head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer__head h2 { font-size: 1.15rem; }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: 20px; align-content: start; }
.drawer__foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.drawer-scrim { position: fixed; inset: 0; background: rgba(10, 10, 5, .35); z-index: 65; opacity: 0; pointer-events: none; transition: opacity .3s; }
.drawer.is-open + .drawer-scrim { opacity: 1; pointer-events: auto; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats div { background: var(--surface-2); border-radius: 10px; padding: 10px; text-align: center; }
.stats b { display: block; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.stats span { font-size: .72rem; color: var(--muted); }
.note { padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: .88rem; display: grid; gap: 3px; }
.note small { color: var(--muted); }
.h3 { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 90; }
.toast { background: var(--ink); color: var(--ink-text); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; font-size: .9rem; animation: pop .25s var(--ease); display: flex; gap: 12px; align-items: center; }
.toast--error { background: var(--st-cancelled); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--ink-text); padding: 6px 10px; border-radius: 8px; font-size: .78rem; font-weight: 500; max-width: 260px; box-shadow: var(--shadow-lg); white-space: pre-line; }
.notif { display: flex; gap: 10px; padding: 10px; border-radius: 10px; cursor: pointer; align-items: flex-start; }
.notif:hover { background: var(--surface-2); }
.notif__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; }
.notif.is-read .notif__dot { background: transparent; }
.notif__body { flex: 1; min-width: 0; font-size: .86rem; }
.notif__body b { display: block; }
.notif__body span { color: var(--muted); font-size: .8rem; }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-layout { grid-template-columns: 1fr; }
  .grid--wide { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app, .is-collapsed .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 60; transform: translateX(-100%); transition: transform .3s var(--ease); background: var(--bg); }
  .is-collapsed .side__name, .is-collapsed .side__group, .is-collapsed .side__link span, .is-collapsed .side__foot { display: revert; }
  .is-collapsed .side__link { justify-content: flex-start; }
  .side-open .side { transform: none; }
  .side-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(10, 10, 5, .35); z-index: 55; }
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login__brand { padding: 32px 24px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 600px) {
  .view { padding: 16px; }
  .demo-banner { margin: 12px 16px 0; }
  .top { padding: 0 10px 0 6px; }
  .grid--4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 16px; }
  .tile__value { font-size: 1.4rem; }
  .form-grid { grid-template-columns: 1fr; }
  .cal__day { min-height: 64px; padding: 5px; }
  .cal__ev, .cal__more { display: none; }
  .cal__dow { padding: 6px 4px; font-size: .64rem; letter-spacing: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 100px 1fr; }
  .bell__menu { position: fixed; left: 8px; right: 8px; width: auto; top: calc(var(--top-h) + 4px); }
  .toolbar .input { min-width: 0; flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
