:root {
  color-scheme: dark;
  --bg: #111416;
  --surface: #191d20;
  --surface-2: #22272b;
  --surface-3: #2b3136;
  --border: #3a4349;
  --text: #e8ecef;
  --muted: #9eabb3;
  --accent: #3ba66b;
  --accent-2: #2f8557;
  --accent-soft: #173f2b;
  --selection: #244b3a;
  --danger: #db6868;
  --warning: #d7a84a;
  --focus: #74c69d;
  --list-height: 35%;
  --split-ratio: 55%;
  --content-font-size: 15px;
  --control-height: 34px;
  --radius: 5px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #edf1f3;
  --surface: #ffffff;
  --surface-2: #f5f7f8;
  --surface-3: #e7ecef;
  --border: #c5cfd4;
  --text: #172027;
  --muted: #5b6b75;
  --accent: #238354;
  --accent-2: #17663f;
  --accent-soft: #dff4e8;
  --selection: #d4eee0;
  --danger: #b73535;
  --warning: #956a10;
  --focus: #17663f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body { font-size: 14px; }
button, input, select, textarea { font: inherit; }
button, .button-like {
  min-height: var(--control-height); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text);
  padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; white-space: nowrap;
}
button:hover, .button-like:hover { border-color: var(--accent); background: var(--surface-3); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent-2); border-color: var(--accent); color: white; }
button.danger { color: var(--danger); }
button.wide { width: 100%; }
input, select, textarea {
  min-height: var(--control-height); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 6px 9px;
}
textarea { resize: vertical; line-height: 1.5; }
label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
kbd { border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; color: var(--muted); background: var(--surface-2); font-size: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; font-size: 11px; }
.login-panel .eyebrow { text-transform: none; }
.form-message { min-height: 20px; margin: 0; color: var(--danger); }
.shortcut-settings p { margin: 0; font-size: 12px; line-height: 1.5; }
.shortcut-settings [data-shortcut-input] { width: 100%; cursor: pointer; font-family: ui-monospace, Consolas, monospace; }
.shortcut-settings button { justify-self: start; }

.login-view { height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 40% 20%, #1d3529 0, var(--bg) 42%); }
.login-panel { width: min(430px, 100%); display: grid; gap: 16px; padding: 30px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: 0 24px 80px rgba(0,0,0,.35); border-radius: 10px; }
.login-panel h1 { margin: 0; font-size: 25px; }
.login-panel p { margin-top: 6px; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-2); color: white; font-weight: 800; letter-spacing: .04em; }
.brand-mark.small { width: 34px; height: 34px; border-radius: 6px; font-size: 12px; }
.security-note { margin: 0; padding: 10px; border-left: 3px solid var(--warning); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.tenant-choice-dialog { width: min(520px, calc(100vw - 30px)); }
.tenant-choice-dialog form > .muted { margin: 0; line-height: 1.5; }
.tenant-choice-list { display: grid; gap: 8px; }
.tenant-choice-button { min-height: 42px; justify-content: flex-start; padding-inline: 12px; text-align: left; }

.app-shell { min-width: 0; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.app-shell { --control-height: 32px; }
:is(.app-shell, .smartview-fullscreen-dialog) button, :is(.app-shell, .smartview-fullscreen-dialog) input, :is(.app-shell, .smartview-fullscreen-dialog) select, :is(.app-shell, .smartview-fullscreen-dialog) .button-like { font-size: .875rem; line-height: 1.25rem; }
:is(.app-shell, .smartview-fullscreen-dialog) button, :is(.app-shell, .smartview-fullscreen-dialog) .button-like { padding-inline: 8px; font-weight: 500; }
:is(.app-shell, .smartview-fullscreen-dialog) input:not([type="checkbox"]), :is(.app-shell, .smartview-fullscreen-dialog) select { padding: 4px 7px; }
.app-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.brand-row { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 8px; }
.brand-row .brand-mark.small { width: 28px; height: 28px; }
.brand-lockup, .header-context { display: flex; align-items: center; gap: 9px; }
.brand-lockup > div { display: grid; gap: 1px; }
.save-state { color: var(--muted); font-size: 11px; }
.toolbar { position: relative; display: grid; gap: 5px; padding: 5px 8px; border-top: 1px solid var(--border); background: var(--surface-2); }
.toolbar-primary, .toolbar-secondary, .toolbar-actions, .toolbar-filters { min-width: 0; display: flex; align-items: center; gap: 5px; }
.toolbar-primary, .toolbar-secondary { flex-wrap: wrap; }
.toolbar-actions, .toolbar-filters { flex: 0 0 auto; }
.toolbar label { gap: 4px; }
.toolbar-filters { gap: 8px; }
.toolbar-filters label { display: flex; align-items: center; font-size: .875rem; white-space: nowrap; }
.toolbar-filters select { min-width: 95px; max-width: 145px; }
.toolbar-filters #typeFilter { width: 108px; }
.toolbar-filters #categoryFilter { width: 132px; }
.search-field { position: relative; min-width: 180px; max-width: 360px; flex: 1 1 180px; }
.app-shell .search-field input { width: 100%; padding-right: 58px; }
.search-field kbd { position: absolute; right: 7px; bottom: 7px; }
.desktop-workspace-switch { display: inline-flex; align-items: center; flex: 0 0 auto; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.desktop-workspace-switch > button { width: 34px; min-width: 34px; height: var(--control-height); padding: 0; border: 0; border-right: 1px solid var(--border); border-radius: 0; background: var(--surface); }
.desktop-workspace-switch > button:last-child { border-right: 0; }
.desktop-workspace-switch > button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.app-shell .desktop-advanced-search-button { width: 36px; min-width: 36px; padding: 0; color: #43bf78; }
.desktop-advanced-search-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.desktop-advanced-search-button.active { border-color: #43bf78; background: color-mix(in srgb, #43bf78 15%, var(--surface-2)); }
.desktop-advanced-search-panel { position: absolute; z-index: 90; top: calc(100% + 4px); left: 8px; width: min(460px, calc(100vw - 16px)); display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); box-shadow: 0 16px 38px rgb(0 0 0 / .35); }
.desktop-search-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.desktop-search-filter-grid select { width: 100%; }
.desktop-search-stars { margin: 0; padding: 9px 0 0; border: 0; border-top: 1px solid var(--border); }
.desktop-search-stars legend { padding: 0; color: var(--text); font-weight: 700; }
.desktop-search-star-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.desktop-search-star-options label { display: flex; align-items: center; justify-content: center; min-height: 36px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: #ffd429; font-weight: 800; }
.desktop-search-star-options input { min-height: 0; margin: 0 4px 0 0; }
.desktop-advanced-search-panel > button { justify-self: end; }
.desktop-search-filter-badge { min-width: 21px; height: 21px; display: inline-grid; place-items: center; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; }
.inbox-badge { min-width: 25px; height: 25px; display: grid; place-items: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 800; align-self: center; }
.view-switch { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; align-self: end; }
.view-switch button { border: 0; border-right: 1px solid var(--border); border-radius: 0; }
.view-switch button:last-child { border-right: 0; }
.view-switch button[aria-pressed="true"], :is(#tocButton, #panelBTocButton)[aria-pressed="true"] { background: var(--accent-2); color: white; }
:is(#tocButton, #panelBTocButton).toc-placeholder > span { visibility: hidden; }
:is(#tocButton, #panelBTocButton).toc-placeholder { cursor: default; }

.workspace { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--list-height-effective, 155px) 7px minmax(0, 1fr); background: var(--bg); }
.workspace.list-hidden { grid-template-rows: minmax(0, 1fr); }
.workspace.list-hidden .list-pane, .workspace.list-hidden .horizontal { display: none; }
.workspace.list-hidden .detail-pane { grid-row: 1; }
.list-pane { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); border-bottom: 1px solid var(--border); background: var(--surface); }
.table-wrap { min-height: 0; overflow: auto; }
.table-wrap > .empty-state { height: auto; min-height: 26px; padding: 3px 8px; }
.item-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.item-table th, .item-table td { height: 26px; padding: 1px 7px; line-height: 20px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-table th { height: 24px; position: sticky; top: 0; z-index: 2; background: var(--surface-3); text-align: left; color: var(--muted); font-weight: 650; }
.item-table th[data-sort] { cursor: pointer; }
.item-table tbody tr { background: var(--surface); cursor: default; }
.item-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 62%, var(--surface)); }
.item-table tbody tr:hover { background: var(--accent-soft); }
.item-table tbody tr.selected { background: var(--selection); box-shadow: inset 3px 0 0 var(--accent); }
.item-table tbody tr.deleted { opacity: .65; text-decoration: line-through; }
.item-table th:nth-child(1) { width: 108px; }
.item-number { font-variant-numeric: tabular-nums; }
.item-table th:nth-child(2) { width: 46px; }
.item-table th:nth-child(3) { width: 50px; }
.item-table th:nth-child(4) { width: 38%; }
.item-table th:nth-child(5) { width: 95px; }
.item-table th:nth-child(6) { width: 100px; }
.item-table th:nth-child(7) { width: 15%; }
.item-table th:nth-child(8) { width: 145px; }
.item-table th:nth-child(9) { width: 80px; }
.star-column-header, .heart-column-header, .item-star-cell, .item-heart-cell { position: relative; text-align: center !important; padding-inline: 2px !important; }
.star-column-header { overflow: visible !important; white-space: nowrap; color: #ffd429 !important; }
.heart-column-header { color: #ef5c67 !important; }
.star-column-header > button, .heart-column-header > span { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 32px; min-width: 32px; height: 24px; min-height: 24px; margin: 0; padding: 0 0 2px; border: 0; background: transparent; line-height: 1; transform: translate(-50%, -50%); box-sizing: border-box; }
.star-column-header > button { color: #ffd429; }
.star-column-header > button > span, .heart-column-header > span { font-size: 22px; line-height: 1; }
.item-star-rating, .item-heart-count { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 30px; height: 24px; min-height: 24px; padding: 0; border: 0; background: transparent; line-height: 0; transform: translate(-50%, -50%); }
.item-star-rating .rating-shape-svg { display: none; }
.item-star-rating .rating-shape { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 31px; line-height: 1; text-shadow: 0 0 2px #8f949b; transform: translateY(-2px); }
.item-star-rating[data-rating]:not([data-rating="0"]) .rating-shape { color: #ffd429; text-shadow: 0 0 1px #8c6b00; }
.item-star-rating .rating-number, .item-heart-count .heart-number { position: absolute; inset: 0; display: grid; place-items: center; color: #15181c; font-size: 10px; font-weight: 800; line-height: 1; text-shadow: 0 0 2px #fff; }
.item-star-rating .rating-number { font-size: 11px; font-weight: 900; transform: translateY(1px); text-shadow: 0 0 1px #fff, 0 1px 0 #fff; }
.item-heart-count .heart-shape { position: absolute; width: 27px; height: 27px; overflow: visible; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; filter: drop-shadow(0 0 1px #8f949b); pointer-events: none; transform: translateY(-1px); }
.item-heart-count .heart-shape-desktop { display: none; }
.item-heart-count .heart-shape-mobile { display: inline; }
.item-heart-count[data-count]:not([data-count="0"]) .heart-shape { fill: #ef5c67; stroke: #ef5c67; }
.item-heart-count .heart-number { color: #fff; font-size: 9px; text-shadow: 0 1px 2px #54151a; transform: translateY(1px); }
@media (min-width: 721px) and (hover: hover) and (pointer: fine) {
  .item-star-rating .rating-shape-svg { display: block; position: absolute; width: 24px; height: 24px; overflow: visible; fill: none; stroke: #fff; stroke-width: 1.45; stroke-linejoin: round; filter: drop-shadow(0 0 1px #8f949b); pointer-events: none; }
  .item-star-rating[data-rating]:not([data-rating="0"]) .rating-shape-svg { fill: #ffd429; stroke: #ffd429; filter: drop-shadow(0 0 1px #8c6b00); }
  .item-star-rating .rating-shape-svg text { fill: #15181c; stroke: none; font-family: "Segoe UI", sans-serif; font-size: 9px; font-weight: 900; text-anchor: middle; dominant-baseline: central; }
  .item-star-rating .rating-shape-mobile, .item-star-rating .rating-number { display: none; }
  .item-heart-count .heart-shape { width: 23px; height: 23px; stroke-width: 1.65; stroke-linecap: round; transform: none; }
  .item-heart-count .heart-shape-desktop { display: inline; }
  .item-heart-count .heart-shape-mobile { display: none; }
  .item-heart-count .heart-number { transform: none; }
}
.star-filter-menu { position: fixed; z-index: 80; width: 200px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); box-shadow: 0 14px 36px rgb(0 0 0 / .32); }
.star-filter-menu[hidden] { display: none; }
.star-filter-menu > strong { display: block; font-size: 15px; line-height: 20px; }
.star-filter-options { display: grid; gap: 0; margin: 4px 0; }
.star-filter-options label { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 18px; line-height: 24px; color: var(--text); cursor: pointer; }
.star-filter-options input[type="checkbox"], .star-filter-sort input[type="checkbox"] { flex: 0 0 20px; width: 20px; height: 20px; min-width: 0; min-height: 0; margin: 0; padding: 0; cursor: pointer; }
.star-filter-sort { display: flex; align-items: center; gap: 8px; min-height: 34px; margin: 0 0 6px; padding-top: 4px; border-top: 1px solid var(--border); font-size: 16px; line-height: 22px; color: var(--text); cursor: pointer; }
.star-filter-actions { display: flex; justify-content: flex-end; gap: 7px; }
.star-filter-actions button { min-height: 30px; }

.priority-high { color: var(--danger); font-weight: 700; }
.priority-low { color: var(--muted); }
.empty-state, .detail-placeholder { height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); }
.list-pager { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.list-pager button { min-width: 28px; min-height: 28px; height: 28px; padding: 0 5px; font-size: 18px; }

.divider { background: var(--border); position: relative; z-index: 3; }
.divider::after { content: ""; position: absolute; inset: -3px; }
.divider.horizontal { cursor: row-resize; }
.divider.horizontal::after { inset: -3px 0; }
.divider.vertical { cursor: col-resize; width: 7px; }
.divider.vertical::after { inset: 0 -3px; }
.divider:hover, .divider:focus { background: var(--accent); }

.detail-pane { min-width: 0; min-height: 0; overflow: hidden; background: var(--surface); }
.workspace.desktop-search-active { grid-template-rows: minmax(0, 1fr); }
.workspace.desktop-search-active > .list-pane, .workspace.desktop-search-active > .divider.horizontal { display: none; }
.workspace.desktop-search-active > .detail-pane { grid-row: 1; }
.desktop-search-workspace { width: 100%; height: 100%; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(330px, .9fr) minmax(0, 1.35fr); background: var(--bg); }
.desktop-search-results-pane, .desktop-search-preview-pane { min-width: 0; min-height: 0; background: var(--surface); }
.desktop-search-results-pane { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; border-right: 1px solid var(--border); }
.desktop-search-header { display: grid; grid-template-columns: minmax(140px, 1fr) auto 34px; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.desktop-search-query { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px; }
.desktop-search-query > span[aria-hidden] { color: var(--accent); font-size: 18px; }
.app-shell .desktop-search-query input { width: 100%; min-width: 0; }
.desktop-search-header > button { min-width: 0; }
#desktopSearchClose { width: 34px; padding: 0; font-size: 20px; }
.desktop-search-summary { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--border); font-size: 12px; }
.desktop-search-results { min-height: 0; overflow: auto; padding: 9px; outline: none; }
.desktop-search-card { position: relative; display: grid; gap: 8px; width: 100%; min-height: 142px; margin: 0 0 9px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 0; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.desktop-search-card:hover, .desktop-search-card:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); outline: none; }
.desktop-search-card[aria-selected="true"] { border-color: var(--accent); background: var(--selection); box-shadow: inset 3px 0 0 var(--accent); }
.desktop-search-card-top { display: flex; align-items: center; gap: 9px; color: var(--accent); font-size: 12px; }
.desktop-search-card-top time { flex: 1 1 auto; min-width: 0; }
.desktop-search-rating { color: #ffd429; font-weight: 900; white-space: nowrap; }
.desktop-search-heart { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 25px; color: #ef5c67; font-weight: 800; white-space: nowrap; }
.desktop-search-heart .heart-shape { width: 18px; height: 18px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.desktop-search-heart[data-count]:not([data-count="0"]) .heart-shape { fill: currentColor; }
.desktop-search-card-title { margin: 0; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.desktop-search-card-preview { margin: 0; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.desktop-search-card mark, .desktop-search-preview-content mark { padding: 0 1px; border-radius: 2px; background: #ffe66c; color: #161616; }
.desktop-search-empty { display: grid; place-items: center; align-content: center; gap: 10px; min-height: 0; padding: 24px; color: var(--muted); text-align: center; }
.desktop-search-empty[hidden] { display: none; }
#desktopSearchMore { margin: 7px 9px 9px; }
.desktop-search-preview-pane { display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.desktop-search-preview-header { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.desktop-search-preview-header > div:first-child { min-width: 0; display: grid; gap: 2px; }
.desktop-search-preview-header strong, .desktop-search-preview-header .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desktop-search-preview-actions { display: flex; flex: 0 0 auto; gap: 5px; }
.desktop-search-preview-find { display: flex; align-items: center; justify-content: flex-end; gap: 5px; padding: 5px 9px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.desktop-search-preview-find > button { min-width: 30px; padding-inline: 7px; }
.desktop-search-preview-content { min-width: 0; min-height: 0; overflow: auto; padding: 18px 22px; font-size: var(--content-font-size); line-height: 1.55; outline: none; }
.detail-content { min-width: 0; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
.detail-content > .smart-view { grid-row: 3; }
.detail-toolbar { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.subject-group { min-width: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.subject-group input { width: 100%; font-weight: 700; }
.detail-meta { max-width: 32vw; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 12px; white-space: nowrap; }
.detail-actions { min-width: 0; display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 4px; }
.detail-actions button { flex: 0 0 auto; }
.smart-view { --pane-axis: columns; width: 100%; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, var(--split-ratio)) 7px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; }
.smart-view > .smart-panel, .smart-view > .divider { grid-row: 1; }
.detail-actions-footer { min-width: 0; grid-column: 1 / -1; grid-row: 3; padding: 4px 8px; border-top: 1px solid var(--border); background: var(--surface-2); }
.smart-view.mode-full, .smart-view.mode-text, .smart-view.mode-images { grid-template-columns: minmax(0, 1fr); }
.smart-view.mode-full #imagePanel, .smart-view.mode-full .vertical, .smart-view.mode-text #imagePanel, .smart-view.mode-text .vertical, .smart-view.mode-images #imagePanel, .smart-view.mode-images .vertical { display: none; }
.smart-panel { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); overflow: hidden; background: var(--surface); }
.smart-view.comparison-actions > .smart-panel { grid-template-rows: auto minmax(0, 1fr) auto; }
.comparison-panel-actions { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 4px 8px; border-top: 1px solid var(--border); background: var(--surface-2); }
.smart-panel:has(> .panel-find-bar:not([hidden])) { grid-template-rows: auto auto minmax(0, 1fr); }
.smart-view.comparison-actions > .smart-panel:has(> .panel-find-bar:not([hidden])) { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.panel-pin-button { display: inline-flex; align-items: center; gap: 4px; padding-inline: 7px; font-weight: 700; white-space: nowrap; }
.panel-pin-button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.panel-pin-icon { font-size: .75rem; line-height: 1; }
.panel-pinned-title { flex: 1 1 160px; min-width: 0; white-space: normal; overflow-wrap: anywhere; font-weight: 600; }
.panel-find-bar { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.panel-find-input { flex: 1 1 100px; min-width: 0; width: 100%; }
.panel-find-navigation { display: flex; align-items: center; flex: 0 0 auto; gap: 4px; }
.panel-find-navigation button { width: 28px; min-width: 28px; padding: 0; font-size: 20px; line-height: 1; }
.panel-find-navigation .panel-find-status { width: auto; min-width: 52px; padding-inline: 5px; border-color: transparent; background: transparent; color: var(--muted); font-size: 12px; line-height: 1.25; text-align: center; white-space: nowrap; }
.panel-find-navigation .panel-find-status[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.panel-find-navigation .panel-find-status:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
:is(.item-find-mark, .wk-find-hit) { padding: 0; border-radius: 2px; background: rgba(222, 189, 91, .19); color: inherit; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
:is(.item-find-mark.is-current, .wk-find-current) { background: rgba(222, 189, 91, .36); outline: 1px solid rgba(222, 189, 91, .65); outline-offset: 1px; }
.smart-panel-heading { justify-content: flex-start; flex-wrap: wrap; }
.smart-panel-heading strong { flex: 0 0 auto; }
.smart-panel-heading > button { flex: 0 0 auto; }
.panel-item-select { min-width: 0; max-width: none; flex: 1 1 190px; }
.smart-panel-heading > .panel-compare-trigger { display: flex; flex: 1 1 190px; justify-content: space-between; overflow: hidden; text-align: left; }
.panel-compare-label { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.panel-compare-chevron { flex: 0 0 auto; }
.panel-compare-options { position: fixed; inset: auto; margin: 0; padding: 6px; width: min(360px, calc(100vw - 16px)); max-width: calc(100vw - 16px); max-height: min(320px, calc(100dvh - 16px)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.panel-compare-options:popover-open { display: flex; flex-direction: column; gap: 2px; }
.panel-picker-search { position: sticky; top: 0; z-index: 1; display: grid; flex: 0 0 auto; gap: 4px; padding-bottom: 4px; background: var(--surface); color: var(--muted); font-size: 12px; }
.panel-picker-search input { width: 100%; min-width: 0; font-size: .875rem; }
.panel-picker-results { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.panel-compare-option { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: flex-start; gap: 6px; width: 100%; min-height: 0; padding: 6px; border: 0; border-radius: 3px; background: transparent; color: var(--text); font-size: .875rem; line-height: 1.25rem; text-align: left; cursor: pointer; }
.panel-picker-mark { flex: 0 0 16px; width: 16px; color: var(--accent); text-align: center; }
.panel-picker-title { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.panel-compare-option.is-selected { background: var(--accent-soft); }
.panel-compare-option:is(:disabled, .is-disabled) { opacity: .65; cursor: default; }
.panel-compare-option:not(:disabled):not(.is-disabled):hover, .panel-compare-option:focus-visible { background: var(--selection); }
.panel-picker-status { flex: 0 0 auto; margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
.panel-picker-retry, .panel-picker-more { flex: 0 0 auto; align-self: stretch; min-height: 26px; padding: 3px 6px; font-size: .875rem; line-height: 1.25rem; }
.panel-reading-controls { display: flex; flex: 0 0 auto; align-items: center; flex-wrap: nowrap; gap: 6px; }
.panel-reading-controls > button, .panel-reading-controls > .toc-toggle { flex: 0 0 auto; }
.panel-type-toggle { width: 105px; flex: 0 0 auto; }
.smart-panel-body { min-width: 0; min-height: 0; overflow: hidden; position: relative; }
.smart-panel-body:has(> .item-metadata:not([hidden])) { display: flex; flex-direction: column; }
.smart-panel-body:has(> .item-metadata:not([hidden])) > :is(.panel-document, .panel-image-view) { flex: 1 1 0; height: auto; }
.item-metadata { flex: 0 0 auto; min-width: 0; padding: 4px 14px; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.item-subject { margin: 0 0 4px; color: var(--text); font-size: 1rem; font-weight: 700; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
.item-metadata-details { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.item-name-display-setting { display: grid; gap: 5px; max-width: 320px; margin-top: 12px; }
.panel-document, .contents-panel, .panel-image-view { width: 100%; height: 100%; min-height: 0; }
.panel-document { display: flex; flex-direction: column; overflow: hidden; }
.panel-document > .content-viewer, .panel-document > .content-editor, .panel-document > .contents-panel { flex: 1 1 0; }
.contents-panel { overflow: auto; padding: 14px 18px; background: var(--surface); }
.panel-heading { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.smart-panel-heading .chips { min-width: 0; max-width: 20%; flex-wrap: nowrap; overflow: hidden; }
.smart-panel-heading .chips > * { white-space: nowrap; }
.compact-heading { min-height: 28px; padding: 3px 0; border: 0; background: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.chip { padding: 2px 6px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 10px; }
.content-viewer, .content-editor { min-height: 0; width: 100%; height: 100%; margin: 0; padding: 14px 16px; border: 0; border-radius: 0; overflow: auto; background: var(--surface); color: var(--text); font-size: var(--content-font-size); line-height: 1.58; overflow-wrap: anywhere; tab-size: 2; }
.content-editor { resize: none; }
.plain-document { min-height: 100%; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: var(--content-font-size)/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.content-viewer .image-reference { min-height: 0; max-width: 100%; margin: 0; padding: 0; border: 0; border-radius: 2px; background: transparent; color: #70b7ff; font: inherit; line-height: inherit; text-align: left; white-space: normal; overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: .15em; }
.content-viewer .image-reference:hover { color: var(--accent); background: var(--accent-soft); }
.content-viewer .image-reference:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.content-viewer .image-reference-group { max-width: 100%; }
.content-viewer .inline-image-gallery { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 16px; max-width: 100%; margin: 8px 0 14px; white-space: normal; }
.content-viewer .inline-image-gallery > .image-reference-group { display: flex; flex: 0 1 auto; flex-direction: column; align-items: flex-start; min-width: 0; }
.content-viewer .inline-image-gallery > br { display: none; }
.content-viewer .inline-image-gallery .inline-reference-image { margin: 8px 0 0; }
.content-viewer .inline-reference-image { display: block; max-width: min(100%, 420px); max-height: min(300px, 40vh); width: auto; height: auto; margin: 8px 0 14px; border: 1px solid var(--border); border-radius: var(--radius); object-fit: contain; object-position: left top; }
.content-viewer .inline-reference-image[role="button"] { cursor: pointer; }
.content-viewer .inline-reference-image[role="button"]:hover { border-color: var(--accent-2); }
.content-viewer .inline-reference-image[role="button"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.content-viewer .image-reference-missing { color: var(--muted); text-decoration: underline dotted; text-underline-offset: .15em; }
#toggleInlineImagesButton[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-2); }
.rendered-document h1, .rendered-document h2, .rendered-document h3, .rendered-document h4, .rendered-document h5, .rendered-document h6 { scroll-margin-top: 12px; line-height: 1.25; }
.rendered-document h1 { font-size: 1.4em; border-bottom: 1px solid var(--border); padding-bottom: .25em; }
.rendered-document h2 { font-size: 1.2em; border-bottom: 1px solid var(--border); padding-bottom: .2em; }
.rendered-document h3 { font-size: 1.1em; }
.rendered-document a { color: #70b7ff; }
.rendered-document table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.rendered-document th, .rendered-document td { padding: 6px 8px; border: 1px solid var(--border); text-align: left; }
.rendered-document blockquote { margin-left: 0; padding: 5px 12px; border-left: 3px solid var(--accent); color: var(--muted); background: var(--surface-2); }
.rendered-document img { max-width: 100%; height: auto; }
.code-block { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 10px 0; }
.rendered-document .code-block > pre { min-width: 0; margin: 0; padding: 12px 14px; max-height: 60vh; overflow: auto; border: 1px solid var(--border); border-left: 2px solid var(--accent-2); border-radius: var(--radius); background-color: var(--surface-2); background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0, rgba(255,255,255,.025) 1px, transparent 1px, transparent 7px); }
.code-block > .code-copy { justify-self: start; font-weight: 600; color: var(--text); background: var(--accent-soft); border-color: var(--accent-2); }
.code-block > .code-copy:hover { background: var(--selection); border-color: var(--accent); }
.code-block > .code-copy:focus-visible { border-color: var(--focus); }
.inline-toc { max-height: 32%; overflow: auto; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.inline-toc.sticky { position: sticky; top: 0; z-index: 4; }
.toc-list, .contents-panel ol, .inline-toc ol { --toc-indent: 19px; margin: 0; padding-left: var(--toc-indent); }
.toc-list li, .contents-panel li, .inline-toc li { margin: 4px 0; margin-inline-start: calc(var(--toc-level-gap, 0) * var(--toc-indent)); }
.toc-list a, .contents-panel a, .inline-toc a { color: var(--text); text-decoration: none; }
.toc-list a:hover, .toc-list a:focus-visible, .contents-panel a:hover, .inline-toc a:hover { color: var(--accent); text-decoration: underline; }
.note-panel { flex: 0 0 auto; min-width: 0; max-height: min(240px, 45%); overflow: auto; padding: 6px 10px; border-top: 1px solid var(--border); background: var(--surface-2); }
.note-panel .compact-heading { flex-wrap: wrap; }
.note-panel .inline-check { max-width: 100%; }
.note-panel textarea { width: 100%; min-height: 48px; }
.inline-check { display: flex; grid-auto-flow: column; align-items: center; gap: 5px; }
.inline-check input { min-height: auto; }
.note-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; margin-top: 5px; }
.note-actions > button { flex: 0 0 auto; }
.detail-actions-footer > .note-actions { margin-top: 0; }
.shared-notes { display: grid; gap: 5px; margin-top: 7px; }
.shared-note { border-left: 2px solid var(--accent); padding: 5px 8px; background: var(--surface); font-size: 12px; white-space: pre-wrap; }
.shared-note strong { display: block; color: var(--accent); margin-bottom: 2px; }

.panel-image-view { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; background: #101214; }
.image-stage { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 8px; }
.image-stage.drag-over { box-shadow: inset 0 0 0 3px var(--accent); }
.image-stage img { position: absolute; inset: 8px; display: block; width: calc(100% - 16px); height: calc(100% - 16px); max-width: none; max-height: none; object-fit: contain; object-position: center top; user-select: none; }
.image-stage.actual { place-items: start; overflow: auto; }
.image-stage.actual img { position: static; inset: auto; width: auto; height: auto; max-width: none; max-height: none; object-fit: none; }
.image-placeholder { display: grid; justify-items: center; gap: 7px; color: var(--muted); text-align: center; padding: 20px; }
.image-toolbar { min-width: 0; min-height: 39px; display: flex; flex-wrap: wrap; align-items: center; align-content: start; gap: 5px; padding: 3px 6px; border-top: 1px solid var(--border); background: var(--surface-2); }
.image-navigation { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.image-toolbar button, .image-toolbar .button-like, #imageCounter, #panelAImageCounter { flex: 0 0 auto; white-space: nowrap; }
.panel-image-view > .image-filename { grid-row: 2; display: block; width: 100%; min-width: 0; min-height: 0; max-width: 100%; height: auto; margin: 0; padding: 2px 6px; border: 0; border-radius: 0; background: var(--surface-2); color: var(--muted); text-align: left; font-size: 12px; font-weight: 400; line-height: 16px; white-space: normal; overflow-wrap: anywhere; }
.panel-image-view > .image-filename:is(:hover, :focus-visible) { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.panel-image-view > .image-filename:focus-visible { outline-offset: -2px; }
.toc-toggle { align-self: center; font-size: .875rem; }
.toc-toggle input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; margin: 0; cursor: pointer; }
.toc-toggle { min-height: var(--control-height); cursor: pointer; gap: 7px; }
.reader-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; }
.reader-font-size { min-width: 38px; text-align: center; color: var(--muted); font-size: 12px; }
.smartview-fullscreen-toolbar { flex-wrap: wrap; }
.smartview-fullscreen-toolbar > .reader-toolbar { flex: 1 1 0%; }
.smartview-fullscreen-toolbar > #smartViewFullscreenTitle { flex: 0 0 auto; }
.smartview-fullscreen-toolbar #smartViewFullscreenSwap, .smartview-fullscreen-toolbar #smartViewFullscreenSave { display: none; }
.item-properties { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; min-width: 0; }
.item-properties .inline-check { white-space: nowrap; }
.item-properties input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; }
.detail-toolbar { flex-wrap: wrap; }
.visibility-label { font-size: 12px; color: var(--muted); }
.visibility-label.private { color: var(--warning); }
.maker-cell { overflow: hidden; text-overflow: ellipsis; }
.panel-visibility { flex: 0 0 auto; white-space: nowrap; }
.private-mark { color: var(--warning); }
.deleted-status { color: var(--warning); font-weight: 600; }
.member-editor { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.member-editor .member-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.member-editor .member-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }

.smartview-fullscreen-dialog { --control-height: 32px; width: calc(100vw - 16px); height: calc(100vh - 16px); height: calc(100dvh - 16px); max-width: none; max-height: none; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); overflow: hidden; }
.smartview-fullscreen-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.smartview-fullscreen-dialog::backdrop { background: rgba(0,0,0,.88); }
:is(#panelATextFullscreen, #panelBTextFullscreen) { display: none; }
.smartview-fullscreen-toolbar { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.smartview-fullscreen-toolbar strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smartview-fullscreen-toolbar button { flex: 0 0 auto; }
.smartview-fullscreen-content { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.smartview-fullscreen-content > .smart-view { height: 100%; }
.image-lightbox { width: calc(100vw - 24px); height: calc(100vh - 24px); max-width: none; max-height: none; padding: 0; border: 1px solid var(--border); background: #080a0b; color: var(--text); }
.image-lightbox::backdrop { background: rgba(0,0,0,.88); }
.lightbox-toolbar, .lightbox-nav { height: 46px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface-2); }
.lightbox-toolbar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-stage { position: relative; height: calc(100% - 92px); overflow: hidden; display: grid; place-items: center; }
.lightbox-stage img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; object-position: center top; }
.lightbox-stage.actual { place-items: start; overflow: auto; }
.lightbox-stage.actual img { position: static; inset: auto; width: auto; height: auto; max-width: none; max-height: none; object-fit: none; }
.lightbox-nav { justify-content: center; }


.dialog { width: min(760px, calc(100vw - 30px)); max-height: calc(100vh - 30px); overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 0; box-shadow: 0 26px 100px rgba(0,0,0,.55); }
.dialog::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(2px); }
.quick-dialog { font-size: 16px; }
.quick-dialog label { font-size: 14px; }
.quick-dialog input:not([type="checkbox"]), .quick-dialog select, .quick-dialog option, .quick-dialog textarea { font-size: 16px; line-height: 1.5; }
.quick-dialog .inline-check { gap: 8px; font-size: 16px; }
.quick-dialog input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; }
.quick-dialog #quickSharingHint { margin: 2px 0; line-height: 1.5; }
.confirmation-dialog { width: min(580px, calc(100vw - 30px)); }
.rename-media-dialog { width: min(640px, calc(100vw - 30px)); }
.rename-media-dialog p { margin: 0; overflow-wrap: anywhere; }
.rename-media-dialog h2 { font-size: 1.25rem; }
.media-name-input { display: flex; align-items: center; gap: 5px; min-width: 0; flex-wrap: wrap; }
.media-name-input span { overflow-wrap: anywhere; }
.media-name-input input { flex: 1 1 200px; min-width: 0; }
.media-name-preview { display: block; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); overflow-wrap: anywhere; }
.confirmation-dialog p { margin: 0; line-height: 1.5; }
.confirmation-dialog h2 { font-size: 1.25rem; }
.confirmation-previews { display: grid; gap: 9px; max-height: min(40vh, 360px); overflow: auto; min-width: 0; }
.confirmation-preview { min-width: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.confirmation-preview strong { display: block; margin-bottom: 4px; font-size: 13px; }
.confirmation-preview pre { max-height: 4.5em; overflow: hidden; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.confirmation-preview small { display: block; margin-top: 4px; color: var(--muted); }
.confirmation-dialog .dialog-actions { flex-wrap: wrap; }
.confirmation-items { max-height: min(40vh, 320px); overflow: auto; margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius); }
.confirmation-items li { padding: 9px 11px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.confirmation-items li:last-child { border-bottom: 0; }
.confirmation-dialog[data-danger="true"] #confirmationConfirm { background: var(--danger); border-color: var(--danger); color: var(--bg); }
.dialog form { display: grid; gap: 14px; padding: 18px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dialog-heading h2, .dialog h3 { margin: 0; }
.icon-button { width: 34px; padding: 0; font-size: 21px; }
.form-grid, .settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 7px; padding-top: 5px; }
.draft-notice { margin: 0; padding: 7px 9px; border-left: 3px solid var(--warning); background: var(--surface-2); color: var(--warning); }
.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-grid label { padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.admin-dialog { width: min(1100px, calc(100vw - 30px)); }
.import-dialog { width: min(1280px, calc(100vw - 24px)); }
.import-dialog form { gap: 11px; }
.import-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.import-drop-zone { min-height: 118px; display: grid; place-items: center; align-content: center; gap: 7px; padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); text-align: center; }
.import-drop-zone strong { color: var(--text); }
.import-drop-zone.drag-over, .import-drop-zone:focus { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent-soft); }
.import-selection-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; }
.csv-mapping { display: grid; gap: 7px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.import-preview-wrap { min-height: 230px; max-height: 42vh; overflow: auto; border: 1px solid var(--border); background: var(--surface); }
.import-preview-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11px; }
.import-preview-table th, .import-preview-table td { height: 31px; padding: 4px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.import-preview-table th { position: sticky; top: 0; z-index: 2; background: var(--surface-3); color: var(--muted); }
.import-preview-table th:nth-child(1) { width: 17%; }
.import-preview-table th:nth-child(2) { width: 7%; }
.import-preview-table th:nth-child(3) { width: 21%; }
.import-preview-table th:nth-child(4) { width: 14%; }
.import-preview-table th:nth-child(5) { width: 6%; }
.import-preview-table th:nth-child(6) { width: 11%; }
.import-preview-table th:nth-child(7) { width: 9%; }
.import-preview-table th:nth-child(8) { width: 15%; }
.import-preview-table select { width: 100%; min-height: 26px; padding: 2px 5px; font-size: 11px; }
.import-preview-table input[data-import-title] { width: 100%; min-width: 0; min-height: 26px; padding: 2px 5px; font-size: 11px; }
.import-warning { color: var(--warning); }
.import-message { min-height: 24px; margin: 0; color: var(--muted); }
.text-review-dialog { width: min(1400px, calc(100vw - 24px)); height: min(900px, calc(100vh - 24px)); }
.text-review-dialog form { height: 100%; min-height: 0; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; }
.text-review-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.text-review-issues { min-height: 0; max-height: 110px; margin: 0; padding: 7px 10px 7px 28px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.text-review-issues:empty { display: none; }
.text-review-issues button { min-height: 0; padding: 0; border: 0; color: inherit; background: none; text-align: left; }
.text-review-issues .blocker { color: var(--danger); }
.text-review-issues .warning { color: var(--warning); }
.text-review-grid { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.text-review-source, .text-review-preview-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--border); background: var(--surface); }
#textReviewEditor { flex: 1 1 auto; min-height: 0; width: 100%; resize: none; padding: 14px; border: 0; border-radius: 0; font: 14px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 4; }
.text-review-preview-pane { overflow: hidden; }
.text-review-preview { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 14px 18px; }
.text-review-toc { flex: 0 0 auto; max-height: 30%; overflow: auto; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.text-review-dialog .text-review-success { color: var(--accent); font-weight: 700; }
.text-review-dialog[data-applied="true"] .text-review-grid { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.import-review-button { width: 100%; min-height: 26px; padding: 2px 5px; font-size: 11px; }
.import-review-actions { display: grid; gap: 3px; }
.sensitive-summary-button { color: var(--warning); }
.sensitive-import-dialog { width: min(760px, calc(100vw - 24px)); }
.sensitive-import-dialog form { max-height: calc(100vh - 40px); overflow: auto; }
.sensitive-import-dialog p { margin: 0; line-height: 1.5; }
.sensitive-import-stats { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.sensitive-import-stats li { padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.sensitive-import-section { display: grid; gap: 7px; }
.sensitive-import-section h3, .sensitive-import-section ul { margin: 0; }
.sensitive-import-section pre { max-height: 260px; margin: 0; padding: 12px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.sensitive-line-list { display: grid; gap: 5px; list-style: none; padding: 0; }
.sensitive-line-list button { width: 100%; min-height: 34px; padding: 6px 9px; text-align: left; white-space: normal; }
.sensitive-line-list button[data-status="pending"] { color: var(--warning); }
.sensitive-line-list button[data-status="approved"] { color: var(--accent); }
.sensitive-line-list button[data-status="changed"], .sensitive-line-list button[data-status="ignored"] { color: var(--muted); }
.sensitive-line-list button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.sensitive-line-review { display: grid; gap: 7px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.sensitive-line-review[hidden] { display: none; }
.sensitive-line-review textarea { width: 100%; min-height: 92px; resize: vertical; font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.sensitive-line-actions { flex-wrap: wrap; }
.sensitive-import-dialog .text-review-success { color: var(--accent); font-weight: 700; }
.import-log-dialog { width: min(1000px, calc(100vw - 24px)); }
.import-log-wrap { max-height: 58vh; overflow: auto; border: 1px solid var(--border); }
.import-log-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.import-log-table th, .import-log-table td { padding: 7px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.import-log-table th { position: sticky; top: 0; background: var(--surface-3); color: var(--muted); }
.import-log-table th:nth-child(1) { width: 28%; }
.import-log-table th:nth-child(2), .import-log-table th:nth-child(3), .import-log-table th:nth-child(4) { width: 12%; }
.import-log-table th:nth-child(5) { width: 36%; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-grid section { min-width: 0; display: grid; align-content: start; gap: 10px; }
.admin-list { max-height: 290px; overflow: auto; border: 1px solid var(--border); }
.admin-row { display: grid; grid-template-columns: minmax(100px, 1fr) auto auto; gap: 7px; align-items: center; padding: 6px; border-bottom: 1px solid var(--border); }
.admin-row:last-child { border-bottom: 0; }
fieldset { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
legend { color: var(--muted); }
.context-menu { position: fixed; z-index: 1000; width: 170px; display: grid; gap: 2px; padding: 5px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 16px 45px rgba(0,0,0,.45); }
.context-menu button { justify-content: flex-start; width: 100%; border-color: transparent; }

html[data-density="normal"] { --control-height: 39px; }
html[data-density="normal"] .app-shell { --control-height: 36px; }
html[data-density="normal"] .smartview-fullscreen-dialog { --control-height: 36px; }
html[data-density="normal"] .item-table th, html[data-density="normal"] .item-table td { padding-inline: 9px; }

@media (max-width: 900px) {
  .desktop-markdown-review, .text-review-dialog { display: none !important; }
  .header-context { flex-wrap: wrap; justify-content: flex-end; }
  .toolbar { max-height: 150px; overflow: auto; }
  .search-field { min-width: 190px; max-width: none; flex-basis: 100%; }
  .toolbar-actions, .toolbar-filters { max-width: 100%; flex-wrap: wrap; }
  .detail-toolbar { align-items: stretch; flex-direction: column; }
  .subject-group { grid-template-columns: 1fr; }
  .detail-meta { max-width: 100%; }
  .smart-view.mode-split { --pane-axis: rows; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(200px, var(--split-ratio)) auto 7px minmax(200px, 1fr) auto auto; overflow: auto; }
  .smart-view.mode-split > #textPanel { grid-row: 1; }
  .smart-view.mode-split > .vertical { grid-row: 3; width: auto; height: 7px; cursor: row-resize; }
  .smart-view.mode-split > .vertical::after { inset: -3px 0; }
  .smart-view.mode-split > #imagePanel { grid-row: 4; }
  .smart-view.mode-split > .detail-actions-footer { grid-column: 1; grid-row: 6; }
  .smart-panel-heading { flex-wrap: wrap; }
  .panel-item-select { max-width: none; }
  .admin-grid, .form-grid, .settings-grid, .import-options { grid-template-columns: 1fr; }
  .import-preview-wrap { max-height: 36vh; }
}

@media (max-width: 620px) {
  .brand-row { align-items: flex-start; }
  .brand-lockup { position: sticky; top: 0; }
  .toolbar-filters { width: 100%; }
  .toolbar-filters label { width: calc(50% - 4px); display: grid; }
  .toolbar-filters label select { width: 100%; max-width: none; }
  .toolbar-filters #typeFilter, .toolbar-filters #categoryFilter { width: 100%; }
  .toolbar-filters label:last-of-type { flex: 1; }
  .view-switch { width: 100%; }
  .view-switch button { flex: 1; }
  .item-table th:nth-child(7), .item-table td:nth-child(7), .item-table th:nth-child(9), .item-table td:nth-child(9) { display: none; }
  .item-table th:nth-child(4) { width: 55%; }
}

@media (min-width: 901px) {
  .smart-view.mode-split:is(.item-actions-under-a, .item-actions-under-b) > #textPanel { grid-column: 1; }
  .smart-view.mode-split:is(.item-actions-under-a, .item-actions-under-b) > #imagePanel { grid-column: 3; }
  .smart-view.mode-split:is(.item-actions-under-a, .item-actions-under-b) > .vertical { grid-column: 2; grid-row: 1 / 3; }
  .smart-view.mode-split.item-actions-under-a > #imagePanel, .smart-view.mode-split.item-actions-under-b > #textPanel { grid-row: 1 / 3; }
  .smart-view.mode-split.item-actions-under-a > .detail-actions-footer { grid-column: 1; grid-row: 2; }
  .smart-view.mode-split.item-actions-under-b > .detail-actions-footer { grid-column: 3; grid-row: 2; }
}

@media (pointer: coarse) {
  .smartview-fullscreen-dialog, html[data-density="normal"] .smartview-fullscreen-dialog { --control-height: 44px; }
  .app-shell { --control-height: 44px; }
  html[data-density="normal"] .app-shell { --control-height: 44px; }
}

.image-stage img.comparison-return-image { cursor: pointer; }
.heart-button { display: inline-flex; align-items: center; justify-content: center; gap: .25rem; margin-inline-start: 0; font-weight: 700; }
:is(.detail-actions, .detail-actions-footer, .comparison-panel-actions) :is(.item-favorite-star, .heart-button) { min-width: 0; padding: 2px 6px; border: 0; background: transparent; font-size: 1.2rem; line-height: 1; }
:is(.detail-actions, .detail-actions-footer, .comparison-panel-actions) :is(.item-favorite-star, .heart-button):hover { border: 0; background: transparent; }
.heart-button-icon { font-size: 1em; line-height: 1; }
.heart-button[data-heart-state="active-provisional"] { color: #fff; background: transparent; }
.heart-button[data-heart-state="active-provisional"] .heart-button-icon { color: #ff4d5f; }
.heart-button[data-heart-state="active-locked"] { color: #fff; background: transparent; }
.heart-button[data-heart-state="active-locked"] .heart-button-icon { color: #fff; }
.heart-button[data-heart-state="active-locked"]:disabled { opacity: 1; }
.community-dialog { width: min(960px, calc(100vw - 2rem)); }
.community-content { min-height: 16rem; max-height: 65vh; overflow: auto; display: grid; gap: .75rem; }
.community-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.community-card { border: 1px solid var(--border, #3a4650); border-radius: .45rem; padding: .75rem; display: grid; gap: .45rem; background: color-mix(in srgb, var(--panel, #1c2226) 94%, white); }
.community-card header { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.community-card pre { white-space: pre-wrap; word-break: break-word; max-height: 18rem; overflow: auto; margin: 0; }
.community-card .community-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.community-feedback-form { display: grid; gap: .5rem; }
.community-feedback-form textarea { min-height: 6rem; }
.community-version-current { border-color: #4e9d72; }
.community-hidden { opacity: .68; }
.community-inbox-row { grid-template-columns: auto 1fr auto; align-items: center; }
.community-inbox-row input { margin: 0; }
.community-empty { padding: 2rem; text-align: center; color: var(--muted, #9aa5ad); }
