/* ============================================================
   HKSSDC — app surfaces (auth, dashboards)
   Builds on styles.css tokens (forest green / teal / parchment)
   ============================================================ */

:root {
  --sidebar-w: 256px;
  --topbar-h: 68px;
  --ok:    oklch(0.62 0.11 168);
  --warn:  oklch(0.72 0.11 78);
  --bad:   oklch(0.58 0.16 25);
  --info:  oklch(0.60 0.10 230);
}

/* ============================================================
   AUTH (login)
   ============================================================ */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-brandside { position: relative; overflow: hidden; background: var(--navy-deep); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brandside .auth-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; display: block; }
.auth-brandside::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(160deg, oklch(0.20 0.05 142 / 0.68), oklch(0.13 0.05 142 / 0.90)); }
.theme-admin .auth-brandside { background: oklch(0.11 0.014 248); }
.theme-admin .auth-brandside::after { background: linear-gradient(160deg, oklch(0.16 0.02 250 / 0.55), oklch(0.09 0.015 250 / 0.86)); }
.auth-brandside > * { position: relative; z-index: 2; }
.auth-brandside .brand { gap: 13px; }
.auth-brandside .brand-mark { border-color: oklch(0.86 0.02 140); color: oklch(0.97 0.01 140); }
.auth-brandside .brand-name { color: oklch(0.97 0.01 140); }
.auth-brandside .brand-sub { color: var(--accent); }
.auth-pitch h2 { color: oklch(0.98 0.01 140); font-size: clamp(28px, 3.2vw, 42px); max-width: 16ch; }
.auth-pitch p { color: oklch(0.84 0.012 140); margin-top: 18px; max-width: 42ch; font-size: 16px; }
.auth-quote { font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em; color: oklch(0.74 0.012 140); }
.auth-formside { display: grid; place-items: center; padding: 48px var(--gutter); background: var(--paper); }
.auth-card { width: 100%; max-width: 400px; }
.auth-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-ink); }
.auth-card h1 { font-size: clamp(28px, 3.4vw, 38px); margin: 12px 0 8px; }
.auth-card .auth-sub { color: var(--ink-soft); font-size: 15px; margin-bottom: 30px; }
.auth-card form .field:last-of-type { margin-bottom: 10px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 22px; }
.auth-row label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.auth-row a { font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.auth-row a:hover { text-decoration: underline; }
.auth-card .btn-gold { width: 100%; justify-content: center; }
.auth-demo { margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); font-family: var(--mono); font-size: 12px; color: var(--ink-faint); text-align: center; }
.auth-alt { margin-top: 26px; text-align: center; font-size: 14px; color: var(--ink-soft); }
.auth-alt a { color: var(--accent-ink); font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; }
.auth-back { position: absolute; top: 24px; left: 24px; z-index: 3; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: oklch(0.88 0.012 140); display: inline-flex; align-items: center; gap: 7px; }
.auth-back svg { width: 14px; height: 14px; }
.auth-back:hover { color: #fff; }

/* ============================================================
   DASHBOARD SHELL
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; min-height: 100dvh; }
.sidebar-scrim { display: none; position: fixed; inset: 0; z-index: 55; background: oklch(0.15 0.04 142 / 0.5); }

.sidebar { background: var(--navy-deep); color: oklch(0.86 0.012 140); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.sidebar-head { padding: 20px 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--navy-line); }
.sidebar-head .brand-mark { border-color: oklch(0.86 0.02 140); color: oklch(0.97 0.01 140); width: 38px; height: 38px; font-size: 18px; }
.sidebar-head .brand-name { font-family: var(--serif); font-weight: 700; font-size: 17px; color: oklch(0.97 0.01 140); line-height: 1.05; }
.sidebar-head .role-tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-top: 3px; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.sidebar-sec { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: oklch(0.6 0.02 140); padding: 16px 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 7px; cursor: pointer;
  color: oklch(0.82 0.012 140); font-size: 14.5px; font-weight: 500; border: none; background: none; width: 100%; text-align: left;
  position: relative; transition: background .16s ease, color .16s ease;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: oklch(0.40 0.06 140 / 0.4); color: oklch(0.96 0.01 140); }
.nav-item.active { background: oklch(0.715 0.105 168 / 0.16); color: oklch(0.97 0.01 140); }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-badge { margin-left: auto; background: var(--accent); color: var(--navy-deep); font-family: var(--mono); font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 20px; }
.sidebar-foot { padding: 14px 14px 18px; border-top: 1px solid var(--navy-line); display: flex; align-items: center; gap: 11px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--navy-deep); display: grid; place-items: center; font-weight: 700; font-family: var(--serif); flex-shrink: 0; }
.sidebar-foot .who { line-height: 1.2; min-width: 0; }
.sidebar-foot .who b { display: block; color: oklch(0.95 0.01 140); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 12px; color: oklch(0.66 0.012 140); }
.logout { margin-left: auto; color: oklch(0.7 0.012 140); width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; transition: .16s; }
.logout:hover { background: oklch(0.40 0.06 140 / 0.5); color: #fff; }
.logout svg { width: 17px; height: 17px; }

/* main column */
.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 20;
  background: oklch(0.986 0.006 85 / 0.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 0 clamp(20px, 3vw, 38px);
}
.topbar h1 { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.topbar .crumb { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.topbar-spacer { flex: 1; }
.season-pill { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--ink-soft); border: 1px solid var(--line-strong); padding: 8px 14px; border-radius: 20px; background: var(--card); }
.icon-btn { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); display: grid; place-items: center; cursor: pointer; position: relative; transition: .16s; }
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); border: 1.5px solid var(--card); }

.content { padding: clamp(22px, 3vw, 38px); max-width: 1280px; width: 100%; }
.panel { display: none; }
.panel.active { display: block; }
.panel-intro { margin-bottom: 26px; }
.panel-intro h2 { font-family: var(--serif); font-size: clamp(26px, 3vw, 34px); }
.panel-intro p { color: var(--ink-soft); margin-top: 8px; max-width: 64ch; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; }
.tile .t-top { display: flex; align-items: center; justify-content: space-between; }
.tile .t-ico { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: oklch(0.715 0.105 168 / 0.14); color: var(--accent-deep); }
.tile .t-ico svg { width: 17px; height: 17px; }
.tile .t-num { font-family: var(--serif); font-size: 38px; font-weight: 600; line-height: 1; margin-top: 16px; letter-spacing: -0.02em; }
.tile .t-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); margin-top: 8px; }
.tile .t-delta { font-size: 12.5px; margin-top: 6px; color: var(--ink-faint); }
.tile .t-delta.up { color: var(--ok); }

/* cards & grid */
.cards-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-head h3 { font-family: var(--serif); font-size: 20px; }
.card-head a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); }
.card-head a:hover { text-decoration: underline; }

/* next fixture / feature row */
.feature-fixture { display: flex; align-items: center; gap: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); margin-bottom: 14px; }
.ff-date { text-align: center; flex-shrink: 0; width: 58px; }
.ff-date .d { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1; }
.ff-date .m { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-ink); }
.ff-body { flex: 1; min-width: 0; }
.ff-body .vs { font-weight: 600; font-size: 16px; }
.ff-body .meta { font-size: 13px; color: var(--ink-faint); margin-top: 3px; }

/* lists */
.tlist { list-style: none; margin: 0; padding: 0; }
.tlist li { display: flex; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.tlist li:last-child { border-bottom: none; }
.tlist .li-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.tlist .li-body b { font-size: 14.5px; }
.tlist .li-body p { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.tlist .li-time { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); white-space: nowrap; }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-strong); font-weight: 500; white-space: nowrap; }
table.data td { padding: 14px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .14s ease; }
table.data tbody tr:hover { background: var(--paper-2); }
table.data .strong { font-weight: 600; }
table.data .muted { color: var(--ink-faint); }
.row-rank { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--accent-ink); width: 40px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; padding: 4px 10px; border-radius: 20px; font-weight: 500; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: oklch(0.62 0.11 168 / 0.13); }
.badge.warn { color: var(--accent-ink); background: oklch(0.72 0.11 78 / 0.16); }
.badge.bad { color: var(--bad); background: oklch(0.58 0.16 25 / 0.12); }
.badge.info { color: var(--info); background: oklch(0.60 0.10 230 / 0.13); }
.badge.flat { color: var(--ink-soft); background: var(--paper-3); }
.badge.flat::before { display: none; }
.fmt-tag { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); border: 1px solid var(--line-strong); padding: 3px 8px; border-radius: 4px; }

/* small action buttons in tables */
.btn-sm { font-family: var(--sans); font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 6px; border: 1.5px solid transparent; cursor: pointer; transition: .16s; }
.btn-approve { background: var(--accent); color: var(--navy-deep); border-color: var(--accent); }
.btn-approve:hover { background: var(--accent-deep); }
.btn-reject { background: transparent; color: var(--bad); border-color: oklch(0.58 0.16 25 / 0.4); }
.btn-reject:hover { background: oklch(0.58 0.16 25 / 0.1); border-color: var(--bad); }
.btn-row { display: flex; gap: 8px; }

/* team / roster cards */
.team-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.team-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
.team-card .tc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.team-card h3 { font-family: var(--serif); font-size: 19px; }
.roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.roster li { display: flex; align-items: center; gap: 11px; font-size: 14.5px; }
.roster .pos { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); margin-left: auto; }
.dot-av { width: 30px; height: 30px; border-radius: 50%; background: var(--paper-3); color: var(--ink-soft); display: grid; place-items: center; font-size: 12px; font-weight: 600; }

/* profile / forms in app */
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 28px; max-width: 620px; }
.composer textarea { width: 100%; min-height: 120px; font-family: var(--sans); font-size: 15px; color: var(--ink); padding: 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); resize: vertical; }
.composer textarea:focus { outline: none; border-color: var(--accent-deep); }

/* progress bar (judges ranking / win rate) */
.bar { height: 8px; border-radius: 5px; background: var(--paper-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }

.mobile-only { display: none; }

/* ============================================================
   ROLE THEMES — teacher (light / warm / editorial)
                  vs admin (dark operations console)
   ============================================================ */

/* --- Teacher: softer, friendlier, rounded --- */
.theme-teacher .card,
.theme-teacher .tile,
.theme-teacher .team-card,
.theme-teacher .form-card,
.theme-teacher .feature-fixture { border-radius: 14px; }
.theme-teacher .content { --tile-shadow: 0 2px 20px -14px oklch(0.33 0.09 137 / 0.5); }
.theme-teacher .tile { box-shadow: var(--tile-shadow); }

/* --- Admin: dark console. Redefine tokens so surfaces auto-flip --- */
body.theme-admin {
  --paper:       oklch(0.205 0.014 248);
  --paper-2:     oklch(0.246 0.016 248);
  --paper-3:     oklch(0.292 0.018 248);
  --card:        oklch(0.238 0.015 248);
  --ink:         oklch(0.955 0.006 248);
  --ink-soft:    oklch(0.780 0.010 248);
  --ink-faint:   oklch(0.615 0.012 248);
  --line:        oklch(0.322 0.016 248);
  --line-strong: oklch(0.410 0.020 248);
  --navy:        oklch(0.170 0.014 248);
  --navy-deep:   oklch(0.128 0.014 248);
  --navy-line:   oklch(0.300 0.016 248);
  --accent:      oklch(0.815 0.125 80);
  --accent-deep: oklch(0.740 0.128 74);
  --accent-ink:  oklch(0.845 0.110 82);
  --ok:   oklch(0.80 0.12 168);
  --warn: oklch(0.83 0.12 82);
  --bad:  oklch(0.72 0.16 25);
  --info: oklch(0.75 0.11 232);
  background: var(--paper);
}
.theme-admin .topbar { background: oklch(0.205 0.014 248 / 0.82); }
/* sharper, denser console surfaces */
.theme-admin .card,
.theme-admin .tile,
.theme-admin .form-card { border-radius: 6px; }
.theme-admin table.data td { padding: 12px 14px; }
/* console typography: mono uppercase page title, tabular tile numbers */
.theme-admin .topbar h1 {
  font-family: var(--mono); font-size: 14px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft);
}
.theme-admin .tile .t-num { font-family: var(--sans); font-weight: 700; letter-spacing: -0.01em; }
/* gold-tinted accents in place of the teal ones */
.theme-admin .tile .t-ico { background: oklch(0.815 0.125 80 / 0.16); color: var(--accent); }
.theme-admin .nav-item.active { background: oklch(0.815 0.125 80 / 0.15); }
.theme-admin .nav-item:hover { background: oklch(1 0 0 / 0.06); }
.theme-admin .logout:hover { background: oklch(1 0 0 / 0.08); }
.theme-admin .sidebar-head .brand-mark { border-color: var(--accent); color: var(--accent); }
.theme-admin .sidebar-head .brand-mark::after { border-color: var(--accent); }
/* stronger badge tints so they read on the dark surface */
.theme-admin .badge.ok   { background: oklch(0.62 0.11 168 / 0.20); }
.theme-admin .badge.warn { background: oklch(0.72 0.11 78 / 0.22); }
.theme-admin .badge.bad  { background: oklch(0.58 0.16 25 / 0.22); }
.theme-admin .badge.info { background: oklch(0.60 0.10 230 / 0.22); }
.theme-admin .row-me { background: oklch(0.815 0.125 80 / 0.10); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .cards-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brandside { display: none; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; width: 280px; transform: translateX(-100%);
    transition: transform .3s ease; box-shadow: 0 0 60px oklch(0.12 0.04 142 / 0.5);
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim { display: none; position: fixed; inset: 0; z-index: 55; background: oklch(0.15 0.04 142 / 0.5); }
  .sidebar-scrim.show { display: block; }
  .mobile-only { display: grid; }
  .team-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr; }
}
