/* ExpSmk 页面样式。令牌和组件的来源：docs/design/mockup.css、设计文档 §4。
   分段：令牌 → 基础 → 客户端外壳 → 后台外壳 → 页面骨架 → 按钮 → 表单 → 表格 → 状态 → 提示 → 菜单与展开 →
         量度 → 分页 → 概况 → 详情 → 设置 → 登录 → 查询结果 → 其它 → 响应式与动效 */

/* ---------- 令牌 ---------- */
:root {
  color-scheme: light;
  --navy: #0B2D5B;
  --navy-deep: #081F42;
  --navy-2: #14508F;
  --orange: #F0821E;
  --orange-ink: #A64A00;
  --ink: #1B2A41;
  --sub: #5B6B82;
  --bg: #F4F7FB;
  --panel: #FFFFFF;
  --line: #E3EAF3;
  --rule: #CDD8E6;
  --tint: #EEF2F8;
  --ok: #176B47;
  --ok-bg: #EAF6EF;
  --warn: #8F4A00;
  --warn-bg: #FFF3E8;
  --bad: #B3261E;
  --bad-bg: #FDECEA;
  --idle-bg: #EEF1F6;
  --placeholder: #6A768A;
  --shadow: 0 8px 24px rgba(11, 45, 91, .16);
  --radius: 4px;
  --speed: 120ms;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Cascadia Mono", monospace;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; font: 15px/1.6 var(--sans); color: var(--ink); background: var(--bg); }   /* 纵向弹性容器：正文撑开，页脚落在页面底部 */
h1, h2, h3, p, dl, dd, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; line-height: 1.3; font-weight: 600; }
h2 { font-size: 18px; line-height: 1.4; font-weight: 600; }
h3 { font-size: 14px; line-height: 1.4; font-weight: 600; }
:focus-visible { outline: 2px solid var(--orange-ink); outline-offset: 2px; }
.topbar :focus-visible, .sidebar :focus-visible, .brandcol :focus-visible { outline-color: #fff; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -60px; left: 8px; z-index: 100; padding: 8px 12px; background: #fff; color: var(--navy); border-radius: var(--radius); }
.skip-link:focus { top: 8px; }

/* ---------- 客户端外壳（顶栏） ---------- */
.topbar { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 0 24px; background: var(--navy); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.brand-logo { height: 30px; width: auto; }
.brand-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, .28); }
.brand-name { font-size: 17px; font-weight: 600; line-height: 1.3; color: inherit; }
.session { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 14px; white-space: nowrap; }
.session a { color: inherit; text-decoration: none; }
.session a:hover { text-decoration: underline; }
.inline-form { display: inline; margin: 0; }
.btn-exit { padding: 0; border: 0; background: none; color: rgba(255, 255, 255, .78); font-size: 14px; cursor: pointer; }
.btn-exit:hover { color: #fff; }
.site-footer { width: 100%; max-width: 1248px; margin: 0 auto; padding: 16px 24px 32px; font-size: 13px; color: var(--sub); }   /* width: 100%：和正文一样撑开、靠左，不被包成文字那么宽居中 */

/* ---------- 后台外壳（侧栏） ---------- */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; align-items: start; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 14px 12px 12px; background: var(--navy); color: #fff; overflow-y: auto; }
.sidebar a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; margin-bottom: 2px; padding: 0 12px; border-radius: var(--radius); font-size: 14px; color: rgba(255, 255, 255, .86); text-decoration: none; }
.sidebar a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar a.on { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 3px 0 0 var(--orange); }
.sidebar a.brand { min-height: 0; margin: 4px 0 16px; padding: 4px 10px; gap: 10px; }
.sidebar a.brand:hover { background: none; }
.sidebar .brand-logo { height: 24px; }
.brand-sub { font-size: 12px; color: rgba(255, 255, 255, .6); }
.sidebar .group { padding: 14px 12px 6px; font-size: 12px; line-height: 1.4; color: rgba(255, 255, 255, .5); }
.count { min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: var(--navy); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.lamp { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding: 12px 12px 2px; font-size: 13px; color: rgba(255, 255, 255, .72); }
.sidebar-foot form { margin: 0; }
.nav-toggle { display: none; }
.content { min-width: 0; max-width: 1248px; padding: 24px; }

/* ---------- 页面骨架 ---------- */
/* 客户端外壳的 <main>（带 id、不带 class）本身就是页面容器；登录页和后台的 <main> 都带 class，不受影响 */
main:not([class]) { flex: 1 0 auto; width: 100%; max-width: 1248px; margin: 0 auto; padding: 24px; }   /* width: 100%：弹性容器里带自动外边距的项按内容的最小宽度定宽，宽表格会把整页撑宽 */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head .actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.back { display: inline-block; margin-bottom: 12px; font-size: 13px; color: var(--sub); text-decoration: none; }
.back:hover { color: var(--navy); text-decoration: underline; }
.section-title { margin: 24px 0 10px; }
.section-title:first-child { margin-top: 0; }
.lede { margin: 16px 0 8px; font-size: 14px; line-height: 1.5; color: var(--sub); }
.hint { margin: 16px 0; font-size: 14px; line-height: 1.5; color: var(--sub); }
.panel { background: var(--panel); border: 1px solid var(--line); }
.pad { padding: 20px 24px; }
.strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; margin-bottom: 20px; padding: 12px 16px; font-size: 14px; }
.strip .k, .facts .k { margin-right: 8px; font-size: 13px; color: var(--sub); }
.filter-bar { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 12px; }
.filter-bar.narrow { grid-template-columns: minmax(0, 320px) auto; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius); font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color var(--speed), color var(--speed), border-color var(--speed); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); }
.btn-secondary { background: #fff; border-color: var(--rule); color: var(--ink); }
.btn-secondary:hover { border-color: var(--navy-2); color: var(--navy); }
.btn-quiet { background: none; border-color: transparent; color: var(--navy); padding: 0 8px; }
.btn-quiet:hover { background: var(--tint); }
.btn-danger { background: #fff; border-color: #E9B8B3; color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 44px; }
.btn:disabled { opacity: .6; cursor: default; }
.icon { width: 16px; height: 16px; fill: currentColor; }
.when-busy { display: none; }
.htmx-request .when-idle { display: none; }
.htmx-request .when-busy { display: inline; }

/* ---------- 表单 ---------- */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px 24px; align-items: end; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; line-height: 1.4; color: var(--sub); }
.field-end { display: flex; justify-content: flex-end; }
.input, .select, .textarea { width: 100%; padding: 0 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; color: var(--ink); font-size: 15px; }
.input, .select { height: 36px; }
.textarea { min-height: 72px; padding: 8px 10px; font-family: inherit; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); }
.input[readonly] { background: var(--bg); color: var(--sub); }
.input.id-input { font-family: var(--mono); font-size: 14px; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
.range span { font-size: 13px; color: var(--sub); }
.field .check { display: flex; align-items: center; gap: 8px; min-height: 36px; margin-bottom: 0; font-size: 14px; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; }
.req { margin-left: 6px; font-size: 13px; font-weight: 400; color: var(--sub); }
.help { margin-top: 4px; font-size: 13px; line-height: 1.5; color: var(--sub); }
.inline-msg { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; line-height: 1.5; }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 20px; }
.span-2 { grid-column: span 2; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.fieldset { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.fieldset:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.legend { font-size: 15px; font-weight: 600; line-height: 1.4; }
.legend small { margin-left: 8px; font-size: 13px; font-weight: 400; color: var(--sub); }
.sublegend { margin: 16px 0 10px; font-size: 13px; font-weight: 600; color: var(--sub); }
.sublegend:first-child { margin-top: 12px; }
.legend + .form-grid { margin-top: 12px; }
.panel + .panel { margin-top: 24px; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--rule); }
.form-foot-left { justify-content: flex-start; }
.panel > .form-foot { margin: 0; padding: 14px 16px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.45; }
th { padding: 10px; border-bottom: 1px solid var(--rule); font-size: 12px; font-weight: 500; color: var(--sub); text-align: left; white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td a { font-weight: 500; text-decoration: none; }
td a:hover { text-decoration: underline; }
.error-text { font-family: var(--mono); font-size: 12px; color: var(--bad); overflow-wrap: anywhere; }   /* 不折行、放不下用省略号和悬停全文：规则在 .resizable td 里；脚本没跑时长的错误码也能断开 */
.kind { font-family: var(--mono); font-size: 12px; color: var(--sub); }
.table-wrap { overflow-x: auto; }
/* ---------- 表格：列宽可拖动、单元格不折行（脚本 app.js 负责量宽、拖动、记住） ---------- */
.resizable th, .resizable td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resizable th { position: relative; padding-right: 18px; }
.col-resize { position: absolute; top: 0; right: 0; width: 8px; height: 100%; cursor: col-resize; user-select: none; touch-action: none; }
.col-resize::after { content: ""; position: absolute; top: 22%; bottom: 22%; right: 3px; width: 1px; background: transparent; }
.resizable th:hover > .col-resize::after, body.col-resizing .col-resize::after { background: var(--orange); }
body.col-resizing { cursor: col-resize; }
body.col-resizing * { cursor: col-resize !important; user-select: none; }
@media (hover: none) { .col-resize { display: none; } }   /* 触屏没有鼠标拖动：不显示拖动柄 */
.table-compact th { padding-top: 8px; padding-bottom: 8px; }
.table-compact td { padding-top: 6px; padding-bottom: 6px; }
.id { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.name { white-space: nowrap; }
.dim { color: var(--sub); }
.nowrap { white-space: nowrap; }
.sub { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--sub); white-space: nowrap; }
.stack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ops { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 2px; white-space: nowrap; }

/* ---------- 状态胶囊 ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; }
.badge::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-run { color: var(--navy); background: var(--tint); }
.badge-warn { color: var(--warn); background: var(--warn-bg); }
.badge-bad { color: var(--bad); background: var(--bad-bg); }
.badge-idle { color: var(--sub); background: var(--idle-bg); }

/* ---------- 提示与空状态 ---------- */
.notice { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; line-height: 1.5; }
.notice-ok { color: var(--ok); background: var(--ok-bg); border-color: #BBE3CC; }
.notice-bad { color: var(--bad); background: var(--bad-bg); border-color: #F1C4BF; }
.notice-warn { color: var(--warn); background: var(--warn-bg); border-color: #F6D3AE; }
.empty { padding: 32px 24px; text-align: center; color: var(--sub); font-size: 14px; line-height: 1.6; }
.empty p + p { margin-top: 4px; }
.empty .btn { margin: 12px 4px 0; }
.empty-cell { padding: 24px; text-align: center; color: var(--sub); }

/* ---------- 菜单与行内展开（原生 details） ---------- */
details.menu { position: relative; }
details.menu > summary { display: inline-flex; align-items: center; justify-content: center; height: 30px; padding: 0 8px; border-radius: var(--radius); color: var(--navy); list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary:hover { background: var(--tint); }
.menu-list { position: absolute; top: calc(100% + 4px); right: 8px; z-index: 20; min-width: 136px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); text-align: left; }
.menu-list form { margin: 0; }
.menu-item { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius); background: none; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--tint); }
.menu-sep { margin: 6px -6px; border: 0; border-top: 1px solid var(--line); }
details.reveal { position: relative; }
details.reveal > summary { display: inline-flex; align-items: center; height: 30px; padding: 0 8px; border-radius: var(--radius); color: var(--navy); font-size: 13px; list-style: none; cursor: pointer; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal > summary:hover { background: var(--tint); }
.reveal-body { position: absolute; top: calc(100% + 4px); right: 0; z-index: 20; width: 560px; max-width: 90vw; margin: 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); text-align: left; }
.reveal-body .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* 面板宽 560：表单排两列，默认的四列会把输入框挤到 117px */

/* ---------- 量度（轮次进度） ---------- */
.meter { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.meter .track { width: 96px; height: 6px; border-radius: 999px; background: var(--tint); }
.meter .fill { display: block; height: 100%; border-radius: 999px; background: var(--navy); }
.meter .fill-ok { background: var(--ok); }
.meter .fill-bad { background: var(--bad); }
.meter .val { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; font-size: 13px; }
.pager .dim { margin-right: auto; }

/* ---------- 概况 ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kpi { display: block; padding: 16px 18px; border-right: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--bg); }
.kpi-label { font-size: 13px; line-height: 1.4; color: var(--sub); }
.kpi-value { margin-top: 6px; font-size: 28px; line-height: 1.2; font-weight: 600; }
.kpi.lead .kpi-value { font-size: 34px; }
.kpi-sub { margin-top: 4px; font-size: 13px; line-height: 1.4; color: var(--sub); }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; vertical-align: 2px; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--orange); }
.dot-bad { background: var(--bad); }
.feed li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.feed li:first-child { border-top: 0; }
.feed a { color: inherit; text-decoration: none; }
.feed a:hover { text-decoration: underline; }
.two { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; margin-top: 24px; }

/* ---------- 详情 ---------- */
.ident { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ident-no { font-family: var(--mono); font-size: 28px; line-height: 1.25; font-weight: 600; white-space: nowrap; }
.ident-no .badge { height: 26px; margin-left: 12px; padding: 0 12px; font-family: var(--sans); font-size: 13px; vertical-align: 6px; }
.updated { padding-bottom: 5px; font-size: 13px; color: var(--sub); white-space: nowrap; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 32px; margin-top: 10px; font-size: 14px; line-height: 1.6; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; margin-top: 24px; }
.rail { grid-column: 2; grid-row: 1; position: sticky; top: 16px; }
.sheet { grid-column: 1; grid-row: 1; min-width: 0; }
.block { margin-bottom: 24px; }
.block > h2 { margin-bottom: 12px; }
.group { margin-top: 20px; }
.group:first-of-type { margin-top: 0; }
.group-title { margin-bottom: 8px; }
dl.sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--panel); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
dl.sheet-grid > div { min-width: 0; padding: 9px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
dt { font-size: 12px; line-height: 1.4; color: var(--sub); }
dd { margin: 2px 0 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 14px 16px 4px; }
.tl-head h2 { font-size: 16px; }
.tl-head span { font-size: 13px; color: var(--sub); }
.tl { padding: 10px 16px 16px; }
.tl li { position: relative; padding: 0 0 20px 22px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--rule); }
.tl li::after { content: ""; position: absolute; left: 4px; top: 19px; bottom: 0; width: 2px; background: var(--line); }
.tl li:last-child::after { display: none; }
.tl-time { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; font-size: 12.5px; line-height: 1.4; color: var(--sub); }
.tl-time .id { min-width: 0; font-size: 12px; white-space: normal; overflow-wrap: anywhere; }   /* 回执号单独一行还放不下时才能断开 */
.tl-status { margin-top: 2px; font-size: 15px; font-weight: 500; line-height: 1.4; }
.tl-detail { margin-top: 2px; font-size: 14px; line-height: 1.5; color: var(--sub); overflow-wrap: anywhere; }
.tl li.latest::before { left: -1px; top: 4px; width: 12px; height: 12px; background: var(--orange); }
.tl li.latest .tl-time, .tl li.latest .tl-detail { color: var(--ink); }
.tl li.latest .tl-status { font-size: 18px; font-weight: 600; }

/* ---------- 设置 ---------- */
.setting-row { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 8px 24px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; }
.setting-label { display: block; font-size: 15px; font-weight: 500; line-height: 1.4; }   /* 是 <label for>：点名称就聚焦到控件 */
.setting-control { display: flex; align-items: center; gap: 8px; min-width: 0; }
.setting-control .input, .setting-control .select { width: 220px; min-width: 0; }   /* min-width: 0：并排的两个输入框在窄栏里能收缩，不会伸出面板 */
.setting-control .input.wide { width: 100%; max-width: 600px; }
.setting-control .input.pair { width: 120px; }
.unit, .joiner { font-size: 13px; color: var(--sub); white-space: nowrap; }

/* ---------- 登录 ---------- */
.login { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: max(100vh, 640px); }
.brandcol { display: flex; flex-direction: column; gap: 32px; padding: 48px; background: var(--navy); color: #fff; }
.brandcol .brand-logo { height: 44px; width: auto; align-self: flex-start; }   /* 纵向弹性容器会把子项拉到整行宽；图片要贴左并保持比例 */
.brandcol h1 { font-size: 30px; line-height: 1.3; color: #fff; }
.brandcol p { max-width: 20em; margin-top: 12px; font-size: 16px; line-height: 1.6; color: rgba(255, 255, 255, .78); }
.brandcol-mid { display: flex; flex-direction: column; gap: 32px; margin: auto 0; }   /* 标题 + 示例卡在标志和公司名之间垂直居中 */
.brandcol .co { font-size: 14px; color: rgba(255, 255, 255, .6); }
/* 左栏的示例卡：一张报关单的回执时间线，全部用页面自己的样式画 */
.login-demo { max-width: 440px; padding: 18px 20px 6px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); border-radius: 6px; }
.login-demo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.login-demo-head .id { font-size: 14px; }
.login-demo .badge-ok { color: #9FE3BE; background: rgba(255, 255, 255, .1); }
.login-demo .tl { padding: 0; }
.login-demo .tl li::before { background: rgba(255, 255, 255, .4); }
.login-demo .tl li::after { background: rgba(255, 255, 255, .18); }
.login-demo .tl li.latest::before { background: var(--orange); }
.login-demo .tl-time, .login-demo .tl li.latest .tl-time { color: rgba(255, 255, 255, .6); }
.login-demo .tl-status, .login-demo .tl li.latest .tl-status { font-size: 16px; color: #fff; }
.login-demo .tl-detail, .login-demo .tl li.latest .tl-detail { color: rgba(255, 255, 255, .6); }
.formcol { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; background: #fff; }
.formcol form, .formcol .login-facts { width: 100%; max-width: 360px; }
.formcol h2 { font-size: 22px; }
.formcol .lede { margin: 4px 0 0; }
.formcol .field { margin-top: 16px; }
.formcol .btn { width: 100%; height: 44px; margin-top: 24px; }
.formcol .help { margin-top: 12px; }
.login-facts { margin: 28px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); list-style: none; }
.login-facts li { position: relative; padding-left: 16px; font-size: 14px; line-height: 1.6; color: var(--sub); }
.login-facts li + li { margin-top: 6px; }
.login-facts li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }

/* ---------- 查询结果 ---------- */
.search { display: grid; grid-template-columns: 1.1fr 1.1fr 1.6fr; gap: 16px 24px; align-items: end; margin-top: 16px; padding: 20px 24px; }
.result-list { display: none; background: var(--panel); border: 1px solid var(--line); }
.result-item + .result-item { border-top: 1px solid var(--line); }
.result-item a { display: block; padding: 12px 14px; color: var(--ink); text-decoration: none; }
.result-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }   /* 回执状态是自由文本，放不下时胶囊换到下一行，不把卡片撑出视口 */
.result-top .id { font-size: 13px; font-weight: 500; }
.result-line { margin-top: 2px; font-size: 13px; line-height: 1.5; }
/* 查询表单的后三个条件：电脑上直接排进栅格；手机上收在“更多条件”后面（媒体规则在 Task 19） */
.toggle-more, .more-label { display: none; }
.extra-filters { display: contents; }

/* ---------- 其它 ---------- */
.error-box, .token-box { max-width: 480px; margin: 64px auto; padding: 32px; background: #fff; border: 1px solid var(--line); }
.token-box { max-width: 560px; margin-top: 48px; }
.error-box p, .token-box p { margin-top: 8px; color: var(--sub); }
.error-box a, .token-box a { display: inline-block; margin-top: 16px; }
.token { display: block; margin: 16px 0; padding: 16px; font-family: var(--mono); font-size: 20px; line-height: 1.5; word-break: break-all; background: var(--tint); border-radius: 6px; color: var(--ink); }

/* ---------- 响应式 ---------- */
.table-hint { display: none; margin: 8px 0 0; font-size: 13px; color: var(--sub); }

/* “表格较宽，可以左右滑动”只在表格真的放不下时出现：app.js 给放不下的滚动容器加 is-overflowing。
   768 以下查询结果不显示表格（显示一单一块），提示也就不显示 */
@media (min-width: 768px) {
  .table-wrap.is-overflowing + .table-hint { display: block; }
}

@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); align-content: start; }   /* 单列后两行各归各的高，不把多余的高度平分给侧栏那一行 */
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 12px; }
  .sidebar a.brand { flex: 1; margin: 0; padding: 4px 8px; }
  .nav-toggle { display: block; }
  .sidebar-body { flex-basis: 100%; display: none; padding-top: 8px; }
  .nav-toggle[open] + .sidebar-body { display: block; }
  .sidebar-foot { flex-basis: 100%; margin-top: 0; padding: 8px 12px 0; }
  .panel { overflow-x: auto; }
  table td:first-child, table th:first-child { position: sticky; left: 0; background: #fff; }
  /* “⋯”菜单和展开面板不在这里改回文档流：单元格不折行、列宽固定，排在单元格里的表单会被挤成一列宽。
     任何宽度都由 app.js 浮在页面之上（面板宽度 560px、最宽 90vw）。 */
  .detail { grid-template-columns: minmax(0, 1fr); }
  .rail { grid-column: 1; grid-row: 1; position: static; }
  .sheet { grid-column: 1; grid-row: 2; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .setting-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .setting-control .input.wide { max-width: none; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4, .form-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: 140px minmax(0, 1fr); }
  .filter-bar .btn { grid-column: 1 / -1; justify-self: end; }
}

@media (max-width: 767px) {
  .topbar { min-height: 52px; padding: 0 16px; gap: 10px; }
  .brand-logo { height: 24px; }
  .brand-sep { height: 16px; }
  .brand-name { font-size: 15px; }
  .session { gap: 12px; font-size: 13px; }
  .session .who { display: none; }
  .site-footer { padding: 16px 16px 24px; }
  main:not([class]), .content { padding: 16px; }
  h1 { font-size: 20px; }
  .page-head { flex-wrap: wrap; align-items: flex-start; }
  .page-head .actions { justify-content: flex-start; width: 100%; }
  .btn { height: 44px; }
  .btn-sm { height: 36px; }
  .input, .select, .textarea { font-size: 16px; }
  .search { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .more-label { display: inline-flex; width: 100%; height: 44px; }
  /* “更多条件”的复选框只是把样子藏起来：display: none 会让键盘和读屏软件都到不了后面三个条件 */
  .toggle-more { display: block; position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .toggle-more:focus-visible + .more-label { outline: 2px solid var(--orange-ink); outline-offset: 2px; }
  .extra-filters { display: none; grid-column: 1 / -1; }
  .toggle-more:checked ~ .extra-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .field-end .btn { width: 100%; }
  .table-wrap.is-results { display: none; }
  .result-list { display: block; }
  .result-list .badge { white-space: normal; height: auto; min-height: 22px; padding-top: 3px; padding-bottom: 3px; }
  .ident { display: block; }
  .ident-no { margin-top: 4px; font-size: 20px; white-space: normal; overflow-wrap: anywhere; }
  .ident-no .badge { height: auto; min-height: 22px; margin-left: 8px; padding: 3px 10px; font-size: 12px; vertical-align: 0; white-space: normal; }
  .updated { padding-bottom: 0; }
  dl.sheet-grid { grid-template-columns: minmax(0, 1fr); }
  dl.sheet-grid > div { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi, .kpi:nth-child(3n) { border-right: 1px solid var(--line); border-top: 1px solid var(--line); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-child(-n + 2) { border-top: 0; }
  .kpi:last-child { border-right: 0; }
  .feed li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4, .form-grid.cols-5, .fields { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .setting-control { flex-wrap: wrap; }
  .setting-control .input, .setting-control .select { width: 100%; max-width: none; }
  .setting-control .input.pair { width: auto; flex: 1 1 120px; }
  .facts { gap: 4px 16px; }
  .error-box, .token-box { margin: 24px auto; padding: 24px 20px; }
  .pager { flex-wrap: wrap; }
  .pager .dim { flex-basis: 100%; }
}

/* 登录页：右栏用自动外边距居中——内容比视口高时从顶部开始、可以滚动（`justify-content: center` 会把顶部裁掉）；
   出错提示不贴着引导语 */
.formcol { justify-content: flex-start; }
.formcol > :first-child { margin-top: auto; }
.formcol > :last-child { margin-bottom: auto; }
.formcol .lede { margin: 4px 0 12px; }

@media (max-width: 800px) {                 /* 登录页：品牌栏收到顶部，表单在下 */
  .login { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .brandcol { gap: 16px; padding: 24px 20px; }
  .brandcol-mid { margin: 0; }
  .brandcol h1 { margin-top: 12px; font-size: 22px; }
  .brandcol p { font-size: 14px; }
  .login-demo { display: none; }
  .formcol { padding: 32px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
