/* Anderson Intranet — design tokens and components. Source of truth: STYLE_GUIDE.md */

:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-muted: #F5F6F8;
  --line: #E3E6EB;
  --line-strong: #D5D9E0;
  --ink: #14171F;
  --ink-2: #3A404C;
  --ink-muted: #5B6270;
  --accent: #C2410C;
  --accent-hover: #9A3412;
  --accent-tint: #FDF0E9;
  --accent-tint-line: #F3D3C2;
  --accent-ink: #8A2D06;
  --link: #B43C0A;
  --link-hover: #8A2D06;
  --brand: #E8622C;
  --success: #166534; --success-tint: #E8F5EC; --success-dot: #15803D;
  --info: #1E40AF;    --info-tint: #E8EEFC;
  --warning: #92400E; --warning-tint: #FEF3C7;
  --danger: #B91C1C;  --danger-tint: #FDECEC;
  --avatar: #1F2937;
  --shadow-pop: 0 12px 32px rgba(20, 23, 31, 0.14), 0 2px 6px rgba(20, 23, 31, 0.08);
  --overlay: rgba(20, 23, 31, 0.45);

  --r-card: 12px;
  --r-tile: 10px;
  --r-control: 8px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1115; --surface: #171A20; --surface-muted: #1E222A; --line: #2A2F38; --line-strong: #3A404C;
    --ink: #E8EAEE; --ink-2: #C4C9D2; --ink-muted: #9AA1AD;
    --accent: #C2410C; --accent-hover: #D9531E; --accent-tint: #2A1A12; --accent-tint-line: #4A2A1A; --accent-ink: #F4A27A;
    --link: #F08A5D; --link-hover: #F4A27A;
    --success: #6EE7A0; --success-tint: #12301F; --success-dot: #4ADE80;
    --info: #93B4FF; --info-tint: #16213D; --warning: #FCD34D; --warning-tint: #33270D; --danger: #FCA5A5; --danger-tint: #3A1616;
    --avatar: #3A404C; --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5); --overlay: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1115; --surface: #171A20; --surface-muted: #1E222A; --line: #2A2F38; --line-strong: #3A404C;
  --ink: #E8EAEE; --ink-2: #C4C9D2; --ink-muted: #9AA1AD;
  --accent: #C2410C; --accent-hover: #D9531E; --accent-tint: #2A1A12; --accent-tint-line: #4A2A1A; --accent-ink: #F4A27A;
  --link: #F08A5D; --link-hover: #F4A27A;
  --success: #6EE7A0; --success-tint: #12301F; --success-dot: #4ADE80;
  --info: #93B4FF; --info-tint: #16213D; --warning: #FCD34D; --warning-tint: #33270D; --danger: #FCA5A5; --danger-tint: #3A1616;
  --avatar: #3A404C; --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5); --overlay: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-muted); }
.meta { font-size: 12px; color: var(--ink-muted); }
.overline { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1 1 auto; }

/* ------------------------------------------------------------------ shell */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 10px 24px; display: flex; align-items: center; gap: 16px; min-height: 61px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; flex: 0 0 36px;
}
.brand-name { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name strong { font-size: 15px; font-weight: 700; }
.brand-name span { font-size: 12px; color: var(--ink-muted); }
.entity-switch {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); cursor: pointer;
}
.entity-switch strong { font-weight: 600; white-space: nowrap; }
.entity-switch { color: var(--ink); font: inherit; }
.entity-switch.static { cursor: default; }
.entity-switch .short { display: none; }
.entity-switch:not(.static):hover { background: var(--surface-muted); }
.entity-switch .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.search-wrap { flex: 1 1 280px; display: flex; justify-content: center; }
.search-box {
  position: relative; width: 100%; max-width: 520px; height: 40px; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface-muted);
  color: var(--ink-muted); cursor: text; text-align: left;
}
.top-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  position: relative; width: 44px; height: 44px; border: 0; border-radius: var(--r-control); background: transparent;
  color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-muted); }
.icon-btn .dot { position: absolute; top: 10px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.user-btn {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px 0 4px; border: 0;
  border-radius: var(--r-control); background: transparent; cursor: pointer; text-align: left;
}
.user-btn:hover { background: var(--surface-muted); }
.user-btn .who { display: flex; flex-direction: column; line-height: 1.25; }
.user-btn .who strong { font-weight: 600; }
.user-btn .who span { font-size: 12px; color: var(--ink-muted); }
.menu-toggle { display: none; }

.layout { display: flex; align-items: stretch; min-height: calc(100vh - 61px); }
.sidebar {
  flex: 0 0 240px; width: 240px; background: var(--surface); border-right: 1px solid var(--line);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 61px; height: calc(100vh - 61px); overflow-y: auto;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group .overline { padding: 0 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--r-control);
  color: var(--ink-2); font-weight: 400; border: 0; background: transparent; width: 100%; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--surface-muted); color: var(--ink); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }
.nav-item .count { margin-left: auto; font-size: 12px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.nav-item.soon { color: var(--ink-muted); }
.nav-item .soon-tag { margin-left: auto; font-size: 11px; color: var(--ink-muted); }
.status-card { margin-top: auto; padding: 12px; border-radius: var(--r-control); background: var(--surface-muted); display: flex; flex-direction: column; gap: 4px; }
.status-card strong { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success-dot); flex: 0 0 8px; }
.status-dot.off { background: var(--warning); }

.main { flex: 1 1 auto; min-width: 0; padding: 24px 32px 48px; }
.container { max-width: 1160px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

.view-as-bar { background: var(--warning-tint); color: var(--warning); border-bottom: 1px solid var(--line); padding: 8px 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-weight: 500; }

/* ------------------------------------------------------------------ page header */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-header h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.page-header p { margin: 4px 0 0; color: var(--ink-muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  min-height: 40px; padding: 0 16px; border-radius: var(--r-control); font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-lg { min-height: 44px; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-muted); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-muted); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); color: #fff; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { text-align: left; background: none; border: 0; padding: 0; color: var(--link); font-weight: 600; font-size: 13px; cursor: pointer; }
.link-btn:hover { color: var(--link-hover); text-decoration: underline; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-header h2 { font-size: 16px; font-weight: 600; }
.card-header a, .card-header .link-btn { font-size: 13px; font-weight: 600; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }
.list { list-style: none; margin: 0; padding: 8px 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 10px 20px; }
.list > li + li { border-top: 1px solid transparent; }
.list.divided > li + li { border-top-color: var(--line); }

.grid-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.stat {
  display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; font: inherit;
}
.stat:hover { border-color: var(--line-strong); text-decoration: none; color: var(--ink); }
.stat .label { font-size: 13px; color: var(--ink-muted); font-weight: 500; }
.stat .value { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .caption { font-size: 12px; color: var(--ink-muted); }
.stat .caption.success { color: var(--success); font-weight: 500; }
.stat .caption.accent { color: var(--accent-ink); font-weight: 500; }

.grid-quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.quick {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-tile); color: var(--ink); font-weight: 500; text-decoration: none; cursor: pointer; text-align: left;
}
.quick:hover { border-color: var(--line-strong); text-decoration: none; color: var(--ink); }
.icon-tile { width: 36px; height: 36px; flex: 0 0 36px; border-radius: var(--r-control); background: var(--surface-muted); color: var(--ink-2); display: flex; align-items: center; justify-content: center; }

.cols-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.cols-1-1 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.section-title { font-size: 16px; font-weight: 600; }

/* ------------------------------------------------------------------ badges, avatars, dates */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.3; }
.tone-neutral { background: var(--surface-muted); color: var(--ink-2); }
.tone-accent { background: var(--accent-tint); color: var(--accent-ink); }
.tone-success { background: var(--success-tint); color: var(--success); }
.tone-info { background: var(--info-tint); color: var(--info); }
.tone-warning { background: var(--warning-tint); color: var(--warning); }
.tone-danger { background: var(--danger-tint); color: var(--danger); }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: var(--avatar); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.avatar.sm { width: 28px; height: 28px; flex-basis: 28px; font-size: 11px; }
.date-badge { width: 44px; flex: 0 0 44px; text-align: center; border: 1px solid var(--line); border-radius: var(--r-control); padding: 4px 0; display: flex; flex-direction: column; line-height: 1.25; }
.date-badge span { font-size: 11px; color: var(--ink-muted); text-transform: uppercase; }
.date-badge strong { font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--accent); }

/* ------------------------------------------------------------------ banner, empty, alerts */
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--accent-tint-line); background: var(--accent-tint); border-radius: var(--r-tile); color: var(--accent-ink); }
.banner .text { flex: 1 1 auto; color: var(--ink); }
.banner.tone-info { border-color: transparent; }
.banner.tone-warning { border-color: transparent; }
.banner.tone-danger { border-color: transparent; }
.empty { padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.empty .circle { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--success-tint); color: var(--success-dot); }
.empty .circle.neutral { background: var(--surface-muted); color: var(--ink-muted); }
.empty strong { font-weight: 600; }
.empty p { margin: 0; color: var(--ink-muted); max-width: 380px; }
.alert { padding: 10px 14px; border-radius: var(--r-tile); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.alert ul { margin: 0; padding-left: 18px; }
.fieldset { border: 1px solid var(--line); border-radius: var(--r-control); padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.fieldset legend { font-size: 13px; font-weight: 500; padding: 0 4px; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
pre.code { display: block; padding: 10px 12px; overflow-x: auto; white-space: pre; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); background: var(--surface-muted); padding: 10px 16px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { padding: 8px 16px; height: 48px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-muted); }
.table tr.clickable { cursor: pointer; }
.table .right { text-align: right; }
.table .person { display: flex; align-items: center; gap: 10px; }
.table .person > div, .table .person > span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.table td.num, .table .nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 12px; font-weight: 500; color: var(--ink-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; min-height: 44px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { margin-left: 6px; font-size: 12px; color: var(--accent-ink); }

/* ------------------------------------------------------------------ forms */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 13px; font-weight: 500; color: var(--ink); }
.field .help { font-size: 12px; color: var(--ink-muted); }
.field .error { font-size: 12px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink);
}
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-control); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 0 12px; min-height: 36px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }

/* ------------------------------------------------------------------ modal, drawer, menu, toast */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 64px 16px 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-pop); width: 100%; max-width: 560px; display: flex; flex-direction: column; }
.modal.lg { max-width: 820px; }
.modal.sm { max-width: 420px; }
.modal-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 16px; font-weight: 600; flex: 1 1 auto; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.drawer-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; background: transparent; border-radius: var(--r-control); cursor: pointer; text-align: left; color: var(--ink); }
.menu-item:hover { background: var(--surface-muted); text-decoration: none; color: var(--ink); }
.menu-left { left: 0; right: auto; }
/* TCF */
.bar { height: 8px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.timeline { list-style: none; margin: 0; padding: 4px 20px 12px; }
.timeline li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0 10px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
/* Learning */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 16px 20px; }
.course-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); color: var(--ink); }
.course-card:hover { border-color: var(--line-strong); text-decoration: none; background: var(--surface-muted); }
.course-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.course-steps { display: flex; flex-direction: column; gap: 2px; }
.course-step { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--r-control); background: transparent; color: var(--ink-2); text-align: left; cursor: pointer; font: inherit; }
.course-step:hover:not(:disabled) { background: var(--surface-muted); }
.course-step[aria-current="step"] { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }
.course-step:disabled { opacity: .55; cursor: default; }
.course-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; border: 1px solid var(--line-strong); background: var(--surface); }
.course-dot.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.lesson-body { white-space: pre-wrap; line-height: 1.6; overflow-wrap: anywhere; }
.certificate { max-width: 760px; margin: 0 auto; padding: 56px 40px; text-align: center; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.certificate h1 { margin: 8px 0 0; font-size: 32px; }
.certificate h2 { margin: 0; font-size: 22px; }
.certificate p { margin: 0; }
.certificate .brand-mark { width: 48px; height: 48px; font-size: 22px; margin-bottom: 8px; }
/* KPI reviews */
.kpi-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 16px; padding: 0; }
.kpi-steps li { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; font-weight: 500; }
.kpi-steps li.current { color: var(--accent-ink); font-weight: 600; }
.kpi-steps li.current .course-dot { border-color: var(--accent); color: var(--accent-ink); }
.kpi-steps li.done { color: var(--ink-2); }
.kpi-steps li.done .course-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.kpi-list { display: flex; flex-direction: column; }
.kpi-item { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.kpi-item:last-child { border-bottom: 0; }
.kpi-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.kpi-score { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 10px; align-items: start; }
.kpi-given { font-size: 14px; }
.kpi-note { white-space: pre-wrap; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.kpi-edit { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-card); }
.kpi-edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; }
/* Tools */
.reg28-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 10px; }
.reg28-cell { display: flex; flex-direction: column; gap: 4px; }
.reg28-check { display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.bar.over > span { background: var(--danger); }
.calc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.calc-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.form-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.calc-inputs { gap: 12px; }
.calc-results { display: flex; flex-direction: column; gap: 10px; }
.calc-line { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.calc-line > span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
.calc-line.strong { font-weight: 600; font-size: 16px; }
.calc-line.strong > span:last-child { font-weight: 700; }
.calc-line.bad > span:last-child { color: var(--danger); }
.calc-line.good > span:last-child { color: var(--success); }
.calc-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.calc-bar-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 96px; gap: 8px; align-items: center; }
.calc-bar { display: flex; height: 10px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.calc-bar .contrib, .key.contrib { background: var(--line-strong); }
.calc-bar .grow, .key.grow { background: var(--accent); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin: 0 4px 0 8px; }
.print-only { display: none; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.app-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); color: var(--ink); }
.app-card:hover { border-color: var(--line-strong); background: var(--surface-muted); text-decoration: none; }
.app-mark { flex: none; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: var(--accent-tint); color: var(--accent-ink); }
.app-host { display: block; margin-top: 2px; }
/* a4u intake */
.linklike { border: 0; background: none; padding: 0; color: var(--accent-ink); cursor: pointer; font: inherit; text-decoration: underline; }
.seg.scroll { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
.seg.scroll button { white-space: nowrap; flex: none; }
.dot-new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface-muted); color: var(--ink); font-size: 13px; }
.attach-chip span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.attach-chip:hover { border-color: var(--line-strong); text-decoration: none; }
.email-body { max-height: 520px; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface-muted); font-size: 14px; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 4px 0 0; font-size: 14px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
/* Support tickets */
.ticket-msg { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ticket-msg:first-child { padding-top: 0; }
.ticket-msg:last-child { border-bottom: 0; padding-bottom: 0; }
.ticket-msg.internal { background: var(--warning-tint, var(--surface-muted)); margin: 0 -20px; padding: 12px 20px; }
.ticket-system { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); text-align: center; }
.star { border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--line-strong); cursor: pointer; padding: 2px; }
.star.on { color: var(--accent); }
/* Document vault */
.vault { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.vault-folders { display: flex; flex-direction: column; gap: 2px; }
.vault-folder { display: flex; align-items: flex-start; gap: 10px; width: 100%; min-height: 40px; padding: 9px 12px; border: 0; border-radius: var(--r-control); background: transparent; color: var(--ink-2); cursor: pointer; text-align: left; font: inherit; }
.vault-folder:hover { background: var(--surface-muted); color: var(--ink); }
.vault-folder[aria-current="true"] { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }
.vault-folder > span { display: flex; flex-direction: column; min-width: 0; }
.vault-folder svg { flex: none; margin-top: 2px; }
.vault-mobile-select { display: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-tile); box-shadow: var(--shadow-pop); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; min-width: 260px; }
.toast.error { border-color: var(--danger); }

/* ------------------------------------------------------------------ calendar month grid */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.month .dow { padding: 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); background: var(--surface-muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.month .day { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.month .day.other { background: var(--surface-muted); }
.month .day .n { font-size: 12px; font-weight: 600; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.month .day.today .n { box-shadow: 0 0 0 2px var(--accent); }
.month .chip { font-size: 11px; line-height: 1.3; padding: 2px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; text-align: left; cursor: default; font-weight: 500; }

/* ------------------------------------------------------------------ attendance sheet */
.sheet td, .sheet th { padding: 0 8px; }
.sheet td { height: 40px; }
.sheet input.cell { width: 64px; min-height: 32px; padding: 4px 6px; text-align: right; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-variant-numeric: tabular-nums; }
.sheet input.note { width: 100%; min-width: 120px; min-height: 32px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.sheet tr.off td { background: var(--surface-muted); color: var(--ink-muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-muted); }
.kv dd { margin: 0; }

/* ------------------------------------------------------------------ sign-in */
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }
.signin .card { width: 100%; max-width: 400px; }
.signin .card-body { display: flex; flex-direction: column; gap: 20px; padding: 32px 28px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .calc-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-stats, .grid-quick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .menu-toggle { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; z-index: 45; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  .cols-2-1, .cols-1-1 { grid-template-columns: minmax(0, 1fr); }
  .user-btn .who, .entity-switch .fsp { display: none; }
  .main { padding: 20px 16px 40px; }
  .topbar { padding: 10px 16px; gap: 8px; }
}
@media (max-width: 720px) {
  .grid-stats, .grid-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .search-wrap { display: none; }
  .entity-switch.static { display: none; }
  .vault { grid-template-columns: minmax(0, 1fr); }
  .course-layout { grid-template-columns: minmax(0, 1fr); }
  .kpi-score { grid-template-columns: minmax(0, 1fr); }
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .calc-layout > nav { flex-direction: row; overflow-x: auto; }
  .calc-layout > nav .course-step { white-space: nowrap; }
  .certificate { padding: 32px 16px; }
  .vault-folders { display: none; }
  .vault-mobile-select { display: block; }
  .entity-switch { padding: 0 8px; }
  .entity-switch .long { display: none; }
  .entity-switch .short { display: inline; }
  .menu-left { left: auto; right: -80px; }
  .brand-name span { display: none; }
  .page-header h1 { font-size: 24px; }
  .month .day { min-height: 64px; }
  .month .chip { display: none; }
  .month .day.has-items::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .certificate { border: 2px solid #C2410C; }
  .topbar, .sidebar, .page-actions, .no-print, .tabs, .page-header { display: none !important; }
  .print-only { display: block; }
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 0; }
  body { background: #fff; }
}
