/* ---------------------------------------------------------------------------------------------
   Dormitory network: white base, deep navy accents (stu-assets-v2 is blue #2563c9, stu-acc-v2 orange,
   stu-ip2 teal). Palette is a proposal, to be checked side by side with stu-assets-v2 (decision 5).
   --------------------------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  --ink: #182030;
  --muted: #5d6778;
  --bg: #ffffff;
  --frame: #e9eef7;           /* the pale navy around the white app */
  --soft: #f5f8fc;            /* rows on hover, table headings */
  --card: #ffffff;
  --line: #dde4ef;
  --line-strong: #c3cfe0;
  --accent: #1e3a6e;            /* buttons, links: white text on it is about 11:1 */
  --accent-dark: #132850;
  --accent-100: #e9eef7;
  --accent-200: #c8d5ea;
  --peach-100: #fdf6d3;
  --mint-100: #e3f5ee;
  --lav-100: #eeeafc;
  --sky-100: #e6f1fb;
  --ok: #23804f;
  --warn: #806600;            /* olive yellow: apart from the navy accent */
  --bad: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 80, .05), 0 10px 28px rgba(20, 40, 80, .07);
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html { background: var(--frame); }
body {
  margin: 0; color: var(--ink); background: var(--frame);
  font: 16px/1.65 system-ui, -apple-system, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
h1 { margin: 0 0 6px; font-size: 1.65rem; line-height: 1.3; font-weight: 700; letter-spacing: .01em; }
h2 { margin: 0 0 10px; font-size: 1.15rem; font-weight: 650; }
h1 small { font-size: .95rem; font-weight: 500; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
small.muted, .muted small { color: var(--muted); }

/* ---- shell: a white, rounded app on a soft blue frame ---- */
.shell {
  display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr);
  max-width: 1760px; min-height: calc(100vh - 32px); margin: 16px auto;
  background: var(--bg); border-radius: 26px; box-shadow: var(--shadow); overflow: clip;
}
.side {
  display: flex; flex-direction: column; gap: 6px; padding: 22px 14px 16px;
  background: linear-gradient(180deg, #fff 0%, var(--soft) 100%); border-right: 1px solid var(--line);
  position: sticky; top: 16px; align-self: start; height: calc(100vh - 32px); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 16px; color: var(--ink); font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.brand:hover { color: var(--ink); }
.brand .mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #fff;
  background: linear-gradient(135deg, #3d5f99 0%, var(--accent) 100%); box-shadow: 0 4px 10px rgba(30, 58, 110, .28);
}
.brand .mark svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav h3 { margin: 16px 12px 4px; font-size: .8rem; font-weight: 600; letter-spacing: .12em; color: var(--muted); }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.nav a svg, .logout svg { flex: none; width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.nav a:hover { background: var(--accent-100); }
.nav a.on { background: var(--accent-100); color: var(--accent-dark); font-weight: 650; }
.nav a.on svg { opacity: 1; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--line); }
.me .avatar { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-200); color: var(--accent-dark); font-weight: 700; }
.me .who { min-width: 0; line-height: 1.3; }
.me .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.me .who span { color: var(--muted); font-size: .82rem; }
.me form { margin: 0 0 0 auto; }
.me button.logout { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; color: var(--muted); cursor: pointer; box-shadow: none; }
.me button.logout:hover { color: var(--accent-dark); border-color: var(--accent-200); background: var(--accent-100); }
.sidebar-toggle { display: none; }

main { min-width: 0; padding: 30px 38px 40px; }
.guest { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(60% 50% at 80% 10%, #f5f8fd, transparent 60%), linear-gradient(160deg, #c9d6ec 0%, #dde6f4 50%, var(--frame) 100%); }
.guest main { width: min(520px, 100%); padding: 32px 36px; background: rgba(255, 255, 255, .92); border-radius: 22px; box-shadow: var(--shadow); }

/* ---- forms and buttons ---- */
input, select, textarea, button { font: inherit; color: var(--ink); }
input, select, textarea {
  padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-200); }
:where(a, button, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
.skip-link { position: absolute; z-index: 100; inset-inline-start: 12px; inset-block-start: -80px; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; }
.skip-link:focus { inset-block-start: 12px; }
input::placeholder, textarea::placeholder { color: #6b7280; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
input[type=file] { padding: 6px; max-width: 100%; }
button {
  padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--ink);
  font-weight: 550; cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s;
}
button:hover { background: var(--accent-100); border-color: var(--accent-200); }
button[type=submit], button.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 8px rgba(30, 58, 110, .22); }
button[type=submit]:hover, button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.secondary, button[type=submit].secondary { background: #fff; color: var(--accent-dark); border-color: var(--line-strong); box-shadow: none; }
button.secondary:hover { background: var(--accent-100); }
button.danger { background: #b3261e; border-color: #b3261e; color: #fff; }
button.danger:hover { background: #8f1d17; }
tr.picked td { background: var(--accent-100); }
.row { display: flex; gap: 8px; margin: 12px 0; }
.row input { flex: 1; }
.stack { display: grid; gap: 12px; max-width: 540px; }
.stack label { display: grid; gap: 4px; font-weight: 500; }
.stack label.inline { display: flex; align-items: center; gap: 6px; }
.stack input:not([type=checkbox]):not([type=radio]), .stack select, .stack textarea { width: 100%; }
dl { display: grid; grid-template-columns: 9em 1fr; gap: 6px 14px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }

/* ---- cards, notices, badges ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 16px 0;
  box-shadow: 0 1px 2px rgba(20, 40, 80, .03);
}
.card > h2:first-child { margin-top: 0; }
.flash { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--soft); }
.flash.ok { border-color: #bfe3cf; background: var(--mint-100); color: #1c6a41; }
.flash.bad { border-color: #f2c3be; background: #fdeceb; color: #9a1f15; }
.flash.warn { border-color: #eadc8f; background: #fdf6d3; color: #7a5b00; }
.flash ul { margin: 4px 0 0; padding-left: 20px; }
.badge {
  display: inline-block; padding: 1px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff;
  color: var(--muted); font-size: .8rem; font-weight: 550; white-space: nowrap; text-decoration: none; line-height: 1.6;
}
a.badge:hover { background: var(--accent-100); color: var(--accent-dark); }
.badge.ok { border-color: #bfe3cf; background: var(--mint-100); color: var(--ok); }
.badge.gone { border-color: #f2c3be; background: #fdeceb; color: var(--bad); }
.badge.warn { border-color: #eadc8f; background: #fdf6d3; color: var(--warn); }
.k-school td { color: var(--muted); }

/* ---- tables ---- */
table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--soft); color: var(--muted); font-size: .9rem; font-weight: 650; letter-spacing: .04em; border-bottom: 1px solid var(--line-strong); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--soft); }
tr.gone td { color: #8a3a33; }
tr.gone td a { color: inherit; }
tr.done td { background: #f4fbf7; }
tr.pending td { background: #fdf9e6; }
th.sortable a, th.sortable.js { color: inherit; text-decoration: none; white-space: nowrap; }
th.sortable a:hover { color: var(--accent-dark); }
th.sortable .arrow { margin-left: 5px; opacity: .35; font-size: .85em; }
th.sortable.on { color: var(--accent-dark); }
th.sortable.on .arrow { opacity: 1; color: var(--accent); }
th.sortable.js { cursor: pointer; user-select: none; }
th.sortable.js:hover { color: var(--accent-dark); }
th.sortable.js:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
th.pick, td.pick { width: 2.4em; text-align: center; }

/* ---- progress, tabs, pager ---- */
progress { width: min(420px, 60%); height: 10px; vertical-align: middle; border: 0; border-radius: 999px; overflow: hidden; background: var(--accent-100); accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--accent-100); }
progress::-webkit-progress-value { background: linear-gradient(90deg, #3d5f99, var(--accent)); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.progress-line { margin: 4px 0 14px; }
.tabs { display: inline-flex; gap: 4px; flex-wrap: wrap; margin: 10px 0; padding: 4px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); }
.tabs a { padding: 5px 16px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 550; }
.tabs a:hover { color: var(--accent-dark); }
.tabs a.on { background: #fff; color: var(--accent-dark); box-shadow: 0 1px 4px rgba(20, 40, 80, .14); }
.pager { display: flex; gap: 6px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.pager a, .pager strong { min-width: 34px; padding: 3px 11px; text-align: center; border-radius: 999px; text-decoration: none; }
.pager a { border: 1px solid var(--line); background: #fff; }
.pager a:hover { background: var(--accent-100); border-color: var(--accent-200); }
.pager strong { background: var(--accent); color: #fff; }
.jump { display: inline-flex; gap: 6px; align-items: center; margin-left: 12px; }
.jump input[type=number] { width: 5em; padding: 5px 8px; }
.jump button { padding: 5px 14px; }

/* ---- small disclosure forms ---- */
details summary { cursor: pointer; }
details.tool summary, details.quick summary, .printmenu summary { color: var(--accent-dark); font-size: .9rem; font-weight: 550; white-space: nowrap; }
details.quick summary { padding: 2px 6px; }
details.quick form { margin-top: 6px; min-width: 14em; }
details.quick .buttons, .buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.printmenu summary { font-size: 1rem; font-weight: 650; }
.printmenu ul { margin: 6px 0 6px 1.2em; padding: 0; }
.help ol { margin: 6px 0 10px 1.2em; padding: 0; }
.help li { margin: 2px 0; }
.suggest-hint { display: block; margin-top: 2px; }
.photo-hint { display: block; }
.picktools { align-items: center; flex-wrap: wrap; }
form.filters .row { flex-wrap: wrap; }
form.filters .row select, .filters select { flex: 0 1 auto; max-width: 100%; }

/* ---- a new count list: folded away, two columns, people as small cards ---- */
.newlist { margin: 14px 0 20px; }
.newlist > summary {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 20px; border-radius: 12px; list-style: none;
  background: var(--accent); color: #fff; font-weight: 650; cursor: pointer; box-shadow: 0 3px 8px rgba(30, 58, 110, .22);
}
.newlist > summary::-webkit-details-marker { display: none; }
.newlist > summary:hover { background: var(--accent-dark); }
.newlist[open] > summary { background: #fff; color: var(--accent-dark); border: 1px solid var(--line-strong); box-shadow: none; }
.newlist-body { margin-top: 14px; padding: 18px 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); }
.reuse { align-items: end; margin: 0 0 16px; }
.reuse label { display: grid; gap: 4px; font-weight: 500; }
.newform { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.5fr); gap: 28px; }
.newform-main { display: grid; align-content: start; gap: 14px; }
.newform-main label { display: grid; gap: 4px; font-weight: 500; }
.newform-main input { width: 100%; }
.newform-main button[type=submit] { justify-self: start; padding: 10px 26px; }
.picker-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.picker-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.picker-tools input[type=search] { flex: 1; min-width: 180px; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 340px; overflow: auto; padding: 4px; }
.picker .person {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; cursor: pointer; transition: background .1s, border-color .1s;
}
.picker .person:hover { border-color: var(--accent-200); }
.picker .person:has(input:checked) { background: var(--accent-100); border-color: var(--accent-200); }
.picker .person input { flex: none; width: 18px; height: 18px; margin: 0; }
.picker .av { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-200); color: var(--accent-dark); font-weight: 700; }
.picker .who { min-width: 0; line-height: 1.3; }
.picker .who b { display: block; font-weight: 600; }
.picker .who small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.progress-col progress { width: 160px; }
td.progress-col { white-space: nowrap; }

/* ---- the count page ---- */
progress + span { margin-left: 8px; }
table.count { table-layout: fixed; }
table.count th:nth-child(1) { width: 9%; }
table.count th:nth-child(2) { width: 16%; }
table.count th:nth-child(3) { width: 8%; }
table.count th:nth-child(4) { width: 10%; }
table.count th:nth-child(5) { width: 8%; }
table.count th:nth-child(7) { width: 18%; }
table.count td { overflow-wrap: anywhere; }
table.count td.no, table.count td.date { white-space: nowrap; }
table.count td[data-label="名稱／型號"] { min-width: 10em; }
table.count form { margin: 0; }
table.count form.note { display: flex; gap: 6px; }
table.count form.note input { flex: 1 1 0; min-width: 7em; padding: 6px 10px; }
table.count form.note button { flex: none; padding: 6px 12px; }
table.count form.note button[type=submit] { background: #fff; color: var(--accent-dark); border-color: var(--line-strong); box-shadow: none; }
table.count form.note button[type=submit]:hover { background: var(--accent-100); border-color: var(--accent-200); }
table.count td.actions form { margin: 4px 0; }
table.count td.actions .flash { display: inline-block; padding: 0 10px; }
table.count .buttons { margin-top: 4px; }
table.count .buttons form { margin: 0; }
table.count .tools { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; align-items: flex-start; }
table.count details.tool { margin-top: 6px; }
table.count .tools details.tool { margin-top: 0; }
table.count .tools details.tool[open] { flex-basis: 100%; }
table.count details .row { flex-wrap: wrap; margin: 6px 0 0; }

/* ---- search and list pages ---- */
th.sortable, td[data-label="狀態"], td[data-label="改地點"], td[data-label="買入日期"] { white-space: nowrap; }
td[data-label="保管單位"] { min-width: 9em; }

/* ---- a tool: heading with its state, the move form, the history as a line ---- */
.crumb { margin: 0 0 6px; }
nav.crumb { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: .95rem; }
nav.crumb .sep { color: var(--muted); }
nav.crumb [aria-current] { color: var(--muted); }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.item-head h1 { margin-bottom: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.statuscard { display: grid; gap: 2px; min-width: 190px; padding: 12px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--soft); }
.statuscard .label { font-size: .75rem; letter-spacing: .1em; color: var(--muted); }
.statuscard strong { font-size: 1.35rem; line-height: 1.3; }
.statuscard .sub { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.statuscard.out { background: #fdf6d3; border-color: #eadc8f; }
.statuscard.out strong { color: var(--warn); }
.statuscard.in { background: var(--mint-100); border-color: #bfe3cf; }
.statuscard.in strong { color: var(--ok); }
.item-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.item-grid .card { margin: 0 0 16px; }
.move { display: grid; gap: 14px; max-width: 560px; }
.move .field { display: grid; gap: 3px; font-weight: 500; }
.move .field small { font-weight: 400; }
.move input:not([type=radio]):not([type=checkbox]) { width: 100%; }
.move button[type=submit] { justify-self: start; padding: 10px 28px; }
.choice { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); justify-self: start; }
.choice label { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: block; padding: 7px 22px; border-radius: 999px; font-weight: 600; color: var(--muted); }
.choice label:hover span { color: var(--accent-dark); }
.choice input:checked + span { background: var(--accent); color: #fff; box-shadow: 0 2px 6px rgba(30, 58, 110, .28); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.addform { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.addform label { display: grid; gap: 3px; font-weight: 500; }
.addform label small { font-weight: 400; }
.addform label.grow { flex: 1 1 240px; }
.addform input { width: 100%; }
.additem { margin-top: 8px; }
ol.timeline { list-style: none; margin: 4px 0 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); }
ol.timeline li { position: relative; padding: 0 0 16px 20px; }
ol.timeline li::before { content: ""; position: absolute; left: -17px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--accent-200); }
ol.timeline li.k-event::before { border-color: var(--accent); }
ol.timeline li.k-school::before { border-color: #e2d0c1; }
ol.timeline li.empty::before { display: none; }
ol.timeline time { color: var(--muted); font-size: .8rem; }
ol.timeline .what { font-weight: 550; overflow-wrap: anywhere; }
ol.timeline li.k-school .what { color: var(--muted); font-weight: 450; }
ol.timeline .meta { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }

/* ---- photos ---- */
.photos { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 12px; }
.photos figure { margin: 0; max-width: 200px; font-size: .9rem; }
.photos img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 8px rgba(20, 40, 80, .08); }
.photos details.tool summary { font-size: .85rem; }

/* ---- home: greeting, numbers, what is going on ---- */
.hero {
  position: relative; display: grid; gap: 14px; padding: 28px 30px; margin: -8px 0 24px; border-radius: 20px; overflow: hidden;
  background: radial-gradient(70% 90% at 90% 0%, #f5f8fd, transparent 60%), linear-gradient(120deg, #ccd8ee 0%, #e3eaf6 60%, #f5f8fc 100%);
}
.hero h1 { font-size: 1.8rem; }
.hero p { margin: 0; color: #3e4c66; }
.hero form { display: flex; gap: 8px; max-width: 640px; margin: 4px 0 0; }
.hero form input { flex: 1; padding: 11px 16px; border-radius: 12px; border-color: transparent; box-shadow: 0 4px 14px rgba(20, 40, 80, .14); }
.hero form button { padding: 10px 22px; border-radius: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 0 0 24px; }
.stat { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(20, 40, 80, .03); }
.stat header { padding: 8px 16px; font-size: .74rem; font-weight: 650; letter-spacing: .1em; color: #3e4c66; }
.stat.blue header { background: var(--accent-100); }
.stat.peach header { background: var(--peach-100); }
.stat.mint header { background: var(--mint-100); }
.stat.lav header { background: var(--lav-100); }
.stat .body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 14px 18px 16px; }
.stat .num { font-size: 2.1rem; font-weight: 700; line-height: 1.15; }
.stat .num small { font-size: .9rem; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat p { margin: 0; color: var(--muted); font-size: .88rem; }
.stat a.go { margin-top: auto; align-self: flex-start; padding: 5px 14px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 550; font-size: .9rem; background: #fff; }
.stat a.go:hover { background: var(--accent-100); border-color: var(--accent-200); color: var(--accent-dark); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.two .card { margin: 0; }
.feed { margin: 0; padding: 0; list-style: none; }
.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .what { font-weight: 550; overflow-wrap: anywhere; }
.feed .when { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.lists-progress { margin: 0; padding: 0; list-style: none; }
.lists-progress li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.lists-progress li:last-child { border-bottom: 0; }
.lists-progress progress { display: block; width: 100%; margin-top: 6px; }

/* ---- the landing page, before signing in ---- */
.landing { text-align: center; }
.landing .mark-lg { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #3d5f99 0%, var(--accent) 100%); box-shadow: 0 8px 20px rgba(30, 58, 110, .28); }
.landing .mark-lg svg { width: 34px; height: 34px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.landing h1 { font-size: 2rem; margin-bottom: 4px; }
.landing .lead { margin: 0 0 18px; color: var(--muted); font-size: 1.05rem; }
.landing .points { margin: 0 0 22px; padding: 0; list-style: none; text-align: left; display: grid; gap: 10px; }
.landing .points li { padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.landing .points b { display: block; color: var(--accent-dark); }
.landing .fine { margin: 14px 0 0; font-size: .85rem; }
a.button { display: inline-flex; align-items: center; justify-content: center; padding: 12px 30px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 650; text-decoration: none; box-shadow: 0 4px 12px rgba(30, 58, 110, .26); }
a.button:hover { background: var(--accent-dark); color: #fff; }

/* ---- narrower than a desktop: the sidebar becomes a bar at the top ---- */
@media (max-width: 960px) {
  .item-grid { grid-template-columns: 1fr; }
  html, body { background: #fff; }
  .shell { display: block; margin: 0; min-height: 100vh; border-radius: 0; box-shadow: none; }
  .side { height: auto; overflow: visible; align-self: stretch; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5; }
  .brand { padding: 0; }
  .sidebar-toggle { display: inline-flex; margin-left: auto; padding: 6px 14px; align-items: center; }
  .nav { display: none; flex-basis: 100%; padding-top: 6px; }
  .side.open .nav { display: flex; }
  .nav a { padding: 12px 12px; }
  .me { display: none; margin: 0; padding: 8px 4px 0; flex-basis: 100%; border-top: 1px solid var(--line); }
  .side.open .me { display: flex; }
  main { padding: 18px 14px 30px; }
  .hero { margin-top: 0; padding: 22px 18px; }
}

/* ---- a phone in a machine room: one card per row, no sideways scrolling, large touch targets ---- */
@media (max-width: 720px) {
  dl { grid-template-columns: 1fr; }
  button, input, select { min-height: 44px; }
  table.count, table.cards { table-layout: auto; font-size: 1rem; border: 0; background: transparent; overflow: visible; }
  table.count thead, table.cards thead { display: none; }
  table.count, table.count tbody, table.count tr, table.count td,
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.count tr, table.cards tr { border: 1px solid var(--line); border-radius: 14px; margin: 0 0 12px; padding: 6px 0; background: #fff; box-shadow: 0 1px 3px rgba(20, 40, 80, .06); }
  table.count td, table.cards td { border: 0; padding: 6px 14px; }
  table.count tbody tr:hover td, table.cards tbody tr:hover td { background: transparent; }
  table.count tr.done td { background: #f4fbf7; }
  table.count tr.pending td { background: #fdf9e6; }
  table.count td[data-label]::before, table.cards td[data-label]::before { content: attr(data-label); display: block; font-size: .78rem; color: var(--muted); }
  table.count td[data-label="產編／名稱"]::before, table.cards td[data-label="產編"]::before { display: none; }
  table.cards td.pick { text-align: left; }
  table.cards td.pick::before { display: none; }
  table.count tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 8px 0; }
  table.count td { grid-column: span 2; padding: 4px 14px; }
  table.count td.no { order: 1; font-size: 1.05rem; font-weight: 650; }
  table.count td[data-label="名稱／型號"] { order: 2; min-width: 0; }
  table.count td.actions { order: 3; padding-top: 8px; padding-bottom: 8px; }
  table.count td[data-label="保管人"] { order: 4; grid-column: span 1; }
  table.count td[data-label="校務地點"] { order: 5; grid-column: span 1; }
  table.count td[data-label="買入日期"] { order: 6; }
  table.count td[data-label="新位置與註記"] { order: 7; }
  table.count td[data-label="產編"]::before, table.count td[data-label="名稱／型號"]::before { display: none; }
  table.count td.actions::before { display: none; }
  table.count td.actions .buttons button[type=submit] { min-width: 7em; }
  table.count form.note { flex-wrap: wrap; }
  table.count form.note input { flex: 1 1 100%; }
  td[data-label="保管單位"] { min-width: 0; }
  td[data-label="狀態"], td[data-label="改地點"], td[data-label="買入日期"] { white-space: normal; }
  .row { flex-wrap: wrap; }
  .filters .row select, .filters select { flex: 1 1 45%; }
  .pager { gap: 8px; }
  .tabs a { padding: 8px 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .newform { grid-template-columns: 1fr; }
  .progress-col progress { width: 110px; }
  .hero form { flex-wrap: wrap; }
  .hero form input { flex: 1 1 100%; }
}
@media (max-width: 460px) { .stats { grid-template-columns: 1fr; } }

/* ---- tools: the name with a picture, a tool page with a note, a history that can be folded ---- */
.items td.itemcell { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.thumb { flex: none; display: block; width: 46px; height: 46px; border-radius: 12px; overflow: hidden; background: var(--accent-100); text-decoration: none; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb .ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--accent-dark); font-weight: 700; font-size: 1.1rem; }
.thumb.big { width: 72px; height: 72px; border-radius: 16px; box-shadow: 0 2px 8px rgba(20, 40, 80, .15); }
.items .nm { min-width: 0; }
.items a.title { display: block; font-weight: 650; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.items a.title:hover { color: var(--accent-dark); text-decoration: underline; }
.items .sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.items .sub .note { color: var(--muted); font-size: .85rem; }
.items tr.inactive td { opacity: .65; }
.item-title { display: flex; gap: 16px; align-items: center; }
.itemnote { margin: 6px 0 0; color: var(--muted); max-width: 44em; }
.editbox form { margin-top: 10px; }
.fine { font-size: .92rem; }
ol.timeline li.year { padding: 4px 0 8px 0; margin-left: -10px; font-weight: 700; color: var(--accent-dark); }
ol.timeline li.year::before { display: none; }
.more { margin: 4px 0 0; }
textarea { width: 100%; resize: vertical; }

/* ---- an asset page: same frame as a tool page ---- */
.choice.wrap { flex-wrap: wrap; border-radius: 18px; }
.badge.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; }
h3.group { margin: 14px 0 6px; font-size: .78rem; font-weight: 650; letter-spacing: .1em; color: var(--muted); }
h3.group:first-of-type { margin-top: 0; }
.item-grid aside dl { grid-template-columns: 7.5em 1fr; }
.statuscard.none { background: var(--soft); }

/* ---- the sign-in is ending, or ended ---- */
.session-banner { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20; max-width: min(640px, calc(100vw - 24px)); padding: 12px 18px; border-radius: 14px; box-shadow: 0 10px 30px rgba(20, 40, 80, .25); font-weight: 550; }
.session-banner.over { background: #fdeceb; border: 1px solid #f2c3be; color: #8f1c13; }
.session-banner.soon { background: #fdf6d3; border: 1px solid #eadc8f; color: var(--warn); }
.session-banner a { font-weight: 700; margin-left: 6px; }

/* ---- the front page: a big soft stage with glassy letters ---- */
.guest:has(.stage) { display: block; padding: 14px; background: var(--frame); }
.guest main.stagemain { width: 100%; max-width: none; padding: 0; background: none; border-radius: 0; box-shadow: none; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }
.stage {
  position: relative; isolation: isolate; overflow: hidden; min-height: calc(100vh - 28px); border-radius: 30px;
  color: #0f1a2e;
  background:
    radial-gradient(55% 45% at 78% 14%, rgba(240, 245, 255, .95), rgba(240, 245, 255, 0) 62%),
    radial-gradient(45% 55% at 12% 86%, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 62%),
    linear-gradient(160deg, #b9cae6 0%, #cfdbef 45%, #e2e9f5 100%);
  box-shadow: 0 20px 50px rgba(20, 40, 80, .2);
}
.stage::before {
  content: ""; position: absolute; inset: -25%; z-index: -2; opacity: .75; filter: blur(30px);
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0) 0 80px, rgba(255, 255, 255, .6) 130px, rgba(255, 255, 255, 0) 200px);
  transform: rotate(-3deg); animation: drift 26s ease-in-out infinite alternate;
}
.stage .lines { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.stage .lines::before, .stage .lines::after { content: ""; position: absolute; }
.stage .lines::before { inset: 0 5% 0 5%; background: linear-gradient(to right, rgba(30, 50, 90, .16) 1px, transparent 1px) 0 0 / 33.3334% 100%, linear-gradient(to left, rgba(30, 50, 90, .16) 1px, transparent 1px) 0 0 / 100% 100% no-repeat; }
.stage .lines::after { left: 0; right: 0; top: 0; bottom: 0; background: linear-gradient(to bottom, transparent 36%, rgba(30, 50, 90, .16) 36%, rgba(30, 50, 90, .16) calc(36% + 1px), transparent calc(36% + 1px)), linear-gradient(to bottom, transparent 72%, rgba(30, 50, 90, .16) 72%, rgba(30, 50, 90, .16) calc(72% + 1px), transparent calc(72% + 1px)); }
.stage .lines i { position: absolute; font: 400 14px/1 ui-monospace, Menlo, monospace; color: rgba(30, 50, 90, .5); transform: translate(-50%, -50%); font-style: normal; }
.stage .lines .p1 { left: 5%; top: 36%; } .stage .lines .p2 { left: 38.33%; top: 36%; } .stage .lines .p3 { left: 71.66%; top: 36%; } .stage .lines .p4 { left: 95%; top: 36%; }

.stage-top { display: flex; justify-content: space-between; align-items: center; padding: 26px 5.5% 0; }
.stage .logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; letter-spacing: .04em; color: #0f1a2e; text-decoration: none; }
.stage .logo .mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, #3d5f99, var(--accent)); }
.stage .logo .mark svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.stage-nav { display: flex; gap: 28px; align-items: center; font-size: .82rem; letter-spacing: .12em; }
.stage-nav a { color: #0f1a2e; text-decoration: none; }
.stage-nav a:hover { text-decoration: underline; }
.stage-nav .pill { padding: 7px 16px; border-radius: 999px; background: #0f1a2e; color: #fff; }
.stage-nav .pill:hover { background: var(--accent-dark); text-decoration: none; }

.stage-notes { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 24px; padding: 34px 5.5% 0; font-size: .82rem; line-height: 1.7; }
.stage-notes p { margin: 0; }
.stage-notes .note-a { font-size: 1.25rem; font-weight: 600; line-height: 1.35; }
.stage-notes .note-a .mono { display: inline-block; margin-top: 6px; font-size: .72rem; font-weight: 400; letter-spacing: .14em; color: #3e4c66; }
.stage-notes .note-c { max-width: 30em; }

.stage .glass {
  position: absolute; left: 50%; top: 45%; z-index: 0; transform: translate(-50%, -50%); margin: 0;
  font-size: clamp(8rem, 27vw, 25rem); font-weight: 900; line-height: .95; letter-spacing: -.03em; white-space: nowrap; user-select: none; pointer-events: none;
  color: transparent;
  background: linear-gradient(165deg, #6f8fc4 0%, #2c4f8a 34%, #a9bde0 62%, #f4f7fc 100%); -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 30px 28px rgba(30, 58, 110, .34)) drop-shadow(0 0 1px rgba(255, 255, 255, .95)) drop-shadow(0 -2px 3px rgba(255, 255, 255, .6));
  animation: float 9s ease-in-out infinite;
}
.stage .glass::after {
  content: attr(data-text); position: absolute; inset: 0; color: transparent; mix-blend-mode: soft-light;
  background: linear-gradient(115deg, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, .7) 100%);
  -webkit-background-clip: text; background-clip: text;
}
.stage .headline {
  position: absolute; left: 5.5%; bottom: 90px; z-index: 1; margin: 0;
  font-size: clamp(2.3rem, 6.4vw, 5.8rem); font-weight: 900; line-height: 1.06; letter-spacing: -.01em; color: #1a1008;
}
.stage .cta { position: absolute; right: 6.5%; bottom: 86px; z-index: 2; display: grid; justify-items: center; gap: 2px; text-decoration: none; color: #0f1a2e; transition: transform .2s; }
.stage .cta:hover { transform: translateY(-4px) rotate(-2deg); }
.stage .cta .arrow { width: clamp(84px, 9vw, 130px); height: auto; filter: drop-shadow(0 14px 14px rgba(20, 40, 80, .4)); animation: float 6s ease-in-out infinite reverse; }
.stage .cta .label { margin-top: 4px; padding: 8px 20px; border-radius: 999px; background: #fff; font-weight: 750; box-shadow: 0 6px 16px rgba(20, 40, 80, .22); }
.stage .cta:hover .label { background: var(--accent); color: #fff; }
.stage .cta .hint { font-size: .66rem; letter-spacing: .16em; color: #3e4c66; }
.stage .cta:focus-visible { outline: 3px solid var(--accent-dark); outline-offset: 6px; border-radius: 16px; }
.stage-foot { position: absolute; left: 5.5%; right: 5.5%; bottom: 52px; display: flex; justify-content: space-between; gap: 12px; font-size: .72rem; letter-spacing: .1em; color: #34425c; }
.stage-credit { position: absolute; left: 5.5%; right: 5.5%; bottom: 10px; margin: 0; display: grid; gap: 2px; line-height: 1.3; text-align: center; font-size: .62rem; letter-spacing: .08em; color: #3e4c66; opacity: .8; }
@keyframes float { 0%, 100% { transform: translate(-50%, -50%) translateY(0); } 50% { transform: translate(-50%, -50%) translateY(-12px); } }
.stage .cta .arrow { animation-name: bob; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes drift { from { transform: rotate(-3deg) translateX(-2%); } to { transform: rotate(-3deg) translateX(3%); } }
@media (prefers-reduced-motion: reduce) { .stage::before, .stage .glass, .stage .cta .arrow { animation: none; } }

@media (max-width: 860px) {
  .guest:has(.stage) { padding: 8px; }
  .stage { border-radius: 22px; min-height: calc(100vh - 16px); }
  .stage-notes { grid-template-columns: 1fr; gap: 10px; padding-top: 22px; }
  .stage-notes .note-b, .stage-notes .note-c { display: none; }
  .stage .glass { top: 33%; font-size: clamp(7rem, 40vw, 12rem); }
  .stage .headline { bottom: 270px; font-size: clamp(2.2rem, 10vw, 3.4rem); }
  .stage .cta { right: 50%; transform: translateX(50%); bottom: 104px; }
  .stage .cta:hover { transform: translateX(50%) translateY(-4px); }
  .stage-foot span:nth-child(2) { display: none; }
}

/* ---- the version in the menu, the release notes ---- */
.side .version { margin-top: auto; padding: 6px 12px; border-radius: 8px; font-size: .78rem; color: var(--muted); text-decoration: none; }
.side .version:hover, .side .version[aria-current] { color: var(--accent-dark); background: var(--accent-100); }
.side .version + .me { margin-top: 0; }
.releases { display: grid; gap: 18px; max-width: 820px; margin-top: 16px; }
.release { padding: 16px 22px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.release.current { border-color: var(--accent-200); box-shadow: 0 2px 12px rgba(20, 40, 80, .08); }
.release header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.release h2 { margin: 0; font-size: 1.35rem; }
.release .date { color: var(--muted); font-size: .85rem; }
.release .rtitle { flex-basis: 100%; font-weight: 550; }
.release ul { margin: 0 0 14px; padding-left: 1.3em; }
.release li { margin: 3px 0; }

.newform.narrow { grid-template-columns: 1fr; gap: 16px; }
table.members { margin-top: 8px; }
table.members tr.inactive td { opacity: .6; }

.stats-line { margin: 10px 0 14px; }
table.users td { vertical-align: top; }

/* the "clear" button of a search */
a.clear { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--accent-dark); font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
a.clear:hover { background: var(--accent-100); border-color: var(--accent-200); color: var(--accent-dark); }
a.clear span { font-size: 1.1em; line-height: 1; }

/* ---- steps, summary cards: batch setting ---- */
ol.steps { display: flex; gap: 8px; margin: 14px 0 18px; padding: 0; list-style: none; flex-wrap: wrap; }
ol.steps li { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); }
ol.steps li b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--soft); border: 1px solid var(--line-strong); font-size: .85rem; }
ol.steps li.on { color: var(--accent-dark); border-color: var(--accent-200); background: var(--accent-100); font-weight: 650; }
ol.steps li.on b { background: var(--accent); border-color: var(--accent); color: #fff; }
ol.steps li.done b { background: var(--mint-100); border-color: #bfe3cf; color: var(--ok); }
ol.steps li.done { color: var(--ink); }
.bulkform { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.bulkform .card { margin: 0; }
.bulkform .field { display: grid; gap: 4px; font-weight: 500; margin-bottom: 12px; }
.bulkform .field small { font-weight: 400; }
.bulkform textarea, .bulkform input:not([type=hidden]) { width: 100%; }
.bulkform textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; line-height: 1.6; }
.bulkform button[type=submit] { padding: 10px 30px; }
.count-line { margin: 0; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
.sumcard { display: grid; gap: 2px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.sumcard .label { font-size: .75rem; letter-spacing: .1em; color: var(--muted); }
.sumcard strong { font-size: 1.25rem; line-height: 1.35; overflow-wrap: anywhere; }
.sumcard.ok { background: var(--mint-100); border-color: #bfe3cf; }
.sumcard.ok strong { color: var(--ok); }
.sumcard.bad { background: #fdeceb; border-color: #f2c3be; }
.sumcard.bad strong { color: var(--bad); }
form.confirm { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 0 0 16px; }
form.confirm button[type=submit] { padding: 12px 34px; font-size: 1.05rem; }
tr.skipped td { color: var(--muted); }
details.help summary { color: var(--accent-dark); font-weight: 600; }
details.help ul { margin: 10px 0 0; padding-left: 1.3em; }
@media (max-width: 960px) { .bulkform { grid-template-columns: 1fr; } }

/* ---- export ---- */
.exports { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; align-items: start; }
.export-card { margin: 0; }
.exportform { display: grid; gap: 14px; }
.exportform .range { display: flex; gap: 12px; flex-wrap: wrap; }
.exportform .range label, .exportform .field { display: grid; gap: 3px; font-weight: 500; }
.exportform .field small { font-weight: 400; }
.exportform .field input, .exportform .field select { width: 100%; }
.exportform .quick { display: flex; gap: 6px; flex-wrap: wrap; }
.exportform .quick button { padding: 4px 12px; font-size: .88rem; }
.exportform button[type=submit] { justify-self: start; padding: 10px 28px; }
.card.note { background: var(--soft); }
.card.note ul { margin: 6px 0 0; padding-left: 1.3em; }
.card.note li { margin: 4px 0; }
details.cols { margin-top: 12px; }
details.cols summary { color: var(--accent-dark); font-size: .9rem; font-weight: 600; }
details.cols p { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }

/* ---- manual ---- */
.manual-ver { margin: 0 0 12px; font-size: .9rem; color: var(--muted); }
.new { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .03em; vertical-align: middle; background: var(--accent-100); color: var(--accent-dark); }
.manual { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; }
.manual .toc { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 14px 16px; background: var(--soft); border-radius: 12px; }
.manual .toc h2 { margin: 0 0 6px; font-size: .95rem; }
.manual .toc ol { margin: 0; padding-left: 1.2em; font-size: .92rem; }
.manual .toc li { margin: 3px 0; }
.manual .toc ol ol { margin-top: 2px; }
.manual .chapter { margin: 0 0 18px; padding: 18px 22px; background: #fff; border: 1px solid var(--line); border-radius: 12px; scroll-margin-top: 16px; }
.manual .chapter h2 { margin-top: 0; }
.manual .chapter h3 { margin: 22px 0 6px; font-size: 1.05rem; scroll-margin-top: 16px; }
.manual .chapter li { margin: 5px 0; }
.manual .who { margin-left: 8px; padding: 2px 10px; font-size: .78rem; font-weight: 500; color: var(--accent-dark); background: var(--soft); border-radius: 999px; vertical-align: middle; }
.manual dt { margin-top: 12px; font-weight: 600; }
.manual dd { margin: 3px 0 0; }
.tablewrap { max-inline-size: 100%; overflow-x: auto; }
.tablewrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.manual .toc a.current { font-weight: 700; color: var(--accent-dark); background: #fff; border-radius: 6px; box-shadow: inset 3px 0 0 var(--accent); padding: 1px 6px; }
.manual .toc a.in { font-weight: 700; color: var(--accent-dark); }
.manual-here { display: none; }
@media (max-width: 900px) {
  .manual { grid-template-columns: 1fr; }
  .manual .toc { position: static; max-height: none; }
  .manual-here:not([hidden]) { display: block; position: sticky; top: 0; z-index: 5; margin: 0 0 10px; padding: 8px 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; font-weight: 600; color: var(--accent-dark); }
}

/* ---- landing: the organisation under the name ---- */
.stage .logo .name { display: grid; line-height: 1.25; }
.stage .logo .name small { font-weight: 500; font-size: .72rem; letter-spacing: .12em; color: #34425c; }

/* ---- phone: the version and the menu button sit together on the right of the top bar ---- */
@media (max-width: 960px) {
  .side .brand { order: 0; }
  .side .version { order: 1; margin: 0 0 0 auto; padding: 6px 4px; }
  .side .sidebar-toggle { order: 2; margin-left: 0; }
  .side .nav { order: 3; }
  .side .me { order: 4; }
}

/* ---- the count button in a search row ---- */
.countbtn { margin: 6px 0 0; }
.countbtn button { padding: 4px 14px; font-size: .9rem; }
.pickers { display: flex; gap: 6px; }

/* ---- sign-in form: a card on the warm frame, the same marks as the front page ---- */
.signin-head { text-align: center; margin-bottom: 18px; }

.signin-head .mark { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, #3d5f99 0%, var(--accent) 100%); box-shadow: 0 8px 20px rgba(30, 58, 110, .28); }
.signin-head .mark svg { width: 30px; height: 30px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.signin-head h1, .signin-head h2 { font-size: 1.6rem; margin-bottom: 2px; }
.signin-head p { margin: 0; }
.signin-form { max-width: none; }
.signin-form button[type=submit] { padding: 11px 16px; font-size: 1.02rem; }
.login-dialog { width: min(440px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 22px; background: #fff; color: var(--ink); box-shadow: 0 24px 60px rgba(20, 40, 80, .35); overflow: auto; }
.login-dialog::backdrop { background: rgba(10, 20, 40, .35); backdrop-filter: blur(6px); }
.login-dialog .inner { position: relative; padding: 30px 34px 26px; }
.login-dialog .close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; min-height: 0; padding: 0; display: grid; place-items: center; border-radius: 50%; font-size: 1.2rem; line-height: 1; color: var(--muted); }
.login-dialog .fine { text-align: center; }
.login-dialog[open] { animation: login-pop .18s ease-out; }
@keyframes login-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .login-dialog[open] { animation: none; } }

/* ---- the warning colour is olive yellow, so a badge.warn reads as "note", not as the navy of the site ---- */
.brand .badge { margin-left: 4px; }
td.fine { overflow-wrap: anywhere; max-width: 28em; }

/* ---- a list of names as small badges ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips .badge { font-size: .9rem; padding: 4px 12px; }

/* ---- password expiry: departments to scan, one by one ---- */
.expiry-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.expiry details { border-bottom: 1px solid var(--line); padding: 6px 0; }
.expiry details:last-child { border-bottom: 0; }
.expiry summary { cursor: pointer; font-weight: 650; padding: 4px 0; }
.expiry .feed li { grid-template-columns: 1fr auto auto; align-items: center; padding: 6px 0 6px 14px; }
button.small { padding: 3px 12px; min-height: 0; font-size: .85rem; }
button:disabled { opacity: .55; cursor: not-allowed; }

/* ---- an account in each system ---- */
.sys { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.badge.off { background: #f4f1ee; border-color: #e6e0da; color: #b3a79c; }
.service-list { display: grid; }
.service-row { display: grid; grid-template-columns: 11.5em max-content minmax(0, 1fr) 4.5em; gap: 4px 12px; align-items: center; padding: 9px 2px; border-top: 1px solid var(--line); }
.service-row:first-child { border-top: 0; }
.service-name { font-weight: 600; }
.service-detail { font-size: .88rem; overflow-wrap: anywhere; }
.service-mail { grid-column: 2 / 4; display: flex; gap: 12px; align-items: center; }
.service-act { text-align: right; }
.service-act form, form.service-act { margin: 0; }
@media (max-width: 720px) { .service-row { grid-template-columns: 1fr max-content; } .service-detail, .service-mail { grid-column: 1 / -1; } .service-act { grid-column: 2; grid-row: 1; } }
.password-once { font-size: 1.8rem; letter-spacing: .12em; padding: 10px 16px; margin: 0 0 8px; border-radius: 12px; background: var(--soft); border: 1px dashed var(--line-strong); display: inline-block; user-select: all; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }

/* ---- an account's groups, each removable ---- */
.groups-edit { display: grid; gap: 16px; }
.chip-form { display: inline; margin: 0; }
.chip-x { margin-left: 6px; padding: 0 4px; min-height: 0; border: 0; background: none; box-shadow: none; color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; }
.chip-x:hover { color: var(--bad); background: none; }
.add-group { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.add-group select { flex: 1 1 260px; }
.groups-edit .card { margin: 0; }
fieldset.stack { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 0; }
fieldset.stack legend { padding: 0 6px; font-size: .88rem; color: var(--muted); }
fieldset.stack input[type=tel] { width: 12em; margin-left: 6px; }
.card-input { width: 8em; }
td.actions .row { flex-wrap: nowrap; gap: 6px; }
td.actions form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.card.danger { border-color: #f2c3be; }

/* ---- pages on the new account API ---- */
dd .mono, .mono.fine, .compare td { overflow-wrap: anywhere; }
/* bed codes, addresses and MACs never break in a table cell (7105 / 4 was hard to read) */
td.mono { white-space: nowrap; }
table.results td:last-child { min-width: 16em; }
/* connection-detail tables: all columns are short numbers, so no wide last column and no wrapping inside a number */
table.results.flows td:last-child { min-width: 0; }
table.results.flows td, table.results.flows th { white-space: nowrap; }
table.results.usageall td:last-child { min-width: 0; }
table.results.usageall td.num, table.results.usageall th:nth-child(n+4) { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.results.arplist td:last-child { min-width: 0; }
table.results.arplist td { white-space: nowrap; }
table.results.flows td.num { text-align: end; font-variant-numeric: tabular-nums; }
table.results td { overflow-wrap: anywhere; }
table.results th:first-child, table.results td:first-child { white-space: nowrap; }
.newacct { max-width: 640px; }
.newacct fieldset.kinds { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.newacct fieldset.kinds legend { font-weight: 500; padding: 0; margin-bottom: 4px; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.two-fields label { display: grid; gap: 4px; }
table.compare { margin: 12px 0; }
table.compare th { width: 6em; }
.crumbs { margin-bottom: 10px; }
.ou-browser { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: 24px; }
.ou-list { list-style: none; margin: 0; padding: 0; columns: 2 220px; }
.ou-list li { padding: 3px 0; break-inside: avoid; }
.ou-actions form { margin-bottom: 16px; }
@media (max-width: 760px) { .ou-browser { grid-template-columns: 1fr; } .two-fields { grid-template-columns: 1fr; } }
.tree-layout { grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); }
.ou-tree { border-right: 1px solid var(--line); padding-right: 12px; max-height: 70vh; overflow: auto; }
.ou-tree ul { list-style: none; margin: 0; padding-left: 16px; }
.ou-tree > ul { padding-left: 0; }
.ou-tree li { padding: 2px 0; }
.ou-tree .twisty { border: 0; background: none; box-shadow: none; padding: 0 4px 0 0; width: 1.2em; color: var(--muted); cursor: pointer; }
.ou-tree a.here { font-weight: 700; background: var(--accent-100); border-radius: 6px; padding: 0 4px; }
.ou-tree .root { font-weight: 600; }
ul.found { list-style: none; padding: 0; margin: 0; }
ul.found li { padding: 4px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .tree-layout { grid-template-columns: 1fr; } .ou-tree { border-right: 0; max-height: 40vh; } }
/* account search and account page */
.result-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; }
.result-tools .tabs { margin: 0; }
td.states, p.states { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
[data-results][aria-busy="true"], [data-part][aria-busy="true"] { opacity: .6; }
.legend dl { margin: 8px 0; }
.account-head h1 { margin-bottom: 6px; }
.actions-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.systems { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 16px 0; }
.systems .card { margin: 0; }
.systems .card h2 { display: flex; align-items: center; gap: 8px; }
.systems .flash ul { margin: 4px 0; }
a.button.secondary { background: #fff; color: var(--accent-dark); border: 1px solid var(--line-strong); box-shadow: none; padding: 8px 16px; }
a.button.secondary:hover { background: var(--accent-100); color: var(--accent-dark); }
a.button.small { padding: 4px 14px; font-size: .9rem; border-radius: 10px; }
tr.exact td { background: var(--accent-100); }
/* vendor VPN */
.vpn-tools input[type=search] { max-width: 420px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.form-grid input, .form-grid select { width: 100%; box-sizing: border-box; }
.suffix-input { display: flex; align-items: center; gap: 6px; }
.suffix-input input { flex: 1; min-width: 0; }
.suffix-input .muted { white-space: nowrap; font-weight: 400; }
fieldset.period, fieldset.part { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.period legend { font-weight: 650; padding: 0; margin-bottom: 6px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.pill span { display: inline-block; padding: 5px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; font-weight: 550; white-space: nowrap; }
.pill:hover span { background: var(--accent-100); }
.pill input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill input:focus-visible + span { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
.date-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.period-preview { min-height: 1.4em; margin: 6px 0 0; color: var(--accent-dark); }
.custom-hours { display: grid; gap: 10px; margin-top: 8px; }
/* the display: grid/flex rules here would otherwise override the hidden attribute */
.vpn-new [hidden], .vpn-dialog [hidden], .wizard-steps[hidden] { display: none !important; }
.stack label.date-line { display: flex; align-items: center; gap: 8px; }
.stack .date-line input[type=date] { width: auto; }
.hour-range { display: flex; flex-wrap: wrap; gap: 12px; }
.hour-range label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.vpn-new { max-width: 760px; }
.vpn-new .step { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.vpn-new .step:first-of-type, .vpn-new[data-wizard-on] .step { padding-top: 0; border-top: 0; }
.vpn-new .step > h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.1rem; }
.vpn-new .step > h2:focus { outline: none; }
.stack-field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; padding: 0; margin: 0 0 14px; counter-reset: wstep; }
.wizard-steps li { counter-increment: wstep; display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: .92rem; }
.wizard-steps li::before { content: counter(wstep); display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; border: 1px solid var(--line-strong); background: #fff; font-size: .8rem; }
.wizard-steps li.now { color: var(--accent-dark); }
.wizard-steps li.now::before { background: var(--accent); border-color: var(--accent); color: #fff; }
.wizard-steps li.done::before { content: "✓"; background: var(--accent-100); border-color: var(--accent-100); color: var(--accent-dark); }
.wizard-nav { display: flex; gap: 8px; padding-top: 6px; }
.review { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.review dt { color: var(--muted); }
.review dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 600; }
.vpn-tools { align-items: center; gap: 10px; }
.vpn-contact { margin-top: 2px; }
.vpn-note { max-width: 26em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-no { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--accent-100); color: var(--accent-dark); font-size: .85rem; font-weight: 700; }
.form-grid label .fine { font-weight: 400; }
.vpn-buttons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vpn-buttons form { margin: 0; }
.danger-text { color: var(--bad) !important; border-color: #f2c3be !important; }
dialog.vpn-dialog { border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; width: min(640px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(10, 20, 40, .25); }
dialog.vpn-dialog::backdrop { background: rgba(10, 20, 40, .4); }
dialog.vpn-dialog form { display: grid; gap: 14px; }
dialog.vpn-dialog h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.vpn-dialog fieldset.part { display: grid; gap: 12px; }

/* API permits: one bar for the view and the search, projects as small pills, short caller lists */
.permit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 10px 0 6px; }
.permit-bar .tabs { margin: 0; }
.permit-bar input[type=search] { flex: 1 1 260px; max-width: 460px; }
.project-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.project-pills a { padding: 3px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--muted); font-size: .9rem; font-weight: 550; text-decoration: none; }
.project-pills a span { color: var(--muted); font-weight: 400; }
.project-pills a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.project-pills a.on span { color: #fff; }
.permit-everything, .permit-legend { margin: 6px 0; }
.permit-path { white-space: nowrap; }
.permit-chips { gap: 6px; }
.permit-chips .badge { font-size: .85rem; padding: 2px 4px 2px 10px; }
.permit-chips.folded li:nth-child(n+13) { display: none; }
.badge.ip { background: #fff; border: 1px dashed var(--line-strong); font-family: var(--mono, ui-monospace, monospace); }
.permit-add { margin-top: 8px; }
.permit-add summary { display: inline-block; cursor: pointer; color: var(--accent-dark); font-size: .9rem; font-weight: 600; }
.permit-add .add-group { margin-top: 8px; }
button.linkish { padding: 2px 4px; min-height: 0; border: 0; background: none; box-shadow: none; font-size: .9rem; font-weight: 600; text-decoration: underline; cursor: pointer; }
.permit-list td.actions { white-space: nowrap; width: 1%; }
.permit-path .fine { font-family: inherit; white-space: normal; }
/* the new API's callers */
.api-client-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.api-client-head h2 { margin: 0; }
.api-perms { margin: 8px 0; }
.api-client-actions { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.api-client-actions > details { flex: 1 1 420px; }
.api-perm-form { max-width: 760px; }
.api-area { border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px 10px; margin: 0; display: grid; gap: 6px; }
.api-area legend { padding: 0 6px; font-weight: 650; }
.api-area label.inline { font-weight: 500; }
.expiry th.pick, .expiry td.pick { width: 2.2em; text-align: center; }
.stack label.send-other, .send-other { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 600; }
.vpn-new .send-other input { max-width: 22em; }
.api-perms-title { margin: 10px 0 0; color: var(--muted); font-weight: 650; }
.vpn-dialog .stack-field input { max-width: 22em; }
.stack-field .fine { font-weight: 400; }

/* password box while the system generates the password */
input.is-off, input.is-off:focus { background: var(--line, #eee); color: var(--muted, #888); cursor: pointer; }

.service-detail form.inline-form { display: inline-block; margin: 0 0 0 6px; }

/* ---------------------------------------------------------------------------------------------
   stu-dorm-v3 additions
   --------------------------------------------------------------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.card h2 svg, button svg { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* the administrators' search box stays at the top of the page while it scrolls (decision 8) */
.searchbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; margin: -30px -38px 22px; padding: 14px 38px; background: rgba(255, 255, 255, .95); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.searchbar input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 10px; }
@media (max-width: 960px) { .searchbar { margin: 0 0 18px; padding: 10px 0; } }

/* a state: icon and words, never colour alone */
.state { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 7px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; background: #fff; }
.state svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.state.ok { color: var(--ok); border-color: #bfe3cf; background: var(--mint-100); }
.state.lock { color: var(--bad); border-color: #f2c3be; background: #fdeceb; }
.state.warn { color: var(--warn); border-color: #eadc8f; background: #fdf6d3; }
.state.unknown { color: var(--muted); }
.states { display: flex; flex-wrap: wrap; gap: 8px; }

/* a few facts as label and value */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* the student's page: one column, made for a phone */
body.phone { background: var(--frame); }
.phone-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.phone-top .brand { padding: 0; }
.phone-top form { margin: 0; }
.phone-main { max-width: 640px; margin: 0 auto; padding: 18px 16px 8px; }
.phone-main .card { margin-bottom: 14px; }
.phone-main h1 small { display: inline-block; }
.phone-foot { max-width: 640px; margin: 0 auto; padding: 8px 16px 24px; font-size: .78rem; }
button.small, button[type=submit].small { padding: 5px 12px; font-size: .85rem; }

/* ---- usage meters (no inline style: the content security policy refuses it) ---- */
.meter-row { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 8px 0; }
.meter-row progress { width: 100%; height: 12px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; background: var(--soft); overflow: hidden; }
.meter-row progress::-webkit-progress-bar { background: var(--soft); border-radius: 999px; }
.meter-row progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.meter-row progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.alert-card { border-color: #f2c3be; background: #fdeceb; }
.alert-card h2 { color: #9a1f15; display: flex; gap: 6px; align-items: center; }
.alert-card h2 svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; }
table.days td, table.days th { padding: 6px 10px; }
@media (max-width: 720px) {
  table.results thead { display: none; }
  table.results, table.results tbody, table.results tr, table.results td { display: block; width: 100%; }
  table.results tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.results td { border: 0; padding: 2px 12px; }
  table.results td::before { content: attr(data-label) "　"; color: var(--muted, #6b7280); font-size: .85em; }
}

/* ---- student page: status first ---- */
.hello { margin: 0 0 10px; font-weight: 600; }
.status { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--card); box-shadow: var(--shadow); margin-bottom: 14px; }
.status h1 { margin: 0 0 4px; font-size: 1.45rem; }
.status p { margin: 0; }
.status-icon { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--muted); }
.status-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.status-fact { margin-top: 10px !important; font-size: 1.15rem; font-weight: 700; }
.status-fact small { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.status.ok { border-color: #bfe3cf; background: var(--mint-100); }
.status.ok .status-icon { background: #fff; color: var(--ok); }
.status.warn { border-color: #eadc8f; background: var(--peach-100); }
.status.warn .status-icon { background: #fff; color: var(--warn); }
.status.bad { border-color: #f2c3be; background: #fdeceb; }
.status.bad .status-icon { background: #fff; color: var(--bad); }
.status.bad h1 { color: var(--bad); }

.notices h2 { display: flex; align-items: center; gap: 6px; }
.notices h2 svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.notices .count { margin-left: 4px; min-width: 1.5em; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .8rem; text-align: center; }
.notices ul { list-style: none; margin: 0; padding: 0; }
.notice { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.notice:first-child { border-top: 0; padding-top: 0; }
.notice p { margin: 2px 0 0; color: var(--muted); }
.notice-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.notice.warn .notice-icon { color: var(--warn); }
.notice.lock .notice-icon, .notice.bad .notice-icon { color: var(--bad); }
.notice.unknown .notice-icon { color: var(--muted); }

table.days tr.over td { color: var(--bad); font-weight: 600; }
.rules summary { cursor: pointer; font-weight: 600; }
.rules ul { margin: 10px 0 0; padding-left: 20px; }

@media (min-width: 900px) {
  .phone-main { max-width: 960px; }
  .phone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .phone-grid .card { margin-bottom: 0; }
  .phone-grid { margin-bottom: 14px; }
}

/* ---- student header nav, posts ---- */
.phone-top { flex-wrap: wrap; }
.phone-nav { display: flex; gap: 4px; }
.phone-nav a { padding: 6px 10px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; }
.phone-nav a[aria-current="page"] { background: var(--accent-100); color: var(--accent-dark); }
@media (max-width: 560px) {
  .phone-nav { order: 3; width: 100%; justify-content: space-around; border-top: 1px solid var(--line); padding-top: 6px; }
}
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.post-list li:first-child { border-top: 0; }
.post h2 { font-size: 1.3rem; margin: 22px 0 8px; }
.post h3 { font-size: 1.15rem; margin: 18px 0 6px; }
.post h4 { font-size: 1.05rem; margin: 14px 0 4px; }
.post ol, .post ul { padding-left: 1.6em; }
.post li { margin: 6px 0; }
.post code { background: var(--soft); padding: 1px 5px; border-radius: 6px; }
.guides details { border-top: 1px solid var(--line); padding: 10px 0; }
.guides details:first-of-type { border-top: 0; }
.guides summary { cursor: pointer; font-weight: 600; }
.notice a { font-weight: 600; }
.notice-more { margin: 10px 0 0; }

/* ---- admin: issues, object pages ---- */
.issues h2 { display: flex; align-items: center; gap: 6px; }
.issues .count { margin-left: 4px; min-width: 1.5em; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .8rem; text-align: center; }
.issues details { border-top: 1px solid var(--line); padding: 8px 0; }
.issues details:first-of-type { border-top: 0; }
.issues summary { cursor: pointer; font-weight: 600; }
.issues ul { margin: 6px 0 0; padding-left: 20px; }
.crumbs { margin: 0 0 6px; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; padding-top: 0; }

/* ---- admin usage ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
.tabs a { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .9rem; }
.tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs .sep { width: 12px; }
td.bad { color: var(--bad); font-weight: 700; }
table.days tr[aria-current] td { background: var(--accent-100); }
table.hours td { padding: 3px 8px; }
table.hours td progress { width: 60%; height: 10px; vertical-align: middle; margin-right: 6px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; background: var(--soft); }
table.hours progress::-webkit-progress-bar { background: var(--soft); border-radius: 999px; }
table.hours progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
table.hours progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
table.hours progress.out::-webkit-progress-value { background: #6f8fc4; }
table.hours progress.out::-moz-progress-bar { background: #6f8fc4; }
.release { margin-top: 6px; }
.release summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; }
.release form { margin-top: 8px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; }

/* ---- admin start page numbers, filters ---- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.kpi b { font-size: 1.6rem; color: var(--accent-dark); }
.kpi small { color: var(--muted); }
.kpi:hover { border-color: var(--accent-200); }
label.check { flex-direction: row; align-items: center; gap: 6px; }
.port-form { display: flex; gap: 6px; margin-top: 6px; }
.port-form input[type=text] { width: 9em; padding: 4px 8px; }

/* ---- 住宿生名冊 search, 學生頁 status ---- */
.inline-form input[type=search] { flex: 1 1 260px; max-width: 420px; }
/* a search box inside a label (the label is a column): the grow goes on the label, never the height of the box */
.inline-form label.grow { flex: 1 1 260px; max-width: 420px; }
.inline-form label.grow input[type=search] { flex: 0 0 auto; max-width: none; width: 100%; }
.statuses { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 12px; }
.statuses > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.statuses dt { font-size: .85em; color: var(--muted); margin-bottom: 4px; }
.statuses dd { margin: 0; }

/* ---- 印埠標籤 (0.19.0): A4, 2 across and 6 down, 97 x 43 mm each, as dorm2 printed them ---- */
.label-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 12px 32px; }
.label-pick > * { min-width: 0; }
.label-pick .row > input, .label-pick .row > select { flex: 1 1 auto; min-width: 0; width: 100%; }
.label-pick .row > button { flex: none; white-space: nowrap; }
.pick-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.pick-links a { padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; text-decoration: none; color: var(--ink); font-weight: 550; }
.pick-links a:hover { border-color: var(--accent); color: var(--accent-dark); }
.pick-links a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick-links a.on small { color: #dfe7f3; }
.label-pick h2 { margin: 6px 0 0; font-size: .98rem; }
.label-pick .row { margin: 6px 0; }
.label-bar p { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0; }
.label-sheet { display: grid; grid-template-columns: repeat(2, 97mm); grid-auto-rows: 43mm; gap: 4mm; margin: 0 0 18px; }
.port-label {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr; align-content: center; row-gap: 2.5mm;
  padding: 3mm 4mm; background: #fff; color: #000; border: 1px solid #000; overflow: hidden;
}
.pl-cell { display: grid; padding: 0 2mm; line-height: 1.25; border-left: 1px solid #bbb; }
.pl-cell:nth-child(3n+1) { border-left: 0; padding-left: 0; }
.pl-cell:nth-child(-n+3) { padding-bottom: 2.5mm; border-bottom: 1px solid #ccc; }
.pl-cell b { font-size: 10px; }
.pl-cell small { font-size: 8px; color: #555; letter-spacing: .02em; white-space: nowrap; }
.pl-cell span { margin-top: .6mm; font-size: 11px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pl-port span { font-size: 13px; font-weight: 800; }
@media print {
  @page { size: A4; margin: 6mm; }
  html, body { background: #fff !important; }
  .side, .no-print, .flash { display: none !important; }
  .shell { display: block; margin: 0; max-width: none; min-height: 0; border-radius: 0; box-shadow: none; overflow: visible; background: #fff; }
  main.labels-main { padding: 0; }
  .label-sheet { margin: 0; break-after: page; page-break-after: always; }
  .label-sheet:last-child { break-after: auto; page-break-after: auto; }
  .port-label { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- (?) help: the longer explanations stay out of the way until asked for (no script, a <details>) ---- */
.help { display: inline-block; position: relative; vertical-align: middle; margin-left: 6px; font-size: 1rem; font-weight: 400; letter-spacing: 0; }
.help > summary { list-style: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); background: #fff; color: var(--accent-dark); font-size: .8rem; font-weight: 700; cursor: pointer; line-height: 1; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary:hover, .help[open] > summary { background: var(--accent-100); border-color: var(--accent-200); }
.help > div { position: absolute; z-index: 20; left: 0; top: 30px; width: min(440px, 80vw); padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; color: var(--ink); box-shadow: var(--shadow); font-size: .95rem; line-height: 1.65; text-align: left; white-space: normal; }
.help > div p { margin: 0 0 6px; }
.help > div p:last-child { margin-bottom: 0; }
.help > div ul { margin: 4px 0; padding-left: 20px; }
.lead-line { margin: 2px 0 14px; color: var(--muted); }
.help.note { display: block; margin: 6px 0; }
.help.note > summary { display: inline-flex; width: auto; height: auto; padding: 2px 12px; border-radius: 999px; font-size: .88rem; font-weight: 600; gap: 4px; }
.help.note > div { position: static; width: auto; max-width: 760px; margin-top: 6px; box-shadow: none; background: var(--soft); }
/* lists of people: the name, with the student number under it; states as a row of chips */
td.who b { font-weight: 600; }
td.who small { display: block; color: var(--muted); font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips .state { font-size: .8rem; padding: 1px 8px 1px 6px; }
/* a page's first cards side by side on a wide screen, so a record is not one long thin column */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 0 20px; align-items: start; }
dl.facts { font-size: 1.02rem; gap: 8px 20px; }
.statuses dt { font-size: .9rem; }
main { max-width: 1440px; }
.waiting { margin-left: 8px; color: var(--warn); font-size: .92rem; }
.waiting::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .waiting::before { animation: none; } }

/* 0.20.1 the student page: the verdict first, then two columns */
h1.who-head small { margin-left: .6em; font-size: .8em; }
.who-sub { margin: -6px 0 14px; font-size: 1.05rem; }
.verdict { border: 1px solid var(--line-strong); border-left: 6px solid var(--muted); border-radius: var(--radius); background: var(--card); padding: 14px 20px; margin: 0 0 16px; }
.verdict p { margin: 0; }
.verdict .v-main { font-size: 1.2rem; }
.verdict .v-main b { margin-right: .8em; }
.verdict .v-chips { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-top: 8px; color: var(--muted); }
.verdict.ok { border-left-color: var(--ok); }
.verdict.ok .v-main b { color: var(--ok); }
.verdict.warn { border-left-color: #d4b000; background: #fffcef; }
.verdict.warn .v-main b { color: var(--warn); }
.verdict.bad { border-left-color: var(--bad); background: #fff8f7; }
.verdict.bad .v-main b { color: var(--bad); }
.student-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 0 20px; align-items: start; }
.student-cols > .card:first-child, .student-cols > .col > .card:first-child { margin-top: 0; }
dl.checks { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0 0 14px; font-size: 1.02rem; }
dl.checks dt { color: var(--muted); padding-top: 2px; }
dl.checks dd { margin: 0; }
dl.checks dd small { display: block; margin-top: 2px; }
details.card.fold > summary { cursor: pointer; list-style: none; }
details.card.fold > summary::-webkit-details-marker { display: none; }
details.card.fold > summary h2 { display: inline; margin: 0; }
details.card.fold > summary::before { content: "▸ "; color: var(--muted); }
details.card.fold[open] > summary::before { content: "▾ "; }
details.card.fold[open] > summary { margin-bottom: 12px; }
form.row-action { margin: 0; }

/* ---- a switch drawn as its front panel (odd ports on top, even below) ---- */
.face { overflow-x: auto; padding: 12px; background: #eef1f6; border: 2px solid var(--line-strong); border-radius: 10px; max-inline-size: 100%; }
.face-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, 3rem); grid-auto-columns: 3rem; gap: 5px; inline-size: max-content; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; border: 2px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink, #1f2937); font-weight: 700; font-size: .85rem; text-decoration: none; }
.tile small { font-size: .8rem; font-weight: 700; }
a.tile:hover, a.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.tile.link { background: var(--mint-100); color: var(--ok); border-color: #6fbf90; }
.tile.closed { background: #fdeceb; color: var(--bad); border-color: #e0877d; }
.tile.idle { background: #fff; color: #44506a; border-color: #8a97b0; }
.tile.orphan { background: #fdf6d3; color: var(--warn); border-color: #cdb94c; }
.tile.uplink { background: #e3ebfb; color: #27468f; border-color: #7f9bd6; }
.tile.unused { background: #e9ecf2; color: #6b7488; border-style: dashed; }
.tile.unknown { background: #fff; color: #6b7488; border-style: dotted; }
.tile.susp { box-shadow: inset 0 -5px 0 var(--warn); }
.tile.mini { display: inline-flex; inline-size: 1.7rem; block-size: 1.7rem; vertical-align: middle; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 8px 0 12px; font-size: .9rem; }
.portinfo { display: none; margin-top: 14px; padding: 12px 14px; border: 2px solid var(--accent); border-radius: 10px; background: #fff; }
html:not(.inline) .portinfo:target { display: block; }
.portinfo h3 { margin-top: 0; }
.face-block { margin-bottom: 18px; }
.face-block h3 { margin: 0 0 6px; }

/* switch panels: the overview in columns, the port window, the ports a search found */
.face-blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 34rem), 1fr)); gap: 14px 18px; align-items: start; }
.face-blocks .face-block { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-inline-size: 0; }
.tile.hit { outline: 4px solid var(--accent); outline-offset: 1px; }
.port-dialog { inline-size: min(34rem, calc(100vw - 28px)); max-block-size: calc(100vh - 28px); padding: 0; border: 0; border-radius: 16px; background: #fff; color: var(--ink); box-shadow: 0 24px 60px rgba(20, 40, 80, .35); overflow: auto; }
.port-dialog::backdrop { background: rgba(10, 20, 40, .35); }
.port-dialog .inner { padding: 18px 22px 20px; display: grid; gap: 10px; }
.port-dialog .inner > h3 { margin: 0; }
.port-dialog .button-link { display: inline-block; justify-self: start; }

.portinfo.open { display: block; }
.face .tile[aria-current] { outline: 4px solid var(--accent); outline-offset: 1px; }
.graph img { display: block; max-inline-size: 100%; block-size: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.graph-ranges { display: flex; gap: 6px; margin-top: 6px; }
.graph-ranges [aria-pressed="true"] { background: var(--accent); color: #fff; }

/* 換床位 (/admin/change-bed): a room drawn as its beds */
.room-list { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.room-list a { display: inline-flex; gap: .4rem; align-items: baseline; padding: .3rem .6rem; border: 1px solid var(--line-strong); border-radius: 6px; text-decoration: none; background: #fff; }
.room-beds { list-style: none; margin: .75rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .6rem; }
.room-beds .bed { display: flex; flex-direction: column; gap: .2rem; padding: .6rem .7rem; border: 2px solid #6fbf90; border-radius: 8px; background: var(--mint-100); }
.room-beds .bed.empty { background: #fff; border: 2px dashed #8a97b0; }
.room-beds .bed.mover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }
.room-beds .bed.target { border-color: var(--warn); }
.room-beds .who { font-weight: 700; display: flex; flex-direction: column; }
.room-beds .act a { font-weight: 700; }
.room-list a.has-free { border-color: #6fbf90; background: var(--mint-100); }
.room-list a.here { outline: 3px solid var(--accent); }
.level { font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--line-strong); font-weight: 700; }
.level.dorm { background: #fdeceb; color: var(--bad); border-color: #e0877d; }
.level.room { background: #fdf6d3; color: var(--warn); border-color: #cdb94c; }
.level.bed { background: var(--mint-100); color: var(--ok); border-color: #6fbf90; }
.room-picker > summary { cursor: pointer; font-weight: 700; padding: .3rem 0; }
.tabs.floors { flex-wrap: wrap; margin: .5rem 0; }
.tabs.floors small { margin-left: .25rem; opacity: .75; }
.room-list { gap: .35rem; }
.room-list a { padding: .2rem .5rem; }
.step h2 .n { display: inline-flex; width: 1.6rem; height: 1.6rem; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: .95rem; margin-right: .4rem; }
.step h3 { margin: 1rem 0 .3rem; font-size: 1rem; }
.step .now { margin: .6rem 0 0; padding: .6rem .8rem; border-radius: 8px; background: var(--mint-100); border: 1px solid #6fbf90; }

/* 學期開始 (/admin/term) */
.flow { list-style: none; margin: 1rem 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; max-width: 62rem; }
.step-item { padding: 1rem 1.2rem; border: 1px solid var(--line-strong); border-left-width: 6px; border-radius: 8px; background: #fff; }
.step-item.done { border-left-color: #6fbf90; }
.step-item.warn { border-left-color: var(--warn); }
.step-item.todo { border-left-color: #8a97b0; }
.step-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.step-head .n { display: inline-flex; width: 1.6rem; height: 1.6rem; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: .95rem; }
.step-item p { margin: .45rem 0 0; }
.step-item .old { color: var(--muted); }
.step-item details.logic { margin-top: .6rem; }
.step-item details.logic summary { cursor: pointer; font-weight: 600; color: var(--accent-dark); }
.step-item details.logic p { max-width: 60ch; }
.flow-intro { max-width: 62rem; }

/* 繳費檢查: the row that was just checked */
tr.just-checked td { background: var(--mint-100); }
tr.just-checked .just { font-weight: 700; color: var(--ok); }
tr:target td { scroll-margin-top: 4rem; }

/* sortable column headings (床位總表) */
a.sort { color: inherit; text-decoration: none; white-space: nowrap; }
a.sort:hover, a.sort:focus-visible { text-decoration: underline; }
a.sort.on { font-weight: 700; }

/* 套用校務名單: sections apart, the tick columns narrow, one line per row, a box in the header that ticks the whole column */
.apply { display: grid; gap: 20px; }
.apply .card { padding: 18px 20px; }
.apply .card h2 { margin: 0 0 6px; }
.apply .lead { margin: 6px 0 16px; max-width: 62ch; }
.apply table.results th, .apply table.results td { padding: 10px 14px; white-space: nowrap; }
.apply th.pick, .apply td.pick { width: 7.5em; text-align: center; }
.apply .allpick { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.apply .field { display: grid; gap: 4px; margin-top: 16px; max-width: 540px; font-weight: 500; }

/* 操作紀錄: one line for time, who and target; the detail takes the room that is left, one fact to a line */
table.audit th, table.audit td { padding: 10px 14px; vertical-align: top; }
table.audit td:nth-child(1), table.audit td:nth-child(2), table.audit td:nth-child(3), table.audit td:nth-child(5) { white-space: nowrap; }
table.audit td:nth-child(4) { max-width: 14em; overflow-wrap: anywhere; }
table.audit .who-role { display: block; }
table.audit td.detail { min-width: 20em; width: 100%; }
/* the detail as label / value rows: the labels line up and a long value wraps beside its label */
table.audit .kvs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; line-height: 1.5; }
table.audit .kvs b { color: var(--muted); font-weight: 600; }
table.audit .kvs span { overflow-wrap: anywhere; }
table.audit td.src { white-space: nowrap; }
@media (max-width: 860px) { table.audit td.detail { min-width: 0; } table.audit td:nth-child(4) { max-width: none; } }

/* 邏輯說明: under the title of every page, closed until it is wanted */
.logic-doc { margin: 4px 0 16px; max-width: 62rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); padding: 8px 14px; }
.logic-doc > summary { cursor: pointer; font-weight: 600; color: var(--accent-dark); }
.logic-doc dl { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px 14px; margin: 10px 0 4px; }
.logic-doc dt { color: var(--muted); font-weight: 600; }
.logic-doc dd { margin: 0; line-height: 1.65; }
@media (max-width: 640px) { .logic-doc dl { grid-template-columns: 1fr; gap: 2px; } .logic-doc dd { margin-bottom: 8px; } }

/* 系統設定: three cards side by side where there is room, the save button under them */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 20px; max-width: 76rem; align-items: start; }
.settings .card { margin: 0; max-width: none; }
.settings .settings-actions { grid-column: 1 / -1; }

/* 學期開始: the text on the left, the buttons that go to the work on the right */
.step-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; }
.step-item > .release { grid-column: 1 / -1; }
.step-main { min-width: 0; }
.step-go { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 12rem; }
.step-go a.button { padding: 12px 22px; text-align: center; }
a.button.secondary { background: #fff; color: var(--accent-dark); border: 1px solid var(--line-strong); box-shadow: none; }
a.button.secondary:hover { background: var(--accent-100); color: var(--accent-dark); }
@media (max-width: 720px) { .step-item { grid-template-columns: 1fr; } .step-go { min-width: 0; } }

/* the bar above a page reached from the term start */
.flowbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 16px; padding: 10px 16px; border: 1px solid var(--accent-200); border-radius: var(--radius); background: var(--accent-100); }
.flowbar .where { font-weight: 650; color: var(--accent-dark); margin-right: auto; }
.flowbar a { text-decoration: none; font-weight: 600; }
.flowbar a.home { color: var(--muted); }

/* 報修: the new ticket on the left, the student's tickets as cards on the right; one column on a phone */
.repair-grid { display: grid; grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr); gap: 20px; align-items: start; max-width: 80rem; }
.repair-grid .card { margin: 0; max-width: none; }
.repair-new h2, .repair-history h2 { margin: 0 0 4px; }
.facts.compact { grid-template-columns: 6em 1fr; gap: 4px 12px; }
.tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ticket { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; background: #fff; }
.ticket.closed { background: var(--soft); }
.ticket-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ticket-head .ticket-who { margin-left: auto; color: var(--muted); font-size: .92rem; }
.ticket-subject { margin: 8px 0 4px; font-weight: 600; overflow-wrap: anywhere; }
.ticket-meta { margin: 0; }
.ticket-close { margin-top: 10px; }
.ticket-close > summary { cursor: pointer; display: inline-block; color: var(--accent-dark); font-weight: 600; }
.ticket-close .inline-form { margin-top: 8px; }
@media (max-width: 900px) { .repair-grid { grid-template-columns: 1fr; } }

/* a checkbox with its words stays on one line inside a stacked form */
.stack label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.stack label.check input { flex: none; }
[hidden] { display: none !important; }

/* 公告管理 edit page: the text on the left, what is set around it on the right; one column on a phone */
.post-form { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 20px; align-items: start; max-width: 82rem; }
.post-form .card { margin: 0; max-width: none; }
.post-main textarea { width: 100%; min-height: 24rem; line-height: 1.6; }
.post-side { display: grid; gap: 16px; position: sticky; top: 12px; }
.post-side h2 { margin: 0 0 4px; }
.post-actions .buttons { margin: 0 0 6px; }
@media (max-width: 960px) { .post-form { grid-template-columns: 1fr; } .post-side { position: static; } }

/* the English version of an announcement sits under the Chinese one, in the wide column */
.post-form .post-en { grid-column: 1; }
.post-form .post-side { grid-column: 2; grid-row: 1 / span 2; }
.preview-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 20px; max-width: 82rem; margin-top: 20px; }
.preview-pair .card { margin: 0; }
@media (max-width: 960px) { .post-form .post-side { grid-column: 1; grid-row: auto; } }

/* 確認無線群組變動: who goes in beside who goes out */
.wifi-confirm { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 16px; align-items: start; }
.wifi-confirm .tablewrap { max-height: 28rem; overflow: auto; }
