.app-shell { height: 100dvh; overflow: hidden; background: var(--white); }
.topbar { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: var(--topbar-height); color: var(--white); background: var(--navy); }
.brand { display: flex; align-items: baseline; gap: var(--space-2); padding: 0 var(--space-5); text-decoration: none; }
.brand-mark { font-size: var(--text-lg); font-weight: 750; letter-spacing: -0.04em; }
.brand > span:last-child { color: color-mix(in srgb, var(--white) 72%, transparent); font-size: var(--text-xs); }
.connection-status { display: flex; align-items: center; gap: var(--space-2); padding-right: var(--space-5); color: color-mix(in srgb, var(--white) 78%, transparent); font-size: var(--text-sm); }
.connection-status i { width: var(--space-2); height: var(--space-2); background: var(--warning); border-radius: 50%; }
.connection-status.is-connected i { background: var(--success); }
.connection-status.is-error i { background: var(--danger); }
.connection-status > button { margin-left: var(--space-2); padding: var(--space-2) var(--space-3); color: var(--white); background: transparent; border: var(--border-thin) solid color-mix(in srgb, var(--white) 26%, transparent); border-radius: var(--radius-control); }
.tool-menu { position: relative; }
.tool-menu summary { padding: var(--space-2) var(--space-3); color: var(--white); list-style: none; cursor: pointer; }
.tool-menu summary::-webkit-details-marker { display: none; }
.tool-menu summary:hover, .tool-menu[open] summary { background: color-mix(in srgb, var(--white) 9%, transparent); }
.tool-menu > div { position: absolute; z-index: 45; top: calc(100% + var(--space-1)); right: 0; display: grid; min-width: var(--sidebar-width); padding: var(--space-2); color: var(--ink); background: var(--white); border: var(--border-thin) solid var(--line-dark); box-shadow: var(--shadow-dialog); }
.tool-menu > div button { width: 100%; min-height: var(--control-height); padding: 0 var(--space-3); color: var(--ink); text-align: left; background: var(--white); border: 0; }
.tool-menu > div button:hover, .tool-menu > div button:focus-visible { background: var(--panel); }
html[data-profile="loading"] #connect-button,
html[data-profile="loading"] #local-hwp-button,
html[data-profile="loading"] #settings-button,
html[data-profile="loading"] #settings-dialog,
html[data-profile="loading"] #local-hwp-input,
html[data-profile="loading"] .result-menu-panel button[data-row-action="edit"],
html[data-profile="public"] #connect-button,
html[data-profile="public"] #local-hwp-button,
html[data-profile="public"] #settings-button,
html[data-profile="public"] #settings-dialog,
html[data-profile="public"] #local-hwp-input,
html[data-profile="public"] .result-menu-panel button[data-row-action="edit"] { display: none !important; }
.workspace { display: grid; height: calc(100dvh - var(--topbar-height)); grid-template-columns: minmax(0, 40%) minmax(0, 60%); grid-template-rows: auto minmax(0, 1fr); }
.folder-panel { display: flex; grid-column: 1 / -1; align-items: center; min-width: 0; min-height: var(--folder-strip-height); padding: 0 var(--space-5); background: var(--panel); border-bottom: var(--border-thin) solid var(--line); }
.folder-panel > header { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto; padding: 0 var(--space-5) 0 0; }
.folder-panel > header strong { font-size: var(--text-md); }
.folder-panel > header span { color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.folder-panel nav { display: flex; align-self: stretch; min-width: 0; gap: var(--space-1); overflow-x: auto; scrollbar-width: thin; }
.folder-button { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto; min-height: var(--control-height); padding: 0 var(--space-3); color: var(--muted); text-align: left; white-space: nowrap; background: transparent; border: 0; border-bottom: var(--border-strong) solid transparent; }
.folder-button:hover { color: var(--ink); background: var(--white); }
.folder-button.is-active { color: var(--navy); font-weight: 650; background: var(--white); border-bottom-color: var(--blue); }
.folder-button span { white-space: nowrap; }
.folder-button small { font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.source-location { display: none; }
.source-location span, .source-location small, .source-location time { color: var(--muted); font-size: var(--text-xs); }
.source-location strong { overflow: hidden; font-size: var(--text-sm); text-overflow: ellipsis; white-space: nowrap; }
.source-location time { display: none; }
.document-pane { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; }
.sync-notice { position: relative; flex: 0 1 auto; min-width: 0; max-width: 35%; color: var(--success); font-size: var(--text-xs); }
.sync-notice summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.sync-notice-detail { position: absolute; z-index: 20; top: calc(100% + var(--space-2)); left: 0; width: min(320px, 80vw); padding: var(--space-3); color: var(--muted-strong); background: var(--white); border: var(--border-thin) solid var(--line-dark); box-shadow: var(--shadow-paper); }
.sync-notice-detail p { margin: 0 0 var(--space-2); line-height: 1.5; }
.sync-notice-detail button { padding: 0; color: var(--blue); background: transparent; border: 0; }
.sync-notice.is-error { color: var(--danger); }
.search-bar { display: grid; grid-template-columns: var(--search-scope-width) minmax(0, 1fr) var(--search-button-width); align-items: center; gap: var(--space-2); min-height: var(--topbar-height); padding: var(--space-1) var(--space-3); background: var(--white); border-bottom: var(--border-thin) solid var(--line); }
.search-bar label { display: block; min-width: 0; }
.search-bar label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.search-bar input, .search-bar select { width: 100%; height: var(--control-height); padding: 0 var(--space-3); background: var(--white); border: var(--border-thin) solid var(--line-dark); border-radius: var(--radius-control); }
.search-query { position: relative; }
.search-query input { padding-right: var(--control-height); }
.search-query kbd { position: absolute; right: var(--space-3); top: 50%; color: var(--muted); font-size: var(--text-xs); transform: translateY(-50%); }
.search-bar > button { height: var(--control-height); color: var(--white); font-weight: 650; background: var(--blue); border: var(--border-thin) solid var(--blue); border-radius: var(--radius-control); }
.search-bar > button:hover { background: var(--blue-hover); }
.table-toolbar { display: flex; align-items: center; gap: var(--space-3); min-height: var(--folder-strip-height); padding: 0 var(--space-3); border-bottom: var(--border-thin) solid var(--line); }
.table-toolbar strong { min-width: 0; overflow: hidden; font-size: var(--text-md); text-overflow: ellipsis; white-space: nowrap; }
.table-toolbar > div { display: flex; flex: 0 0 auto; align-items: center; gap: var(--space-2); margin-left: auto; }
.table-toolbar span { color: var(--muted); font-size: var(--text-xs); }
.table-toolbar button { padding: var(--space-1) var(--space-2); color: var(--muted); font-size: var(--text-xs); white-space: nowrap; background: transparent; border: 0; border-left: var(--border-thin) solid var(--line); }
.document-table { min-height: 0; overflow-y: auto; border-bottom: var(--border-thin) solid var(--line-dark); }
.document-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) var(--control-height); align-items: start; width: 100%; padding: var(--space-2) var(--space-3); text-align: left; background: var(--white); border-bottom: var(--border-thin) solid var(--line); }
.document-row:hover { background: var(--panel-hover); }
.document-row.is-selected { background: var(--blue-soft); box-shadow: inset var(--accent-width) 0 var(--blue); }
.document-select { display: grid; min-width: 0; grid-template-columns: var(--space-6) minmax(0, 1fr); gap: var(--space-2); padding: 0; text-align: left; background: transparent; border: 0; }
.result-rank { padding-top: var(--space-1); color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.result-content { display: grid; min-width: 0; gap: var(--space-1); }
.result-topline, .result-subline { display: flex; align-items: baseline; min-width: 0; gap: var(--space-2); }
.document-name { min-width: 0; overflow: hidden; font-size: var(--text-md); line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.document-name strong { font-weight: 650; }
.result-match { flex: 0 0 auto; margin-left: auto; color: var(--blue); font-size: var(--text-xs); white-space: nowrap; }
.format-label { display: inline-block; margin-right: var(--space-2); padding: 0 var(--space-1); color: var(--blue); font-size: var(--text-xs); font-style: normal; font-weight: 700; border: var(--border-thin) solid color-mix(in srgb, var(--blue) 38%, var(--white)); }
.result-path { min-width: 0; overflow: hidden; color: var(--muted); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.result-date { flex: 0 0 auto; margin-left: auto; color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }
.result-excerpt { display: -webkit-box; overflow: hidden; color: var(--muted-strong); font-size: var(--text-sm); line-height: 1.5; overflow-wrap: break-word; word-break: keep-all; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.new-label { display: inline-block; margin-left: var(--space-2); padding: 0 var(--space-1); color: var(--success); font-size: var(--text-xs); font-weight: 700; border: var(--border-thin) solid color-mix(in srgb, var(--success) 48%, var(--white)); }
.result-actions { position: relative; }
.result-actions summary { display: grid; width: var(--control-height); height: var(--control-height); place-items: center; color: var(--muted); font-size: var(--text-lg); line-height: 1; list-style: none; cursor: pointer; }
.result-actions summary::-webkit-details-marker { display: none; }
.result-actions summary:hover, .result-actions[open] summary { color: var(--blue); background: var(--blue-soft); }
.result-menu-panel { position: fixed; z-index: 25; top: 0; left: 0; width: var(--sidebar-width); padding: var(--space-2); background: var(--white); border: var(--border-thin) solid var(--line-dark); box-shadow: var(--shadow-paper); }
.result-menu-panel button { display: block; width: 100%; min-height: var(--control-height); padding: 0 var(--space-2); text-align: left; background: transparent; border: 0; }
.result-menu-panel button:hover, .result-menu-panel button:focus-visible { background: var(--panel); }
.result-menu-panel small { display: block; padding: var(--space-2); color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.empty-state { padding: var(--space-8) var(--space-4); color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: var(--space-2); color: var(--ink); }
.detail-panel { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; background: var(--panel); border-left: var(--border-thin) solid var(--line); }
.mobile-back { display: none; }
.detail-panel #document-detail { min-height: 0; padding: var(--space-3); overflow-y: auto; overscroll-behavior: contain; }
.preview-page-status { position: absolute; z-index: 3; right: var(--space-5); bottom: var(--space-5); padding: var(--space-1) var(--space-2); color: var(--muted-strong); font-size: var(--text-xs); font-variant-numeric: tabular-nums; background: var(--white); box-shadow: var(--shadow-paper); pointer-events: none; }
.paper-preview { width: 100%; aspect-ratio: 210 / 297; padding: var(--space-8); background: var(--white); box-shadow: var(--shadow-paper); }
.paper-preview > span { color: var(--muted); font-size: var(--text-xs); }
.paper-preview h3 { margin: var(--space-8) 0 var(--space-5); font-size: var(--text-lg); line-height: 1.5; text-align: center; overflow-wrap: break-word; word-break: keep-all; }
.paper-preview p { font-size: var(--text-sm); line-height: 1.85; overflow-wrap: break-word; word-break: keep-all; }
.drive-preview { width: 100%; height: calc(100dvh - var(--topbar-height) - var(--space-6)); background: var(--white); border: 0; }
.source-page { width: 100%; aspect-ratio: 210 / 297; margin: 0 0 var(--space-3); overflow: hidden; background: var(--white); box-shadow: var(--shadow-paper); }
.source-page canvas, .source-page img { display: block; width: 100%; height: auto; background: var(--white); }
.source-page img { height: 100%; object-fit: contain; }
.preview-loading, .preview-error { margin: 0; padding: var(--space-4); color: var(--muted-strong); font-size: var(--text-sm); text-align: center; background: var(--white); }
.preview-error { color: var(--danger); }
.hwp-render-host { position: fixed; left: -10000px; top: 0; width: var(--hwp-render-width); height: var(--hwp-render-width); visibility: hidden; pointer-events: none; }
.settings-dialog { width: min(var(--settings-dialog-width), calc(100% - var(--space-8))); max-height: calc(100dvh - var(--space-8)); padding: 0; color: var(--ink); background: var(--white); border: var(--border-thin) solid var(--line-dark); border-radius: var(--radius-dialog); box-shadow: var(--shadow-dialog); }
.settings-dialog::backdrop { background: var(--backdrop); }
.settings-dialog form { display: grid; gap: var(--space-4); padding: var(--space-6); }
.settings-dialog header { display: flex; justify-content: space-between; }
.settings-dialog header span { color: var(--blue); font-size: var(--text-xs); }
.settings-dialog h2 { margin: var(--space-1) 0 0; font-size: var(--text-xl); }
.dialog-close { align-self: flex-start; padding: 0 var(--space-1); color: var(--muted); font-size: var(--text-xl); background: transparent; border: 0; }
.settings-dialog form > p { margin: 0; color: var(--muted); font-size: var(--text-sm); line-height: 1.6; }
.settings-dialog .field-help { margin-top: var(--space-neg-2); font-size: var(--text-xs); }
.settings-dialog code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.settings-dialog form > label:not(.checkbox-row) { display: grid; gap: var(--space-2); }
.settings-dialog label > span { font-size: var(--text-sm); font-weight: 650; }
.settings-dialog input[type="text"], .settings-dialog input:not([type]) { height: var(--control-height); padding: 0 var(--space-3); border: var(--border-thin) solid var(--line-dark); border-radius: var(--radius-control); }
.checkbox-row { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-3); background: var(--panel); border: var(--border-thin) solid var(--line); }
.checkbox-row input { margin-top: 0; }
.checkbox-row span { display: grid; gap: var(--space-1); }
.checkbox-row small { color: var(--muted); font-weight: 400; }
.settings-dialog aside { padding: var(--space-3) var(--space-4); background: var(--panel); border-left: var(--accent-width) solid var(--blue); }
.settings-dialog aside strong { font-size: var(--text-sm); }
.settings-dialog aside ol { margin: var(--space-2) 0 0; padding-left: var(--space-5); color: var(--muted-strong); font-size: var(--text-xs); line-height: 1.7; }
.settings-dialog footer { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-1); }
.settings-dialog footer button { min-height: var(--button-height); padding: 0 var(--space-4); border-radius: var(--radius-control); }
.settings-dialog footer button[type="submit"] { color: var(--white); background: var(--blue); border: var(--border-thin) solid var(--blue); }
.toast { position: fixed; z-index: 80; right: var(--space-5); bottom: var(--space-5); max-width: min(var(--detail-width), calc(100% - var(--space-5) - var(--space-5))); padding: var(--space-3) var(--space-4); color: var(--white); background: var(--ink); box-shadow: var(--shadow-dialog); }
.document-editor-dialog { width: min(var(--editor-dialog-width), calc(100% - var(--space-8))); height: calc(100dvh - var(--space-8)); max-width: none; max-height: none; padding: 0; color: var(--ink); background: var(--white); border: var(--border-thin) solid var(--line-dark); border-radius: var(--radius-dialog); box-shadow: var(--shadow-dialog); }
.document-editor-dialog::backdrop { background: var(--backdrop); }
.document-editor-dialog > section { display: grid; height: 100%; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.document-editor-dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) var(--space-5) var(--space-3); border-bottom: var(--border-thin) solid var(--line); }
.document-editor-dialog header span { color: var(--blue); font-size: var(--text-xs); font-weight: 650; }
.document-editor-dialog h2 { margin: var(--space-1) 0 0; font-size: var(--text-lg); }
.document-editor-dialog header button { padding: 0 var(--space-1); color: var(--muted); font-size: var(--text-xl); background: transparent; border: 0; }
.editor-status { min-height: var(--button-height); margin: 0; padding: var(--space-2) var(--space-5); color: var(--muted); font-size: var(--text-xs); background: var(--panel); border-bottom: var(--border-thin) solid var(--line); }
.editor-status[data-type="changed"] { color: var(--warning); background: var(--warning-soft); }
.editor-status[data-type="error"] { color: var(--danger); }
.hwp-editor-host { min-width: 0; min-height: 0; overflow: hidden; background: var(--panel); }
.document-editor-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-5); border-top: var(--border-thin) solid var(--line); }
.document-editor-dialog footer p { margin: 0; color: var(--muted); font-size: var(--text-xs); }
.document-editor-dialog footer button { min-height: var(--button-height); padding: 0 var(--space-4); color: var(--white); font-weight: 650; background: var(--blue); border: var(--border-thin) solid var(--blue); border-radius: var(--radius-control); }
