/* Dojo Tracker — JKA red / deep navy / gold, with belt colors doing the talking. */
:root {
  --navy: #1b2a49; --navy-2: #24365e; --red: #c8102e; --red-2: #a60d26; --gold: #f2b134;
  --green: #2e9e4f; --ink: #1f2430; --muted: #6b7280; --line: #e3e6ec; --bg: #f3f5f9; --card: #ffffff;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px -12px rgba(16,24,40,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--navy); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0; letter-spacing: -.005em; }
h3 { margin: 0 0 8px; }
b { font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; } .r { text-align: right; } .fr { float: right; }

/* ---------- top bar */
.topbar { background: linear-gradient(100deg, var(--navy) 0%, var(--navy-2) 55%, #3a2140 100%); color: #fff; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 68px; box-shadow: 0 2px 12px rgba(0,0,0,.25); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; padding: 10px 0; }
.brand:hover { text-decoration: none; }
.mon { width: 36px; height: 36px; border-radius: 50%; background: var(--red); box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 5px var(--red), 0 0 0 2px rgba(255,255,255,.25); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 17px; }
.brand-sub { font-size: 12px; opacity: .75; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: rgba(255,255,255,.85); padding: 8px 14px; border-radius: 999px; font-weight: 500; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; }
.nav a.cta { background: var(--red); color: #fff; } .nav a.cta:hover, .nav a.cta.on { background: var(--red-2); }

/* ---------- layout */
.wrap { max-width: 1240px; margin: 0 auto; padding: 26px 28px 40px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.hero p { margin: 0; }
.hero-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.cols.wide-left { grid-template-columns: 3fr 2fr; }
@media (max-width: 900px) { .cols, .cols.wide-left { grid-template-columns: 1fr; } .wrap { padding: 18px 16px 32px; } .topbar { padding: 0 16px; } }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; border-top: 3px solid transparent; border-image: linear-gradient(90deg, var(--red), var(--gold)) 1; border-image-slice: 1; border-image-width: 3px 0 0 0; }
.card.pad0 { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.card-head.pad { padding: 14px 20px 0; margin-bottom: 8px; }
.card.standing { border-left: 4px solid var(--gold); border-top: 0; border-image: none; background: #fff9e8; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 12px 0 28px; letter-spacing: .02em; }
.empty { color: var(--muted); margin: 6px 0; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: #e7f6ec; color: #1c6b36; border: 1px solid #bfe5cb; }
.flash.err { background: #fdecef; color: #8f1024; border: 1px solid #f5c2ca; }

/* ---------- stat tiles */
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile { border-radius: var(--radius); padding: 16px 18px; color: #fff; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.12); }
.tile-n { font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.tile-l { font-weight: 600; margin-top: 8px; }
.tile-s { font-size: 12px; opacity: .85; margin-top: 2px; }
.t-navy { background: linear-gradient(135deg, #1b2a49, #2f4a80); }
.t-red { background: linear-gradient(135deg, #c8102e, #e8434f); }
.t-gold { background: linear-gradient(135deg, #d9931a, #f2b134); }
.t-green { background: linear-gradient(135deg, #1f7a3c, #3cb862); }
.t-black { background: linear-gradient(135deg, #111, #3a3a3a); }
.t-black::after { background: rgba(200,16,46,.35); }

/* ---------- belts */
.belt { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.belt-bar { width: 34px; height: 12px; border-radius: 3px; background: var(--belt, #b9bec8); box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); position: relative; flex: none; }
.belt-bar::after { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 5px; background: rgba(0,0,0,.22); }
.belt.sm { font-size: 13px; } .belt.sm .belt-bar { width: 28px; height: 10px; }
.belt.none { color: var(--muted); font-weight: 500; }
.belt.none .belt-bar { background: repeating-linear-gradient(45deg, #d9dde5 0 4px, #eef0f4 4px 8px); }

/* ---------- pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.pill.ok { background: #e2f5e8; color: #1c6b36; } .pill.dim { background: #eef0f4; color: var(--muted); }
.pill.cat { background: #e8edf8; color: var(--navy); }
.res-pass { background: #e2f5e8; color: #1c6b36; } .res-fail { background: #fdecef; color: #8f1024; }
.res-absent { background: #eef0f4; color: #4b5563; } .res-pending { background: #fff3d6; color: #8a5a00; }
.st-active { background: #e2f5e8; color: #1c6b36; } .st-inactive { background: #eef0f4; color: #4b5563; } .st-onhold { background: #fff3d6; color: #8a5a00; }
.score { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #eef0f4; color: #374151; margin-right: 4px; }
.sc-excellent { background: #e2f5e8; color: #1c6b36; } .sc-good { background: #e6f0fb; color: #1e4e9c; }
.sc-satisfactory { background: #fff3d6; color: #8a5a00; } .sc-needswork { background: #fdecef; color: #8f1024; }

/* ---------- tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 14px; border-bottom: 2px solid var(--line); background: #fafbfd; }
.tbl th.r { text-align: right; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #f7f9fc; }
.tbl.compact th, .tbl.compact td { padding: 8px 10px; }
.row-eligible td { background: #f0faf3; } .row-eligible:hover td { background: #e6f6ea !important; }
.row-eligible td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.table-scroll { overflow-x: auto; }
.grading td { padding: 8px 10px; } .grading select, .grading input { min-width: 0; } .grading td:nth-child(3) select { min-width: 110px; } .grading td:nth-child(4) select { min-width: 140px; }
.grading .res-sel.set { border-color: var(--navy); background: #eef3ff; font-weight: 600; }
.belts input.w4 { width: 64px; } .belts select { min-width: 74px; } .belts td input[name^=name_] { min-width: 110px; } .belts input[type=color] { width: 44px; height: 32px; padding: 2px; }
.grading-day { margin-bottom: 18px; }

/* ---------- belt distribution */
.dist { display: flex; flex-direction: column; gap: 7px; }
.dist-row { display: grid; grid-template-columns: 130px 1fr 34px; align-items: center; gap: 10px; }
.dist-track { height: 16px; background: #eef0f4; border-radius: 8px; overflow: hidden; }
.dist-bar { height: 100%; border-radius: 8px; min-width: 0; transition: width .4s ease; }
.dist-n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #374151; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd4dd; border-radius: 9px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(200,16,46,.25); border-color: var(--red); }
textarea { resize: vertical; }
.grid-3, .grid-4 { display: grid; gap: 14px; margin-bottom: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
.form h2 { margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--navy); }
.form h2:first-child { margin-top: 0; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; }
.filters input, .filters select { width: auto; } .filters input[type=search] { flex: 1; min-width: 200px; }
.inline-form { background: #f7f9fc; border: 1px dashed #cfd4dd; border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.note-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-bottom: 14px; }
.note-form textarea { grid-column: 1 / -1; }
.note-form select { width: auto; min-width: 150px; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid #cfd4dd; background: #fff; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: #f3f5f9; text-decoration: none; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; } .btn.primary:hover { background: var(--red-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: #8f1024; border-color: #f5c2ca; } .btn.danger:not(.ghost) { background: var(--red); color: #fff; border-color: var(--red); }
.btn.danger.ghost:hover { background: #fdecef; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: #8f1024; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
form { margin: 0; }

/* ---------- student profile */
.profile-head { display: flex; gap: 18px; align-items: flex-start; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; border-left: 8px solid var(--belt); flex-wrap: wrap; }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 22px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.12); flex: none; letter-spacing: .02em; }
.profile-main { flex: 1; min-width: 260px; }
.profile-main h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-belt { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.facts { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: #374151; }
.facts b { color: var(--muted); font-weight: 600; margin-right: 4px; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }

/* ---------- timeline */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line); margin-top: 2px; }
.tl-item.res-pass .tl-dot { box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--green); }
.tl-item.res-fail .tl-dot { box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--red); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-actions { margin-left: auto; font-size: 13px; display: flex; gap: 10px; }
.tl-notes { color: #374151; margin-top: 4px; }
.scores { margin-top: 6px; }

/* ---------- notes */
.notes-list { list-style: none; margin: 0; padding: 0; }
.notes-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.notes-list li:last-child { border-bottom: 0; }
.note-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 3px; }
.note-meta form { margin-left: auto; }
.note-body { white-space: pre-wrap; }

/* ---------- modal */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 14px; padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); border-top: 4px solid var(--red); }
.modal-card p { margin: 0 0 16px; color: #374151; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media print { .topbar, .hero-actions, .filters, .btn, .linkbtn, .foot, .note-form, .inline-form { display: none !important; } body { background: #fff; } .card { box-shadow: none; border: 1px solid #ccc; } }

/* ---------- syllabus */
.syl-index { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px 16px; }
.syl-index a:hover { text-decoration: none; opacity: .8; }
.syl { border-left: 6px solid var(--belt); }
.syl-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .syl-grid { grid-template-columns: 1fr; } }
.syl-grid h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--red); }
.syl-grid pre { margin: 0; white-space: pre-wrap; font: 13px/1.5 ui-monospace, Menlo, monospace; color: #374151; background: #f7f9fc; border-radius: 8px; padding: 10px 12px; }
.syl-notes { font-size: 13px; color: #374151; background: #fff9e8; border-left: 3px solid var(--gold); padding: 6px 10px; border-radius: 6px; margin: 10px 0 0; }
.mono { font-family: ui-monospace, Menlo, monospace; }

/* ---------- roster import */
.raw { white-space: pre-wrap; font: 12px/1.4 ui-monospace, Menlo, monospace; max-height: 320px; overflow: auto; color: #374151; }
.review input { min-width: 120px; } .review select { min-width: 200px; }
.review tr.k-exact td { background: #f4fbf6; } .review tr.k-fuzzy td { background: #fff8e6; }
.missing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; margin-bottom: 12px; }
.chk { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.chk input { width: auto; }

/* ---------- login */
.login-body { background: linear-gradient(135deg, var(--navy), #3a2140); min-height: 100vh; display: grid; place-items: center; margin: 0; font: 15px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.login-card { background: #fff; padding: 28px; border-radius: 16px; width: min(400px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-card .brand { color: var(--navy); } .login-card .brand-sub { color: var(--muted); }
.login-card .mon { box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 5px var(--red); }

/* ---------- attendance */
.date-nav { display: flex; gap: 6px; align-items: center; } .date-nav input { width: auto; }
.att input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--green); cursor: pointer; }
.att tr.is-present td { background: #f0faf3; }
.inline { display: inline; }
.code-chip { font-family: ui-monospace, Menlo, monospace; font-size: 22px; letter-spacing: .2em; background: #eef3ff; color: var(--navy); padding: 4px 12px; border-radius: 8px; font-weight: 700; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 20px; font-size: 14px; }
.contact-grid b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.minor-flag { background: #fff3d6; color: #8a5a00; }
.bilingual .bl { padding: 5px 0; border-bottom: 1px dashed var(--line); } .bilingual .bl:last-child { border-bottom: 0; }
.bilingual .jp { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: #374151; }
.bilingual .en { color: var(--navy); font-size: 13px; }
.cert-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Sep 2026: grading plan, absences, medical, assistant, backups */
.row-invited td { background: #eef3fb; } .row-invited td:first-child { box-shadow: inset 3px 0 0 var(--navy); }
.att tr.is-excused td { background: #fff9e8; }
.att-med { color: #8f1024; font-size: 12px; font-weight: 600; margin-top: 2px; }
.exc-cell { white-space: nowrap; } .exc-cell .chk { display: inline-flex; margin: 0; } .exc-cell input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--gold); }
.exc-reason { width: 120px; padding: 4px 8px; font-size: 12px; margin-left: 6px; }
.card.standing.medical { border-left-color: var(--red); background: #fdecef; }
.nav-note { color: rgba(255,255,255,.7); font-size: 12px; padding: 8px 6px; }
.session-strip { margin: -10px 0 16px; }
a.tile { text-decoration: none; display: block; } a.tile:hover { text-decoration: none; filter: brightness(1.05); }
pre.log { background: #f3f5f9; border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 10px 0 0; font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.brand .logo { width: 44px; height: 44px; flex: none; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.25); background: #fff; }
.login-card .logo { width: 56px; height: 56px; }
.msg-form textarea { margin-bottom: 8px; }
.quick input, .quick select { min-width: 120px; } .quick td { padding: 6px 8px; }

.inline-row { display: flex; gap: 6px; align-items: center; } .inline-row input { width: auto; }

.belts-set select, .belts-set input[type=date] { min-width: 150px; } .belt-sel.changed { border-color: var(--red); background: #fff5f6; font-weight: 600; }
