/* Cabin ops: a calm, warm admin for one cabin. */
:root {
  --bg: #f5f3ee;
  --panel: #ffffff;
  --panel-2: #faf9f6;
  --side: #1f2a24;
  --side-text: #c9d3cc;
  --side-active: #2f3d35;
  --text: #1d2420;
  --muted: #5f6761;
  --faint: #6e756f;
  --line: #e6e2d9;
  --line-2: #efece5;
  --accent: #2f6f4f;
  --accent-soft: #e3efe7;
  --accent-text: #ffffff;
  --warn: #8f5300;
  --warn-soft: #fbf0dc;
  --bad: #b42318;
  --bad-soft: #fde9e7;
  --good: #1f7a4d;
  --good-soft: #e1f3e8;
  --airbnb: #e0565b;
  --airbnb-soft: #fde6e6;
  --vrbo: #2f6bd8;
  --vrbo-soft: #e2ebfb;
  --direct: #2f8a5b;
  --direct-soft: #def2e6;
  --practice: #7a5cc4;
  --practice-soft: #ece6fa;
  /* Text on the soft channel colours, and bars with white text */
  --airbnb-text: #b8383e; --vrbo-text: #2559b8; --direct-text: #1f6b44; --practice-text: #5e43a6;
  --airbnb-strong: #c8454a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 36, 32, .05), 0 4px 16px rgba(29, 36, 32, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614;
    --panel: #1a1f1c;
    --panel-2: #161a18;
    --side: #0e1210;
    --side-text: #aab5ad;
    --side-active: #1f2823;
    --text: #e8ebe8;
    --muted: #9ba49d;
    --faint: #6f7871;
    --line: #2a312d;
    --line-2: #222825;
    --accent: #5fb98a;
    --accent-soft: #1d3127;
    --accent-text: #0c140f;
    --warn: #e3a33b;
    --warn-soft: #33270f;
    --bad: #f97066;
    --bad-soft: #3a1a17;
    --good: #5fb98a;
    --good-soft: #1b3025;
    --airbnb: #f07a7e;
    --airbnb-soft: #3b1f20;
    --vrbo: #6d9cf0;
    --vrbo-soft: #1c2840;
    --direct: #5fb98a;
    --direct-soft: #1b3025;
    --practice: #a68bea;
    --practice-soft: #2a2340;
    --airbnb-text: #f07a7e; --vrbo-text: #6d9cf0; --direct-text: #5fb98a; --practice-text: #a68bea; --airbnb-strong: #c8454a;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --panel: #1a1f1c; --panel-2: #161a18; --side: #0e1210; --side-text: #aab5ad; --side-active: #1f2823;
  --text: #e8ebe8; --muted: #9ba49d; --faint: #6f7871; --line: #2a312d; --line-2: #222825;
  --accent: #5fb98a; --accent-soft: #1d3127; --accent-text: #0c140f; --warn: #e3a33b; --warn-soft: #33270f;
  --bad: #f97066; --bad-soft: #3a1a17; --good: #5fb98a; --good-soft: #1b3025;
  --airbnb: #f07a7e; --airbnb-soft: #3b1f20; --vrbo: #6d9cf0; --vrbo-soft: #1c2840; --direct: #5fb98a; --direct-soft: #1b3025;
  --practice: #a68bea; --practice-soft: #2a2340; --airbnb-text: #f07a7e; --vrbo-text: #6d9cf0; --direct-text: #5fb98a; --practice-text: #a68bea; --airbnb-strong: #c8454a; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 12px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 0 8px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { color: var(--side-text); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
  color: var(--side-text); text-decoration: none; font-weight: 500;
}
.nav-link svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-link:hover { background: var(--side-active); color: #fff; }
.nav-link.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #7fd3a6; }
.count { margin-left: auto; background: #e8604c; color: #fff; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 20px; }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px; }
.side-foot .link { color: var(--side-text); }
.mode { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.mode.practice { background: #3d3420; color: #f4cf7c; }
.mode.live { background: #1f3d2c; color: #8fe0b2; }
.main { min-width: 0; padding: 28px 32px 64px; }
.page { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.practice-bar {
  background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  padding: 10px 14px; border-radius: 12px; font-size: 14px;
}
.practice-bar strong { color: var(--warn); }
.flash { padding: 10px 14px; border-radius: 12px; background: var(--good-soft); border: 1px solid color-mix(in srgb, var(--good) 30%, transparent); font-size: 14px; }
.flash.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }

/* ---------- Cards & grids ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.card-head .hint { color: var(--muted); font-size: 13px; }
.card-body { padding: 16px 18px; }
.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)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.empty { color: var(--muted); padding: 22px 18px; text-align: center; }

/* Stat tiles */
.tile { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-height: 124px; }
.tile .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.tile .value { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.tile .meta { color: var(--muted); font-size: 13px; }
.tile.accent { background: linear-gradient(160deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 75%, #000) 100%); border-color: transparent; color: #fff; }
.tile.accent .label, .tile.accent .meta { color: rgba(255,255,255,.8); }
.big-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; font-weight: 700; letter-spacing: .08em; }

/* ---------- Buttons & inputs ---------- */
button, .btn {
  font: inherit; font-size: 14px; font-weight: 550; padding: 7px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.3;
}
button:hover, .btn:hover { border-color: var(--faint); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { filter: brightness(1.06); }
button.danger { color: var(--bad); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--line-2); color: var(--text); }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
button.link { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 0; font-weight: 400; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 12px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; line-height: 1.5; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
label.check input { width: auto; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 28px; }
.input-suffix span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }

/* ---------- Pills & chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.pill.good, .pill.active, .pill.sent, .pill.done, .pill.confirmed { background: var(--good-soft); color: var(--good); }
.pill.warn, .pill.pending, .pill.scheduled, .pill.notified, .pill.new { background: var(--warn-soft); color: var(--warn); }
.pill.bad, .pill.failed, .pill.urgent { background: var(--bad-soft); color: var(--bad); }
.pill.action { background: var(--warn-soft); color: var(--warn); }
.pill.removed, .pill.skipped, .pill.cancelled { background: var(--line-2); color: var(--faint); }
.dot { width: 9px; height: 9px; border-radius: 99px; display: inline-block; flex: none; background: var(--faint); }
.ch-airbnb { --ch: var(--airbnb); --ch-soft: var(--airbnb-soft); --ch-text: var(--airbnb-text); --ch-strong: var(--airbnb-strong); }
.ch-vrbo { --ch: var(--vrbo); --ch-soft: var(--vrbo-soft); --ch-text: var(--vrbo-text); }
.ch-direct { --ch: var(--direct); --ch-soft: var(--direct-soft); --ch-text: var(--direct-text); --ch-strong: var(--direct-text); }
.ch-practice { --ch: var(--practice); --ch-soft: var(--practice-soft); --ch-text: var(--practice-text); }
.ch-other { --ch: var(--faint); --ch-soft: var(--line-2); }
.ch-owner { --ch: #6b7280; --ch-soft: #eceef1; --ch-text: #4b5563; --ch-strong: #5b6270; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--ch-soft, var(--line-2)); color: var(--ch-text, var(--ch, var(--muted))); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: var(--ch, var(--faint)); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
tr.selected td { background: var(--accent-soft); }
tr.here td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr.past td { color: var(--faint); }
td.money, th.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
/* A secondary line under a name or title, wherever it appears. */
.sub { display: block; }
span.chip + .sub, .pill + .sub { display: inline; }

/* ---------- Needs-you list ---------- */
.needs { display: flex; flex-direction: column; }
.need { display: grid; grid-template-columns: 4px 1fr auto; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); align-items: start; }
.need:last-child { border-bottom: 0; }
.need .bar { border-radius: 4px; align-self: stretch; background: var(--faint); }
.need.urgent .bar { background: var(--bad); }
.need.action .bar { background: var(--warn); }
.need.info .bar { background: var(--vrbo); }
.need.draft .bar { background: var(--accent); }
.need pre { white-space: pre-wrap; font: inherit; font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.need blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--line); color: var(--muted); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.need textarea { margin-top: 6px; }

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 18px; }
.tl-day h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.tl-item { display: grid; grid-template-columns: 68px 28px 1fr; gap: 8px; align-items: start; padding: 6px 0; }
.tl-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 3px; }
.tl-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; }
.tl-icon.arrive { background: var(--good-soft); color: var(--good); }
.tl-icon.depart { background: var(--vrbo-soft); color: var(--vrbo); }
.tl-icon.clean { background: var(--warn-soft); color: var(--warn); }
.tl-icon.message { background: var(--line-2); color: var(--muted); }
.tl-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Occupancy strip ---------- */
.strip { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 22px 3px; }
.strip .cell { height: 30px; border-radius: 5px; background: var(--line-2); position: relative; }
.strip .cell.weekend { background: color-mix(in srgb, var(--line) 80%, var(--bg)); }
.strip .cell.booked { background: var(--ch); }
.strip .cell.ch-practice.booked { background: repeating-linear-gradient(45deg, var(--practice), var(--practice) 4px, var(--practice-soft) 4px, var(--practice-soft) 8px); }
.strip .cell span { position: absolute; bottom: -18px; left: 0; font-size: 10px; color: var(--faint); white-space: nowrap; }
.strip-wrap { padding-bottom: 20px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--ch); display: inline-block; }

/* ---------- Month calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line-2); }
.cal .dow { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.cal .day { min-height: 92px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px 0 6px; display: flex; flex-direction: column; gap: 3px; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day .n { font-size: 13px; color: var(--muted); padding: 0 8px; font-variant-numeric: tabular-nums; }
.cal .day.other .n { color: var(--faint); opacity: .6; }
.cal .day.today .n { color: var(--accent-text); background: var(--accent); border-radius: 99px; width: 24px; height: 24px; display: grid; place-items: center; margin-left: 4px; padding: 0; font-weight: 700; }
.cal .ev { height: 22px; background: var(--ch-strong, var(--ch)); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; padding: 0 8px; cursor: pointer; white-space: nowrap; overflow: hidden; border: 0; border-radius: 0; width: 100%; }
.cal .ev.in { margin-left: 45%; width: 55%; border-radius: 6px 0 0 6px; }
.cal .ev.out { width: 40%; border-radius: 0 6px 6px 0; }
.cal .ev.mid { }
.cal .ev.ch-practice { background: repeating-linear-gradient(45deg, var(--practice), var(--practice) 5px, color-mix(in srgb, var(--practice) 70%, #fff) 5px, color-mix(in srgb, var(--practice) 70%, #fff) 10px); }

/* ---------- Detail drawer ---------- */
.detail { position: sticky; top: 20px; }
.detail .kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 14px; }
.detail .kv dt { color: var(--muted); }
.detail .kv dd { margin: 0; }
.convo { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; }
.bubble { padding: 8px 12px; border-radius: 12px; background: var(--line-2); font-size: 14px; max-width: 90%; }
.bubble.host { background: var(--accent-soft); align-self: flex-end; }

/* ---------- Rates ---------- */
.channel-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; border-top: 4px solid var(--ch); }
.channel-card .presets { display: flex; gap: 6px; flex-wrap: wrap; }
.channel-card .presets button.on { background: var(--ch-soft); border-color: var(--ch); color: var(--ch-text, var(--ch)); }
.price-cell { white-space: nowrap; }
.price-cell .kept { display: block; font-size: 12px; color: var(--muted); }
.price-cell .kept.short { color: var(--warn); }
tr.current td { background: var(--accent-soft); }

/* ---------- Money ---------- */
.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: end; height: 190px; padding-top: 10px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; cursor: pointer; background: none; border: 0; padding: 0; }
.bar-pair { display: flex; gap: 4px; align-items: flex-end; height: 140px; width: 100%; justify-content: center; }
.bar-pair i { display: block; width: 38%; max-width: 26px; border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar-pair .rev { background: var(--accent); }
.bar-pair .cost { background: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.bar-col .lbl { font-size: 12px; color: var(--muted); }
.bar-col .pl { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-col .pl.neg { color: var(--bad); }
.bar-col.current .lbl { color: var(--text); font-weight: 700; }
.profit-big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.profit-big.neg { color: var(--bad); }
.ledger { display: flex; flex-direction: column; }
.ledger .line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.ledger .line .sub { display: block; margin-top: 1px; }
.ledger .line:last-child { border-bottom: 0; }
.ledger .line.total { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; margin-top: 4px; }

/* ---------- Guests ---------- */
.avatar { width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; flex: none; }
.who { display: flex; gap: 10px; align-items: center; }
.toggle { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.toggle.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.toggle.on.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.offer { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.offer:last-child { border-bottom: 0; }

/* ---------- Settings & misc ---------- */
.check-list { display: flex; flex-direction: column; }
.check-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); align-items: center; }
.check-item:last-child { border-bottom: 0; }
.tick { width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.tick.ok { background: var(--good-soft); color: var(--good); }
.tick.no { background: var(--line-2); color: var(--faint); }
.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line-2); }
.step:last-child { border-bottom: 0; }
.outbox-body { white-space: pre-wrap; font-size: 13px; color: var(--muted); max-height: 7.5em; overflow: hidden; }
pre.preview { white-space: pre-wrap; font: inherit; font-size: 14px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; margin: 0; }
details summary { cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 550; }
details[open] summary { margin-bottom: 8px; }
.device { display: flex; gap: 14px; align-items: flex-start; }
.device-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--line-2); flex: none; }
.device-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--line-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .detail { position: static; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
  .brand-text small { display: none; }
  .nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; gap: 4px; scrollbar-width: none; }
  .nav-link { padding: 7px 10px; white-space: nowrap; }
  .nav-link.active { box-shadow: inset 0 -2px 0 #7fd3a6; }
  .side-foot { margin: 0 0 0 auto; padding: 0; }
  .main { padding: 18px 16px 48px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .strip { grid-template-columns: repeat(15, minmax(0, 1fr)); row-gap: 22px; }
  .cal .day { min-height: 64px; }
  .cal .ev { font-size: 0; height: 10px; }
  h1 { font-size: 22px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .tile { min-height: 0; }
  td, th { padding: 10px; }
}

/* Forecast table: losses in red. */
td.neg, strong.neg { color: var(--bad); }
/* Phones: wide tables become one card per row, each cell labelled. */
@media (max-width: 640px) {
  table.stack-table thead { display: none; }
  table.stack-table, table.stack-table tbody, table.stack-table tr, table.stack-table td { display: block; width: 100%; }
  table.stack-table tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.stack-table td { padding: 3px 0; border: 0; text-align: left; white-space: normal; }
  table.stack-table td.money, table.stack-table td.right { text-align: left; }
  table.stack-table td[data-label]::before {
    content: attr(data-label); display: inline-block; min-width: 104px; margin-right: 6px;
    color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  }
  table.stack-table td[data-label] .sub { display: inline; margin-left: 4px; }
  table.stack-table td:empty { display: none; }
}
@media (max-width: 640px) {
  th, td { padding-left: 10px; padding-right: 10px; }
  td { overflow-wrap: break-word; }
}
/* Long unbroken text (URLs, pasted codes) must never widen the page. */
.card { overflow-wrap: break-word; min-width: 0; }
/* Inside tables "break-word" keeps words whole; the table-wrap scrolls instead. */
.card button, .card .pill, .card .chip, .card .mono, .card select, .card input, .card th { overflow-wrap: normal; white-space: nowrap; }
.chip, .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 641px) {
  table.stack-table td:first-child { min-width: 210px; }
}

tr.day-row th { background: var(--line-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding-top: 6px; padding-bottom: 6px; }

.pill.up-overdue { background: var(--bad-soft); color: var(--bad); }
.pill.up-soon { background: var(--warn-soft); color: var(--warn); }
.pill.up-ok { background: var(--good-soft); color: var(--good); }

.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.supply { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 99px; padding: 2px 4px 2px 12px; background: var(--panel); font-size: 13px; }
.supply .link { text-decoration: none; color: inherit; font-weight: 500; }
.supply.low { border-color: var(--warn); background: var(--warn-soft); }
.supply.low .link { color: var(--warn); font-weight: 700; }
.supply .tiny-x { font-size: 11px; padding: 2px 6px; color: var(--faint); }
.supply-add { display: flex; gap: 8px; align-items: center; }
.supply-add input { flex: 1; min-width: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.login-title { font-size: 1.25rem; margin: 0; }

.card p.empty { color: var(--muted); }
.warn-text { color: var(--warn); font-weight: 600; }
/* Guest guidebook (/g/<token>/) */
.guide { max-width: 640px; margin: 0 auto; padding: 24px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.guide-head h1 { margin: 2px 0 0; font-size: 1.6rem; }
.guide-code { font-size: 2.4rem; font-weight: 700; letter-spacing: .18em; margin: 0; }
.guide-list { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.guide-foot { text-align: center; }
.guide .ledger .line span:first-child { white-space: nowrap; }

.checklist { list-style: none; margin: 0; padding: 4px 18px 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 4px 20px; }
.checklist li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.checklist .mark { width: 18px; flex: none; font-weight: 700; }
.checklist li.ok .mark { color: var(--good); }
.checklist li.miss .mark { color: var(--bad); }
.checklist li.todo .mark { color: var(--warn); }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
