:root {
  color-scheme: light;
  --ink: #192e32; --muted: #5f7073; --line: #d7e1df; --paper: #fff; --ground: #f3f6f5;
  --teal: #146854; --deep: #134c43; --wash: #e8f3ee; --amber: #976121; --error: #953a2b;
  --mono: "IBM Plex Mono", Consolas, "Microsoft YaHei UI", monospace;
  font-family: "Inter", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: var(--ink); background: var(--ground); font-size: 16px; line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary, label.picker, select, a { -webkit-tap-highlight-color: transparent; }
button, summary, select { cursor: pointer; }
button { background: none; border: 0; }
button:disabled, fieldset:disabled .picker { cursor: wait; opacity: .65; }
button:disabled:not([aria-busy]) { cursor: default; }
h1, h2, h3, h4, p, figure, fieldset, ul, ol, dl, dd { margin: 0; }
fieldset, legend { min-width: 0; border: 0; padding: 0; }
h1, h2, h3, h4 { line-height: 1.35; }
h2 { font-size: 20px; letter-spacing: -.045em; }
h3 { font-size: 16px; }
small, .muted { color: var(--muted); font-size: 13px; }
a { text-decoration: none; color: var(--teal); }
:focus-visible, .picker:focus-within, .segment input:focus-visible + span, .switch input:focus-visible + span { outline: 3px solid #3486a3; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.picker input, .segment input, .switch input { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.skip-link { position: absolute; z-index: 10; top: 5px; left: 5px; padding: 8px 15px; background: white; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.icon { display: inline-block; flex: 0 0 auto; width: 18px; height: 18px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.topbar { border-bottom: 1px solid var(--line); background: var(--paper); }
.topbar-inner, .shell { width: min(1392px, 100%); margin-inline: auto; padding-inline: clamp(18px, 4vw, 66px); }
.topbar-inner { min-height: 68px; display: flex; align-items: center; gap: clamp(20px, 5vw, 80px); }
.brand, .main-nav, .main-nav a, .connection, .heading-group, .text-action, .button, .icon-button, .section-head, .queue-line, .dialog-head { display: flex; align-items: center; }
.brand { gap: 9px; color: var(--ink); font-size: 20px; font-weight: 760; letter-spacing: -.06em; white-space: nowrap; }
.main-nav { align-self: stretch; gap: 12px; }
.main-nav a { position: relative; align-self: stretch; gap: 7px; padding: 0 12px; color: var(--muted); white-space: nowrap; font-size: 15px; font-weight: 550; }
.main-nav a:hover, .main-nav a[aria-current] { color: var(--teal); }
.main-nav a[aria-current]::after { content: ""; position: absolute; height: 3px; inset: auto 9px 0; background: var(--teal); border-radius: 3px 3px 0 0; }
.connection { margin-left: auto; gap: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 20px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: #8c9d99; }
.connection.online i { background: #2f926c; box-shadow: 0 0 0 3px #e1f1e9; }
.connection.offline i { background: #b57731; }
.nav-count, .pill { display: inline-block; font: 600 12px/1.5 var(--mono); border-radius: 5px; padding: 1px 7px; background: #eaf0ed; color: #44625c; }
.shell { padding-block: clamp(20px, 2.6vw, 37px) 52px; }
.shell:focus, #results-section:focus { outline: none; }
h1 { margin: 9px 0; font-size: clamp(29px, 2.65vw, 42px); letter-spacing: -.045em; }
#import-panel, #import-report { margin-bottom: 20px; }
.status-filter { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.status-filter select { width: auto; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; background: white; padding: 5px 8px; }
.thumbnail-button { display: grid; place-items: center; padding: 0; width: 108px; height: 68px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #f6faf8; }
.thumbnail-button img { display: block; object-fit: contain; width: 100%; height: 100%; }
.thumbnail-button:hover { border-color: var(--teal); }
.row-actions .delete-action { color: var(--error); }
.danger { background: var(--error); color: white; }
#remove-dialog { max-width: 390px; }
#remove-filename { margin: 10px 0 5px; font-weight: 650; overflow-wrap: anywhere; }
#remove-description { color: var(--muted); font-size: 14px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.feature-section, .contour-records { margin-top: 14px; }
.contour-records p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.contour-records summary { color: var(--teal); font-weight: 600; font-size: 14px; }
.feature-table-scroll { overflow-x: auto; }
.feature-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.feature-table th, .feature-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; }
.feature-table th { color: var(--muted); font-weight: 550; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 2px 5px #213d3810; }
.entry-card, .report-card { padding: clamp(17px, 1.8vw, 26px); }
.form-controls { width: 100%; }
.card-heading, .entry-actions, .collection-tools, .page-heading, .pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-heading { margin-bottom: 18px; flex-wrap: wrap; }
.heading-group { gap: 10px; min-width: 0; }
.heading-icon, .drop-icon, .empty-symbol { display: grid; place-items: center; flex: 0 0 auto; color: var(--teal); background: var(--wash); border-radius: 9px; }
.heading-icon { width: 34px; height: 34px; }
.heading-icon .icon { width: 20px; height: 20px; }
.heading-icon.neutral { color: #5a684c; background: #eef1e6; }
.text-action, .button, .icon-button { gap: 6px; justify-content: center; }
.text-action { padding: 4px 1px; font-size: 13px; color: var(--teal); font-weight: 600; }
.text-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-action .icon { width: 15px; height: 15px; }
.button, .icon-button { min-height: 37px; border: 1px solid transparent; border-radius: 7px; font-weight: 600; transition: background .15s, border-color .15s; }
.button { width: fit-content; padding: 7px 14px; font-size: 14px; line-height: 1.45; white-space: nowrap; }
.icon-button { width: 32px; min-height: 32px; padding: 3px; color: var(--muted); }
.primary { background: var(--teal); color: white; }
.primary:hover { background: var(--deep); }
.secondary, .icon-button { border-color: #cbdad3; background: white; color: var(--deep); }
.secondary:hover, .icon-button:hover { background: var(--wash); }
.picker { position: relative; cursor: pointer; }
.search-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(332px, .9fr); gap: clamp(18px, 2.6vw, 38px); }
.query-file-row { position: relative; }
.query-drop {
  min-height: 138px; height: 100%; display: grid; place-content: center; justify-items: center;
  gap: 10px; padding: 18px; text-align: center; background: #f5faf7; border: 1px dashed #8bb5a4; border-radius: 10px;
}
.query-drop:hover, .query-drop.dragging, .query-drop.selected { background: #eaf5ee; border-color: var(--teal); }
.query-drop.selected { padding-inline: 38px; border-style: solid; }
.drop-icon { width: 44px; height: 44px; background: white; border: 1px solid #cfe2d7; }
.drop-icon .icon { width: 21px; height: 21px; }
.pick-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pick-copy strong { color: var(--deep); overflow-wrap: anywhere; font-size: 15px; }
.clear-file { position: absolute; z-index: 2; right: 8px; top: 8px; }
.search-settings { display: grid; gap: 13px; align-content: center; }
.search-limits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.option-group { display: grid; gap: 5px; }
.option-group > label, .option-group legend { font-size: 13px; font-weight: 600; color: #465a57; }
.option-group legend { margin-bottom: 5px; }
.stepper, .similarity-input, .segment { display: flex; align-items: center; min-height: 39px; border-radius: 7px; }
.stepper, .similarity-input { border: 1px solid #cbd6d1; }
.stepper button { width: 36px; min-height: 37px; flex-shrink: 0; color: var(--teal); }
.stepper button:hover { background: var(--wash); }
.stepper input, .similarity-input input { flex: 1; width: 100%; min-width: 0; border: 0; background: transparent; appearance: textfield; }
.stepper input { text-align: center; font: 600 14px var(--mono); }
.stepper input::-webkit-inner-spin-button, .similarity-input input::-webkit-inner-spin-button { appearance: none; }
.similarity-input input { padding: 6px 10px; font-size: 14px; }
.similarity-input:focus-within { outline: 3px solid #3486a3; outline-offset: 2px; }
.similarity-input input:focus-visible { outline: none; }
.similarity-input > span { padding-right: 10px; color: var(--muted); font: 13px var(--mono); }
.segment { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 3px; background: #eef3f0; gap: 3px; }
.segment label { position: relative; cursor: pointer; }
.segment span { display: block; padding: 6px 4px; text-align: center; font-size: 14px; line-height: 21px; border-radius: 5px; color: var(--muted); }
.segment input:checked + span { background: white; color: var(--teal); font-weight: 650; box-shadow: 0 1px 3px #234d3826; }
.search-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.mirror-control { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #465a57; cursor: pointer; }
.switch { position: relative; display: flex; align-items: center; }
.switch span { width: 34px; padding: 3px; background: #a7b6af; border-radius: 12px; }
.switch span::before { content: ""; display: block; width: 14px; height: 14px; background: white; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::before { transform: translateX(14px); }
#search-submit { min-width: 130px; min-height: 41px; }
#search-submit[aria-busy=true] .icon { display: none; }
.spinner {
  width: 16px; height: 16px; flex: 0 0 auto; border: 2px solid #ffffff60; border-top-color: white;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.import-pickers { display: flex; align-items: end; gap: 10px; }
.import-picker { flex: 1; min-height: 91px; display: grid; place-content: center; justify-items: center; column-gap: 7px; grid-template-columns: auto auto; border: 1px solid var(--line); border-radius: 8px; background: #fafbf9; }
.import-picker:hover { background: #f0f5ef; border-color: #9ab49f; }
.import-picker .icon { width: 20px; height: 20px; color: #507268; }
.import-picker small { grid-column: span 2; padding-top: 4px; }
.queue-line { flex-wrap: wrap; gap: 8px; min-height: 74px; color: var(--muted); font-size: 13px; }
.queue-line .text-action { margin-left: auto; }
.queue-details { margin-bottom: 10px; }
.file-list, .receipt-list { max-height: 270px; overflow: auto; list-style: none; padding: 0; }
.file-list li, .receipt-list li { padding: 6px 0; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
.entry-actions { position: relative; flex-wrap: wrap; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.entry-actions > :first-child { display: contents; }
.options-toggle { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); padding: 6px 0; font-size: 13px; }
.options-toggle .icon { width: 15px; height: 15px; }
.options-toggle[aria-expanded=true] .icon:last-child { transform: rotate(180deg); }
.options-panel { order: 1; flex: 1 0 100%; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: #f8faf8; }
.options-panel label, .field-label { display: grid; gap: 5px; color: #435955; font-size: 13px; font-weight: 550; }
.options-panel select, .options-panel input, .filter input, textarea { min-width: 0; width: 100%; padding: 7px 10px; border: 1px solid #c7d4cf; border-radius: 6px; background: white; }
.options-panel select { max-width: 240px; }
.options-panel fieldset { margin-top: 10px; }
.options-panel legend { color: var(--muted); font-size: 12px; }
.region-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 5px; }
.region-grid label { font: 12px/1.5 var(--mono); }
.notice { margin-top: 12px; padding: 8px 12px; border-left: 3px solid #77ad96; background: #eff7f2; color: #335a4c; font-size: 13px; overflow-wrap: anywhere; }
.notice.error { background: #fff4ef; color: var(--error); border-color: #c87352; }
.report-card, .results-section { margin-top: 25px; }
.section-head, .dialog-head { justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.section-icon { color: var(--teal); width: 20px; height: 20px; }
.empty-state { padding: 32px 16px; min-height: 155px; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-state p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.empty-state .button { margin-top: 12px; }
.empty-symbol { margin-bottom: 9px; width: 37px; height: 37px; background: white; border: 1px solid #ccded4; }
.drafting { border-radius: inherit; background-color: #fbfcfa; background-image: radial-gradient(#acbeb560 .8px, transparent .9px); background-size: 13px 13px; }
.receipt-list { margin-top: 8px; }
.receipt-list li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.page-heading { margin: 6px 0 24px; flex-wrap: wrap; }
.page-heading p { color: var(--muted); }
.collection { padding: clamp(16px, 2vw, 28px); }
.collection-tools { justify-content: flex-start; flex-wrap: wrap; padding-bottom: 16px; }
.collection-tools h2 { margin-right: auto; }
.filter { display: flex; gap: 8px; align-items: center; }
.filter { border: 1px solid var(--line); border-radius: 7px; padding-left: 9px; color: var(--muted); }
.filter input { border: 0; background: none; }
.pager { justify-content: flex-end; flex-wrap: wrap; margin-top: 15px; color: var(--muted); }
@media (max-width: 960px) { .topbar-inner, .shell { padding-inline: 22px; } }
@media (max-width: 780px) {
  .main-nav { gap: 0; } .topbar-inner { gap: 16px; } .main-nav a { padding-inline: 8px; }
  .queue-line { min-height: 44px; }
  .search-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 600px) {
  .topbar-inner, .shell { padding-inline: 14px; } .shell { padding-top: 15px; }
  .topbar-inner { flex-wrap: wrap; gap: 0; padding-top: 9px; } .brand { font-size: 18px; } .brand img { width: 29px; height: 29px; }
  .main-nav { order: 1; width: 100%; justify-content: space-between; margin-top: 6px; } .main-nav a { min-height: 40px; font-size: 13px; }
  h1 { font-size: 27px; } h2 { font-size: 18px; } .entry-card { padding: 16px; }
  .query-drop { min-height: 128px; }
  .card-heading { margin-bottom: 13px; } .region-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter { flex: 1; min-width: 0; } .collection-tools h2 { flex-basis: 100%; }
}
@media (max-width: 370px) { .main-nav .icon { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before { scroll-behavior: auto !important; transition: none !important; }
  .spinner { animation: none; }
}
