/* Admin interface. Layout: sticky top bar, centered page (max 1240px); building page = tab content + sticky live preview. */
:root {
  --ground: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #13203b;
  --soft: #5d6a85;
  --line: #e1e6ef;
  --accent: #1f4fd1;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefc;
  --ok: #17865a;
  --ok-soft: #e3f4ec;
  --info: #1f4fd1;
  --info-soft: #e8eefc;
  --muted: #7d879b;
  --muted-soft: #eef0f4;
  --danger: #c3362b;
  --danger-soft: #fbe9e7;
  --shadow: 0 1px 2px rgba(19, 32, 59, .05), 0 6px 20px rgba(19, 32, 59, .06);
  --radius: 14px;
  --f: "Rubik", "Arial Hebrew", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0f1522; --surface: #172033; --surface-2: #1c273d; --ink: #e8ecf5; --soft: #a3aec4; --line: #2a3650;
    --accent: #6f95ff; --accent-ink: #0b1220; --accent-soft: #22325a; --ok: #4cc58f; --ok-soft: #173a2c;
    --info: #6f95ff; --info-soft: #22325a; --muted: #8d97ab; --muted-soft: #252f44; --danger: #ff7b6e; --danger-soft: #3d2120;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 var(--f); }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
.muted { color: var(--soft); }
.small { font-size: 14px; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--soft); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

.wrap { max-width: 1240px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 15px var(--f); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--muted-soft); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-btn { background: none; border: 0; padding: 4px 6px; border-radius: 6px; color: var(--accent); font: 500 14px var(--f); cursor: pointer; }
.link-btn:hover { background: var(--accent-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-soft); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 36px 32px; display: flex; flex-direction: column; gap: 22px; }
.auth-card h1 { font-size: 28px; }
.auth-alt { display: flex; justify-content: center; margin-top: -8px; }
.mark { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.mark svg { width: 32px; height: 32px; }

/* forms */
form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-weight: 500; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.field .hint { font-weight: 400; font-size: 13px; color: var(--soft); }
.counter { font-weight: 400; font-size: 13px; color: var(--soft); font-variant-numeric: tabular-nums; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 16px var(--f);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=tel], input[dir=ltr] { text-align: right; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: 10px; padding: 10px 14px; font-size: 15px; }
.range { display: flex; align-items: center; gap: 14px; }
.range input { flex: 1; accent-color: var(--accent); }
.range output { min-width: 84px; font-variant-numeric: tabular-nums; color: var(--soft); }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
legend { font-weight: 600; font-size: 18px; margin-bottom: 4px; padding: 0; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.panel + .panel { margin-top: 18px; }
.save-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px; padding: 14px 0 max(14px, env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--ground) 70%, transparent); }

/* top bar */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--surface); z-index: 11; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; font-size: 18px; }
.logo .mark { width: 38px; height: 38px; border-radius: 10px; }
.logo .mark svg { width: 24px; height: 24px; }
.logo small { color: var(--soft); font-weight: 400; font-size: 15px; }
.who { display: flex; align-items: center; gap: 10px; color: var(--soft); font-size: 15px; }

.page { padding-top: 28px; padding-bottom: 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 30px; }
.page-head .sub { color: var(--soft); margin-top: 6px; }
.back { display: inline-flex; gap: 6px; font-size: 15px; margin-bottom: 12px; }

/* buildings */
.b-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.b-card { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; color: var(--ink); border: 1px solid transparent; transition: border-color .15s, transform .15s; }
.b-card:hover { border-color: color-mix(in srgb, var(--accent) 35%, transparent); transform: translateY(-2px); }
.b-top { display: flex; align-items: center; gap: 14px; }
.b-top h2 { font-size: 20px; }
.b-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; padding: 4px 10px; border-radius: 999px; background: var(--muted-soft); color: var(--soft); }
.stat.ok { background: var(--ok-soft); color: var(--ok); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.ok .dot, .dot.on { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }

.swatch { width: 46px; height: 32px; border-radius: 8px; flex: none; position: relative; overflow: hidden; background: var(--a); }
.swatch::before { content: ""; position: absolute; inset: 6px 50% 6px 6px; border-radius: 3px; background: var(--b); }
.swatch::after { content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; left: 8px; top: 8px; background: var(--c); }

.empty { text-align: center; padding: 48px 24px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty h2 { font-size: 20px; }
.empty p { color: var(--soft); max-width: 42ch; }

/* building page */
.b-layout { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 24px; align-items: start; }
/* Tabs wrap onto a second row when they don't fit, so none hides out of view */
.tabs { display: flex; flex-wrap: wrap; gap: 0 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 12px; color: var(--soft); font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { font-size: 13px; background: var(--muted-soft); color: var(--soft); padding: 1px 8px; border-radius: 999px; }
.tabs a.on .count { background: var(--accent-soft); color: var(--accent); }
.tab-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.tab-head p { color: var(--soft); max-width: 60ch; }

.preview { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px; }
.pv-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.pv-head a { font-weight: 400; font-size: 14px; }
.pv-frame { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 12px; overflow: hidden; background: #0d1e23; box-shadow: var(--shadow); border: 6px solid #1b2230; }
.pv-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* notices */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.n-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; border-inline-start: 5px solid var(--st); }
.n-item.st-live { --st: var(--ok); } .n-item.st-scheduled { --st: var(--info); } .n-item.st-ended, .n-item.st-off { --st: var(--line); }
.n-item.st-ended .n-title, .n-item.st-off .n-title { color: var(--soft); }
.n-title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-weight: 600; font-size: 18px; }
.n-body { color: var(--soft); margin-top: 4px; overflow-wrap: anywhere; }
.n-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 14px; color: var(--soft); }
.n-actions { display: flex; align-items: flex-start; gap: 2px; }
.pill { font-size: 13px; font-weight: 500; padding: 2px 10px; border-radius: 999px; }
.pill.live { background: var(--ok-soft); color: var(--ok); }
.pill.scheduled { background: var(--info-soft); color: var(--info); }
.pill.ended, .pill.off { background: var(--muted-soft); color: var(--muted); }

/* templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tpl { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; border: 2px solid var(--line); cursor: pointer; background: var(--surface); }
.tpl:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tpl input { position: absolute; opacity: 0; }
.tpl:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.tpl .swatch { width: 100%; height: 70px; }
.tpl b { font-weight: 500; font-size: 15px; }

/* screens */
.s-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; }
.s-name { font-weight: 600; font-size: 17px; }
.s-mode { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; color: var(--soft); }
.s-mode select { width: auto; min-height: 34px; padding: 4px 10px; font-size: 14px; }
.s-link { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
code { font: 14px ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); padding: 4px 8px; border-radius: 6px; direction: ltr; overflow-wrap: anywhere; }
.howto { margin-top: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
details.howto summary { cursor: pointer; list-style-position: inside; }
details.howto[open] summary { margin-bottom: 4px; }
.sub-list { margin: 6px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.howto ol { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; }
.howto pre { margin: 0; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; direction: ltr; text-align: left; font: 13px ui-monospace, Consolas, monospace; }

/* section headings inside a tab */
.sec-h { font-size: 19px; }
.tab-head h3 { font-size: 19px; margin-bottom: 4px; }
.tab-head.spaced { margin-top: 28px; }

/* switches */
.fixed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.switch-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; background: var(--surface); }
.switch-card:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.switch-card b { display: block; font-weight: 600; }
.switch-card .muted { display: block; margin-top: 2px; }
.sw { position: relative; display: inline-block; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line); transition: background .15s; margin-top: 2px; }
.sw::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
input:checked + .sw { background: var(--accent); }
input:checked + .sw::after { transform: translateX(-18px); }
.switch-card input, .switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-card input:focus-visible + .sw, .switch-row input:focus-visible + .sw { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.switch-card.preset { cursor: default; }
.pc-toggle { position: relative; display: flex; cursor: pointer; flex: none; }
.pc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-body .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.pc-foot .link-btn { padding: 2px 6px; margin-inline-start: -6px; }
.switch-row { position: relative; display: flex; align-items: center; gap: 12px; font-weight: 500; cursor: pointer; }

/* image banners */
.bn-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.bn-card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border-top: 4px solid var(--st); }
.bn-card.st-live { --st: var(--ok); } .bn-card.st-scheduled { --st: var(--info); } .bn-card.st-ended, .bn-card.st-off { --st: var(--line); }
.bn-card.st-ended .bn-thumb img, .bn-card.st-off .bn-thumb img { opacity: .45; }
.bn-thumb { aspect-ratio: 16 / 9; max-width: 100%; background: #0d1522; display: grid; place-items: center; overflow: hidden; }
.bn-thumb { position: relative; }
.bn-thumb img, .bn-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.bn-thumb.contain img, .bn-thumb.contain video { object-fit: contain; }
.vid-badge { position: absolute; top: 8px; right: 8px; padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 13px; font-weight: 600; }
.file-pick video { max-width: 100%; max-height: 220px; border-radius: 10px; background: #000; align-self: flex-start; }
.bn-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.bn-body .n-title { font-size: 16px; }
.bn-body .n-actions { margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.file-pick { display: flex; flex-direction: column; gap: 10px; }
.file-pick img { max-width: 100%; max-height: 200px; border-radius: 10px; object-fit: contain; background: var(--surface-2); align-self: flex-start; }
input[type=file] { font: 15px var(--f); color: var(--soft); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg label { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg input { position: absolute; opacity: 0; }
.seg span { font-size: 13px; color: var(--soft); }
.font-seg { grid-template-columns: repeat(3, 1fr); }
.font-seg span { font-size: 17px; color: var(--ink); margin-top: 4px; }
.font-arial { font-family: "Arimo", Arial, sans-serif; }
.font-david { font-family: "David Libre", David, serif; }
@media (max-width: 640px) { .font-seg { grid-template-columns: 1fr; } }
/* greeting dialog: the headline as it will read on the screen */
.g-preview { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line); font-size: 15px; overflow-wrap: anywhere; }
.g-preview span { color: var(--soft); }
.bar { height: 8px; border-radius: 999px; background: var(--muted-soft); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* music */
.t-item { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 280px) auto; align-items: center; gap: 14px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; }
.t-num { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.t-item b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-item audio { width: 100%; height: 36px; }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 14px; }
.style-card { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.style-card b { font-weight: 600; }
.style-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.uploads { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.uploads .up { background: var(--surface); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.uploads .up.err { color: var(--danger); }
.note { font-size: 14px; color: var(--soft); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 16px; }

/* top navigation */
.nav { display: flex; align-items: center; gap: 6px; }
.nav .logo { margin-inline-end: 18px; }
.nav-link { padding: 8px 12px; border-radius: 8px; color: var(--soft); font-weight: 500; font-size: 15px; }
.nav-link:hover { background: var(--muted-soft); color: var(--ink); }
.nav-link.on { color: var(--accent); background: var(--accent-soft); }

/* users */
.u-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--muted-soft); color: var(--soft); }
.chip.warn { background: var(--danger-soft); color: var(--danger); }
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; font-family: ui-monospace, Consolas, monospace; }

/* activity log */
.act-day { font-size: 15px; font-weight: 600; color: var(--soft); margin: 24px 0 8px; }
.act-day:first-child { margin-top: 0; }
.act-list { list-style: none; margin: 0; padding: 2px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.act-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 0; }
.act-item + .act-item { border-top: 1px solid var(--line); }
.act-item .avatar { width: 34px; height: 34px; font-size: 15px; }
.act-text { overflow-wrap: anywhere; }
.act-item .n-meta { margin-top: 2px; }
.act-more { display: flex; justify-content: center; margin-top: 16px; }
.b-pick { max-height: 220px; overflow-y: auto; gap: 8px; }

/* building events */
.ev-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; }
.ev-item.past { opacity: .6; }
.ev-date { width: 62px; text-align: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); padding: 6px 0; display: flex; flex-direction: column; line-height: 1.2; }
.ev-date b { font-size: 20px; }
.ev-date span { font-size: 12px; }

/* fault reports */
.rp-link { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; }
.rp-link > div { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.rp-qr { width: 132px; height: 132px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: #fff; padding: 4px; }
.rp-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.chips.filter { margin: 0; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--soft); border-radius: 999px; padding: 6px 14px; font: 500 14px var(--f); cursor: pointer; }
.chip-btn span { color: var(--muted); margin-inline-start: 4px; }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-btn.on span { color: inherit; opacity: .8; }
.rp-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; border-inline-start: 5px solid var(--st); }
.rp-item.st-open { --st: var(--info); } .rp-item.st-progress { --st: var(--ok); } .rp-item.st-done { --st: var(--line); }
.rp-item:not(:has(.rp-photo)) { grid-template-columns: minmax(0, 1fr) auto; }
.rp-photo img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; display: block; }
.rp-desc { margin-top: 6px; font-size: 16px; overflow-wrap: anywhere; white-space: pre-line; }
.rp-note { margin-top: 8px; font-size: 14px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.rp-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.rp-side select { width: auto; min-height: 36px; padding: 4px 10px; font-size: 14px; }

/* urgent message */
.urgent-btn { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.urgent-btn:hover { border-color: var(--danger); }
.alert-on { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: -8px 0 20px; padding: 12px 16px; border-radius: 12px; background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.alert-on.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.stat.warn { background: var(--info-soft); color: var(--info); }
.stat.urgent { background: var(--danger-soft); color: var(--danger); font-weight: 600; }

/* notice hours and weekdays */
details.more { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
details.more summary { cursor: pointer; font-weight: 500; color: var(--accent); }
details.more[open] { display: flex; flex-direction: column; gap: 14px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { position: relative; cursor: pointer; }
.days input { position: absolute; opacity: 0; }
.days span { display: grid; place-items: center; width: 42px; height: 38px; border-radius: 10px; border: 1px solid var(--line); font-weight: 600; color: var(--soft); }
.days input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.days input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.n-meta .win { color: var(--accent); font-weight: 500; }

.danger-zone { border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line)); }
.danger-zone h3 { color: var(--danger); font-size: 17px; margin-bottom: 6px; }
.danger-zone .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* dialog & toasts */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(10, 16, 30, .45); }
.dlg-form { padding: 26px; gap: 18px; }
.dlg-form h2 { font-size: 22px; }
.dlg-actions { display: flex; gap: 10px; }
#toasts { position: fixed; bottom: max(20px, env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--surface); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: toastIn .25s ease; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1100px) {
  .b-layout { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
}
@media (max-width: 640px) {
  .page-head h1 { font-size: 24px; }
  .row2 { grid-template-columns: 1fr; }
  .n-item { grid-template-columns: 1fr; }
  .n-actions { justify-content: flex-start; }
  .s-item { grid-template-columns: auto minmax(0, 1fr); }
  .s-item .s-menu { grid-column: 1 / -1; }
  .t-item { grid-template-columns: auto minmax(0, 1fr); }
  .t-item audio, .t-item .n-actions { grid-column: 1 / -1; }
  .who span, .logo small, [data-action="my-password"] { display: none; }
  .nav .logo { margin-inline-end: 4px; }
  .u-item, .ev-item { grid-template-columns: auto minmax(0, 1fr); }
  .rp-item, .rp-item:not(:has(.rp-photo)) { grid-template-columns: minmax(0, 1fr); }
  .rp-side { align-items: flex-start; }
  .rp-link { flex-direction: column; }
  .u-item .n-actions, .ev-item .n-actions { grid-column: 1 / -1; }
  .tab-head { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
