/* Discover — the nightly event sweep's review screen.

   Most colours here are existing theme-aware custom properties
   (--charcoal-soft, --concrete, --glass-border, --glass-white, --bone, --muted,
   --sand, --amber, --teal, --teal-bright all redefine themselves under
   body.light-theme in index.html's inline stylesheet), so those rules need no
   counterpart.

   HANDOFF rule 6. The convention for flat accents holds for FILLS and BORDERS
   only, not for TEXT: raw --amber reads about 2:1 on a light card and #E05A4A
   about 3.2:1, both under AA. Every flat accent used as text below therefore
   carries a body.light-theme counterpart, reusing the pair established
   everywhere else in this codebase — #9C5C08 for amber, #B03A2E for red.

   Equal-specificity CSS resolves by source order (HANDOFF rule 7), and this file
   loads after the inline <style>, so the rules here win over anything it sets at
   the same specificity. Nothing below deliberately relies on that; it is noted
   so a later edit knows which way the resolution runs. */

.dsc-wrap { padding: 0 1.5rem 2rem; }

/* What this module is. The one thing the screen cannot show on its own is that
   nothing on it is in his pipeline yet, so it is said first and in bold. */
.dsc-note {
  font-size: .78rem; line-height: 1.6; color: var(--muted);
  background: var(--glass-white); border-left: 2px solid var(--glass-border);
  border-radius: 0 8px 8px 0; padding: .7rem 1rem; margin-bottom: 1.1rem;
}
.dsc-note strong { color: var(--bone); font-weight: 600; }

.dsc-note-quiet {
  font-size: .74rem; line-height: 1.55; color: var(--muted);
  margin: .3rem 0 .8rem;
}

/* ---------- The bar ---------- */

.dsc-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  flex-wrap: wrap; margin-bottom: .8rem;
}

/* flex:1 so the two buttons sit together on the right rather than the filters
   button landing in the middle of the bar under space-between. */
.dsc-summary { font-size: .76rem; color: var(--muted); flex: 1 1 auto; }

/* Amber fill with dark text, in both themes — a fill, so no light-theme
   counterpart. Matches .mnu-check, .soc-generate and .tasks-add-btn. */
.dsc-run {
  background: var(--amber); color: #1A1410; border: 0; border-radius: 8px;
  font-family: 'Archivo', sans-serif; font-weight: 600; font-size: .8rem;
  padding: .5rem 1.05rem; cursor: pointer;
}
.dsc-run:disabled { opacity: .45; cursor: not-allowed; }

.dsc-status { font-size: .78rem; line-height: 1.5; min-height: 1.2rem; margin-bottom: .8rem; }
/* --teal-bright reads well on charcoal and only ~2.6:1 on white, so the light
   theme drops to the darker --teal, exactly as css/links.css does. */
.dsc-status-working { color: var(--sand); }
.dsc-status-ok { color: var(--teal-bright, #1FA39E); }
body.light-theme .dsc-status-ok { color: var(--teal, #0E5F66); }
.dsc-status-done { color: var(--muted); }
.dsc-status-error { color: #E05A4A; }
body.light-theme .dsc-status-error { color: #B03A2E; }

/* ---------- Sections ---------- */

.dsc-section { margin-bottom: 1.6rem; }

.dsc-section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .8rem;
  border-bottom: 1px solid var(--glass-border); padding-bottom: .4rem; margin-bottom: .5rem;
}

.dsc-section-title {
  font-family: 'Fraunces', serif; font-size: 1rem; color: var(--bone);
}

/* ---------- Cards ---------- */

.dsc-card {
  background: var(--charcoal-soft); border: 1px solid var(--glass-border);
  border-radius: 10px; padding: .85rem 1rem; margin-bottom: .7rem;
}

/* Dimming while a decision is in flight. Opacity moves foreground and border
   together without introducing a colour, so it needs no light-theme rule. */
.dsc-card-busy { opacity: .5; }

.dsc-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .6rem;
}

.dsc-card-name {
  font-family: 'Fraunces', serif; font-size: 1.02rem; line-height: 1.3;
  color: var(--bone);
}

.dsc-card-when {
  font-size: .78rem; color: var(--sand); margin-top: .25rem;
}

.dsc-card-desc {
  font-size: .78rem; line-height: 1.55; color: var(--muted); margin-top: .5rem;
}

/* Fees, deadlines and what the organiser wants — the half of a proposal he acts
   on rather than reads. Amber as TEXT, so it carries its light counterpart. */
.dsc-card-vendor {
  font-size: .76rem; line-height: 1.55; color: var(--amber-light, var(--amber));
  margin-top: .45rem;
}
body.light-theme .dsc-card-vendor { color: #9C5C08; }

.dsc-card-quiet {
  font-size: .72rem; line-height: 1.5; color: var(--muted); margin-top: .45rem;
}

/* ---------- Chips ---------- */

.dsc-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }

.dsc-chip {
  font-size: .68rem; letter-spacing: .02em; text-transform: uppercase;
  padding: .18rem .5rem; border-radius: 999px;
  border: 1px solid var(--glass-border); color: var(--muted);
  white-space: nowrap;
}

.dsc-chip-cat { flex: 0 0 auto; }

/* Applications open is the only state on this screen that means "do something
   today", so it is the only one that gets a colour with weight behind it.
   Border and background are fills; the text is not, hence the light rule. */
.dsc-app-open {
  border-color: var(--teal-bright, #1FA39E);
  color: var(--teal-bright, #1FA39E);
}
body.light-theme .dsc-app-open { color: var(--teal, #0E5F66); }

.dsc-app-opening_later { border-color: var(--glass-border); color: var(--sand); }
.dsc-app-closed { border-color: var(--glass-border); color: var(--muted); }
.dsc-app-unknown { border-color: var(--glass-border); color: var(--muted); }

.dsc-conf-high { color: var(--sand); }
.dsc-conf-medium { color: var(--muted); }
.dsc-conf-low { color: var(--muted); opacity: .85; }

/* "You will need to add a date" — a thing to fix, not a thing that is wrong. */
.dsc-chip-warn { border-color: var(--amber); color: var(--amber); }
body.light-theme .dsc-chip-warn { color: #9C5C08; }

/* ---------- Links ---------- */

.dsc-links { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .55rem; }

.dsc-link {
  font-size: .74rem; color: var(--teal-bright, #1FA39E); text-decoration: none;
}
body.light-theme .dsc-link { color: var(--teal, #0E5F66); }
.dsc-link:hover { text-decoration: underline; }

/* The application page is the one he came for. Amber as text. */
.dsc-link-apply { color: var(--amber); font-weight: 600; }
body.light-theme .dsc-link-apply { color: #9C5C08; }

/* ---------- Actions ---------- */

.dsc-actions {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem;
}

.dsc-more { margin-left: auto; }

/* ---------- Empty and unloaded ---------- */

/* HANDOFF rule 4. A genuinely empty list and a list that could not be read must
   not look alike, so the second gets a warning border and the first does not. */
.dsc-empty {
  font-size: .78rem; line-height: 1.55; color: var(--muted);
  background: var(--glass-white); border-left: 2px solid var(--glass-border);
  border-radius: 0 8px 8px 0; padding: .7rem 1rem;
}
.dsc-empty strong { color: var(--bone); font-weight: 600; }

.dsc-empty-warn { border-left-color: var(--amber); color: var(--sand); }
body.light-theme .dsc-empty-warn { border-left-color: #9C5C08; }

/* ---------- Last search ---------- */

.dsc-run-row {
  font-size: .76rem; line-height: 1.5; color: var(--muted);
  padding: .35rem 0; border-bottom: 1px solid var(--glass-border);
}
.dsc-run-row:last-child { border-bottom: 0; }
.dsc-run-row strong { color: var(--bone); font-weight: 600; }

/* Found / nothing / broke, told apart at a glance — the distinction rule 4 is
   about, made visual as well as textual. */
.dsc-run-found { color: var(--sand); }
.dsc-run-empty { color: var(--muted); }
.dsc-run-failed { color: #E05A4A; }
body.light-theme .dsc-run-failed { color: #B03A2E; }

/* ---------- Is the nightly search actually running? ---------- */

/* The panel that answers the question the queue cannot. It sits above
   everything because everything below it is about what was FOUND, and a queue
   with nothing in it looks the same on a quiet week as it does when the search
   has been failing since April.

   Three states, and they must be distinguishable at a glance and not only by
   reading: ok (quiet, left border in the neutral glass), warn (amber — it ran
   but something in it did not), bad (red — it did not run, or has never run).
   HANDOFF rule 4 is a colour here as well as a sentence. */
.dsc-health {
  font-size: .78rem; line-height: 1.6; color: var(--muted);
  background: var(--glass-white); border-left: 2px solid var(--glass-border);
  border-radius: 0 8px 8px 0; padding: .7rem 1rem; margin-bottom: 1rem;
}
.dsc-health strong { color: var(--bone); font-weight: 600; }
.dsc-health code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em;
  color: var(--sand);
}

.dsc-health-head { color: var(--bone); font-weight: 600; margin-bottom: .2rem; }
.dsc-health-line { margin-top: .15rem; }

/* The reasons a run failed, one per line — the link finder spent two live runs
   undiagnosable because it kept counts and threw the reasons away. */
.dsc-health-reasons { margin: .35rem 0 .2rem; padding-left: 1.1rem; }
.dsc-health-reasons li { margin-bottom: .2rem; }

/* Amber and red AS TEXT, so both carry their light-theme counterparts —
   HANDOFF rule 6, the distinction that has been rediscovered three times. */
.dsc-health-warn { border-left-color: var(--amber); }
body.light-theme .dsc-health-warn { border-left-color: #9C5C08; }
.dsc-health-warn .dsc-health-head { color: var(--amber); }
body.light-theme .dsc-health-warn .dsc-health-head { color: #9C5C08; }

.dsc-health-bad { border-left-color: #E05A4A; }
.dsc-health-bad .dsc-health-head { color: #E05A4A; }
body.light-theme .dsc-health-bad .dsc-health-head { color: #B03A2E; }

/* A line inside an otherwise-fine run that still needs pointing at: a category
   that fell over, rows that could not be saved, a notification nobody got. */
.dsc-health-flag { color: var(--amber); }
body.light-theme .dsc-health-flag { color: #9C5C08; }

/* ---------- Filters ---------- */
/* Set before pressing Search. Collapsed by default: the nightly sweep needs
   none of this, and six controls above the queue would make the screen look
   like work before it looks like results.

   NOT .dsc-chip — that class already means a pill on a card (category,
   application status, confidence) and reusing it here would restyle every card
   on the screen. Same collision HANDOFF rule 5 is about, one layer down in the
   CSS. */

.dsc-f-toggle {
  background: none; border: 1px solid var(--glass-border); color: var(--muted);
  border-radius: 999px; padding: .4rem .9rem; font-family: inherit; font-size: .8rem;
  cursor: pointer; min-height: 40px; white-space: nowrap;
}
.dsc-f-toggle:hover { color: var(--bone); border-color: var(--amber); }
.dsc-f-toggle[aria-expanded="true"] { color: var(--bone); border-color: var(--amber); }

.dsc-filters {
  border: 1px solid var(--glass-border); border-radius: 12px;
  padding: 1rem; margin-bottom: 1rem;
}

.dsc-f-row { margin-bottom: 1.1rem; }
.dsc-f-row:last-of-type { margin-bottom: .6rem; }

.dsc-f-label {
  font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .45rem;
}

.dsc-f-chips { display: flex; flex-wrap: wrap; gap: .4rem; }

.dsc-fchip {
  background: none; border: 1px solid var(--glass-border); color: var(--muted);
  border-radius: 999px; padding: .4rem .8rem; font-family: inherit; font-size: .8rem;
  cursor: pointer; min-height: 38px; text-align: left;
}
.dsc-fchip:hover { color: var(--bone); border-color: var(--amber); }

/* Amber fill with dark text in both themes — a fill, so no light counterpart
   is needed, the same arrangement .dsc-run uses above. */
.dsc-fchip-on {
  background: var(--amber); border-color: var(--amber); color: #1A1814; font-weight: 600;
}
.dsc-fchip-on:hover { color: #1A1814; }

.dsc-f-hint { font-size: .75rem; color: var(--muted); line-height: 1.5; margin-top: .45rem; }

/* The "asked for, not enforced" line under the distance filter. Amber because
   it is a limit on what the screen can promise, not decoration — and amber as
   TEXT needs its light counterpart, the pair used everywhere else here. */
.dsc-f-hint-soft { color: var(--amber); opacity: .9; }
body.light-theme .dsc-f-hint-soft { color: #9C5C08; }

.dsc-f-check {
  display: flex; align-items: flex-start; gap: .55rem;
  font-size: .88rem; line-height: 1.4; cursor: pointer; min-height: 38px;
}
.dsc-f-check input { margin-top: .18rem; width: 18px; height: 18px; flex: 0 0 auto; }

.dsc-f-foot {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .8rem; flex-wrap: wrap;
  border-top: 1px solid var(--glass-border); padding-top: .8rem;
}
.dsc-f-plan { flex: 1 1 240px; font-size: .8rem; color: var(--sand); line-height: 1.5; }
.dsc-f-reset {
  background: none; border: 1px solid var(--glass-border); color: var(--muted);
  border-radius: 8px; padding: .35rem .8rem; font-family: inherit; font-size: .78rem;
  cursor: pointer; min-height: 36px;
}
.dsc-f-reset:hover { color: var(--bone); border-color: var(--amber); }

@media (max-width: 560px) {
  /* Two per row rather than a ragged wrap — ten category names at one per line
     is a panel he has to scroll past every time. */
  .dsc-f-chips { display: grid; grid-template-columns: 1fr 1fr; }
  .dsc-fchip { width: 100%; }
}
