:root {
  --bg: #F2F6F1; --surface: #ffffff; --ink: #1b2a32; --muted: #56666f; --line: #d8e0e4;
  --accent: #2C731D; --accent-ink: #ffffff; --accent-soft: #e3f1de;
  --done: #1a7544; --done-bg: #e3f4ea; --prog: #96570a; --prog-bg: #fdf0d8;
  --skip: #6a479c; --skip-bg: #eee8f8; --none: #56666f; --none-bg: #edf1f3; --danger: #b42318; --danger-bg: #fdecea;
  --radius: 10px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4rem; font-weight: 650; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .6rem; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid #f5a524; outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .right { text-align: right; }
.sr { position: absolute; left: -9999px; }

/* shell */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 920px; margin: 0 auto; padding: .6rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.brand { font-weight: 700; color: var(--accent); margin-right: auto; text-decoration: none; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { padding: .45rem .75rem; border-radius: 8px; text-decoration: none; color: var(--ink); min-height: 40px; display: inline-flex; align-items: center; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.who { font-size: .875rem; color: var(--muted); }
main { max-width: 920px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.crumb { display: inline-block; margin-bottom: .5rem; font-size: .9rem; }

/* components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.btn { font: inherit; min-height: 44px; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { min-height: 52px; font-size: 1.05rem; width: 100%; }
.btn.small { min-height: 36px; padding: .25rem .7rem; font-size: .875rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link { background: none; border: 0; padding: .25rem 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; min-height: 32px; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; }
label { display: block; font-weight: 600; margin-bottom: .25rem; }
input, select, textarea { font: inherit; width: 100%; min-height: 44px; padding: .5rem .65rem; border: 1px solid #b9c5cb; border-radius: 8px; background: #fff; color: var(--ink); }
textarea { min-height: 76px; resize: vertical; }
.field { margin-bottom: .9rem; }
.hint { font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.bar { height: 10px; background: var(--none-bg); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; background: var(--accent); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pill.s-done { background: var(--done-bg); color: var(--done); } .pill.s-prog { background: var(--prog-bg); color: var(--prog); }
.pill.s-skip { background: var(--skip-bg); color: var(--skip); } .pill.s-none { background: var(--none-bg); color: var(--none); }
.pill.next { background: var(--accent); color: #fff; }
.banner { background: var(--accent-soft); border: 1px solid #b5dbe0; border-radius: 8px; padding: .6rem .8rem; margin-bottom: .8rem; }
.alert { background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c1bb; border-radius: 8px; padding: .7rem .9rem; margin-bottom: 1rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.skeleton { height: 90px; border-radius: var(--radius); background: linear-gradient(90deg, #e6ecef 25%, #f1f5f6 50%, #e6ecef 75%); background-size: 200% 100%; animation: sh 1.2s infinite linear; margin-bottom: 1rem; }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-size: .9rem; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll { overflow: auto; max-height: 340px; border: 1px solid var(--line); border-radius: 8px; }

/* class cards */
.class-card.cover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.next-box { background: var(--accent-soft); border-radius: 8px; padding: .6rem .8rem; margin: .7rem 0; }

/* handoff */
.start { border: 2px solid var(--accent); background: var(--surface); }
.start h2 { font-size: 1.35rem; }
.note { border-left: 3px solid var(--line); padding: .1rem 0 .1rem .7rem; margin-bottom: .7rem; }

/* timeline */
details.mod { margin-bottom: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.mod > summary { cursor: pointer; padding: .8rem 1rem; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: .5rem; min-height: 48px; align-items: center; }
details.mod > summary::-webkit-details-marker { display: none; }
ol.timeline { list-style: none; margin: 0; padding: 0 1rem 1rem 1rem; position: relative; }
.node { position: relative; display: flex; gap: .8rem; padding-bottom: 1rem; }
.node::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.node:last-child::before { display: none; }
.dot { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9rem; border: 2px solid; background: #fff; z-index: 1; }
.s-done .dot { color: var(--done); border-color: var(--done); background: var(--done-bg); }
.s-prog .dot { color: var(--prog); border-color: var(--prog); background: var(--prog-bg); }
.s-skip .dot { color: var(--skip); border-color: var(--skip); background: var(--skip-bg); }
.s-none .dot { color: var(--none); border-color: #aab7be; }
.node.next .body { background: var(--accent-soft); border-radius: 8px; padding: .5rem .6rem; margin: -.5rem 0 0; }
.body { flex: 1; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; gap: .1rem .8rem; font-size: .85rem; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem; margin: .5rem 0; }
@media (min-width: 640px) { .seg { grid-template-columns: repeat(4, 1fr); } }
.seg button { min-height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font: inherit; cursor: pointer; }
.seg button[aria-pressed="true"] { border-width: 2px; font-weight: 700; }
.seg .s-done[aria-pressed="true"] { border-color: var(--done); background: var(--done-bg); color: var(--done); }
.seg .s-prog[aria-pressed="true"] { border-color: var(--prog); background: var(--prog-bg); color: var(--prog); }
.seg .s-skip[aria-pressed="true"] { border-color: var(--skip); background: var(--skip-bg); color: var(--skip); }
.seg .s-none[aria-pressed="true"] { border-color: var(--none); background: var(--none-bg); }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: .6rem 1rem; z-index: 30; }
.savebar > div { max-width: 920px; margin: 0 auto; display: flex; gap: .5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* planner */
.tbar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--none-bg); }
.tbar span { display: block; height: 100%; }
.tbar .setup { background: #9db0b8; } .tbar .less { background: var(--accent); border-right: 1px solid #fff; } .tbar .tidy { background: #9db0b8; }
.tbar.over { border-color: var(--danger); }
.check { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem 0; border-bottom: 1px solid var(--line); min-height: 44px; }
.check input { width: 22px; min-height: 22px; height: 22px; flex: none; margin-top: .15rem; }
.check .qty { margin-left: auto; font-weight: 650; white-space: nowrap; }
.check .src { display: block; font-size: .8rem; color: var(--muted); }
.check.done span.txt { text-decoration: line-through; color: var(--muted); }
.lesson { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.lesson input[type=number] { width: 84px; }

/* drawer + modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(15, 30, 38, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 85vh; overflow: auto; border-radius: 14px 14px 0 0; padding: 1rem; }
@media (min-width: 720px) { .overlay { align-items: stretch; justify-content: flex-end; } .sheet { max-height: none; border-radius: 0; height: 100%; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 5rem; background: #17252c; color: #fff; padding: .65rem 1rem; border-radius: 8px; z-index: 60; max-width: 92vw; }
.toast.err { background: var(--danger); }
.login { max-width: 400px; margin: 8vh auto 0; }

@media print {
  .top, .savebar, .btn, .noprint, .overlay, .toast { display: none !important; }
  body { background: #fff; font-size: 11pt; } main { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; break-inside: avoid-page; }
  .check { break-inside: avoid; }
  .check input { appearance: auto; }
}

.brand{display:inline-flex;align-items:center;gap:.5rem}.top{border-top:4px solid #2C731D}

/* dates, roadmap, overview */
.dayh{margin:1rem 0 .4rem;font-size:1rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;font-size:.8rem}
.dayh.today{color:var(--accent)}
ul.tight{margin:.2rem 0 .5rem;padding-left:1.2rem}ul.tight li{margin:.1rem 0}
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:.6rem;margin-bottom:1rem}
.tile{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:.7rem .9rem;display:flex;flex-direction:column}
.tile b{font-size:1.7rem;line-height:1.1}.tile span{color:var(--muted);font-size:.85rem}
.tile.ok b{color:var(--done)}.tile.warn{background:var(--prog-bg)}.tile.warn b{color:var(--prog)}.tile.bad{background:var(--danger-bg)}.tile.bad b{color:var(--danger)}
.filters{display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:.8rem}.filters input{flex:1 1 220px}.filters select{flex:0 1 200px}
.tbl{width:100%;border-collapse:collapse;min-width:900px}.tbl th{text-align:left;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);padding:.4rem .5rem;border-bottom:2px solid var(--line)}
.tbl td{padding:.55rem .5rem;border-bottom:1px solid var(--line);vertical-align:top}.tbl tr:hover td{background:#f7faf6}
.tbl select.rowcur{max-width:190px;width:100%}.tbl .acts{white-space:nowrap}.tbl .acts .btn{margin-right:.25rem}
.bar.mini{height:8px;margin:.1rem 0 .25rem;min-width:110px}
@media (max-width:700px){
  .tbl{min-width:0}.tbl thead{display:none}.tbl tr{display:block;border:1px solid var(--line);border-radius:var(--radius);margin:.6rem 0;padding:.4rem .6rem;background:var(--surface)}
  .tbl td{display:flex;justify-content:space-between;gap:.8rem;border:0;padding:.3rem 0}.tbl td[data-l]::before{content:attr(data-l);color:var(--muted);font-size:.8rem;flex:none}
  .tbl td:not([data-l]){display:block}.tbl td>div,.tbl td>select{text-align:right}
}
.scroll:has(.tbl){max-height:none;overflow-x:auto;overflow-y:visible}
main:has(.tbl){max-width:1240px}.top-in{max-width:1240px}
.tbl select.rowcur{min-width:170px}.tbl td:first-child{min-width:150px}.tbl td:nth-child(5){min-width:170px}
