:root {
  --ink: #1f292d;
  --muted: #657176;
  --canvas: #f3f6f5;
  --surface: #ffffff;
  --line: #d8e0dd;
  --teal: #0f766e;
  --teal-soft: #e6f4f1;
  --red: #b42318;
  --red-soft: #fcebea;
  --amber: #8a5b08;
  --amber-soft: #fff5d8;
  --charcoal: #182125;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(23, 34, 39, 0.06);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; background: var(--canvas); line-height: 1.5; }
a { color: inherit; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }

.topbar {
  min-height: 60px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: var(--charcoal);
  color: #f7faf9;
  border-bottom: 3px solid var(--teal);
}

.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand-mark { padding: 3px 6px; color: #d7fff8; border: 1px solid #528c85; border-radius: 3px; font: 700 11px Consolas, monospace; }
.nav { display: flex; align-self: stretch; }
.nav a { display: flex; align-items: center; padding: 0 17px; color: #bfc9c6; text-decoration: none; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a:focus-visible { color: #fff; }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: #65c5b8; }

.page-shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: 0; }
.page-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font: 700 11px Consolas, monospace; text-transform: uppercase; letter-spacing: 0; }
.schedule-chip, .result-count { padding: 5px 9px; color: #315b56; background: var(--teal-soft); border: 1px solid #b8dcd6; border-radius: 4px; font-size: 13px; }

.attention { margin-bottom: 22px; padding: 15px 17px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-left: 4px solid; box-shadow: var(--shadow); }
.attention strong { display: block; margin-bottom: 2px; }
.attention p { margin: 0; font-size: 14px; }
.attention a { font-weight: 700; white-space: nowrap; }
.attention-danger { color: #751a14; background: var(--red-soft); border-color: var(--red); }
.attention-warning { color: #654204; background: var(--amber-soft); border-color: #c7880a; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric { min-height: 112px; padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric span, .metric small { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: inline-block; margin: 8px 4px 4px 0; font: 700 30px Consolas, "Microsoft YaHei UI", sans-serif; }
.metric .metric-time { font-size: 18px; }
.text-danger { color: var(--red); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 28px; margin-bottom: 30px; }
.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 30px; }
.workspace-section, .data-section { min-width: 0; padding-top: 18px; border-top: 2px solid var(--ink); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
.text-link, .back-link { color: var(--teal); font-size: 14px; font-weight: 650; }

.cookie-form label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 650; }
.publicity-section { margin-bottom: 30px; }
.publicity-form { display: grid; gap: 14px; max-width: 960px; }
.publicity-form label { display: grid; gap: 7px; font-size: 13px; }
.publicity-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(70px, 1fr) minmax(0, 2fr); gap: 12px; }
.publicity-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.publicity-form .publicity-checkbox { display: flex; gap: 7px; align-items: center; }
.publicity-checkbox input { width: 18px; min-height: 18px; height: 18px; }
.publicity-category-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.publicity-category-filter select { width: auto; min-width: 160px; max-width: 100%; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.item-card { min-width: 0; padding: 16px; border: 1px solid #ccd7d2; border-radius: 6px; background: white; }
.item-card-heading { display: flex; gap: 10px; align-items: center; }
.item-card-heading img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }
.item-card-heading div { min-width: 0; flex: 1; }
.item-card h3 { margin: 0 0 5px; font-size: 15px; overflow-wrap: anywhere; }
.item-card-heading span { color: var(--muted); font-size: 12px; }
.item-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.item-card-heading .item-ordered-badge { color: #fff; background: #c2410c; border: 1px solid #9a3412; border-radius: 3px; padding: 2px 6px; font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.item-state.item-state-ordered { color: #9a3412; background: #ffedd5; font-weight: 700; border: 1px solid #fdba74; }
.item-card-heading strong { color: var(--red); font-size: 17px; overflow-wrap: anywhere; max-width: 35%; }
.item-card p { font-size: 13px; min-height: 36px; overflow-wrap: anywhere; }
.item-card dl { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 7px; font-size: 12px; }
.item-card dt { color: var(--muted); }
.item-card dd { margin: 0; overflow-wrap: anywhere; }
.item-card-links { display: flex; justify-content: flex-end; gap: 16px; margin-top: 16px; font-size: 13px; }
.item-pagination { margin-top: 20px; justify-content: center; }
.item-list-controls { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0 8px; font-size: 13px; color: var(--muted); }
.item-list-controls label { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--ink); }
.item-list-controls input { width: 18px; height: 18px; min-height: 18px; padding: 0; margin: 0; }
.item-lazy-footer { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 64px; font-size: 13px; color: var(--muted); }
.item-load-more { min-width: 100px; }
[data-item-pagination][hidden], [data-item-lazy-sentinel][hidden], [data-item-lazy-controls][hidden], [data-item-load-more][hidden] { display: none; }
.listing-remaining { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.item-sale-tabs { display: flex; gap: 20px; border-bottom: 1px solid #ccd7d2; margin-bottom: 16px; }
.item-sale-tabs a { padding: 10px 4px; text-decoration: none; border-bottom: 2px solid transparent; }
.item-sale-tabs a[aria-current="page"] { color: var(--teal); border-bottom-color: var(--teal); font-weight: 700; }
.status-check-controls { margin-bottom: 16px; }
.item-card-tools { display: flex; align-items: center; justify-content: flex-end; gap: 12px; font-size: 12px; margin-top: 12px; }
.item-card-tools .item-status-button { min-height: 30px; padding: 4px 7px; font-size: 12px; }
.item-card-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.item-card-links a { text-align: center; padding: 6px 3px; border: 1px solid #ccd7d2; border-radius: 4px; font-size: 12px; text-decoration: none; }
@media (max-width: 600px) { .publicity-fields { grid-template-columns: minmax(0, 1fr); } }
.input-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
input, select { width: 100%; min-height: 40px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #b8c3bf; border-radius: 4px; outline: none; }
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
button, .button-primary { min-height: 40px; padding: 8px 14px; color: #fff; background: var(--teal); border: 1px solid var(--teal); border-radius: 4px; font-weight: 700; text-decoration: none; }
button:hover, .button-primary:hover { background: #0b625c; }
button:focus-visible, .button-primary:focus-visible, a:focus-visible { outline: 3px solid rgba(15, 118, 110, .28); outline-offset: 2px; }
button:disabled { opacity: .55; cursor: wait; }

.status-dot { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 13px; font-weight: 700; }
.status-dot::before { width: 7px; height: 7px; flex: 0 0 7px; content: ""; border-radius: 50%; background: currentColor; }
.scheduler-control { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; }
.scheduler-control form { margin: 0; }
.scheduler-note { min-height: 0; margin: 0; white-space: nowrap; }
.status-ready { color: var(--teal); }
.status-danger { color: var(--red); }
.status-pending { color: var(--amber); }
.status-muted { color: var(--muted); }
.run-control { display: flex; align-items: center; gap: 12px; min-height: 43px; }
.htmx-indicator { display: none; color: var(--muted); font-size: 13px; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
.run-result { min-height: 28px; margin-top: 11px; }
.status-line { min-height: 20px; margin: -4px 0 13px; color: var(--muted); font: 12px Consolas, "Microsoft YaHei UI", sans-serif; }
.status-line.status-error { color: #8a211b; }
.job-metrics { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; }
.job-metrics span { padding: 3px 6px; color: #44545a; background: #eef2f1; border: 1px solid #d7e0dd; border-radius: 3px; font: 11px Consolas, "Microsoft YaHei UI", sans-serif; white-space: nowrap; }
.result-message { padding: 9px 11px; border-left: 3px solid; font-size: 13px; }
.result-success { color: #255f58; background: var(--teal-soft); border-color: var(--teal); }
.result-warning { color: #654204; background: var(--amber-soft); border-color: var(--amber); }
.result-error { color: #751a14; background: var(--red-soft); border-color: var(--red); }

.overview-filters {
  display: grid;
  grid-template-columns: 1.5fr 1fr .85fr .62fr .62fr 1fr auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 22px;
  padding: 14px;
  background: #e8eeec;
  border: 1px solid #cfdbd7;
}
.overview-filters > label > span { display: block; margin-bottom: 4px; color: #556267; font-size: 12px; font-weight: 650; }
.scope-tabs { grid-column: 1 / -1; display: flex; gap: 5px; }
.scope-tabs label { position: relative; }
.scope-tabs input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.scope-tabs span { display: inline-flex; min-height: 34px; align-items: center; padding: 6px 12px; color: #4d5a5f; background: #fff; border: 1px solid #bdc9c5; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 650; }
.scope-tabs input:checked + span { color: #fff; background: var(--teal); border-color: var(--teal); }
.scope-tabs input:focus-visible + span { outline: 3px solid rgba(15, 118, 110, .25); outline-offset: 2px; }
.filter-reset { min-height: 40px; display: inline-flex; align-items: center; padding: 8px 4px; color: #526064; font-size: 13px; font-weight: 650; }
.overview-results { min-width: 0; }
.listing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.listing-card { min-width: 0; min-height: 298px; display: flex; flex-direction: column; padding: 16px 17px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.listing-card[data-source="sold"] { border-top: 3px solid #28758f; }
.listing-card:hover { border-color: #9db8b2; box-shadow: 0 3px 10px rgba(23, 34, 39, .08); }
.listing-card-head { min-height: 44px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.listing-title-line { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.listing-title { max-width: 100%; color: var(--ink); font-size: 16px; font-weight: 750; text-decoration: none; overflow-wrap: anywhere; }
.listing-title:hover { color: var(--teal); text-decoration: underline; }
.level-badge { color: #89600b; font: 700 11px Consolas, monospace; }
.school-badge { padding: 2px 5px; color: #606b6e; background: #eef1f0; border-radius: 3px; font-size: 11px; }
.listing-price-stack { flex: 0 0 auto; display: grid; justify-items: end; gap: 3px; text-align: right; }
.listing-price { color: #b33c30; font: 750 14px Consolas, "Microsoft YaHei UI", sans-serif; white-space: nowrap; }
.listing-price-pending { color: var(--amber); }
.listing-secondary-price { color: #68767a; font: 11px Consolas, "Microsoft YaHei UI", sans-serif; white-space: nowrap; }
.listing-facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 8px 16px; margin: 13px 0 0; padding: 12px 0; border-top: 1px solid #e2e8e6; border-bottom: 1px solid #e2e8e6; }
.listing-facts div { min-width: 0; }
.listing-facts dt { color: var(--muted); font-size: 11px; }
.listing-facts dd { margin: 2px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.listing-summary { min-height: 39px; margin: 11px 0 8px; color: #3f4c51; font-size: 12px; line-height: 1.55; }
.history-match { align-self: flex-start; margin: 10px 0 0; padding: 3px 6px; color: #17645e; background: var(--teal-soft); border: 1px solid #b8dcd6; border-radius: 3px; font-size: 11px; font-weight: 700; }
.history-unmatched { color: #885807; background: var(--amber-soft); border-color: #efd89e; }
.listing-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.listing-tags span { padding: 2px 6px; color: #715315; background: #fff7df; border: 1px solid #f0dfad; border-radius: 3px; font-size: 11px; }
.listing-actions { min-height: 50px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: auto; padding: 9px 0; border-top: 1px solid #e2e8e6; }
.listing-actions a { padding: 6px 9px; color: #4f5d61; background: #f1f4f3; border: 1px solid #dce3e1; border-radius: 4px; font-size: 12px; font-weight: 650; text-decoration: none; }
.listing-actions a:hover { color: var(--teal); border-color: #a9c9c3; }
.listing-actions .official-action { color: #fff; background: var(--teal); border-color: var(--teal); }
.listing-actions .official-action:hover { color: #fff; background: #0b625c; }
.empty-overview { grid-column: 1 / -1; min-height: 180px; display: grid; place-items: center; color: var(--muted); background: #fff; border: 1px solid var(--line); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; }
.pagination button { min-height: 34px; padding: 5px 11px; }
.pagination span { color: var(--muted); font: 12px Consolas, monospace; }

.filter-bar { display: grid; grid-template-columns: 1fr 1.2fr 1fr .8fr .8fr auto; gap: 10px; align-items: end; margin-bottom: 24px; padding: 14px; background: #e8eeec; border: 1px solid #cfdbd7; }
.filter-bar.compact { grid-template-columns: 220px auto; justify-content: start; }
.run-filters { grid-template-columns: repeat(2, minmax(180px, 240px)) auto !important; }
.filter-bar label span { display: block; margin-bottom: 4px; color: #556267; font-size: 12px; font-weight: 650; }
.filter-bar button { min-width: 76px; }
.table-meta { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.table-wrap { width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 10px 12px; color: #536066; background: #edf2f0; border-bottom: 1px solid #cbd6d2; text-align: left; font-size: 11px; text-transform: uppercase; white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #e1e7e5; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7faf9; }
td small { display: block; margin-top: 2px; color: var(--muted); }
.role-link { color: #145e58; font-weight: 700; text-decoration: none; }
.role-link:hover { text-decoration: underline; }
.price { color: #9b3128; font: 700 14px Consolas, monospace; white-space: nowrap; }
.actions a { color: var(--teal); font-weight: 650; white-space: nowrap; }
.error-cell { max-width: 320px; color: var(--red); overflow-wrap: anywhere; }
.empty-state { height: 110px; color: var(--muted); text-align: center; }

.detail-heading { align-items: center; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.back-link { display: inline-block; margin-bottom: 10px; }
.identity { margin: 8px 0 0; color: var(--muted); font: 12px Consolas, monospace; overflow-wrap: anywhere; }
.detail-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 30px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--surface); }
.detail-facts div { min-height: 88px; padding: 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-facts span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.detail-facts strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.attribute-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--surface); }
.attribute-grid div { min-width: 0; padding: 11px 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.attribute-grid dt { margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.attribute-grid dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; }
.raw-json { margin-top: 22px; background: var(--surface); border: 1px solid var(--line); }
.raw-json summary { padding: 12px 14px; cursor: pointer; font-weight: 650; }
.raw-json pre { max-height: 520px; margin: 0; padding: 15px; overflow: auto; color: #d9e4df; background: #202a2e; font: 12px/1.55 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.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; }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr; gap: 22px; }
  .filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filter-search { grid-column: span 2; }
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-facts, .attribute-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .topbar { padding: 0 16px; align-items: stretch; flex-direction: column; gap: 0; }
  .brand { min-height: 52px; }
  .nav { height: 42px; overflow-x: auto; }
  .nav a { padding: 0 14px; }
  .page-shell { width: min(100% - 28px, 1440px); padding-top: 22px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 24px; }
  .page-heading-actions { justify-content: flex-start; }
  .attention { align-items: flex-start; flex-direction: column; gap: 10px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 100px; padding: 14px; }
  .metric strong { font-size: 25px; }
  .metric .metric-time { font-size: 14px; }
  .input-action { grid-template-columns: 1fr; }
  .filter-bar, .filter-bar.compact, .run-filters { grid-template-columns: 1fr 1fr !important; }
  .overview-filters { grid-template-columns: 1fr 1fr; }
  .filter-search, .filter-area, .filter-order { grid-column: 1 / -1; }
  .listing-grid { grid-template-columns: 1fr; }
  .listing-card { min-height: 0; }
  .listing-card-head { min-height: 0; }
  .listing-price-stack { align-items: end; }
  .listing-facts { grid-template-columns: 1fr; }
  .filter-bar button { width: 100%; }
  .detail-heading { align-items: flex-start; flex-direction: column; }
  .detail-actions { justify-content: flex-start; }
  .detail-facts, .attribute-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  table, thead, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  tbody { display: grid; gap: 8px; }
  tbody tr { padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  td { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid #e4e9e7; text-align: right; overflow-wrap: anywhere; }
  td::before { content: attr(data-label); color: var(--muted); text-align: left; font-size: 12px; }
  td:last-child { border-bottom: 0; }
  td small { text-align: right; }
  td.actions, td.empty-state { display: block; text-align: center; }
  td.actions::before, td.empty-state::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.auto-crawl-metrics { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px 20px; margin: 0 0 24px; }
.auto-crawl-metrics dd { margin: 0; overflow-wrap: anywhere; }
.upstream-error { max-width: 100%; max-height: 360px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; font: 12px/1.6 Consolas, monospace; }
.item-search-form { padding: 16px 0; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.item-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
.item-filter-grid > label { min-width: 0; }
.item-filter-grid label > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.item-filter-grid input, .item-filter-grid select { min-width: 0; width: 100%; }
.range-fields { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 6px; }
.attribute-filter > div { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(55px, 1fr); gap: 5px; }
.item-attribute-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.item-attribute-tags span, .item-subtype { padding: 2px 5px; background: #eff4f5; border: 1px solid #d7e1e4; border-radius: 3px; font-size: 11px; }
.item-attribute-tags .main-attribute { color: #684c0a; background: #fff8e4; border-color: #e8d9aa; }
.item-attribute-tags .vice-attribute { color: #215a69; }
.item-price-drop { color: #0b756d; font-size: 12px; font-weight: 700; }
.item-highlight-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.item-highlight-tags span { color: #215a69; border: 1px solid #b9d8df; background: #edf7fa; padding: 2px 5px; border-radius: 3px; font-size: 12px; }
.history-button { align-self: flex-start; padding: 5px 9px; min-height: 32px; font-size: 12px; margin-bottom: 8px; }
#item-history-dialog { width: min(850px, calc(100% - 28px)); max-height: calc(100% - 40px); overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; }
#item-history-dialog::backdrop { background: rgb(0 0 0 / 38%); }
.dialog-close { display: flex; justify-content: flex-end; }
.dialog-close button { font-size: 24px; width: 36px; height: 36px; min-height: 36px; padding: 0; color: var(--muted); background: transparent; border-color: transparent; }
@media (max-width: 980px) { .item-filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 540px) { .item-filter-grid { grid-template-columns: 1fr; } #item-history-dialog { padding: 16px; } .error-cell { max-width: 100%; } }

.book-price-dates { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 16px; }
.book-price-dates label { font-size: 12px; color: var(--muted); }
.book-price-layout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 20px; }
.book-price-layout aside { min-width: 0; border-right: 1px solid var(--line); padding-right: 16px; }
.book-price-layout h3 { font-size: 14px; margin: 0 0 10px; }
.book-price-main { min-width: 0; }
.book-price-legend { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px 18px; margin: 10px 0 14px; padding: 0; max-height: 108px; overflow-y: auto; list-style: none; }
.book-price-legend:empty { display: none; }
.book-price-legend li { display: flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; font-size: 12px; overflow-wrap: anywhere; }
.book-price-legend .book-color { width: 18px; }
.book-chart-stage { position: relative; min-width: 0; }
.book-price-tooltip { position: absolute; z-index: 5; width: max-content; max-width: min(360px, calc(100% - 16px)); max-height: calc(100% - 16px); overflow-y: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); box-shadow: 0 4px 16px rgb(20 40 40 / 15%); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.book-price-tooltip[hidden] { display: none; }
.book-tooltip-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.book-tooltip-heading strong { min-width: 0; }
.book-tooltip-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 3px 0; }
.book-tooltip-heading > span { color: var(--muted); }
.book-tooltip-row.is-active { color: var(--teal); font-weight: 700; }
.book-tooltip-row > strong { font-variant-numeric: tabular-nums; }
.book-price-chart { cursor: crosshair; }
.price-chart-point { pointer-events: none; outline: none; }
.price-chart-point:focus, .price-chart-point.is-active { stroke: var(--ink); stroke-width: 2px; }
.book-price-chart { display: block; width: 100%; min-height: 220px; max-height: 360px; }
.book-price-status { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.book-skill-list { display: grid; gap: 10px; margin-top: 12px; max-height: 380px; overflow-y: auto; }
.book-skill-list label { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.book-skill-list label[hidden] { display: none; }
.book-skill-list input { width: 16px; height: 16px; }
.book-color { width: 12px; height: 4px; flex: 0 0 auto; }
.book-price-minimums { overflow-x: auto; }
.material-statistics { padding-top: 20px; border-top: 2px solid var(--ink); }
.material-statistics-filters label { min-width: 120px; }
.material-statistics-filters select { width: 100%; }
.material-series-heading { margin: 0 0 12px; font-size: 15px; }
.series-selection { display: flex; gap: 14px; margin-top: 10px; }
.series-selection button { color: var(--teal); background: transparent; border: 0; padding: 0; min-height: 28px; font-size: 12px; }
.material-statistics .book-skill-list label { align-items: center; min-height: 28px; overflow-wrap: anywhere; }
.material-statistics .book-skill-list input { flex: 0 0 16px; min-height: 16px; padding: 0; margin: 0; }
.material-statistics .book-price-chart { height: 340px; max-height: none; }
.material-statistics .book-price-layout { grid-template-columns: 250px minmax(0,1fr); }
@media (max-width: 680px) {
  .material-statistics .book-price-layout { grid-template-columns: 1fr; }
  .material-statistics-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .material-statistics-filters label { min-width: 0; }
  .material-statistics-filters input { width: 100%; min-width: 0; }
  .material-statistics .book-price-chart { height: 260px; }
}
@media (max-width: 680px) { .book-price-layout { grid-template-columns: 1fr; } .book-price-layout aside { border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 12px; } .book-skill-list { grid-template-columns: repeat(2,minmax(0,1fr)); max-height: 140px; } }
