:root {
  --ink: #12243a;
  --ink-soft: #2f2a42;
  --muted: #605b77;
  --line: #c9b8ff;
  --line-strong: #b49df8;
  --surface: #ffffff;
  --surface-soft: #f6f2ff;
  --surface-purple: #ede5ff;
  --purple-dark: #3f0fb4;
  --purple-deep: #320c90;
  --purple-soft: #ddccff;
  --purple-light: #f0eaff;
  --surface-purple-soft: #f1e8ff;
  --ms-subject: #3d108f;
  --ms-boardwalk: #4fa9ff;
  --ms-avenue: #42c28a;
  --ms-independent-1: #f59e0b;
  --ms-independent-2: #06b6d4;
  --ms-independent-3: #ef4444;
  --ms-independent-4: #22c55e;
  --ms-independent-5: #f97316;
  --surface-purple-strong: var(--surface-purple);
  --accent-primary: var(--purple-dark);
  --accent-dark: var(--purple-deep);
  --accent-light: var(--purple-soft);
  --amber: #9a6400;
  --amber-soft: #fff5dc;
  --red: #a1393f;
  --red-soft: #fff0f1;
  --success: #176b45;
  --success-line: #79c9a1;
  --success-soft: #e8f7ef;
  --accent: var(--purple-dark);
  --shadow: 0 14px 34px rgba(18, 36, 58, 0.08);
  --radius: 9px;
  --focus: 0 0 0 3px rgba(63, 15, 180, 0.26);
  color: var(--ink);
  background: var(--surface-soft);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--surface-soft); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: none; box-shadow: var(--focus); }
a { color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(1.65rem, 2.4vw, 2.25rem); letter-spacing: -0.035em; }
h2 { margin-bottom: 5px; font-size: 1.05rem; letter-spacing: -0.015em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 9999; top: 8px; left: 8px; transform: translateY(-150%); padding: 10px 14px; color: #fff; background: var(--ink); border-radius: 6px; }
.skip-link:focus { transform: none; }
.eyebrow { margin-bottom: 5px; color: var(--accent-primary); font-size: 0.68rem; font-weight: 850; letter-spacing: 0.11em; text-transform: uppercase; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.1fr) minmax(420px, 0.9fr); }
.auth-story { display: flex; flex-direction: column; justify-content: center; padding: clamp(42px, 8vw, 110px); color: #fff; background: radial-gradient(circle at 12% 18%, rgba(150, 118, 255, 0.2), transparent 28%), linear-gradient(145deg, #24113f, #3b1d86 82%); }
.auth-story .eyebrow { color: #d4c5ff; }
.auth-story h1 { max-width: 720px; font-size: clamp(2.7rem, 6vw, 5.2rem); line-height: 0.96; }
.product-mark { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 30px; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; color: #fff; background: rgba(255,255,255,.1); font-weight: 900; letter-spacing: -.05em; }
.product-mark-small { width: 38px; height: 38px; margin: 0; border-color: var(--ms-independent-2); color: var(--accent-dark); background: var(--surface-purple-strong); font-size: .8rem; }
.auth-panel { display: grid; place-items: center; padding: 32px; background: #fff; }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { font-size: 1.7rem; }
.auth-tabs { display: flex; gap: 4px; margin: 28px 0 20px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.auth-tab { flex: 1; min-height: 44px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; font-weight: 750; }
.auth-tab.is-active { color: var(--accent-dark); background: #fff; box-shadow: 0 1px 5px rgba(18,36,58,.12); }

.field { position: relative; display: grid; gap: 7px; min-width: 0; color: var(--ink-soft); font-size: .77rem; font-weight: 780; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 0 11px; color: var(--ink); background: #fff; font-size: .9rem; font-weight: 550; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #8498a9; }
.auth-card .field + .field { margin-top: 15px; }
.password-field { position: relative; }
.password-field input { padding-right: 56px; }
.password-toggle { position: absolute; z-index: 2; right: 0; top: 50%; width: 44px; height: 44px; display: grid; place-items: center; transform: translateY(-50%); border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.password-toggle:hover { color: var(--accent-dark); background: var(--surface-soft); }
.password-toggle:active { transform: translateY(-50%); }
.form-status { min-height: 23px; margin: 14px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.form-status.error { color: var(--red); }
.form-status.success { color: var(--accent-dark); }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 7px; padding: 0 15px; cursor: pointer; font-size: .82rem; font-weight: 820; transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .52; cursor: not-allowed; }
.button-primary { color: #fff; background: var(--accent-primary); border-color: var(--accent-primary); }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button-secondary { border-color: var(--line-strong); background: #fff; }
.button-secondary:hover:not(:disabled) { border-color: var(--accent-primary); color: var(--accent-dark); background: var(--surface-purple-strong); }
.button-wide { width: 100%; margin-top: 22px; }
.icon-button { width: 40px; min-height: 40px; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; }
.text-button { width: max-content; border: 0; padding: 0; color: var(--accent); background: transparent; cursor: pointer; font-size: .75rem; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; z-index: 500; top: 0; min-height: 50px; display: grid; grid-template-columns: minmax(235px, 1fr) auto minmax(235px, 1fr); align-items: center; gap: 20px; padding: 6px clamp(18px, 3vw, 42px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); backdrop-filter: blur(12px); }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font-size: .94rem; }
.brand-lockup span { color: var(--muted); font-size: .68rem; }
.topnav { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.nav-button { min-height: 34px; border: 0; border-radius: 5px; padding: 0 11px; color: var(--muted); background: transparent; cursor: pointer; font-size: .76rem; font-weight: 800; }
.nav-button.is-active { color: var(--accent-dark); background: #fff; box-shadow: 0 1px 4px rgba(18,36,58,.12); }
.account-menu { justify-self: end; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .76rem; }
.workspace { width: min(1600px, calc(100% - clamp(24px, 4vw, 64px))); margin: 0 auto; padding: 12px 0 44px; }
.section-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-title-row p { margin-bottom: 0; }
.decision-boundary { max-width: 350px; color: var(--muted); font-size: .78rem; }
.decision-boundary i { margin-right: 5px; color: var(--accent-primary); }
#compare-view > .section-title-row { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.market-mode-control { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.market-mode-control > div:first-child { min-width: 0; }
.market-mode-control strong, .market-mode-control span { display: block; }
.market-mode-control strong { color: var(--ink); font-size: .75rem; }
.market-mode-control span { margin-top: 2px; color: var(--muted); font-size: .68rem; line-height: 1.35; }
.market-mode-buttons { display: inline-grid; grid-template-columns: 1fr 1fr; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; }
.market-mode-button { min-height: 36px; border: 0; border-right: 1px solid var(--line); padding: 0 12px; color: var(--muted); background: transparent; cursor: pointer; font-size: .7rem; font-weight: 850; }
.market-mode-button:last-child { border-right: 0; }
.market-mode-button.is-active { color: #fff; background: var(--accent-primary); }
.market-mode-button:disabled { cursor: not-allowed; opacity: .52; }
.search-console { display: grid; grid-template-columns: minmax(320px, 2fr) repeat(3, minmax(145px, .8fr)) auto; align-items: end; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.search-mode-picker { min-width: 0; grid-column: 1 / -1; display: flex; align-items: end; gap: 10px; margin: 0; border: 0; padding: 0; }
.search-mode-picker legend { margin-bottom: 5px; color: var(--ink-soft); font-size: .68rem; font-weight: 800; }
.search-mode-options { display: inline-grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface-soft); }
.search-mode-button { min-width: 170px; min-height: 44px; display: grid; align-content: center; gap: 1px; border: 0; border-right: 1px solid var(--line); padding: 5px 12px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; }
.search-mode-button:last-child { border-right: 0; }
.search-mode-button strong { color: inherit; font-size: .76rem; }
.search-mode-button span { font-size: .62rem; }
.search-mode-button.is-active { color: #fff; background: var(--accent-primary); }
.search-mode-button:disabled { cursor: not-allowed; opacity: .52; }
.building-field { align-self: start; }
.building-field > .text-button { position: absolute; top: 0; right: 0; font-size: .66rem; }
.building-field.is-selected .combobox-shell input { border-color: var(--ms-independent-3); background: var(--surface-purple-soft); }
.combobox-shell { position: relative; }
.combobox-shell input { padding-left: 35px; padding-right: 36px; }
.field-icon { position: absolute; z-index: 2; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.clear-field { position: absolute; right: 5px; top: 4px; width: 36px; height: 36px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; }
.combobox-results { position: absolute; z-index: 900; top: 69px; width: min(560px, calc(100vw - 44px)); max-height: 310px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; box-shadow: var(--shadow); }
.building-option { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; border: 0; border-bottom: 1px solid var(--line); padding: 11px 13px; text-align: left; background: #fff; cursor: pointer; }
.building-option:last-child { border-bottom: 0; }
.building-option:hover, .building-option.is-active { background: var(--surface-purple-strong); }
.building-option strong { font-size: .82rem; }
.building-option span { color: var(--muted); font-size: .72rem; }
.building-option em { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--accent-dark); font-size: .68rem; font-style: normal; font-weight: 800; }
.selected-building { display: none; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--ms-independent-4); border-radius: 5px; color: var(--ink-soft); background: var(--surface-purple-strong); font-size: .72rem; font-weight: 600; }
.money-input { height: 44px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; }
.money-input > span { padding: 0 9px; color: var(--muted); font-size: .72rem; }
.money-input input { min-height: 40px; border: 0; outline: none; box-shadow: none; padding: 0; background: transparent; appearance: textfield; }
.money-input input:focus { outline: none; box-shadow: none; }
.money-input:focus-within { border-color: var(--line-strong); box-shadow: none; }
.field.is-area-disabled { color: #7a7f89; }
.field.is-area-disabled .money-input { border-color: #c7ccd4; background: #e5e7eb; }
.field.is-area-disabled .money-input > span,
.field.is-area-disabled .money-input input { color: #6b7280; cursor: not-allowed; }
.rent-delta { display: block; margin-top: 2px; font-size: .62rem; font-weight: 800; line-height: 1; }
.rent-delta.is-positive { color: #9b3f32; }
.rent-delta.is-negative { color: #16803a; }
.search-source-picker { min-width: 0; grid-column: 1 / -2; margin: 0; border: 0; padding: 0; }
.search-source-picker legend { margin-bottom: 5px; color: var(--ink-soft); font-size: .68rem; font-weight: 800; }
.search-source-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.search-source-option { position: relative; min-width: 0; min-height: 58px; display: flex; align-items: center; gap: 8px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 9px; background: #fff; cursor: pointer; transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease, opacity 160ms ease; }
.search-source-option::before { content: ""; position: absolute; z-index: 0; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #e7f8eb, #c9efd3); }
.search-source-option > * { position: relative; z-index: 1; }
.search-source-option input { width: 17px; height: 17px; flex: 0 0 auto; margin: 0; accent-color: var(--success); }
.search-source-option span { min-width: 0; display: grid; gap: 2px; }
.search-source-option strong, .search-source-option small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-source-option strong { font-size: .7rem; }
.search-source-option small { color: var(--muted); font-size: .58rem; font-weight: 750; }
.search-source-option.is-searching { border-color: var(--success-line); }
.search-source-option.is-searching::before { animation: search-source-green-fill 120s linear forwards; }
.search-source-option.is-complete { border-color: var(--success); }
.search-source-option.is-complete::before { width: 100%; }
.search-source-option.is-complete small { color: #176f3b; }
.search-source-option.is-warning { border-color: #d6b66b; background: var(--amber-soft); }
.search-source-option.is-warning::before { display: none; }
.search-source-option.is-warning small { color: #765400; }
.search-source-option.is-unavailable { border-color: #e2a7ac; background: var(--red-soft); }
.search-source-option.is-unavailable::before { display: none; }
.search-source-option.is-unavailable small { color: var(--red); }
.search-source-option.is-excluded { border-color: var(--line); color: var(--muted); background: var(--surface-soft); opacity: .68; }
.search-source-option.is-excluded::before { display: none; }
.search-source-option:focus-within { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.search-source-option input:disabled { cursor: not-allowed; }
@keyframes search-source-green-fill { from { width: 0; } to { width: 100%; } }
.run-button { min-width: 152px; grid-column: -2 / -1; }

.trace-panel { display: grid; grid-template-columns: 1fr; align-items: center; gap: 12px; margin-top: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.trace-scroll { display: flex; gap: 6px; overflow-x: auto; padding: 3px 1px; scrollbar-width: thin; }
.trace-scroll:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 3px; }
.trace-step { flex: 0 0 auto; min-width: 76px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface-soft); font-size: .62rem; line-height: 1.3; }
.trace-step strong { display: block; color: var(--ink-soft); font-size: .72rem; }
.trace-step.has-results { border-color: var(--ms-independent-1); color: var(--accent-dark); background: var(--surface-purple-strong); }

.search-status { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-soft); background: #fff; font-size: .72rem; }
.search-status.working { border-color: var(--ms-independent-2); background: var(--surface-purple); }
.search-status.warning { border-color: #d6b66b; background: var(--amber-soft); }
.search-status.error { border-color: #e2a7ac; background: var(--red-soft); }
.source-status-details { margin-top: 6px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .68rem; }
.source-status-details summary { padding: 6px 2px 2px; color: var(--accent-dark); cursor: pointer; font-weight: 800; }
.source-status-detail-list { display: grid; gap: 4px; margin: 4px 0 6px; padding-left: 18px; }
.source-status-detail-list li { line-height: 1.35; }
.queue-meter { min-width: 170px; height: 6px; overflow: hidden; border-radius: 999px; background: #dbcfff; }
.queue-meter span { display: block; height: 100%; background: var(--accent); animation: progress-sweep 1.8s ease-in-out infinite; }
@keyframes progress-sweep { 0% { width: 10%; transform: translateX(-100%); } 50% { width: 55%; } 100% { width: 20%; transform: translateX(520%); } }

.map-shell { display: grid; gap: 0; margin-top: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 1px 0 rgba(18,36,58,.02); }
.map-shell-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.map-shell-header h2 { margin-bottom: 2px; font-size: 1.05rem; }
.map-shell-address { margin-bottom: 0; color: var(--muted); font-size: .8rem; }
.result-market-mode { width: fit-content; margin: 5px 0 0; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: var(--surface-soft); font-size: .64rem; font-weight: 800; }
.result-market-mode.night-cache { border-color: #d6b66b; background: var(--amber-soft); }
.map-shell-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.map-collapse-button { width: 44px; height: 44px; flex: 0 0 auto; }
.map-shell-body { position: relative; min-height: clamp(420px, 66vh, 760px); background: var(--surface-purple); }
.map-stage { position: relative; height: 100%; min-height: inherit; overflow: hidden; }
.map-shell .market-map { height: 100%; min-height: inherit; }
.map-shell-footer { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: #fff; }
.map-shell.is-collapsed .map-shell-body,
.map-shell.is-collapsed .map-shell-footer { display: none; }
.map-shell.is-locked .leaflet-container { cursor: crosshair; }
.map-shell.is-locked .leaflet-control-zoom { pointer-events: none; opacity: .58; }
.map-shell.is-searching .map-shell-header { border-bottom-color: var(--ms-independent-3); }
.map-radar { position: absolute; z-index: 450; left: 50%; top: 50%; width: min(72%, 60vh, 620px); aspect-ratio: 1; overflow: hidden; border: 2px solid rgba(88,22,198,.45); border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); background: radial-gradient(circle at center, rgba(102,24,225,.1), rgba(102,24,225,.025) 52%, rgba(102,24,225,.08)); box-shadow: inset 0 0 32px rgba(88,22,198,.14), 0 0 0 1px rgba(255,255,255,.72); }
.map-radar-sweep { position: absolute; inset: 0; border-radius: inherit; transform-origin: center; animation: map-radar-reach-12321 16s cubic-bezier(.45,0,.55,1) infinite; filter: blur(1px); will-change: transform; }
.map-radar-sweep::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: conic-gradient(from 0deg, rgba(102,24,225,0) 0deg, rgba(102,24,225,.04) 300deg, rgba(102,24,225,.22) 338deg, rgba(102,24,225,.58) 352deg, rgba(102,24,225,0) 360deg); animation: map-radar-rotate 2.04s linear infinite; will-change: transform; }
.map-radar-core { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: rgba(102,24,225,.9); box-shadow: 0 0 0 10px rgba(102,24,225,.14), 0 0 0 28px rgba(102,24,225,.08); animation: map-radar-pulse 1.8s ease-in-out infinite; }
@keyframes map-radar-reach-12321 {
  0%, 18.75% { transform: scale(.3333); }
  25%, 43.75% { transform: scale(.6667); }
  50%, 68.75% { transform: scale(1); }
  75%, 93.75% { transform: scale(.6667); }
  100% { transform: scale(.3333); }
}
@keyframes map-radar-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes map-radar-pulse { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.12); } }
.map-radar-radius-label { background: transparent; border: 0; }
.map-radar-radius-label span { display: inline-block; padding: 3px 6px; border: 1px solid rgba(126,63,242,.55); border-radius: 999px; color: #4b1d95; background: rgba(255,255,255,.94); box-shadow: 0 2px 7px rgba(33,18,62,.18); font-size: .68rem; font-weight: 800; line-height: 1; white-space: nowrap; }

.map-pin { width: 30px; height: 30px; display: grid !important; place-items: center; border: 2px solid #fff; border-radius: 6px; color: #fff; background: var(--pin-color, var(--accent-primary)); box-shadow: 0 3px 10px rgba(18,36,58,.28); transform: rotate(45deg); }
.map-pin.subject { box-shadow: 0 0 0 3px rgba(126,63,242,.18), 0 3px 10px rgba(18,36,58,.3); }
.map-pin-label { display: block; transform: rotate(-45deg); font-size: 10px; font-weight: 900; line-height: 1; }

.leaflet-tooltip.map-tooltip-shell { padding: 0; border: 0; border-radius: 10px; background: transparent; box-shadow: none; }
.leaflet-tooltip.map-tooltip-shell .leaflet-tooltip-content-wrapper { overflow: visible; }
.map-tooltip-card { min-width: 118px; display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; box-shadow: var(--shadow); }
.map-tooltip-card strong { font-size: .76rem; line-height: 1.25; }
.map-tooltip-card span { color: var(--ink-soft); font-size: .7rem; line-height: 1.25; }
.map-tooltip-inline { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.map-tooltip-inline span + span::before { content: "·"; margin-right: 5px; color: var(--muted); }

.map-shell.is-collapsed .map-collapse-button i { transform: translateY(1px); }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; margin-top: 12px; }
.evidence-panel, .rail-panel, .detail-panel, .history-list, .usage-grid { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.evidence-panel { overflow: hidden; }
.panel-heading, .rail-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.panel-heading p, .rail-heading p { margin-bottom: 0; }
.table-scroll { min-height: 240px; overflow: auto; }
table { width: 100%; min-width: 820px; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; font-size: .68rem; }
th { position: sticky; z-index: 3; top: 0; color: var(--muted); background: #f7f9fa; font-size: .64rem; letter-spacing: .03em; text-transform: uppercase; }
tbody tr.result-row { cursor: pointer; }
tbody tr.result-row:hover, tbody tr.result-row.is-selected { background: var(--surface-purple); }
tbody tr.result-row:focus-visible { position: relative; z-index: 2; outline: 2px solid var(--accent-primary); outline-offset: -2px; }
.source-cell strong, .building-cell strong, .unit-cell strong, .rent-cell strong { display: block; margin-bottom: 2px; font-size: .7rem; }
.building-cell span, .unit-cell span { display: block; color: var(--muted); line-height: 1.25; }
.money { font-variant-numeric: tabular-nums; }
.table-source-link { display: inline-flex; align-items: center; gap: 4px; border-bottom: 1px solid currentColor; color: var(--accent); font-size: .67rem; font-weight: 800; white-space: nowrap; }
.link-unavailable { color: var(--muted); font-size: .65rem; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border: 1px solid currentColor; border-radius: 999px; padding: 3px 7px; font-size: .62rem; font-weight: 850; white-space: nowrap; }
.status-badge.verified, .status-badge.complete, .status-badge.human-confirmed, .status-badge.working { color: var(--success); background: var(--success-soft); }
.status-badge.searching { color: var(--ms-independent-2); background: var(--surface-purple-soft); }
.status-badge.partial, .status-badge.incomplete, .status-badge.blocked, .status-badge.stale, .status-badge.no-match, .status-badge.changed { color: #765000; background: var(--amber-soft); }
.status-badge.interrupted { color: #765000; background: var(--amber-soft); }
.status-badge.failed, .status-badge.unavailable, .status-badge.broken { color: var(--red); background: var(--red-soft); }
.status-badge.neutral { color: var(--muted); background: var(--surface-soft); }
.empty-state { min-height: 360px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-state i { font-size: 1.7rem; color: #8f88aa; }
.empty-state strong { color: var(--ink-soft); }
.empty-state span { max-width: 360px; font-size: .76rem; }

.rail-panel { min-width: 0; overflow: hidden; }
.market-map { height: 330px; background: var(--surface-purple); }
.map-number { width: 28px !important; height: 28px !important; display: grid !important; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: var(--accent-primary); box-shadow: 0 2px 8px rgba(18,36,58,.28); font-size: 11px; font-weight: 900; }
.map-number.subject { background: var(--ms-subject); }

.night-cache-view-switch { display: inline-flex; gap: 3px; margin-top: 12px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.night-cache-view-button { min-height: 38px; border: 0; border-radius: 6px; padding: 0 16px; color: var(--muted); background: transparent; font-size: .72rem; font-weight: 850; cursor: pointer; }
.night-cache-view-button:hover { color: var(--ink); background: #fff; }
.night-cache-view-button.is-active { color: #fff; background: var(--accent-primary); box-shadow: 0 1px 4px rgba(18,36,58,.18); }
.night-cache-view-button:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

.source-dashboard-panel { margin-top: 10px; }
.source-dashboard-table { width: 100%; min-width: 0; table-layout: fixed; }
.source-dashboard-table th,
.source-dashboard-table td { padding: 6px 5px; overflow-wrap: anywhere; }
.source-dashboard-table th { white-space: normal; line-height: 1.1; }
.source-dashboard-table:not(.source-search-dashboard-table) th:nth-child(1) { width: 10%; }
.source-dashboard-table:not(.source-search-dashboard-table) th:nth-child(n+2) { width: 8.18%; }
.source-search-dashboard-table th:nth-child(1) { width: 10%; }
.source-search-dashboard-table th:nth-child(n+2) { width: 9%; }
.source-dashboard-table td { font-size: .62rem; line-height: 1.25; }
.source-price-summary { display: inline-flex; flex-direction: column; gap: 1px; }
.source-dashboard-table .source-dashboard-stage {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 6px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: .58rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.source-dashboard-table .source-dashboard-stage.complete { color: var(--success); border-color: var(--success-line); background: var(--success-soft); }
.source-dashboard-table .source-dashboard-stage.searching { color: var(--ms-independent-2); border-color: #9bcfda; background: var(--surface-purple-soft); }
.source-dashboard-table .source-dashboard-stage.neutral { color: var(--muted); border-color: var(--line); background: var(--surface-soft); }
.source-dashboard-table .source-dashboard-stage.partial,
.source-dashboard-table .source-dashboard-stage.incomplete,
.source-dashboard-table .source-dashboard-stage.stale,
.source-dashboard-table .source-dashboard-stage.interrupted,
.source-dashboard-table .source-dashboard-stage.blocked,
.source-dashboard-table .source-dashboard-stage.no-match { color: #765000; border-color: #d6b66b; background: var(--amber-soft); }
.source-dashboard-table .source-dashboard-stage.failed,
.source-dashboard-table .source-dashboard-stage.unavailable { color: var(--red); border-color: #e2a7ac; background: var(--red-soft); }

.source-dashboard-status-note { display: block; margin-top: 2px; color: var(--muted); font-size: .61rem; line-height: 1.25; }
.usage-dashboard { margin-top: 12px; }
.cache-count-note { margin: 0; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .65rem; line-height: 1.45; }

.table-scroll.table-scroll-compact { min-height: 180px; }

.detail-panel { margin-top: 12px; overflow: hidden; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); }
.detail-item { min-width: 0; padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-item:nth-child(4n) { border-right: 0; }
.detail-item span { display: block; margin-bottom: 4px; color: var(--muted); font-size: .63rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.detail-item strong, .detail-item p { overflow-wrap: anywhere; font-size: .76rem; line-height: 1.45; }
.detail-item p { margin: 0; color: var(--ink-soft); }
.source-evidence-list { display: grid; gap: 8px; }
.source-evidence-entry { display: grid; gap: 2px; }
.source-evidence-entry span { color: var(--muted); font-size: .72rem; line-height: 1.35; }
.note-panel { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 14px; background: #f7f9fa; }
.note-panel p { margin: 3px 0 0; color: var(--muted); font-size: .68rem; }
.note-panel form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.note-panel select { min-height: 44px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 9px; background: #fff; }
.note-panel textarea { min-height: 72px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 7px; padding: 9px; }
.notes-list { display: grid; gap: 6px; }
.note { padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font-size: .72rem; }
.note time { display: block; margin-top: 4px; color: var(--muted); font-size: .62rem; }
.recheck-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 10px 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.recheck-panel p { margin: 3px 0 0; }
.recheck-panel form { display: grid; grid-template-columns: auto minmax(150px,1fr) auto 130px minmax(0,1fr) auto; align-items: center; gap: 8px; }
.recheck-panel select, .recheck-panel input { min-height: 34px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 9px; background: #fff; }
.rechecks-list { grid-column: 2; display: grid; gap: 6px; }
.recheck { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 7px 9px; background: #fff; font-size: .68rem; }
.recheck time { color: var(--muted); font-size: .62rem; }

.history-list { overflow: hidden; }
.history-load-more { display: flex; width: fit-content; margin: 14px auto; }
.history-item { width: 100%; display: grid; grid-template-columns: 180px minmax(0,1fr) 140px auto; align-items: center; gap: 16px; border: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; text-align: left; background: #fff; cursor: pointer; }
.history-item:last-child { border-bottom: 0; }
.history-item:hover { background: var(--surface-purple-strong); }
.history-item strong, .history-item span { display: block; }
.history-item span { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.history-item .history-market-mode { width: fit-content; margin-top: 5px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 999px; font-size: .61rem; font-weight: 800; }
.history-item .history-market-mode.night-cache { border-color: #d6b66b; color: #7d5900; background: var(--amber-soft); }
.usage-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); overflow: hidden; }
.usage-filters { display: flex; gap: 12px; align-items: end; margin: 16px 0; flex-wrap: wrap; }
.usage-filters label { display: grid; gap: 5px; color: var(--muted); font-size: .78rem; }
.usage-filters select, .usage-filters input { min-height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; }
.usage-table-wrap { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.usage-tab-list { display: flex; gap: 8px; margin-top: 18px; }
.usage-tab-button { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px 14px; color: var(--ink); cursor: pointer; }
.usage-tab-button[aria-selected="true"] { background: var(--ink); color: #fff; }
.usage-table { width: 100%; border-collapse: collapse; }
.usage-table th, .usage-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.usage-item { padding: 24px; border-right: 1px solid var(--line); }
.usage-item:last-child { border-right: 0; }
.usage-item strong { display: block; font-size: 2rem; font-variant-numeric: tabular-nums; }
.usage-item span { color: var(--muted); font-size: .75rem; }

.resolve-dialog { width: min(520px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 10px; padding: 0; color: var(--ink); box-shadow: var(--shadow); }
.resolve-dialog::backdrop { background: rgba(10,25,40,.58); }
.resolve-dialog form { display: grid; gap: 14px; padding: 20px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.inline-warning { padding: 10px 12px; border: 1px solid #d6b66b; border-radius: 5px; color: #674700; background: var(--amber-soft); font-size: .75rem; line-height: 1.5; }
.toast { position: fixed; z-index: 2000; right: 20px; bottom: 20px; max-width: 380px; padding: 11px 14px; border-radius: 7px; color: #fff; background: var(--ink); box-shadow: var(--shadow); font-size: .78rem; }

@media (max-width: 1180px) {
  .search-console { grid-template-columns: 2fr repeat(3, 1fr); }
  .search-source-picker,
  .run-button { grid-column: 1 / -1; }
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: repeat(3, 1fr); }
  .detail-item:nth-child(4n) { border-right: 1px solid var(--line); }
  .detail-item:nth-child(3n) { border-right: 0; }
}

@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { min-height: 38vh; padding: 42px 28px; }
  .auth-story h1 { font-size: 3rem; }
  .auth-panel { padding: 38px 24px; }
  .topbar { grid-template-columns: 1fr auto; }
  .topnav { grid-row: 2; grid-column: 1 / -1; justify-content: stretch; }
  .nav-button { flex: 1; }
  .account-menu span { display: none; }
  .market-mode-control { align-items: stretch; flex-direction: column; }
  .market-mode-buttons { width: 100%; }
  .search-console { grid-template-columns: 1fr 1fr; }
  .building-field { grid-column: 1 / -1; }
  .search-source-picker { grid-column: 1 / -1; }
  .search-source-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trace-panel { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2,1fr); }
  .detail-item:nth-child(3n) { border-right: 1px solid var(--line); }
  .detail-item:nth-child(2n) { border-right: 0; }
  .history-item { grid-template-columns: 1fr auto; }
  .history-item > *:nth-child(2), .history-item > *:nth-child(3) { grid-column: 1; }
  .map-shell-body { min-height: clamp(380px, 60vh, 640px); }
  .map-shell-footer { flex-direction: column; align-items: flex-start; }
  .map-shell-footer .button { width: 100%; }
}

@media (max-width: 620px) {
  .workspace { width: min(100% - 20px, 1600px); padding-top: 18px; }
  .section-title-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  #compare-view > .section-title-row { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .market-mode-button { min-height: 42px; padding: 0 9px; }
  .search-console { grid-template-columns: 1fr; padding: 12px; }
  .search-mode-picker { align-items: stretch; flex-direction: column; }
  .search-mode-options { width: 100%; }
  .search-mode-button { min-width: 0; min-height: 50px; }
  .building-field, .search-source-picker, .run-button { grid-column: auto; }
  .search-source-options { grid-template-columns: 1fr 1fr; }
  .building-field > .text-button { position: static; }
  .selected-building:not([hidden]) { display: block; }
  .run-button { min-height: 48px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading .button { width: 100%; }
  .map-shell-header, .map-shell-footer { padding-left: 12px; padding-right: 12px; }
  .map-shell-body { min-height: 360px; }
  .map-radar { width: min(82%, 320px); }
  .map-collapse-button { width: 40px; height: 40px; }
  .map-tooltip-card { min-width: 138px; }
  .table-scroll { overflow: visible; min-height: 0; }
  table, thead, tbody, th, td, tr { display: block; min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .group-row th { padding: 9px 11px; }
  tbody tr.result-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 8px 10px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
  tbody tr.result-row td { min-width: 0; border-right: 1px solid var(--line); padding: 9px 10px; }
  tbody tr.result-row td:nth-child(2n) { border-right: 0; }
  tbody tr.result-row td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: .58rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
  tbody tr.result-row td { font-size: .8125rem; line-height: 1.4; }
  tbody tr.result-row td::before { font-size: .68rem; }
  tbody tr.result-row .source-cell strong, tbody tr.result-row .building-cell strong, tbody tr.result-row .rent-cell strong { font-size: .84rem; }
  tbody tr.result-row .source-cell span, tbody tr.result-row .building-cell span, tbody tr.result-row .rent-cell span { font-size: .76rem; }
  tbody tr.result-row .evidence-link { font-size: .76rem; }
  .evidence-link { min-height: 44px; padding: 8px 0; }
  tbody tr.result-row .status-badge { font-size: .7rem; }
  .source-dashboard-table { min-width: 0; }
  .night-cache-view-switch { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .night-cache-view-button { min-height: 44px; padding: 0 8px; }
  .source-dashboard-table tbody tr { margin: 0 8px 10px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
  .source-dashboard-table tbody td { display: grid; grid-template-columns: minmax(105px, .8fr) minmax(0, 1.2fr); gap: 10px; align-items: start; border-bottom: 1px solid var(--line); padding: 8px 10px; font-size: .72rem; }
  .source-dashboard-table tbody td:last-child { border-bottom: 0; }
  .source-dashboard-table tbody td::before { content: attr(data-label); color: var(--muted); font-size: .61rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
  .source-dashboard-table .source-dashboard-status-note { grid-column: 2; margin-top: 4px; }
  .mobile-detail-row td { padding: 0; }
  .mobile-detail-row .detail-panel { margin: 0 8px 10px; }
  .nav-button, .icon-button, .clear-field, .building-field > .text-button { min-height: 44px; min-width: 44px; }
  .building-field > .text-button { display: inline-flex; align-items: center; width: fit-content; }
  .empty-state { min-height: 260px; padding: 20px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item, .detail-item:nth-child(n) { border-right: 0; }
  .note-panel { grid-template-columns: 1fr; }
  .note-panel form { grid-template-columns: 1fr; }
  .notes-list { grid-column: 1; }
  .recheck-panel { grid-template-columns: 1fr; }
  .recheck-panel form { grid-template-columns: 1fr; }
  .rechecks-list { grid-column: 1; }
  .recheck { grid-template-columns: 1fr; }
  .recheck-panel select, .recheck-panel input { min-height: 44px; }
  .leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 44px !important; }
  .usage-grid { grid-template-columns: 1fr; }
  .usage-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .usage-item:last-child { border-bottom: 0; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

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