/* NeedohFinder — Apple-inspired Spectrum field UI */
:root {
  --bg: #f2f2f7;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --bg-solid: #ffffff;
  --bg-grouped: #f2f2f7;
  --fill: rgba(120, 120, 128, 0.12);
  --line: rgba(60, 60, 67, 0.12);
  --label: #000000;
  --label-secondary: rgba(60, 60, 67, 0.6);
  --label-tertiary: rgba(60, 60, 67, 0.35);
  --blue: #007aff;
  --blue-press: #0066d6;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --yellow: #ffcc00;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: rgba(28, 28, 30, 0.78);
    --bg-solid: #1c1c1e;
    --bg-grouped: #000000;
    --fill: rgba(120, 120, 128, 0.24);
    --line: rgba(84, 84, 88, 0.65);
    --label: #ffffff;
    --label-secondary: rgba(235, 235, 245, 0.6);
    --label-tertiary: rgba(235, 235, 245, 0.3);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 28px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg-grouped); color: var(--label);
  font-family: var(--font); font-size: 17px; line-height: 1.29;
  letter-spacing: -0.022em; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
#app { min-height: 100%; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; flex-direction: column; gap: 10px;
  padding: calc(8px + var(--safe-top)) 16px 10px;
  background: var(--bg-elevated);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #ffe566, #ff9f0a);
  box-shadow: var(--shadow); font-size: 20px;
}
.brand strong { display: block; font-size: 17px; font-weight: 700; }
.brand small { color: var(--label-secondary); font-size: 12px; }
.tabs {
  display: flex; gap: 4px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; color: var(--label-secondary);
  padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 14px;
  white-space: nowrap; min-height: 36px;
}
.tab.active { background: var(--fill); color: var(--label); }

main {
  flex: 1; padding: 12px 16px calc(28px + var(--safe-bottom));
  max-width: 560px; width: 100%; margin: 0 auto;
}
.view { display: none; }
.view.active { display: block; }

.banner, .banner-live {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-lg);
  background: var(--bg-solid); border: 0.5px solid var(--line);
  box-shadow: var(--shadow); margin-bottom: 14px; font-size: 14px;
  color: var(--label-secondary);
}
.banner strong { display: block; color: var(--label); margin-bottom: 4px; }
.banner-live { align-items: center; }
.banner-live .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.18); flex-shrink: 0;
}
.banner-live.busy .dot { background: var(--orange); animation: pulse 1s infinite; }
.banner-live.err .dot { background: var(--red); }
@keyframes pulse { 50% { opacity: 0.45; } }

.hero {
  padding: 18px 16px; border-radius: 20px;
  background: linear-gradient(160deg, rgba(255, 204, 0, 0.22), rgba(255, 149, 0, 0.08)), var(--bg-solid);
  border: 0.5px solid var(--line); box-shadow: var(--shadow); margin-bottom: 16px;
}
.hero.compact { background: var(--bg-solid); }
.eyebrow {
  margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 11px; font-weight: 700; color: var(--orange);
}
.hero h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.03em; line-height: 1.1; }
.hero p { margin: 0 0 14px; color: var(--label-secondary); font-size: 15px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 650;
  min-height: 44px; background: var(--fill); color: var(--label); cursor: pointer;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:active { background: var(--blue-press); }
.btn.secondary { background: var(--fill); }
.btn.ghost { background: transparent; color: var(--blue); }
.btn.danger { background: rgba(255, 59, 48, 0.14); color: var(--red); }
.btn.sm { min-height: 34px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }

.section-title {
  margin: 18px 0 10px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--label-secondary);
}
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-between .section-title { margin: 8px 0; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px;
}
.stat {
  background: var(--bg-solid); border: 0.5px solid var(--line);
  border-radius: var(--radius); padding: 12px 10px; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 20px; letter-spacing: -0.02em; }
.stat span { font-size: 11px; color: var(--label-secondary); font-weight: 600; }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.item-card {
  background: var(--bg-solid); border: 0.5px solid var(--line);
  border-radius: var(--radius-lg); padding: 14px; box-shadow: var(--shadow);
  text-align: left; width: 100%; color: inherit; cursor: pointer;
}
.item-card.link-card { display: block; text-decoration: none; }
.item-title { font-weight: 700; font-size: 16px; }
.item-meta { margin-top: 4px; color: var(--label-secondary); font-size: 14px; }
.muted { color: var(--label-secondary); font-size: 14px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge {
  font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 999px;
  background: var(--fill); color: var(--label-secondary);
}
.badge.ok { background: rgba(52, 199, 89, 0.16); color: var(--green); }
.badge.warn { background: rgba(255, 149, 0, 0.16); color: var(--orange); }
.badge.bad { background: rgba(255, 59, 48, 0.14); color: var(--red); }
.badge.blue { background: rgba(0, 122, 255, 0.14); color: var(--blue); }

.search-row { margin-bottom: 10px; }
.search-row select, .form-card input, .form-card select {
  width: 100%; border: 0; background: var(--bg-solid);
  border-radius: 12px; padding: 12px 14px; min-height: 48px;
  border: 0.5px solid var(--line); box-shadow: var(--shadow);
}
.form-card {
  background: var(--bg-solid); border: 0.5px solid var(--line);
  border-radius: var(--radius-lg); padding: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.form-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 650; color: var(--label-secondary); }

.tips {
  margin: 0; padding-left: 18px; color: var(--label-secondary); font-size: 14px;
}
.tips li { margin: 8px 0; }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 100; }
.sheet.hidden { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.36); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: min(88dvh, 720px); overflow: auto;
  background: var(--bg-solid);
  border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(20px + var(--safe-bottom));
  box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
}
.sheet-handle {
  width: 36px; height: 5px; border-radius: 99px; background: var(--fill);
  margin: 6px auto 12px;
}
.sheet-panel h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.sheet-actions {
  display: flex; flex-direction: column; gap: 8px; margin-top: 14px;
}
.sheet-actions .row { display: flex; flex-wrap: wrap; gap: 8px; }
.addr-block {
  margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--fill);
  font-weight: 600; line-height: 1.35;
}
.report-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.empty {
  text-align: center; padding: 28px 12px; color: var(--label-secondary);
  background: var(--bg-solid); border-radius: var(--radius-lg); border: 0.5px dashed var(--line);
}
