/* Kelo for Real Estate — app styles. Brand colours come from the company's theme as CSS variables
   (--brand, --brand-ink, --brand-soft, --brand-line, --accent, --radius) set on <body> by theme.css_vars(). */
:root {
  --ink: #16201C; --ink-2: #3D4A44; --muted: #66736D; --line: #E3E1DA; --paper: #F7F6F2; --card: #FFFFFF;
  --cream: #F3EFE6; --ok: #1E7A4C; --ok-soft: #E5F3EB; --bad: #B42318; --bad-soft: #FDECEA; --warn: #8A5A00; --warn-soft: #FFF4DC;
  --brand: #1F5A47; --brand-ink: #194A3A; --brand-soft: #E9EFEC; --brand-line: #C7D6D1; --accent: #E9A23B; --radius: 10px;
  --shadow: 0 1px 2px rgba(22,32,28,.06), 0 4px 16px rgba(22,32,28,.05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --display: "Sora", var(--font);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--paper); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
code { font: .9em "JetBrains Mono", ui-monospace, monospace; background: var(--cream); padding: 1px 5px; border-radius: 4px; }
img { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── layout ─────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; min-height: 52px; }
.side .logo img { max-height: 40px; max-width: 180px; object-fit: contain; }
.side .logo .co { font-weight: 600; font-size: .95rem; line-height: 1.2; }
.nav-group { margin: 14px 0 4px; padding: 0 10px; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--paper); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand-ink); }
.nav a .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-line); flex: none; }
.nav a.on .dot { background: var(--brand); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .grow { flex: 1; }
.top .who { font-size: .9rem; color: var(--ink-2); }
.menu-btn { display: none; }
.content { padding: 28px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head p { color: var(--muted); margin: 0; }
.trial-bar { background: var(--warn-soft); color: var(--warn); padding: 9px 28px; font-size: .9rem; border-bottom: 1px solid #F2DFB3; }
.trial-bar a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ── pieces ─────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--brand-line); text-decoration: none; }
.tile b { display: block; margin-bottom: 4px; }
.tile span { color: var(--muted); font-size: .88rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--brand);
       background: var(--brand); color: #fff; font: 600 .92rem var(--font); cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { background: var(--brand-ink); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.light { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1B1405; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.small { padding: 5px 11px; min-height: 32px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #BFE3CD; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #F2DFB3; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: #F6C7C1; }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand-line); }
.flash { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 18px; background: var(--ok-soft); color: var(--ok); border: 1px solid #BFE3CD; }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: #F6C7C1; }
.note { padding: 12px 16px; border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand-ink); margin-bottom: 16px; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }

/* ── forms ──────────────────────────────────────────── */
label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .84rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #CFCDC5; border-radius: 8px; font: 15px var(--font); color: var(--ink); background: #fff; min-height: 42px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid var(--brand-soft); }
textarea { min-height: 96px; resize: vertical; }
input[type=color] { width: 56px; height: 42px; padding: 3px; border: 1px solid #CFCDC5; border-radius: 8px; background: #fff; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.row { display: flex; gap: 14px; flex-wrap: wrap; } .row > * { flex: 1; min-width: 160px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.choice { display: block; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; background: #fff; margin-bottom: 10px; font-weight: 400; }
.choice:hover { border-color: var(--brand-line); }
.choice input { margin-right: 8px; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice b { font-weight: 600; }
.choice .sub { display: block; color: var(--muted); font-size: .88rem; margin: 3px 0 0 26px; }
.code-input { font: 600 1.6rem "JetBrains Mono", monospace !important; letter-spacing: .35em; text-align: center; }

/* ── tables ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--paper); }
tr:last-child td { border-bottom: 0; }

/* ── sign-in / sign-up pages ────────────────────────── */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 40px 16px; background: linear-gradient(180deg, var(--cream), var(--paper) 340px); }
.auth .brand { margin-bottom: 22px; } .auth .brand img { height: 40px; }
.auth .box { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 30px; box-shadow: var(--shadow); }
.auth .box.wide { max-width: 720px; }
.auth .foot { margin-top: 18px; font-size: .88rem; color: var(--muted); text-align: center; }
.steps { display: flex; gap: 6px; margin: 0 0 22px; padding: 0; list-style: none; }
.steps li { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps li.on { background: var(--brand); }
.price-box { border: 1.5px solid var(--line); border-radius: 12px; padding: 18px; }
.price-box .amount { font: 700 1.6rem var(--display); }
.price-box ul { margin: 10px 0 0; padding-left: 18px; color: var(--ink-2); font-size: .9rem; }

/* ── help ───────────────────────────────────────────── */
.help-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--brand); background: #fff; }
.help-btn:hover { background: var(--brand-soft); text-decoration: none; }
.article { max-width: 760px; }
.article h2 { margin-top: 1.4em; }
.article li { margin-bottom: .35em; }
.article table { margin: 1em 0; border: 1px solid var(--line); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--brand-line); flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; color: #fff; }
.checklist .done .tick { background: var(--ok); border-color: var(--ok); }
.checklist .done a { color: var(--muted); text-decoration: line-through; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; vertical-align: -4px; border: 1px solid rgba(0,0,0,.12); }

/* ── small screens ──────────────────────────────────── */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.nav-open .side { transform: none; }
  .menu-btn { display: inline-flex; }
  .top, .trial-bar { padding-left: 16px; padding-right: 16px; }
  .content { padding: 18px 16px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .top .who { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .side, .top, .trial-bar, .help-btn { display: none !important; } .shell { display: block; } }

/* ── records (Phase 1) ──────────────────────────────── */
.money-input { display: flex; align-items: stretch; }
.money-input span { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid #CFCDC5; border-right: 0; border-radius: 8px 0 0 8px; background: var(--paper); color: var(--muted); font-size: .9rem; }
.money-input input { border-radius: 0 8px 8px 0 !important; }
.picker { position: relative; }
.pick-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: -10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 30; max-height: 260px; overflow-y: auto; }
.pick-list button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; font: inherit; cursor: pointer; }
.pick-list button:hover, .pick-list button.on { background: var(--brand-soft); }
.pick-list small { color: var(--muted); display: block; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }
a.sort { color: inherit; } a.sort.on { color: var(--brand-ink); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 140px; flex: 1; }
.filters .field.wide { flex: 2; min-width: 220px; }
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; } .kv dd { margin: 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photos figure { margin: 0; position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.photos img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.photos figcaption { display: flex; gap: 4px; padding: 6px; font-size: .8rem; align-items: center; }
.photos figcaption form { display: inline; }
.prop-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.prop-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); box-shadow: var(--shadow); }
.prop-card:hover { border-color: var(--brand-line); text-decoration: none; }
.prop-card .ph { aspect-ratio: 4/3; background: var(--cream) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; }
.prop-card .bd { padding: 12px 14px; } .prop-card b { display: block; } .prop-card .price { font-weight: 700; color: var(--brand-ink); margin-top: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { font-size: .8rem; color: var(--muted); }
.timeline .body { white-space: pre-wrap; margin-top: 3px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.tabs a:hover { text-decoration: none; background: var(--paper); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font: 700 1.5rem var(--display); } .stat span { color: var(--muted); font-size: .85rem; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board .col { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.board .col h3 { font-size: .85rem; display: flex; justify-content: space-between; }
.board .item { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; color: var(--ink); font-size: .9rem; }
.board .item:hover { border-color: var(--brand-line); text-decoration: none; }
.overdue { color: var(--bad); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nav a.sub { padding: 5px 10px 5px 28px; font-size: .88rem; font-weight: 400; color: var(--muted); }
.nav a.sub.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; }
a.stat.tile { color: var(--ink); } a.stat.tile:hover { text-decoration: none; border-color: var(--brand-line); }

/* ── small-screen safety: grid/flex children may shrink; long words and codes wrap ── */
.grid > *, .row > *, .main, .content { min-width: 0; }
.kv dd, .card p, .card li, td { overflow-wrap: anywhere; }
code { word-break: break-all; }
@media (max-width: 900px) { .kv { grid-template-columns: minmax(96px, 40%) 1fr; } .page-head .actions { width: 100%; } }
