/* Rate Desk — calm, legible, built for front-desk and owner use on any screen. */
:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --surface-2: #f0efea;
  --line: #dfddd5;
  --text: #17171a;
  --text-2: #52514e;
  --muted: #7a7973;
  --brand: #1d3a5f;
  --brand-ink: #ffffff;
  --accent: #b7862b;
  --accent-soft: #f6ecd6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --band: rgba(122, 121, 115, .16);
  --ok: #1d7a46; --ok-soft: #e3f3e9;
  --warn: #8a5a00; --warn-soft: #fbf0d6;
  --err: #b42318; --err-soft: #fbe7e5;
  /* sequential demand scale: one hue, light → dark */
  --d-low: #f5f7fa; --d-normal: #e4edf8; --d-high: #bcd3ef; --d-peak: #8fb4e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 1px rgba(0,0,0,.03);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
}
/* Light theme is the default. Dark theme only when the user picks it (Theme link in the menu). */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #121212; --surface: #1a1a19; --surface-2: #222220; --line: #33322f;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #94938b;
    --brand: #8fb4e3; --brand-ink: #0f1a29; --accent: #d9a84a; --accent-soft: #3a2f18;
    --series-1: #3987e5; --series-2: #d95926; --band: rgba(195, 194, 183, .14);
    --ok: #5cc48a; --ok-soft: #173326; --warn: #e2b04a; --warn-soft: #362a10; --err: #f08b80; --err-soft: #3a1a17;
    --d-low: #1c1f24; --d-normal: #1f2a38; --d-high: #26405f; --d-peak: #2f5b8e;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; font-weight: 650; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.up { color: var(--err); } .down { color: var(--ok); }

/* ------------------------------------------------------------ layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: var(--brand-ink); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
:root[data-theme="dark"] .sidebar { background: #16202d; color: #e8eef6; }
.brand { display: flex; gap: 10px; align-items: center; margin: 2px 6px 22px; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #1a1405; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.brand-name { font-weight: 700; font-size: 1.05rem; }
.brand-sub { font-size: .76rem; opacity: .75; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { color: inherit; opacity: .86; padding: 9px 12px; border-radius: 8px; font-size: .94rem; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; opacity: 1; }
.nav a.on { background: rgba(255,255,255,.14); opacity: 1; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; margin: 16px 12px 4px; }
.me { border-top: 1px solid rgba(255,255,255,.15); padding: 14px 8px 0; margin-top: 16px; font-size: .88rem; }
.me-name { font-weight: 600; }
.me-role { opacity: .7; font-size: .8rem; }
.me-actions { display: flex; gap: 14px; margin-top: 8px; }
.me-actions a, .linkbtn { color: inherit; opacity: .85; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

.main { padding: 20px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { flex: 1; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-btn { display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 1.1rem; color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.narrow { max-width: 560px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card h2 + p { margin-top: 4px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.settings .two-col { grid-template-columns: 1fr 1fr; }
.two-col > .card { margin-bottom: 18px; }

/* ------------------------------------------------------------ controls */
label { display: block; font-size: .86rem; color: var(--text-2); margin-bottom: 12px; }
label > input:not([type=checkbox]):not([type=radio]):not([type=range]), label > select, label > .money-input, label > .range-wrap { display: flex; margin-top: 4px; }
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--series-1); outline-offset: 0; border-color: transparent; }
input:disabled { background: var(--surface-2); color: var(--text-2); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=range] { padding: 0; border: 0; accent-color: var(--brand); background: transparent; }
input[type=file] { padding: 6px; }
.num-sm { width: 86px !important; text-align: right; }
.range-wrap { display: flex; align-items: center; gap: 12px; }
.range-wrap output { min-width: 52px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.range-wrap.big input { flex: 1; }
.range-wrap.big output { font-size: 1.3rem; }
.money-input { align-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding-left: 10px; }
.money-input input { border: 0; width: 100px; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
fieldset.plain { margin: 0; }
legend { font-size: .86rem; color: var(--text-2); margin-bottom: 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; margin: 0 14px 6px 0; color: var(--text); }
.check-row { display: flex; flex-wrap: wrap; }
.self-end { align-self: end; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 16px; }
.span2 { grid-column: span 2; }
.form-foot { display: flex; justify-content: flex-end; align-items: flex-end; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.form-foot .grow, .grow { flex: 1; margin-bottom: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form label { margin: 0; }
form.inline { display: inline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 550; font-size: .92rem; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.1); }
.btn-danger { color: var(--err); }
.btn-sm { padding: 5px 10px; font-size: .84rem; }
.btn-block { width: 100%; margin-bottom: 8px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.flashes { margin-bottom: 16px; display: grid; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 8px; border: 1px solid; font-size: .92rem; }
.flash-success { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.flash-error { background: var(--err-soft); border-color: transparent; color: var(--err); }
.flash-info { background: var(--surface); border-color: var(--line); }
.callout { background: var(--accent-soft); padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: .92rem; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.callout-warn { background: var(--warn-soft); }

.tag { display: inline-block; font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-override { background: var(--accent-soft); color: var(--warn); }
.tag-event { background: var(--d-normal); color: var(--text); }
.tag-low { background: var(--d-low); color: var(--text-2); border: 1px solid var(--line); }
.tag-normal { background: var(--d-normal); color: var(--text); }
.tag-high { background: var(--d-high); color: var(--text); }
.tag-peak { background: var(--d-peak); color: var(--text); }

/* ------------------------------------------------------------ tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.table input { padding: 6px 8px; }
.table .inactive { opacity: .55; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.actions { white-space: nowrap; text-align: right; }
.actions > * { margin-left: 4px; }
.row-warn td { background: var(--err-soft); }
.add-row td { background: var(--surface-2); }
.comp-table td:first-child input { min-width: 220px; }
.inline-details { display: inline-block; }
.inline-details summary { list-style: none; }
.inline-details[open] form { margin-top: 6px; }

.grid { border-collapse: separate; border-spacing: 0; font-size: .88rem; min-width: 100%; }
.grid th, .grid td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.grid thead th { font-weight: 500; color: var(--text-2); font-size: .8rem; position: relative; }
.grid thead th a { color: inherit; }
.grid .sticky-col { position: sticky; left: 0; background: var(--surface); text-align: left; z-index: 1; font-weight: 600; min-width: 150px; color: var(--text); font-size: .86rem; }
.grid .wknd { background: var(--surface-2); }
.grid .ctx-row td, .grid .ctx-row th { font-size: .78rem; color: var(--muted); font-weight: 400; }
.grid .cell { min-width: 84px; }
.rate-input { width: 76px; text-align: right; padding: 6px 7px; font-variant-numeric: tabular-nums; font-weight: 600; }
.rate-input.is-dirty { outline: 2px solid var(--accent); }
.rate-input.is-sample { font-style: italic; color: var(--muted); font-weight: 400; }
.rate-input.is-soldout { color: var(--err); }
.cell.is-override .rate-input { background: var(--accent-soft); border-color: var(--accent); }
.rec { display: block; font-size: .68rem; color: var(--muted); margin-top: 2px; }
.dot-event { color: var(--accent); margin-left: 2px; }
.rate-ro { font-weight: 600; }

/* ------------------------------------------------------------ dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi-label { font-size: .78rem; color: var(--text-2); }
.kpi-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .8rem; color: var(--muted); }

.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--text-2); flex-wrap: wrap; }
.legend span, .cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; }
.sw-line { height: 3px; border-radius: 2px; width: 18px; }
.sw-line.s1 { background: var(--series-1); }
.sw-line.s2 { background: var(--series-2); }
.sw-band { background: var(--band); height: 10px; width: 18px; }
.chart { position: relative; min-height: 280px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line-1 { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; }
.chart .line-2 { fill: none; stroke: var(--series-2); stroke-width: 2; stroke-linejoin: round; stroke-dasharray: 0; }
.chart .band { fill: var(--band); }
.chart .ev-mark { fill: var(--accent); }
.chart .ov-mark { fill: var(--surface); stroke: var(--series-1); stroke-width: 2; }
.chart .xhair { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hover-dot { stroke: var(--surface); stroke-width: 2; }
.chart .label-end { font-size: 11px; font-weight: 600; fill: var(--text-2); }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.12); border-radius: 8px; padding: 9px 11px; font-size: .82rem; min-width: 180px; z-index: 5; }
.tooltip .tt-date { font-weight: 650; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); }
.tooltip .tt-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.tooltip .tt-key { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.tooltip .tt-ev { margin-top: 5px; color: var(--warn); }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; }
.cal-dow { font-size: .74rem; color: var(--muted); text-align: center; padding-bottom: 4px; text-transform: uppercase; letter-spacing: .05em; }
.cal-cell { position: relative; display: flex; flex-direction: column; min-height: 86px; padding: 6px 7px 9px; border-radius: 8px; color: var(--text); border: 1px solid transparent; overflow: hidden; }
.cal-cell:hover { border-color: var(--series-1); text-decoration: none; }
.cal-cell.demand-low { background: var(--d-low); border-color: var(--line); }
.cal-cell.demand-normal { background: var(--d-normal); }
.cal-cell.demand-high { background: var(--d-high); }
.cal-cell.demand-peak { background: var(--d-peak); }
.cal-cell.other-month { opacity: .4; }
.cal-cell.is-past { opacity: .55; }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-day { font-size: .76rem; color: var(--text-2); display: flex; justify-content: space-between; }
.cal-rate { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.cal-sub { font-size: .7rem; color: var(--text-2); }
.cal-event { font-size: .68rem; color: var(--text); background: rgba(255,255,255,.55); border-radius: 4px; padding: 0 4px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-theme="dark"] .cal-event { background: rgba(0,0,0,.3); }
.pin { color: var(--accent); font-size: .7rem; }
.occ-bar { position: absolute; left: 7px; right: 7px; bottom: 4px; height: 3px; background: rgba(0,0,0,.08); border-radius: 2px; }
.occ-bar span { display: block; height: 100%; background: var(--brand); border-radius: 2px; opacity: .7; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.cal-legend .sw { width: 14px; height: 14px; border: 1px solid var(--line); }
.cal-legend .demand-low { background: var(--d-low); } .cal-legend .demand-normal { background: var(--d-normal); }
.cal-legend .demand-high { background: var(--d-high); } .cal-legend .demand-peak { background: var(--d-peak); }

.event-list { list-style: none; padding: 0; margin: 0 0 16px; }
.event-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ev-when { font-size: .78rem; color: var(--muted); }
.ev-name { font-weight: 600; }
.ev-meta { font-size: .8rem; color: var(--text-2); }

/* ------------------------------------------------------------ day */
.day-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.occ-form label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.occ-form label > input.num-sm { display: inline-block; width: 70px !important; margin: 0; }
.room-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 18px; }
.room-card.is-override { border-color: var(--accent); }
.price-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.price-big { font-size: 2.2rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.vs-mkt { text-align: right; }
.override-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 12px; background: var(--surface-2); border-radius: 8px; }
.override-form label { margin: 0; }
.breakdown { margin-top: 12px; }
.breakdown summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--series-1); padding: 4px 0; }
.steps { width: 100%; border-collapse: collapse; font-size: .86rem; margin-top: 8px; }
.steps td { padding: 5px 6px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.steps td:first-child { font-weight: 550; white-space: nowrap; }
.steps td.num { white-space: nowrap; }
.steps tr:last-child td { border-bottom: 0; font-weight: 700; }

/* ------------------------------------------------------------ occupancy */
.occ-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 8px; }
.occ-cell { background: var(--surface-2); padding: 8px; border-radius: 8px; margin: 0; }
.occ-cell.wknd { background: var(--d-normal); }
.occ-cell input { text-align: right; margin-top: 4px; }
.occ-cell input.is-sample { font-style: italic; color: var(--muted); }
.occ-date { font-size: .78rem; font-weight: 600; color: var(--text); }

/* ------------------------------------------------------------ settings */
.factor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.factor-grid label { margin: 0; text-align: center; font-weight: 600; }
.factor-grid input { text-align: center; }
.sticky-save { position: sticky; bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.impact-guide { background: var(--surface-2); padding: 8px 10px; border-radius: 6px; }
.preview { max-height: 360px; overflow-y: auto; margin-top: 8px; }

/* ------------------------------------------------------------ auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand) 0%, var(--brand) 38%, var(--bg) 38%); }
:root[data-theme="dark"] .auth-wrap { background: linear-gradient(160deg, #16202d 0%, #16202d 38%, var(--bg) 38%); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.auth-card h1 { margin-bottom: 16px; }
.auth-brand { margin: 0 0 20px; }
.auth-brand .brand-sub { color: var(--muted); opacity: 1; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .two-col, .settings .two-col { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .menu-btn { display: inline-block; }
  .main { padding: 14px 16px 60px; }
  .room-cards { grid-template-columns: 1fr; }
  .occ-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-rate { font-size: .86rem; }
  .cal-sub, .cal-event { display: none; }
  .span2 { grid-column: auto; }
  .kpi-value { font-size: 1.4rem; }
  .chart { min-height: 220px; }
  .sticky-save { flex-direction: column; align-items: stretch; }
}
@media print { .sidebar, .topbar-actions, .form-foot, .menu-btn { display: none; } .shell { display: block; } }

/* ------------------------------------------------------------ v2: properties, integrations, event levels */
.prop-switch { margin: -8px 4px 16px; }
.prop-switch select { background: rgba(255,255,255,.1); color: inherit; border-color: rgba(255,255,255,.25); font-size: .88rem; }
.prop-switch option { color: #111; }
.freshness { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin: -6px 0 14px; color: var(--text-2); }
.freshness span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot-ok { background: var(--ok); } .dot-err { background: var(--err); } .dot-off { background: var(--line); border: 1px solid var(--muted); }
.pill { display: inline-block; font-size: .74rem; font-weight: 650; padding: 2px 9px; border-radius: 99px; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-err { background: var(--err-soft); color: var(--err); }
.pill-off { background: var(--surface-2); color: var(--muted); }
.pill-wait { background: var(--warn-soft); color: var(--warn); }
.err-text { color: var(--err); }
.callout-secure { background: var(--ok-soft); align-items: flex-start; flex-wrap: nowrap; }
.callout-secure .lock { font-size: 1.2rem; line-height: 1.2; }
.two-col.even { grid-template-columns: 1fr 1fr; }
.integ-card .status-line { margin: -4px 0 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.integ-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.integ-actions form { display: inline; }
.howto { margin: -4px 0 14px; }
.howto summary { cursor: pointer; color: var(--series-1); font-size: .86rem; }
.howto ol { padding-left: 20px; margin: 8px 0; }
.btn-on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.level-cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 10px; }
.level-card { border-radius: 8px; padding: 10px 12px; font-size: .86rem; border: 1px solid var(--line); }
.level-card .lvl-name { font-weight: 700; margin-bottom: 2px; }
.lvl-high { background: var(--d-peak); } .lvl-moderate { background: var(--d-high); } .lvl-low { background: var(--d-normal); } .lvl-ignore { background: var(--surface-2); color: var(--text-2); }
.lvl-tag-high { background: var(--d-peak); color: var(--text); } .lvl-tag-moderate { background: var(--d-high); color: var(--text); }
.lvl-tag-low { background: var(--d-normal); color: var(--text); } .lvl-tag-ignore { background: var(--surface-2); color: var(--muted); }
.lvl-tag-custom { background: var(--accent-soft); color: var(--warn); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg-opt { margin: 0; position: relative; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; padding: 6px 11px; font-size: .82rem; font-weight: 600; color: var(--text-2); cursor: pointer; border-right: 1px solid var(--line); white-space: nowrap; }
.seg-opt:last-child span { border-right: 0; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--series-1); outline-offset: -2px; }
.seg-high input:checked + span { background: var(--d-peak); color: var(--text); }
.seg-moderate input:checked + span { background: var(--d-high); color: var(--text); }
.seg-low input:checked + span { background: var(--d-normal); color: var(--text); }
.seg-ignore input:checked + span { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.seg-opt.changed span { box-shadow: inset 0 -3px 0 var(--accent); }
.row-ignored td { opacity: .6; }
.tag-src { background: var(--d-normal); color: var(--series-1); }
.rate-input.is-lh { color: var(--series-1); }
.lh-key { color: var(--series-1); font-weight: 600; }
.events-table td { vertical-align: top; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { margin-bottom: 14px; }
.inline-h { display: inline; }
.setup-card { max-width: 620px; }
.setup-h { font-size: 1rem; margin: 18px 0 10px; }
@media (max-width: 1100px) { .two-col.even { grid-template-columns: 1fr; } .level-cards { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 820px) {
  .events-table thead { display: none; }
  .events-table, .events-table tbody, .events-table tr, .events-table td { display: block; width: 100%; }
  .events-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .events-table td { border: 0; padding: 3px 0; }
  .events-table td.actions { text-align: left; }
  .events-table .seg { display: flex; width: 100%; }
  .events-table .seg-opt { flex: 1; }
  .events-table .seg-opt span { text-align: center; padding: 8px 4px; }
  .level-cards { grid-template-columns: 1fr 1fr; }
}
.support-bar { background: var(--accent-soft); color: var(--warn); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
.setup-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.15rem; letter-spacing: .06em; background: var(--surface-2); padding: 12px 14px; border-radius: 8px; margin: 8px 0; word-break: break-all; }
.code-input { font-size: 1.3rem; letter-spacing: .3em; text-align: center; max-width: 200px; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.recovery-form { margin-top: 6px; }
.recovery-form input { width: 170px; }
.howto { margin-top: 10px; }
