:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #68777c;
  --paper: #f5f2ea;
  --card: #fffdf8;
  --line: #d8d6ce;
  --green: #145a4a;
  --green-soft: #dcebe5;
  --amber: #ad681f;
  --red: #9a4037;
  --shadow: 0 18px 45px rgb(23 33 38 / 8%);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button, .file-button { border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); padding: .65rem .85rem; cursor: pointer; }
button:hover, .file-button:hover { border-color: var(--green); }
button:focus-visible, .file-button:focus-within, summary:focus-visible, a:focus-visible { outline: 3px solid #8fc9b8; outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .5; }
button.primary { color: white; background: var(--green); border-color: var(--green); }
.hero { min-height: 270px; padding: 3.5rem max(5vw, 1.25rem) 2.75rem; display: flex; align-items: end; justify-content: space-between; gap: 2rem; color: white; background: radial-gradient(circle at 82% 16%, #387a69 0, transparent 26%), linear-gradient(125deg, #102b2a, #174e42 70%, #183a37); }
.hero h1 { margin: .15rem 0 .45rem; font: 700 clamp(2.7rem, 6vw, 5.6rem)/.95 Georgia, serif; letter-spacing: -.04em; }
.lead { max-width: 720px; margin: 0; color: #d9e7e2; font-size: 1.1rem; }
.eyebrow { margin: 0; color: #8da29f; font-size: .73rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.hero .eyebrow { color: #a9ccc1; }
.hero__stamp { display: flex; min-width: 260px; align-items: center; gap: .75rem; padding: 1rem 1.2rem; border: 1px solid rgb(255 255 255 / 20%); background: rgb(0 0 0 / 12%); backdrop-filter: blur(8px); }
.hero__stamp small, .hero__stamp strong { display: block; }
.hero__stamp small { color: #bbd2cb; }
.hero__stamp span:last-child { display: block; color: #bbd2cb; font-size: .78rem; }
.health-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 6px rgb(255 255 255 / 9%); }
.health-dot.healthy { background: #7ed7b9; }
.health-dot.unhealthy { background: #ff8b7c; }
main { width: min(1500px, 94vw); margin: -1.2rem auto 4rem; position: relative; }
[hidden] { display: none !important; }
.access-shell { display: grid; min-height: 340px; place-items: start center; }
.access-card { width: min(480px, 100%); padding: 1.6rem; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.access-card h2 { margin: .2rem 0 .6rem; font: 700 1.9rem/1.15 Georgia, serif; }
.access-card form { display: flex; align-items: end; gap: .65rem; margin-top: 1.2rem; }
.access-card form label { flex: 1; margin: 0; }
.access-status { min-height: 1.5em; margin: 1rem 0 0; color: var(--muted); }
.access-error { min-height: 1.5em; margin-bottom: 0; color: var(--red); font-weight: 650; }
.session-actions { display: flex; justify-content: end; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: .7rem; }
.notice { margin-bottom: 1rem; padding: .9rem 1.15rem; border-left: 4px solid var(--amber); background: #fff4dd; box-shadow: var(--shadow); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.metrics article, .panel { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.metrics article { padding: 1.15rem 1.25rem; }
.metrics span, .muted { color: var(--muted); }
.metrics strong { display: block; margin-top: .15rem; font: 700 2rem/1 Georgia, serif; }
.panel { padding: 1.35rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.section-heading h2 { margin: .1rem 0 0; font: 700 1.65rem/1.1 Georgia, serif; }
.platform-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: .65rem; }
.platform { min-height: 95px; padding: .8rem; border: 1px solid var(--line); border-radius: 10px; }
.platform strong, .platform small { display: block; }
.platform small { margin-top: .25rem; color: var(--muted); }
.pill { display: inline-block; margin-top: .55rem; padding: .15rem .45rem; border-radius: 99px; background: #eeeae0; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pill.live { background: var(--green-soft); color: var(--green); }
.pill.healthy, .pill.new { background: var(--green-soft); color: var(--green); }
.pill.stale, .pill.partial { background: #fff0d3; color: var(--amber); }
.pill.error { background: #f9dfdb; color: var(--red); }
.platform.health-error { border-color: #d99c94; }
.platform.health-partial, .platform.health-stale { border-color: #dab77c; }
.workspace { display: grid; grid-template-columns: minmax(290px, 370px) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; align-items: start; }
.rules-panel {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}
.rules-panel:focus-visible { outline: 2px solid #a8cfc3; outline-offset: 2px; }
details > summary { cursor: pointer; font-weight: 750; }
#rule-editor { margin-bottom: .5rem; padding: .7rem; border: 1px solid var(--line); border-radius: 8px; }
#rule-editor[open] > summary { margin-bottom: .8rem; }
form label { display: block; margin-bottom: .75rem; font-weight: 650; }
form label span { color: var(--muted); font-size: .78rem; font-weight: 400; }
input, textarea, select { width: 100%; margin-top: .25rem; padding: .65rem .7rem; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; }
input:focus, textarea:focus, select:focus { outline: 2px solid #a8cfc3; border-color: var(--green); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.actions, .rule-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.rule-tools { margin: 1rem 0; padding-top: 1rem; border-top: 1px solid var(--line); }
.file-button input { display: none; }
.rule { margin-top: .6rem; padding: .75rem; border: 1px solid var(--line); border-radius: 8px; }
.rule__top { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.rule p { margin: .3rem 0 0; color: var(--muted); font-size: .82rem; }
.rule.disabled { opacity: .6; background: #f1eee7; }
.rule-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .25rem; }
.rule-actions button { padding: .2rem .4rem; font-size: .72rem; }
.rule-actions button:last-child { color: var(--red); }
.chips, .bulk-actions, .view-controls { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; margin-bottom: .75rem; }
.chips button { padding: .38rem .7rem; border-radius: 99px; }
.chips button[aria-pressed="true"] { color: white; background: var(--green); border-color: var(--green); }
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(4, minmax(130px, 1fr)); gap: .6rem; margin-bottom: .75rem; }
.filters input, .filters select { margin: 0; }
.view-controls label { min-width: 145px; margin: 0; color: var(--muted); font-size: .78rem; }
.view-controls select { margin-top: .15rem; }
.segmented { display: flex; }
.segmented button { border-radius: 0; }
.segmented button:first-child { border-radius: 8px 0 0 8px; }
.segmented button:last-child { border-radius: 0 8px 8px 0; }
.segmented button[aria-pressed="true"], .lot-actions button.active { color: white; background: var(--green); border-color: var(--green); }
.inactive-toggle { display: flex; grid-column: 1 / -1; align-items: center; gap: .45rem; white-space: nowrap; color: var(--muted); }
.inactive-toggle input { width: auto; }
.lot-list { display: grid; gap: .7rem; }
.lot { position: relative; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 10px; background: white; }
.lot.candidate { border-left: 5px solid var(--green); }
.lot.favourite { box-shadow: inset 0 0 0 2px #e4b85e; }
.lot.inactive { opacity: .68; background: #f1eee7; }
.inactive-reason { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .65rem; margin-top: .65rem; color: var(--muted); }
.inactive-reason small { font-size: .78rem; }
.inactive-reason__label { margin-top: 0; background: #e7e1d5; color: #594f40; }
.lot__select { position: absolute; top: .8rem; right: .8rem; display: flex; align-items: center; gap: .4rem; }
.lot__select input { width: auto; margin: 0; }
.lot__meta, .lot__facts { display: flex; flex-wrap: wrap; gap: .45rem .85rem; color: var(--muted); font-size: .82rem; }
.lot__meta { padding-right: 5.5rem; }
.lot h3 { margin: .5rem 0 .35rem; font: 700 1.15rem/1.3 Georgia, serif; }
.lot p { margin: 0 0 .65rem; }
.description { margin: .35rem 0 .7rem; }
.description summary { color: var(--green); font-size: .85rem; }
.description p { margin-top: .4rem; }
.compact .description:not([open]) + .lot__facts { margin-top: .5rem; }
.match-explanation { margin-top: .6rem; padding: .5rem .65rem; border-radius: 7px; background: var(--green-soft); }
.match-explanation summary { color: var(--green); font-size: .85rem; }
.match-explanation ul { margin: .45rem 0 0; padding-left: 1.2rem; }
.lot-note { display: none; margin-top: .7rem; resize: vertical; }
.detailed .lot-note { display: block; }
.compact .lot__facts span:nth-child(n+5) { display: none; }
.lot-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .65rem; }
.lot-actions button { padding: .3rem .55rem; font-size: .78rem; }
mark { padding: 0 .08em; background: #ffe39a; color: inherit; }
.lot__footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .65rem; padding-top: .65rem; border-top: 1px solid #ece9e1; }
.lot__price { font-weight: 800; font-size: 1.05rem; }
.lot a { color: var(--green); font-weight: 750; }
.candidate-mark { color: var(--green); font-weight: 800; }
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.empty { padding: 3rem 1rem; text-align: center; border: 1px dashed var(--line); color: var(--muted); }
.empty strong, .empty span { display: block; }
.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: 1270px) and (min-width: 701px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1050px) {
  .platform-grid { grid-template-columns: repeat(4, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .rules-panel {
    position: static;
    max-height: none;
    overflow-y: visible;
    overscroll-behavior-y: auto;
    scrollbar-gutter: auto;
  }
}
@media (max-width: 700px) { .hero { align-items: start; flex-direction: column; padding-top: 2.3rem; } .hero__stamp { width: 100%; } .metrics { grid-template-columns: 1fr 1fr; } .platform-grid { grid-template-columns: 1fr 1fr; } .filters { grid-template-columns: 1fr; } .two-col { grid-template-columns: 1fr; } .lot__footer { align-items: start; flex-direction: column; } .session-actions { justify-content: stretch; } .session-actions button { flex: 1; } }
@media (max-width: 430px) { main { width: 96vw; } .metrics { gap: .5rem; } .metrics article, .panel { padding: .9rem; } .platform-grid { grid-template-columns: 1fr; } }
