/* ---- font: Inter (bundled, OFL; see fonts/Inter-LICENSE.txt) ---- */
@font-face {
  font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-2: #eef0f3;
  --head: #f9fafb;
  --accent: #4338ca;
  --accent-2: #3730a3;
  --accent-soft: #eef2ff;
  --ring: rgba(67, 56, 202, .18);
  --grey-bg: #f3f4f6;
  --grey-ink: #8b919c;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --bad: #b91c1c;
  --bad-bg: #fef2f2;
  --warn: #92400e;
  --warn-bg: #fffbeb;
  --warn-line: #fcd34d;
  --side: #111827;
  --side-2: #1f2937;
  --side-ink: #d1d5db;
  --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 1px 3px rgba(17, 24, 39, .04);
  --radius: 12px;
  /* one colour per party, used for the dots */
  --p1: #7c3aed; --p2: #0d9488; --p3: #d97706; --p4: #db2777; --p0: #64748b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
table, .tile .v, .conv, .land-foot, .who small, .transfers b, input[type=number] { font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
::selection { background: var(--accent-soft); }

/* ---- shell: sidebar + main ---- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink); padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; padding: 4px 6px; }
.brand:hover { text-decoration: none; color: #fff; }
.mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.brand b { display: block; font-size: 14px; font-weight: 600; line-height: 1.25; }
.brand small { display: block; font-size: 12px; color: #9ca3af; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--side-ink); font-weight: 500; font-size: 14px; white-space: nowrap;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(99, 102, 241, .18); color: #fff; }
.nav a.on svg { opacity: 1; color: #a5b4fc; }
.side-foot { margin-top: auto; font-size: 12px; color: #6b7280; padding: 0 6px; }
.side-foot button { color: var(--side-ink); background: none; border: none; padding: 6px 0; }
.side-foot button:hover { color: #fff; }

.main { min-width: 0; }
.wrap { max-width: 1760px; margin: 0 auto; padding: 30px 40px 72px; }

/* ---- type ---- */
h1 { font-size: 22px; line-height: 1.3; margin: 0 0 4px; font-weight: 650; letter-spacing: -0.015em; }
h2 { font-size: 15px; margin: 0 0 14px; font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 11.5px; margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 22px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head .sub { margin: 0; }
.muted { color: var(--muted); font-size: 12.5px; }

/* ---- cards ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; }
details.card[open] > summary::before { transform: rotate(45deg); }
.cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-bottom: 18px; }
.cols > .card { margin-bottom: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---- forms ---- */
label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
input, select, textarea {
  width: 100%; height: 40px; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 72px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236b7280' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
input:hover, select:hover { border-color: #b8bdc6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder { color: var(--faint); }
input:disabled {
  background: var(--grey-bg); color: var(--grey-ink); border: 1px dashed #d1d5db;
  -webkit-text-fill-color: var(--grey-ink); opacity: 1; cursor: default; box-shadow: none;
}
.sfx { position: relative; }
.sfx input { padding-right: 36px; }
.sfx::after { content: attr(data-sfx); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 12.5px; pointer-events: none; }
.pre { position: relative; }
.pre input { padding-left: 28px; }
.pre::before { content: "\20B9"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); font-weight: 400; cursor: pointer; margin: 0; }
.check input { width: 17px; height: 17px; margin: 0; flex: none; accent-color: var(--accent); box-shadow: none; }
.seg { display: inline-flex; border-radius: 10px; padding: 3px; background: var(--grey-bg); gap: 2px; border: 1px solid var(--line); }
.seg label { margin: 0; font-size: 13.5px; font-weight: 500; color: var(--muted); padding: 6px 14px; border-radius: 7px; cursor: pointer; transition: all .12s; }
.seg label:hover { color: var(--ink); }
.seg input { display: none; }
.seg label:has(input:checked) { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(17,24,39,.1), 0 0 0 1px rgba(17,24,39,.04); }

/* ---- buttons ---- */
button, .btn {
  font: inherit; font-size: 14px; font-weight: 500; height: 38px; padding: 0 15px; border-radius: 8px;
  border: 1px solid #d1d5db; background: #fff; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(17,24,39,.05); transition: background .12s, border-color .12s, color .12s;
}
button:hover, .btn:hover { background: var(--head); border-color: #b8bdc6; color: var(--ink); text-decoration: none; }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.primary:hover, .btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.danger { color: var(--bad); }
.danger:hover { background: var(--bad-bg); border-color: #fca5a5; color: var(--bad); }
.link { border: none; background: none; box-shadow: none; color: var(--muted); padding: 0 6px; height: auto; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* ---- land entry ---- */
.land-head, .land-row, .land-foot { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 10px; align-items: center; }
.land-head { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; padding-bottom: 8px; }
.land-row { padding: 10px 0; border-top: 1px solid var(--line-2); }
.who { font-weight: 600; font-size: 14px; }
.who small { display: block; font-weight: 400; color: var(--grey-ink); font-size: 12.5px; margin-top: 1px; }
.land-foot { padding-top: 12px; border-top: 1px solid var(--line); font-weight: 600; }
.land-foot span:not(.who) { padding-left: 12px; }

/* ---- converter ---- */
.cv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cv-head h2 { margin: 0; }
.cv-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: end; }
.cv-to { font-size: 20px; color: var(--faint); padding-bottom: 7px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.conv { margin-top: 14px; padding: 8px 12px; border-radius: 8px; font-size: 14px; background: var(--grey-bg); color: var(--ink-2); border: 1px dashed #d1d5db; }

/* ---- tables ---- */
.tbl { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; border-bottom: 1px solid var(--line); padding-top: 0; }
tbody tr:last-child td { border-bottom: 1px solid var(--line); }
tfoot td { font-weight: 650; border-bottom: none; color: var(--ink); padding-top: 13px; }
td.wrap-text { white-space: normal; min-width: 140px; }
td.nil { color: #d1d5db; }
tr.pw td { background: var(--head); }
tr.pw td:first-child { box-shadow: -22px 0 0 var(--head); }
tr.pw td:last-child { box-shadow: 22px 0 0 var(--head); }
td small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 1px; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: #fafaff; }
.hl { font-weight: 650; color: var(--ink); }

/* party colour dots */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--p0); flex: none; }
.dot.c1 { background: var(--p1); } .dot.c2 { background: var(--p2); } .dot.c3 { background: var(--p3); } .dot.c4 { background: var(--p4); }

/* ---- tiles, badges, notes ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.tile .n { font-size: 12.5px; font-weight: 500; color: var(--muted); display: flex; align-items: center; }
.tile .v { font-size: 22px; font-weight: 650; margin-top: 6px; letter-spacing: -0.01em; }
.tile .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tile.dark { background: var(--side); border-color: var(--side); color: #fff; }
.tile.dark .n { color: #9ca3af; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; line-height: 1.4; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.due { background: var(--warn-bg); color: var(--warn); }
.note { font-size: 13.5px; padding: 11px 14px; border-radius: 8px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); margin: 14px 0 0; }
.flash { padding: 11px 15px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #a7f3d0; }
.flash.error { background: var(--bad-bg); color: var(--bad); border: 1px solid #fecaca; }
.errors { background: var(--bad-bg); color: var(--bad); border: 1px solid #fecaca; border-radius: 10px; padding: 12px 16px 12px 34px; margin: 0 0 18px; }
.transfers { list-style: none; margin: 0; padding: 0; }
.transfers li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.transfers li:last-child { border-bottom: none; }
.transfers b { font-weight: 650; white-space: nowrap; }
.transfers small { color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; margin: 0; }
dl.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px 24px; margin: 0; }
dl.facts dt { font-size: 12px; color: var(--muted); font-weight: 500; }
dl.facts dd { margin: 3px 0 0; font-weight: 500; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 16px 22px; }
.filters > div { min-width: 170px; }
.sticky-save { position: sticky; bottom: 0; padding: 14px 0; margin-top: 4px; background: linear-gradient(to top, var(--bg) 75%, rgba(245,246,248,0)); z-index: 2; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-title h2 { margin: 0; }
.section-title a { font-size: 13px; font-weight: 500; }

/* ---- sign-in page ---- */
body.auth { background: #fff; }
.auth-shell { display: grid; grid-template-columns: minmax(360px, 44%) 1fr; min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden; color: #e0e7ff; padding: 44px 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(120% 90% at 0% 0%, #312e81 0%, #1e1b4b 55%, #111827 100%);
}
/* a faint plot-division grid, like the layout plan */
.auth-brand::before {
  content: ""; position: absolute; inset: -40px;
  background-image:
    linear-gradient(rgba(165,180,252,.09) 2px, transparent 2px),
    linear-gradient(90deg, rgba(165,180,252,.09) 2px, transparent 2px);
  background-size: 92px 64px; transform: rotate(-8deg);
  mask-image: linear-gradient(to bottom, transparent 5%, #000 45%, #000 80%, transparent);
}
.auth-brand > * { position: relative; }
.auth-logo { display: flex; align-items: center; gap: 14px; }
.auth-logo img { border-radius: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.wm { font-size: 24px; font-weight: 700; letter-spacing: .14em; color: #fff; line-height: 1.1; }
.wm-sub { font-size: 12px; font-weight: 500; letter-spacing: .3em; color: #a5b4fc; margin-top: 4px; }
.auth-pitch { max-width: 420px; }
.auth-pitch h2 { font-size: 30px; line-height: 1.2; font-weight: 650; color: #fff; letter-spacing: -0.02em; margin: 0 0 14px; }
.auth-pitch p { font-size: 15.5px; line-height: 1.6; color: #c7d2fe; margin: 0; }
.auth-foot { font-size: 13px; color: #818cf8; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card-logo { display: none; margin-bottom: 28px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { margin-bottom: 26px; }
.auth-form { display: grid; gap: 18px; }
.auth-form input:not([type=checkbox]) { height: 44px; font-size: 15px; background: #fff; }
.pw { position: relative; }
.pw input { padding-right: 70px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 32px; padding: 0 10px;
  border: none; box-shadow: none; background: transparent; color: var(--accent); font-size: 13px; font-weight: 600;
}
.pw-toggle:hover { background: var(--accent-soft); color: var(--accent-2); }
.auth-submit { height: 46px; justify-content: center; font-size: 15px; margin-top: 4px; }
.auth-legal { margin-top: 36px; font-size: 12.5px; color: var(--faint); }
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card-logo { display: block; }
}

/* ---- sidebar logo and user ---- */
.brand img { border-radius: 9px; flex: none; }
.brand .wm-side { display: block; font-size: 14px; font-weight: 700; letter-spacing: .12em; color: #fff; line-height: 1.2; }
.brand .wm-side-sub { display: block; font-size: 10.5px; font-weight: 500; letter-spacing: .24em; color: #a5b4fc; margin-top: 3px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--side-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #374151; color: #e5e7eb; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; flex: none; }
.side-user .who-side { min-width: 0; flex: 1; }
.side-user b { display: block; color: #f3f4f6; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { display: block; color: #9ca3af; font-size: 12px; }
.side-user button { height: auto; padding: 0; font-size: 12px; color: #9ca3af; }
.side-user button:hover { color: #fff; background: none; }

/* ---- settings: password pop-over ---- */
.pw-edit { position: relative; }
.pw-edit > summary { list-style: none; }
.pw-edit > summary::-webkit-details-marker { display: none; }
.pw-pop {
  position: absolute; right: 0; top: 44px; z-index: 10; width: 280px; display: grid; gap: 10px; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; box-shadow: 0 10px 30px rgba(17,24,39,.14);
}
.pw-pop label { margin: 0; display: grid; gap: 5px; }

/* ---- statements ---- */
.party-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.party-tabs a {
  display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-weight: 500; box-shadow: var(--shadow);
}
.party-tabs a:hover { border-color: #c7cbd3; text-decoration: none; color: var(--ink); }
.party-tabs a.on { background: var(--side); border-color: var(--side); color: #fff; }
tr.month-head td { background: var(--head); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 9px; padding-bottom: 9px; }
tr.month-head td:first-child { box-shadow: -22px 0 0 var(--head); }
tr.month-head td:last-child { box-shadow: 22px 0 0 var(--head); }
tr.subtotal td { font-weight: 600; border-bottom: 1px solid var(--line); }
.own-tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 6px; margin-left: 4px; }
a.tile { color: inherit; display: block; transition: border-color .12s, box-shadow .12s; }
a.tile:hover { text-decoration: none; border-color: #c7cbd3; box-shadow: 0 4px 12px rgba(17,24,39,.08); }
a.tile .go { float: right; color: var(--faint); font-size: 13px; }

/* ---- deleting a sale ---- */
.danger-title { color: var(--bad); }
.btn-danger, button.btn-danger {
  background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600;
}
.btn-danger:hover, button.btn-danger:hover { background: #991b1b; border-color: #991b1b; color: #fff; }
button.btn-danger:disabled { background: #f3c4c4; border-color: #f3c4c4; color: #fff; cursor: not-allowed; box-shadow: none; }
.warnings { border-color: #fcd34d; background: #fffdf5; }
.warn-list { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
.warn-list > li { line-height: 1.55; }
.warn-list > li::marker { color: var(--warn); }
.warn-strong { background: var(--bad-bg); border: 1px solid #fecaca; border-radius: 8px; padding: 10px 12px; margin-left: -20px; list-style: none; color: #7f1d1d; }
.confirm-box { border-color: #fecaca; }
.badge.del { background: var(--bad-bg); color: var(--bad); }
.deleted-banner { background: var(--bad-bg); border: 1px solid #fecaca; color: #7f1d1d; border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; }

/* ---- land map ---- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.map-card { padding: 14px; margin-bottom: 0; }
.map-side .card { margin-bottom: 18px; }
.map-side th, .map-side td { padding-left: 6px; padding-right: 6px; }
.map-side .tbl { margin: 0 -22px; padding: 0 22px; }
.map-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 2px 4px 12px; }
.map-tools .spacer { flex: 1; }
.map-tools button { height: 32px; min-width: 36px; justify-content: center; padding: 0 10px; }
.map-scroll { overflow: auto; height: calc(100vh - 210px); min-height: 520px; border-radius: 10px; background: #fbfbfa; border: 1px solid var(--line-2); }
.map-scroll svg.plan-svg { display: block; height: 100%; width: 100%; }
.map-scroll.zoomed svg.plan-svg { width: auto; }
.map-scroll.mini { height: 380px; min-height: 0; }
.map-mini { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.plan-svg .plan-drawing { opacity: .9; }
.plan-svg.no-drawing .plan-drawing, .map-scroll.no-drawing .plan-drawing { display: none; }
.plan-svg .parcel { stroke: #111827; stroke-width: 1.5; stroke-opacity: .25; }
.plan-svg .parcel.o-baby { fill: rgba(124, 58, 237, .09); }
.plan-svg .parcel.o-george { fill: rgba(13, 148, 136, .09); }
.plan-svg .parcel.o-thomas { fill: rgba(217, 119, 6, .09); }
.plan-svg .parcel.out { fill: rgba(107, 114, 128, .16); }
.plan-svg .ht-hatch { pointer-events: none; }

.plan-svg .cube { stroke: #fff; stroke-width: 2.2; transition: fill .08s, fill-opacity .08s; }
.plan-svg .cube.o-baby { fill: #7c3aed; fill-opacity: .20; }
.plan-svg .cube.o-george { fill: #0d9488; fill-opacity: .20; }
.plan-svg .cube.o-thomas { fill: #d97706; fill-opacity: .22; }
.plan-svg .cube.sold { fill: var(--sale, #e11d48); fill-opacity: .82; cursor: pointer; }
.plan-svg .cube.free:hover { fill-opacity: .42; }
.plan-svg .cube.sold:hover { fill-opacity: 1; stroke: #111827; }
.map-scroll.no-cubes .cube:not(.sold):not(.sel):not(.locked) { display: none; }
.plan-svg.dim .cube.sold:not(.hl) { fill-opacity: .18; }
.plan-svg .cube.sold.hl { stroke: #111827; stroke-width: 3; }

/* editing one sale */
.map-scroll.editing { cursor: crosshair; user-select: none; touch-action: none; }
.plan-svg .cube.sel { fill: #111827; fill-opacity: .78; stroke: #fbbf24; stroke-width: 3; }
.plan-svg .cube.locked { fill: var(--sale, #6b7280); fill-opacity: .35; cursor: not-allowed; }
.plan-svg[data-mode="edit"] .cube.free { cursor: pointer; }
/* a sale's own page */
.plan-svg[data-mode="mini"] .cube.sel { fill: #e11d48; fill-opacity: .85; stroke: #fff; }
.plan-svg[data-mode="mini"] .cube.other { fill: #6b7280; fill-opacity: .45; }

.plan-svg .labels { pointer-events: none; display: none; }
.plan-svg .layout { pointer-events: none; }
.plan-svg .lay { fill: none; stroke: #1e3a8a; stroke-width: 3; stroke-opacity: .75; stroke-dasharray: 10 6; }
.plan-svg .lay.common { stroke: #6b7280; }
.plan-svg .lay-no { font: 700 34px Inter, sans-serif; text-anchor: middle; fill: #1e3a8a; paint-order: stroke; stroke: #fff; stroke-width: 6px; stroke-opacity: .85; }
.plan-svg .lay-c { font: 600 20px Inter, sans-serif; text-anchor: middle; fill: #1e3a8a; paint-order: stroke; stroke: #fff; stroke-width: 5px; stroke-opacity: .85; }
.map-scroll.no-plots .layout { display: none; }
.plan-svg .roads { pointer-events: none; }
.plan-svg .road { fill: #475569; fill-opacity: .42; stroke: #334155; stroke-width: 1.5; stroke-opacity: .5; }
.map-scroll.no-roads .roads { display: none; }
/* by owner view: every cube in its brother's colour, dark = sold */
.owner-view .plan-svg .cube.o-baby { fill: #7c3aed; }
.owner-view .plan-svg .cube.o-george { fill: #0d9488; }
.owner-view .plan-svg .cube.o-thomas { fill: #d97706; }
.owner-view .plan-svg .cube.free { fill-opacity: .3; }
.owner-view .plan-svg .cube.sold { fill-opacity: .92; }
.owner-view .plan-svg .parcel.o-baby { stroke: #6d28d9; }
.owner-view .plan-svg .parcel.o-george { stroke: #0f766e; }
.owner-view .plan-svg .parcel.o-thomas { stroke: #b45309; }
.owner-view .plan-svg .parcel { stroke-width: 4; stroke-opacity: .7; }
.owner-view .plan-svg .lay.shared { stroke: #db2777; stroke-width: 7; stroke-dasharray: none; stroke-opacity: .95; fill: url(#shared-hatch); }
/* focusing on one brother */
.owner-focus .plan-svg .cube { fill: #9ca3af !important; fill-opacity: .12 !important; }
.owner-focus .plan-svg .parcel { stroke-opacity: .1; }
.focus-baby .plan-svg .cube.o-baby, .focus-george .plan-svg .cube.o-george, .focus-thomas .plan-svg .cube.o-thomas { fill-opacity: .35 !important; }
.focus-baby .plan-svg .cube.o-baby { fill: #7c3aed !important; } .focus-george .plan-svg .cube.o-george { fill: #0d9488 !important; } .focus-thomas .plan-svg .cube.o-thomas { fill: #d97706 !important; }
.focus-baby .plan-svg .cube.sold.o-baby, .focus-george .plan-svg .cube.sold.o-george, .focus-thomas .plan-svg .cube.sold.o-thomas { fill-opacity: .95 !important; }
.focus-baby .plan-svg .parcel.o-baby, .focus-george .plan-svg .parcel.o-george, .focus-thomas .plan-svg .parcel.o-thomas { stroke-width: 8; stroke-opacity: 1; }
.owner-focus .plan-svg .lay.shared { stroke-opacity: .35; }
.plan-svg .lay.hover-shared { stroke: #9d174d !important; stroke-width: 11 !important; stroke-dasharray: none; stroke-opacity: 1 !important; fill: url(#shared-hatch); }
/* brother cards */
.owner-cards { display: grid; gap: 8px; }
.owner-card {
  display: grid; gap: 6px; height: auto; padding: 11px 13px; text-align: left; width: 100%;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; box-shadow: none; transition: all .12s;
}
.owner-card:hover { border-color: #c7cbd3; background: #fff; }
.owner-card .oc-top { display: flex; align-items: center; gap: 9px; font-size: 14.5px; }
.owner-card .oc-figs { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.owner-card .oc-figs b { color: var(--ink); }
.owner-card[aria-pressed="true"].o-baby { border-color: #7c3aed; background: #f5f3ff; }
.owner-card[aria-pressed="true"].o-george { border-color: #0d9488; background: #f0fdfa; }
.owner-card[aria-pressed="true"].o-thomas { border-color: #d97706; background: #fffbeb; }
.owner-card.dim { opacity: .5; }
.sw.strong.o-baby { background: #7c3aed; } .sw.strong.o-george { background: #0d9488; } .sw.strong.o-thomas { background: #d97706; }
.shared-table { font-size: 13.5px; }
.shared-table th, .shared-table td { padding: 6px; }
.shared-table tbody tr { cursor: default; }
.shared-table tbody tr:hover td { background: #fdf2f8; }
/* car tour */
.plan-svg .drive { pointer-events: none; }
.plan-svg .drive-route { fill: none; stroke: #fbbf24; stroke-width: 5; stroke-dasharray: 2 14; stroke-linecap: round; opacity: 0; transition: opacity .3s; }
.map-scroll.driving .drive-route { opacity: .9; }
.map-scroll.no-car .drive { display: none; }
.plan-svg .gate-sign { fill: #14532d; stroke: #fbbf24; stroke-width: 3; }
.plan-svg .gate-text { font: 800 25px Inter, sans-serif; letter-spacing: .12em; fill: #fef3c7; text-anchor: middle; }
.plan-svg .gate-sub2 { font: 700 17px Inter, sans-serif; fill: #fbbf24; text-anchor: middle; }
.plan-svg .car-body { fill: #dc2626; stroke: #7f1d1d; stroke-width: 1.5; }
.plan-svg .car-roof { fill: #b91c1c; }
.plan-svg .car-glass { fill: #bfdbfe; }
.plan-svg .car-light { fill: #fef08a; }
.plan-svg .car-tail { fill: #450a0a; }
.plan-svg .car-shadow { fill: #000; opacity: .22; }
.map-tools .car-btn { background: #14532d; border-color: #14532d; color: #fff; font-weight: 600; min-width: 96px; }
.map-tools .car-btn:hover { background: #166534; color: #fff; }
/* sold vs unsold view */
.status-view .plan-svg .cube.free { fill: #16a34a; fill-opacity: .45; }
.status-view .plan-svg .cube.sold { fill: #dc2626; fill-opacity: .85; }
.status-view .plan-svg .cube.free[data-road]:not([data-road=""]) { fill: #94a3b8; fill-opacity: .3; }
.status-view .plan-svg .cube.free[data-plot=""] { fill: #94a3b8; fill-opacity: .25; }
.status-view .plan-svg .lay.st-part { stroke: #b45309; stroke-width: 6; stroke-dasharray: none; }
.status-view .plan-svg .lay.st-sold { stroke: #7f1d1d; stroke-dasharray: none; }
.sw.st-sold { background: #dc2626; } .sw.st-unsold { background: rgba(22, 163, 74, .6); }
.progress { height: 12px; border-radius: 999px; background: rgba(22, 163, 74, .35); overflow: hidden; margin: 2px 0 14px; }
.progress span { display: block; height: 100%; background: #dc2626; border-radius: 999px 0 0 999px; }
.status-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.status-figs div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.status-figs small { flex-basis: 100%; color: var(--muted); padding-left: 24px; margin-top: -4px; }
.status-plots td { padding: 6px 0; }
.sw.road { background: rgba(71, 85, 105, .5); }
.sw.lay { background: #fff; border: 2px dashed #1e3a8a; }
.add-plot { margin: 16px 0 6px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.add-plot select { flex: 1; min-width: 0; }
.add-plot .actions { flex-wrap: nowrap; }
.map-scroll.show-labels .labels, .map-scroll.no-drawing .labels { display: inline; }
.plan-svg .plan-letter { font: 700 58px Inter, sans-serif; text-anchor: middle; fill: #111827; fill-opacity: .7; }
.plan-svg .plan-sub { font: 500 24px Inter, sans-serif; text-anchor: middle; fill: #374151; }
.plan-svg .out { fill-opacity: .55; }

.legend, .sold-list, .plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.sw { width: 18px; height: 18px; border-radius: 4px; flex: none; border: 1px solid rgba(0,0,0,.08); display: inline-block; }
.sw.o-baby { background: rgba(124, 58, 237, .28); } .sw.o-george { background: rgba(13, 148, 136, .28); } .sw.o-thomas { background: rgba(217, 119, 6, .3); }
.sw.ht { background: repeating-linear-gradient(45deg, rgba(192,38,211,.35) 0 3px, transparent 3px 8px); }
.sw.out { background: rgba(107, 114, 128, .25); }
.sw.sel { background: #111827; outline: 2px solid #fbbf24; outline-offset: -2px; }
.sw.locked { background: rgba(107, 114, 128, .45); }
.sold-list a { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); padding: 6px 8px; margin: -6px -8px; border-radius: 8px; }
.sold-list a:hover { background: var(--head); text-decoration: none; }
.sold-list .sw { margin-top: 2px; }
.sold-list small, .plain-list small { display: block; color: var(--muted); font-size: 12.5px; }
.plain-list li { font-size: 14px; }

.plan-tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 300px; padding: 9px 12px; border-radius: 9px;
  background: #111827; color: #f9fafb; font-size: 13px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.plan-tip b { color: #fff; }
.plan-tip .muted { color: #9ca3af; font-size: 12px; }
.diff-ok { color: var(--ok); } .diff-off { color: var(--warn); }

@media (max-width: 1100px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-scroll { height: 70vh; }
  .map-mini { grid-template-columns: 1fr; }
}

/* ---- simulation mode ---- */
.sim-banner {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; padding: 10px 32px; background: #f59e0b; color: #1f1300; font-size: 14px;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.12) 0 14px, transparent 14px 28px);
}
.sim-banner b { letter-spacing: .08em; }
.sim-actions { display: flex; gap: 8px; }
.sim-actions form { margin: 0; }
.sim-actions button { height: 32px; background: rgba(255,255,255,.85); border-color: rgba(0,0,0,.15); }
.sim-actions button.primary { background: #1f2937; border-color: #1f2937; color: #fff; }
.sim-enter { margin: 0 0 10px; padding: 0 6px; }
.sim-enter button { width: 100%; justify-content: center; height: 32px; font-size: 13px; background: transparent;
  color: #fbbf24; border: 1px dashed rgba(251,191,36,.5); box-shadow: none; }
.sim-enter button:hover { background: rgba(251,191,36,.1); color: #fcd34d; }
.sim-check { align-items: flex-start; padding: 10px 12px; border: 1px dashed #f59e0b; border-radius: 8px; background: #fffbeb; font-size: 13.5px; }
.sim-check input { margin-top: 2px; }

/* ---- small screens: sidebar becomes a top bar ---- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 14px; z-index: 5; overflow-x: auto; }
  .brand small, .side-foot { display: none; }
  .nav { flex-direction: row; }
  .nav a { padding: 7px 10px; }
  .wrap { padding: 22px 16px 64px; }
}
@media (max-width: 640px) {
  .land-head { display: none; }
  .land-row, .land-foot { grid-template-columns: 1fr 1fr 1fr; }
  .land-row .who, .land-foot .who { grid-column: 1 / -1; }
  .cv-row { grid-template-columns: 1fr; }
  .cv-to { padding: 0; text-align: center; transform: rotate(90deg); }
  .nav a span { display: none; }
  .card { padding: 18px; }
  .tbl { margin: 0 -18px; padding: 0 18px; }
}
@media print {
  .side, .actions, .no-print, .flash { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card, .tile { border: none; box-shadow: none; padding: 0; }
  .wrap { padding: 0; }
}

.land-owner-card { margin-top: 18px; }
.progress.small { height: 9px; margin: 0; background: var(--grey-bg); }
.progress.small.o-baby span { background: #7c3aed; } .progress.small.o-george span { background: #0d9488; } .progress.small.o-thomas span { background: #d97706; }

[hidden] { display: none !important; }

/* scenery: HT tower on the roundabout, wires, trees */
.plan-svg .scenery { pointer-events: none; }
.map-scroll.no-trees .trees { display: none; }
.map-scroll.no-roads .roundabout { display: none; }
.plan-svg .ht-wire { stroke: #1f2937; stroke-width: 1.6; stroke-opacity: .55; }
.plan-svg .tree-shadow { fill: #000; opacity: .16; }
.plan-svg .tree-crown { stroke: #14532d; stroke-width: 1.2; }
.plan-svg .t0 .tree-crown { fill: #15803d; } .plan-svg .t1 .tree-crown { fill: #166534; } .plan-svg .t2 .tree-crown { fill: #3f7d20; }
.plan-svg .tree-light { fill: #86efac; opacity: .35; }
.plan-svg .ra-road { fill: #64748b; stroke: #334155; stroke-width: 2; }
.plan-svg .ra-lane { fill: none; stroke: #f8fafc; stroke-width: 1.5; stroke-dasharray: 6 7; opacity: .8; }
.plan-svg .ra-island { fill: #86c96b; stroke: #f8fafc; stroke-width: 3; }
.plan-svg .pylon-shadow { fill: #000; opacity: .22; }
.plan-svg .pylon-leg { fill: none; stroke: #111827; stroke-width: 3; stroke-linejoin: round; }
.plan-svg .pylon-brace { fill: none; stroke: #374151; stroke-width: 1.5; }
.plan-svg .pylon-arm { fill: none; stroke: #111827; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.plan-svg .pylon-ins { stroke: #c026d3; stroke-width: 2.5; stroke-linecap: round; }
.sw.ra { background: radial-gradient(circle, #86c96b 0 35%, #64748b 38% 100%); border-radius: 50%; }

.sw.tr { background: radial-gradient(circle, #86efac 0 25%, #15803d 30% 100%); border-radius: 50%; }
.plan-svg .lay-no.lay-common { font-size: 22px; fill: #166534; }
.map-scroll.no-trees .park-label { display: none; }
.plan-svg .park-label { font-size: 19px; }

/* practice mode: an icon at the top instead of words */
.main { position: relative; }
.sim-toggle { margin: 0 0 12px; padding: 0 6px; }
.sim-toggle button { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 50%;
  color: #fbbf24; border: 1px solid rgba(251,191,36,.45); background: rgba(251,191,36,.08); box-shadow: none; }
.sim-toggle button:hover { background: rgba(251,191,36,.18); color: #fcd34d; border-color: #fbbf24; }
.sim-id { display: inline-flex; align-items: center; gap: 10px; }
.sim-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #1f2937; color: #fbbf24; }
