/* Kingsgate Estate — clean professional, white with deep blue accents. Shared by both surfaces. */
:root {
  --navy: #0b2a5b; --navy-700: #0f3a7d; --blue: #1d4ed8; --blue-100: #e8effc; --blue-50: #f3f7ff;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --bg: #ffffff; --bg-2: #f7f9fc;
  --ok: #047857; --ok-bg: #ecfdf5; --warn: #b45309; --warn-bg: #fffbeb; --bad: #b91c1c; --bad-bg: #fef2f2;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(11,42,91,.08);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 16px; overflow-x: hidden; overflow-wrap: break-word; }
img, svg { max-width: 100%; }
a { color: var(--blue); }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.15; letter-spacing: -.01em; color: var(--navy); }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); } h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); } h3 { font-size: 1.15rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .tiny { font-size: .78rem; }
.money, .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.money { font-weight: 600; }
.wrap { width: min(1180px, 100% - 32px); margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; position: relative; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); font-weight: 700; }
.brand img { height: 36px; width: auto; }
.brand .tag { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); font-weight: 600; }
nav.main { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
nav.main a { text-decoration: none; color: var(--ink-2); padding: 12px 12px; border-radius: 10px; font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
nav.main a:hover, nav.main a:focus-visible { background: var(--blue-50); color: var(--navy); outline: none; }
nav.main a.active { background: var(--blue-100); color: var(--navy); }
.menu-btn { display: none; margin-left: auto; }
@media (max-width: 900px) {
  nav.main { display: none; position: absolute; left: -16px; right: -16px; top: 64px; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px 16px; flex-direction: column; align-items: stretch; box-shadow: var(--shadow); }
  nav.main.open { display: flex; }
  .menu-btn { display: inline-flex; }
}

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s, box-shadow .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; } .btn-primary:hover { background: var(--navy-700); }
.btn-blue { background: var(--blue); color: #fff; } .btn-blue:hover { background: #1e40af; }
.btn-outline { background: #fff; color: var(--navy); border-color: #c7d2fe; } .btn-outline:hover { background: var(--blue-50); }
.btn-ghost { background: transparent; color: var(--ink-2); } .btn-ghost:hover { background: var(--bg-2); }
.btn-danger { background: var(--bad); color: #fff; } .btn-danger:hover { background: #991b1b; }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: .9rem; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 1.05rem; }
.btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--ink-2); }
input, select, textarea { width: 100%; font: inherit; padding: 11px 12px; min-height: 44px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 3px solid #bfdbfe; border-color: var(--blue); }
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 14px; } .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* Cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 2px rgba(15,23,42,.04); display: flex; flex-direction: column; }
.card.flat { box-shadow: none; }
.card h3 { margin-bottom: 6px; }
.card .price-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card .actions { margin-top: auto; padding-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kpi { background: linear-gradient(180deg, #fff, var(--blue-50)); border: 1px solid #dbe4f3; border-radius: var(--radius); padding: 18px 20px; }
.kpi .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 700; color: var(--navy); line-height: 1.1; margin: 6px 0 2px; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.kpi .sub { font-size: .85rem; color: var(--ink-2); }
.kpi.bad .value { color: var(--bad); } .kpi.warn .value { color: var(--warn); } .kpi.ok .value { color: var(--ok); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--blue-100); color: var(--navy); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.muted { background: var(--bg-2); color: var(--muted); }
.notice { border-left: 4px solid var(--blue); background: var(--blue-50); padding: 12px 14px; border-radius: 10px; }
.notice.warn { border-color: var(--warn); background: var(--warn-bg); } .notice.bad { border-color: var(--bad); background: var(--bad-bg); } .notice.ok { border-color: var(--ok); background: var(--ok-bg); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); border: 1px dashed #cbd5e1; border-radius: var(--radius); background: var(--bg-2); }
.empty svg { color: #94a3b8; margin-bottom: 8px; }

/* Tables (scroll inside their wrapper on phones) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 560px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--bg-2); }
tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: start; background: #fff; }
.item .title { font-weight: 600; color: var(--ink); }
.item .meta { font-size: .85rem; color: var(--muted); }
.item .side { text-align: right; }
@media (max-width: 600px) { .item { grid-template-columns: 1fr; } .item .side { text-align: left; } }

/* Section rhythm */
section.block { padding: 56px 0; }
section.block.tint { background: var(--bg-2); }
.section-head { margin-bottom: 24px; }
.section-head p { max-width: 62ch; color: var(--ink-2); }
.eyebrow { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); font-weight: 700; margin-bottom: 8px; }
.page { padding: 28px 0 56px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Hero (photograph + overlay) */
.hero { position: relative; color: #fff; background: url('/assets/hero-generated.webp') center/cover no-repeat, var(--navy); min-height: 560px; display: flex; align-items: center; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11,42,91,.92) 0%, rgba(11,42,91,.78) 45%, rgba(11,42,91,.35) 100%); }
.hero .wrap { position: relative; padding: 72px 0; }
.hero h1 { color: #fff; font-size: clamp(3rem, 6vw, 4.4rem); line-height: 1.02; letter-spacing: -.02em; max-width: 16ch; margin-bottom: 18px; }
.hero p.lead { font-size: clamp(1.05rem, 1.6vw, 1.3rem); max-width: 56ch; color: #dbe7fb; margin-bottom: 28px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .cta .btn { white-space: normal; text-align: center; }
.hero .stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 36px; }
.hero .stats div b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.hero .stats div span { color: #bfd3f5; font-size: .85rem; }
@media (max-width: 600px) { .hero { min-height: 520px; } .hero .wrap { padding: 56px 0; } .hero h1 { font-size: 3rem; } }

/* Journey */
.journey { counter-reset: step; }
.journey .step { position: relative; padding-left: 56px; }
.journey .step::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }

/* Footer */
footer.site { background: var(--navy); color: #cfdcf3; padding: 44px 0 28px; margin-top: 40px; }
footer.site a { color: #fff; }
footer.site .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
footer.site .trust { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
footer.site .trust span { border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 4px 10px; font-size: .78rem; }
footer.site .legal { border-top: 1px solid rgba(255,255,255,.15); margin-top: 28px; padding-top: 16px; font-size: .8rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
@media (max-width: 900px) { footer.site .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { footer.site .cols { grid-template-columns: 1fr; } }

/* Dialog + toast */
dialog.kg { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 30px 80px rgba(2,6,23,.35); }
dialog.kg::backdrop { background: rgba(2,6,23,.5); }
dialog.kg .dlg { padding: 22px; }
dialog.kg .dlg h3 { margin-bottom: 8px; }
dialog.kg .dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.toast-host { position: fixed; left: 16px; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast { pointer-events: auto; margin: 0 auto; max-width: 520px; width: 100%; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; animation: toast-in .2s ease-out; }
.toast.ok { background: #064e3b; } .toast.bad { background: #7f1d1d; } .toast.warn { background: #78350f; }
.toast button { margin-left: auto; background: transparent; border: 0; color: #fff; font: inherit; cursor: pointer; min-width: 44px; min-height: 32px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.code-box { font-size: clamp(1.6rem, 6vw, 2.4rem); letter-spacing: .25em; font-weight: 700; color: var(--navy); background: var(--blue-50); border: 2px dashed #93c5fd; border-radius: 14px; padding: 18px; text-align: center; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; }
.pin-pad button { min-height: 60px; font-size: 1.4rem; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; font-family: inherit; }
.pin-pad button:active { background: var(--blue-100); }
.panic-btn { width: 100%; min-height: 96px; border-radius: 20px; border: 0; background: var(--bad); color: #fff; font: inherit; font-size: 1.3rem; font-weight: 800; letter-spacing: .04em; cursor: pointer; box-shadow: 0 10px 30px rgba(185,28,28,.35); }
.panic-btn[disabled] { background: #9ca3af; box-shadow: none; }
.skeleton { background: linear-gradient(90deg, #eef2f7, #f7f9fc, #eef2f7); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; min-height: 18px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.progress { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 18px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; }

/* Admin console layout — visibly a different application */
body.console { background: #f1f5f9; }
.console-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.console-side { background: var(--navy); color: #cfdcf3; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.console-side .brand { color: #fff; padding: 6px 8px 18px; }
.console-side .brand .tag { color: #93c5fd; }
.console-side .group { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #93a8cc; padding: 14px 10px 6px; }
.console-side a { display: flex; align-items: center; gap: 10px; color: #dbe7fb; text-decoration: none; padding: 11px 12px; border-radius: 10px; min-height: 44px; font-weight: 500; }
.console-side a:hover { background: rgba(255,255,255,.08); }
.console-side a.active { background: #fff; color: var(--navy); font-weight: 600; }
.console-main { padding: 22px 26px 60px; min-width: 0; }
.console-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.console-top .who { font-size: .9rem; color: var(--ink-2); }
.console-main .card { padding: 18px; }
@media (max-width: 900px) {
  .console-shell { grid-template-columns: 1fr; }
  .console-side { position: static; height: auto; padding-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .console-side nav { display: none; width: 100%; }
  .console-side nav.open { display: block; }
  .console-side .menu-btn { display: inline-flex; color: #fff; border-color: rgba(255,255,255,.3); background: transparent; margin-left: 0; }
  .console-main { padding: 16px; }
}
