/* ===========================================================
   UW Dashboard — Linear-style utility interface
   Geist Sans / Geist Mono · flat neutrals · 14px base
   =========================================================== */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500&display=swap");

:root {
  --bg:              #fcfcfd;
  --bg-subtle:       #f7f8fa;
  --bg-hover:        #f1f2f5;
  --bg-panel:        #ffffff;

  --border:          #e8e8ec;
  --border-strong:   #d3d4d9;

  --text:            #0f1011;
  --text-soft:       #41434a;
  --text-muted:      #8a8f98;

  --accent:          #b8860b;   /* Korman gold, used sparingly */
  --accent-soft:     #fbf6e8;
  --accent-ink:      #7d5b07;

  --green:           #2f8c54;
  --amber:           #b7791f;
  --red:             #bd3a3a;

  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-sm: 5px;
  --radius:    6px;
  --radius-lg: 8px;

  --shadow-1: 0 1px 2px rgba(15, 16, 17, 0.04), 0 0 0 1px rgba(15, 16, 17, 0.04);
  --shadow-2: 0 4px 12px rgba(15, 16, 17, 0.06), 0 0 0 1px rgba(15, 16, 17, 0.05);

  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "ss01" on, "cv11" on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
code { font-family: var(--mono); font-size: 0.9em; }

/* --- Top bar ----------------------------------------------- */

.topbar {
  height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
}

.brand__mark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.brand__mark::after { content: "K"; }

.brand__sep {
  color: var(--text-muted);
  font-weight: 400;
  margin: 0 2px;
}

.brand__crumb {
  color: var(--text-muted);
  font-weight: 400;
}

.topbar__spacer { flex: 1; }

.topbar__tools {
  display: flex;
  align-items: center;
  gap: 8px;
}



/* --- Buttons ----------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn:disabled { opacity: 0.55; cursor: wait; }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-soft);
  padding: 0 8px;
}

.btn--ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

.btn__icon { width: 13px; height: 13px; stroke-width: 1.75; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.3; transform: scale(0.55); }
}

/* --- Shell ------------------------------------------------- */

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}

/* --- Page heading ------------------------------------------ */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.page-head__title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

.page-head__sub {
  font-size: 13px;
  color: var(--text-muted);
}

.page-head__stats {
  display: flex;
  gap: 18px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}

.page-head__stat strong {
  color: var(--text);
  font-weight: 500;
  margin-right: 4px;
}

/* --- Deal list --------------------------------------------- */

.deal-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.deal {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 16px;
  padding: 0 10px 0 8px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  transition: background 100ms var(--ease);
  opacity: 0;
  animation: row-in 320ms var(--ease) forwards;
}

.deal:nth-child(1)  { animation-delay:   0ms; }
.deal:nth-child(2)  { animation-delay:  15ms; }
.deal:nth-child(3)  { animation-delay:  30ms; }
.deal:nth-child(4)  { animation-delay:  45ms; }
.deal:nth-child(5)  { animation-delay:  60ms; }
.deal:nth-child(6)  { animation-delay:  75ms; }
.deal:nth-child(7)  { animation-delay:  90ms; }
.deal:nth-child(8)  { animation-delay: 105ms; }
.deal:nth-child(9)  { animation-delay: 120ms; }
.deal:nth-child(10) { animation-delay: 135ms; }
.deal:nth-child(11) { animation-delay: 150ms; }
.deal:nth-child(12) { animation-delay: 165ms; }

@keyframes row-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.deal:hover { background: var(--bg-subtle); }
.deal:hover .deal__chev { color: var(--text-soft); transform: translateX(2px); }

.deal__link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Every child is decorative — all clicks fall through to .deal__link so the
   entire row is one uniform click target. */
.deal > *:not(.deal__link) { pointer-events: none; }

.deal__icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.deal__icon svg { width: 12px; height: 12px; stroke-width: 1.8; }

.deal__heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.deal__name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text);
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal__city {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.deal__heading .status-pill { flex-shrink: 0; }

/* City-load progress overlay (KCI-34). Bar styling follows the Atlassian
   Design System ProgressBar (deliberate, user-chosen look): 6px pill track
   in light neutral, Default blue fill, Success green on completion —
   expressed as tokens per the global UI guidelines. */
:root {
  --progress-track:   rgba(9, 30, 66, 0.13);
  --progress-fill:    #0052cc;  /* ADS Default */
  --progress-success: #22a06b;  /* ADS Success */
}
.city-loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(252, 252, 253, 0.82);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 160ms ease;
}

.city-loading.is-visible { opacity: 1; }

.city-loading__card {
  width: min(420px, calc(100vw - 48px));
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 16, 17, 0.10);
  padding: 22px 24px;
}

.city-loading__msg {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 12px;
  /* Shimmer: a light band sweeping through the text while the city loads. */
  background: linear-gradient(
    90deg,
    var(--text) 0%,
    var(--text) 42%,
    var(--text-muted) 50%,
    var(--text) 58%,
    var(--text) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: city-loading-shimmer 2.6s linear infinite;
}

@keyframes city-loading-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.city-loading__track {
  height: 6px;
  border-radius: 3px;
  background: var(--progress-track);
  overflow: hidden;
}

.city-loading__fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--progress-fill);
}

.city-loading__fill.is-success { background: var(--progress-success); }

@media (prefers-reduced-motion: reduce) {
  .city-loading__msg {
    animation: none;
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--text);
  }
}

/* Staleness banner: the city refresh failed and the page is rendering
   cached DB state (see city_page / _refresh_on_view). */
.stale-banner {
  margin: 10px 0 2px;
  padding: 8px 12px;
  border: 1px solid #ecd9a8;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12.5px;
}

.deal__files {
  display: flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
}

.pip--ok {
  background: var(--bg-subtle);
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.pip--ok .pip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.pip--miss {
  background: rgba(189, 58, 58, 0.08);
  color: var(--red);
  border: 1px solid rgba(189, 58, 58, 0.28);
}

.pip--miss .pip__bang {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 10.5px;
  line-height: 1;
  width: 10px;
  text-align: center;
}

.deal__count {
  margin-left: 6px;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.deal__files--warn .deal__count { color: var(--red); }

.deal__warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--red);
}

.deal__warn svg { width: 14px; height: 14px; stroke-width: 2; }

.deal__chev {
  color: var(--text-muted);
  transition: color 100ms var(--ease), transform 160ms var(--ease);
  display: inline-flex;
  justify-content: center;
}

.deal__chev svg { width: 14px; height: 14px; stroke-width: 1.8; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--mono);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.status-pill__glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  font-weight: 700;
  font-size: 11px;
}

.status-pill__glyph svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.25;
}

.status-pill--needs_docs {
  background: rgba(189, 58, 58, 0.08);
  color: var(--red);
  border-color: rgba(189, 58, 58, 0.28);
}

.status-pill--preflighted {
  background: var(--bg-subtle);
  color: var(--text-soft);
  border-color: var(--border-strong);
}

.status-pill--preflighted .status-pill__glyph { color: var(--text-muted); }

.status-pill--prepared {
  background: rgba(47, 140, 84, 0.08);
  color: var(--green);
  border-color: rgba(47, 140, 84, 0.28);
}

/* --- Detail page ------------------------------------------- */

.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 18px 0 8px;
}

.crumbs a:hover { color: var(--text); }
.crumbs__sep { color: var(--border-strong); }
.crumbs__current { color: var(--text); font-weight: 500; }

.deal-header {
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 32px;
}

.deal-header__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.deal-header__icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
}

.deal-header__icon svg { width: 16px; height: 16px; stroke-width: 1.75; }

.deal-header__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}

.deal-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.deal-header__meta-item { display: inline-flex; align-items: center; gap: 5px; }
.deal-header__meta-item strong { color: var(--text-soft); font-weight: 500; }
.deal-header__meta-item code { color: var(--text-soft); }

.deal-header__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.external {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  transition: background 120ms var(--ease), border-color 120ms var(--ease);
}

.external:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.external svg { width: 12px; height: 12px; stroke-width: 1.75; color: var(--text-muted); }

/* --- Tabs -------------------------------------------------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: -4px 0 20px;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: color 120ms var(--ease);
}

.tab:hover:not(:disabled) { color: var(--text-soft); }

.tab.is-active {
  color: var(--text);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.tab--disabled,
.tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tab__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.tab-panel[hidden] { display: none; }

/* --- Prepare bar ------------------------------------------- */

.prepare-bar {
  margin-top: 24px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 200ms var(--ease), background 200ms var(--ease);
}

.prepare-bar--running {
  background: var(--accent-soft);
  border-color: rgba(184, 134, 11, 0.35);
}

.prepare-error {
  margin-top: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--red);
  background: rgba(189, 58, 58, 0.06);
  border: 1px solid rgba(189, 58, 58, 0.28);
  border-radius: var(--radius);
}

.prepare-error code {
  font-family: var(--mono);
  color: var(--red);
  background: transparent;
}

.prepare-bar__text {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
  min-width: 0;
}

.prepare-bar__text strong {
  color: var(--text);
  font-weight: 600;
  display: block;
  font-size: 13.5px;
}

.btn-prepare {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background 120ms var(--ease), transform 100ms var(--ease), box-shadow 160ms var(--ease);
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(15, 16, 17, 0.1);
}

.btn-prepare:hover:not(:disabled) {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 16, 17, 0.15);
}

.btn-prepare:disabled {
  opacity: 0.8;
  cursor: wait;
}

.btn-prepare__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.btn-prepare.is-working .btn-prepare__dot {
  animation: pulse 1.05s var(--ease) infinite;
}

/* --- Output card ------------------------------------------- */

.output-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-1);
}

.output-card__main { min-width: 0; flex: 1; }

.output-card__filename {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.output-card__meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  letter-spacing: -0.01em;
}

.output-card__actions { flex-shrink: 0; }

/* --- Office Online embed ----------------------------------- */

/* Break out of the 1120px shell — the spreadsheet reads better wider.
   Pin to the viewport with a 20px gutter on each side, cap at 1440px. */
.embed-frame {
  position: relative;
  margin-top: 16px;
  width: min(calc(100vw - 40px), 1440px);
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-panel);
  box-shadow: var(--shadow-1);
}

.embed-frame__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  transition: border-color 180ms var(--ease);
}

.embed-frame__meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.embed-frame__title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: -0.005em;
}

.embed-frame__note {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.embed-frame__toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px 0 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  font-family: var(--mono);
  letter-spacing: -0.01em;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
  flex-shrink: 0;
}

.embed-frame__toggle:hover {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text);
}

.embed-frame__chev {
  width: 12px;
  height: 12px;
  stroke-width: 2;
  transition: transform 180ms var(--ease);
}

.embed-frame.is-collapsed .embed-frame__chev { transform: rotate(-90deg); }
.embed-frame.is-collapsed .embed-frame__head { border-bottom-color: transparent; }

.embed-frame__body {
  overflow: hidden;
  transition: max-height 260ms var(--ease), opacity 180ms var(--ease);
  max-height: 60vh;
  opacity: 1;
}

.embed-frame.is-collapsed .embed-frame__body {
  max-height: 0;
  opacity: 0;
}

.embed-frame__iframe {
  display: block;
  width: 100%;
  height: 60vh;
  min-height: 420px;
  border: none;
  background: #fff;
}

/* Section */

.section {
  margin: 24px 0 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.section__title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text-soft);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section__count {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-subtle);
}

.section__note { font-size: 12.5px; color: var(--text-muted); }

/* --- Rent-roll as-of sub-row ------------------------------- */

/* Sits inside .slot-rows between the rent_roll and om rows. Visually reads
   as a continuation of the rent_roll row — shared background band,
   indented gutter with a corner-hook connector, and a subtle gold left
   edge that mirrors the rent_roll's manual/auto tags. */
.subrow {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding: 12px 16px 14px 16px;
  margin-top: -1px;                  /* collapse border with rent_roll */
  background: var(--accent-soft);
  border-top: 1px dashed rgba(184, 134, 11, 0.45);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 3px 0 0 var(--accent);
  transition: background 180ms var(--ease), box-shadow 180ms var(--ease);
}

.subrow--needs {
  background: rgba(189, 58, 58, 0.06);
  box-shadow: inset 3px 0 0 var(--red);
  border-top-color: rgba(189, 58, 58, 0.45);
}

.subrow__gutter {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 6px;
  color: var(--accent);
}

.subrow--needs .subrow__gutter { color: var(--red); }

.subrow__gutter svg { width: 16px; height: 16px; stroke-width: 1.75; }

.subrow__body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.subrow__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.subrow__row[hidden] { display: none; }

.subrow__label {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
  line-height: 1.15;
}

.subrow__label-kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent-ink);
  text-transform: uppercase;
}

.subrow--needs .subrow__label-kicker { color: var(--red); }

.subrow__input {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-panel);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  min-width: 150px;
  transition: border-color 120ms var(--ease), box-shadow 180ms var(--ease);
}

.subrow__input:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 2px rgba(15, 16, 17, 0.1);
}

@keyframes subrow-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(189, 58, 58, 0); border-color: var(--border-strong); }
  30%      { box-shadow: 0 0 0 3px rgba(189, 58, 58, 0.25); border-color: var(--red); }
  70%      { box-shadow: 0 0 0 3px rgba(189, 58, 58, 0.18); border-color: var(--red); }
}

.subrow__input--flash { animation: subrow-flash 900ms var(--ease); }

.subrow__note {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.4;
}

.subrow__note code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  background: rgba(15, 16, 17, 0.04);
  padding: 0 4px;
  border-radius: 3px;
}

.subrow--needs .subrow__note { color: var(--red); }

/* Recent-date mode pill toggle (subrow) ------------------------------- */
.recent-mode {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.recent-mode__pill {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-muted);
  transition: background 180ms var(--ease), color 180ms var(--ease);
}
.recent-mode__pill:hover { color: var(--text); }
.recent-mode__pill.is-active {
  background: var(--accent);
  color: #fff;
}
.recent-mode__pill.is-active:hover { color: #fff; }

.subrow__sublabel {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  align-self: center;
  white-space: nowrap;
}
.subrow__suffix {
  font-size: 13px;
  color: var(--text-muted);
  align-self: center;
}
.subrow__input--narrow { max-width: 90px; }

.tag--needs {
  background: rgba(189, 58, 58, 0.1);
  color: var(--red);
  border: 1px solid rgba(189, 58, 58, 0.3);
}

@media (max-width: 640px) {
  .subrow { grid-template-columns: 24px 1fr; padding-left: 12px; }
  .subrow__gutter { justify-content: flex-start; }
}

/* Slot rows (detail view replaces cards with tight stacked rows, Linear-ish) */

.slot-rows {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-panel);
}

.slot-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 0 16px;
  min-height: 68px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 100ms var(--ease);
}

.slot-row:last-child { border-bottom: none; }
.slot-row:hover { background: var(--bg-subtle); }

.slot-row--missing { background: repeating-linear-gradient(
  135deg,
  var(--bg-panel),
  var(--bg-panel) 6px,
  var(--bg-subtle) 6px,
  var(--bg-subtle) 7px
); }

.slot-row__type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-soft);
}

.slot-row__type-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.slot-row--filled .slot-row__type-dot { background: var(--green); }
.slot-row--missing .slot-row__type-dot { background: var(--border-strong); }

.slot-row__body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.slot-row__name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-row__name--missing { font-style: italic; color: var(--text-muted); }

.slot-row__sub {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.slot-row__sub > span { flex-shrink: 0; }
.slot-row__sub > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
}

.slot-row__sub .dot { color: var(--border-strong); }

.slot-row__side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
  font-family: var(--mono);
  letter-spacing: -0.01em;
  line-height: 1;
}

.tag--auto   { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }
.tag--manual { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid rgba(184, 134, 11, 0.25); }
.tag--version { background: var(--bg-subtle); color: var(--text-soft); border: 1px solid var(--border); }

/* History list */

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-panel);
}

.history-item {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  align-items: center;
}

.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--bg-subtle); }

.history-item__type {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.history-item__name {
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.empty-state {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}

/* --- Slot row clickability -------------------------------- */

.slot-row {
  cursor: pointer;
  user-select: none;
  transition: background 100ms var(--ease), box-shadow 120ms var(--ease);
}

.slot-row:hover {
  background: var(--bg-hover);
  box-shadow: inset 2px 0 0 var(--accent);
}

.slot-row:focus-visible {
  outline: none;
  background: var(--bg-hover);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* Always-visible action cue. Becomes fully opaque on hover. */
.slot-row__action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  line-height: 1;
  transition: color 120ms var(--ease), border-color 120ms var(--ease), background 120ms var(--ease), transform 120ms var(--ease);
}

.slot-row:hover .slot-row__action {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-panel);
}

.slot-row__action svg {
  width: 11px;
  height: 11px;
  stroke-width: 2;
  transition: transform 160ms var(--ease);
}

.slot-row:hover .slot-row__action svg { transform: translateX(2px); }

/* Children are purely visual — every click / drag within the row routes to
   the row's own click handler. No nested links or buttons. */
.slot-row > * { pointer-events: none; }

/* Empty-row CTA: elevate the action so the row reads as "add a file". */
.slot-row--missing .slot-row__action {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: rgba(184, 134, 11, 0.35);
}

.slot-row--missing:hover .slot-row__action {
  background: #fff;
  border-color: var(--accent);
  color: var(--accent-ink);
}

.slot-row--missing .slot-row__type-dot { border: 1px dashed var(--accent); }


/* --- Modal ------------------------------------------------- */

.modal-root[hidden] { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 16, 17, 0.38);
  backdrop-filter: blur(2px);
  z-index: 50;
  opacity: 0;
  animation: fade-in 180ms var(--ease) forwards;
}

@keyframes fade-in { to { opacity: 1; } }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(15, 16, 17, 0.18);
  z-index: 51;
  opacity: 0;
  animation: modal-in 220ms var(--ease) forwards;
  overflow: hidden;
}

@keyframes modal-in {
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal__head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal__head-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal__head-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid rgba(184, 134, 11, 0.25);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.modal__head-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal__close {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background 120ms var(--ease), color 120ms var(--ease);
}

.modal__close:hover { background: var(--bg-hover); color: var(--text); }
.modal__close svg { width: 14px; height: 14px; stroke-width: 1.75; }

.modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
}

.modal__loading, .modal__empty {
  padding: 36px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.pick-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 100ms var(--ease);
  position: relative;
}

.pick-item:hover { background: var(--bg-subtle); }
.pick-item:focus-visible {
  outline: none;
  background: var(--bg-hover);
  box-shadow: 0 0 0 1.5px var(--accent) inset;
}

.pick-item[disabled],
.pick-item.is-working {
  pointer-events: none;
  opacity: 0.55;
}

.pick-item__icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.pick-item__icon svg { width: 14px; height: 14px; stroke-width: 1.75; }

.pick-item__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.pick-item__name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-item__meta {
  display: flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

.pick-item__side {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pick-item .tag--current {
  background: var(--bg-subtle);
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.pick-item .tag--same-type {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid rgba(184, 134, 11, 0.25);
}

/* --- Toast ------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
  pointer-events: none;
  z-index: 40;
  max-width: 340px;
  box-shadow: var(--shadow-2);
}

.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--err { background: var(--red); }

/* --- Line item review -------------------------------------- */

/* Header-row heights are hard-coded into sticky offsets below; if padding or
   type scale changes, re-measure (thead ≈ 38px, section row ≈ 32px). */
:root {
  --review-thead-h: 38px;
  --review-section-h: 32px;
}

.review {
  margin-top: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.review__bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  flex-wrap: wrap;
}

.review__stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-soft);
}

.review__stat strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.review__filters {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.review__filter-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-muted);
}

.review__filter-label svg { width: 12px; height: 12px; stroke-width: 2; }

/* Filter-chip group — segmented control look. Visually obvious that these
   are toggles for list filtering (not arbitrary checkboxes). */
.filter-chips {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(15, 16, 17, 0.02);
}

.filter-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}

.filter-chip:hover { background: var(--bg-hover); color: var(--text); }

.filter-chip__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.filter-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 140ms var(--ease), opacity 140ms var(--ease);
}

/* Color the dot by the filter it represents so the chip self-documents even
   when inactive — gold for overrides, red for low-confidence. */
.filter-chip[data-filter="overrides"] .filter-chip__dot { background: var(--accent); opacity: 0.4; }
.filter-chip[data-filter="low"] .filter-chip__dot { background: var(--red); opacity: 0.4; }

.filter-chip__count {
  font-family: var(--mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  line-height: 1.3;
}

/* Active state — tinted bg + full-opacity dot (+ slight scale for feedback). */
.filter-chip.is-active[data-filter="overrides"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px rgba(184, 134, 11, 0.28);
}
.filter-chip.is-active[data-filter="low"] {
  background: #fdecec;
  color: #8c2a2a;
  box-shadow: inset 0 0 0 1px rgba(189, 58, 58, 0.22);
}
.filter-chip.is-active .filter-chip__dot { opacity: 1; transform: scale(1.15); }
.filter-chip.is-active[data-filter="overrides"] .filter-chip__count {
  background: rgba(184, 134, 11, 0.15);
  color: var(--accent-ink);
}
.filter-chip.is-active[data-filter="low"] .filter-chip__count {
  background: rgba(189, 58, 58, 0.12);
  color: #8c2a2a;
}

.filter-chip:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.review__body {
  max-height: 640px;
  overflow: auto;
}

.review__empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* table-layout: fixed — column widths come from the thead <th>s, cell content
   can't distort heights or widths. Fixes the misaligned horizontal borders. */
.review-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.review-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 11px 14px;
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-col-line  { width: 42%; }
.review-col-map   { width: 30%; }
.review-col-why   { width: 28%; }

/* Section header row — sticky, pinned just under the thead, with a soft
   overline accent so it reads as a divider rather than a data row. */
.review-row--section td {
  position: sticky;
  top: var(--review-thead-h);
  z-index: 2;
  background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg-subtle) 100%);
  padding: 7px 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--border);
}

.review-section__label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-soft);
}
.review-section__label::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 1px;
  background: var(--text-muted);
  vertical-align: middle;
  margin-right: 8px;
  opacity: 0.5;
}

.review-table tbody tr:not(.review-row--section) td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.review-row:hover:not(.review-row--section) td { background: var(--bg-hover); }

.review-row--override td {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.review-row--override:hover td { background: #f5ecd0; }

.review-line__text {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.45;
}

.review-line__origin {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Stacked layout — select on top, badge directly underneath. Default
   table-cell rendering is kept so row heights stay locked to siblings. */
.review-cell-map .review-select {
  display: block;
  width: 100%;
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23706F6C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 9px center,
    var(--bg-panel);
  color: var(--text);
  cursor: pointer;
  appearance: none;
}

.review-cell-map .review-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.16);
}

.review-cell-map .review-select:disabled { opacity: 0.6; cursor: progress; }

.review-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
}

.review-badge--override { background: var(--accent); color: #fff; }
.review-badge--trained { background: var(--success-bg, #e6f4ea); color: var(--success-fg, #1e7d3e); margin-left: 4px; }
.review-badge--untrained { background: var(--warning-bg, #fdf3e1); color: var(--warning-fg, #9a6b00); margin-left: 4px; }

.review-why__head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.review-conf {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 1px 6px;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}

.review-conf--high { background: #dff3e4; color: var(--green); }
.review-conf--med  { background: #fbead0; color: var(--amber); }
.review-conf--low  { background: #fadada; color: var(--red); }

.review-method {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.review-why__text {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}


/* --- Responsive -------------------------------------------- */

@media (max-width: 880px) {
  .deal { grid-template-columns: 20px minmax(0,1fr) auto; height: auto; min-height: 52px; padding: 10px; }
  .deal__chev { display: none; }
  .deal-header { grid-template-columns: 1fr; }
  .deal-header__aside { align-items: flex-start; }
  .slot-row { grid-template-columns: 80px 1fr; }
  .slot-row__side { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .deal { grid-template-columns: 20px minmax(0,1fr); }
  .deal__files { grid-column: 1 / -1; justify-content: flex-start; }
  .deal__heading .status-pill { display: none; }
  .review-col-line { width: auto; }
  .review-col-map,
  .review-col-why { display: none; }
}

/* ---- Bug report capture (KCI-53) ---- */
.bug-report-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  color: var(--text-muted);
  border: 1px solid var(--border, #e1e6eb);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: all 200ms ease;
}
.bug-report-btn:hover { color: var(--accent-ink, #7d5b07); border-color: var(--accent, #b8860b); }

/* The [hidden] attribute's UA display:none loses to any author
   `display` rule — without these guards the overlay and the conditional
   workbook fields render permanently and close/toggle appear broken. */
.bug-modal-overlay[hidden],
.bug-modal [hidden] {
  display: none !important;
}
.bug-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(35, 31, 32, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.bug-modal {
  background: var(--bg-panel);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 24px;
}
.bug-modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bug-modal__head h2 { font-size: 15px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; margin: 0; }
.bug-modal__close { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted); }
.bug-field { display: block; margin-bottom: 14px; }
.bug-field__label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text-muted); }
.bug-field__label em { color: #b3261e; font-style: normal; }
.bug-field textarea,
.bug-field input[type="text"],
.bug-field select {
  width: 100%;
  border: 1px solid var(--border, #e1e6eb);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}
.bug-field--radios { border: none; padding: 0; margin: 0 0 14px; }
.bug-field--radios label { margin-right: 18px; font-size: 13px; }
.bug-field--row { display: flex; gap: 14px; }
.bug-field--row label { flex: 1; }
.bug-field__note { font-size: 12px; color: var(--text-muted); }
.bug-modal__actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 6px; }
.bug-submit {
  background: var(--accent, #b8860b);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 200ms ease;
}
.bug-submit:disabled { opacity: 0.6; cursor: default; }

.bug-dropzone {
  border: 1.5px dashed var(--border, #e1e6eb);
  border-radius: 6px;
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 200ms ease;
}
.bug-dropzone:hover,
.bug-dropzone--over {
  border-color: var(--accent, #b8860b);
  color: var(--accent-ink, #7d5b07);
  background: var(--accent-soft, #fbf6e8);
}
.bug-attachment-list { list-style: none; margin: 8px 0 0; padding: 0; }
.bug-attachment-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--accent-soft, #fbf6e8);
  border: 1px solid var(--border, #e1e6eb);
  border-radius: 5px;
  padding: 4px 8px;
  margin-top: 4px;
}
.bug-attachment-list__remove {
  background: none;
  border: none;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}
.bug-attachment-list__remove:hover { color: #b3261e; }
.bug-confirm { text-align: center; padding: 28px 8px 20px; }
.bug-confirm__check {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  background: var(--accent, #b8860b);
}
.bug-confirm__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.bug-confirm__detail { font-size: 12px; color: var(--text-muted); }
