:root {
  --ground: #F4F2EC;
  --card: #FFFFFF;
  --ink: #1D1C1A;
  --ink-2: #4A4843;
  --ink-3: #5E5B54;
  --rule: #E2DED3;
  --rule-2: #EFECE4;
  --field: #CFCBBF;
  --accent: #0E5A55;
  --accent-ink: #FFFFFF;
  --accent-hover: #08403C;
  --dot: #1F7A5C;
  --soft: #EFF7F3;
  --soft-line: #C5E0D4;
  --soft-ink: #175C45;
  --warn-bg: #FBF4E6;
  --warn-line: #EBCF9B;
  --warn-ink: #7A4B00;
  --info-bg: #E4EAF6;
  --info-ink: #2F4A7A;
  --purple-bg: #E6E1F4;
  --purple-ink: #4B3A86;
  --danger: #9E2A1F;
  --danger-hover: #7E1F16;
  --danger-bg: #FBEDEA;
  --danger-line: #E8BDB5;
  --danger-ink: #6E1D15;
  --side: #1C2B2A;
  --side-ink: #C9D6D2;
  --side-muted: #9FB3AE;
  --side-hover: #27403D;
  --side-on: #2F4D49;
  --off: #B9B5AA;
  --shadow: 0 10px 30px rgba(20, 24, 23, 0.18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #141B1A; --card: #1C2524; --ink: #EDEBE4; --ink-2: #C9C5BB; --ink-3: #A9A59B;
    --rule: #2F3A38; --rule-2: #273130; --field: #3C4846; --accent: #7FC8B8; --accent-ink: #0D1716;
    --accent-hover: #9ED8CB; --dot: #7FC8B8; --soft: #1D2F2B; --soft-line: #2F5249; --soft-ink: #9ED8CB;
    --warn-bg: #2E2616; --warn-line: #5C4A22; --warn-ink: #F0CF8E; --info-bg: #1E2638; --info-ink: #A9BCE6;
    --purple-bg: #28223A; --purple-ink: #C3B5F0; --danger: #E08A7E; --danger-hover: #EBA69C; --danger-bg: #331E1B;
    --danger-line: #5E332D; --danger-ink: #F2B8AE; --side: #0E1413; --side-ink: #C9D6D2; --side-muted: #8FA39E;
    --side-hover: #1B2826; --side-on: #243836; --off: #4E5956; --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #141B1A; --card: #1C2524; --ink: #EDEBE4; --ink-2: #C9C5BB; --ink-3: #A9A59B;
  --rule: #2F3A38; --rule-2: #273130; --field: #3C4846; --accent: #7FC8B8; --accent-ink: #0D1716;
  --accent-hover: #9ED8CB; --dot: #7FC8B8; --soft: #1D2F2B; --soft-line: #2F5249; --soft-ink: #9ED8CB;
  --warn-bg: #2E2616; --warn-line: #5C4A22; --warn-ink: #F0CF8E; --info-bg: #1E2638; --info-ink: #A9BCE6;
  --purple-bg: #28223A; --purple-ink: #C3B5F0; --danger: #E08A7E; --danger-hover: #EBA69C; --danger-bg: #331E1B;
  --danger-line: #5E332D; --danger-ink: #F2B8AE; --side: #0E1413; --side-ink: #C9D6D2; --side-muted: #8FA39E;
  --side-hover: #1B2826; --side-on: #243836; --off: #4E5956; --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 16px; line-height: 1.5; min-height: 100vh; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1, .serif { font-family: 'Fraunces', Georgia, serif; font-weight: 600; }
h1 { font-size: clamp(28px, 5vw, 34px); }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.grow { flex-grow: 1; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.lg { gap: 16px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* --------------------------------------------------------------- controls */
.btn { font: inherit; font-size: 14px; font-weight: 600; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--field); background: var(--card); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--rule-2); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--accent-ink); }
.btn.danger:hover { background: var(--danger-hover); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--accent); }
.btn.quiet:hover { background: var(--rule-2); }
.btn.red { color: var(--danger); }
/* Something waiting on the lecturer (a missing due date, markers not placed): warning colours,
   which have their own dark-mode values. */
.btn.amber { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.btn.sm { min-height: 36px; font-size: 13px; padding: 0 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.link { font: inherit; font-size: 13px; font-weight: 600; background: none; border: none; color: var(--accent); cursor: pointer; min-height: 36px; padding: 0 8px; border-radius: 6px; text-decoration: none; display: inline-flex; align-items: center; }
.link:hover { background: var(--rule-2); }
.link.red { color: var(--danger); }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="number"], input[type="datetime-local"], input[type="date"], input[type="search"], select, textarea {
  font: inherit; font-size: 14px; min-height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: var(--card); color: var(--ink); width: 100%;
}
textarea { padding: 10px 12px; line-height: 1.5; resize: vertical; }
input[readonly] { background: var(--rule-2); color: var(--ink-2); }
input[type="file"] { font: inherit; font-size: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; accent-color: var(--accent); }

.switch { font: inherit; background: none; border: none; cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 10px; padding: 0 2px; color: var(--ink); font-size: 14px; font-weight: 600; }
.switch .track { width: 44px; height: 26px; border-radius: 13px; padding: 3px; display: flex; background: var(--off); transition: background 0.15s; flex-shrink: 0; }
.switch .knob { width: 20px; height: 20px; border-radius: 10px; background: #FFFFFF; transition: transform 0.15s; }
.switch[aria-pressed="true"] .track { background: var(--dot); }
.switch[aria-pressed="true"] .knob { transform: translateX(18px); }
.switch[disabled] { opacity: 0.5; cursor: not-allowed; }

.seg { display: inline-flex; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; min-height: 36px; padding: 0 12px; cursor: pointer; border: 1px solid var(--field); background: var(--card); color: var(--ink); margin-left: -1px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button[aria-pressed="true"] { background: var(--side); border-color: var(--side); color: #FFFFFF; position: relative; }
.seg.status button[data-v="hadir"][aria-pressed="true"] { background: #1F7A5C; border-color: #1F7A5C; }
.seg.status button[data-v="terlambat"][aria-pressed="true"] { background: #9A6400; border-color: #9A6400; }
.seg.status button[data-v="izin"][aria-pressed="true"] { background: #3F4E86; border-color: #3F4E86; }
.seg.status button[data-v="absen"][aria-pressed="true"] { background: #9E2A1F; border-color: #9E2A1F; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font: inherit; font-size: 13px; font-weight: 600; min-height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer; border: 1px solid var(--field); background: var(--card); color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--side); border-color: var(--side); color: #FFFFFF; }
.pill .n { font-weight: 400; margin-left: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.tabs button { font: inherit; font-size: 14px; font-weight: 600; min-height: 44px; padding: 0 14px; border: none; background: none; color: var(--ink-3); border-bottom: 3px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.chip { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--rule-2); color: var(--ink-2); white-space: nowrap; display: inline-block; }
.chip.green { background: var(--soft); color: var(--soft-ink); }
.chip.amber { background: var(--warn-bg); color: var(--warn-ink); }
.chip.blue { background: var(--info-bg); color: var(--info-ink); }
.chip.purple { background: var(--purple-bg); color: var(--purple-ink); }
.chip.red { background: var(--danger-bg); color: var(--danger-ink); }
.badge { display: inline-flex; min-width: 22px; height: 22px; padding: 0 6px; margin-left: 4px; border-radius: 11px; align-items: center; justify-content: center; font-size: 12px; background: var(--danger); color: var(--accent-ink); }

.card { background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.card.flat { padding: 0; overflow: hidden; gap: 0; }
.card.tight { padding: 12px 14px; border-radius: 12px; gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 18px; }
.stat .v { font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 600; line-height: 1.2; }
.stat .v small { font-family: 'IBM Plex Sans', sans-serif; font-size: 15px; font-weight: 400; color: var(--ink-3); }
.note { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--ink-2); }
.ok { background: var(--soft); border: 1px solid var(--soft-line); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--ink); }
.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--ink); }
.alert { background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger-ink); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.error { color: var(--danger); font-size: 14px; font-weight: 600; }
.drop { border: 2px dashed var(--soft-line); background: var(--soft); border-radius: 12px; padding: 18px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dashed { border: 1px dashed var(--field); border-radius: 10px; padding: 10px 14px; }
.empty { padding: 28px; text-align: center; color: var(--ink-3); font-size: 14px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.sel td { background: var(--soft); }
td.act { text-align: right; white-space: nowrap; }
.bar { width: 90px; height: 8px; border-radius: 4px; background: var(--rule-2); display: inline-block; vertical-align: middle; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--dot); }
.bar.wide { width: 200px; height: 10px; }

.pick { font: inherit; text-align: left; width: 100%; border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--rule); background: transparent; color: var(--ink); }
.pick:hover { background: var(--card); }
.pick[aria-pressed="true"] { background: var(--card); border-color: var(--accent); }

.dialog { border: none; border-radius: 16px; padding: 26px; width: min(560px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.dialog.wide { width: min(720px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(10, 14, 13, 0.5); }
.dialog form { display: flex; flex-direction: column; gap: 14px; }
.dialog h2 { font-family: 'Fraunces', Georgia, serif; font-size: 24px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--side); color: #FFFFFF; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); z-index: 50; max-width: calc(100vw - 32px); }

/* ------------------------------------------------------------ admin shell */
.admin { display: flex; min-height: 100vh; }
.side { width: 232px; flex-shrink: 0; background: var(--side); display: flex; flex-direction: column; gap: 4px; padding: 26px 14px; position: sticky; top: 0; height: 100vh; }
.side .brand { font-family: 'Fraunces', Georgia, serif; font-size: 24px; font-weight: 600; color: #FFFFFF; padding: 0 12px; text-decoration: none; }
.side .brand span { color: #7FC8B8; }
.side .domain { font-size: 12px; color: var(--side-muted); padding: 0 12px 16px; }
.side a.nav { display: flex; align-items: center; min-height: 42px; padding: 0 12px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-size: 14px; }
.side a.nav:hover { background: var(--side-hover); color: #FFFFFF; }
.side a.nav[aria-current="page"] { background: var(--side-on); color: #FFFFFF; font-weight: 600; }
.side .me { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.1); color: var(--side-ink); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.side .me button, .side .me a { font: inherit; font-size: 13px; background: none; border: none; color: #7FC8B8; cursor: pointer; padding: 0; text-align: left; text-decoration: none; }
.page { flex-grow: 1; min-width: 0; padding: 30px 40px 60px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head .t { flex-grow: 1; display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.crumb { font-size: 13px; text-decoration: none; }
.split { display: flex; gap: 18px; align-items: flex-start; }
.split > aside { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.split > section { flex-grow: 1; min-width: 0; }
.menu-btn { display: none; }

@media (max-width: 900px) {
  .admin { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 2px; }
  .side .domain { display: none; }
  .side a.nav { min-height: 36px; font-size: 13px; padding: 0 10px; }
  .side .me { margin-top: 0; border-top: none; flex-direction: row; padding: 6px 10px; width: 100%; }
  .page { padding: 20px 16px 48px; }
  .split { flex-direction: column; }
  .split > aside { width: 100%; }
}

/* ---------------------------------------------------------- student shell */
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--rule); min-height: 60px; }
.topbar .brand { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 22px; color: var(--ink); text-decoration: none; }
.topbar .brand span { color: var(--dot); }
.topbar .timer { font-family: 'IBM Plex Mono', monospace; font-size: 14px; padding: 6px 10px; border-radius: 8px; background: var(--side); color: #FFFFFF; }
.topbar .timer.low { background: var(--danger); }
.wrap { max-width: 620px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 16px; }
.class-card { text-decoration: none; color: var(--ink); }
.class-card:hover { border-color: var(--accent); }
.class-card .title { font-family: 'Fraunces', Georgia, serif; font-size: 22px; font-weight: 600; }
.item { font: inherit; text-align: left; width: 100%; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; color: var(--ink); min-height: 56px; text-decoration: none; cursor: pointer; }
a.item:hover, button.item:hover { border-color: var(--accent); }
.item[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.item .body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.opt { font: inherit; text-align: left; width: 100%; border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; align-items: flex-start; gap: 12px; font-size: 15px; line-height: 1.4; min-height: 52px; border: 2px solid var(--rule); background: var(--card); color: var(--ink); }
.opt .mark { flex-shrink: 0; width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--field); margin-top: 1px; }
.opt.multi .mark { border-radius: 6px; }
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--soft); }
.opt[aria-pressed="true"] .mark { background: var(--accent); border-color: var(--accent); }
.opt.right { border-color: var(--soft-line); background: var(--soft); }
.opt.wrong { border-color: var(--danger-line); background: var(--danger-bg); }
.dots { display: flex; gap: 4px; }
.dots button { flex-grow: 1; height: 8px; border: none; border-radius: 4px; cursor: pointer; background: var(--rule); padding: 0; }
.dots button.done { background: #8FB8A8; }
.dots button.on { background: var(--accent); }
.q-text { font-size: 18px; line-height: 1.5; font-weight: 500; white-space: pre-wrap; }
.icon-circle { width: 52px; height: 52px; border-radius: 26px; display: flex; align-items: center; justify-content: center; }
.icon-circle.warn { background: var(--warn-bg); color: var(--warn-ink); padding: 0; border: none; }
.icon-circle.ok { background: var(--soft); color: var(--soft-ink); padding: 0; border: none; }
.deck-thumb { aspect-ratio: 16 / 9; background: #F2F3EE; color: #1C222B; display: flex; flex-direction: column; justify-content: center; padding: 18px; gap: 6px; border-radius: 12px 12px 0 0; }
.deck-thumb .kick { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: #4E5764; text-transform: uppercase; }
.deck-thumb .big { font-size: 22px; font-weight: 800; line-height: 1.05; }
.deck-thumb .hl { width: 70px; height: 8px; background: #FFE14D; }

/* Peta digitasi: cukup tinggi untuk menggambar, dan tidak membuat halaman bergeser
   ke samping di ponsel. OpenLayers butuh tinggi yang pasti; tanpa itu petanya 0 px. */
.peta-digitasi {
  width: 100%;
  height: min(70vh, 720px);
  min-height: 360px;
  border: 1px solid var(--line, #ddd);
  border-radius: 8px;
  overflow: hidden;
  background: #111;
}

/* Digitasi satu situs, semua tahun dalam satu peta (seperti WebGIS Sumsel). */
.wrap.lebar { max-width: 1320px; }
.digitasi-situs { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 12px; align-items: start; }
.digitasi-situs .peta-digitasi { height: min(78vh, 820px); }
.panel-digitasi { display: flex; flex-direction: column; gap: 14px; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 12px; }
.panel-digitasi h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 4px; color: var(--ink-2); }
.panel-digitasi p { margin: 0 0 6px; }
.baris-tahun { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: 14px; }
.baris-tahun label { font-weight: 600; min-width: 40px; }
.baris-tahun input[type="range"] { flex: 1; min-width: 60px; }
.baris-tahun .jumlah { margin-left: auto; min-width: 2ch; text-align: right; }
.panel-digitasi .swatch, .peta-banner .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.55); flex: none; }
.panel-digitasi .alat { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.panel-digitasi .alat .btn { justify-content: flex-start; }
.panel-digitasi .pasangan { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.peta-wadah { position: relative; }
.peta-banner { position: absolute; top: 8px; left: 50px; right: 8px; pointer-events: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: fit-content; max-width: calc(100% - 58px); background: rgba(20, 20, 20, 0.78); color: #fff; font-size: 13px; padding: 5px 10px; border-radius: 6px; }
.peta-banner .sep { opacity: 0.6; }
.peta-banner .beda { color: #ffd166; font-weight: 600; }
@media (max-width: 900px) {
  .digitasi-situs { grid-template-columns: 1fr; }
  .digitasi-situs .peta-digitasi { height: 70vh; }
}
