/* 货盘工作台：演示界面。桌面双栏独立滚动，窄屏在原列表上打开详情。 */
:root {
  color-scheme: light;
  --surface: oklch(1 0 0);
  --sidebar: oklch(.977 .003 343);
  --surface-soft: oklch(.982 .002 343);
  --surface-hover: oklch(.963 .004 343);
  --ink: oklch(.26 .007 343);
  --muted: oklch(.49 .007 343);
  --subtle: oklch(.54 .007 343);
  --line: oklch(.914 .005 343);
  --line-strong: oklch(.83 .007 343);
  --accent: oklch(.49 .18 343);
  --accent-hover: oklch(.43 .17 343);
  --accent-soft: oklch(.968 .016 343);
  --accent-border: oklch(.86 .05 343);
  --warning: oklch(.48 .105 70);
  --warning-soft: oklch(.97 .027 79);
  --success: oklch(.43 .095 169);
  --success-soft: oklch(.962 .025 169);
  --info: oklch(.46 .1 247);
  --info-soft: oklch(.964 .019 247);
  --error: oklch(.48 .18 26);
  --error-soft: oklch(.968 .017 26);
  --sidebar-width: 192px;
  --page-gutter: 32px;
  --radius: 8px;
  --motion: 160ms;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --z-sticky: 10;
  --z-detail: 20;
  --z-toast: 40;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--surface); }
body { margin: 0; color: var(--ink); font: .875rem/1.55 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button, input, select, textarea { color: inherit; }
button { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex: none; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: fixed; z-index: 60; top: 12px; left: 12px; padding: 10px 16px; border-radius: 6px; background: var(--ink); color: white; transform: translateY(-150%); }
.skip:focus { transform: translateY(0); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: var(--z-sticky); width: var(--sidebar-width); display: flex; flex-direction: column; padding: 25px 14px 18px; border-right: 1px solid var(--line); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; font-size: 18px; font-weight: 650; letter-spacing: .01em; }
.brand-mark { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: white; font-size: 17px; font-weight: 600; }
.brand-caption { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; letter-spacing: .02em; }
.workspace-label { margin: 38px 12px 12px; color: var(--subtle); font-size: 12px; }
#navigation { display: flex; flex-direction: column; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 42px; padding: 10px 12px; border-radius: var(--radius); color: var(--muted); transition: background var(--motion), color var(--motion); }
.nav-item:hover { color: var(--ink); background: var(--surface-hover); }
.nav-item.active { color: var(--accent); background: oklch(.945 .025 343); font-weight: 600; }
.nav-icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 19px; }
.nav-count { display: inline-grid; place-items: center; min-width: 20px; min-height: 20px; margin-left: auto; padding: 0 5px; border-radius: 5px; background: oklch(.921 .007 343); color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.active .nav-count { color: var(--accent); background: oklch(.9 .044 343); }
.sidebar-bottom { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 18px 8px 0; border-top: 1px solid var(--line); font-size: 12px; }
.avatar { display: grid; place-items: center; flex: none; width: 31px; height: 31px; border-radius: 50%; background: oklch(.91 .012 343); color: var(--muted); }
.sidebar-bottom small { display: block; margin-top: 2px; font-size: 11px; color: var(--subtle); }
.local-dot { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--success); }
#main { display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; margin-left: var(--sidebar-width); overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none; min-height: 59px; padding: 10px var(--page-gutter); border-bottom: 1px solid var(--line); }
.breadcrumb { display: inline-flex; align-items: center; gap: 12px; color: var(--subtle); font-size: 12px; }
.breadcrumb > span { color: var(--line-strong); }
.breadcrumb b { color: var(--muted); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 13px; }
.demo-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.demo-label > span { width: 5px; height: 5px; border-radius: 50%; background: var(--subtle); }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex: none; padding: 28px var(--page-gutter) 19px; }
.page-heading > div { min-width: 0; }
h1 { font-size: 1.625rem; line-height: 1.3; font-weight: 650; letter-spacing: -.025em; }
.page-heading p { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.page-heading > button { flex: none; }
.workflow-strip { display: flex; align-items: center; flex: none; gap: 14px; min-height: 37px; margin: 0 var(--page-gutter) 7px; color: var(--muted); font-size: 12px; }
.workflow-strip > span { white-space: nowrap; }
.workflow-strip i { color: var(--line-strong); font-size: 16px; font-style: normal; }
.loop-step { display: inline-flex; align-items: center; gap: 7px; }
.loop-step b { font-weight: 500; font-size: 15px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 18px; min-height: 66px; padding: 11px var(--page-gutter) 14px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.filter { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 6px 11px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; white-space: nowrap; transition: background var(--motion), border-color var(--motion), color var(--motion); }
.filter:hover { background: var(--surface-hover); color: var(--ink); }
.filter.active { border-color: var(--line); background: var(--surface-soft); color: var(--ink); font-weight: 600; }
.count { color: var(--subtle); font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; }
.filter.active .count { color: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; flex: 0 1 230px; width: 230px; min-width: 160px; min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color var(--motion), outline-color var(--motion); }
.search > span { flex: none; color: var(--muted); font-size: 22px; line-height: 1; }
.search:focus-within { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 1px; }
.search input { display: block; min-width: 0; width: 100%; padding: 8px 0; border: 0; outline: none; background: transparent; font-size: 12px; }
.search input::placeholder { color: var(--subtle); opacity: 1; }
.workspace { display: grid; grid-template-columns: minmax(0, 48fr) minmax(0, 52fr); flex: 1; min-height: 0; margin: 0 var(--page-gutter); border-top: 1px solid var(--line); }
.list-panel { min-width: 0; min-height: 0; padding-right: 24px; overflow-y: auto; scrollbar-gutter: stable; overscroll-behavior-y: contain; }
.list-heading { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 12px 10px; background: var(--surface); color: var(--muted); font-size: 12px; }
#result-count { color: var(--subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }
.task-row, .archive-row, .change-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 14px; align-items: start; gap: 14px; width: 100%; padding: 19px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface); text-align: left; transition: background var(--motion); }
.task-row:hover { background: var(--surface-soft); }
.task-row.selected { background: var(--accent-soft); }
.task-row:focus-visible { position: relative; z-index: 1; outline-offset: -2px; }
.number-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; width: 48px; min-height: 48px; padding: 7px 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); color: var(--muted); font-size: 17px; line-height: 1.15; font-weight: 550; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.number-tile small { display: block; margin-top: 3px; font-size: 10px; font-weight: 500; letter-spacing: .02em; }
.selected .number-tile { border-color: var(--accent-border); background: var(--surface); color: var(--accent); }
.task-body { display: block; min-width: 0; }
.task-title { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 14px; line-height: 1.55; font-weight: 600; overflow-wrap: anywhere; }
.task-description { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.task-meta { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.task-meta + .task-meta { margin-top: 4px; color: var(--subtle); }
.row-arrow { align-self: center; color: var(--subtle); font-size: 21px; line-height: 1; font-weight: 300; }
.selected .row-arrow { color: var(--accent); }
.tag { display: inline-flex; align-items: center; flex: none; min-height: 20px; padding: 2px 6px; border-radius: 4px; background: var(--surface-hover); color: var(--muted); font-size: 11px; line-height: 1.4; font-weight: 500; white-space: nowrap; letter-spacing: 0; }
.tag.primary { background: oklch(.939 .028 343); color: var(--accent); }
.tag.neutral { background: oklch(.949 .004 343); color: var(--muted); }
.tag.warn { background: var(--warning-soft); color: var(--warning); }
.tag.good { background: var(--success-soft); color: var(--success); }
.tag.info { background: var(--info-soft); color: var(--info); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; padding: 42px 20px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 15px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 17px; }
.empty-state h3 { font-size: 15px; font-weight: 550; }
.empty-state p { max-width: 34ch; margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.empty-state button { margin-top: 20px; }
/* 档案内容用分隔线组织，销售链接和手中实物始终分开显示。 */
.detail-panel { min-width: 0; min-height: 0; padding: 23px 0 28px 28px; border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; scrollbar-gutter: stable; overscroll-behavior-y: contain; }
.detail-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.detail-close { display: none !important; }
.detail-identity { display: flex; align-items: center; gap: 15px; margin-top: 18px; }
.detail-identity > div:last-child { min-width: 0; }
.detail-code { display: grid; place-items: center; flex: none; width: 54px; height: 54px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--ink); font-size: 21px; font-weight: 550; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.detail-name { font-size: 18px; font-weight: 650; line-height: 1.45; letter-spacing: -.015em; overflow-wrap: anywhere; }
.detail-subtitle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin: 24px 0 22px; padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.fact { min-width: 0; }
.fact + .fact { padding-left: 22px; border-left: 1px solid var(--line); }
.fact-label { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }
.fact-main { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 10px; font-size: 14px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
.fact-main > span:first-child { display: inline-grid; place-items: center; flex: none; min-width: 23px; height: 23px; padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; font-weight: 600; line-height: 1; }
.fact-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.next-actions { margin-bottom: 22px; }
.next-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 2px; }
.next-heading h3 { font-size: 13px; font-weight: 650; }
.next-heading > span { color: var(--subtle); font-size: 11px; }
.pending-item { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.pending-item:last-child { border-bottom: 0; padding-bottom: 0; }
.pending-item > div:first-child { flex: 1 1 210px; min-width: 0; }
.pending-title { font-size: 13px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
.pending-note { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 11px; }
.pending-item > .button-row { flex: 0 1 auto; max-width: 100%; margin-top: 0; }
.complete-line { display: flex; align-items: center; gap: 7px; margin-top: 16px; color: var(--success); font-size: 13px; line-height: 1.65; }
.detail-tabs { position: sticky; top: -1px; z-index: 3; display: flex; align-items: stretch; gap: 24px; min-height: 45px; margin-bottom: 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.detail-tab { position: relative; flex: none; padding: 11px 0 12px; border: 0; background: transparent; color: var(--muted); font-size: 13px; white-space: nowrap; transition: color var(--motion); }
.detail-tab:hover { color: var(--ink); }
.detail-tab.active { color: var(--accent); font-weight: 600; }
.detail-tab.active::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: var(--accent); }
.detail-tab:focus-visible { outline-offset: -2px; }
.detail-records { min-width: 0; }
.timeline { margin: 0; padding: 3px 0 0; list-style: none; }
.event { position: relative; display: grid; grid-template-columns: 13px minmax(0, 1fr); align-items: start; gap: 13px; padding-bottom: 22px; }
.event::before { content: ""; position: absolute; top: 14px; bottom: -6px; left: 6px; width: 1px; background: var(--line); }
.event:last-child { padding-bottom: 0; }
.event:last-child::before { display: none; }
.event-dot { position: relative; z-index: 1; display: block; width: 7px; height: 7px; margin: 7px 3px 0; border-radius: 50%; background: var(--line-strong); }
.event:first-child .event-dot { background: var(--accent); }
.event-dot.switch { border: 1.5px solid var(--accent); background: var(--surface); }
.event:first-child .event-dot.switch { background: var(--accent); }
.event-body { min-width: 0; }
.event-title { font-size: 13px; font-weight: 550; line-height: 1.65; overflow-wrap: anywhere; }
.event-title .tag { margin-left: 4px; vertical-align: middle; }
.event-detail { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; }
.event-meta { margin-top: 7px; color: var(--subtle); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.link-row, .sample-row { display: flex; align-items: flex-start; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.link-row:first-child, .sample-row:first-child { padding-top: 3px; }
.link-row:last-child, .sample-row:last-child { border-bottom: 0; }
.link-letter { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); font-size: 13px; font-weight: 600; }
.link-info { flex: 1; min-width: 0; }
.link-info strong { font-size: 13px; font-weight: 600; }
.sample-state { display: flex; flex: none; flex-direction: column; align-items: flex-end; gap: 8px; margin-left: auto; }
.page-footer { display: flex; align-items: center; justify-content: space-between; flex: none; flex-wrap: wrap; gap: 6px 16px; min-height: 39px; margin: 0 var(--page-gutter); padding: 10px 0; border-top: 1px solid var(--line); color: var(--subtle); font-size: 11px; line-height: 1.55; }
/* 控件保留可见键盘焦点；触屏尺寸在窄屏规则中加大。 */
.primary-button, .outline-button, .quiet-button, .icon-button, .small-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 7px 12px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; font-size: 13px; font-weight: 500; line-height: 1.45; text-align: center; text-decoration: none; white-space: nowrap; transition: color var(--motion), border-color var(--motion), background var(--motion); }
.primary-button { border-color: var(--accent); background: var(--accent); color: white; }
.primary-button:hover:not(:disabled) { border-color: var(--accent-hover); background: var(--accent-hover); }
.primary-button:active:not(:disabled) { background: oklch(.39 .155 343); }
.outline-button { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.outline-button:hover:not(:disabled) { border-color: var(--subtle); background: var(--surface-soft); }
.quiet-button { color: var(--muted); }
.quiet-button:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink); }
.icon-button { flex: none; width: 32px; min-height: 32px; padding: 4px; color: var(--muted); font-size: 18px; font-weight: 400; line-height: 1; }
#help-button { width: 27px; min-height: 27px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 14px; }
.small-button { min-height: 30px; padding: 5px 9px; font-size: 12px; }
button:disabled, button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
button[aria-busy="true"] { cursor: progress; }
/* 原生 dialog 负责焦点和遮罩层级，样式仅负责内容与状态呈现。 */
dialog { width: min(500px, calc(100vw - 40px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 18px 60px oklch(.26 .007 343 / .22); overflow-y: auto; overscroll-behavior: contain; }
dialog[open] { animation: dialog-enter var(--motion) var(--ease); }
dialog::backdrop { background: oklch(.26 .007 343 / .36); }
#dialog-content, #dialog-form { min-width: 0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 23px 24px 18px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 17px; font-weight: 650; line-height: 1.5; }
.dialog-head .icon-button { margin: -5px -6px -5px 0; }
.dialog-body { padding: 20px 24px 22px; }
.dialog-body p { color: var(--muted); font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.dialog-body p + p { margin-top: 9px; }
.dialog-body p > b { color: var(--ink); font-weight: 600; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.form-field { display: flex; flex-direction: column; gap: 7px; margin: 18px 0 16px; font-size: 13px; font-weight: 500; }
.form-field > span { color: var(--subtle); font-size: 11px; font-weight: 400; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-width: 0; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; font-weight: 400; line-height: 1.5; transition: border-color var(--motion); }
.form-field textarea { min-height: 88px; resize: vertical; }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--subtle); opacity: 1; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 1px; }
.form-field [aria-invalid="true"], .form-field :user-invalid { border-color: var(--error); }
.check-field { display: flex; align-items: flex-start; gap: 9px; margin-top: 21px; font-size: 13px; line-height: 1.7; cursor: pointer; }
.check-field input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); cursor: pointer; }
.check-field > span { min-width: 0; }
.help-section h3 { margin-bottom: 8px; font-size: 13px; font-weight: 650; }
.help-section + .help-section { margin-top: 22px; padding-top: 19px; border-top: 1px solid var(--line); }
.dialog-body > p + .help-section { margin-top: 22px; padding-top: 19px; border-top: 1px solid var(--line); }
.help-section > button { display: flex; width: fit-content; margin-top: 10px; white-space: normal; text-align: left; }
.dialog-body .dialog-error { margin-top: 17px; padding: 10px 12px; border-radius: 6px; background: var(--error-soft); color: var(--error); font-size: 12px; line-height: 1.65; }
.dialog-error:empty { display: none; }
#storage-error { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; flex: none; margin: 16px var(--page-gutter) 0; padding: 12px 14px; border: 1px solid oklch(.85 .055 26); border-radius: var(--radius); background: var(--error-soft); color: var(--error); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
#storage-error button { margin-left: auto; }
#toast { position: fixed; right: 24px; bottom: 24px; z-index: var(--z-toast); max-width: min(440px, calc(100vw - 40px)); padding: 11px 16px; border-radius: 8px; background: var(--ink); color: white; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity var(--motion), transform var(--motion) var(--ease); }
#toast.show { opacity: 1; transform: translateY(0); }
noscript { display: block; position: fixed; inset: 20px 20px auto; z-index: 100; padding: 15px; border: 1px solid var(--error); border-radius: 8px; background: var(--surface); color: var(--error); }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes detail-enter { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@media (max-width: 1099px) {
  :root { --sidebar-width: 164px; --page-gutter: 24px; }
  .sidebar { padding-inline: 10px; }
  .brand { gap: 9px; padding-inline: 6px; }
  .brand-mark { width: 30px; height: 30px; font-size: 16px; }
  .brand-caption { font-size: 10px; }
  .nav-item { gap: 9px; padding-inline: 10px; font-size: 13px; }
  .workspace-label { margin-inline: 10px; }
  .search { flex-basis: 194px; width: 194px; }
  .toolbar { align-items: flex-start; gap: 12px; }
  .filters { gap: 4px; }
  .filter { padding-inline: 8px; }
  .list-panel { padding-right: 17px; }
  .detail-panel { padding-left: 21px; }
  .task-row, .archive-row, .change-row { grid-template-columns: 40px minmax(0, 1fr) 10px; gap: 11px; padding-inline: 9px; }
  .number-tile { width: 40px; min-height: 43px; font-size: 16px; }
  .facts { gap: 15px; }
  .fact + .fact { padding-left: 15px; }
  .workflow-strip { gap: 10px; }
}
@media (max-width: 819px) {
  #main { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  .workspace { display: block; flex: 1; min-height: 400px; }
  .list-panel { overflow: visible; padding-right: 0; scrollbar-gutter: auto; }
  .list-heading { position: static; }
  .toolbar { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .search { flex: none; width: 100%; }
  .detail-panel { position: fixed; inset: 0; z-index: var(--z-detail); display: none; height: 100vh; height: 100dvh; padding: 0 28px 32px; border: 0; overflow-y: auto; scrollbar-gutter: auto; }
  body.detail-open { overflow: hidden; }
  .detail-open .detail-panel { display: block; animation: detail-enter 180ms var(--ease); }
  .detail-top { position: sticky; top: 0; z-index: var(--z-sticky); min-height: 62px; margin-inline: -28px; padding: 20px 64px 18px 28px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .detail-close { position: absolute; top: 13px; right: 20px; display: inline-flex !important; width: 36px; min-height: 36px; font-size: 22px; }
  .detail-identity { margin-top: 22px; }
  .detail-tabs { position: static; }
  .page-heading { padding-top: 24px; }
  h1 { font-size: 24px; }
  .workflow-strip { flex-wrap: wrap; gap: 4px 10px; padding-block: 4px; }
  .task-row, .archive-row, .change-row { grid-template-columns: 46px minmax(0, 1fr) 12px; gap: 14px; }
  .number-tile { width: 46px; min-height: 46px; }
  .page-footer > span:last-child { display: none; }
}
@media (max-width: 559px) {
  :root { --page-gutter: 18px; }
  .sidebar { position: relative; inset: auto; z-index: 1; width: 100%; padding: 14px 14px 9px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { gap: 8px; align-items: center; width: fit-content; padding: 0 4px; font-size: 16px; }
  .brand-mark { width: 27px; height: 27px; border-radius: 7px; font-size: 14px; }
  .brand > span:last-child { display: flex; align-items: baseline; gap: 9px; }
  .brand-caption { display: inline; margin: 0; font-size: 11px; letter-spacing: 0; }
  .workspace-label, .sidebar-bottom { display: none; }
  #navigation { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; margin-top: 14px; }
  .nav-item { justify-content: center; gap: 5px; min-height: 40px; padding: 9px 3px; border-radius: 7px; font-size: 12px; white-space: nowrap; }
  .nav-icon { display: none; }
  .nav-count { min-width: 16px; min-height: 16px; margin-left: 0; padding-inline: 3px; border-radius: 4px; font-size: 10px; }
  #main { min-height: calc(100vh - 105px); min-height: calc(100dvh - 105px); margin-left: 0; }
  .topbar { gap: 8px; min-height: 48px; padding-block: 7px; }
  .breadcrumb { gap: 7px; font-size: 11px; white-space: nowrap; }
  .top-actions { gap: 7px; }
  .demo-label { gap: 4px; font-size: 11px; }
  .top-actions .quiet-button { min-height: 31px; padding: 5px 6px; font-size: 11px; }
  #help-button { width: 26px; min-height: 26px; font-size: 13px; }
  .page-heading { align-items: flex-start; gap: 12px; padding-top: 22px; padding-bottom: 11px; }
  .page-heading h1 { font-size: 24px; }
  .page-heading p { max-width: 28ch; margin-top: 7px; font-size: 12px; line-height: 1.7; }
  #export-button { min-height: 33px; margin-top: 1px; padding: 6px 9px; font-size: 11px; }
  .workflow-strip { gap: 5px 7px; min-height: 34px; margin-bottom: 3px; font-size: 11px; line-height: 1.6; }
  .workflow-strip i { font-size: 14px; }
  .loop-step { gap: 4px; }
  .loop-step b { font-size: 13px; }
  .toolbar { gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .search { min-height: 38px; }
  .search input { padding-block: 9px; font-size: 16px; line-height: 1.25; }
  .search input::placeholder { font-size: 12px; }
  .filters { gap: 4px; }
  .filter { gap: 5px; min-height: 36px; padding: 7px 9px; font-size: 12px; }
  .count { font-size: 10px; }
  .list-heading { min-height: 42px; padding: 10px 3px; font-size: 11px; }
  .task-row, .archive-row, .change-row { grid-template-columns: 40px minmax(0, 1fr) 10px; gap: 10px; padding: 17px 5px; }
  .number-tile { width: 40px; min-height: 43px; border-radius: 8px; font-size: 16px; }
  .task-title { gap: 6px; font-size: 13px; }
  .task-description { gap: 6px; margin-top: 6px; font-size: 12px; }
  .task-meta { margin-top: 8px; font-size: 11px; line-height: 1.65; }
  .tag { min-height: 19px; padding: 2px 5px; font-size: 10px; }
  .row-arrow { font-size: 20px; }
  .detail-panel { padding-inline: 18px; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .detail-top { min-height: 59px; margin-inline: -18px; padding: 18px 57px 16px 18px; }
  .detail-close { top: 11px; right: 12px; }
  .detail-identity { gap: 12px; }
  .detail-code { width: 50px; height: 50px; font-size: 20px; }
  .detail-name { font-size: 17px; line-height: 1.55; }
  .detail-subtitle { gap: 7px; margin-top: 5px; font-size: 11px; }
  .facts { gap: 13px; margin-top: 21px; margin-bottom: 21px; padding-bottom: 21px; }
  .fact + .fact { padding-left: 13px; }
  .fact-label { font-size: 11px; }
  .fact-main { gap: 6px; margin-top: 9px; font-size: 13px; }
  .fact-main > span:first-child { min-width: 21px; height: 21px; font-size: 11px; }
  .fact-note { gap: 6px; font-size: 11px; }
  .pending-item { padding-block: 15px; gap: 11px; }
  .pending-item > div:first-child { flex-basis: 100%; }
  .pending-item > .button-row { width: 100%; }
  .next-actions { margin-bottom: 20px; }
  .detail-tabs { gap: 25px; margin-bottom: 17px; }
  .detail-tab { min-height: 45px; font-size: 13px; }
  .event { gap: 11px; padding-bottom: 21px; }
  .event-title { font-size: 13px; }
  .event-detail { font-size: 12px; }
  .link-row, .sample-row { gap: 10px; }
  .sample-state { max-width: 116px; }
  .sample-state .tag { white-space: normal; text-align: right; }
  .sample-state .button-row { flex-direction: column; align-items: flex-end; }
  .primary-button, .outline-button, .quiet-button { min-height: 38px; }
  .small-button { min-height: 34px; padding: 6px 10px; }
  .page-footer { min-height: 39px; padding-bottom: max(10px, env(safe-area-inset-bottom)); font-size: 10px; }
  .empty-state { min-height: 280px; padding-inline: 10px; }
  dialog { width: calc(100vw - 24px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); border-radius: 11px; }
  .dialog-head { gap: 10px; padding: 20px 19px 16px; }
  .dialog-head h2 { font-size: 16px; }
  .dialog-body { padding: 18px 19px 20px; }
  .dialog-footer { padding: 14px 19px max(14px, env(safe-area-inset-bottom)); }
  .dialog-footer > button { min-height: 40px; }
  .form-field input, .form-field select, .form-field textarea { min-height: 44px; font-size: 16px; }
  .form-field input::placeholder, .form-field textarea::placeholder { font-size: 13px; }
  .check-field { gap: 10px; }
  .check-field input { width: 18px; height: 18px; margin-top: 2px; }
  #storage-error { margin-top: 12px; padding: 11px 12px; font-size: 12px; }
  #storage-error button { margin-left: 0; }
  #toast { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); left: 16px; max-width: none; padding: 11px 14px; font-size: 12px; }
}
@media (max-width: 359px) {
  :root { --page-gutter: 14px; }
  .nav-item { gap: 3px; font-size: 11px; }
  .nav-count { font-size: 9px; }
  .breadcrumb { display: none; }
  .topbar { justify-content: flex-end; }
  .fact + .fact { padding-left: 10px; }
  .facts { gap: 10px; }
  .filter { padding-inline: 7px; }
  .detail-tabs { gap: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  dialog[open], .detail-open .detail-panel { animation: none; }
  #toast { transform: none; }
}
@media (forced-colors: active) {
  .nav-item.active, .filter.active, .task-row.selected { outline: 1px solid Highlight; outline-offset: -1px; }
  .primary-button, .outline-button { border: 1px solid ButtonText; }
  .tag, .number-tile, .link-letter, .detail-code { border: 1px solid GrayText; }
  .event-dot, .event-dot.switch { border: 1px solid CanvasText; background: CanvasText; }
  .event::before { background: GrayText; }
  .detail-tab.active::after { background: Highlight; }
  #toast { border: 1px solid CanvasText; }
}

.auth-page{display:grid;place-items:center;min-height:100vh;background:#f7f7f8}.auth-card{width:min(420px,92vw);padding:40px;background:white;border:1px solid #e6e6e8;border-radius:16px;margin:0}.auth-card h1{font-size:26px;margin-top:28px}.auth-card p{color:#65646a;line-height:1.7}.auth-card form{display:grid;gap:16px;margin:24px 0}.auth-card>a{font-size:13px;color:#766875}.auth-card button{width:100%}.data-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}.detail-tools{display:flex;gap:8px;margin-top:10px}.form-field textarea,.form-field select{width:100%;padding:10px;border:1px solid #d7d6dc;border-radius:7px;background:white;font:inherit;line-height:1.5;resize:vertical}.form-field input[type=file]{max-width:100%}.evidence{margin-top:6px!important;color:#66616a!important;white-space:pre-wrap;overflow-wrap:anywhere}.product-link{color:var(--accent,#a03357);text-decoration:underline}.recovery-note{padding:12px;background:#f2edf1;border-radius:8px}.dialog-body{max-height:65vh;overflow:auto}.dialog-error{white-space:pre-wrap}.empty-state button{margin-top:12px}.top-actions{flex-wrap:wrap}.demo-label{white-space:normal}button:disabled{cursor:not-allowed;opacity:.5}

/* Long feedback forms use one scrolling body; header and actions stay reachable. */
dialog { overflow: hidden; }
#dialog-form { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.dialog-head,.dialog-footer { flex: none; }
.dialog-body { min-height: 0; max-height: none; overflow-y: auto; }
