/* ==========================================================================
   TDT – Teacher Development Tracker · โรงเรียนโรตารี่กรุงเทพ
   ========================================================================== */
:root {
  --navy-950: #081634;
  --navy-900: #0c2257;
  --navy-800: #12307a;
  --navy-700: #1b3f93;
  --primary: #1d5fd6;
  --primary-600: #174fb6;
  --primary-50: #eaf1fe;
  --cyan: #13b8e8;
  --cyan-50: #e6f8fd;
  --magenta: #d4157b;
  --magenta-50: #fde8f3;
  --gold: #f2a91c;
  --ok: #17935a;   --ok-50: #e5f6ee;
  --warn: #d48806; --warn-50: #fff4dc;
  --bad: #d63a2f;  --bad-50: #fdecea;
  --bg: #f1f5fb;
  --card: #ffffff;
  --line: #e2e8f2;
  --line-2: #eef2f8;
  --text: #11223f;
  --text-2: #3b4a66;
  --muted: #6b7a94;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 34, 72, .05), 0 4px 16px rgba(16, 34, 72, .05);
  --shadow-lg: 0 12px 40px rgba(16, 34, 72, .16);
  --sidebar-w: 256px;
  --font: "IBM Plex Sans Thai", "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
  --font-head: "Prompt", "IBM Plex Sans Thai", system-ui, sans-serif;
  --hm-high: #2fa463; --hm-mid: #f4c430; --hm-low: #ef6b5b; --hm-none: #e7ebf2;
}

*, *::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.6; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.3; margin: 0 0 .5em; color: var(--text); }
h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .8em; }
small { font-size: .82em; }
.muted { color: var(--muted); }
.pad { padding: 14px 16px; margin: 0; }
.num, td.num, .kpi strong, .tabular { font-variant-numeric: tabular-nums; }
.ic { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
:focus-visible { outline: 3px solid rgba(29, 95, 214, .35); outline-offset: 2px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: #c9d6f2; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 18px; color: #fff; text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; padding: 2px; object-fit: cover; }
.brand b { display: block; font-family: var(--font-head); font-size: 1.45rem; letter-spacing: .04em; line-height: 1.1; }
.brand small { display: block; font-size: .72rem; color: #9fb2dc; }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-group { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #7f93c2; padding: 16px 10px 6px; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #d3def7; font-size: .93rem; margin-bottom: 2px; position: relative; text-decoration: none !important; transition: background .15s; }
.nav-link .ic { width: 19px; height: 19px; opacity: .85; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(29,95,214,.45); }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--cyan); }
.nav-badge { margin-left: auto; font-style: normal; background: var(--magenta); color: #fff; font-size: .72rem; font-weight: 600; min-width: 22px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 2px; }
.sidebar-foot a { color: #9fb2dc; font-size: .86rem; padding: 7px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; text-decoration: none; }
.sidebar-foot a:hover { background: rgba(255,255,255,.06); color: #fff; }
.scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); min-height: 68px; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.25rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 0; font-size: .84rem; color: var(--muted); }
.top-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; height: 40px; width: 260px; color: var(--muted); }
.top-search input { border: 0; background: transparent; outline: none; font: inherit; width: 100%; color: var(--text); }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--primary-50); color: var(--primary); }
.icon-btn .dot { position: absolute; top: -3px; right: -3px; background: var(--magenta); color: #fff; font-style: normal; font-size: .66rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 12px; text-align: left; font: inherit; color: inherit; }
.user-chip:hover { background: var(--bg); }
.user-chip b { display: block; font-size: .9rem; line-height: 1.2; }
.user-chip small { color: var(--muted); }
.only-mobile { display: none; }

.content { padding: 24px 28px 40px; flex: 1; width: 100%; max-width: 1480px; }
.foot { padding: 16px 28px 24px; font-size: .8rem; color: var(--muted); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu > a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; color: var(--text); font-size: .92rem; text-decoration: none; }
.dropdown-menu > a:hover { background: var(--bg); }
.notif-menu { width: 340px; padding: 0; max-height: 440px; overflow-y: auto; }
.dm-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.notif { display: block; padding: 11px 16px; border-bottom: 1px solid var(--line-2); color: var(--text-2); font-size: .88rem; text-decoration: none !important; }
.notif small { display: block; color: var(--muted); font-size: .76rem; }
.notif.unread { background: var(--primary-50); color: var(--text); }
.notif:hover { background: var(--bg); }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; font-size: .84rem; padding: 0; }

/* ---------- Layout helpers ---------- */
.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-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.g-side { grid-template-columns: 320px minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.stack > * + * { margin-top: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; } .mb-0 { margin-bottom: 0; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head p { margin: 2px 0 0; font-size: .84rem; color: var(--muted); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 18px 22px 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); min-width: 0; }
.kpi-ic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-ic .ic { width: 26px; height: 26px; }
.kpi p { margin: 0; font-size: .84rem; color: var(--muted); line-height: 1.3; }
.kpi strong { display: block; font-family: var(--font-head); font-size: 1.7rem; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.kpi strong small { font-family: var(--font); font-size: .82rem; font-weight: 500; color: var(--muted); margin-left: 5px; }
.kpi em { display: block; font-style: normal; font-size: .76rem; color: var(--muted); }
.kpi-blue .kpi-ic { background: var(--primary-50); color: var(--primary); }
.kpi-green .kpi-ic { background: var(--ok-50); color: var(--ok); }
.kpi-cyan .kpi-ic { background: var(--cyan-50); color: #0a8fb8; }
.kpi-magenta .kpi-ic { background: var(--magenta-50); color: var(--magenta); }
.kpi-red .kpi-ic { background: var(--bad-50); color: var(--bad); }
.kpi-amber .kpi-ic { background: var(--warn-50); color: var(--warn); }
a.kpi { color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 340px; }
.donut-wrap { display: grid; place-items: center; position: relative; height: 230px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center strong { font-family: var(--font-head); font-size: 2rem; color: var(--ok); display: block; line-height: 1; }
.donut-center span { font-size: .8rem; color: var(--muted); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; font-size: .84rem; color: var(--text-2); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-scroll { overflow-x: auto; }
.chart-scroll > .chart-box { min-width: 560px; }

/* ---------- Heatmap ---------- */
.heatmap { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: .84rem; }
.heatmap th { font-weight: 500; color: var(--text-2); padding: 4px 6px; white-space: nowrap; }
.heatmap thead th { font-size: .78rem; text-align: center; vertical-align: bottom; }
.heatmap tbody th { text-align: left; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.heatmap td { height: 34px; min-width: 38px; border-radius: 6px; text-align: center; font-weight: 600; color: rgba(0,0,0,.6); font-variant-numeric: tabular-nums; }
.heatmap td a { display: block; color: inherit; text-decoration: none; line-height: 34px; }
.hm-high { background: var(--hm-high); color: #fff !important; }
.hm-mid { background: var(--hm-mid); }
.hm-low { background: var(--hm-low); color: #fff !important; }
.hm-none { background: var(--hm-none); color: #9aa6ba !important; }
.hm-legend { display: flex; gap: 16px; font-size: .8rem; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.hm-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hm-legend .l-high::before { background: var(--hm-high); }
.hm-legend .l-mid::before { background: var(--hm-mid); }
.hm-legend .l-low::before { background: var(--hm-low); }
.hm-legend .l-none::before { background: var(--hm-none); }
.hm-scroll { overflow-x: auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); background: #f7f9fd; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:hover { background: #fafbfe; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 22px; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 22px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.person b { display: block; font-weight: 600; line-height: 1.3; color: var(--text); }
.person small { color: var(--muted); }
a.person:hover { text-decoration: none; }
a.person:hover b { color: var(--primary); }

/* ---------- Avatar ---------- */
.avatar { --h: 215; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 55% 35%); font-family: var(--font-head); font-weight: 600; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 36px; height: 36px; font-size: .9rem; }
.avatar-md { width: 42px; height: 42px; font-size: 1rem; }
.avatar-lg { width: 88px; height: 88px; font-size: 2rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 2.6rem; border: 4px solid #fff; box-shadow: var(--shadow); }

/* ---------- Badges / bars / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; line-height: 1.7; }
.badge-ok { background: var(--ok-50); color: var(--ok); }
.badge-warn { background: var(--warn-50); color: var(--warn); }
.badge-bad { background: var(--bad-50); color: var(--bad); }
.badge-info { background: var(--primary-50); color: var(--primary); }
.badge-muted { background: #eef1f6; color: var(--muted); }
.badge-magenta { background: var(--magenta-50); color: var(--magenta); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--cyan-50); color: #0a7fa3; font-size: .76rem; margin: 2px 4px 2px 0; }
.bar { height: 8px; background: #edf1f7; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .6s ease; }
.bar-ok i { background: var(--ok); }
.bar-bad i { background: var(--bad); }
.bar-warn i { background: var(--gold); }
.bar-info i { background: var(--primary); }
.bar-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.bar-cell .bar { flex: 1; }
.bar-cell span { font-size: .8rem; color: var(--text-2); width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; background: var(--primary); color: #fff; font: inherit; font-weight: 500; font-size: .92rem; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.btn:hover { background: var(--primary-600); box-shadow: 0 4px 12px rgba(29,95,214,.28); }
.btn-ghost { background: #fff; color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); box-shadow: none; color: var(--text); }
.btn-ok { background: var(--ok); } .btn-ok:hover { background: #127a4a; box-shadow: none; }
.btn-danger { background: #fff; color: var(--bad); border-color: #f3c9c5; } .btn-danger:hover { background: var(--bad-50); box-shadow: none; }
.btn-magenta { background: var(--magenta); } .btn-magenta:hover { background: #b30f67; }
.btn-sm { height: 32px; padding: 0 12px; font-size: .84rem; border-radius: 8px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .86rem; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--bad); }
.field small, .help { color: var(--muted); font-size: .8rem; }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid #d5ddea; border-radius: 10px; background: #fff;
  font: inherit; font-size: .94rem; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,95,214,.14); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7a94' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.input-sm { height: 36px; font-size: .88rem; }
.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid #d5ddea; border-radius: 10px; cursor: pointer; font-size: .88rem; background: #fff; }
.checks label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.checks input { accent-color: var(--primary); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .input { width: auto; min-width: 160px; }
.year-form label { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--text-2); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 4px 0 12px; height: 40px; }
.year-form select { border: 0; font: inherit; font-weight: 600; background: transparent; height: 36px; padding: 0 6px; cursor: pointer; color: var(--primary); }

/* Drop zone */
.dropzone { border: 2px dashed #c6d3e8; border-radius: 12px; padding: 22px; text-align: center; background: #fafcff; cursor: pointer; transition: border-color .15s, background .15s; position: relative; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-50); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .ic { width: 30px; height: 30px; color: var(--primary); margin: 0 auto 6px; display: block; }
.dropzone b { display: block; }
.dropzone .dz-file { margin-top: 8px; font-size: .86rem; color: var(--ok); font-weight: 600; }
.file-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); padding: 6px 12px; border-radius: 10px; font-size: .86rem; color: var(--text-2); max-width: 100%; }
.file-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Score picker 1-5 */
.score-pick { display: flex; gap: 6px; }
.score-pick label { position: relative; }
.score-pick input { position: absolute; opacity: 0; }
.score-pick span { width: 42px; height: 40px; border-radius: 10px; border: 1px solid #d5ddea; display: grid; place-items: center; font-weight: 600; cursor: pointer; background: #fff; transition: all .12s; }
.score-pick input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.score-pick input:focus-visible + span { outline: 3px solid rgba(29,95,214,.35); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: .92rem; border: 1px solid; }
.alert span { flex: 1; }
.alert-success { background: var(--ok-50); color: #0f6b40; border-color: #bfe6d1; }
.alert-error { background: var(--bad-50); color: #a02a21; border-color: #f4c7c2; }
.alert-info { background: var(--primary-50); color: var(--primary-600); border-color: #c9dafb; }
.alert-warn { background: var(--warn-50); color: #8a5a00; border-color: #f6dda4; }
.alert-x { background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; padding: 0; }

/* ---------- Misc components ---------- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state .ic { width: 44px; height: 44px; color: #b7c3d8; margin: 0 auto 10px; display: block; }
.empty-state h2, .empty-state h3 { color: var(--text); }
.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--text-2); text-decoration: none; }
.pager a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 16px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.tabs a .badge { font-size: .7rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: .9rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 18px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
.timeline li.t-ok::before { border-color: var(--ok); }
.timeline li.t-warn::before { border-color: var(--gold); }
.timeline li.t-bad::before { border-color: var(--bad); }
.timeline .t-date { font-size: .78rem; color: var(--muted); }
.timeline b { display: block; font-weight: 600; line-height: 1.4; }
.feedback-item { border-left: 3px solid var(--cyan); background: #f6fbfe; padding: 12px 14px; border-radius: 0 10px 10px 0; margin-bottom: 10px; }
.feedback-item.praise { border-color: var(--ok); background: #f3fbf7; }
.feedback-item.urgent { border-color: var(--bad); background: #fef6f5; }
.feedback-item p { margin: 0 0 4px; }
.feedback-item small { color: var(--muted); }
.ann { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.ann:last-child { border-bottom: 0; }
.ann h4 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; }
.ann p { margin: 0; color: var(--text-2); font-size: .9rem; }
.profile-card { text-align: center; }
.profile-card .avatar { margin: 0 auto 12px; }
.profile-card h2 { margin-bottom: 2px; }
.ring { --p: 0; --c: var(--ok); width: 132px; height: 132px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), #e9eef6 0); display: grid; place-items: center; margin: 0 auto; }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; }
.ring strong { font-family: var(--font-head); font-size: 1.6rem; line-height: 1; display: block; }
.ring span { font-size: .74rem; color: var(--muted); }
.stat-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.stat-line:last-child { border-bottom: 0; }
.stat-line b { font-variant-numeric: tabular-nums; }
.goal { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.goal:last-child { border-bottom: 0; }
.goal-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.goal-top b { font-weight: 600; }
.cert-thumb { width: 64px; height: 46px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; overflow: hidden; }
.cert-thumb .ic { width: 22px; height: 22px; }
.welcome { background: linear-gradient(120deg, var(--navy-800), var(--primary) 70%, var(--cyan)); color: #fff; border: 0; position: relative; overflow: hidden; }
.welcome::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08); }
.welcome h2 { color: #fff; font-size: 1.35rem; }
.welcome p { color: rgba(255,255,255,.86); margin: 0; }
.welcome .btn { background: #fff; color: var(--primary); }
.welcome .btn:hover { background: #eef4ff; }
.welcome .btn-ghost { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }
.ipof { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ipof > div { border-radius: 12px; padding: 12px 14px; color: #fff; font-size: .84rem; }
.ipof b { display: block; font-family: var(--font-head); font-size: .95rem; }
.ipof .i { background: #1a8de0; } .ipof .p { background: #18a05a; } .ipof .o { background: #ef8a17; } .ipof .f { background: #7b4fd6; }
dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(8, 22, 52, .5); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: #fafbfe; }
.cred { font-family: ui-monospace, Consolas, monospace; background: var(--bg); padding: 2px 8px; border-radius: 6px; font-size: .86rem; }

/* ---------- Auth page ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.auth-side { background: radial-gradient(circle at 20% 20%, rgba(19,184,232,.35), transparent 50%), linear-gradient(150deg, var(--navy-900), var(--navy-700)); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 60px solid rgba(255,255,255,.04); right: -180px; bottom: -200px; }
.auth-side h1 { color: #fff; font-size: 2.2rem; margin-bottom: 12px; }
.auth-side p { color: rgba(255,255,255,.82); max-width: 460px; }
.auth-brand { display: flex; gap: 14px; align-items: center; color: #fff; text-decoration: none !important; }
.auth-brand img { width: 64px; height: 64px; border-radius: 50%; background: #fff; padding: 3px; }
.auth-brand b { font-family: var(--font-head); font-size: 1.15rem; display: block; }
.auth-brand small { color: #b9c9ec; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: 1.6rem; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: rgba(255,255,255,.9); }
.auth-points .ic { width: 22px; height: 22px; color: var(--cyan); margin-top: 2px; }

/* ---------- Public landing ---------- */
.public { background: #fff; display: block; }
.pub-nav { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.pub-nav .wrap { display: flex; align-items: center; gap: 16px; height: 72px; }
.pub-nav .links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.pub-nav .links a:not(.btn) { color: var(--text-2); font-weight: 500; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.pub-brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none !important; }
.pub-brand img { width: 48px; height: 48px; border-radius: 50%; }
.pub-brand b { font-family: var(--font-head); display: block; line-height: 1.2; }
.pub-brand small { color: var(--muted); }
.hero { background: radial-gradient(circle at 85% 20%, rgba(19,184,232,.18), transparent 45%), radial-gradient(circle at 10% 90%, rgba(212,21,123,.08), transparent 40%), linear-gradient(180deg, #f3f7fe, #fff); padding: 72px 0 64px; }
.hero .wrap { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .84rem; color: var(--primary); font-weight: 600; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.2; margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p.lead { font-size: 1.1rem; color: var(--text-2); max-width: 560px; margin-bottom: 28px; }
.hero-logo { position: relative; display: grid; place-items: center; }
.hero-logo img { width: min(360px, 80%); border-radius: 50%; box-shadow: 0 30px 60px rgba(16,34,72,.18); background: #fff; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 36px; max-width: 560px; }
.hero-stats div { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.hero-stats strong { font-family: var(--font-head); font-size: 1.6rem; display: block; color: var(--navy-800); }
.hero-stats span { font-size: .82rem; color: var(--muted); }
.section { padding: 64px 0; }
.section.alt { background: var(--bg); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 36px; }
.section-head h2 { font-size: 1.8rem; }
.section-head p { color: var(--muted); }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.flow-card { border-radius: 16px; padding: 22px; color: #fff; position: relative; }
.flow-card h3 { color: #fff; font-size: 1.15rem; margin-bottom: 2px; }
.flow-card .sub { opacity: .85; font-size: .86rem; margin-bottom: 12px; display: block; }
.flow-card ul { margin: 0; padding-left: 18px; font-size: .9rem; opacity: .95; }
.flow-card .ic { width: 32px; height: 32px; margin-bottom: 10px; }
.fc-1 { background: linear-gradient(150deg, #1a8de0, #1268b3); }
.fc-2 { background: linear-gradient(150deg, #1fae63, #128049); }
.fc-3 { background: linear-gradient(150deg, #f39a21, #d9720d); }
.fc-4 { background: linear-gradient(150deg, #8a5be6, #6239c2); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.feature .fi { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; }
.feature .fi .ic { width: 24px; height: 24px; }
.feature p { color: var(--text-2); margin: 0; font-size: .92rem; }
.pub-foot { background: var(--navy-950); color: #b4c3e3; padding: 40px 0 28px; font-size: .9rem; }
.pub-foot b { color: #fff; }
.pub-foot a { color: #d4e0fa; }
.pub-foot .wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .foot, .no-print, .btn, .alert { display: none !important; }
  body, .content { background: #fff; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .main { display: block; }
  .print-only { display: block !important; }
  a { color: inherit; }
}
.print-only { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .g-main, .g-side, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .flow, .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(8,22,52,.45); z-index: 35; }
  .only-mobile { display: grid; }
  .top-search { display: none; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 32px; }
  .foot { padding: 12px 16px 20px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 24px; }
  .auth-side h1 { font-size: 1.6rem; }
  .auth-points { display: none; }
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-logo { order: -1; }
  .hero-logo img { width: 180px; }
  .pub-foot .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .kpis, .kpis.k4, .g-2, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .hide-mobile { display: none; }
  .flow, .features, .ipof { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .hero-stats strong { font-size: 1.25rem; }
  .pub-nav .links a:not(.btn) { display: none; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .card { padding: 16px; }
  .notif-menu { width: calc(100vw - 32px); right: -60px; }
  .page-head { align-items: stretch; }
  .filters .input { min-width: 0; flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.review-grid { grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; }
@media (max-width: 760px) { .review-grid { grid-template-columns: minmax(0, 1fr); } }
.ic.big { width: 40px; height: 40px; }

/* ---------- SVG charts ---------- */
.tdt-tip { position: absolute; display: none; pointer-events: none; z-index: 5; background: var(--navy-900); color: #fff; font-size: .8rem; line-height: 1.45; padding: 7px 10px; border-radius: 8px; white-space: nowrap; box-shadow: var(--shadow-lg); }
.tdt-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--text-2); padding: 2px 0 8px; }
.tdt-legend-top-end { justify-content: flex-end; }
.tdt-legend-bottom { justify-content: center; padding: 8px 0 0; }
.tdt-legend-right { flex-direction: column; gap: 6px; padding: 0 0 0 12px; max-width: 46%; }
.tdt-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.tdt-bar, .tdt-seg { transition: opacity .15s; }
.tdt-bar:hover, .tdt-seg:hover { opacity: .78; }
.donut-wrap > .tdt-chart { position: absolute; inset: 0; }
@media (max-width: 680px) { .tdt-legend-right { max-width: none; padding: 8px 0 0; } }
.dl dd { overflow-wrap: anywhere; }
