:root {
  --bg: #f6f7f5; --panel: #fff; --ink: #1c2420; --muted: #5d6963; --line: #dfe4e0;
  --brand: #1f5a44; --brand-ink: #fff; --link: #1a5fa0; --warn: #9a5b00; --chip: #e8efe9;
}
* { box-sizing: border-box; }
html { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; color: var(--ink); background: var(--bg); }
body { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: .2rem 0 .8rem; font-weight: 600; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .5rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1.3rem 0 .4rem; font-weight: 600; }
h1 small, h2 small { font-size: .8em; color: var(--muted); font-weight: 400; margin-left: .5rem; }

.top { display: flex; align-items: center; gap: 1.2rem; padding: .55rem 1.2rem; background: var(--brand); color: var(--brand-ink); flex-wrap: wrap; }
.top a { color: var(--brand-ink); }
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.top nav { display: flex; gap: 1rem; }
.top nav a { opacity: .85; padding: .2rem 0; border-bottom: 2px solid transparent; }
.top nav a.on, .top nav a:hover { opacity: 1; border-bottom-color: var(--brand-ink); text-decoration: none; }
.topsearch { display: flex; gap: .3rem; flex: 1 1 280px; max-width: 520px; margin-left: auto; }
.topsearch input { flex: 1; }
.badge { font-size: .78rem; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; padding: .1rem .6rem; white-space: nowrap; }

main { padding: 1rem 1.2rem 3rem; max-width: 1800px; margin: 0 auto; }
input, select, button { font: inherit; padding: .38rem .55rem; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); }
button, .button { background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand); border-radius: 5px; padding: .38rem .8rem; cursor: pointer; display: inline-block; white-space: nowrap; }
.button:hover { text-decoration: none; filter: brightness(1.1); }
.top button { background: #fff; color: var(--brand); border-color: #fff; }

.hero { text-align: center; padding: 2.2rem 0 1rem; }
.bigsearch { display: flex; gap: .4rem; max-width: 760px; margin: 1rem auto .6rem; }
.bigsearch input { flex: 1; font-size: 1.1rem; padding: .65rem .8rem; }
.bigsearch button { font-size: 1.05rem; padding: .65rem 1.3rem; }
.hint { color: var(--muted); font-size: .92rem; max-width: 760px; margin: .4rem auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; max-width: 900px; margin: 1.6rem auto; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; text-align: center; color: var(--ink); }
.tile b { display: block; font-size: 1.6rem; font-weight: 600; }
.tile span { color: var(--muted); }

.crumbs { color: var(--muted); margin: 0 0 .4rem; }
.headrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .6rem 0; }
.filters input[type=search] { flex: 1 1 260px; max-width: 460px; }
.filters select.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.cats { display: inline-flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: center; flex-basis: 100%; }
.cats .seglabel { margin-right: 0; } label.check { white-space: nowrap; }
.seg { display: inline-flex; align-items: center; margin-left: auto; }
.seglabel { color: var(--muted); margin-right: .5rem; }
.seg a { padding: .32rem .7rem; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.seg a:first-of-type { border-radius: 5px 0 0 5px; } .seg a:last-of-type { border-radius: 0 5px 5px 0; border-left: 0; }
.seg a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.seg a:hover { text-decoration: none; }
.hint.left { margin: .2rem 0 .6rem; max-width: 70rem; }
.est { color: var(--warn); font-size: .85em; white-space: nowrap; }
details.sect { margin: .7rem 0; }
details > summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; padding: .25rem 0; }
details details > summary { font-size: .95rem; font-weight: 500; margin-top: .4rem; }
summary small { font-size: .8em; color: var(--muted); font-weight: 400; margin-left: .4rem; }
.muted { color: var(--muted); font-size: .9em; }
div.pre { white-space: pre-wrap; }
ul.notes { list-style: none; margin: .3rem 0; padding: 0; max-width: 70rem; }
ul.notes li { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .5rem .8rem; margin-bottom: .4rem; }
.s-complete { background: #d9efdf; }
.bar { display: inline-block; width: 90px; height: .55rem; background: #e3e7e4; border-radius: 999px; overflow: hidden; vertical-align: middle; margin: 0 .3rem; }
.bar i { display: block; height: 100%; background: var(--brand); }
table.stages { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; margin: .6rem 0 1rem; }
form.courthouse { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
form.courthouse fieldset { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem .8rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1rem; margin: 0; }
form.courthouse legend { font-weight: 600; padding: 0 .3rem; }
form.courthouse label { display: flex; flex-direction: column; gap: .2rem; color: var(--muted); font-size: .85rem; }
form.courthouse input[type=text], form.courthouse select { width: 100%; box-sizing: border-box; }
form.courthouse .full { grid-column: 1 / -1; }
form.courthouse .actions { grid-column: 1 / -1; text-align: center; margin: 0; }
table.qq { border-collapse: collapse; }
table.qq td { border: 1px solid var(--line); padding: .45rem .6rem; background: #fff; }
table.qq tr:nth-child(2) td { border-bottom: 2px solid var(--ink); } table.qq td:nth-child(2) { border-right: 2px solid var(--ink); }
table.qq label { flex-direction: row; align-items: center; color: var(--ink); white-space: nowrap; }
.button.plain { background: #fff; color: var(--ink); border: 1px solid var(--line); }
p.warn { color: var(--warn); }
@media (max-width: 800px) { form.courthouse { grid-template-columns: 1fr; } }
.pager { display: flex; gap: 1rem; align-items: center; color: var(--muted); margin: .5rem 0; flex-wrap: wrap; }

.scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
table.grid { border-collapse: collapse; width: 100%; }
.grid th, .grid td { padding: .35rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.grid th { background: #eef1ee; font-weight: 600; position: sticky; top: 0; }
.grid tbody tr:hover { background: #f3f7f4; }
.grid td.wrap { white-space: normal; min-width: 14rem; max-width: 30rem; }
.grid td.pre, dd.pre { white-space: pre-wrap; }
.grid .num { text-align: right; }
.grid .empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.grid.small { width: auto; min-width: 60%; }
.grid.small td.wrap { min-width: 10rem; }
.runsheet td { font-size: .93rem; }
a.missing { color: var(--warn); }
.empty { color: var(--muted); }

.status { font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: var(--chip); white-space: nowrap; font-weight: 400; vertical-align: middle; }
.s-complete { background: #d9efdf; } .s-in-progress { background: #fdeccb; } .s-assigned { background: #e3e8f4; }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: .05rem .55rem; margin: 0 .2rem .2rem 0; font-size: .85rem; }

dl.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem 1.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .9rem 1rem; margin: .4rem 0; }
dl.facts.one { grid-template-columns: 1fr; }
dl.facts .wide { grid-column: 1 / -1; }
dl.facts dt { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

.split { display: grid; grid-template-columns: minmax(340px, 5fr) minmax(0, 7fr); gap: 1rem; align-items: start; }
.doc { position: sticky; top: .6rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.doc iframe { width: 100%; height: calc(100vh - 8.5rem); min-height: 480px; border: 0; display: block; }
.viewer { height: calc(100vh - 15.5rem); min-height: 420px; overflow: auto; background: #6b716d; cursor: grab; user-select: none; touch-action: none; }
.viewer.dragging { cursor: grabbing; }
.viewer .pages { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 12px; width: max-content; min-width: 100%; }
.viewer canvas, .viewer img { display: block; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.tools { display: flex; gap: .35rem; align-items: center; padding: .4rem .8rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tools button { background: #fff; color: var(--ink); border-color: var(--line); padding: .25rem .65rem; }
.tools button:hover { background: var(--chip); }
#zoomlabel { min-width: 3.2rem; text-align: center; color: var(--muted); }
.tools .tip { color: var(--muted); font-size: .85rem; margin-left: auto; }
.docbar { display: flex; gap: 1rem; padding: .45rem .8rem; border-bottom: 1px solid var(--line); color: var(--muted); flex-wrap: wrap; }
.nodoc { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
ul.plain { margin: .3rem 0; padding-left: 1.2rem; max-width: 60rem; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } .doc { position: static; } }

/* export panel on the assignment page */
.exports { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 8px 0; }
.exports form { border: 1px solid var(--line, #d8dde3); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.exports h3 { margin: 0; font-size: 1rem; }
.exports p { margin: 0; color: var(--muted, #5b6470); font-size: .9rem; flex: 1; }
.exports label { font-size: .9rem; }
.exports .button { align-self: flex-start; }
.exports .button[disabled] { opacity: .5; cursor: not-allowed; }

/* project page: tabs of assignments */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin: .6rem 0 0; flex-wrap: wrap; }
.tabs a { padding: .45rem .9rem; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--bg); color: var(--ink); }
.tabs a.on { background: var(--panel); font-weight: 600; position: relative; top: 1px; }
.tabs a:hover { text-decoration: none; }
.tabs small { background: var(--chip); border-radius: 999px; padding: 0 .45rem; font-weight: 400; }
.scroll.tall { max-height: 70vh; overflow-y: auto; }
.scroll.tall thead th { position: sticky; top: 0; background: var(--panel); }

/* sign-in */
body.signin { display: grid; place-items: center; min-height: 100vh; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.6rem 1.8rem; width: min(26rem, 92vw); }
.card h1 { margin: 0 0 .8rem; }
.card form { display: flex; flex-direction: column; gap: .5rem; margin: .8rem 0; }
.card .note { color: var(--muted); font-size: .92rem; }
.top .who { display: flex; align-items: center; gap: .5rem; margin-left: auto; font-size: .9rem; }
