:root {
  --ink: #14181f;
  --ink-2: #3c4350;
  --muted: #6b7280;
  --paper: #f7f6f2;
  --card: #ffffff;
  --line: rgba(20, 24, 31, .09);
  --line-2: rgba(20, 24, 31, .16);
  --accent: #1d5c46;
  --accent-ink: #ffffff;
  --accent-soft: #e6efe9;
  --warn-soft: #fbf3e2;
  --warn: #8a5a10;
  --danger: #a1321f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 31, .04), 0 18px 44px -26px rgba(20, 24, 31, .28);
  --gutter: clamp(20px, 4vw, 40px);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--paper); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 .5em; font-variation-settings: 'opsz' 144; }
h1 { font-size: clamp(36px, 5vw, 56px); }
h2 { font-size: clamp(26px, 3vw, 36px); }
h3 { font-size: 20px; letter-spacing: -0.01em; font-variation-settings: normal; }
p { margin: 0 0 1em; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 14px; }
.eyebrow::before { content: ''; width: 18px; height: 1px; background: var(--accent); }
.hidden { display: none !important; }
.show-sm { display: none; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: rgba(247, 246, 242, .92); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--serif); font-weight: 500; font-size: 21px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 20px; margin-left: auto; align-items: center; font-size: 14px; }
.nav a { color: var(--ink-2); white-space: nowrap; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.gray { background: rgba(20, 24, 31, .06); color: var(--ink-2); }
.pill.danger { background: #f8e7e3; color: var(--danger); }

/* Buttons + inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 14px var(--sans); padding: 11px 18px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #174b39; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: #fff; border-color: var(--ink-2); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: transparent; color: var(--danger); border-color: #e6c4bc; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-block { width: 100%; }

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
input, select, textarea { width: 100%; font: 15px var(--sans); padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(29, 92, 70, .12); }
input::placeholder { color: #9a9ea6; }
.field { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-error { color: var(--danger); font-size: 14px; margin: 0 0 12px; min-height: 0; }
.form-error:empty { display: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: clamp(24px, 3vw, 36px); }

/* Search */
.search { position: relative; max-width: 680px; }
.search-box { display: flex; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); }
.search-box:focus-within { border-color: var(--line-2); }
.search-box input { flex: 1; min-width: 0; width: auto; border: 0; font-size: 16.5px; padding: 12px 10px; outline: none; box-shadow: none; }
.search-box svg { width: 20px; margin-left: 10px; color: var(--muted); flex: none; align-self: center; }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(20, 24, 31, .12); overflow: hidden; z-index: 10; }
.result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.result:last-child { border-bottom: 0; }
.result:hover, .result.active { background: var(--paper); text-decoration: none; }
.result .addr { font-weight: 500; }
.result-empty { padding: 16px; color: var(--muted); font-size: 14px; }
.price { font-family: var(--serif); font-size: 52px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.price small { font-family: var(--sans); font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.checks { list-style: none; padding: 0; margin: 20px 0 24px; }
.checks li { padding: 7px 0 7px 28px; position: relative; color: var(--ink-2); }
.checks li::before { content: ''; position: absolute; left: 0; top: 11px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.8' fill='none' stroke='%231d5c46' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; }

footer { padding: 36px 0; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
footer a { color: var(--ink-2); }
footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* Report page */
.report-head { padding: clamp(36px, 5vw, 64px) 0 32px; }
.report-head h1 { font-size: clamp(32px, 4.4vw, 52px); margin-bottom: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.back:hover { color: var(--ink); text-decoration: none; }
.report-grid { display: grid; grid-template-columns: 1fr 340px; gap: clamp(24px, 3vw, 40px); align-items: start; padding-bottom: 80px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 24px; }
.stat { padding: 20px 22px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: var(--serif); font-size: clamp(20px, 2.4vw, 28px); white-space: nowrap; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--muted); }
.facts { padding: 24px 26px; margin-bottom: 28px; }
.facts h3 { margin: 0 0 4px; }
.facts-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.facts-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 20px; margin: 0; }
.facts-grid dt { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.facts-grid dd { margin: 0; font-size: 15px; font-weight: 500; }
.facts-sub { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.facts-cta { display: flex; justify-content: space-between; align-items: center; gap: 16px 24px; flex-wrap: wrap; }
.facts-cta p { margin: 0; max-width: 34em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.chip b { color: var(--ink); font-weight: 600; margin-left: 4px; }

.timeline { position: relative; }
.rec { display: grid; grid-template-columns: 92px 1fr; gap: 24px; padding: 26px 0; border-top: 1px solid var(--line); }
.rec:first-child { border-top: 0; padding-top: 0; }
.connector .pill { align-self: flex-start; }
.rec-date { font-size: 13px; color: var(--muted); padding-top: 3px; }
.rec-date b { display: block; font-family: var(--serif); font-size: 22px; color: var(--ink); font-weight: 500; }
.rec h3 { font-family: var(--sans); font-size: 16px; font-weight: 600; letter-spacing: -0.005em; margin: 8px 0 6px; font-variation-settings: normal; }
.rec p { color: var(--ink-2); margin-bottom: 10px; }
.rec-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.rec-meta b { color: var(--ink-2); font-weight: 500; }
.verified { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 600; }
.verified svg { width: 14px; }

.locked { position: relative; }
.locked .rec { filter: blur(6px); user-select: none; pointer-events: none; }
.lock-overlay { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 60px; background: linear-gradient(180deg, rgba(247, 246, 242, .3), rgba(247, 246, 242, .85) 40%); }
.lock-card { max-width: 420px; text-align: center; padding: 34px; }
.lock-card .lock-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 14px; }
.lock-card .lock-icon svg { width: 20px; }
.side { position: sticky; top: 88px; }
.side .card-pad { padding: 24px; }
.empty-state { text-align: center; padding: 56px 24px; }
.banner { padding: 14px 18px; border-radius: 12px; font-size: 14px; margin-bottom: 20px; }
.banner.ok { background: var(--accent-soft); color: var(--accent); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

/* Auth */
.auth { max-width: 460px; margin: clamp(40px, 7vw, 88px) auto 96px; }
.tabs { display: flex; gap: 4px; background: rgba(20, 24, 31, .05); padding: 4px; border-radius: 10px; margin-bottom: 24px; }
.tab { flex: 1; text-align: center; padding: 8px; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; border: 0; background: transparent; font-family: var(--sans); }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* Contractor dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: clamp(36px, 5vw, 56px) 0 28px; flex-wrap: wrap; }
.dash-head h1 { font-size: clamp(32px, 4vw, 44px); margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.kpi { padding: 24px 26px; }
.kpi b { display: block; font-family: var(--serif); font-size: 38px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 4px; }
.kpi span { font-size: 13px; color: var(--muted); }
.panel { margin-bottom: 28px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 28px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 22px; margin: 0; }
.panel-body { padding: 28px; }
.connectors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.connector { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; background: #fff; }
.connector-top { display: flex; align-items: center; gap: 12px; }
.connector-logo { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px; flex: none; }
.connector h3 { font-family: var(--sans); font-size: 15px; margin: 0; }
.connector .help { font-size: 12.5px; color: var(--muted); }
.connector .actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 44px 28px; text-align: center; background: #fcfbf8; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone.drag, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 30px; color: var(--accent); margin-bottom: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; padding: 12px 16px; border-bottom: 1px solid var(--line); }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; }
.preview-summary { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 4px 0 18px; font-size: 14px; }
.preview-summary b { font-family: var(--serif); font-weight: 500; font-size: 24px; margin-right: 4px; }
.errors-list { max-height: 180px; overflow: auto; font-size: 13px; background: #fbf7f5; border: 1px solid #efdcd6; border-radius: 8px; padding: 10px 14px; color: var(--danger); margin-bottom: 16px; }
.mapping { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.mapping span { font-size: 12px; background: rgba(20, 24, 31, .05); border-radius: 6px; padding: 3px 8px; color: var(--ink-2); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 12px; max-width: calc(100vw - 32px); font-size: 14px; box-shadow: var(--shadow); z-index: 50; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-bg { position: fixed; inset: 0; background: rgba(20, 24, 31, .45); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal { max-width: 460px; width: 100%; }

@media (max-width: 900px) {
  .connectors, .kpis { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .side { position: static; }
  .stats, .facts-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .nav .hide-sm { display: none; }
  .nav .show-sm { display: inline; }
  .panel-head { flex-wrap: wrap; padding: 18px 20px; }
  .panel-body { padding: 20px; }
  .nav { gap: 14px; }
  .site-header .wrap { gap: 12px; }
  .search-box { flex-wrap: wrap; }
  .search-box .btn { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  .rec { grid-template-columns: 1fr; gap: 4px; }
}

/* Connect wizard */
.modal.wizard { max-width: 520px; }
.wz-head { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.wz-head h3 { margin: 0; font-family: var(--sans); font-size: 18px; font-weight: 600; font-variation-settings: normal; }
.wz-steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.wz-steps li { counter-increment: s; position: relative; padding-left: 36px; font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.wz-steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px; display: grid; place-items: center; }
.wz-steps b { color: var(--ink); }
.wz-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.wz-progress { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.wz-progress li { position: relative; padding-left: 32px; font-size: 14.5px; color: var(--muted); }
.wz-progress li::before { content: ''; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); box-sizing: border-box; }
.wz-progress li.on { color: var(--ink); font-weight: 500; }
.wz-progress li.on::before { border-color: var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.wz-progress li.done { color: var(--ink-2); }
.wz-progress li.done::before { border: 0; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.8' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }
.wz-progress li.fail { color: var(--danger); }
.wz-progress li.fail::before { border-color: var(--danger); }
.wz-done { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0 6px; }
.wz-big { background: var(--paper); border-radius: 10px; padding: 14px; text-align: center; }
.wz-big b { display: block; font-family: var(--serif); font-weight: 500; font-size: 28px; }
.wz-big span { font-size: 12.5px; color: var(--muted); }
.autosync { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 0; cursor: pointer; }
.autosync input { width: auto; margin: 0; accent-color: var(--accent); }
