/* KLC Students — design v2 (2026-11-06): navy + KLC red, tinted background, Khmer first. */
:root {
  --navy: #13294b;
  --navy2: #1d3b69;
  --blue: #1f4e9c;
  --sky: #e7eef9;
  --red: #c8102e;
  --red-dark: #a10c25;
  --red-soft: #fdecef;
  --bg: #edf1f7;
  --card: #ffffff;
  --ink: #15202e;
  --soft: #5a6678;
  --faint: #8a95a5;
  --line: #dfe5ee;
  --line2: #c6cfdc;
  --head: #f2f5fa;
  --ok: #17734a;      --ok-bg: #e2f4ea;
  --warn: #9a5b00;    --warn-bg: #fff1d6;
  --bad: #b3261e;     --bad-bg: #fde7e5;
  --c-woori: #0a63b8; --c-aba: #0b6f80; --c-acleda: #2b3990; --c-cash: #2e7d32; --c-other: #7a8494;
  --shadow: 0 1px 2px rgba(19, 41, 75, .06), 0 6px 20px rgba(19, 41, 75, .06);
  --font: "IBM Plex Sans", "Noto Sans Khmer", "Malgun Gothic", system-ui, sans-serif;
  --km: "Noto Sans Khmer", "Khmer OS Battambang", "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--ink); font-family: var(--font); font-size: 15px; }
body { background: linear-gradient(180deg, #dfe7f3 0, var(--bg) 260px) no-repeat, var(--bg); min-height: 100vh; }
a { color: var(--blue); }
.km { font-family: var(--km); }
.num, .id { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--soft); }
.small { font-size: 12.5px; }

/* Khmer first, English second */
.L { display: inline; }
.L .lk { font-family: var(--km); }
.L .le { font-size: .8em; color: var(--faint); margin-left: .45em; font-weight: 500; }
.S { display: inline-flex; flex-direction: column; line-height: 1.2; }
.S .lk { font-family: var(--km); }
.S .le { font-size: 11px; color: var(--faint); font-weight: 500; }

h1 { font-size: 24px; margin: 6px 0 16px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
h1 .le { font-size: 15px; }
h2 { font-size: 17px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; font: 600 14px var(--mono); flex: none; }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 10px 22px; background: var(--navy); color: #fff; flex-wrap: wrap; box-shadow: 0 2px 10px rgba(10, 20, 40, .25); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand .plate { background: #fff; border-radius: 9px; padding: 4px 8px; display: flex; }
.brand img { height: 28px; display: block; }
.brand .S .lk { font-weight: 600; font-size: 15px; }
.brand .S .le { color: #a9b8d0; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { text-decoration: none; color: #dfe6f2; padding: 6px 14px; border-radius: 10px; display: flex; flex-direction: column; line-height: 1.15; }
.top nav a .lk { font-family: var(--km); font-size: 15px; font-weight: 600; }
.top nav a .le { font-size: 11px; color: #9fb0ca; }
.top nav a:hover { background: rgba(255, 255, 255, .08); }
.top nav a.on { background: var(--red); color: #fff; }
.top nav a.on .le { color: #ffd6dd; }
.mode { margin-left: auto; background: #ffe7a6; color: #5c3d00; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; }

main { max-width: 1140px; margin: 0 auto; padding: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.accent-blue { border-top: 4px solid var(--blue); }
.card.accent-red { border-top: 4px solid var(--red); }
.card.accent-navy { border-top: 4px solid var(--navy); }
.card.accent-green { border-top: 4px solid var(--ok); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } main { padding: 12px; } }

/* hero (search) */
.hero { background: linear-gradient(120deg, var(--navy) 0%, var(--navy2) 70%, #284f8c 100%); color: #fff; border: none; }
.hero h1 { color: #fff; margin-top: 0; }
.hero h1 .le { color: #a9b8d0; }
.hero .muted { color: #c3cfe2; }

/* forms */
label.f { display: block; font-size: 14px; color: var(--ink); font-weight: 600; }
label.f > input, label.f > select, label.f > textarea { display: block; margin-top: 5px; }
div.f > .choices { margin-top: 6px; }
label.f b.req, b.req { color: var(--red); }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=date], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 10px; background: #fbfcfe; color: var(--ink); font-size: 15px; font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 3px solid #c9d8f2; outline-offset: 0; border-color: var(--blue); background: #fff; }
input.amt { text-align: right; font-family: var(--mono); }
.search { font-size: 19px !important; padding: 14px 16px !important; border: none !important; box-shadow: 0 4px 18px rgba(0, 0, 0, .18); background: #fff !important; }
.choices { display: flex; gap: 6px; flex-wrap: wrap; }
.choices label { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid var(--line2); border-radius: 10px; cursor: pointer; background: #fff; font-size: 14px; font-weight: 500; color: var(--ink); }
.choices input { margin: 0; accent-color: var(--red); }
.choices label:has(input:checked) { border-color: var(--navy); background: var(--navy); color: #fff; }
.choices label:has(input:checked) .le { color: #b9c6dc; }

button, .btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: #fff; color: var(--navy); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; line-height: 1.2; }
button:hover, .btn:hover { background: var(--sky); border-color: #b7c7e3; }
button.primary, .btn.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(200, 16, 46, .25); }
button.primary .le, .btn.primary .le { color: #ffd6dd; }
button.primary:hover, .btn.primary:hover { background: var(--red-dark); }
button.dark, .btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
button.dark .le, .btn.dark .le { color: #b9c6dc; }
button.ghost { border-color: transparent; background: transparent; color: var(--blue); padding: 5px 8px; box-shadow: none; }
button.ghost:hover { background: var(--sky); }
button.danger, button.ghost.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
.big { padding: 12px 22px; font-size: 16px; border-radius: 12px; }

/* tables */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.t th { text-align: left; font-size: 12.5px; color: var(--soft); font-weight: 600; padding: 9px 10px; background: var(--head); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th:first-child { border-top-left-radius: 10px; }
table.t th:last-child { border-top-right-radius: 10px; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tbody tr:nth-child(even) td { background: #fafbfd; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--sky); }
table.t td.r, table.t th.r { text-align: right; }
table.t td.nw, table.t td.id, table.t td.num { white-space: nowrap; }
table.t tr.dim td { color: var(--faint); }
table.t tr.void td { color: var(--faint); text-decoration: line-through; }
table.t tr.void td.keep { text-decoration: none; }

/* badges */
.b { display: inline-flex; gap: 5px; align-items: baseline; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: #eef1f6; color: var(--ink); white-space: nowrap; }
.b .lk { font-family: var(--km); }
.b .le { font-size: 10.5px; opacity: .75; font-weight: 500; }
.b.ok { background: var(--ok-bg); color: var(--ok); }
.b.warn { background: var(--warn-bg); color: var(--warn); }
.b.bad { background: var(--bad-bg); color: var(--bad); }
.b.blue { background: var(--sky); color: var(--blue); }
.b.pk { background: var(--blue); color: #fff; }

/* person / class header */
.who { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.who .left { display: flex; gap: 14px; align-items: center; }
.avatar { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font: 700 19px var(--font); color: #fff; background: linear-gradient(135deg, var(--blue), var(--navy)); flex: none; }
.avatar.cls { background: linear-gradient(135deg, var(--red), #7d0a1d); }
.who .id { font-size: 14px; color: var(--soft); }
.who .name { font-size: 23px; font-weight: 700; }
.who .name .km { font-weight: 500; font-size: 19px; margin-left: 10px; color: var(--navy2); }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line2); }
@media (max-width: 760px) { .kv { grid-template-columns: 1fr 1fr; } }
.kv div { display: flex; flex-direction: column; gap: 2px; }
.kv .k { font-size: 12.5px; color: var(--soft); }
.kv .k .le { font-size: 11px; }
.kv .v { font-weight: 600; }

/* receipt form */
.lines { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: 1.3fr 1.3fr 120px 34px; gap: 8px; align-items: center; }
@media (max-width: 760px) { .line { grid-template-columns: 1fr 100px 34px; } .line .detail { grid-column: 1 / -1; order: 3; } }
.sumbox { display: grid; gap: 9px; background: var(--head); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.sumbox .r { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.sumbox .total { font-family: var(--mono); font-size: 20px; text-align: right; font-weight: 600; color: var(--navy); }
.sumbox .bal { font-family: var(--mono); font-size: 16px; text-align: right; }
.ref { background: #fff8e1; border: 1px dashed #e0bf55; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.ref b { display: block; margin-bottom: 4px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c-other); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.stat .l { font-size: 13px; color: var(--soft); }
.stat .l .le { font-size: 11px; }
.stat .v { font-family: var(--mono); font-size: 21px; font-weight: 600; margin-top: 2px; }
.stat .c { font-size: 12px; color: var(--faint); }
.stat.main { background: linear-gradient(135deg, var(--navy), var(--navy2)); color: #fff; border: none; }
.stat.main .l, .stat.main .c, .stat.main .le { color: #b9c6dc; }
.stat.m-woori { border-left-color: var(--c-woori); }
.stat.m-aba { border-left-color: var(--c-aba); }
.stat.m-acleda { border-left-color: var(--c-acleda); }
.stat.m-cash { border-left-color: var(--c-cash); }

.errors { background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 12px 16px; margin: 10px 0; }
.errors ul { margin: 4px 0 0 18px; padding: 0; }
.done { background: linear-gradient(135deg, #e6f5ec, #f3fbf6); border: 1px solid #b9dfc7; border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); }
.done .big-no { font-family: var(--mono); font-size: 28px; font-weight: 600; color: var(--navy); }
.dupes { background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.soon { color: var(--warn); font-weight: 600; font-size: 12.5px; }

/* EPS exam schedule */
.rounds { display: grid; gap: 10px; }
.round { margin-bottom: 0; padding: 14px 16px; display: grid; gap: 10px; }
.round b { font-size: 15.5px; }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px 14px; }
.rgrid div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rgrid .k { font-size: 12px; color: var(--soft); }
.rgrid .k .le { font-size: 10.5px; }
.rgrid .v { font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.rnote { font-size: 13.5px; white-space: pre-line; background: var(--head); border-radius: 10px; padding: 8px 12px; color: var(--ink); }
.round-note { margin-bottom: 0; padding: 10px 14px; font-size: 14px; background: var(--warn-bg); border-color: #f0d58a; }

dialog { border: none; border-radius: 16px; padding: 0; width: min(480px, 94vw); box-shadow: 0 24px 70px rgba(10, 20, 40, .35); }
dialog::backdrop { background: rgba(13, 25, 45, .5); }
dialog form { padding: 20px 22px; display: grid; gap: 13px; }
dialog h3 { margin: -20px -22px 0; padding: 14px 22px; font-size: 17px; background: var(--navy); color: #fff; }
dialog h3 .le { color: #a9b8d0; }
dialog.wide { width: min(720px, 94vw); }
dialog.wide form { grid-template-columns: 1fr 1fr; column-gap: 16px; }
dialog.wide form > h3, dialog.wide form > p, dialog.wide form > .row, dialog.wide form > label.check { grid-column: 1 / -1; }
@media (max-width: 600px) { dialog.wide form { grid-template-columns: 1fr; } }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; font-weight: 500; background: var(--head); padding: 10px 12px; border-radius: 10px; }
label.check input { margin-top: 3px; accent-color: var(--red); }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: 0 8px 24px rgba(10, 20, 40, .3); }
#toast.show { opacity: 1; }

@media print {
  .top, .noprint, button { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card { border: none; padding: 0; box-shadow: none; }
}
