/* 学员课表 · 个人版
   视觉方向：排课板 / 台账。细线分栏、宋体数字，科目色只用来编码信息。 */

:root {
  --paper: #F1F2EC;
  --paper-deep: #E9EBE2;
  --panel: #FCFCF7;
  --ink: #182430;
  --ink-2: #3D4B58;
  --muted: #7A8794;
  --muted-2: #9AA5B0;
  --line: #E1E4DB;
  --line-2: #C9D0C4;
  --petrol: #1E3A46;
  --petrol-2: #2B4F5E;
  --brass: #9A7434;
  --red: #A93E2C;
  --amber: #8E6219;
  --green: #2C6B52;

  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;

  --rail: 92px;
  --day-min: 88px;
  --weekend-min: 240px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 2px solid var(--petrol-2); outline-offset: 2px; }

/* ── 顶栏 ─────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 18px 30px 16px;
  background: var(--paper);
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.seal {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--petrol);
  color: #F4F2E7;
  font: 600 24px/1 var(--serif);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  flex: none;
}

.brand-text h1 {
  margin: 0;
  font: 600 25px/1.15 var(--serif);
  letter-spacing: .04em;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
}

.tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search {
  display: flex; align-items: center; gap: 8px;
  width: 230px;
  padding: 0 12px;
  height: 36px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 3px;
}
.search svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 1.6; flex: none; }
.search input {
  border: 0; background: none; outline: none;
  width: 100%; min-width: 0; font-size: 13px;
}
.search input::placeholder { color: var(--muted-2); }
.search:focus-within { border-color: var(--petrol-2); box-shadow: 0 0 0 3px rgba(43,79,94,.09); }

.btn {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--panel);
  font-size: 13px;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: #fff; border-color: var(--muted-2); color: var(--ink); }
.btn-primary { background: var(--petrol); border-color: var(--petrol); color: #F5F3E9; }
.btn-primary:hover { background: var(--petrol-2); border-color: var(--petrol-2); color: #fff; }
.btn-quiet { background: transparent; }
.btn-danger-quiet { background: transparent; color: var(--red); border-color: rgba(169,62,44,.32); }
.btn-danger-quiet:hover { background: #FBF0EC; border-color: var(--red); color: var(--red); }

/* ── 台账栏：视图标签 + 数字 ─────────────── */

.ledger {
  display: flex; align-items: flex-end;
  gap: 24px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line-2);
  background: var(--paper);
}

.tabs { display: flex; gap: 2px; flex: none; }
.tabs a {
  display: block;
  padding: 10px 13px 11px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .03em;
}
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--petrol); font-weight: 600; }

.kpis { margin-left: auto; display: flex; align-items: stretch; padding-bottom: 9px; }
.kpi { display: flex; align-items: baseline; gap: 5px; padding: 0 14px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi .v { font: 600 17px/1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.kpi .l { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.kpi.alert .v { color: var(--red); }
.kpi.ok .v { color: var(--green); }

/* ── 主体 ─────────────────────────────── */

main {
  flex: 1;
  overflow: auto;
  padding: 22px 30px 40px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.view[hidden] { display: none; }

/* ── 课表（桌面） ──────────────────────── */

.board-head { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 10px; }
.board-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.legend { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 11.5px; color: var(--muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw { width: 9px; height: 9px; border-radius: 1px; }

.board-wrap { border: 1px solid var(--line-2); border-radius: 4px; overflow: auto; background: var(--panel); }

.board {
  display: grid;
  grid-template-columns:
    var(--rail)
    repeat(4, minmax(var(--day-min), .6fr))
    minmax(150px, .95fr)
    minmax(var(--weekend-min), 2.9fr)
    minmax(var(--weekend-min), 2.9fr);
  grid-auto-rows: minmax(96px, auto);
  min-width: 900px;
  background: var(--line);
}

.bh {
  position: sticky; top: 0;
  z-index: 3;
  display: flex; flex-direction: column; justify-content: center;
  gap: 2px;
  padding: 9px 10px 8px;
  background: var(--petrol);
  color: #EDEBDD;
  font: 600 13.5px/1.2 var(--serif);
  letter-spacing: .07em;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,.12);
  border-bottom: 1px solid var(--petrol);
}
.bh.weekend { background: var(--petrol-2); }
.bh .n { font: 400 10.5px/1 var(--sans); letter-spacing: .02em; color: rgba(237,235,221,.62); }
.bh .n.has { color: #E4C98D; }

.bh.corner {
  left: 0;
  z-index: 5;
  text-align: left;
  padding-left: 14px;
  letter-spacing: .12em;
  font-size: 12px;
  color: rgba(237,235,221,.8);
}

.rail {
  position: sticky; left: 0;
  z-index: 2;
  display: flex; flex-direction: column; justify-content: center;
  gap: 1px;
  padding: 8px 12px;
  background: var(--paper-deep);
  border-right: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.rail .t1 { font: 600 15px/1.2 var(--serif); letter-spacing: .03em; color: var(--ink-2); }
.rail .t2 { font-size: 11px; color: var(--muted); letter-spacing: .02em; }

.cell {
  position: relative;
  padding: 4px;
  container-type: inline-size;
  background: #F7F8F2;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cell.weekend { background: #FDFDF8; }

.cell-add {
  position: absolute; inset: 4px;
  display: grid; place-items: center;
  border: 1px dashed transparent;
  border-radius: 2px;
  background: none;
  color: var(--muted-2);
  font-size: 17px;
  opacity: 0;
  transition: opacity .12s, border-color .12s, color .12s;
}
.cell:hover .cell-add, .cell-add:focus-visible { opacity: 1; border-color: var(--line-2); }
.cell-add:hover { border-color: var(--petrol-2); color: var(--petrol); background: #fff; }

.cell-add-mini {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 0; border-radius: 2px;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 13px; line-height: 1;
  opacity: 0;
  transition: opacity .12s;
}
.cell:hover .cell-add-mini, .cell-add-mini:focus-visible { opacity: 1; }
.cell-add-mini:hover { background: var(--petrol); color: #fff; }

/* 课次 */

.ent {
  --s: var(--petrol);
  --st: #EFF1EA;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 10px;
  margin: 0 0 3px;
  padding: 4px 8px 5px 9px;
  border: 0;
  border-left: 3px solid var(--s);
  border-radius: 2px;
  background: var(--st);
  text-align: left;
  transition: background .12s, box-shadow .12s;
}
.ent:last-child { margin-bottom: 0; }
.ent:hover { background: #fff; box-shadow: 0 0 0 1px var(--s), 0 1px 3px rgba(24,36,48,.07); }
.ent.is-rel { box-shadow: 0 0 0 1.5px var(--brass), 0 2px 6px rgba(24,36,48,.1); }
.ent.dim { opacity: .2; }

.ent-main { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ent-main b { font-size: 13.5px; font-weight: 600; letter-spacing: .02em; color: var(--ink); white-space: nowrap; }
.ent-cls {
  font-size: 10px; line-height: 1.5;
  padding: 0 4px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  letter-spacing: .04em;
  flex: none;
}
.ent-flag {
  font-size: 10px; line-height: 1.5;
  padding: 0 4px;
  border: 1px solid rgba(169,62,44,.28);
  border-radius: 2px;
  background: rgba(169,62,44,.07);
  color: var(--red);
  flex: none;
  white-space: nowrap;
}
.ent-meta {
  min-width: 0;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@container (max-width: 215px) {
  .ent { grid-template-columns: 1fr; row-gap: 1px; }
  .ent-meta { text-align: left; }
}

/* 科目配色（网格与手机共用） */
.ent[data-subject="数学"], .ag-card[data-subject="数学"] { --s: #2F5FA8; --st: #EDF2FA; }
.ent[data-subject="语文"], .ag-card[data-subject="语文"] { --s: #A1651C; --st: #FAF3E7; }
.ent[data-subject="英语"], .ag-card[data-subject="英语"] { --s: #2C7A5E; --st: #EAF4EF; }
.ent[data-subject="物理"], .ag-card[data-subject="物理"] { --s: #6A4C93; --st: #F1EDF8; }
.ent[data-subject="化学"], .ag-card[data-subject="化学"] { --s: #A03D51; --st: #FAEEF1; }

/* ── 课表（手机：按天排） ───────────────── */

.agenda { display: none; }
.scroll-hint { display: none; margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.ag-run {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
  border-radius: 3px;
  color: var(--muted);
  font-size: 12.5px;
}
.ag-run em { font-style: normal; font-size: 11px; color: var(--muted-2); }

.ag-day { margin-bottom: 22px; }
.ag-day-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 2px 8px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-2);
}
.ag-name { font: 600 17px/1.2 var(--serif); letter-spacing: .06em; }
.ag-count { font-size: 11.5px; color: var(--muted); }
.ag-add {
  margin-left: auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--panel);
  font-size: 16px; line-height: 1;
  color: var(--muted);
}
.ag-add:hover { color: var(--petrol); border-color: var(--petrol-2); }

.ag-block { padding-top: 12px; }
.ag-time {
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.ag-time b { font: 600 13.5px/1 var(--serif); color: var(--ink-2); letter-spacing: .03em; }
.ag-time span { font-size: 11px; color: var(--muted); }

.ag-items { display: flex; flex-direction: column; gap: 6px; }

.ag-card {
  --s: var(--petrol);
  --st: #EFF1EA;
  display: flex; flex-direction: column; gap: 3px;
  width: 100%;
  min-height: 50px;
  padding: 9px 12px 10px;
  border: 0;
  border-left: 3px solid var(--s);
  border-radius: 4px;
  background: var(--st);
  text-align: left;
}
.ag-card:active { background: #fff; }
.ag-top { display: flex; align-items: center; gap: 7px; }
.ag-top b { font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.ag-subj { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--s); }
.ag-bot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* ── 章节标题 ─────────────────────────── */

.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font: 600 19px/1.2 var(--serif); letter-spacing: .05em; }
.section-note { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ── 表格 ─────────────────────────────── */

.table-wrap {
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--panel);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px; font-weight: 500;
  color: var(--muted);
  letter-spacing: .04em;
  background: var(--paper);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #F6F7F0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.num { text-align: right; }
.tbl .name { font-weight: 600; letter-spacing: .02em; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td:first-child .name { text-decoration: underline; text-underline-offset: 3px; }
.tbl .sub { color: var(--muted); font-size: 12px; }
.tbl .nowrap { white-space: nowrap; }
.tbl-data td { font-size: 13px; }
.tbl-data .ops { display: flex; gap: 4px; justify-content: flex-end; }

.icon-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 2px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--muted);
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted-2); background: #fff; }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); background: #FBF0EC; }

.chip {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .04em;
  background: rgba(255,255,255,.7);
  white-space: nowrap;
}
.chip.warn { color: var(--red); border-color: rgba(169,62,44,.3); background: #FBF0EC; }
.chip.amber { color: var(--amber); border-color: rgba(142,98,25,.3); background: #FBF4E6; }
.chip.ok { color: var(--green); border-color: rgba(44,107,82,.3); background: #EDF5F0; }

.subject { white-space: nowrap; }
.subject i { display: inline-block; width: 8px; height: 8px; border-radius: 1px; margin-right: 4px; vertical-align: 1px; }

/* ── 检查 ─────────────────────────────── */

.issue-group { margin-bottom: 26px; }
.issue-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-2);
}
.issue-head h3 { margin: 0; font: 600 15px/1.3 var(--serif); letter-spacing: .05em; }
.issue-head span { font-size: 12px; color: var(--muted); }

.issue {
  border-left: 3px solid var(--line-2);
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--panel);
  border-radius: 0 3px 3px 0;
}
.issue.bad { border-left-color: var(--red); background: #FCF3EF; }
.issue.warn { border-left-color: var(--brass); background: #FBF7EC; }
.issue.info { border-left-color: var(--petrol-2); background: #F3F6F4; }
.issue h4 { margin: 0 0 3px; font-size: 13.5px; font-weight: 600; }
.issue p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.issue .refs { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; }
.issue .refs button {
  border: 1px solid rgba(24,36,48,.14);
  background: rgba(255,255,255,.75);
  border-radius: 2px;
  padding: 2px 7px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.issue .refs button:hover { background: #fff; border-color: var(--ink-2); }

.empty {
  padding: 34px 20px;
  text-align: center;
  border: 1px dashed var(--line-2);
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
}
.empty strong { display: block; font: 600 16px/1.4 var(--serif); color: var(--green); margin-bottom: 4px; letter-spacing: .04em; }
.empty p { margin: 0; font-size: 12.5px; }
.empty .rules { margin: 14px auto 0; padding: 0; list-style: none; max-width: 520px; text-align: left; font-size: 12.5px; }
.empty .rules li { padding: 4px 0 4px 18px; position: relative; color: var(--ink-2); }
.empty .rules li::before { content: "·"; position: absolute; left: 6px; color: var(--muted); }

/* ── 数据 ─────────────────────────────── */

.data-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.saved { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ── 抽屉 ─────────────────────────────── */

.drawer {
  position: fixed; inset: 0;
  z-index: 40;
  display: flex; justify-content: flex-end;
  background: rgba(24,36,48,.22);
}
.drawer[hidden] { display: none; }
body.drawer-open { overflow: hidden; }
.drawer-panel {
  position: relative;
  width: min(430px, 92vw);
  height: 100%;
  overflow: auto;
  background: var(--panel);
  border-left: 1px solid var(--line-2);
  padding: 26px 24px 40px;
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(18px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 3px;
  font-size: 18px; line-height: 1;
  color: var(--muted);
}
.drawer-close:hover { color: var(--ink); border-color: var(--muted-2); }

.dw-title { margin: 0 0 2px; font: 600 23px/1.2 var(--serif); letter-spacing: .04em; padding-right: 36px; }
.dw-sub { margin: 0 0 16px; font-size: 12.5px; color: var(--muted); }
.dw-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.dw-sec { margin-top: 20px; }
.dw-sec h3 {
  margin: 0 0 8px;
  font: 600 12px/1.4 var(--sans);
  letter-spacing: .08em;
  color: var(--muted);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.dw-day { margin-bottom: 12px; }
.dw-day > .d { font: 600 13px/1.6 var(--serif); letter-spacing: .08em; color: var(--ink-2); margin-bottom: 4px; }
.dw-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
}
.dw-item:first-of-type { border-top: 0; }
.dw-item .tm { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.dw-item .ct b { font-weight: 600; }
.dw-item .ct span { color: var(--muted); }

/* ── 弹窗 ─────────────────────────────── */

.dlg {
  width: min(560px, 94vw);
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(24,36,48,.22);
  overflow: auto;
  max-height: 92vh;
}
.dlg::backdrop { background: rgba(24,36,48,.3); }
.dlg form { padding: 24px; }
.dlg h2 { margin: 0 0 18px; font: 600 20px/1.2 var(--serif); letter-spacing: .05em; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); letter-spacing: .03em; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid input, .form-grid select {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  outline: none;
}
.form-grid input:focus, .form-grid select:focus { border-color: var(--petrol-2); box-shadow: 0 0 0 3px rgba(43,79,94,.09); }

.form-hint { min-height: 18px; margin: 12px 0 0; font-size: 12.5px; color: var(--red); }
.dlg-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.dlg-actions .spacer { flex: 1; }
#btnDelete[hidden] { display: none; }

/* ── 提示条 ───────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: var(--petrol);
  color: #F3F1E6;
  border-radius: 3px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(24,36,48,.22);
  max-width: 92vw;
}
.toast[hidden] { display: none; }
.toast-undo {
  border: 1px solid rgba(243,241,230,.35);
  background: transparent;
  color: #E4C98D;
  border-radius: 2px;
  padding: 2px 9px;
  font-size: 12.5px;
}
.toast-undo:hover { background: rgba(255,255,255,.1); }

/* ── 窄屏 ─────────────────────────────── */

@media (max-width: 1180px) {
  .topbar { gap: 16px; padding: 14px 18px; }
  .search { width: 190px; }
  .ledger { padding: 0 18px; gap: 12px; }
  .kpi { padding: 0 9px; }
  main { padding: 16px 18px 32px; }
}

/* 手机：日程视图 + 底部导航 */
@media (max-width: 860px) {
  body { overflow: auto; display: block; }

  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px 12px;
    padding: 12px 16px 10px;
  }
  .brand { grid-column: 1; }
  .brand-text h1 { font-size: 22px; }
  .brand-text p { font-size: 11.5px; }
  .seal { width: 34px; height: 34px; font-size: 21px; }
  .tools { display: contents; }
  .search { grid-column: 1 / -1; grid-row: 2; width: 100%; height: 40px; }
  #btnAdd { grid-column: 2; grid-row: 1; height: 36px; padding: 0 12px; font-size: 13px; }
  #btnPrint { display: none; }

  .ledger {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    padding: 0 0 env(safe-area-inset-bottom);
    border-top: 1px solid var(--line-2);
    border-bottom: 0;
    background: var(--panel);
    align-items: stretch;
    gap: 0;
  }
  .tabs { width: 100%; justify-content: space-around; gap: 0; }
  .tabs a {
    padding: 13px 6px 12px;
    margin-bottom: 0;
    font-size: 12.5px;
    border-bottom: 0;
    border-top: 2px solid transparent;
    text-align: center;
    flex: 1;
  }
  .tabs a.on { border-top-color: var(--petrol); border-bottom-color: transparent; }
  .kpis { display: none; }

  main { overflow: visible; padding: 14px 16px 96px; }

  .board-wrap { display: none; }
  .scroll-hint { display: none; }
  .agenda { display: block; }
  .board-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .legend { margin-left: 0; flex-wrap: wrap; row-gap: 6px; }

  .section-head { flex-direction: column; gap: 4px; }
  .tbl { font-size: 13px; }
  .tbl th { padding: 9px 10px; }
  .tbl td { padding: 12px 10px; }
  .tbl .sm-hide { display: none; }
  .tbl-data td { font-size: 12.5px; }

  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-grid input, .form-grid select { font-size: 16px; height: 44px; }

  /* 手机上排课弹窗占满屏，字段区滚动，保存键固定在最下面 */
  .dlg {
    width: 100vw; max-width: 100vw;
    height: 100vh; height: 100dvh;
    max-height: 100vh; max-height: 100dvh;
    margin: 0; border: 0; border-radius: 0;
    position: fixed; inset: 0;
    overflow: hidden;
  }
  .dlg form {
    height: 100%;
    display: flex; flex-direction: column;
    padding: 16px 16px calc(12px + env(safe-area-inset-bottom));
    overflow: hidden;
  }
  .dlg h2 { flex: none; font-size: 18px; margin-bottom: 12px; padding-right: 30px; }
  .form-grid {
    flex: 1; min-height: 0;
    overflow-y: auto;
    padding: 2px 2px 10px;
    -webkit-overflow-scrolling: touch;
  }
  .form-hint { flex: none; margin: 6px 0 0; }
  .dlg-actions {
    flex: none;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }
  .dlg-actions .btn { height: 44px; }

  .drawer-panel { width: 100%; padding: 22px 18px 40px; }
  .toast { bottom: 84px; }

  .empty { padding: 26px 16px; }
  .issue { padding: 10px 12px; }
}

@media (max-width: 420px) {
  .legend { font-size: 11px; gap: 10px; }
  .ag-name { font-size: 16px; }
  .dw-item { grid-template-columns: 82px 1fr; }
}

/* ── 不能自动保存时的提示 ─────────────── */

.storage-bar {
  position: fixed;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 14px;
  background: #FBF4E6;
  border: 1px solid rgba(142,98,25,.35);
  border-radius: 4px;
  color: var(--amber);
  font-size: 12.5px;
  box-shadow: 0 6px 20px rgba(24,36,48,.12);
  max-width: 92vw;
}
.storage-bar[hidden] { display: none; }
.storage-bar button {
  border: 1px solid rgba(142,98,25,.45);
  background: #fff;
  color: var(--amber);
  border-radius: 3px;
  padding: 3px 9px;
  font-size: 12px;
  white-space: nowrap;
}

/* ── 登录 ─────────────────────────────── */

.login {
  position: fixed; inset: 0;
  z-index: 80;
  display: grid; place-items: center;
  padding: 24px;
  background: var(--paper);
}
.login[hidden] { display: none; }
.login-card {
  width: min(340px, 100%);
  display: flex; flex-direction: column; gap: 12px;
  padding: 28px 24px 22px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(24,36,48,.12);
}
.login-card .seal { width: 44px; height: 44px; font-size: 27px; margin-bottom: 2px; }
.login-card h2 { margin: 0; font: 600 22px/1.2 var(--serif); letter-spacing: .05em; }
.login-card p { margin: 0; font-size: 12.5px; color: var(--muted); }
.login-card input {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: #fff;
  font-size: 16px;
}
.login-card input:focus { outline: none; border-color: var(--petrol-2); box-shadow: 0 0 0 3px rgba(43,79,94,.09); }
.login-card .btn { height: 44px; margin-top: 2px; }
.login-hint { min-height: 16px; font-size: 12.5px; color: var(--red); }

/* ── 打印 ─────────────────────────────── */

@media print {
  @page { size: A4 landscape; margin: 6mm; }
  html, body { overflow: visible; height: auto; background: #fff; }
  .topbar { padding: 0 0 4px; }
  .brand-text h1 { font-size: 18px; }
  .brand-text p { display: none; }
  .seal { width: 28px; height: 28px; font-size: 18px; }
  .tools, .tabs, .kpis, .board-head .legend, .drawer, .toast, .cell-add, .cell-add-mini, .agenda, .scroll-hint, .storage-bar, .login { display: none !important; }
  .ledger { position: static; border-bottom: 1px solid #999; padding: 0; background: #fff; }
  main { overflow: visible; padding: 6px 0 0; }
  .board-head { margin-bottom: 4px; }
  .board-note { font-size: 10px; }
  .board-wrap { display: block !important; border-color: #999; overflow: visible; zoom: .75; }
  .board {
    min-width: 0;
    grid-template-columns: 66px repeat(4, .5fr) .85fr 2.5fr 2.5fr;
    grid-auto-rows: minmax(70px, auto);
  }
  .bh, .rail { position: static; }
  .bh { padding: 5px 6px; font-size: 11px; }
  .bh .n { font-size: 8.5px; }
  .rail .t1 { font-size: 11px; }
  .rail .t2 { font-size: 9px; }
  .ent { padding: 2px 5px 3px 6px; margin-bottom: 2px; break-inside: avoid; }
  .ent-main b { font-size: 11px; }
  .ent-cls, .ent-flag { font-size: 8px; }
  .ent-meta { font-size: 9px; }
  .bh {
    background: #fff !important;
    color: #1E3A46;
    border-bottom: 1.5px solid #1E3A46;
    border-right: 1px solid #B7C0B6;
  }
  .bh .n { color: #5C6A76; }
  .bh.corner { color: #1E3A46; }
  .ent, .chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl th { position: static; }
  .view[hidden] { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
