/* Shared visual system. No framework or remote font dependency. */
:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --panel: #ffffff;
  --surface: #f8fafc;
  --text: #172c46;
  --muted: #627186;
  --line: #dce3ed;
  --brand: #bd3b47;
  --brand-hover: #a62c38;
  --soft: #fcf0f2;
  --blue: #255b86;
  --blue-soft: #edf3fa;
  --teal: #216c60;
  --teal-soft: #edf7f3;
  --warn: #855710;
  --warn-soft: #fff5e3;
  --danger: #b6323d;
  --on-brand: #ffffff;
  --header: #132943;
  --header-text: #f8fbff;
  --header-muted: #becddd;
  --shadow: 0 4px 18px rgba(25, 44, 71, .045);
  --shadow-raised: 0 7px 24px rgba(25, 44, 71, .09);
  --focus: rgba(37, 91, 134, .16);
  --radius: 18px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 100px; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 8% 0%, var(--blue-soft), transparent 48%);
  color: var(--text);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
  touch-action: manipulation;
}
button.primary, .auth-page button:not([data-close]) {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 3px 8px rgba(189, 59, 71, .12);
}
button:active:not(:disabled), a.button:active { transform: translateY(1px); box-shadow: none; }
button:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
a { color: var(--blue); text-underline-offset: 3px; }
input, select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .9; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--focus); }
input[type="checkbox"] { display: inline-block; width: 21px; min-height: 21px; margin: 3px 0 0; accent-color: var(--brand); cursor: pointer; }
input[type="checkbox"]:disabled { cursor: default; }
input[type="file"] { padding: 8px; font-size: 14px; }
input::file-selector-button { padding: 7px 10px; margin-right: 10px; border: 0; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font: inherit; cursor: pointer; }
textarea { min-height: 108px; resize: vertical; }
label { display: block; color: var(--text); font-size: 14px; font-weight: 600; }
label > input:not([type="checkbox"]), label > select, label > textarea { margin-top: 7px; font-weight: 400; }
header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--header);
  color: var(--header-text);
  border-bottom: 3px solid var(--brand);
  box-shadow: 0 4px 16px rgba(12, 28, 49, .09);
}
.bar { max-width: 1320px; margin: auto; padding: 17px 28px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; min-width: 0; }
.brand { position: relative; flex: 1; padding-left: 56px; font-size: 19px; font-weight: 700; letter-spacing: .02em; min-width: 250px; }
.brand::before, .auth-brand-mark {
  content: "油";
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 22px;
  font-weight: 700;
}
.brand::before { position: absolute; left: 0; top: 4px; }
.subtitle { font-size: 12px; color: var(--header-muted); font-weight: 400; letter-spacing: 0; margin-top: 3px; }
nav { display: flex; gap: 5px; padding: 4px; border: 1px solid rgba(255,255,255,.12); border-radius: 13px; background: rgba(255,255,255,.035); }
nav button { gap: 7px; min-width: 76px; min-height: 39px; padding: 8px 12px; border: 0; background: transparent; color: var(--header-muted); font-size: 14px; font-weight: 500; }
nav button::before { content: ""; display: inline-block; width: 17px; height: 17px; background: currentColor; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
nav button[data-tab="today"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' d='M3 10 12 3l9 7v11h-6v-7H9v7H3z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' d='M3 10 12 3l9 7v11h-6v-7H9v7H3z'/%3E%3C/svg%3E"); }
nav button[data-tab="progress"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' d='M4 3v17h17M8 15v-4m5 4V6m5 9V9'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' d='M4 3v17h17M8 15v-4m5 4V6m5 9V9'/%3E%3C/svg%3E"); }
nav button[data-tab="errors"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' d='M6 3h12v18H6zM10 7h4m-4 4h4m-4 4h3M3 7h3m-3 4h3m-3 4h3'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' d='M6 3h12v18H6zM10 7h4m-4 4h4m-4 4h3M3 7h3m-3 4h3m-3 4h3'/%3E%3C/svg%3E"); }
nav button[data-tab="docs"]::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' d='M3 6h7l2 3h9v11H3z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' d='M3 6h7l2 3h9v11H3z'/%3E%3C/svg%3E"); }
nav button.active { background: #f7faff; color: #142d47; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
header #refresh { min-height: 39px; padding: 8px 13px; background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.22); color: var(--header-text); }
header button:focus-visible { outline-color: #d5e4f5; }
#account { padding-top: 13px; padding-bottom: 13px; gap: 12px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 13px; min-height: 58px; }
#account > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#account .button, #account button { padding: 7px 12px; min-height: 38px; font-size: 12px; background: var(--panel); }
#account .button { border-color: var(--brand); color: var(--brand); background: var(--soft); }
main { max-width: 1320px; margin: auto; padding: 28px; }
h1 { margin: 0 0 22px; font-size: 28px; line-height: 1.4; font-weight: 750; letter-spacing: -.025em; overflow-wrap: anywhere; }
h2 { margin: 0 0 13px; font-size: 19px; line-height: 1.55; font-weight: 700; }
h3 { margin: 0 0 6px; font-size: 17px; line-height: 1.55; font-weight: 650; overflow-wrap: anywhere; }
p { margin: 10px 0 16px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.7; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.row > * { min-width: 0; }
.row > h1, .row > h2, .row > h3 { margin-bottom: 0; }
.spread { justify-content: space-between; }
#app > .row { margin-bottom: 22px; }
.datebar > .row { flex: 0 0 auto; flex-wrap: nowrap; gap: 8px; }
.datebar input { width: 155px; flex: 0 0 155px; max-width: 155px; font-size: 14px; min-height: 42px; }
.datebar button { flex-shrink: 0; min-height: 42px; }
.grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; margin-bottom: 24px; }
.card { min-width: 0; padding: 24px; margin-bottom: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.grid > .card { position: relative; margin-bottom: 0; padding: 22px 24px; overflow: hidden; border-top-width: 3px; }
.grid > .card:first-child { background: var(--soft); border-top-color: var(--brand); }
.grid > .card:nth-child(2) { background: var(--blue-soft); border-top-color: var(--blue); }
.grid > .card:nth-child(3) { background: var(--teal-soft); border-top-color: var(--teal); }
.grid > .card > .muted:first-child { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.grid > .card:first-child .metric { color: var(--brand); }
.grid > .card:nth-child(2) .metric { color: var(--blue); }
.grid > .card:nth-child(3) .metric { color: var(--teal); }
.metric { font-size: 38px; font-weight: 750; letter-spacing: -.035em; line-height: 1.2; font-variant-numeric: tabular-nums; margin: 5px 0 12px; overflow-wrap: anywhere; }
.split { display: grid; grid-template-columns: minmax(0,2.05fr) minmax(285px,1fr); gap: 22px; }
.split > * { min-width: 0; }
.split aside .card { padding: 22px; }
.split aside .card:first-child { border-color: var(--line); }
.pill { display: inline-flex; align-items: center; max-width: 100%; padding: 4px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--blue-soft); color: var(--blue); font-size: 12px; line-height: 1.6; font-weight: 600; overflow-wrap: anywhere; }
.warn { color: var(--warn); }
p.warn { padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--warn-soft); }
.danger, button[data-correct="false"] { color: var(--danger); border-color: var(--line); background: var(--soft); }
button[data-correct="true"] { color: var(--teal); background: var(--teal-soft); }
.task { display: grid; grid-template-columns: 23px minmax(0,1fr); gap: 13px; padding: 19px; margin: 14px 0 0; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.task:first-child { margin-top: 0; }
.task .row.spread { align-items: flex-start; gap: 8px; }
.task h3 { flex: 1 1 170px; }
.task .small.muted { margin-top: 7px; }
.task p.small { margin: 10px 0 12px; font-size: 14px; }
.task .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 13px; }
.task .actions button { padding: 8px 12px; font-size: 13px; }
.task.done { background: var(--teal-soft); border-color: var(--teal); }
.task.done h3 { color: var(--teal); }
.task.done .pill { color: var(--teal); background: var(--panel); }
.progress { height: 7px; margin: 13px 0; overflow: hidden; border-radius: 8px; background: var(--line); }
.progress span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--brand); }
.task.done .progress span { background: var(--teal); }
.grid > .card:nth-child(2) .progress span { background: var(--blue); }
.trendrow .progress span { background: var(--teal); }
.formgrid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 16px; }
.span2 { grid-column: 1/-1; }
dialog { width: min(760px,calc(100vw - 40px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow: auto; margin: auto; padding: 27px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); color: var(--text); box-shadow: 0 24px 90px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10,24,43,.58); }
dialog .row.spread { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
dialog [data-close] { min-height: 38px; padding: 6px 13px; background: var(--surface); }
dialog form > button.primary { margin-top: 10px; min-width: 180px; }
#viewer { display: none; width: min(1320px,calc(100vw - 36px)); height: calc(100vh - 36px); height: calc(100dvh - 36px); max-height: none; padding: 22px; }
#viewer[open] { display: flex; flex-direction: column; }
#viewer h2 { flex: 1; font-size: 17px; overflow-wrap: anywhere; }
#viewer > .row { flex-shrink: 0; }
#viewer iframe { flex: 1; min-height: 160px; width: 100%; border: 1px solid var(--line); border-radius: 10px; margin-top: 17px; background: white; }
.tablewrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 17px; scrollbar-color: var(--muted) var(--surface); }
table { width: 100%; min-width: 730px; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 14px 15px; border-bottom: 1px solid var(--line); line-height: 1.55; }
th { background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 700; white-space: nowrap; }
td:first-child { font-weight: 600; white-space: nowrap; }
tbody tr:nth-child(even) { background: var(--surface); }
tbody tr:last-child td { border-bottom: 0; }
.empty { padding: 28px 22px; border: 1px dashed var(--line); border-radius: 13px; background: var(--surface); color: var(--muted); font-size: 14px; }
.trendrow { display: grid; grid-template-columns: 70px minmax(0,1fr) 130px; gap: 14px; align-items: center; margin: 20px 0 7px; font-variant-numeric: tabular-nums; }
.trendrow > .progress { margin: 0; }
.trendrow > .small { text-align: right; }
.docrow { padding: 20px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.docrow:first-child { padding-top: 0; }
.docrow:last-child { border-bottom: 0; padding-bottom: 0; }
.docrow strong { display: block; font-size: 16px; line-height: 1.65; margin-bottom: 5px; }
.docrow > .row.spread { align-items: center; gap: 18px; }
.docrow > .row.spread > div { flex: 1 1 260px; min-width: 0; }
.docrow > .row.spread > button { flex-shrink: 0; color: var(--blue); background: var(--blue-soft); border-color: var(--line); }
.docrow p { margin: 12px 0; }
.docrow > button.danger { margin-top: 10px; min-height: 36px; font-size: 12px; }
details { margin-top: 18px; }
summary { padding: 12px 14px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 13px; font-weight: 600; cursor: pointer; }
.footer { padding: 14px 0 4px; color: var(--muted); font-size: 12px; line-height: 1.8; }
#notice { display: none; position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(90vw,600px); padding: 12px 18px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; background: var(--header); color: var(--header-text); box-shadow: var(--shadow-raised); z-index: 20; font-size: 14px; overflow-wrap: anywhere; }
.auth-page { min-height: 100vh; padding: 36px 28px; background-image: radial-gradient(ellipse at 15% 0%, var(--blue-soft), transparent 55%); }
.auth-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 28px; color: var(--text); font-size: 17px; font-weight: 700; text-decoration: none; }
.auth-brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 20px; }
.auth-shell { max-width: 1050px; margin: 3vh auto 0; }
.auth-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: var(--panel); box-shadow: var(--shadow-raised); }
.auth-intro { padding: 48px 40px; background: linear-gradient(145deg,#132943,#213f5f); color: #f4f8ff; }
.auth-eyebrow { display: inline-flex; padding: 5px 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 7px; color: #e1eaf6; font-size: 12px; }
.auth-intro h2 { margin: 32px 0 18px; font-size: 34px; line-height: 1.45; letter-spacing: -.03em; }
.auth-intro > p { color: #becddd; font-size: 14px; max-width: 330px; }
.auth-features { display: grid; gap: 18px; list-style: none; padding: 26px 0 0; margin: 30px 0 0; border-top: 1px solid rgba(255,255,255,.15); }
.auth-features li { position: relative; padding-left: 22px; font-size: 14px; color: #e3ecf6; }
.auth-features li::before { content: ""; position: absolute; left: 0; top: 9px; width: 7px; height: 7px; border-radius: 2px; background: #ec8993; }
.auth-page main.auth-card { max-width: none; width: 100%; margin: 0; padding: 44px 40px; background: var(--panel); }
.auth-card h1 { font-size: 25px; margin-bottom: 12px; }
.auth-card > p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-card form { margin-top: 27px; }
.auth-card input { margin-bottom: 19px; }
.auth-card #submit { width: 100%; min-height: 48px; margin: 5px 0 19px; font-size: 15px; }
.auth-card small { display: block; color: var(--muted); font-size: 12px; line-height: 1.8; }
.auth-card > p:last-of-type { margin-top: 22px; margin-bottom: 0; }
.auth-card #status:not(:empty), .auth-card #message:not(:empty) { padding: 12px 14px; border: 1px solid var(--line); border: 1px solid var(--line); border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 13px; white-space: pre-wrap; }
.auth-card #status:empty, .auth-card #message:empty { display: none; }
@media (hover:hover) {
  button:hover:not(:disabled), a.button:hover { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 2px 8px rgba(25,44,71,.06); }
  button.primary:hover:not(:disabled), .auth-page button:hover:not(:disabled) { border-color: var(--brand-hover); background: var(--brand-hover); color: var(--on-brand); }
  nav button:hover { background: rgba(255,255,255,.1); color: var(--header-text); box-shadow: none; }
  nav button.active:hover { background: #f7faff; color: #142d47; }
  header #refresh:hover { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.1); }
  #account .button:hover { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
  tbody tr:hover { background: var(--blue-soft); }
  input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--muted); }
  a:not(.button):hover { color: var(--brand); }
}
@media (max-width:1024px) {
  .bar { padding: 15px 22px; gap: 15px; }
  main { padding: 24px 22px; }
  .brand { font-size: 17px; min-width: 245px; }
  .split { grid-template-columns: minmax(0,1.65fr) minmax(270px,1fr); gap: 18px; }
  .card { padding: 20px; }
  .grid > .card { padding: 20px; }
  .task { padding: 16px; }
  .task h3 { flex-basis: 150px; }
  .auth-intro { padding: 40px 30px; }
  .auth-page main.auth-card { padding: 38px 30px; }
}
@media (max-width:850px) {
  header .bar { gap: 10px; }
  .brand { flex-basis: calc(100% - 90px); order: 0; }
  header #refresh { order: 1; margin-left: auto; }
  nav { order: 2; width: 100%; justify-content: space-between; }
  nav button { flex: 1; }
  .split { grid-template-columns: minmax(0,1fr); }
  .split aside { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; align-items: start; }
  .split aside .card { margin-bottom: 0; }
  .split aside .card:last-child { grid-column: 1/-1; }
  .metric { font-size: 32px; }
  .auth-layout { grid-template-columns: minmax(0,1fr); max-width: 510px; margin: auto; }
  .auth-intro { display: none; }
  .auth-shell { max-width: 510px; margin-top: 0; }
}
@media (max-width:600px) {
  html { scroll-padding-top: 95px; }
  body.workbench { padding-bottom: calc(84px + env(safe-area-inset-bottom,0px)); }
  .bar { padding: 13px 16px; gap: 10px; }
  .brand { min-width: 0; font-size: 15px; padding-left: 46px; }
  .brand::before { top: 3px; width: 34px; height: 34px; border-radius: 10px; font-size: 19px; }
  .subtitle { font-size: 11px; margin-top: 2px; }
  header #refresh { min-height: 36px; padding: 6px 10px; font-size: 12px; }
  nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; width: auto; gap: 4px; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom,0px)); background: var(--panel); box-shadow: 0 -4px 18px rgba(15,35,56,.06); }
  nav button { flex-direction: column; gap: 4px; min-width: 0; min-height: 53px; padding: 6px; font-size: 12px; color: var(--muted); border-radius: 10px; }
  nav button::before { width: 19px; height: 19px; }
  nav button.active { background: var(--soft); color: var(--brand); box-shadow: none; }
  header nav button:focus-visible { outline-color: var(--blue); }
  #account { padding: 11px 16px; font-size: 12px; gap: 8px; }
  #account > span { flex-basis: 100%; }
  #account .button, #account button { font-size: 12px; min-height: 36px; }
  main { padding: 22px 16px; }
  h1 { font-size: 24px; margin-bottom: 18px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }
  .small { font-size: 13px; }
  #app > .row { align-items: flex-start; gap: 13px; margin-bottom: 18px; }
  .datebar > h1 { flex-basis: 100%; }
  .datebar > .row { width: 100%; }
  .datebar input { width: auto; flex: 1; max-width: none; }
  .grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
  .grid > .card { padding: 17px; border-radius: 14px; }
  .grid > .card:last-child { grid-column: 1/-1; }
  .metric { font-size: 30px; margin-bottom: 10px; }
  .grid > .card > .muted:first-child { font-size: 12px; margin-bottom: 8px; }
  .card { padding: 18px; border-radius: 15px; margin-bottom: 18px; }
  .split aside { grid-template-columns: minmax(0,1fr); gap: 18px; }
  .split aside .card { padding: 18px; }
  .task { padding: 15px 13px; gap: 10px; grid-template-columns: 21px minmax(0,1fr); border-radius: 11px; }
  .task .row.spread { flex-direction: column; gap: 5px; }
  .task h3 { flex: none; }
  .task .small.muted { font-size: 12px; }
  .task .actions { gap: 7px; }
  .task .actions button { font-size: 13px; padding: 8px 10px; }
  .formgrid { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .span2 { grid-column: auto; }
  dialog { width: calc(100vw - 20px); max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); padding: 20px 17px; border-radius: 16px; }
  dialog h2 { font-size: 18px; }
  dialog form > button.primary { width: 100%; }
  #viewer { width: calc(100vw - 16px); height: calc(100vh - 18px); height: calc(100dvh - 18px); padding: 16px 12px; }
  #viewer .row { gap: 8px; }
  #viewerHint { flex-basis: 100%; }
  #viewer .button { min-height: 40px; padding: 7px 10px; font-size: 12px; }
  .trendrow { grid-template-columns: 54px minmax(0,1fr) 110px; gap: 9px; }
  .trendrow .small { font-size: 12px; }
  .empty { padding: 22px 16px; }
  .docrow { padding: 17px 0; }
  .docrow > .row.spread { gap: 10px; }
  .docrow > .row.spread > div { flex-basis: 100%; }
  .docrow strong { font-size: 15px; }
  #notice { bottom: calc(91px + env(safe-area-inset-bottom,0px)); font-size: 13px; }
  .auth-page { padding: 22px 16px; }
  .auth-brand { font-size: 15px; margin-bottom: 22px; }
  .auth-layout { border-radius: 18px; }
  .auth-page main.auth-card { padding: 28px 23px; }
  .auth-card h1 { font-size: 24px; }
}
@media (max-width:359px) {
  .brand { font-size: 13px; padding-left: 40px; }
  .brand::before { width: 30px; height: 30px; font-size: 17px; }
  .subtitle { font-size: 11px; }
  .metric { font-size: 27px; }
  .grid > .card { padding: 14px; }
  .task { grid-template-columns: 19px minmax(0,1fr); gap: 8px; padding: 13px 10px; }
  .task .actions button { width: 100%; }
  .trendrow { grid-template-columns: 47px minmax(0,1fr) 96px; gap: 7px; }
}
@media (prefers-color-scheme:dark) {
  :root { color-scheme: dark; --bg:#0e1828; --panel:#1a2a40; --surface:#20324b; --text:#e1e8f3; --muted:#a5b5ca; --line:#334861; --brand:#ed8d97; --brand-hover:#f4a1aa; --soft:#352b3b; --blue:#99c2e6; --blue-soft:#263a54; --teal:#9cdbc8; --teal-soft:#233e3d; --warn:#edc787; --warn-soft:#3b342b; --danger:#ee9aa5; --on-brand:#2a1620; --header:#101f34; --focus:rgba(153,194,230,.18); --shadow:0 4px 18px rgba(0,0,0,.13); --shadow-raised:0 7px 24px rgba(0,0,0,.22); }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition: none !important; scroll-behavior: auto !important; } }

#viewer { overflow:hidden; }
#viewer iframe { min-height:0; flex:1 1 0; }
#docFrame:fullscreen { width:100vw!important; height:100vh!important; height:100dvh!important; min-height:0!important; margin:0!important; border:0!important; border-radius:0!important; background:white; }
/* u1: document modal uses its height for reading rather than duplicate headings. */
@media(orientation:landscape) and (max-height:850px){#viewer{padding:10px 12px;width:calc(100vw - 16px);height:calc(100dvh - 16px);}#viewer h2{margin:0;font-size:15px;}#viewer>.row{gap:6px;min-height:32px;}#viewer .button,#viewer button{min-height:34px;padding:5px 9px;}#viewer iframe{margin-top:8px;}#viewerHint{font-size:11px;}}

.back-button{flex-shrink:0;font-size:13px;min-height:36px;padding:6px 10px;white-space:nowrap;}
.reader-heading .back-button{font-size:12px;min-height:28px;padding:3px 7px;}

/* News integration: keep the incumbent palette and existing reader geometry. */
.news-nav-link{white-space:nowrap;}
.practice-page .formgrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;align-items:end;}
.practice-page .formgrid label{min-width:0;display:flex;flex-direction:column;gap:8px;}
.practice-page .formgrid select{width:100%;min-width:0;min-height:44px;}
@media(max-width:700px){.practice-page .formgrid{grid-template-columns:1fr;gap:12px;}}
@media(max-width:600px){body:not(.news-page) nav:has(.news-nav-link){display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:2px;}body:not(.news-page) nav:has(.news-nav-link)>*{min-width:0;padding:6px 2px;font-size:12px;min-height:53px;}}

@media(hover:hover){header #refresh:hover,header .back-button:hover{color:var(--header-text);background:rgba(255,255,255,.1);}}

/* Mock entry: retain all existing sections; keep seven touch targets readable. */
@media(max-width:600px){body.workbench nav:has(.mock-nav-link){grid-template-columns:repeat(7,minmax(0,1fr));padding-inline:6px;}body.workbench nav:has(.mock-nav-link)>*{font-size:12px;min-width:0;min-height:53px;}}
