/* Scout — design system
   Precision instrument. Apple-grade restraint: SF stack, liquid glass, one accent. */

:root {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-2: #f0f0f2;
  --surface-3: #e8e8ed;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #86868b;
  --muted-2: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-pressed: #006edb;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-ring: rgba(0, 113, 227, 0.35);
  --go: #248a3d;
  --go-soft: rgba(52, 199, 89, 0.14);
  --urgent: #c93400;
  --urgent-soft: rgba(255, 149, 0, 0.14);
  --closed: #d70015;
  --closed-soft: rgba(255, 59, 48, 0.12);
  --fill-track: #e8e8ed;
  --fill-bar: linear-gradient(90deg, #0071e3, #2997ff);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12), 0 24px 80px rgba(0, 0, 0, 0.1);
  --glass: saturate(180%) blur(20px);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-pill: 980px;
  --maxw: 780px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-spring: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --surface: rgba(28, 28, 30, 0.72);
    --surface-solid: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-3: #3a3a3c;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --muted: #86868b;
    --muted-2: #98989d;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.16);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-pressed: #0077ed;
    --accent-soft: rgba(10, 132, 255, 0.16);
    --accent-ring: rgba(10, 132, 255, 0.4);
    --go: #30d158;
    --go-soft: rgba(48, 209, 88, 0.16);
    --urgent: #ff9f0a;
    --urgent-soft: rgba(255, 159, 10, 0.16);
    --closed: #ff453a;
    --closed-soft: rgba(255, 69, 58, 0.16);
    --fill-track: #3a3a3c;
    --fill-bar: linear-gradient(90deg, #0a84ff, #64d2ff);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35), 0 16px 48px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-2: #f0f0f2;
  --surface-3: #e8e8ed;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #86868b;
  --muted-2: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-pressed: #006edb;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-ring: rgba(0, 113, 227, 0.35);
  --go: #248a3d;
  --go-soft: rgba(52, 199, 89, 0.14);
  --urgent: #c93400;
  --urgent-soft: rgba(255, 149, 0, 0.14);
  --closed: #d70015;
  --closed-soft: rgba(255, 59, 48, 0.12);
  --fill-track: #e8e8ed;
  --fill-bar: linear-gradient(90deg, #0071e3, #2997ff);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12), 0 24px 80px rgba(0, 0, 0, 0.1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --surface: rgba(28, 28, 30, 0.72);
  --surface-solid: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --ink: #f5f5f7;
  --ink-2: #a1a1a6;
  --muted: #86868b;
  --muted-2: #98989d;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-pressed: #0077ed;
  --accent-soft: rgba(10, 132, 255, 0.16);
  --accent-ring: rgba(10, 132, 255, 0.4);
  --go: #30d158;
  --go-soft: rgba(48, 209, 88, 0.16);
  --urgent: #ff9f0a;
  --urgent-soft: rgba(255, 159, 10, 0.16);
  --closed: #ff453a;
  --closed-soft: rgba(255, 69, 58, 0.16);
  --fill-track: #3a3a3c;
  --fill-bar: linear-gradient(90deg, #0a84ff, #64d2ff);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35), 0 16px 48px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }

/*
  Horizontal anti-wiggle (iOS Safari):
  overflow-x:hidden on body alone is not enough when a child is wider than the
  viewport; the document still rubber-bands sideways. Clip at html+body, force
  width containment, and never let flex/grid kids expand past the content box.
  Pinch-zoom stays available (viewport meta does not set maximum-scale).
*/
html {
  -webkit-text-size-adjust: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}
body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
  position: relative;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.47059;
  letter-spacing: -0.016em;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Soft atmospheric depth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 113, 227, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 0, 0, 0.03), transparent 50%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before {
    background:
      radial-gradient(ellipse 70% 45% at 50% -15%, rgba(10, 132, 255, 0.12), transparent 55%),
      radial-gradient(ellipse 50% 40% at 0% 100%, rgba(10, 132, 255, 0.04), transparent 50%);
  }
}
:root[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse 70% 45% at 50% -15%, rgba(10, 132, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(10, 132, 255, 0.04), transparent 50%);
}
:root[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 113, 227, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 0, 0, 0.03), transparent 50%);
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  min-width: 0;
  /* Safe-area aware side padding (notch / home indicator) without exceeding 100% */
  padding-top: 28px;
  padding-bottom: max(96px, calc(48px + env(safe-area-inset-bottom, 0px)));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overflow-x: hidden;
  overflow-x: clip;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
a:hover { color: var(--accent-hover); }

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: none;
  /* Inset-style ring so focus never expands layout width on small screens */
  box-shadow: 0 0 0 3px var(--surface-solid), 0 0 0 6px var(--accent-ring);
}

.mono, .tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  line-height: 1.333;
}

/* ---- Masthead ---- */
.mast {
  padding-top: 8px;
  margin-bottom: 8px;
  animation: rise 0.6s var(--ease-spring) both;
}
.mast-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}
.mast-top > div {
  min-width: 0;
  flex: 1 1 auto;
}
.mast h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 4px 0 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.mast .brand-sub {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: -0.01em;
  max-width: 28em;
  overflow-wrap: break-word;
}

.theme-btn {
  appearance: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), border-color 0.2s var(--ease);
}
.theme-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.theme-btn:active { transform: scale(0.97); }

/* Segmented control nav */
.nav {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  box-sizing: border-box;
  box-shadow: inset 0 0 0 0.5px var(--line);
}
.nav-link {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--muted-2);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: none;
  text-decoration: none;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.nav-link:hover {
  color: var(--ink);
  background: transparent;
}
.nav-link.current {
  color: var(--ink);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm), 0 0 0 0.5px var(--line);
}
.nav-logout {
  margin-left: 2px;
  color: var(--muted);
}
.nav-logout:hover { color: var(--closed); }

.metaline {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: -0.01em;
}
.metaline b {
  color: var(--ink-2);
  font-weight: 500;
  margin-right: 4px;
}

.banner-warn {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--urgent-soft);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13px;
  letter-spacing: -0.01em;
}
.banner-warn b { color: var(--ink); font-weight: 600; }

/* ---- Controls (sticky glass) ---- */
/* No negative horizontal margins: those were a prime iOS sideways-wiggle source. */
.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 20px 0 0;
  padding: 14px 0 16px;
  max-width: 100%;
  min-width: 0;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: var(--glass);
  backdrop-filter: var(--glass);
  border-bottom: 0.5px solid var(--line);
  animation: rise 0.65s 0.05s var(--ease-spring) both;
}
.ctrl-row {
  display: flex;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}
.ctrl-row + .ctrl-row { margin-top: 12px; }
.ctrl-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ctrl-field label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--muted);
  padding-left: 2px;
}
select {
  width: 100%;
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.016em;
  color: var(--ink);
  background-color: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 36px 11px 14px;
  appearance: none;
  box-shadow: var(--shadow-sm);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 13px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  cursor: pointer;
}
select:hover { border-color: var(--line-strong); }
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
  outline: none;
}

.var-focus {
  margin: 10px 2px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}

.ctrl-row-2 {
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
  letter-spacing: -0.01em;
  user-select: none;
}
.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.scan-btn,
.btn {
  appearance: none;
  font-family: var(--font);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.016em;
  color: #fff;
  background: var(--accent);
  border: none;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0, 113, 227, 0.2);
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), opacity 0.2s var(--ease);
}
.scan-btn:hover, .btn:hover { background: var(--accent-hover); }
.scan-btn:active, .btn:active {
  background: var(--accent-pressed);
  transform: scale(0.98);
}
.scan-btn:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: progress;
  transform: none;
}
.btn.secondary {
  background: var(--surface-solid);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.btn.secondary:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.btn.danger {
  background: #d70015;
  box-shadow: 0 1px 2px rgba(215, 0, 21, 0.25);
}
.btn.danger:hover { background: #ff453a; }

/* ---- Main / states ---- */
main {
  margin-top: 24px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

.hint, .empty-state, .error-state, .loading-state {
  padding: 48px 28px;
  background: var(--surface-solid);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  letter-spacing: -0.016em;
  box-shadow: var(--shadow-sm);
  animation: rise 0.5s var(--ease-spring) both;
}
.error-state {
  border-color: transparent;
  background: var(--closed-soft);
  color: var(--ink);
}
.error-state button {
  display: inline-block;
  margin: 14px auto 0;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.loading-state {
  color: var(--muted);
  position: relative;
}
.loading-state::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 16px auto 0;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---- Summary ---- */
.summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 4px 2px;
  animation: rise 0.45s var(--ease-spring) both;
}
.summary .big {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.04em;
}
.summary .txt {
  font-size: 15px;
  color: var(--muted);
  letter-spacing: -0.016em;
}

/* ---- Stat groups ---- */
.stat-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 560px) {
  .stat-groups { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
}
.stat-group {
  background: var(--surface-solid);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.stat-group .eyebrow {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-row { display: flex; align-items: center; gap: 10px; }
.stat-row.extra { display: none; }
.stat-group.expanded .stat-row.extra { display: flex; }
.stat-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.stat-bar {
  flex: 0 0 52px;
  height: 4px;
  background: var(--fill-track);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.stat-bar-fill {
  display: block;
  height: 100%;
  background: var(--fill-bar);
  border-radius: var(--radius-pill);
}
.stat-count {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
  flex: 0 0 auto;
  min-width: 1.6em;
  text-align: right;
}
.stat-more {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  padding: 2px 0;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: -0.01em;
}
.stat-more:hover { color: var(--accent-hover); }

/* ---- Chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: none;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-2);
}
.chip.go { color: var(--go); background: var(--go-soft); }
.chip.urgent { color: var(--urgent); background: var(--urgent-soft); }
.chip.closed { color: var(--closed); background: var(--closed-soft); }
.chip.neutral { color: var(--muted-2); background: var(--surface-2); }

/* ---- Opportunity cards ---- */
.opp {
  background: var(--surface-solid);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
  margin-top: 14px;
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
  animation: rise 0.5s var(--ease-spring) both;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
/* Hover lift only on fine pointers; transform on touch can contribute to scroll jank */
@media (hover: hover) and (pointer: fine) {
  .opp:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
  }
}
.opp-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
}
.opp-rank {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.1;
  min-width: 32px;
  letter-spacing: -0.04em;
  opacity: 0.55;
}
.opp-title { flex: 1; min-width: 0; max-width: 100%; }
.opp-title h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.022em;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 6px;
  min-width: 0;
  max-width: 100%;
}
.meter .mlabel {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}
.track {
  flex: 1 1 auto;
  min-width: 0;
  height: 5px;
  background: var(--fill-track);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.fill {
  height: 100%;
  width: 0;
  background: var(--fill-bar);
  border-radius: var(--radius-pill);
  transition: width 0.9s var(--ease-spring);
}
.fill.green { background: linear-gradient(90deg, #248a3d, #30d158); }
.fill.amber { background: linear-gradient(90deg, #c93400, #ff9f0a); }
.fill.red { background: linear-gradient(90deg, #d70015, #ff453a); }
.score {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.score b { font-size: 18px; font-weight: 700; }
.score .of { color: var(--muted); font-weight: 500; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin: 18px 0 4px;
  border-top: 0.5px solid var(--line);
  padding-top: 16px;
}
@media (min-width: 480px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
.kv {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  min-width: 0;
}
.kv .k {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin-bottom: 3px;
}
.kv .v {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
  overflow-wrap: anywhere;
  letter-spacing: -0.02em;
  max-width: 100%;
}
.kv .v.sans {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.016em;
}
.star { color: var(--accent); }
.bullseye-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-left: 4px;
  letter-spacing: -0.01em;
}

.kw-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.kw-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: -0.01em;
  border: none;
}

.why {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--ink-2);
  letter-spacing: -0.014em;
  line-height: 1.45;
}
.why b { color: var(--ink); font-weight: 600; }

.excerpt {
  margin: 16px 0 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--ink-2);
  letter-spacing: -0.014em;
  line-height: 1.45;
}
.excerpt .xl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}
.excerpt q { font-style: normal; quotes: none; }
.desc { margin-top: 10px; }
.desc summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  font-style: normal;
  letter-spacing: -0.01em;
  list-style: none;
}
.desc summary::-webkit-details-marker { display: none; }
.desc .desc-body {
  margin-top: 10px;
  max-height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-style: normal;
  line-height: 1.5;
  font-size: 13.5px;
  color: var(--ink-2);
}

.attachments {
  margin: 16px 0 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.attachments .xl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}
.attach-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}
.attach-list li { margin: 4px 0; }
.attach-list .asize {
  color: var(--muted);
  font-size: 12px;
}
.attach-btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  letter-spacing: -0.01em;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.attach-btn:hover {
  background: var(--accent);
  color: #fff;
}
.attach-btn:disabled { opacity: 0.5; cursor: default; }

.opp-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.dec-btn, .card-btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--ink-2);
  letter-spacing: -0.01em;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.dec-btn:hover, .card-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--surface-2);
}
.dec-btn:active, .card-btn:active { transform: scale(0.98); }
.dec-btn:disabled, .card-btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.dec-accept {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 113, 227, 0.2);
}
.dec-accept:hover {
  background: var(--accent-hover);
  color: #fff;
  border-color: transparent;
}
.dec-hide:hover {
  border-color: var(--closed);
  color: var(--closed);
  background: var(--closed-soft);
}
.dec-return {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}
.dec-return:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pager {
  display: flex;
  justify-content: center;
  margin: 28px 0 8px;
}
.pager-btn {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--ink);
  letter-spacing: -0.016em;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
.pager-btn:hover { background: var(--surface-2); }
.pager-btn:active { transform: scale(0.98); }

.opp-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

footer.appfoot {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 0.5px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  letter-spacing: -0.01em;
}

/* ---- Report block & modal ---- */
.report-block {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.report-btn {
  border-color: transparent !important;
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}
.report-btn:hover {
  background: var(--accent) !important;
  color: #fff !important;
}
.report-status-line {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: -0.01em;
}
.report-status-line.err { color: var(--closed); }

.report-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 24px;
  padding-bottom: 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior: contain;
}
.report-modal[hidden] { display: none; }
.report-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: fade 0.25s var(--ease) both;
}
.report-modal-box {
  position: relative;
  z-index: 1;
  background: var(--surface-solid);
  border: 0.5px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  max-width: min(800px, 100%);
  width: 100%;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  animation: modal-in 0.35s var(--ease-spring) both;
}
.report-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--line);
  flex-shrink: 0;
  background: var(--surface-solid);
}
.report-modal-actions { display: flex; gap: 8px; }
.report-modal-body {
  padding: 28px 28px 40px;
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.016em;
  color: var(--ink);
  min-width: 0;
  max-width: 100%;
}
.report-modal-body h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  line-height: 1.15;
}
.report-modal-body h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.022em;
  margin: 32px 0 12px;
  padding-top: 20px;
  border-top: 0.5px solid var(--line);
}
.report-modal-body h2:first-child {
  padding-top: 0;
  border-top: none;
  margin-top: 0;
}
.report-modal-body h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 20px 0 8px;
}
.report-modal-body h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 6px;
  color: var(--ink-2);
}
.report-modal-body p { margin: 0 0 12px; color: var(--ink-2); }
.report-modal-body hr {
  border: none;
  border-top: 0.5px solid var(--line);
  margin: 24px 0;
}
.report-modal-body ul,
.report-modal-body ol {
  margin: 0 0 12px;
  padding-left: 22px;
  color: var(--ink-2);
}
.report-modal-body li { margin: 4px 0; }
.report-modal-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
}
.report-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 16px;
  max-width: 100%;
  /* Contain table scroll so it never widens the page */
  overscroll-behavior-x: contain;
}
.report-modal-body table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  max-width: none; /* allow internal horizontal scroll inside .report-table-wrap */
  font-size: 13px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 0.5px solid var(--line);
}
.report-modal-body th,
.report-modal-body td {
  border-bottom: 0.5px solid var(--line);
  border-right: 0.5px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.report-modal-body th:last-child,
.report-modal-body td:last-child { border-right: none; }
.report-modal-body tr:last-child td { border-bottom: none; }
.report-modal-body th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 12px;
  color: var(--muted-2);
}

/* ---- Admin cards ---- */
.card {
  background: var(--surface-solid);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
  margin-top: 16px;
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
  animation: rise 0.5s var(--ease-spring) both;
}
.card-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.022em;
  color: var(--ink);
}
.card-content {
  font-size: 14px;
  color: var(--ink-2);
  letter-spacing: -0.014em;
}
.note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  letter-spacing: -0.01em;
}
.note b { color: var(--ink-2); font-weight: 500; }

.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

textarea.field {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 15px;
  letter-spacing: -0.016em;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  line-height: 1.45;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
textarea.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
  background: var(--surface-solid);
}
.field-status {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  min-height: 16px;
  letter-spacing: -0.01em;
}
.field-status.ok { color: var(--go); }
.field-status.err { color: var(--closed); }

.big-stat {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 0 0 6px;
}
.big-stat-label {
  font-size: 15px;
  color: var(--muted);
  letter-spacing: -0.016em;
}

/* ---- Login page ---- */
body.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 32px;
  padding-bottom: 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-x: clip;
}
body.login-page .login-card {
  width: 100%;
  max-width: 400px;
  min-width: 0;
  background: var(--surface-solid);
  border: 0.5px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 32px;
  position: relative;
  animation: rise 0.55s var(--ease-spring) both;
}
body.login-page .theme-btn {
  position: absolute;
  top: 18px;
  right: 18px;
}
body.login-page h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 6px 0 6px;
  line-height: 1.1;
}
body.login-page .sub {
  margin: 0 0 28px;
  font-size: 15px;
  color: var(--muted);
  letter-spacing: -0.016em;
}
body.login-page label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--muted);
  margin-bottom: 8px;
}
body.login-page input + label {
  margin-top: 16px;
}
body.login-page input[type="email"],
body.login-page input[type="password"] {
  width: 100%;
  font: inherit;
  font-size: 17px;
  letter-spacing: -0.022em;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
body.login-page input[type="email"]:focus,
body.login-page input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
  background: var(--surface-solid);
}
body.login-page .error {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: var(--closed-soft);
  border: none;
  color: var(--ink);
  border-radius: var(--radius-sm);
  font-size: 13px;
  letter-spacing: -0.01em;
}
body.login-page .submit-btn {
  width: 100%;
  margin-top: 18px;
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.022em;
  color: #fff;
  background: var(--accent);
  border: none;
  padding: 14px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
body.login-page .submit-btn:hover { background: var(--accent-hover); }
body.login-page .submit-btn:active {
  background: var(--accent-pressed);
  transform: scale(0.99);
}
body.login-page footer.login-foot {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: -0.01em;
}

/* ---- Motion ---- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .fill { transition: none; }
}

@media print {
  html.report-modal-open .wrap { display: none; }
  html.report-modal-open .report-modal-backdrop,
  html.report-modal-open .report-modal-head { display: none; }
  html.report-modal-open .report-modal {
    position: static;
    padding: 0;
  }
  html.report-modal-open .report-modal-box {
    box-shadow: none;
    border: none;
    max-width: 100%;
    max-height: none;
    border-radius: 0;
  }
  html.report-modal-open .report-modal-body {
    overflow: visible;
    padding: 0;
  }
  body::before { display: none; }
}
