/* Thai Rent — light, quiet UI */
:root {
  --bg: #f6f6f3;
  --surface: #fff;
  --line: #e6e5e0;
  --line-soft: #efeeea;
  --text: #16181d;
  --muted: #6b6f76;
  --faint: #9a9da3;
  --ink: #16181d;
  --accent: #2557d6;
  --up: #b42318;   --up-bg: #fdefed;
  --down: #2557d6; --down-bg: #edf2fd;
  --ok: #13795b;   --ok-bg: #e9f5ef;
  --busy: #6b6f76; --busy-bg: #f0f0ec;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(22, 24, 29, .04);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--ink); display: grid; place-items: center; }
.brand-mark i { width: 10px; height: 10px; border: 2px solid #fff; border-radius: 2px; display: block; }
.mainnav { display: flex; gap: 4px; }
.mainnav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); font-weight: 500; }
.mainnav a:hover { color: var(--text); background: var(--bg); }
.mainnav a.on { color: var(--text); background: var(--bg); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { color: var(--muted); font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stack > * + * { margin-top: 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { text-decoration: none; color: var(--muted); padding: 10px 0; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-color: var(--ink); }
.tabs .count { color: var(--faint); font-weight: 400; margin-left: 4px; }

/* ---------- segmented control ---------- */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button, .seg a {
  border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 5px 12px; border-radius: 7px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.seg button:hover, .seg a:hover { color: var(--text); }
.seg .on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(22,24,29,.08); }
.seg-sm button { padding: 3px 9px; font-size: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--ink);
  background: var(--ink); color: #fff; font: inherit; font-weight: 500; font-size: 14px;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .4; cursor: default; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-line { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-line:hover { opacity: 1; background: var(--bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 0 8px; }
.btn-ghost:hover { opacity: 1; color: var(--text); background: var(--bg); }
.btn-danger { background: var(--surface); color: var(--up); border-color: #f1c6c0; }
.btn-danger:hover { opacity: 1; background: var(--up-bg); }
.btn-block { width: 100%; height: 40px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.linkbtn:hover { color: var(--text); }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.plain::before { display: none; }
.p-high { color: var(--up); background: var(--up-bg); }
.p-low { color: var(--down); background: var(--down-bg); }
.p-ok { color: var(--ok); background: var(--ok-bg); }
.p-busy, .p-na { color: var(--busy); background: var(--busy-bg); }
.p-run { color: var(--accent); background: var(--down-bg); }
.p-run::before { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.tag { display: inline-block; font-size: 12px; font-weight: 500; padding: 1px 7px; border-radius: 6px; background: var(--bg); color: var(--muted); border: 1px solid var(--line-soft); white-space: nowrap; }
.tag-ours { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag-condo { background: var(--down-bg); color: var(--down); border-color: transparent; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--faint); letter-spacing: 0; margin-left: 2px; }
.stat-hint { color: var(--faint); font-size: 12.5px; margin-top: 2px; }
.c-high { color: var(--up); } .c-low { color: var(--down); } .c-ok { color: var(--ok); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; background: #fbfbf9; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table tbody tr { transition: background .1s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: #fafaf8; }
.table tr.mine td { background: #fafaf6; }
.table .title-cell a { text-decoration: none; font-weight: 500; }
.table .title-cell a:hover { color: var(--accent); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.date-cell b { font-weight: 600; }
.date-cell span { color: var(--faint); margin-left: 6px; font-size: 13px; }
.price { font-weight: 600; }

/* price range bar */
.rb { min-width: 170px; }
.rb-track { position: relative; height: 22px; }
.rb-track::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 2px; background: var(--line-soft); border-radius: 2px; }
.rb-span { position: absolute; top: 8px; height: 6px; border-radius: 3px; background: #d9dbe0; }
.rb-med { position: absolute; top: 4px; width: 2px; height: 14px; margin-left: -1px; background: var(--muted); border-radius: 1px; }
.rb-you { position: absolute; top: 5px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--ink); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--ink); }
.rb-you.high { background: var(--up); box-shadow: 0 0 0 1px var(--up); }
.rb-you.low { background: var(--down); box-shadow: 0 0 0 1px var(--down); }
.rb-you.ok { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.rb-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.lg-span { width: 18px; height: 6px; border-radius: 3px; background: #d9dbe0; }
.lg-med { width: 2px; height: 12px; background: var(--muted); }
.lg-you { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }

/* ---------- property cards ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pcard { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; text-decoration: none; transition: border-color .15s, box-shadow .15s; min-height: 168px; }
.pcard:hover { border-color: #cfcec8; box-shadow: 0 2px 8px rgba(22,24,29,.05); }
.pcard-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pcard h3 { font-size: 16px; }
.pcard .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.vbar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line-soft); gap: 2px; }
.vbar span { display: block; height: 100%; }
.vbar .high { background: var(--up); } .vbar .low { background: var(--down); }
.vbar .ok { background: var(--ok); } .vbar .busy { background: #cfd0cc; }
.vlegend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.vlegend b { color: var(--text); font-weight: 600; margin-right: 3px; }
.vlegend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.pcard-foot { margin-top: auto; color: var(--faint); font-size: 12.5px; display: flex; justify-content: space-between; gap: 8px; }
.pcard-add { border-style: dashed; background: transparent; box-shadow: none; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.pcard-add:hover { background: var(--surface); }
.plus { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; background: var(--surface); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; }
.field small { color: var(--faint); font-size: 12.5px; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .select {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.select-sm { height: 30px; font-size: 13px; padding: 0 8px; width: auto; }
.input:focus, .field input:focus, .field select:focus, .select:focus { outline: none; border-color: #9fb3ea; box-shadow: 0 0 0 3px rgba(37,87,214,.12); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 14px; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 14px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 18px; line-height: 1; }
details.more[open] > summary::before { transform: rotate(90deg); }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert-err { background: var(--up-bg); color: var(--up); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-info { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* ---------- auth ---------- */
.auth { min-height: calc(100vh - 56px); display: grid; place-items: center; padding: 32px 16px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box .card { padding: 28px; }
.auth-box h1 { font-size: 22px; margin-bottom: 4px; }
.auth-box .lead { color: var(--muted); margin-bottom: 22px; }
.auth-box .field + .field { margin-top: 14px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }

/* ---------- empty / running ---------- */
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.running { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; margin-top: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.log { background: #fbfbf9; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px 14px; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: #3d4048; max-height: 320px; overflow: auto; white-space: pre-wrap; margin: 10px 0 0; }

/* runs list */
.runs { list-style: none; margin: 0; padding: 0; }
.runs li { padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.runs li:last-child { border-bottom: 0; }
.run-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.run-row .when { color: var(--muted); font-size: 13px; margin-left: auto; }
.runs details > summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 6px; }

/* day nav */
.daynav { display: flex; align-items: center; gap: 6px; }
.iconbtn { width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; text-decoration: none; color: var(--text); }
.iconbtn:hover { background: var(--bg); }
.iconbtn.off { opacity: .35; pointer-events: none; }
.iconbtn svg { width: 16px; height: 16px; }

.ext { width: 13px; height: 13px; vertical-align: -1px; margin-left: 4px; color: var(--faint); }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .topbar-in { height: auto; flex-wrap: wrap; gap: 0 12px; padding: 10px 16px 0; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; padding: 8px 0 8px; margin: 0 -4px; }
  .who { display: none; }
  .container { padding: 20px 16px 48px; }
  h1 { font-size: 21px; }
  .page-head { align-items: flex-start; }
  .page-head .actions { width: 100%; flex-direction: column; }
  .page-head .actions > form, .page-head .actions > .btn { width: 100%; }
  .page-head .actions .btn { width: 100%; height: 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .card-pad { padding: 16px; }
  .card-head { padding: 14px 16px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 22px; }
  .pgrid { grid-template-columns: 1fr; }

  /* tables become stacked cards */
  .table.stack-sm thead { display: none; }
  .table.stack-sm, .table.stack-sm tbody, .table.stack-sm tr, .table.stack-sm td { display: block; width: 100%; }
  .table.stack-sm tr { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
  .table.stack-sm tr:last-child { border-bottom: 0; }
  .table.stack-sm td { border: 0; padding: 3px 0 !important; text-align: left !important; }
  .table.stack-sm td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; display: inline-block; min-width: 150px; padding-right: 10px; }
  .table.stack-sm td.hide-sm { display: none; }

  /* dashboard rows: compact grid */
  .table.dash tr { display: grid !important; grid-template-columns: 1fr auto; gap: 6px 12px; }
  .table.dash td.d-date { grid-column: 1; grid-row: 1; align-self: center; }
  .table.dash td.d-verdict { grid-column: 2; grid-row: 1; text-align: right !important; }
  .table.dash td.d-bar { grid-column: 1 / -1; grid-row: 2; }
  .table.dash td.d-nums { grid-column: 1 / -1; grid-row: 3; display: flex !important; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
  .table.dash td.d-nums b { color: var(--text); }
  .table.dash td.d-wide { display: none !important; }
}
@media (min-width: 721px) {
  .only-sm { display: none !important; }
}
@media (max-width: 720px) { .hide-xs { display: none; } }
@media (max-width: 720px) {
  .table.stack-sm tr.mine { background: #fafaf6; }
  .table.stack-sm tr.mine td { background: transparent; }
}

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-title { display: flex; align-items: center; gap: 8px; }
.cal-title h2 { font-size: 20px; min-width: 170px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); }
.cal-wd { font-size: 12px; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-transform: uppercase; letter-spacing: .04em; }
.cal-day { position: relative; min-height: 96px; padding: 8px 0 6px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: var(--surface); user-select: none; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day .dn { display: inline-grid; place-items: center; min-width: 26px; height: 26px; margin-left: 8px; border-radius: 13px; font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-day.out { background: #fbfbf9; }
.cal-day.out .dn { color: var(--faint); }
.cal-day.past:not(.out) .dn { color: var(--muted); }
.cal-day.today .dn { background: var(--ink); color: #fff; }
.cal-day.free.can { cursor: pointer; }
.cal-day.free.can:hover { background: #f8f9fc; }
.cal-day.sel, .cal-day.range { background: #eef2fd !important; }
.cal-day.sel .dn { background: var(--accent); color: #fff; }
.band { position: absolute; left: 0; right: 0; bottom: 10px; height: 28px; display: flex; align-items: center; padding: 0 8px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; cursor: pointer; }
.band.booking { background: #e5edfd; color: #1f47b0; }
.band.block { background: #ecece8; color: var(--muted); }
.band.first { left: 6px; border-top-left-radius: 7px; border-bottom-left-radius: 7px; border-left: 3px solid currentColor; }
.band.last { right: 6px; border-top-right-radius: 7px; border-bottom-right-radius: 7px; }
.band span { overflow: hidden; text-overflow: ellipsis; }
.band:hover { filter: brightness(.97); }
.cal-hint { font-size: 13px; color: var(--muted); }
.cal-hint.active { color: var(--accent); font-weight: 500; }

.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); }
.mini-stats > div { padding: 14px 20px; border-right: 1px solid var(--line-soft); }
.mini-stats > div:last-child { border-right: 0; }
.mini-stats b { display: block; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }

.list-row { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line-soft); cursor: default; }
.list-row:last-child { border-bottom: 0; }
.list-row.clickable { cursor: pointer; }
.list-row.clickable:hover { background: #fafaf8; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .sub { color: var(--muted); font-size: 13px; }
.list-row .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.booking { background: #1f47b0; } .dot.block { background: #b9bab5; } .dot.exp { background: var(--up); } .dot.util { background: #c58a1d; }

/* ---------- dialog ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 14px; width: calc(100% - 32px); max-width: 480px; max-height: calc(100% - 32px);
  box-shadow: 0 20px 50px rgba(22,24,29,.18); color: var(--text); }
dialog.modal::backdrop { background: rgba(22,24,29,.32); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-body { padding: 10px 20px 20px; }
.modal-foot { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line-soft); background: #fbfbf9; border-radius: 0 0 14px 14px; }
.x { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--faint); cursor: pointer; padding: 4px; }
.x:hover { color: var(--text); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .field + .field, .modal .row2 + .field, .modal .field + .row2, .modal .row2 + .row2 { margin-top: 12px; }
.seg-full { display: flex; width: 100%; }
.seg-full button, .seg-full label { flex: 1; text-align: center; }
.seg label { border-radius: 7px; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--text); }
.seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(22,24,29,.08); }
.exp-mini { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.exp-mini .it { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.exp-mini .it .grow { flex: 1; }

/* ---------- statement ---------- */
.receipt { padding: 6px 20px 16px; }
.receipt .ln { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.receipt .ln:last-child { border-bottom: 0; }
.receipt .ln .l { color: var(--muted); }
.receipt .ln.minus .r::before { content: "− "; color: var(--faint); }
.receipt .ln.sum { border-bottom: 0; border-top: 1px solid var(--ink); margin-top: 4px; padding-top: 12px; font-weight: 600; font-size: 16px; }
.receipt .ln.sum .l { color: var(--text); }
.neg { color: var(--up); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-opt { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.mode-opt + .mode-opt { margin-top: 8px; }
.mode-opt:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.mode-opt { font-size: 14px; font-weight: 500; }
.mode-opt input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0 8px 0 0; vertical-align: -3px; }
.mode-opt small { display: block; color: var(--faint); font-weight: 400; margin: 4px 0 0 24px; }
.linkbox { display: flex; gap: 8px; margin-top: 10px; }
.linkbox input { flex: 1; font-size: 13px; }

@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .cal-day { min-height: 54px; padding-top: 4px; }
  .cal-day .dn { margin-left: 4px; font-size: 12.5px; min-width: 22px; height: 22px; }
  .cal-wd { padding: 6px 4px; text-align: center; font-size: 11px; }
  .band { height: 8px; bottom: 6px; padding: 0; }
  .band span { display: none; }
  .band.first { left: 3px; border-left-width: 0; }
  .band.last { right: 3px; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .mini-stats > div:nth-child(2) { border-right: 0; }
  .mini-stats > div:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .mini-stats > div { padding: 12px 16px; }
  .list-row { padding: 12px 16px; }
  .cal-title h2 { min-width: 0; font-size: 18px; }
  dialog.modal { margin-bottom: 0; border-radius: 14px 14px 0 0; max-width: none; width: 100%; max-height: 92%; }
  .modal-foot { border-radius: 0; }
  .receipt { padding: 4px 16px 12px; }
}
.modal .row2 > .field + .field { margin-top: 0; }
.x:focus-visible { outline: 2px solid #9fb3ea; border-radius: 6px; }
.x:focus:not(:focus-visible) { outline: none; }
.mainnav { scrollbar-width: none; min-width: 0; overflow-x: auto; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { white-space: nowrap; }
/* tablets: the e-mail does not fit next to the menu */
@media (max-width: 1100px) { .who { display: none; } }
/* tablets: the price table loses the "nearby" column; wide tables scroll inside their card, not the page */
@media (min-width: 721px) and (max-width: 960px) {
  .table th { white-space: normal; }
  .card:has(> .table) { overflow-x: auto; }
}
.table td.r { white-space: nowrap; }
/* phones and tablets: fade the right edge so scrollable menus show there is more */
@media (max-width: 1100px) {
  .mainnav {
    padding-right: 28px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
}
@media (max-width: 720px) {
  .tabs {
    padding-right: 28px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
}
@media (max-width: 720px) {
  .band.booking { background: #5b7fe0; }
  .band.block { background: #b9bab5; }
}

/* ---------- price calendar: small month picker next to the daily table ---------- */
.pgrid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.pcal-card { padding: 14px; position: sticky; top: 72px; }
.pcal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pcal-head .iconbtn { width: 32px; height: 32px; }
.pcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.pcal-wd { font-size: 11px; color: var(--faint); text-align: center; padding: 2px 0 4px; text-transform: uppercase; }
.pcal-d { display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; font-size: 13px; font-weight: 500;
  font-variant-numeric: tabular-nums; color: var(--faint); text-decoration: none; }
a.pcal-d { color: var(--text); background: var(--bg); }
a.pcal-d:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
a.pcal-d.c-high { background: var(--up-bg); color: var(--up); }
a.pcal-d.c-low { background: var(--down-bg); color: var(--down); }
a.pcal-d.c-ok { background: var(--ok-bg); color: var(--ok); }
a.pcal-d.c-busy { background: var(--busy-bg); color: var(--busy); text-decoration: line-through; }
.pcal-d.past { opacity: .5; }
.pcal-d.today { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.pcal-d.sel { box-shadow: inset 0 0 0 2px var(--ink); }
.pcal-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.pcal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.pcal-legend i.c-high { background: var(--up-bg); box-shadow: inset 0 0 0 1px var(--up); }
.pcal-legend i.c-ok { background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok); }
.pcal-legend i.c-low { background: var(--down-bg); box-shadow: inset 0 0 0 1px var(--down); }
.pcal-legend i.c-busy { background: var(--busy-bg); box-shadow: inset 0 0 0 1px var(--busy); }
.table tr.gap-row td { color: var(--faint); font-size: 13px; padding-top: 8px; padding-bottom: 8px; background: #fbfbf9; }
.table tr.wknd td.d-date b { color: var(--up); }
.day-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.day-sum > div { display: flex; flex-direction: column; }
.day-sum b { font-size: 17px; font-variant-numeric: tabular-nums; }
@media (max-width: 1180px) {
  .pgrid { grid-template-columns: minmax(0, 1fr); }
  .pcal-card { position: static; max-width: 420px; }
}
@media (max-width: 720px) {
  .pcal-card { max-width: none; }
  .table.dash tr.gap-row { display: block !important; }
  .table.dash tr.gap-row td { padding: 0 !important; background: transparent; }
  .table.stack-sm tr.gap-row { padding: 10px 16px; background: #fbfbf9; }
  .day-sum { padding: 12px 16px; gap: 8px 20px; }
}
@media (max-width: 720px) { .pcal-d { aspect-ratio: auto; height: 40px; } }
.sub.util-note { color: #a06c0c; }
.receipt .ln .r { white-space: nowrap; }
