:root {
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-strong: #eef3f8;
  --line: #dce4ee;
  --line-strong: #c9d4e1;
  --text: #101828;
  --text-secondary: #526277;
  --text-tertiary: #7b8ca3;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eaf1ff;
  --success: #087a55;
  --success-soft: #e7f7f0;
  --warning: #a15c05;
  --warning-soft: #fff5df;
  --danger: #c22d45;
  --danger-hover: #a91f36;
  --danger-soft: #ffedf0;
  --focus: #8db7ff;
  --shadow-sm: 0 4px 16px rgba(25, 43, 67, .08);
  --shadow-lg: 0 24px 64px rgba(20, 37, 62, .18);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--canvas);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html { min-width: 0; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--text); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { touch-action: manipulation; }
button, a, input, select, textarea, [contenteditable] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
::selection { color: var(--text); background: #cfe0ff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #bdc9d8; border: 3px solid transparent; border-radius: 8px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #98a8bc; border: 2px solid transparent; background-clip: padding-box; }

.hidden, [hidden] { display: none !important; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.button, .icon-button, .nav-button, .segmented button {
  border: 0;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 180ms ease, transform 100ms ease-out;
}
.button:active, .icon-button:active, .nav-button:active, .segmented button:active { transform: scale(.97); }
.button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: .48; transform: none; }
.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
}
.button.primary { color: #fff; background: var(--primary); }
.button.primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 6px 16px rgba(37, 99, 235, .2); }
.button.secondary { color: #314158; background: var(--surface); border-color: var(--line-strong); }
.button.secondary:hover:not(:disabled) { color: var(--text); background: var(--surface-subtle); border-color: #aebccc; }
.button.warning { color: var(--warning); background: var(--warning-soft); border-color: #f0d49e; }
.button.warning:hover:not(:disabled) { background: #ffedc8; }
.button.danger { color: #fff; background: var(--danger); }
.button.danger:hover:not(:disabled) { background: var(--danger-hover); box-shadow: 0 6px 16px rgba(194, 45, 69, .18); }
.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 40px;
  color: #516177;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
}
.icon-button:hover:not(:disabled) { color: var(--text); background: var(--surface-strong); }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(420px, 100%); background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg); overflow: hidden; }
.brand { display: flex; align-items: center; min-width: 0; gap: 11px; }
.brand img { display: block; width: 42px; height: 42px; flex: 0 0 42px; object-fit: contain; }
.brand div { min-width: 0; display: grid; }
.brand strong { font-size: 17px; line-height: 1.25; font-weight: 720; }
.brand span { color: var(--text-secondary); font-size: 12px; }
.brand-login { padding: 26px 28px 18px; border-bottom: 1px solid var(--line); }
.brand-login img { width: 48px; height: 48px; flex-basis: 48px; }
.brand-login strong { font-size: 20px; }
.brand-login span { font-size: 13px; }
.login-form { display: grid; gap: 10px; padding: 24px 28px 28px; }
.login-form label, .field > span { display: block; color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.login-form input { margin-bottom: 6px; }
.form-message { min-height: 21px; margin: 0; color: var(--danger); font-size: 13px; text-align: center; }

.topbar { position: sticky; z-index: 20; top: 0; background: rgba(255, 255, 255, .88); backdrop-filter: blur(18px) saturate(145%); border-bottom: 1px solid rgba(201, 212, 225, .82); }
.topbar-inner { width: min(1520px, 100%); min-height: 68px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr); align-items: center; gap: 18px; }
.topbar .brand { justify-self: start; }
.topbar #logoutButton { justify-self: end; }
.primary-nav { height: 44px; padding: 4px; display: flex; align-items: center; gap: 3px; background: #edf2f7; border-radius: 8px; }
.nav-button { height: 36px; min-width: 96px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: var(--text-secondary); background: transparent; border-radius: 6px; font-size: 14px; font-weight: 650; }
.nav-button:hover { color: var(--text); }
.nav-button.active { color: var(--primary); background: var(--surface); box-shadow: var(--shadow-sm); }

.workspace { width: min(1520px, 100%); margin: 0 auto; padding: 24px 24px 48px; }
.view { animation: view-enter 360ms var(--ease-out) both; }
@keyframes view-enter { from { opacity: .2; transform: translateY(7px); filter: blur(3px); } to { opacity: 1; transform: translateY(0); filter: blur(0); } }
.page-heading { min-height: 52px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-heading h1, .section-heading h1, .section-heading h2 { margin: 0; font-weight: 720; line-height: 1.25; }
.page-heading h1, .section-heading h1 { font-size: 22px; }
.section-heading h2 { font-size: 18px; }

.stats-strip { min-height: 88px; margin-bottom: 18px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stat { min-width: 0; padding: 16px 18px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat span { display: block; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.stat strong { display: block; margin-top: 4px; font-size: 25px; line-height: 1.25; font-variant-numeric: tabular-nums; }

.workspace-section { padding: 22px 0 26px; border-top: 1px solid var(--line); }
.generator-section { border-top: 0; padding-top: 0; }
.section-heading { min-height: 42px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-actions, .list-actions, .maintenance-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.generator-grid { display: grid; grid-template-columns: 100px minmax(180px, 1.1fr) 120px 110px minmax(160px, .9fr) minmax(220px, 1.5fr) auto; align-items: end; gap: 10px; }
.field { min-width: 0; display: grid; align-content: start; gap: 6px; }
.field input, .field select, .field textarea, .login-form input, .editor-toolbar select, .editor-toolbar input[type="color"], .new-category-row input, .selection-actions select {
  width: 100%;
  min-width: 0;
  height: 40px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.field input:hover, .field select:hover, .field textarea:hover, .login-form input:hover { border-color: #a9b8ca; }
.field input:disabled, .field select:disabled { color: var(--text-tertiary); background: #edf1f5; cursor: not-allowed; }
.field textarea { height: auto; min-height: 92px; padding: 9px 10px; resize: vertical; }
.create-button { min-width: 130px; }
.generated-panel { margin-top: 16px; overflow: hidden; background: var(--surface); border: 1px solid #bed2fb; border-radius: 8px; animation: reveal 420ms var(--ease-out) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(-8px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: translateY(0); clip-path: inset(0); } }
.generated-heading { min-height: 50px; padding: 7px 10px 7px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.generated-heading strong { font-size: 14px; }
.generated-panel pre { max-height: 240px; margin: 0; padding: 14px; overflow: auto; color: #26364c; font: 600 13px/1.75 "Cascadia Mono", Consolas, monospace; }

.list-heading { margin-bottom: 12px; }
.segmented { display: inline-flex; height: 40px; padding: 4px; gap: 3px; background: var(--surface-strong); border-radius: 8px; }
.segmented button { min-width: 92px; height: 32px; padding: 0 12px; color: var(--text-secondary); background: transparent; border-radius: 6px; font-size: 13px; font-weight: 650; }
.segmented button.active { color: var(--text); background: var(--surface); box-shadow: 0 3px 10px rgba(37, 54, 78, .09); }
.filters { display: grid; grid-template-columns: 150px 150px 180px minmax(260px, 1fr); gap: 10px; align-items: end; margin-bottom: 12px; }
.input-with-icon { position: relative; display: block; }
.input-with-icon .icon { position: absolute; z-index: 1; left: 11px; top: 11px; width: 17px; height: 17px; color: var(--text-tertiary); pointer-events: none; }
.input-with-icon input { padding-left: 36px; }
.selection-bar { min-height: 54px; margin-bottom: 10px; padding: 7px 9px 7px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--primary-soft); border: 1px solid #c8d9fb; border-radius: 8px; animation: selection-enter 240ms var(--ease-out) both; }
@keyframes selection-enter { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.selection-bar strong { color: #244374; font-size: 13px; white-space: nowrap; }
.selection-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.selection-actions select { width: 150px; }

.table-shell { width: 100%; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 1200px; border-collapse: collapse; table-layout: fixed; }
th, td { min-width: 0; padding: 11px 10px; border-bottom: 1px solid #e8edf3; text-align: left; vertical-align: middle; font-size: 13px; }
th { position: sticky; z-index: 2; top: 0; color: var(--text-secondary); background: #f7f9fc; font-size: 11px; font-weight: 720; }
tbody tr { transition: background-color 140ms ease; }
tbody tr:hover { background: #f8faff; }
tbody tr:last-child td { border-bottom: 0; }
th:nth-child(2) { width: 230px; } th:nth-child(3) { width: 205px; } th:nth-child(4) { width: 105px; } th:nth-child(5) { width: 96px; } th:nth-child(6) { width: 170px; } th:nth-child(7) { width: 120px; } th:nth-child(8) { width: 150px; }
.select-column { width: 42px; text-align: center; }
.actions-column { width: 128px; text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.row-actions .icon-button { width: 34px; height: 34px; flex-basis: 34px; }
.row-actions .danger-action:hover { color: var(--danger); background: var(--danger-soft); }
.card-key { display: block; color: #1f3554; font: 650 13px/1.5 "Cascadia Mono", Consolas, monospace; white-space: nowrap; }
.card-subline, .cell-subline { display: block; margin-top: 2px; color: var(--text-tertiary); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-badge, .status-badge, .online-badge { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 24px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.category-badge::before, .online-badge::before { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: currentColor; content: ""; }
.status-unused { color: #526277; background: #edf1f5; }
.status-active { color: var(--success); background: var(--success-soft); }
.status-expired { color: var(--danger); background: var(--danger-soft); }
.status-recycled { color: var(--warning); background: var(--warning-soft); }
.online-badge.online { color: var(--success); background: var(--success-soft); }
.online-badge.offline { color: var(--text-secondary); background: #edf1f5; }
.empty-state { padding: 44px 18px !important; color: var(--text-tertiary); text-align: center; }

.publish-section:first-of-type { border-top: 0; }
.publish-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; }
.publish-grid .wide { grid-column: auto; }
.editor-toolbar { min-height: 54px; margin-top: 14px; padding: 7px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; background: var(--surface-strong); border-radius: 8px; }
.toolbar-group { min-width: 0; display: flex; align-items: center; gap: 7px; padding-right: 8px; border-right: 1px solid var(--line-strong); }
.toolbar-group:last-child { padding-right: 0; border-right: 0; }
.toolbar-media { margin-left: auto; }
.editor-toolbar select { width: 90px; }
.editor-toolbar input[type="color"] { width: 44px; padding: 3px; }
.announcement-editor { width: 100%; min-height: 260px; max-height: 560px; margin-top: 10px; padding: 16px; overflow: auto; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; line-height: 1.7; outline: none; white-space: pre-wrap; }
.announcement-editor:empty::before { color: var(--text-tertiary); content: attr(data-placeholder); }
.announcement-editor img { display: block; max-width: min(620px, 100%); max-height: 420px; margin: 10px 0; object-fit: contain; border-radius: 6px; }
.announcement-editor a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.section-meta { color: var(--text-tertiary); font-size: 12px; }
.announcement-editor + .section-meta { margin-top: 8px; }
.release-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.release-summary > div { min-width: 0; padding: 13px 15px; border-right: 1px solid var(--line); }
.release-summary > div:last-child { border-right: 0; }
.release-summary span { display: block; color: var(--text-secondary); font-size: 11px; }
.release-summary strong { display: block; margin-top: 3px; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.upload-zone { margin-top: 14px; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--surface-subtle); border: 1px dashed #b8c6d8; border-radius: 8px; }
.upload-zone input[type="file"] { min-width: 0; }
.upload-progress { display: none; grid-column: 1 / -1; grid-template-columns: minmax(100px, 1fr) auto; gap: 10px; align-items: center; }
.upload-progress.active { display: grid; }
.upload-progress progress { width: 100%; height: 8px; accent-color: var(--primary); }
.upload-status { color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.update-fields { margin-top: 14px; grid-template-columns: 220px 220px minmax(0, 1fr); }
.update-fields .update-notes-field { grid-column: 1 / -1; }
.update-fields textarea { min-height: 160px; line-height: 1.65; }
.section-footer { min-height: 54px; margin-top: 14px; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }

.diagnostic-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.diagnostic { min-width: 0; padding: 16px; border-right: 1px solid var(--line); }
.diagnostic:last-child { border-right: 0; }
.diagnostic span { display: block; color: var(--text-secondary); font-size: 12px; }
.diagnostic strong { display: block; margin-top: 5px; font-size: 18px; font-variant-numeric: tabular-nums; }
.diagnostic small { display: block; margin-top: 3px; overflow: hidden; color: var(--text-tertiary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.system-actions-section { border-top: 0; }
.storage-section .section-heading > div { min-width: 0; display: grid; gap: 3px; }
.storage-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.storage-column { min-width: 0; }
.storage-heading { min-height: 54px; padding: 0 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-strong); }
.storage-heading > div { min-width: 0; display: grid; gap: 2px; }
.storage-heading strong { font-size: 14px; }
.storage-heading span { color: var(--text-tertiary); font-size: 11px; }
.storage-list { min-height: 120px; }
.storage-row { min-height: 64px; padding: 9px 2px; align-items: center; gap: 10px; border-bottom: 1px solid #e5ebf2; }
.storage-row:last-child { border-bottom: 0; }
.candidate-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; cursor: pointer; }
.candidate-row.disabled { cursor: not-allowed; opacity: .58; }
.quarantine-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
.storage-file { min-width: 0; display: grid; gap: 2px; }
.storage-file strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.storage-file small { overflow: hidden; color: var(--text-secondary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.storage-size { color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.storage-actions { display: flex; align-items: center; gap: 2px; }
.storage-actions .icon-button { width: 36px; height: 36px; flex-basis: 36px; }
.audit-list { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.audit-item { min-height: 58px; padding: 10px 14px; display: grid; grid-template-columns: 170px minmax(160px, 1fr) minmax(120px, .7fr) 160px; align-items: center; gap: 12px; border-bottom: 1px solid #e8edf3; }
.audit-item:last-child { border-bottom: 0; }
.audit-item strong { font-size: 13px; }
.audit-item span { min-width: 0; overflow: hidden; color: var(--text-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.audit-item time { color: var(--text-tertiary); font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }

.toast { position: fixed; z-index: 100; top: 18px; left: 50%; max-width: min(440px, calc(100vw - 32px)); min-height: 44px; padding: 11px 16px; display: flex; align-items: center; color: #fff; background: #182437; border-radius: 8px; box-shadow: 0 12px 32px rgba(14, 28, 48, .24); opacity: 0; pointer-events: none; transform: translate(-50%, -14px) scale(.98); transition: opacity 180ms ease, transform 360ms var(--ease-out); }
.toast.visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.error { background: var(--danger); }

.dialog { max-width: none; max-height: none; padding: 0; color: var(--text); background: transparent; border: 0; opacity: 0; transform: scale(.985) translateY(8px); transition: opacity 180ms ease, transform 360ms var(--ease-out), display 360ms allow-discrete, overlay 360ms allow-discrete; }
.dialog[open] { opacity: 1; transform: scale(1) translateY(0); }
@starting-style { .dialog[open] { opacity: 0; transform: scale(.985) translateY(8px); } }
.dialog::backdrop { background: rgba(21, 32, 48, 0); backdrop-filter: blur(0); transition: background-color 240ms ease, backdrop-filter 360ms var(--ease-out), display 360ms allow-discrete, overlay 360ms allow-discrete; }
.dialog[open]::backdrop { background: rgba(21, 32, 48, .34); backdrop-filter: blur(5px); }
@starting-style { .dialog[open]::backdrop { background: rgba(21, 32, 48, 0); backdrop-filter: blur(0); } }
.dialog-panel { width: min(520px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 32px)); padding: 0; display: grid; gap: 15px; overflow: auto; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg); }
.dialog-panel > header { min-height: 68px; padding: 13px 14px 13px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.dialog-panel > header h2 { margin: 0; font-size: 18px; }
.dialog-panel > header span { display: block; margin-top: 2px; color: var(--text-tertiary); font-size: 11px; }
.dialog-panel > .field, .dialog-panel > p { margin: 0 18px; }
.dialog-panel > footer { min-height: 66px; padding: 12px 18px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.confirm-dialog p { color: var(--text-secondary); line-height: 1.65; }
.drawer-dialog { margin: 0 0 0 auto; height: 100vh; }
.drawer-panel { width: min(520px, 100vw); height: 100vh; max-height: none; border-radius: 0; transform-origin: right center; }
.drawer-panel { grid-template-rows: auto auto minmax(0, 1fr); align-content: start; }
.new-category-row { padding: 0 18px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; }
.new-category-row input[type="color"] { padding: 3px; }
.category-list { min-height: 0; padding: 0 18px 18px; display: grid; align-content: start; gap: 8px; overflow: auto; }
.category-row { min-height: 60px; padding: 9px; display: grid; grid-template-columns: 38px minmax(120px, 1fr) auto auto auto; align-items: center; gap: 8px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 8px; }
.category-row input[type="color"] { width: 38px; height: 38px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); }
.category-row input[type="text"] { min-width: 0; height: 38px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 7px; }
.category-row label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 12px; white-space: nowrap; }

@media (max-width: 1180px) {
  .generator-grid { grid-template-columns: 100px minmax(180px, 1fr) 120px 110px minmax(180px, 1fr); }
  .note-field { grid-column: span 3; }
  .create-button { justify-self: stretch; }
  .filters { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .search-field { grid-column: 1 / -1; }
  .diagnostic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diagnostic:nth-child(2) { border-right: 0; }
  .diagnostic:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .audit-item { grid-template-columns: 150px minmax(180px, 1fr) 140px; }
  .audit-item .audit-ip { display: none; }
  .storage-columns { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { background: var(--surface); backdrop-filter: none; }
  .topbar-inner { min-height: 62px; padding: 0 12px; grid-template-columns: minmax(0, 1fr) auto; }
  .topbar .brand span { display: none; }
  .topbar .brand img { width: 38px; height: 38px; flex-basis: 38px; }
  .primary-nav { position: fixed; z-index: 30; right: 12px; bottom: 12px; left: 12px; height: 58px; justify-content: stretch; box-shadow: 0 12px 38px rgba(23, 40, 64, .22); }
  .nav-button { min-width: 0; height: 50px; flex: 1; flex-direction: column; gap: 2px; padding: 3px 6px; font-size: 11px; }
  .topbar #logoutButton { grid-column: 2; }
  .workspace { padding: 16px 12px 92px; }
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-bottom: 1px solid var(--line); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .section-heading, .list-heading, .section-footer { align-items: stretch; flex-direction: column; }
  .section-actions, .list-actions { justify-content: flex-end; }
  .generator-grid, .filters, .publish-grid, .update-fields { grid-template-columns: 1fr; }
  .note-field { grid-column: auto; }
  .compact-field { display: block; }
  .compact-field > span { margin-bottom: 6px; }
  .selection-bar { align-items: stretch; flex-direction: column; }
  .selection-actions { justify-content: stretch; }
  .selection-actions .button, .selection-actions select { flex: 1 1 140px; width: auto; }
  .release-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .release-summary > div:nth-child(2) { border-right: 0; }
  .release-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .upload-zone { grid-template-columns: 1fr; }
  .upload-progress { grid-column: auto; }
  .diagnostic-grid { grid-template-columns: 1fr; }
  .diagnostic { border-right: 0; border-bottom: 1px solid var(--line); }
  .diagnostic:last-child { border-bottom: 0; }
  .audit-item { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .audit-item .audit-target { grid-column: 1; }
  .audit-item time { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .editor-toolbar .button { flex: 1 1 130px; }
  .toolbar-group { width: 100%; padding: 0 0 7px; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .toolbar-group:last-child { padding-bottom: 0; border-bottom: 0; }
  .toolbar-media { margin-left: 0; }
  .dialog-panel { width: calc(100vw - 20px); }
  .drawer-panel { width: 100vw; }
  .category-row { grid-template-columns: 38px minmax(0, 1fr) auto auto; }
  .category-row label { grid-column: 2 / -1; }
  .category-row .category-save { grid-column: 3; grid-row: 1; }
  .category-row .category-delete { grid-column: 4; grid-row: 1; }
  .storage-heading { align-items: stretch; flex-direction: column; }
  .storage-heading .button { width: 100%; }
  .quarantine-row { grid-template-columns: minmax(0, 1fr) auto; }
  .quarantine-row .storage-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .view, .dialog, .toast, .generated-panel, .selection-bar { transform: none !important; filter: none !important; clip-path: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--surface); backdrop-filter: none; }
  .dialog::backdrop { backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --line: #a8b5c5; --line-strong: #7f8fa3; --text-secondary: #334155; }
  .topbar { background: var(--surface); }
}
