:root {
  color-scheme: light;
  font-family: Inter, Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18211e;
  background: #ecefe9;
  font-synthesis: none;
  --ink: #18211e;
  --muted: #66716b;
  --line: #d6ddd7;
  --line-strong: #bbc7be;
  --paper: #fbfcf8;
  --canvas: #eef1ec;
  --green: #1b6847;
  --green-dark: #102f24;
  --green-soft: #e3efe7;
  --cream: #f7f5ec;
  --amber: #b37a19;
  --amber-soft: #f8eed3;
  --red: #a84238;
  --red-soft: #f6dfdc;
  --shadow: 0 5px 18px rgba(16, 47, 36, .07);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid #2f815d;
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.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; }

.app-shell { min-height: 100vh; }
.topbar {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto auto;
  align-items: center;
  gap: 20px;
  padding: 11px 28px;
  color: white;
  background: var(--green-dark);
  border-bottom: 1px solid rgba(255,255,255,.1);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { min-width: 0; display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center;
  border: 1px solid #74aa8e; border-radius: 50%; color: #c5e2d1; font-family: Georgia, serif; font-size: 16px;
}
.brand > div { min-width: 0; display: flex; flex-direction: column; }
.brand strong { overflow: hidden; font-family: Georgia, serif; font-size: 18px; font-weight: 500; letter-spacing: .01em; text-overflow: ellipsis; white-space: nowrap; }
.brand small { margin-top: 2px; color: #aebfb6; font-size: 10px; }
.scope-note { margin: 0; color: #b9c8c1; font-size: 11px; text-align: center; }
.source-pill {
  display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.15); border-radius: 999px; background: rgba(255,255,255,.04);
  color: #c8d4ce; font-size: 10px; white-space: nowrap;
}
.source-pill i { width: 7px; height: 7px; border-radius: 50%; background: #8d9893; box-shadow: 0 0 0 3px rgba(255,255,255,.05); }
.source-pill[data-health="healthy"] i { background: #66cb90; }
.source-pill[data-health="fixture"] i { background: #e5bb5f; }
.source-pill[data-health="refreshing"] i { background: #8fc5df; animation: pulse 1.4s infinite; }
.source-pill[data-health="stale"] i, .source-pill[data-health="never_refreshed"] i { background: #dda24b; }
.source-pill[data-health="error"] i { background: #ef806f; }
.refresh-button {
  min-height: 37px; padding: 9px 14px; border: 0; border-radius: 6px;
  background: #dbeadf; color: #173f2e; font-size: 11px; font-weight: 800;
}
.refresh-button:hover { background: white; }
@keyframes pulse { 50% { opacity: .35; } }

.fixture-banner, .policy-banner, .alert-banner { padding: 10px 28px; border-bottom: 1px solid; font-size: 11px; line-height: 1.45; }
.fixture-banner { border-color: #ddc377; background: #fff2cb; color: #6e521b; }
.policy-banner { border-color: #a9c7b7; background: #e8f2eb; color: #28533e; }
.alert-banner { border-color: #dfa6a0; background: var(--red-soft); color: #843a34; }

main { max-width: 1800px; margin: 0 auto; border-inline: 1px solid var(--line); background: #f8faf6; }
.overview { padding: 28px 28px 22px; border-bottom: 1px solid var(--line); background: var(--paper); }
.overview-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; }
.eyebrow { color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { margin: 5px 0 0; font-size: clamp(25px, 2.6vw, 34px); line-height: 1.16; }
.lead { max-width: 780px; margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.last-refresh { flex: 0 0 270px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; background: white; text-align: right; }
.last-refresh span, .last-refresh small { display: block; color: var(--muted); font-size: 9px; }
.last-refresh strong { display: block; margin: 5px 0 3px; color: var(--green-dark); font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 22px; }
.metric { min-width: 0; min-height: 94px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.metric > span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.metric > strong { display: block; margin-top: 9px; color: var(--ink); font-size: 23px; line-height: 1; }
.metric > small { display: block; margin-top: 8px; overflow: hidden; color: #768079; font-size: 9px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.primary-metric { border-color: #91b8a0; background: linear-gradient(115deg, #e6f3ea, #fbfcf8); box-shadow: 0 0 0 2px rgba(27,104,71,.05); }
.primary-metric > strong { color: var(--green); font-size: 30px; }

.controls {
  display: grid; grid-template-columns: minmax(240px, 1.4fr) minmax(180px, .7fr) minmax(220px, .8fr) auto auto;
  align-items: end; gap: 10px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: #f4f7f2;
}
.controls label { min-width: 0; display: flex; flex-direction: column; gap: 5px; color: #46524c; font-size: 9px; font-weight: 800; }
.controls input[type="search"], .controls select {
  width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid #c5cec7; border-radius: 5px; background: white; color: var(--ink); outline: none;
}
.controls input[type="search"]:focus, .controls select:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(27,104,71,.12); }
.controls .checkbox-field { min-height: 38px; flex-direction: row; align-items: center; gap: 7px; padding: 0 5px; white-space: nowrap; }
.checkbox-field input { width: 15px; height: 15px; accent-color: var(--green); }
.secondary-button { min-height: 38px; padding: 8px 12px; border: 1px solid #bdc9c0; border-radius: 5px; background: white; color: var(--green); font-size: 10px; font-weight: 800; }
.secondary-button:hover { background: var(--green-soft); }

.kanban-wrap { overflow-x: auto; padding: 12px 12px 20px; background: var(--canvas); }
.kanban { min-width: 1180px; display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); align-items: start; gap: 7px; }
.kanban-column { min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: #f6f8f4; }
.kanban-column > header { min-height: 42px; display: flex; justify-content: space-between; align-items: center; padding: 8px 9px; border-bottom: 1px solid var(--line); }
.kanban-column > header > div { display: flex; align-items: center; gap: 7px; }
.kanban-column h2 { margin: 0; font-family: inherit; font-size: 11px; font-weight: 800; }
.kanban-column header b { min-width: 22px; padding: 4px 7px; border-radius: 999px; background: #e3e8e3; color: #4c5852; font-size: 9px; text-align: center; }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; background: #7ca88f; }
.critical-column .stage-dot { background: #d88a33; }
.critical-column > header { background: #fff9e9; }
.muted-column .stage-dot { background: #bd6d62; }
.archive-column .stage-dot { background: #8b9690; }
.card-list { min-height: 140px; display: grid; align-content: start; gap: 6px; padding: 6px; border-radius: 0 0 7px 7px; transition: background .15s ease; }
.card-list.drag-over { background: #dcebe1; box-shadow: inset 0 0 0 2px #5e9875; }
.card-list:empty::after { content: "Нет карточек"; display: grid; place-items: center; min-height: 90px; border: 1px dashed #c4cdc6; border-radius: 5px; color: #89928d; font-size: 9px; }

.lot-card { min-width: 0; padding: 9px; border: 1px solid #cbd4cd; border-radius: 6px; background: white; box-shadow: 0 2px 7px rgba(16,47,36,.04); }
.lot-card[draggable="true"] { cursor: grab; }
.lot-card.dragging { opacity: .45; }
.lot-card.inactive { border-style: dashed; background: #f5f5f1; }
.lot-card.expanded { border-color: #89ad96; box-shadow: 0 4px 14px rgba(16,47,36,.08); }
.card-summary { display: grid; gap: 7px; }
.card-topline { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.region-badge, .confidence-badge, .inactive-badge { display: inline-flex; width: fit-content; padding: 3px 6px; border-radius: 999px; font-size: 7.5px; font-weight: 800; line-height: 1.2; }
.region-badge { max-width: 58%; overflow: hidden; background: var(--green-soft); color: #235f40; text-overflow: ellipsis; white-space: nowrap; }
.confidence-badge { background: #eef0ed; color: #66716b; }
.inactive-badge { background: #ebe7de; color: #766d5c; }
.lot-compact-id { min-width: 0; max-width: 48%; margin-left: auto; overflow: hidden; color: var(--muted); font-size: 7.5px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.price-row { display: flex; justify-content: space-between; align-items: baseline; gap: 7px; }
.card-price { color: var(--green-dark); font-size: 16px; letter-spacing: -.02em; white-space: nowrap; }
.deadline-chip { padding: 3px 5px; border-radius: 4px; background: #eef3ef; color: #4e6257; font-size: 7.5px; font-weight: 800; white-space: nowrap; }
.deadline-chip.urgent { background: var(--red-soft); color: var(--red); }
.deadline-chip.soon { background: var(--amber-soft); color: #805d1b; }
.classification-summary { min-width: 0; padding-top: 6px; border-top: 1px solid #edf0ed; }
.classification-summary > span { display: block; color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.classifier { display: -webkit-box; margin: 3px 0 0; overflow: hidden; color: var(--green); font-size: 8.5px; font-weight: 750; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-details-toggle { width: 100%; min-height: 27px; padding: 5px 8px; border: 1px solid #c4cfc7; border-radius: 4px; background: #f5f8f5; color: var(--green); font-size: 8px; font-weight: 800; }
.card-details-toggle:hover, .card-details-toggle[aria-expanded="true"] { border-color: #9db8a6; background: var(--green-soft); }
.card-details { margin-top: 9px; padding-top: 9px; border-top: 1px solid #dce4de; }
.details-topline { display: flex; justify-content: space-between; align-items: center; gap: 7px; color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.card-title { max-height: 220px; margin: 7px 0 0; overflow: auto; padding: 7px; border: 1px solid #e3e8e4; border-radius: 4px; background: #fafbf8; font-family: inherit; font-size: 9px; font-weight: 500; line-height: 1.48; overflow-wrap: anywhere; }
.card-facts { margin: 8px 0 0; border-block: 1px solid #e4e8e4; }
.card-facts > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 6px; padding: 5px 0; border-top: 1px solid #edf0ed; font-size: 8px; line-height: 1.35; }
.card-facts > div:first-child { border-top: 0; }
.card-facts dt { color: var(--muted); }
.card-facts dd { min-width: 0; margin: 0; color: #2f3934; overflow-wrap: anywhere; }
.evidence-panel { border-bottom: 1px solid #e4e8e4; }
.evidence-panel summary { padding: 7px 0; color: var(--green); font-size: 8px; font-weight: 800; }
.evidence-grid { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 4px 6px; padding: 0 0 8px; font-size: 7.5px; line-height: 1.45; }
.evidence-grid span { color: var(--muted); }
.evidence-grid p { margin: 0; overflow-wrap: anywhere; }
.notes-block { margin-top: 10px; }
.notes-block label { display: flex; flex-direction: column; gap: 5px; color: #46524c; font-size: 8px; font-weight: 800; }
.notes-input { width: 100%; min-height: 58px; resize: vertical; padding: 7px 8px; border: 1px solid #cbd3cd; border-radius: 5px; background: #fbfcfa; color: var(--ink); font-size: 9px; line-height: 1.4; outline: none; }
.notes-input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(27,104,71,.1); }
.notes-block > div { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin-top: 6px; }
.save-state { color: var(--muted); font-size: 8px; }
.save-note { padding: 6px 8px; border: 1px solid #b9c8bd; border-radius: 4px; background: #eff5f1; color: var(--green); font-size: 8px; font-weight: 800; }
.card-actions { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-top: 10px; }
.source-link { padding-top: 6px; color: var(--green); font-size: 9px; font-weight: 800; text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.move-menu { position: relative; }
.move-menu > summary { display: block; padding: 6px 8px; border: 1px solid #c5cec7; border-radius: 4px; background: white; color: #425048; font-size: 8px; font-weight: 800; list-style: none; }
.move-menu > summary::-webkit-details-marker { display: none; }
.stage-buttons { position: absolute; z-index: 5; right: 0; width: 150px; display: grid; gap: 1px; margin-top: 4px; padding: 4px; border: 1px solid #bdc9c0; border-radius: 5px; background: white; box-shadow: var(--shadow); }
.stage-buttons button { padding: 7px 8px; border: 0; border-radius: 3px; background: white; color: var(--ink); font-size: 9px; text-align: left; }
.stage-buttons button:hover { background: var(--green-soft); }
.stage-buttons button:disabled { background: #eef1ee; color: var(--muted); opacity: 1; }
.history-button { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 8px; text-decoration: underline; }
.history-list { margin: 7px 0 0; padding: 7px 7px 7px 22px; border-radius: 4px; background: #f3f5f2; color: #59655f; font-size: 8px; line-height: 1.5; }

footer { max-width: 1800px; display: flex; justify-content: space-between; gap: 30px; margin: 0 auto; padding: 14px 28px; color: #758079; font-size: 8px; line-height: 1.45; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr auto auto; }
  .scope-note { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .controls { grid-template-columns: 1fr 1fr 1fr; }
  .controls .checkbox-field { align-self: center; }
}

@media (max-width: 720px) {
  .topbar { position: static; grid-template-columns: 1fr auto; gap: 9px; padding: 10px 14px; }
  .brand small { display: none; }
  .brand strong { font-size: 16px; }
  .source-pill { grid-column: 1 / -1; justify-self: start; }
  .refresh-button { grid-column: 2; grid-row: 1; }
  .fixture-banner, .policy-banner, .alert-banner { padding-inline: 14px; }
  .overview { padding: 23px 14px 17px; }
  .overview-heading { align-items: flex-start; flex-direction: column; }
  .last-refresh { width: 100%; flex-basis: auto; text-align: left; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 88px; }
  .controls { grid-template-columns: 1fr; padding: 12px 14px; }
  .controls .checkbox-field { min-height: 30px; }
  .kanban-wrap { padding: 10px 8px 18px; scroll-snap-type: x proximity; }
  .kanban { min-width: 1080px; grid-template-columns: repeat(5, minmax(205px, 1fr)); }
  .kanban-column { scroll-snap-align: start; }
  footer { flex-direction: column; gap: 7px; padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
