/* 兮郗好学库 —— 学习工作台样式表
   浅色主题 / 卡片式 / 无外部依赖 */

:root {
  --bg: #eef3fb;
  --bg-2: #f7faff;
  --panel: #ffffff;
  --line: #e4ecf8;
  --line-2: #eef3fa;
  --text: #17233c;
  --text-2: #43516e;
  --muted: #8996ae;
  --brand: #2f6fed;
  --brand-2: #5b8def;
  --brand-soft: #e9f0ff;
  --ok: #16a34a;
  --ok-soft: #e7f7ed;
  --warn: #e58a2b;
  --warn-soft: #fdf1e2;
  --danger: #e0524b;
  --danger-soft: #fdeceb;
  --shadow: 0 1px 2px rgba(23, 51, 108, .04), 0 6px 18px rgba(23, 51, 108, .06);
  --shadow-lg: 0 12px 40px rgba(23, 51, 108, .14);
  --r: 16px;
  --r-sm: 10px;
  --sidebar: 196px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
::selection { background: #cfe0ff; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd8ee; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b3c5e4; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-right: 1px solid var(--line);
  padding: 18px 12px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 10px; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4b8bf5, #2f6fed 55%, #7a5cf0);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 14px rgba(47, 111, 237, .28);
  letter-spacing: -1px;
}
.brand-txt { line-height: 1.25; }
.brand-txt b { display: block; font-size: 15.5px; letter-spacing: .5px; }
.brand-txt span { font-size: 11px; color: var(--muted); letter-spacing: .6px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 13.5px;
  transition: .16s;
  position: relative;
}
.nav a svg { flex: 0 0 18px; opacity: .78; }
.nav a:hover { background: #f2f6fd; color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav a.on svg { opacity: 1; }
.nav a.on::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav .badge-count {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: #ffefe8; color: #d9603a; border-radius: 20px; padding: 1px 7px;
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.mode-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; padding: 7px 10px; border-radius: 9px;
  background: #f4f7fd; color: var(--muted); border: 1px solid var(--line-2);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: 0 0 7px; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.off { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 26px;
  background: rgba(238, 243, 251, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(228, 236, 248, .9);
}
.topbar h1 { font-size: 19px; margin: 0; letter-spacing: .3px; font-weight: 700; }
.topbar .sub { font-size: 12px; color: var(--muted); margin-left: 2px; }
.topbar .spacer { flex: 1; }

.switch {
  display: flex; padding: 3px; gap: 2px;
  background: #e3ecfa; border-radius: 12px;
}
.switch button {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px; border-radius: 9px;
  font-size: 13px; color: #5a6b88; font-weight: 500;
  transition: .18s;
}
.switch button .av {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: #a9b8d1;
}
.switch button.on {
  background: #fff; color: var(--text);
  box-shadow: 0 1px 4px rgba(23, 51, 108, .12);
  font-weight: 700;
}
.switch button.on .av { background: linear-gradient(135deg, #4b8bf5, #2f6fed); }
.switch button small { font-size: 10.5px; color: var(--muted); font-weight: 500; margin-left: 1px; }

.content { padding: 20px 26px 40px; max-width: 1500px; width: 100%; }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--panel);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  border: 1px solid rgba(228, 236, 248, .7);
  padding: 16px 18px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.card-head .ico {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); flex: 0 0 26px;
}
.card-head .more { margin-left: auto; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
.card-head .more:hover { color: var(--brand); }

.grid { display: grid; gap: 14px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-hero { grid-template-columns: 1.55fr 1fr; }

/* ---------- 顶部横幅 ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 18px;
  padding: 20px 24px;
  background: linear-gradient(115deg, #2f6fed 0%, #4c86f3 46%, #7f9df7 100%);
  color: #fff;
  display: flex; align-items: center; gap: 22px;
  box-shadow: 0 10px 30px rgba(47, 111, 237, .26);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.28), transparent 62%);
}
.hero::before {
  content: ""; position: absolute; right: 120px; bottom: -110px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.14), transparent 65%);
}
.hero-main { position: relative; z-index: 1; flex: 1; min-width: 0; }
.hero h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.hero p { margin: 0; font-size: 13px; opacity: .92; }
.hero-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hero-tags span {
  font-size: 11.5px; padding: 3px 10px; border-radius: 20px;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .26);
  backdrop-filter: blur(4px);
}
.hero-score { position: relative; z-index: 1; display: flex; gap: 18px; text-align: center; }
.hero-score div b { display: block; font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -.5px; }
.hero-score div span { font-size: 11.5px; opacity: .86; }

/* ---------- KPI 卡 ---------- */
.kpi {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 14px; padding: 14px 16px;
  box-shadow: var(--shadow); border: 1px solid rgba(228, 236, 248, .7);
  transition: .18s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 40px;
}
.kpi-body { min-width: 0; }
.kpi-body .lab { font-size: 11.5px; color: var(--muted); }
.kpi-body .val { font-size: 22px; font-weight: 800; line-height: 1.15; letter-spacing: -.5px; }
.kpi-body .val small { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.kpi-body .tip { font-size: 11px; color: var(--muted); }

/* ---------- 科目条 ---------- */
.subj-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.subj-row .nm { width: 52px; font-size: 12.5px; color: var(--text-2); flex: 0 0 52px; }
.bar { flex: 1; height: 9px; border-radius: 6px; background: #f0f4fb; overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; border-radius: 6px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
/* 无分数科目：用斜纹条表示「错题相对数量」，避免与得分率混淆 */
.bar i.err {
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .6) 0 4px, transparent 4px 8px) !important;
}
.subj-row .sc { width: 62px; text-align: right; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.subj-row .sc b { font-size: 13px; }

/* ---------- 科目卡片网格 ---------- */
.subj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.subj-card {
  background: #fff; border-radius: 14px; padding: 15px 16px;
  box-shadow: var(--shadow); border: 1px solid rgba(228, 236, 248, .7);
  cursor: pointer; transition: .18s; position: relative; overflow: hidden;
}
.subj-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.subj-card .top { display: flex; align-items: center; gap: 10px; }
.subj-card .em {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-size: 14px; font-weight: 800; color: #fff; flex: 0 0 34px;
}
.subj-card h4 { margin: 0; font-size: 14.5px; font-weight: 700; }
.subj-card .meta { font-size: 11px; color: var(--muted); }
.subj-card .nums { display: flex; gap: 14px; margin-top: 12px; }
.subj-card .nums div { font-size: 11px; color: var(--muted); }
.subj-card .nums b { display: block; font-size: 16px; color: var(--text); font-weight: 800; line-height: 1.3; }
.subj-card .nums b.dim { color: #c8d2e2; font-weight: 600; }
.subj-card .bar { margin-top: 10px; height: 6px; }
.subj-card .lock {
  position: absolute; top: 12px; right: 12px; font-size: 10.5px;
  background: var(--warn-soft); color: #a9661d; padding: 2px 8px; border-radius: 20px;
}

/* ---------- 错题卡 ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 14px;
}
.chip {
  font-size: 12px; padding: 5px 12px; border-radius: 20px;
  background: #fff; border: 1px solid var(--line); color: var(--text-2);
  transition: .15s;
}
.chip:hover { border-color: #c9d9f5; background: #f8fbff; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip .n { opacity: .6; font-size: 11px; margin-left: 3px; }
.filter-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.search-box {
  margin-left: auto; display: flex; align-items: center; gap: 7px;
  background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px;
}
.search-box input { border: none; outline: none; font-size: 12.5px; width: 150px; background: transparent; color: var(--text); }

.mistake-list { display: flex; flex-direction: column; gap: 10px; }
.mk {
  background: #fff; border-radius: 13px; border: 1px solid rgba(228, 236, 248, .9);
  box-shadow: 0 1px 2px rgba(23,51,108,.03);
  padding: 13px 16px; display: flex; gap: 14px; align-items: flex-start;
  cursor: pointer; transition: .16s; position: relative;
}
.mk:hover { border-color: #cfe0fb; box-shadow: 0 6px 18px rgba(23,51,108,.08); }
.mk-no {
  flex: 0 0 auto; min-width: 46px; max-width: 92px; text-align: center;
  font-size: 13px; font-weight: 800; color: var(--brand);
  background: var(--brand-soft); border-radius: 9px; padding: 6px 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mk-body { flex: 1; min-width: 0; }
.mk-title { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.mk-sub { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mk-tags { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.tag {
  font-size: 10.5px; padding: 2px 8px; border-radius: 6px;
  background: #f2f6fd; color: #5d6d8a; border: 1px solid #e8effa;
  max-width: 100%; white-space: normal; word-break: break-word; line-height: 1.5;
}
.tag.cause { background: var(--danger-soft); color: #b8433c; border-color: #f9d9d6; }
.tag.kp { background: #eef6ff; color: #2f6fed; border-color: #dbeaff; }
.tag.diff-难 { background: #fdecec; color: #c0392b; border-color: #f8d7d3; }
.tag.diff-中 { background: #fff6e6; color: #b4741a; border-color: #fae6c7; }
.tag.diff-易 { background: #eaf8ef; color: #1a7f43; border-color: #d3f0dd; }
.mk-state { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.state-pill {
  font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600;
  background: #f4f7fd; color: #7a89a3; border: 1px solid var(--line);
}
.state-pill.mastered { background: var(--ok-soft); color: #15803d; border-color: #cdeedb; }
.state-pill.review { background: var(--warn-soft); color: #a9661d; border-color: #f6e0c2; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; padding: 46px 20px; color: var(--muted);
}
.empty .em-ico { font-size: 30px; opacity: .5; margin-bottom: 8px; }
.empty p { margin: 4px 0; font-size: 13px; }
.empty .hint { font-size: 12px; color: #a8b4c8; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 33, 58, .42);
  backdrop-filter: blur(3px); z-index: 100;
  display: grid; place-items: center; padding: 24px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 18px; width: min(920px, 100%);
  max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
  position: sticky; top: 0; background: #fff; z-index: 2; border-radius: 18px 18px 0 0;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; color: var(--muted); font-size: 18px;
}
.modal-head .x:hover { background: #f2f6fd; color: var(--text); }
.modal-body { padding: 18px 20px 22px; }

.field { margin-bottom: 15px; }
.field > .k {
  font-size: 11.5px; color: var(--muted); margin-bottom: 5px;
  display: flex; align-items: center; gap: 5px; letter-spacing: .3px;
}
.field > .v {
  font-size: 13.5px; color: var(--text-2); line-height: 1.75;
  background: #fafcff; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 13px;
  white-space: pre-wrap; word-break: break-word;
}
.field.wrong > .v { background: #fef7f6; border-color: #f9e0dd; }
.field.right > .v { background: #f6fdf8; border-color: #d9f0e2; }
.field .v em { font-style: normal; color: var(--danger); font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.img-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.img-strip figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f7f9fd; }
.img-strip img { width: 100%; max-height: 260px; object-fit: cover; object-position: top center; display: block; cursor: zoom-in; background: #eef2f8; }
.img-strip img:hover { opacity: .92; }
.img-strip figcaption { font-size: 11px; color: var(--muted); padding: 5px 8px; }

/* ---------- 试卷浏览 ---------- */
.viewer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; padding: 7px 14px; border-radius: 9px;
  background: var(--brand); color: #fff; font-weight: 600;
  transition: .16s;
}
.btn:hover { background: #255ed6; }
.btn.ghost { background: #fff; color: var(--text-2); border: 1px solid var(--line); font-weight: 500; }
.btn.ghost:hover { background: #f8fbff; border-color: #cfe0fb; }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.thumb {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #f7f9fd; cursor: pointer; position: relative; transition: .16s;
}
.thumb:hover { border-color: var(--brand-2); box-shadow: 0 4px 14px rgba(47,111,237,.14); }
.thumb img { width: 100%; height: 150px; object-fit: contain; display: block; background: #eef2f8; }
.thumb span {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 11px; padding: 3px 8px; color: #fff;
  background: linear-gradient(transparent, rgba(15,28,52,.72));
}

.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(12, 20, 36, .92);
  display: flex; flex-direction: column; animation: fade .16s;
}
.lightbox .lb-top {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; color: #e8eefb;
}
.lightbox .lb-top .grow { flex: 1; }
.lightbox .lb-top button {
  color: #dbe5f8; font-size: 13px; padding: 6px 12px; border-radius: 8px;
  background: rgba(255,255,255,.1);
}
.lightbox .lb-top button:hover { background: rgba(255,255,255,.2); }
.lightbox .lb-img { flex: 1; overflow: auto; display: grid; place-items: center; padding: 0 18px 18px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }

/* ---------- 分析图表 ---------- */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut {
  width: 132px; height: 132px; border-radius: 50%; position: relative; flex: 0 0 132px;
}
.donut::after {
  content: ""; position: absolute; inset: 26px; background: #fff; border-radius: 50%;
  box-shadow: inset 0 2px 8px rgba(23,51,108,.06);
}
.donut .ctr {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; z-index: 1;
  font-size: 11px; color: var(--muted); line-height: 1.2;
}
.donut .ctr b { display: block; font-size: 20px; color: var(--text); font-weight: 800; }
.legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 150px; }
.legend div { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.legend span.n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.kp-list { display: flex; flex-direction: column; gap: 9px; }
.kp-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.kp-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kp-row .cnt {
  font-size: 11px; font-weight: 700; color: #b8433c; background: var(--danger-soft);
  padding: 1px 8px; border-radius: 20px; flex: 0 0 auto;
}
.kp-track { width: 90px; height: 6px; background: #f0f4fb; border-radius: 4px; overflow: hidden; flex: 0 0 90px; }
.kp-track i { display: block; height: 100%; background: linear-gradient(90deg, #f5a08c, #e0524b); border-radius: 4px; }

/* ---------- 复习清单 ---------- */
.review-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  border-bottom: 1px dashed var(--line-2);
}
.review-item:last-child { border-bottom: none; }
.review-item .ck {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #ccd8ec;
  display: grid; place-items: center; flex: 0 0 20px; cursor: pointer; transition: .15s;
  color: transparent; font-size: 12px;
}
.review-item .ck:hover { border-color: var(--brand-2); }
.review-item .ck.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.review-item .txt { flex: 1; min-width: 0; }
.review-item .txt b { font-size: 13px; font-weight: 600; display: block; }
.review-item .txt span { font-size: 11.5px; color: var(--muted); }

/* ---------- 提示条 ---------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fffaf0; border: 1px solid #f7e6c8; color: #8a5d1c;
  border-radius: 12px; padding: 11px 15px; font-size: 12.5px; line-height: 1.65;
  margin-bottom: 14px;
}
.notice b { color: #7a4f12; }
.notice.blue { background: #f4f8ff; border-color: #dbe8fb; color: #4a5c7c; }

/* ---------- 页脚 ---------- */
.foot {
  margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-hero { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar: 64px; }
  .sidebar { padding: 14px 8px; }
  .brand-txt, .nav a span.txt, .side-foot .mode-chip span { display: none; }
  .brand { justify-content: center; padding: 2px 0 8px; }
  .nav a { justify-content: center; padding: 11px 0; }
  .nav a.on::before { display: none; }
  .nav .badge-count { position: absolute; top: 2px; right: 4px; font-size: 9px; padding: 0 4px; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 14px; padding-right: 14px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 14px; }
  .two-col, .img-strip { grid-template-columns: 1fr; }
  .search-box { margin-left: 0; width: 100%; }
  .search-box input { width: 100%; }
  .topbar h1 { font-size: 16px; }
  .switch button small { display: none; }
}

@media print {
  .sidebar, .topbar, .foot { display: none; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
