/* ===== Design tokens ===== */
:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f9f9fb;
  --surface-3: #ececf0;
  --glass: rgba(255, 255, 255, 0.72);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.14);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --good: #1a7f37;
  --good-soft: rgba(26, 127, 55, 0.1);
  --warn: #a35a00;
  --warn-soft: rgba(219, 132, 0, 0.13);
  --bad: #d70015;
  --bad-soft: rgba(215, 0, 21, 0.09);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: rgba(0, 0, 0, 0.07);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  --gradient: linear-gradient(90deg, #0071e3 0%, #8e44ec 50%, #e0457b 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #232325;
    --surface-3: #2c2c2e;
    --glass: rgba(22, 22, 24, 0.72);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --line: rgba(255, 255, 255, 0.09);
    --line-2: rgba(255, 255, 255, 0.16);
    --accent: #2997ff;
    --accent-hover: #47a6ff;
    --accent-soft: rgba(41, 151, 255, 0.16);
    --good: #4cd964;
    --good-soft: rgba(76, 217, 100, 0.14);
    --warn: #ffb340;
    --warn-soft: rgba(255, 179, 64, 0.14);
    --bad: #ff6961;
    --bad-soft: rgba(255, 105, 97, 0.14);
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --gradient: linear-gradient(90deg, #2997ff 0%, #a970ff 50%, #ff6b9a 100%);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #232325;
  --surface-3: #2c2c2e;
  --glass: rgba(22, 22, 24, 0.72);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #8e8e93;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --accent: #2997ff;
  --accent-hover: #47a6ff;
  --accent-soft: rgba(41, 151, 255, 0.16);
  --good: #4cd964;
  --good-soft: rgba(76, 217, 100, 0.14);
  --warn: #ffb340;
  --warn-soft: rgba(255, 179, 64, 0.14);
  --bad: #ff6961;
  --bad-soft: rgba(255, 105, 97, 0.14);
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: rgba(255, 255, 255, 0.08);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --gradient: linear-gradient(90deg, #2997ff 0%, #a970ff 50%, #ff6b9a 100%);
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.47;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 34px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 980px; border: 1px solid transparent;
  background: var(--surface-3); color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, transform .1s;
}
.btn:hover { text-decoration: none; filter: brightness(0.97); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); filter: none; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); filter: none; }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 17px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn svg, .icon { width: 18px; height: 18px; flex: none; }
.btn-sm svg { width: 16px; height: 16px; }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, select.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 92px; 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 4px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 34px; border-radius: 980px; background: var(--surface-2); }

/* ===== Cards & layout ===== */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head h3 { font-size: 17px; }
.card-body { padding: 16px 22px 22px; }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* ===== KPI ===== */
.kpi { padding: 20px 22px; }
.kpi .label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi .value { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.kpi .icon-wrap { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }

/* ===== Badges, chips, avatars ===== */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 980px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 14px; border-radius: 980px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: #fff; overflow: hidden; background: #8e8e93; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 88px; height: 88px; font-size: 30px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .meta { font-size: 12px; color: var(--text-3); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.table th.right { text-align: right; }
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text); }
.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.clickable { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar select.input { width: auto; min-width: 140px; height: 36px; border-radius: 980px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.empty { padding: 48px 22px; text-align: center; color: var(--text-2); }
.empty svg { width: 40px; height: 40px; color: var(--text-3); margin: 0 auto 10px; }

/* ===== App shell ===== */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 24px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--line); z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: var(--gradient); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; flex: none; overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 650; font-size: 15px; line-height: 1.2; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--text-3); }
.nav-group { margin-top: 14px; }
.nav-title { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 0 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 12px; border-radius: 10px;
  color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none;
}
.nav a svg { width: 18px; height: 18px; color: var(--text-2); }
.nav a:hover { background: var(--surface-3); }
.nav a.active { background: var(--accent); color: #fff; }
.nav a.active svg { color: #fff; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 28px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar .search { width: 300px; }
.topbar .menu-btn { display: none; }
.crumbs { font-size: 13px; color: var(--text-3); display: flex; gap: 6px; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--text-3); }
.crumbs b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.profile-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 980px; }
.profile-btn:hover { background: var(--surface-3); }
.profile-btn .who { text-align: left; line-height: 1.2; }
.profile-btn .who b { font-size: 13px; font-weight: 600; display: block; }
.profile-btn .who span { font-size: 11px; color: var(--text-3); }
.content { padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; animation: fadeUp .35s ease both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--text-2); margin-top: 6px; font-size: 15px; }
.page-head .row-wrap { justify-content: flex-end; }
.scrim { display: none; }

/* ===== Dropdown / popover ===== */
.popover { position: absolute; top: calc(100% + 8px); right: 0; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; animation: pop .16s ease both; }
.popover a, .popover button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px; border: 0; background: transparent; color: var(--text); font-size: 14px; text-align: left; cursor: pointer; text-decoration: none; }
.popover a:hover, .popover button.item:hover { background: var(--surface-3); }
.popover .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.popover .head { padding: 10px 12px 8px; }
.search-results { left: 0; right: auto; width: 100%; max-height: 380px; overflow-y: auto; }

/* ===== Modal ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.36); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .2s ease both; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2) both; }
.modal.wide { width: min(920px, 100%); }
.modal.narrow { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 8px; }
.modal-body { padding: 12px 24px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--line); }

/* ===== Toast & tooltip ===== */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; pointer-events: none; }
.toast { background: rgba(29, 29, 31, 0.92); color: #fff; padding: 11px 18px; border-radius: 980px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.2) both; display: flex; gap: 8px; align-items: center; }
.toast.bad { background: #d70015; }
.tip { position: fixed; z-index: 300; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); padding: 7px 10px; border-radius: 9px; font-size: 12px; line-height: 1.35; max-width: 240px; }
.tip b { font-weight: 600; }

/* ===== Tabs ===== */
.tabs { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 980px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; height: 30px; padding: 0 14px; border: 0; border-radius: 980px; background: transparent; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-2); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

/* ===== Charts ===== */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .bar { fill: var(--series-1); }
.chart .bar-2 { fill: var(--series-2); }
.chart .bar:hover, .chart .bar-2:hover { opacity: .8; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-1); opacity: .1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .marker { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--line-2); stroke-width: 1; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.meter.good > i { background: var(--good); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--bad); }

/* ===== Lists ===== */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.date-chip { width: 46px; flex: none; text-align: center; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); padding: 5px 0; line-height: 1.1; }
.date-chip b { display: block; font-size: 18px; font-family: var(--font-display); }
.date-chip span { font-size: 10px; text-transform: uppercase; color: var(--bad); font-weight: 700; letter-spacing: .04em; }

/* ===== Attendance ===== */
.att-toggle { display: inline-flex; gap: 4px; }
.att-toggle button { width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.att-toggle button.on-P { background: var(--good); border-color: var(--good); color: #fff; }
.att-toggle button.on-A { background: var(--bad); border-color: var(--bad); color: #fff; }
.att-toggle button.on-L { background: var(--warn); border-color: var(--warn); color: #fff; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { font-size: 11px; text-align: center; color: var(--text-3); font-weight: 600; text-transform: uppercase; }
.cal .day { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 500; background: var(--surface-2); color: var(--text-3); position: relative; }
.cal .day.P { background: var(--good-soft); color: var(--good); }
.cal .day.A { background: var(--bad-soft); color: var(--bad); }
.cal .day.L { background: var(--warn-soft); color: var(--warn); }
.cal .day.H { background: var(--accent-soft); color: var(--accent); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--text); }
.cal .day.has-event::after { content: ""; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ===== Timetable ===== */
.tt { width: 100%; border-collapse: separate; border-spacing: 6px; min-width: 760px; table-layout: fixed; }
.tt tr > th:first-child { width: 44px; }
.tt th { font-size: 12px; color: var(--text-3); font-weight: 600; text-align: left; padding: 4px 6px; }
.tt td { background: var(--surface-2); border-radius: 12px; padding: 9px 10px; vertical-align: top; height: 62px; border: 1px solid var(--line); }
.tt td.free { background: transparent; border-style: dashed; color: var(--text-3); }
.tt td.clash { border-color: var(--bad); background: var(--bad-soft); }
.tt td.editable { cursor: pointer; }
.tt td.editable:hover { border-color: var(--accent); }
.tt .s { font-weight: 600; font-size: 13px; }
.tt .t { font-size: 12px; color: var(--text-2); }

/* ===== Gallery ===== */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.event-card { overflow: hidden; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.event-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.event-cover { aspect-ratio: 16 / 9; background: var(--surface-3); position: relative; overflow: hidden; }
.event-cover img { width: 100%; height: 100%; object-fit: cover; }
.event-cover .count { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 980px; backdrop-filter: blur(10px); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.gallery .ph { aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-3); position: relative; cursor: zoom-in; }
.gallery .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery .ph:hover img { transform: scale(1.04); }
.gallery .ph .del { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .15s; }
.gallery .ph:hover .del { opacity: 1; }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--text-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 34px; height: 34px; margin: 0 auto 8px; color: var(--accent); }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 12px; }
.previews img { aspect-ratio: 1; object-fit: cover; border-radius: 10px; width: 100%; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.92); z-index: 150; display: flex; align-items: center; justify-content: center; animation: fade .2s ease both; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 10px; object-fit: contain; }
.lightbox .lb-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 24px; cursor: pointer; }
.lightbox .lb-prev { left: 20px; }
.lightbox .lb-next { right: 20px; }
.lightbox .lb-close { top: 30px; right: 20px; transform: none; }
.lightbox .lb-count { position: absolute; bottom: 22px; color: rgba(255, 255, 255, 0.7); font-size: 13px; }

/* ===== Notices ===== */
.notice { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.notice:last-child { border-bottom: 0; }
.notice.unread { box-shadow: inset 3px 0 0 var(--accent); }
.notice h3 { font-size: 16px; }
.notice .body { color: var(--text-2); margin-top: 6px; white-space: pre-line; }

/* ===== Profile ===== */
.profile-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 22px; }
.kv div span { display: block; font-size: 12px; color: var(--text-3); font-weight: 500; }
.kv div b { font-weight: 550; }

/* ===== Login ===== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: #000; color: #f5f5f7; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art::before { content: ""; position: absolute; width: 720px; height: 720px; left: -160px; bottom: -260px; background: radial-gradient(circle, rgba(41, 151, 255, 0.55), transparent 60%); filter: blur(30px); }
.auth-art::after { content: ""; position: absolute; width: 600px; height: 600px; right: -200px; top: -140px; background: radial-gradient(circle, rgba(224, 69, 123, 0.45), transparent 60%); filter: blur(30px); }
.auth-art > * { position: relative; z-index: 1; }
.auth-art h1 { font-size: clamp(40px, 5vw, 64px); line-height: 1.05; letter-spacing: -0.035em; }
.auth-art p { color: #a1a1a6; font-size: 19px; max-width: 460px; margin-top: 16px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
.auth-form .error { color: var(--bad); font-size: 14px; min-height: 20px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; text-align: left; }
.demo-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.demo-btn b { font-size: 14px; }
.demo-btn span { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ===== Print ===== */
#print-root { display: none; }
.doc { color: #000; background: #fff; font-size: 13px; }
.doc h1 { font-size: 22px; }
.doc .doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 12px; margin-bottom: 16px; }
.doc table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.doc th, .doc td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; }
.doc th { background: #f2f2f2; }
.doc .total td { font-weight: 700; }
.doc .sign { display: flex; justify-content: space-between; margin-top: 48px; }
.doc .sign div { border-top: 1px solid #000; padding-top: 4px; width: 180px; text-align: center; font-size: 12px; }
.doc-preview { border: 1px solid var(--line); border-radius: 12px; padding: 24px; background: #fff; color: #000; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  .doc-page { page-break-after: always; }
  .doc-page:last-child { page-break-after: auto; }
}

/* ===== Motion ===== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1 { grid-template-columns: minmax(0, 1fr); }
  .topbar .search { width: 220px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .25s ease; background: var(--surface); }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); z-index: 35; }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn { display: grid; }
  .topbar .search { display: none; }
  .profile-btn .who { display: none; }
  .content { padding: 20px 16px; }
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 32px 24px; min-height: 260px; }
  .auth-art p { font-size: 16px; }
}
@media (max-width: 560px) {
  h1 { font-size: 28px; }
  .g-4, .g-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .kpi { padding: 16px; }
  .kpi .value { font-size: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .card-pad { padding: 16px; }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 14px 16px 16px; }
  .toolbar { padding: 12px 16px; }
  .toolbar .search { max-width: none; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92vh; }
  .crumbs span.sep, .crumbs a { display: none; }
}

/* ===== Chart hover layer ===== */
.chart .pt .cross, .chart .pt .marker { opacity: 0; transition: opacity .12s; pointer-events: none; }
.chart .pt:hover .cross, .chart .pt:hover .marker { opacity: 1; }
