:root {
  color-scheme: light;
  --background: #f7f8f4;
  --surface: #fff;
  --ink: #20302b;
  --muted: #596961;
  --line: #dce5dd;
  --forest: #153d32;
  --forest-dark: #102f27;
  --light-green: #e9f1e7;
  --accent: #d4e5ac;
  --error: #9c292d;
  --error-bg: #fff0ef;
  --warning: #70511a;
  --warning-bg: #fff4d8;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: Georgia, Cambria, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--ink); font: 15px/1.5 var(--font); }
h1, h2, h3, p { margin: 0; }
h1, h2 { line-height: 1.15; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
button, input, select, a { touch-action: manipulation; }
button:disabled, select:disabled { cursor: default; opacity: .58; }
a { color: inherit; }
:focus-visible { outline: 3px solid #6b8c43; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 20; padding: 10px 15px; background: var(--surface); }
.skip-link:focus { top: 1rem; }
.page-width { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }
.site-header { position: relative; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 76px; display: flex; align-items: center; gap: 38px; }
.wordmark { display: inline-flex; gap: 11px; align-items: center; flex: none; padding: 0; border: 0; background: none; text-decoration: none; color: var(--forest); font-weight: 750; letter-spacing: -.025em; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--forest); color: var(--accent); }
.brand-mark > span { position: relative; width: 14px; height: 17px; border: 1.5px solid currentColor; border-radius: 2px; transform: translate(2px, -1px); }
.brand-mark > span::before { content: ""; position: absolute; inset: 3px 4px -5px -5px; border: 1.5px solid currentColor; border-top: 0; border-right: 0; border-radius: 0 0 0 2px; }
.brand-mark > span::after { content: ""; position: absolute; inset: 5px 3px auto; height: 4px; border-block: 1px solid currentColor; }
.site-nav { display: flex; align-items: stretch; gap: 26px; align-self: stretch; }
.site-nav button { display: flex; align-items: center; gap: 6px; position: relative; border: 0; padding: 0 1px; background: none; color: var(--muted); font-weight: 620; }
.site-nav button:hover, .site-nav button[aria-current] { color: var(--forest); }
.site-nav button[aria-current]::after { content: ""; position: absolute; height: 3px; border-radius: 3px 3px 0 0; background: var(--forest); inset: auto 0 0; }
.nav-count { padding: 1px 6px; border-radius: 20px; font-size: .73rem; color: var(--forest); background: var(--light-green); }
.header-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; text-decoration: none; font-weight: 650; line-height: 1.25; white-space: nowrap; }
.button-primary { background: var(--forest); color: #fff; }
.button-primary:hover { background: var(--forest-dark); }
.button-outline { border-color: var(--line); background: var(--surface); color: var(--forest); }
.button-outline:hover { background: var(--light-green); border-color: #bfcebf; }
.button-compact { width: 40px; min-height: 40px; padding: 0; font-size: 1.35rem; }
.button-link { padding: 0; border: 0; background: none; color: var(--forest); font-size: .83rem; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.account { position: relative; }
.account summary { display: flex; align-items: center; gap: 7px; color: var(--forest); font-size: .84rem; font-weight: 650; list-style: none; cursor: pointer; }
.account summary::-webkit-details-marker { display: none; }
#avatar { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 50%; background: var(--light-green); }
.account-dropdown { position: absolute; z-index: 2; right: 0; top: calc(100% + 10px); width: 148px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 9px 24px #182f2420; background: var(--surface); }
.account-dropdown button { width: 100%; padding: 8px 10px; text-align: left; border: 0; border-radius: 5px; background: none; color: var(--forest); }
.account-dropdown button:hover { background: var(--light-green); }
#main { padding-block: 32px 64px; }
#main:focus { outline: none; }
.search-panel { padding: 36px 40px 32px; border-radius: 15px; color: #fff; background: radial-gradient(ellipse at 87% 2%, #285a47 0%, transparent 58%), var(--forest); }
.search-panel h1 { margin-bottom: 18px; font: 400 clamp(2.15rem, 3.9vw, 3.35rem)/1.05 var(--display); letter-spacing: -.037em; }
.search-panel p { margin-top: 13px; color: #dcebe1; font-size: .89rem; }
#search-form { display: flex; gap: 10px; width: min(760px, 100%); }
.search-input { display: flex; align-items: center; flex: 1; min-width: 0; gap: 13px; padding-inline: 16px 8px; border: 1px solid #edeee7; border-radius: 8px; background: var(--surface); color: var(--muted); }
.search-input:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.search-input input { min-width: 0; width: 100%; min-height: 48px; padding: 9px 0; border: 0; outline: 0; background: none; color: var(--ink); }
.search-input input::-webkit-search-cancel-button { display: none; }
.button-search { align-self: stretch; padding-inline: 22px; background: var(--accent); color: var(--forest-dark); }
.button-search:hover { background: #e2edc9; }
.archive-layout { display: grid; grid-template-columns: minmax(200px, 244px) minmax(0, 1fr); align-items: start; gap: 25px; margin-top: 28px; }
.filter-panel, .document-list, .import-history { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.filter-panel { padding: 17px; }
.filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 16px; }
.filter-heading h2 { display: flex; align-items: center; gap: 9px; font-size: 1rem; }
.filter-controls { display: flex; align-items: center; gap: 9px; }
#toggle-filters { display: none; }
.filter-form { display: grid; gap: 6px; }
.filter-form label, .filter-form legend, .login-card label { color: var(--ink); font-size: .83rem; font-weight: 650; }
.filter-form :is(input, select), .login-card input { width: 100%; min-height: 40px; margin-bottom: 6px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.filter-form select { text-overflow: ellipsis; }
.filter-form fieldset { display: grid; grid-template-columns: 1fr; gap: 3px; margin: 0 0 5px; padding: 8px 0 0; border: 0; }
.filter-form fieldset label { color: var(--muted); font-size: .76rem; }
.filter-form .button { margin-top: 3px; }
.results { min-width: 0; }
.results-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.results-heading h2 { font: 400 1.85rem/1.1 var(--display); letter-spacing: -.03em; overflow-wrap: anywhere; }
.results-heading p { min-height: 1.4em; margin-top: 4px; color: var(--muted); font-size: .85rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.active-filters { margin: 0 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 9px; border: 1px solid #dfe9dd; border-radius: 20px; background: var(--light-green); color: var(--forest); line-height: 1.4; font-size: .74rem; font-weight: 600; overflow-wrap: anywhere; }
button.chip:hover { border-color: #9eaf9d; }
.document-list { overflow: hidden; min-height: 132px; }
.document-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(84px, auto) auto; align-items: start; gap: 13px; width: 100%; min-height: 86px; padding: 14px 15px; border: 0; background: var(--surface); color: inherit; text-align: left; }
.document-row + .document-row { border-top: 1px solid var(--line); }
.document-row:hover { background: #f5f8f3; }
.document-row:focus-visible { outline-offset: -3px; }
.file-badge { display: inline-grid; place-items: center; inline-size: 43px; block-size: 49px; border: 1px solid #d7e5d7; border-radius: 7px; background: #ecf4eb; color: #365845; font-size: .62rem; font-weight: 780; letter-spacing: .025em; }
.file-badge.file-pdf { border-color: #ebdcd7; background: #f9eeeb; color: #843e34; }
.file-badge.file-doc { border-color: #dbe5ed; background: #edf4fa; color: #355572; }
.file-badge.file-image { border-color: #eadfcf; background: #fbf3e7; color: #725527; }
.document-row strong, .import-row strong { display: block; color: var(--ink); font-weight: 710; overflow-wrap: anywhere; }
.row-meta { display: block; margin-top: 3px; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.row-snippet { display: -webkit-box; margin-top: 5px; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--muted); font-size: .83rem; overflow-wrap: anywhere; }
.row-snippet mark { border-radius: 2px; background: #e4edc4; color: var(--forest-dark); }
.row-tags { margin-top: 7px; }
.row-date { margin-top: 2px; color: var(--muted); font-size: .79rem; text-align: right; white-space: nowrap; }
.row-arrow { margin: 0 2px 0 3px; color: #526e60; font-size: 1.1rem; }
.empty-state { display: grid; justify-items: center; gap: 9px; padding: 37px 18px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 1.02rem; }
.empty-state p { max-width: 340px; font-size: .87rem; }
.empty-state .button { margin-top: 5px; }
.empty-mark { display: grid; width: 45px; height: 45px; place-items: center; border-radius: 11px; background: var(--light-green); color: var(--forest); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; }
.pagination span { color: var(--muted); font-size: .85rem; }
.imports-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin: 12px 0 24px; }
.imports-heading h1 { margin-bottom: 6px; font: 400 clamp(2.2rem, 4vw, 3.3rem)/1.05 var(--display); letter-spacing: -.04em; }
.imports-heading p { color: var(--muted); }
.import-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin-bottom: 22px; }
.import-summary > div { display: grid; gap: 2px; min-width: 0; padding: 15px 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.import-summary strong { font: 400 1.8rem/1.15 var(--display); color: var(--forest); }
.import-summary span { color: var(--muted); font-size: .86rem; }
.import-history h2 { padding: 17px 18px; border-bottom: 1px solid var(--line); font-size: 1.1rem; }
.import-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; }
.import-row + .import-row { border-top: 1px solid var(--line); }
.import-row .file-badge { width: 36px; height: 41px; }
.import-actions { display: grid; justify-items: end; gap: 5px; }
.import-title { border: 0; padding: 0; background: none; color: var(--forest); text-align: left; font-weight: 700; overflow-wrap: anywhere; }
.import-title:hover { text-decoration: underline; }
.import-error { display: block; margin-top: 3px; color: var(--error); font-size: .82rem; overflow-wrap: anywhere; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 20px; background: #eaf0ef; color: #385752; line-height: 1.2; font-size: .75rem; font-weight: 650; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-done, .status-duplicate, .status-transferred { background: var(--light-green); color: #315d42; }
.status-processing, .status-uploading { background: #e9effb; color: #354d81; }
.status-error { background: var(--error-bg); color: var(--error); }
.status-waiting { background: var(--warning-bg); color: var(--warning); }
.notice { padding: 9px 12px; border: 1px solid #cfe0cf; border-radius: 7px; background: var(--light-green); color: var(--forest); overflow-wrap: anywhere; }
.notice-error { border-color: #f1c8c8; background: var(--error-bg); color: var(--error); }
.notice-warning { border-color: #ead9a5; background: var(--warning-bg); color: var(--warning); }
#app-notice { margin-bottom: 14px; }
.startup { margin: 4rem auto; width: min(90%, 420px); color: var(--muted); text-align: center; }
.login-layout { display: grid; min-height: 100dvh; place-items: center; padding: 22px; background: radial-gradient(ellipse at 66% 14%, #e1eadc, transparent 65%); }
.login-card { width: min(100%, 428px); padding: 32px; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 16px 46px #163d3010; background: var(--surface); }
.login-brand { margin-bottom: 30px; }
.login-card h1 { margin-bottom: 20px; font: 400 2.45rem/1 var(--display); letter-spacing: -.03em; }
.login-card form { display: grid; gap: 8px; }
.login-card input { min-height: 44px; margin-bottom: 4px; padding-inline: 12px; }
.login-card .button { justify-content: space-between; margin-top: 7px; }
.modal { position: fixed; padding: 0; max-height: min(90dvh, 930px); max-width: calc(100% - 30px); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 24px 80px #13281f50; background: var(--surface); color: var(--ink); }
.modal::backdrop { background: #0c2118a6; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px 15px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font: 400 1.9rem/1.15 var(--display); letter-spacing: -.03em; overflow-wrap: anywhere; }
.modal-header p { margin-top: 4px; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.icon-button { display: inline-grid; flex: none; place-items: center; width: 33px; height: 33px; border: 0; border-radius: 7px; background: none; color: var(--forest); font-size: 1.45rem; line-height: 1; }
.icon-button:hover, .modal-close { background: var(--light-green); }
.modal-close:hover { background: #dce9da; }
.upload-modal { width: 560px; }
.dropzone { display: grid; justify-items: center; gap: 5px; margin: 16px 22px; padding: 22px 12px; border: 2px dashed #c3d4c2; border-radius: var(--radius); background: #f6f9f4; text-align: center; }
.dropzone.is-dragging { border-color: var(--forest); background: #e5efe2; }
.dropzone strong { font-size: 1.04rem; }
.dropzone p { color: var(--muted); font-size: .85rem; }
.dropzone .button { margin-top: 7px; }
.upload-mark { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 3px; border-radius: 8px; background: var(--light-green); color: var(--forest); }
.upload-queue { margin: 0 22px 15px; }
.queue-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.queue-heading h3 { font-size: .92rem; }
.queue-heading span { color: var(--muted); font-size: .8rem; text-align: right; }
.upload-list { max-height: 280px; overflow: auto; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; list-style: none; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; min-height: 43px; padding: 7px 8px; }
.upload-item + .upload-item { border-top: 1px solid var(--line); }
.upload-item strong { font-size: .83rem; overflow-wrap: anywhere; }
.upload-item progress { grid-column: 1 / -1; width: 100%; height: 5px; accent-color: var(--forest); }
.upload-item .button-link { justify-self: start; }
.upload-item .import-error { grid-column: 1 / -1; }
.modal-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--line); }
.modal-footer .button-link { margin-right: auto; }
.document-modal { width: min(1240px, calc(100vw - 42px)); }
.document-modal[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); height: min(88dvh, 930px); }
.document-kind { margin-bottom: 3px; color: var(--forest); font-size: .8rem; font-weight: 730; overflow-wrap: anywhere; }
.document-kind:empty, .modal-header p:empty { display: none; }
.document-actions { display: flex; align-items: center; gap: 10px; }
.document-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 315px); min-height: 0; overflow: hidden; }
.preview-section { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #e8ede8; }
.preview-tools { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); background: #f4f7f1; }
.preview-tools .button { min-height: 33px; font-size: .82rem; }
.preview-tools .button[aria-pressed="true"] { border-color: #c3d4c2; background: var(--light-green); }
.preview-tools .preview-link { margin-left: auto; }
.workbook-controls label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .83rem; }
.workbook-controls select { max-width: 180px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.preview { display: grid; flex: 1; place-items: stretch; min-height: 0; overflow: auto; }
.preview > iframe { width: 100%; height: 100%; min-height: 350px; border: 0; background: var(--surface); }
.preview > img { place-self: center; max-width: 100%; max-height: 100%; padding: 14px; object-fit: contain; }
.preview > :is(audio, video) { place-self: center; max-width: 100%; max-height: 100%; }
.preview > .empty-state { align-content: center; }
.preview > pre { margin: 0; padding: 18px; color: var(--ink); background: #f4f7f3; font: .85rem/1.55 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.workbook { min-width: min-content; background: var(--surface); }
.workbook caption { padding: 6px 8px; color: var(--muted); text-align: left; }
.workbook-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .8rem; }
.workbook-table th, .workbook-table td { min-width: 84px; max-width: 280px; padding: 5px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.workbook-table thead th { position: sticky; top: 0; background: var(--light-green); }
.workbook-table tbody th { min-width: 36px; background: #f1f5ef; }
.document-meta { min-height: 0; overflow: auto; padding: 15px 17px; border-left: 1px solid var(--line); background: var(--surface); }
.meta-section + .meta-section { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.meta-section h3 { margin-bottom: 8px; font-size: .92rem; }
.meta-section p { color: var(--muted); font-size: .85rem; }
.meta-section .notice { margin-bottom: 9px; color: var(--warning); }
.key-values { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); gap: 6px 8px; margin-block: 0; font-size: .82rem; }
.key-values dt { color: var(--muted); overflow-wrap: anywhere; }
.key-values dd { margin: 0; overflow-wrap: anywhere; }
.related-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-top: 7px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; background: #f8faf6; color: var(--forest); text-align: left; }
.related-link:hover { background: var(--light-green); }
.related-link strong { display: block; font-size: .83rem; overflow-wrap: anywhere; }
.related-link small { display: block; margin-top: 2px; color: var(--muted); }
.icon { display: inline-block; flex: none; position: relative; width: 16px; height: 16px; }
.icon-search { border: 1.7px solid currentColor; border-radius: 50%; width: 13px; height: 13px; margin: -2px 2px 0 0; }
.icon-search::after { content: ""; position: absolute; width: 6px; height: 1.7px; left: 9px; top: 10px; border-radius: 2px; transform: rotate(45deg); background: currentColor; }
.icon-upload, .icon-download { height: 7px; margin-top: 7px; border: 1.6px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.icon-upload::before, .icon-download::before { content: ""; position: absolute; width: 1.6px; height: 10px; left: 6px; border-radius: 2px; background: currentColor; }
.icon-upload::before { top: -8px; }
.icon-download::before { top: -9px; }
.icon-upload::after, .icon-download::after { content: ""; position: absolute; left: 4px; width: 6px; height: 6px; border-left: 1.6px solid currentColor; border-top: 1.6px solid currentColor; }
.icon-upload::after { top: -8px; transform: rotate(45deg); }
.icon-download::after { top: -4px; transform: rotate(225deg); }
.icon-chevron { width: 6px; height: 6px; margin: -3px 0 0 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.icon-filter { width: 14px; height: 12px; background: linear-gradient(currentColor, currentColor) 0 1px / 14px 1.5px, linear-gradient(currentColor, currentColor) 2px 5px / 10px 1.5px, linear-gradient(currentColor, currentColor) 5px 9px / 4px 1.5px; background-repeat: no-repeat; }

@media (max-width: 850px) {
  .page-width { width: calc(100% - 36px); }
  .header-inner { gap: 21px; }
  .header-actions { gap: 12px; }
  .site-nav { gap: 16px; }
  #account-name { display: none; }
  .search-panel { padding: 30px 28px; }
  .archive-layout { grid-template-columns: minmax(170px, 205px) minmax(0, 1fr); gap: 15px; }
  .filter-panel { padding: 13px; }
  .document-row { gap: 9px; padding: 12px; }
  .document-body { grid-template-columns: minmax(0, 1fr) 250px; }
}

@media (max-width: 640px) {
  .page-width { width: calc(100% - 24px); }
  .header-inner { min-height: 0; flex-wrap: wrap; gap: 0; padding-top: 9px; }
  .wordmark { gap: 6px; font-size: .83rem; }
  .brand-mark { width: 27px; height: 27px; border-radius: 7px; }
  .brand-mark > span { transform: translate(2px, -1px) scale(.8); }
  .header-actions { order: 2; gap: 7px; }
  .header-actions .button { min-height: 33px; gap: 5px; padding: 5px 7px; font-size: .73rem; }
  #avatar { width: 27px; height: 27px; }
  .account summary .icon-chevron { display: none; }
  .site-nav { order: 3; width: 100%; height: 41px; justify-content: flex-start; gap: 22px; padding-left: 1px; font-size: .84rem; }
  #main { padding-block: 15px 35px; }
  .search-panel { padding: 21px 14px; border-radius: 12px; }
  .search-panel h1 { margin-bottom: 13px; }
  .search-panel p { font-size: .76rem; }
  #search-form { gap: 6px; }
  .search-input { gap: 8px; padding-inline: 9px 3px; }
  .search-input input { min-height: 42px; font-size: .82rem; }
  .button-search { gap: 4px; padding-inline: 8px; font-size: .8rem; }
  .archive-layout { grid-template-columns: minmax(0, 1fr); margin-top: 13px; }
  .filter-heading { margin-bottom: 0; }
  #toggle-filters { display: inline-flex; min-height: 30px; padding: 4px 8px; font-size: .78rem; }
  .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 8px; }
  .filter-panel:not(.is-open) .filter-form { display: none; }
  .filter-panel.is-open .filter-heading { margin-bottom: 9px; }
  .filter-form label[for="filter-type"] { grid-row: 1; grid-column: 1; }
  #filter-type { grid-row: 2; grid-column: 1; }
  .filter-form label[for="filter-tag"] { grid-row: 1; grid-column: 2; }
  #filter-tag { grid-row: 2; grid-column: 2; }
  .filter-form label[for="filter-correspondent"] { grid-row: 3; grid-column: 1; }
  #filter-correspondent { grid-row: 4; grid-column: 1; }
  .filter-form label[for="filter-source"] { grid-row: 3; grid-column: 2; }
  #filter-source { grid-row: 4; grid-column: 2; }
  .filter-form fieldset { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3px 8px; margin-bottom: 0; }
  .filter-form fieldset label[for="filter-to"] { grid-column: 2; grid-row: 1; }
  .filter-form .button { grid-column: 1 / -1; }
  .filter-form :is(input, select) { margin-bottom: 2px; }
  .results-heading h2 { font-size: 1.55rem; }
  .document-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .row-date { grid-column: 2; grid-row: 2; margin-top: -6px; text-align: left; }
  .row-arrow { grid-column: 3; grid-row: 1; }
  .imports-heading { display: grid; align-items: start; margin: 5px 0 13px; }
  .imports-heading .button { justify-self: start; }
  .import-summary { gap: 7px; }
  .import-summary > div { padding: 8px; }
  .import-summary span { font-size: .73rem; overflow-wrap: anywhere; }
  .import-row { padding-inline: 9px; gap: 8px; }
  .import-row .file-badge { width: 31px; height: 36px; }
  .document-modal { width: 100%; }
  .document-modal[open] { height: 93dvh; }
  .modal-header { padding: 12px; }
  .modal-header h2 { font-size: 1.43rem; }
  .modal-header p { font-size: .78rem; }
  .document-actions { gap: 6px; }
  .document-actions .button { padding: 5px 7px; min-height: 34px; font-size: .72rem; white-space: normal; }
  .document-actions .button .icon { display: none; }
  .document-body { display: block; overflow: auto; }
  .preview { min-height: 345px; max-height: min(64dvh, 560px); }
  .preview > iframe { height: min(62dvh, 550px); }
  .preview > img { max-height: 62dvh; }
  .document-meta { border-left: 0; border-top: 1px solid var(--line); }
  .dropzone, .upload-queue { margin-inline: 12px; }
  .modal-footer { padding-inline: 12px; }
}

@media (max-width: 355px) {
  .header-actions .open-upload span:last-child { display: none; }
  .header-actions .open-upload { min-width: 33px; }
}
