/* Shared production design system. All data, forms and permissions stay in the existing UI modules. */
:root {
  --ui-bg: #f3f5f0;
  --ui-surface: #ffffff;
  --ui-soft: #f8faf6;
  --ui-hover: #edf2e9;
  --ui-ink: #29392f;
  --ui-text: #4d5e51;
  --ui-muted: #677565;
  --ui-line: #dce4d7;
  --ui-accent: #356447;
  --ui-accent-hover: #294f37;
  --ui-accent-soft: #eaf2e6;
  --ui-on-accent: #ffffff;
  --ui-amber: #865b13;
  --ui-amber-soft: #faf1df;
  --ui-red: #a13f3b;
  --ui-red-soft: #f9eae6;
  --ui-blue: #426b82;
  --ui-blue-soft: #eaf1f5;
  --ui-purple: #765788;
  --ui-purple-soft: #f0eaf5;
  --ui-overlay: #15251aa6;
  --ui-shadow: 0 16px 50px #263d3112;
  --ui-radius: 13px;
  --ui-nav-width: 240px;
  --mast-height: 76px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ui-bg: #141c18;
  --ui-surface: #1c2720;
  --ui-soft: #202e25;
  --ui-hover: #2a3b2e;
  --ui-ink: #e3ebdf;
  --ui-text: #bdcbb8;
  --ui-muted: #9dac96;
  --ui-line: #354637;
  --ui-accent: #b0d09a;
  --ui-accent-hover: #c6e7b0;
  --ui-accent-soft: #30472d;
  --ui-on-accent: #172319;
  --ui-amber: #e1bc77;
  --ui-amber-soft: #473b24;
  --ui-red: #efa6a0;
  --ui-red-soft: #472d2b;
  --ui-blue: #9bc4d9;
  --ui-blue-soft: #2a3d47;
  --ui-purple: #c9afd9;
  --ui-purple-soft: #3a3043;
  --ui-overlay: #050b07ce;
  --ui-shadow: 0 16px 50px #0003;
  color-scheme: dark;
}
:root, body {
  --green: var(--ui-ink);
  --accent: var(--ui-accent);
  --border: var(--ui-line);
  --surface: var(--ui-surface);
  --soft: var(--ui-accent-soft);
  --muted: var(--ui-muted);
  background: var(--ui-bg);
  color: var(--ui-ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body { min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { min-height: 40px; border-radius: 8px; padding: 8px 14px; font-size: 14px; font-weight: 550; }
button:hover:not(:disabled) { transform: none; box-shadow: none; filter: none; }
button:disabled { opacity: .48; cursor: not-allowed; }
:is(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid var(--ui-accent); outline-offset: 3px; }
button.primary, .primary { background: var(--ui-accent); color: var(--ui-on-accent); border-color: var(--ui-accent); }
button.primary:hover:not(:disabled) { background: var(--ui-accent-hover); }
button.secondary, .secondary { background: var(--ui-surface); color: var(--ui-text); border: 1px solid var(--ui-line); }
button.secondary:hover:not(:disabled) { background: var(--ui-hover); color: var(--ui-ink); }
button.danger, .danger, .archive-cleanup-results .danger { background: var(--ui-red-soft); color: var(--ui-red); border: 1px solid var(--ui-red); }
input, select, textarea { background: var(--ui-surface); color: var(--ui-ink); border: 1px solid var(--ui-line); border-radius: 8px; min-height: 42px; padding: 9px 12px; }
input::placeholder, textarea::placeholder { color: var(--ui-muted); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ui-accent); min-height: 20px; width: 20px; height: 20px; flex: none; }
input[type="date"] { min-width: 0; }
a { color: var(--ui-accent); }
p { line-height: 1.75; }
h2, h3, h4, strong { color: var(--ui-ink); }
h3 { font-weight: 650; }
small { font-size: 12px; }
.muted, .setting-help, .eyebrow { color: var(--ui-muted); }
.eyebrow { font-size: 12px; letter-spacing: .06em; }
.toolbar { gap: 8px; }
.skip-link { position: fixed; left: 16px; top: -80px; padding: 12px 20px; background: var(--ui-surface); border: 2px solid var(--ui-accent); border-radius: 8px; z-index: 200; }
.skip-link:focus { top: 12px; }
.navigation-icon { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }

/* Consistent header and grouped navigation across every authenticated page. */
.masthead { height: var(--mast-height); min-height: var(--mast-height); padding: 12px 26px; background: var(--ui-surface); border-bottom: 1px solid var(--ui-line); color: var(--ui-ink); gap: 14px; box-shadow: none; }
.brand { gap: 12px; }
.brand-mark { width: 39px; height: 39px; border-radius: 12px; background: var(--ui-accent); color: var(--ui-on-accent); font-size: 23px; }
.masthead h1 { font-size: 18px; font-weight: 650; letter-spacing: .02em; }
.masthead .eyebrow { color: var(--ui-muted); font-size: 12px; letter-spacing: .03em; }
.header-button { min-height: 38px; font-size: 13px; padding: 7px 10px; color: var(--ui-text); background: transparent; border: 1px solid var(--ui-line); }
.header-button:hover:not(:disabled) { color: var(--ui-ink); background: var(--ui-hover); }
#themeToggle { flex: none; order: 3; }
#themeToggle[aria-pressed="true"] { background: var(--ui-accent-soft); border-color: var(--ui-accent); color: var(--ui-accent); }
#themeToggle::before { content: "◐"; display: inline-block; margin-right: 7px; font-size: 17px; line-height: 1; vertical-align: -1px; }
#operation { font-size: 12px; padding: 4px 9px; }
main { max-width: none; margin: 0; padding: 0; }
main > #notice { margin: 16px 24px; }
#workspace { grid-template-columns: var(--ui-nav-width) minmax(0, 1fr); gap: 0; min-height: calc(100dvh - var(--mast-height)); }
#tabs { padding: 20px 14px !important; width: auto; border-right: 1px solid var(--ui-line); border-radius: 0; background: var(--ui-surface); top: var(--mast-height); height: calc(100dvh - var(--mast-height)); scrollbar-width: thin; scrollbar-color: var(--ui-line) transparent; }
.nav-group { gap: 3px; margin-bottom: 23px; }
.nav-label { font-size: 12px; font-weight: 500; letter-spacing: .06em; color: var(--ui-muted); padding: 5px 12px 8px; }
.nav-button { display: flex; align-items: center; gap: 11px; padding: 11px 12px; min-height: 44px; border-radius: 8px; color: var(--ui-text); font-size: 14px; font-weight: 450; line-height: 1.5; text-align: left; white-space: normal; }
.nav-button .navigation-icon { color: var(--ui-muted); }
.nav-button.active { background: var(--ui-accent-soft); color: var(--ui-accent); font-weight: 650; box-shadow: none; }
.nav-button.active .navigation-icon { color: var(--ui-accent); }
.nav-button:hover:not(:disabled) { background: var(--ui-hover); }
.workspace-menu { color: var(--ui-text); border: 1px solid var(--ui-line); border-radius: 8px; min-width: 40px; min-height: 40px; padding: 5px 10px; background: var(--ui-surface); }
#workspaceClose { display: none; margin: 0 0 18px auto; color: var(--ui-text); background: var(--ui-soft); border: 1px solid var(--ui-line); }
body[data-nav-open="true"] #workspaceClose { display: block; }
body[data-nav-open="true"] #tabs { width: min(292px, 88vw); padding: 20px 16px !important; background: var(--ui-surface); box-shadow: var(--ui-shadow); }
.workspace-backdrop { background: var(--ui-overlay); border-radius: 0; }
body[data-workbench="personal"] .workspace-menu { display: inline-flex; align-items: center; justify-content: center; }
#summary { padding: 28px 32px 0; gap: 16px; }
.work-card { padding: 32px clamp(24px, 3vw, 48px) 44px !important; border: 0; background: var(--ui-bg); box-shadow: none; }
.page-heading { margin-bottom: 27px; padding-bottom: 22px; border-color: var(--ui-line); gap: 20px; }
.page-heading h2 { font-size: 28px; line-height: 1.4; font-weight: 650; letter-spacing: .02em; margin-bottom: 9px; }
.page-heading p { font-size: 14px; line-height: 1.8; max-width: 840px; color: var(--ui-muted); }
.page-heading #actions { padding-top: 6px; }
.page-heading .eyebrow { display: block; margin-bottom: 8px; color: var(--ui-accent); }
#homeView, #guideView, #toolsView, #settingsView { animation: none; }

/* Home uses live status and counts; visual structure never supplies sample metrics. */
.home-welcome { padding: 28px 30px !important; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); }
.home-welcome .eyebrow { color: var(--ui-accent); }
.home-welcome h3 { font-size: clamp(25px, 2.3vw, 32px); line-height: 1.5; font-weight: 600; letter-spacing: .02em; margin: 10px 0; }
.home-welcome p { font-size: 16px; max-width: 850px; }
.home-counts { gap: 0; padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--ui-line); flex-wrap: wrap; }
.home-counts > div { flex: 1; min-width: 130px; display: grid; gap: 8px; padding: 4px 24px !important; border: 0 !important; border-left: 1px solid var(--ui-line) !important; background: transparent !important; border-radius: 0 !important; }
.home-counts > div:first-child { padding-left: 0 !important; border-left: 0 !important; }
.home-counts strong { color: var(--ui-ink); font-size: 30px; line-height: 1.25; font-weight: 600; letter-spacing: -.03em; overflow-wrap: anywhere; }
.home-counts span { font-size: 14px; color: var(--ui-muted); }
.home-tasks { gap: 18px; margin: 22px 0; }
.home-task, .home-task:nth-child(n) { padding: 24px; background: var(--ui-surface); border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius) !important; }
.home-task > .navigation-icon { color: var(--ui-accent); background: var(--ui-accent-soft); width: 42px; height: 42px; padding: 10px; border-radius: 11px; margin-bottom: 16px; }
.home-task:nth-child(2) > .navigation-icon { color: var(--ui-purple); background: var(--ui-purple-soft); }
.home-task:nth-child(3) > .navigation-icon { color: var(--ui-blue); background: var(--ui-blue-soft); }
.home-task:nth-child(4) > .navigation-icon { color: var(--ui-amber); background: var(--ui-amber-soft); }
.home-task h3 { font-size: 18px; margin-bottom: 9px; }
.home-task p { font-size: 14px; color: var(--ui-muted); }
.home-task button { font-size: 14px; }
.home-health { padding: 24px; border: 1px solid var(--ui-line); border-radius: var(--ui-radius) !important; background: var(--ui-surface); }
.home-health h3 { margin-top: 0; font-size: 18px; }
.home-health p { font-size: 14px; }
.home-health.storage-overview { margin-bottom: 22px; }
.summary-card { padding: 20px 22px; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); }
.summary-card::before { display: none; }
.summary-card span { font-size: 14px; color: var(--ui-muted); }
.summary-card strong { font-size: 21px; font-weight: 600; margin-top: 12px; }
.summary-card p { font-size: 13px; color: var(--ui-muted); }
.summary-card.attention strong { color: var(--ui-red); }

/* Cards and record/table switching keep existing full editors and search controls. */
.record-grid, .assistant-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); gap: 20px; }
.record-card, .assistant-card { --tone: var(--ui-accent-soft); --ink: var(--ui-accent); --shape: var(--ui-line); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: var(--ui-surface); color: var(--ui-ink); box-shadow: none; animation: none; }
.record-card.theme-1, .assistant-card.theme-1 { --tone: var(--ui-purple-soft); --ink: var(--ui-purple); }
.record-card.theme-2, .assistant-card.theme-2 { --tone: var(--ui-blue-soft); --ink: var(--ui-blue); }
.record-card.theme-3, .assistant-card.theme-3 { --tone: var(--ui-amber-soft); --ink: var(--ui-amber); }
.record-card:hover, .assistant-card:hover { transform: none; border-color: var(--ui-muted); box-shadow: none; }
.record-front, .assistant-front.assistant-front-compact { background: var(--ui-surface); padding: 22px 24px 18px; color: var(--ui-ink); border-bottom: 1px solid var(--ui-line); }
.record-front::before { display: none; }
.record-front h3, .assistant-front h3 { color: var(--ui-ink); font-size: 21px; line-height: 1.5; font-weight: 650; overflow-wrap: anywhere; }
.record-kind, .assistant-purpose { color: var(--ink); background: var(--tone); border-radius: 6px; padding: 4px 8px; font-size: 12px; }
.record-subtitle { font-size: 14px; color: var(--ui-muted); margin-top: 8px; }
.record-body, .assistant-card-body { padding: 22px 24px; gap: 17px; background: var(--ui-surface); }
.record-facts dt, .assistant-card h4 { font-size: 12px; color: var(--ui-muted); font-weight: 500; margin-bottom: 7px; }
.record-facts dd { font-size: 14px; color: var(--ui-ink); line-height: 1.7; }
.record-excerpt, .assistant-description { font-size: 16px; line-height: 1.8; color: var(--ui-text); }
.record-chips span { color: var(--ui-text); background: var(--ui-soft); font-size: 12px; border: 1px solid var(--ui-line); border-radius: 5px; }
.record-open, .assistant-card-body > .primary { font-size: 14px; border: 1px solid var(--ui-line); border-radius: 8px; color: var(--ui-accent); background: var(--ui-accent-soft); }
.record-open:hover:not(:disabled), .assistant-card-body > .primary:hover:not(:disabled) { background: var(--ui-hover); color: var(--ui-accent); }
.assistant-variants { gap: 7px; margin-top: 18px; }
.assistant-mode { font-size: 13px; color: var(--ui-text); background: var(--ui-soft); border: 1px solid var(--ui-line); }
.assistant-mode[aria-pressed="true"] { color: var(--ui-accent); background: var(--ui-accent-soft); border-color: var(--ui-accent); }
.assistant-expand, .assistant-full-description, .assistant-full-description[open] summary { color: var(--ui-accent); font-size: 14px; }
.assistant-toolbar { gap: 16px; margin: 20px 0; }
.assistant-toolbar p { color: var(--ui-muted); font-size: 14px; }
.view-switch { background: var(--ui-hover); padding: 4px; border-radius: 9px; }
.view-switch button { color: var(--ui-muted); font-size: 14px; }
.view-switch button[aria-pressed="true"] { color: var(--ui-accent); background: var(--ui-surface); box-shadow: 0 1px 3px #0001; }
.table-tools { padding: 18px 20px; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: var(--ui-surface); }
.record-search { gap: 10px 16px; }
.record-search .search-label, .record-search details summary, #columnPicker { font-size: 14px; color: var(--ui-text); }
.record-search .search-label input { max-width: 620px; }
#columnPicker[open] { background: var(--ui-soft); border-color: var(--ui-line); }
#searchScope { color: var(--ui-muted); font-size: 13px; }
.lookup-control { color: var(--ui-text); background: var(--ui-soft); border: 1px solid var(--ui-line); }
.lookup-control label, .lookup-control p, .lookup-control button { font-size: 14px; }
.table-wrap, .performance-wrap { border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); }
table { font-size: 14px; color: var(--ui-text); background: var(--ui-surface); }
th, td { border-color: var(--ui-line); padding: 13px 15px; }
th, th:first-child { background: var(--ui-soft); color: var(--ui-muted); font-size: 12px; font-weight: 600; }
td:first-child { background: var(--ui-surface); }
tbody tr:hover td, tbody tr:focus td { background: var(--ui-accent-soft); }
/* The original saved-row feedback uses !important; retain that feedback with theme tokens. */
.just-saved td { background: var(--ui-accent-soft) !important; }
.copy-id, .copy-row { color: var(--ui-accent); background: var(--ui-accent-soft); font-size: 12px; }
.resize-grip::after, .resize-grip:hover { background: var(--ui-line); }
.pagination, .pagination button { font-size: 14px; color: var(--ui-muted); }
.empty, .record-empty { background: var(--ui-surface); border-color: var(--ui-line); color: var(--ui-muted); }
.record-empty p { font-size: 14px; color: var(--ui-muted); }
.badge, .pill, .yes, .assistant-front .pill { color: var(--ui-accent); background: var(--ui-accent-soft); border-radius: 5px; font-size: 12px; padding: 4px 8px; }
.pill.no, .no { color: var(--ui-muted); background: var(--ui-hover); }
.pill.warning, .warning { color: var(--ui-amber); background: var(--ui-amber-soft); }
.pill.error, .error { color: var(--ui-red); background: var(--ui-red-soft); }

/* Settings, assistance, tools and cleanup remain progressive, reviewable forms. */
.tool-group, .settings-group { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius) !important; padding: 24px; margin-bottom: 22px; }
.tool-group > h3, .tool-group > summary, .settings-group > h3, .settings-group > summary { color: var(--ui-ink); font-size: 19px; font-weight: 650; line-height: 1.65; }
.tool-group > p, .settings-group > p { color: var(--ui-text); font-size: 14px; }
.settings-group > summary:hover { color: var(--ui-accent); }
.settings-grid, .tool-grid { gap: 0 24px; }
.tool-item, .setting, .storage-rows .tool-item { background: transparent; border: 0; border-top: 1px solid var(--ui-line); border-radius: 0; padding: 22px 0; }
.tool-item > button, .tool-item:nth-child(n) > button { background: var(--ui-accent-soft); color: var(--ui-accent); font-size: 14px; }
.tool-item p, .tool-item .action-result, .setting-help { font-size: 14px; color: var(--ui-muted); }
.action-result { background: var(--ui-soft); color: var(--ui-text); border-color: var(--ui-line); }
.setting label { font-size: 16px; color: var(--ui-ink); }
.setting > button { font-size: 14px; }
.setting-help { line-height: 1.75; }
.secret-setting label small { color: var(--ui-muted); font-size: 12px; }
.danger-zone { background: var(--ui-red-soft); border: 1px solid var(--ui-red); border-radius: var(--ui-radius); }
.danger-zone h3, .danger-zone p { color: var(--ui-red); }
.danger-zone .lookup-control { background: var(--ui-surface); }
.notice { background: var(--ui-amber-soft); color: var(--ui-amber); border: 1px solid var(--ui-line); border-radius: 9px; padding: 13px 16px; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.notice button { color: inherit; }
.guide-start { background: var(--ui-accent-soft); color: var(--ui-text); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 26px; }
.guide-start h3 { font-size: 22px; }
.guide-start p { font-size: 16px; }
.guide-filters { gap: 16px; margin-block: 24px; }
.guide-categories button { color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-line); font-size: 14px; }
.guide-categories button[aria-pressed="true"] { color: var(--ui-accent); background: var(--ui-accent-soft); border-color: var(--ui-accent); }
.guide-card, .guide-card:nth-child(n) { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius) !important; padding: 24px; }
.guide-card h3 { font-size: 19px; }
.guide-card h4 { color: var(--ui-text); font-size: 16px; }
.guide-card p, .guide-card li, .guide-card .toolbar button, .guide-command { font-size: 14px; color: var(--ui-text); }
.guide-example { border: 1px solid var(--ui-line); background: var(--ui-soft); border-radius: 9px; padding: 16px; }
.guide-example label { color: var(--ui-muted); font-size: 12px; }
.guide-command { background: var(--ui-surface); min-height: 80px; }
.guide-feedback, .guide-note { font-size: 14px; color: var(--ui-muted); border-color: var(--ui-line); }
.guide-example button { font-size: 14px; }
.results-card { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); }
.result { background: var(--ui-soft); border: 1px solid var(--ui-line); border-radius: 8px; }
.result pre, .readonly { background: var(--ui-soft); color: var(--ui-text); font-size: 14px; line-height: 1.8; border-color: var(--ui-line); }
.result summary { color: var(--ui-ink); }
.editor-page { padding: 28px 28px 120px; max-width: 1220px; margin-inline: auto; }
.editor-page form { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); }
.panel-header { background: var(--ui-surface); color: var(--ui-ink); border-color: var(--ui-line); border-radius: var(--ui-radius) var(--ui-radius) 0 0; padding: 24px 28px; }
.panel-header h2 { font-size: 27px; }
.panel-body { background: var(--ui-surface); padding: 16px 28px 28px; }
.editor-section:not(details) { background: var(--ui-surface); border: 0; padding: 18px 0; border-radius: 0 !important; }
.editor-section > h3 { font-size: 19px; border-color: var(--ui-line); }
.editor-section > summary { font-size: 16px; }
.field label { font-size: 14px; color: var(--ui-text); }
.field .muted, .field small { color: var(--ui-muted); font-size: 13px; }
.advanced-fields { background: var(--ui-soft); border-color: var(--ui-line); border-radius: 10px !important; }
.readonly-grid .field { background: var(--ui-soft); border: 1px solid var(--ui-line); border-radius: 8px; }
.field .readonly { background: var(--ui-soft); color: var(--ui-text); border-color: var(--ui-line); }
.hint { background: var(--ui-accent-soft); color: var(--ui-text); border: 1px solid var(--ui-line); border-radius: 8px; font-size: 14px; }
.panel-footer { background: var(--ui-surface); border: 1px solid var(--ui-line); max-width: 1162px; border-radius: 10px 10px 0 0; padding: 14px 24px; box-shadow: var(--ui-shadow); }
.export-options { border-color: var(--ui-line); }
.export-options[open] { background: var(--ui-soft); }
.login-card { margin: 8vh auto; padding: 38px; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 17px; box-shadow: var(--ui-shadow); }
.login-card h2 { font-size: 31px; }
.login-card p { color: var(--ui-muted); font-size: 16px; }
.login-card .muted { font-size: 14px; }
.login-card label { color: var(--ui-text); font-size: 14px; }
.password-dialog { background: var(--ui-surface); color: var(--ui-ink); border: 1px solid var(--ui-line); border-radius: 15px; box-shadow: var(--ui-shadow); }
.password-dialog::backdrop, dialog::backdrop { background: var(--ui-overlay); }
.chat-detail-dialog, .archive-image-viewer { background: var(--ui-surface); color: var(--ui-ink); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); }
.chat-detail-dialog { width: 760px; max-width: calc(100vw - 32px); max-height: 85dvh; overflow: auto; padding: 24px; }
.chat-detail-dialog p { white-space: pre-wrap; overflow-wrap: anywhere; }
.archive-image-viewer { max-width: 95vw; max-height: 95dvh; padding: 16px; }
.archive-image-viewer > button { display: block; margin: 0 0 12px auto; }
.archive-image-viewer img { display: block; max-width: 85vw; max-height: 78dvh; object-fit: contain; }
.chat-detail-dialog h3, .archive-image-viewer h3 { color: var(--ui-ink); }
.chat-detail-dialog p, .chat-detail-dialog .chat-content, .chat-detail-dialog pre { color: var(--ui-text); }
.chat-detail-dialog .chat-detail-section { background: var(--ui-soft); border-color: var(--ui-line); }
.icon-button { color: var(--ui-muted); background: var(--ui-soft); min-width: 40px; min-height: 40px; }
.storage-rows { gap: 0; }
.storage-rows .tool-item { padding: 22px 0; }
.storage-rows .tool-item h3 { font-size: 18px; }
.storage-hero .home-counts { gap: 22px; }
.storage-hero .home-counts > div { border: 0 !important; padding: 0 !important; }
.archive-cleanup-view { background: var(--ui-surface); color: var(--ui-ink); padding: 28px; }
.archive-cleanup-results { background: var(--ui-soft); border: 1px solid var(--ui-line); border-radius: 10px; }
.archive-file { border-color: var(--ui-line); }
.archive-file small { color: var(--ui-muted); }
.archive-file-details > summary, .chat-photo-description > summary { color: var(--ui-accent); font-size: 14px; }
.archive-file-details, .message-identity { color: var(--ui-muted); font-size: 12px; }
.archive-photo { background: var(--ui-soft); border: 1px solid var(--ui-line); }
.assistant-effective-rules { border-color: var(--ui-line); background: var(--ui-soft); color: var(--ui-text); }
.guard-member { border-color: var(--ui-line); color: var(--ui-text); }

/* Official account history remains a separate, read-only message workflow. */
.work-card.message-workspace { background: var(--ui-surface); padding: 0 !important; }
.message-workspace > .page-heading { padding: 20px 26px; margin: 0; }
.message-workspace > .page-heading h2 { font-size: 23px; }
.message-workspace > .page-heading p { font-size: 14px; }
.message-chat { background: var(--ui-surface); color: var(--ui-ink); border-color: var(--ui-line); grid-template-columns: minmax(260px, 310px) minmax(0, 1fr); height: calc(100dvh - var(--mast-height) - 116px); }
.chat-room { background: var(--ui-surface); color: var(--ui-ink); }
.chat-groups, .chat-room-header, .chat-search, .chat-footer { background: var(--ui-surface); border-color: var(--ui-line); }
.chat-groups > h3 { color: var(--ui-ink); font-size: 16px; }
.chat-group-search input, .chat-search input { background: var(--ui-soft); color: var(--ui-ink); border-color: var(--ui-line); }
.chat-group-search button, .chat-search button, .chat-action, .chat-older { background: var(--ui-accent-soft); color: var(--ui-accent); border-color: var(--ui-line); }
.chat-group { min-height: 76px; color: var(--ui-text); padding: 14px 12px; border-radius: 9px; }
.chat-group:hover:not(:disabled), .chat-group[aria-pressed="true"] { background: var(--ui-accent-soft); color: var(--ui-ink); box-shadow: none; }
.chat-group-label strong { color: var(--ui-ink); font-size: 16px; }
.chat-group-label small, .chat-list-status, .chat-count { font-size: 12px; color: var(--ui-muted); }
.chat-avatar { color: var(--ui-accent); background: var(--ui-accent-soft); border-radius: 12px; }
.chat-avatar.tone-1, .chat-avatar.tone-4 { color: var(--ui-purple); background: var(--ui-purple-soft); }
.chat-avatar.tone-2 { color: var(--ui-blue); background: var(--ui-blue-soft); }
.chat-avatar.tone-3 { color: var(--ui-amber); background: var(--ui-amber-soft); }
.chat-room-header h3 { font-size: 18px; color: var(--ui-ink); }
.chat-action, .chat-back, .chat-message-more { color: var(--ui-accent); font-size: 14px; }
.chat-action:hover:not(:disabled), .chat-message-more:hover:not(:disabled) { background: var(--ui-hover); }
.chat-search { font-size: 14px; }
.chat-search summary { color: var(--ui-muted); }
.chat-feedback { color: var(--ui-amber); background: var(--ui-amber-soft); }
.chat-scroll { background: var(--ui-bg); padding: 24px; }
.chat-day { color: var(--ui-muted); background: var(--ui-hover); font-size: 12px; }
.chat-sender { color: var(--ui-text); font-size: 14px; }
.chat-bubble { background: var(--ui-surface); border: 1px solid var(--ui-line); color: var(--ui-ink); box-shadow: none; padding: 12px 16px; }
.chat-message.is-bot .chat-bubble { background: var(--ui-accent-soft); }
.chat-content { color: var(--ui-ink); font-size: 16px; line-height: 1.8; }
.chat-content a { color: var(--ui-accent); }
.chat-quote { background: var(--ui-soft); color: var(--ui-text); border-color: var(--ui-accent); }
.chat-quote strong { color: var(--ui-accent); }
.chat-message-side time, .chat-history-status, .chat-media-kind, .chat-media-hint, .chat-footer, .chat-empty p { font-size: 12px; color: var(--ui-muted); }
.chat-empty-icon { color: var(--ui-accent); background: var(--ui-accent-soft); }
.chat-empty h4 { color: var(--ui-ink); }
.chat-scope p { font-size: 14px; }

@media (min-width: 1700px) {
  #summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  :root { --ui-nav-width: 220px; }
  .masthead { padding-inline: 18px; gap: 10px; }
  .masthead .eyebrow { display: none; }
  .masthead h1 { font-size: 16px; }
  .header-button { font-size: 12px; padding-inline: 8px; }
  #operation { display: none; }
  .work-card { padding: 26px !important; }
  #summary { padding: 24px 26px 0; }
  .settings-grid, .tool-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 850px) {
  .message-chat { display: block; }
  .chat-groups, .chat-room { height: 100%; }
  .chat-scroll { padding: 20px 14px; }
}
@media (max-width: 760px) {
  :root { --mast-height: 116px; }
  .masthead { flex-wrap: wrap; align-content: center; gap: 8px; padding: 10px 14px; }
  .masthead .brand { flex: 1; min-width: 0; }
  .masthead .brand > div { min-width: 0; }
  .brand-mark { width: 33px; height: 33px; border-radius: 10px; font-size: 20px; }
  .masthead h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #themeToggle { order: 0; font-size: 12px; min-height: 38px; padding-inline: 8px; }
  #themeToggle::before { margin-right: 5px; font-size: 16px; }
  .masthead #account { width: 100%; gap: 6px; margin: 0; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; }
  .header-button { font-size: 12px; min-height: 36px; flex: 1; padding: 6px 8px; }
  .workspace-menu { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; min-width: 38px; padding: 5px 8px; font-size: 20px; flex: none; }
  #workspace { display: block; }
  #tabs { display: none; }
  .nav-label { display: block; font-size: 12px; }
  .nav-group { display: grid; margin-bottom: 20px; }
  .nav-button { width: 100%; font-size: 14px; min-height: 44px; }
  .work-card { padding: 24px 16px 34px !important; }
  #summary { padding: 20px 16px 0; gap: 12px; }
  .summary-card { padding: 17px 15px; }
  .summary-card span { font-size: 12px; }
  .summary-card strong { font-size: 18px; }
  .summary-card p { font-size: 12px; }
  .page-heading { flex-wrap: wrap; gap: 16px; margin-bottom: 23px; padding-bottom: 18px; }
  .page-heading h2 { font-size: 25px; }
  .page-heading p { font-size: 14px; }
  .page-heading #actions { padding-top: 0; }
  .home-welcome { padding: 22px 20px !important; }
  .home-welcome h3 { font-size: 26px; }
  .home-counts { gap: 18px 12px; padding-top: 20px; margin-top: 20px; }
  .home-counts > div { min-width: 95px; padding: 0 !important; border: 0 !important; }
  .home-counts strong { font-size: 27px; }
  .home-counts span { font-size: 12px; }
  .home-tasks, .guide-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .home-task, .home-task:nth-child(n), .home-health { padding: 22px; }
  .record-grid, .assistant-grid { grid-template-columns: minmax(0, 1fr); }
  .record-front, .assistant-front.assistant-front-compact, .record-body, .assistant-card-body { padding: 20px; }
  .table-tools { padding: 17px; }
  .record-search > .toolbar { flex-wrap: wrap; }
  .tool-group, .settings-group, .guide-card, .guide-card:nth-child(n) { padding: 20px; }
  .tool-item, .setting { padding-block: 20px; }
  .tool-item button, .setting button { min-height: 44px; white-space: normal; }
  .assistant-toolbar { flex-wrap: wrap; align-items: flex-start; }
  .assistant-toolbar p { margin: 0; }
  .editor-page { padding: 20px 12px 125px; }
  .panel-header { padding: 20px; }
  .panel-header h2 { font-size: 24px; }
  .panel-body { padding: 14px 20px 26px; }
  .panel-footer { padding: 12px 16px; }
  .panel-footer button { min-height: 44px; }
  .editor-field-grid { grid-template-columns: minmax(0, 1fr); }
  .login-card { margin: 30px 16px; padding: 28px; }
  .message-workspace > .page-heading { padding: 17px 16px; }
  .message-chat { height: calc(100dvh - var(--mast-height) - 116px); }
  .chat-content { font-size: 16px; }
  .chat-room-header h3 { font-size: 16px; }
  .chat-search button, .chat-back, .chat-action { min-height: 40px; }
  .archive-cleanup-view { padding: 20px 16px; }
  .archive-cleanup-form { grid-template-columns: minmax(0, 1fr); }
  .archive-cleanup-results button { white-space: normal; min-height: 44px; }
  #results { margin: 0 16px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
