:root {
  --ink: #12052F;
  --ink-soft: #2a1850;
  --muted: #6b6578;
  --line: #e6e1f0;
  --paper: #f5f3fb;
  --card: #ffffff;
  --sidebar: #12052F;
  --sidebar-text: #ddd6f3;
  --sidebar-dim: #8b82a8;
  --accent: #5A18EB;
  --accent-2: #4c12d4;
  --ok: #067647;
  --warn: #b54708;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(18, 5, 47, 0.08);
  --radius: 18px;
  --sans: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --serif: "Fraunces", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.app-body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}
a { color: inherit; }
img { max-width: 100%; }

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
.shell.is-collapsed,
html.sidebar-collapsed .shell { grid-template-columns: 76px 1fr; }
.shell.is-collapsed .brand-copy,
.shell.is-collapsed .nav-label,
.shell.is-collapsed .nav a span,
.shell.is-collapsed .org-switcher,
.shell.is-collapsed .org-tz,
.shell.is-collapsed .lang-switch,
.shell.is-collapsed .sidebar-foot .signout,
html.sidebar-collapsed .brand-copy,
html.sidebar-collapsed .nav-label,
html.sidebar-collapsed .nav a span,
html.sidebar-collapsed .org-switcher,
html.sidebar-collapsed .org-tz,
html.sidebar-collapsed .lang-switch,
html.sidebar-collapsed .sidebar-foot .signout { display: none; }
.shell.is-collapsed .nav a,
html.sidebar-collapsed .nav a { justify-content: center; padding: 12px 0; }
.shell.is-collapsed .brand,
html.sidebar-collapsed .brand { padding: 0 0 20px; justify-content: center; }
.shell.is-collapsed .sidebar-toggle,
html.sidebar-collapsed .sidebar-toggle { margin-left: auto; margin-right: auto; }

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 10px 22px;
  text-decoration: none;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(180deg, #7c4dff, var(--accent));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; color: #fff; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--sidebar-dim); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  text-decoration: none;
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav a:hover, .nav a.is-active {
  background: rgba(90, 24, 235, 0.35);
  color: #fff;
}
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sidebar-dim);
  padding: 16px 12px 8px;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}
.sidebar-foot a { color: var(--sidebar-dim); text-decoration: none; }
.org-switcher { position: relative; margin-bottom: 10px; }
.org-switch {
  width: 100%;
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 8px 28px 8px 10px;
  font: 13px var(--sans);
  text-align: left;
  cursor: pointer;
  position: relative;
}
.org-switch-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
}
.org-switch::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid #ddd6f3;
  border-bottom: 1.5px solid #ddd6f3;
  transform: translateY(-70%) rotate(45deg);
}
.org-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(18,5,47,0.22);
  padding: 8px;
  z-index: 30;
}
.org-switcher.is-open .org-menu { display: flex; flex-direction: column; }
.org-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: 13px var(--sans);
  color: var(--ink);
  background: #f7f5fb;
  margin-bottom: 6px;
}
.org-menu-list {
  max-height: 220px;
  overflow-y: auto;
}
.org-menu a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.org-menu a.is-hidden { display: none; }
.org-menu a:hover, .org-menu a.is-current { background: #f3efff; color: var(--accent); }
.org-empty { margin: 8px 10px; color: var(--muted); font-size: 12px; }
.org-tz { margin-bottom: 10px; color: var(--sidebar-dim); }
.signout button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--sidebar-dim);
  padding: 0;
  font: 13px var(--sans);
  cursor: pointer;
}
.signout button:hover { color: #fff; }
.sidebar-toggle {
  appearance: none;
  border: 0;
  background: rgba(255,255,255,0.08);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  margin: 0 0 12px;
  display: grid;
  place-items: center;
  padding: 0;
  position: relative;
}
.sidebar-toggle::before {
  content: '';
  width: 8px;
  height: 8px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
  margin-left: 3px;
}
.shell.is-collapsed .sidebar-toggle::before,
html.sidebar-collapsed .sidebar-toggle::before {
  transform: rotate(225deg);
  margin-left: -3px;
}

.main { padding: 28px 36px 60px; min-width: 0; overflow-x: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.page-kicker { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.page-title { font-family: var(--serif); font-size: 36px; font-weight: 500; letter-spacing: -0.03em; margin: 0; color: var(--ink); }
.page-copy { color: var(--muted); margin: 8px 0 0; max-width: 62ch; }

.btn, button.btn, input[type=submit] {
  appearance: none; border: 0; background: var(--accent); color: #fff;
  border-radius: 999px; padding: 10px 16px; font: 600 13px var(--sans);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { background: var(--danger); }
.btn.accent { background: var(--accent); }
.btn:not(.secondary):not(.ghost):not(.danger):hover, input[type=submit]:hover { background: var(--accent-2); }
.btn.sm { padding: 7px 12px; font-size: 12px; }
.btn[disabled], button.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-spinner {
  display: none;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  flex-shrink: 0;
  animation: btn-spin .6s linear infinite;
}
.btn.is-busy {
  opacity: 1;
  cursor: wait;
  pointer-events: none;
}
.btn.is-busy .btn-spinner { display: inline-block; }
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.grid-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.grid-metrics.six { grid-template-columns: repeat(6, 1fr); }
.grid-metrics.three { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--card);
  border: 1px solid rgba(18, 5, 47, 0.05);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
/* Cards stacked directly in the page (e.g. System health) need a gap; grids/stacks use their own gap. */
.card + .card { margin-top: 16px; }
.card + .row-actions { margin-top: 16px; }
/* Meraki import layout: notes wrap at a readable width so the site choice keeps its room. */
.layout-table td { vertical-align: middle; }
.layout-table .layout-note { display: block; max-width: 60ch; margin-top: 2px; }
.layout-table td:nth-child(3) { white-space: nowrap; }
.layout-table select { min-width: 220px; }
/* Zone editor: AP coverage switch above the map. */
.ze-coverage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 10px; }
.ze-coverage .choice-group label { padding: 6px 12px; }
.ze-zones-label { margin-left: 8px; }
.ze-coverage-note { flex-basis: 100%; margin: 0; font-size: 12px; }
.fv-coverage polygon, .fv-coverage rect { vector-effect: non-scaling-stroke; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 8px;
}
.card-head h3 { margin: 0; }
.chart-box { position: relative; height: 220px; width: 100%; }
.chart-box canvas { width: 100% !important; }
.chart-box-donut { height: 240px; }
.metric-label { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.metric-value { font-family: var(--serif); font-size: 32px; margin-top: 8px; letter-spacing: -0.03em; }
.metric-value-dt { font-size: 22px; }
.metric-note { color: var(--muted); font-size: 13px; margin-top: 6px; }

.layout-2 { display: grid; grid-template-columns: 1.6fr 0.9fr; gap: 16px; min-width: 0; }
.settings-stack { display: flex; flex-direction: column; gap: 16px; }
.settings-meta { grid-template-columns: 1fr 1fr; align-items: stretch; }
.settings-meta .card { height: 100%; }
.org-profile-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; }
.org-profile-form p { margin: 0 0 14px; }
.org-profile-form button { grid-column: 1; justify-self: start; margin-top: 4px; }
.sms-layout { grid-template-columns: 1.1fr 0.9fr; align-items: start; }
.sms-help { display: grid; gap: 16px; min-width: 0; }
.sms-guide summary { cursor: pointer; list-style: none; }
.sms-guide summary h3 { display: inline; }
.sms-guide h4 { margin: 16px 0 8px; font-size: 14px; }
.sms-guide pre {
  background: #f7f5fb;
  padding: 10px 12px;
  border-radius: 10px;
  overflow: auto;
  font-size: 12px;
}
.sms-test-alert { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; }
.sms-test-alert.is-info { background: #f3efff; }
.sms-test-alert.is-ok { background: #ecf8f1; color: #0f7b45; }
.sms-test-alert.is-error { background: #fdecea; color: #9b1c1c; }
.sms-test-response {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #f7f5fb;
  border-radius: 10px;
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
}
.layout-builder { grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); align-items: start; }
.portal-settings-card {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.portal-settings-card > h3 { margin-bottom: 2px; }
.portal-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.portal-settings .portal-block:first-of-type {
  margin-top: 0;
  padding-top: 4px;
  border-top: 0;
}
.portal-block h4 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.portal-hint {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.portal-settings .helptext-block {
  display: block;
  margin-top: 6px;
  line-height: 1.4;
}
.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}
.portal-grid .span-2 { grid-column: 1 / -1; }
.portal-settings p { margin: 0 0 10px; }
.portal-settings input[type=text],
.portal-settings input[type=url],
.portal-settings input[type=number],
.portal-settings input:not([type]),
.portal-settings select {
  padding: 8px 10px;
}
.portal-settings select { padding-right: 32px; }
textarea.radius-attrs {
  width: 100%;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  direction: ltr;
  text-align: left;
}
.radius-attr-examples { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.radius-attr-examples summary { cursor: pointer; }
.radius-attr-examples dl { margin: 6px 0 0; direction: ltr; text-align: left; }
.radius-attr-examples dt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text, inherit); margin-top: 6px; }
.radius-attr-examples dd { margin: 0; }
.radius-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.radius-top > .card { margin: 0; }
@media (max-width: 900px) { .radius-top { grid-template-columns: minmax(0, 1fr); } }
.radius-test select, .radius-test textarea { width: 100%; }
.radius-test .helptext { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.radius-test-result { margin-top: 16px; border-top: 1px solid var(--line, rgba(127,127,127,.25)); padding-top: 12px; }
.radius-test-check { margin-bottom: 12px; }
.radius-test-check p { margin: 0 0 6px; }
.radius-test-attrs { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; direction: ltr; text-align: left; font-size: 13px; }
.radius-test-attrs dt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.radius-test-attrs dd { margin: 0; overflow-wrap: anywhere; }
.radius-test-bad { margin: 0 0 12px; direction: ltr; text-align: left; }
html[dir="rtl"] .portal-settings select { padding-right: 10px; padding-left: 32px; }
.period-inputs {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 8px;
}
.portal-checks { display: grid; gap: 2px; }
.portal-settings > .btn { margin-top: 8px; }
.page-tabs, .starter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.builder-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
}
.builder-switch, .preview-toolbar { display: flex; gap: 8px; margin: 0; }
.builder-work { display: grid; grid-template-columns: 1fr; gap: 16px; min-width: 0; }
#page-builder[data-pane="code"] .builder-work { grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr); align-items: start; }
#page-builder[data-pane="preview"] .builder-code { display: none; }
.builder-preview { min-width: 0; overflow: auto; display: flex; justify-content: center; }
.builder-code { min-width: 0; }
#page-builder[data-pane="code"] .device-frame.phone iframe { height: 520px; }
#page-builder[data-pane="code"] .code-input { min-height: 520px; }
.builder-guide {
  padding: 12px 14px;
  background: #f7f5fb;
  border-radius: 14px;
  margin-bottom: 14px;
}
.builder-guide p { margin: 0; }
.builder-guide .page-kicker { margin-bottom: 4px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.gallery-preview {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 12px;
  background: #12052F;
}
.gallery-preview img,
.gallery-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-name { font-weight: 600; margin: 10px 0 2px; }
.gallery-card .row-actions { margin-top: 10px; }
.layout-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.layout-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; min-width: 0; }

.table-wrap { overflow: auto; }
.card:has(table.data) { overflow-x: auto; }
.card:has(table.data):has(.site-picker[open]) { overflow: visible; }   /* a picker in a table row must not be clipped */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 12px 8px; border-bottom: 1px solid #efeaf7; vertical-align: top; }
table.data .cell-dt { white-space: nowrap; }
.table-schedules { table-layout: fixed; }
.table-schedules col.col-status { width: 8rem; }
.table-schedules col.col-dt { width: 11rem; }
.table-schedules col.col-actions { width: 15rem; }
.table-schedules td:first-child { overflow-wrap: anywhere; }
.table-schedules .row-actions { flex-wrap: nowrap; }
table.data tr.is-invalid td { background: #fef3f2; }
table.data a { color: var(--accent); text-decoration: none; font-weight: 600; }
table.data a:hover { text-decoration: underline; }
.profile-facts {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 14px;
}
.profile-facts dt { color: var(--muted); margin: 0; }
.profile-facts dd { margin: 0; word-break: break-word; }
.license-facts { grid-template-columns: 140px 1fr; margin-top: 10px; }
.profile-facts.wide { grid-template-columns: minmax(148px, 12rem) 1fr; margin-top: 10px; }
.empty { color: var(--muted); padding: 24px 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.role-form { margin: 0; }
.role-select { width: auto; min-width: 132px; padding: 8px 32px 8px 10px; }
.member-edit-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.member-edit-actions form { margin: 0; }
.member-modal { width: min(640px, 100%); }
.member-modal-who { margin: 4px 0 0; font-size: 13px; }
.member-modal-copy { margin: 0 0 8px; font-size: 13px; }
.grant-grid th:not(:first-child), .grant-grid td:not(:first-child) { text-align: center; width: 84px; }
.row-actions form { margin: 0; }
.temp-pass { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.temp-pass [data-reveal-secret][data-revealed="1"] {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--ink);
}
.live-actions {
  display: flex;
  gap: 8px;
  margin-right: 4px;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

form p, .field { margin: 0 0 14px; }
label, .field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=date], input[type=tel], input[type=color], input[type=search], input:not([type]),
select, textarea, .input, .flatpickr-alt {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 11px 12px; font: 14px var(--sans); color: var(--ink);
  appearance: none; -webkit-appearance: none;
}
select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b6578' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
select[aria-expanded="true"] { border-color: var(--accent); }
.select-menu {
  position: fixed; z-index: 70; overflow-y: auto; padding: 6px;
  max-width: min(420px, calc(100vw - 16px));
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 36px rgba(18, 5, 47, 0.14);
  font: 14px var(--sans); color: var(--ink);
}
.select-option {
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.select-option.is-active { background: var(--paper); }
.select-option.is-selected { color: var(--accent); font-weight: 600; }
.select-option.is-disabled { color: var(--muted); opacity: .55; cursor: default; }
.select-group {
  padding: 10px 12px 4px; font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
input[type=search]::-webkit-search-decoration,
input[type=search]::-webkit-search-cancel-button,
input[type=search]::-webkit-search-results-button,
input[type=search]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}
.code-input { font-family: ui-monospace, Consolas, monospace; font-size: 13px; min-height: 220px; }
.errorlist { color: var(--danger); font-size: 13px; padding-left: 16px; }
.helptext, .helptext-block { color: var(--muted); font-size: 12px; }

.location-pick-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.location-pick-row select { flex: 1; min-width: 0; }
.location-add-btn {
  appearance: none;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.location-add-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.location-add-btn:hover,
.location-add-btn.is-open {
  border-color: var(--accent);
  background: #f3efff;
}
.location-add-btn.is-open svg { transform: rotate(45deg); }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li {
  padding: 12px 40px 12px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: #ecfdf3;
  color: var(--ok);
  position: relative;
  transition: opacity .25s ease, transform .25s ease;
}
.messages li.is-leaving { opacity: 0; transform: translateY(-6px); }
.messages li.error, .messages li.warning { background: #fff6ed; color: var(--warn); }
.message-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  position: absolute;
  right: 8px;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}
.message-close:hover { opacity: 1; background: rgba(18,5,47,0.06); }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  margin-bottom: 18px; background: var(--card); padding: 14px; border-radius: 16px;
  border: 1px solid rgba(18,5,47,0.05);
}
.filters .field { margin: 0; min-width: 180px; display: flex; flex-direction: column; justify-content: flex-end; }
.filters .field[hidden], .field[hidden] { display: none !important; }
.filters .btn { height: 44px; }
.search-field, .date-field, .time-field {
  position: relative; min-width: 240px; flex: 1;
}
.time-field { min-width: 160px; }
.narrow-field { min-width: 120px; flex: 0 0 140px; }
.search-field input, .date-field input, .date-field .flatpickr-alt,
.time-field input, .time-field .flatpickr-alt,
.filters select, .filters input[type=text], .filters input[type=search],
.filters input[type=number] {
  padding: 11px 16px; height: 44px; border-radius: 999px;
}
.select-field select { height: 44px; border-radius: 999px; padding-right: 32px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b6578' d='M1 1l5 5 5-5'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; }

/* Multi-site picker in scope bars (templates/includes/site_picker.html). */
.site-field { position: relative; min-width: 220px; }
.site-picker > summary {
  list-style: none; cursor: pointer; height: 44px; padding: 11px 32px 11px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b6578' d='M1 1l5 5 5-5'/></svg>") no-repeat right 14px center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-picker > summary::-webkit-details-marker { display: none; }
.site-picker[open] > summary { border-color: var(--accent); }
.site-picker-panel {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content;
  max-width: min(360px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 12px;
}
.site-picker-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filters .site-picker-quick .btn { height: auto; }
.site-picker-list { display: grid; gap: 2px; max-height: 280px; overflow-y: auto; }
.site-picker-list label {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 4px; font-weight: 400; cursor: pointer;
  border-radius: 8px;
}
.site-picker-list label:hover { background: var(--accent-soft, rgba(90, 24, 235, 0.06)); }
.site-picker-hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.table-export { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.pager-meta { margin: 0; color: var(--muted); font-size: 13px; }
.pager-links { display: flex; align-items: center; gap: 8px; }
.pager-current { font-size: 13px; color: var(--ink); font-weight: 600; }

.card.inline-end-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.card.inline-end-chip .chip { flex: 0 0 auto; white-space: nowrap; }

.chip {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; background: #efe9ff; color: var(--accent);
}
.chip.neutral { background: #f4f0e8; color: var(--ink-soft); }
.chip.warn { background: #fff6ed; color: var(--warn); }
.chip.danger { background: #fef3f2; color: var(--danger); }
.chip.ok { background: #ecfdf3; color: var(--ok); }

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(18, 5, 47, 0.45);
  z-index: 40; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.is-open { display: flex; }
.modal {
  width: min(560px, 100%); background: #fff; border-radius: 24px; padding: 24px;
  box-shadow: 0 30px 80px rgba(18,5,47,0.25); max-height: 90vh; overflow: auto;
}
.modal h3 { margin: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-error, .modal-ok {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
}
.modal-error { background: #fff6ed; color: var(--warn); }
.modal-ok { background: #ecfdf3; color: var(--ok); }
.modal-overlay#confirm-action { z-index: 50; }
.confirm-modal { width: min(420px, 100%); }
.confirm-modal h3 { margin-bottom: 8px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.icon-close {
  appearance: none;
  border: 0;
  background: #f3efff;
  color: var(--ink);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-close:hover { background: #e8e0ff; color: var(--accent); }

.import-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.import-form .btn { align-self: flex-start; }
.file-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  width: 100%;
  min-width: 0;
  position: relative;
}
.file-pick input[type=file] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.file-pick-btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: 600 13px var(--sans);
  cursor: pointer;
  white-space: nowrap;
}
.file-pick:hover .file-pick-btn { border-color: var(--accent); color: var(--accent); }
.file-pick-name {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.app-body input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 26px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: #e6e1f0;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
  transition: background .2s ease;
}
.app-body input[type=checkbox]::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(18,5,47,0.2);
  transition: transform .2s ease;
}
.app-body input[type=checkbox]:checked {
  background: var(--accent);
}
.app-body input[type=checkbox]:checked::after {
  transform: translateX(18px);
}
.app-body form p:has(> input[type=checkbox]),
.app-body .field:has(> input[type=checkbox]) {
  /* like every other field: label on top, the toggle in the input's place (centred on a 42px input line) */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.app-body form p:has(> input[type=checkbox]) label,
.app-body .field:has(> input[type=checkbox]) label {
  margin: 0;
}
.app-body form p:has(> input[type=checkbox]) > input[type=checkbox],
.app-body .field:has(> input[type=checkbox]) > input[type=checkbox] {
  margin: 9px 0;
}
.app-body input[type=checkbox].select-box {
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid #cfc6e3; background: #fff;
}
.app-body input[type=checkbox].select-box::after { display: none; }
.app-body input[type=checkbox].select-box:checked {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'><path fill='none' stroke='white' stroke-width='2' d='M1 5l3.5 3.5L11 1'/></svg>") center / 12px no-repeat;
}

.app-body #id_events { display: grid; gap: 2px; margin-top: 6px; }
.app-body #id_events label {
  display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between;
  gap: 12px; margin: 0; padding: 6px 0; font-weight: 400;
}
.webhook-events { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.webhook-events a.chip { text-decoration: none; }
.webhook-health { margin-top: 6px; font-size: 13px; }
.delivery-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.delivery-actions form { margin: 0; }

.auth-screen,
.error-screen {
  min-height: 100vh; display: grid; place-items: center; color: white; padding: 24px;
  font-family: var(--sans);   /* their <body> has no app-body class */
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, #12052F, #090218);
}
.error-screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 24px;
  overflow-x: hidden;
  overflow-y: auto;
}
.error-screen::before,
.error-screen::after {
  content: "";
  width: 100%;
}
.error-screen::before {
  flex: 1 1 24px;
  min-height: 24px;
}
.error-screen::after {
  flex: 1 1 calc(40vh + 24px);
  min-height: 24px;
}
.error-screen > .auth-stack { flex-shrink: 0; }
.auth-waves {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.auth-dust {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
}
.auth-orb-a {
  width: 52vw;
  height: 52vw;
  left: -16%;
  top: -22%;
  background: radial-gradient(circle, rgba(90,24,235,0.5), transparent 62%);
  animation: auth-drift-a 18s ease-in-out infinite;
}
.auth-orb-b {
  width: 40vw;
  height: 40vw;
  right: -12%;
  bottom: -18%;
  background: radial-gradient(circle, rgba(124,77,255,0.35), transparent 64%);
  animation: auth-drift-b 22s ease-in-out infinite;
}
.wifi-wordmark {
  position: absolute;
  left: 7%;
  top: 11%;
  z-index: 1;
  color: #e6deff;
  font-family: Outfit, sans-serif;
  font-weight: 500;
  font-size: clamp(40px, 6.6vw, 72px);
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 0 16px rgba(196,181,255,0.35));
}
.wifi-i { position: relative; display: inline-block; }
.wifi-from-i {
  position: absolute;
  left: 50%;
  top: 0.12em;
  width: 1.55em;
  height: 1.4em;
  overflow: visible;
  display: block;
  pointer-events: none;
  transform: translate(-50%, -86%);
}
.wifi-arc {
  stroke: currentColor;
  stroke-width: 3.1;
  stroke-linecap: round;
  fill: none;
  transform-origin: 32px 50px;
  animation: wifi-arc-pulse 2.4s ease-in-out infinite;
}
.wifi-arc-1 { animation-delay: 0s; }
.wifi-arc-2 { animation-delay: .35s; }
.wifi-arc-3 { animation-delay: .7s; }
html[dir="rtl"] .wifi-wordmark {
  left: auto;
  right: 7%;
}
.auth-promo {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}
.auth-promo a {
  font-weight: 700;
  white-space: nowrap;
}
@keyframes wifi-arc-pulse {
  0%, 100% { opacity: 0.22; }
  40% { opacity: 0.95; }
}
@keyframes auth-drift-a {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(14%, 10%); }
}
@keyframes auth-drift-b {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-12%, -8%); }
}
.auth-stack { width: min(440px, 100%); position: relative; z-index: 1; }
.auth-card {
  width: 100%; background: #fff; color: var(--ink);
  border-radius: 28px; padding: 36px; box-shadow: var(--shadow);
  position: relative;
}
.auth-card h1 { font-family: var(--serif); font-weight: 500; margin: 8px 0; }
.error-card { text-align: center; }
.error-card .error-code {
  font-family: var(--serif);
  font-size: clamp(72px, 16vw, 112px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--accent);
  margin: 0 0 12px;
  font-weight: 600;
}
.error-card h1 { margin: 8px 0 10px; }
.error-card .muted { margin: 0; }
.auth-card .helptext, .auth-card .helptext ul { display: none; }
.auth-card label { display: block; text-align: start; }
@media (prefers-reduced-motion: reduce) {
  .auth-orb, .wifi-arc { animation: none; }
}
@media (max-width: 720px) {
  .auth-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 0 16px;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .auth-screen::before,
  .auth-screen::after {
    content: "";
    width: 100%;
  }
  .auth-screen::before {
    flex: 1 1 72px;
    min-height: 72px;
  }
  .auth-screen::after {
    flex: 1 1 calc(40vh + 72px);
    min-height: 32px;
  }
  .auth-screen > .wifi-wordmark,
  .auth-screen > .auth-stack { flex-shrink: 0; }
  .wifi-wordmark {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    margin: 0 0 18px;
    font-size: clamp(36px, 11vw, 52px);
  }
  html[dir="rtl"] .wifi-wordmark { left: auto; right: auto; }
}
.muted { color: var(--muted); }
.log-row { display: grid; grid-template-columns: 160px 90px 110px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log-row.is-head {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding-top: 0;
  border-bottom-color: var(--line);
}

.preview-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.device-frame {
  margin: 0 auto; background: #0b031c; border-radius: 28px; padding: 14px 10px;
  box-shadow: 0 20px 50px rgba(18,5,47,0.25);
}
.device-frame iframe { border: 0; background: #fff; border-radius: 18px; display: block; }
.device-frame.phone { width: 390px; }
.device-frame.phone iframe { width: 370px; height: 640px; }
.device-frame.tablet { width: 620px; }
.device-frame.tablet iframe { width: 600px; height: 500px; }
.device-frame.desktop { width: 100%; max-width: 980px; border-radius: 16px; }
.device-frame.desktop iframe { width: 100%; height: 520px; border-radius: 10px; }

.flatpickr-calendar { font-family: var(--sans) !important; }
.flatpickr-current-month .flatpickr-monthDropdown-months {
  width: auto; border: 0; padding: 0 0 0 .5ch; background: none; font: inherit; color: inherit;
}
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange,
.flatpickr-day.selected:hover, .flatpickr-day.startRange:hover, .flatpickr-day.endRange:hover,
.flatpickr-day.selected.inRange, .flatpickr-day.startRange.inRange, .flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus, .flatpickr-day.startRange:focus, .flatpickr-day.endRange:focus,
.flatpickr-day.selected.prevMonthDay, .flatpickr-day.startRange.prevMonthDay, .flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay, .flatpickr-day.startRange.nextMonthDay, .flatpickr-day.endRange.nextMonthDay {
  background: var(--accent); border-color: var(--accent);
}
.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),
.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)) { box-shadow: -10px 0 0 var(--accent); }
.flatpickr-day.inRange, .flatpickr-day.inRange:hover { background: #efe9ff; border-color: #efe9ff; box-shadow: -5px 0 0 #efe9ff, 5px 0 0 #efe9ff; }
.flatpickr-day.today { border-color: var(--accent); }
code { background: #f3efff; padding: 1px 6px; border-radius: 6px; font-size: 12px; }

.docs pre {
  background: var(--ink); color: #efe9ff; padding: 14px 16px; border-radius: 14px;
  overflow: auto; font-size: 13px;
}
.docs-webhooks { margin-top: 16px; }
.docs-webhooks .card { scroll-margin-top: 16px; }
.docs-webhooks ol, .docs-webhooks ul { padding-inline-start: 20px; line-height: 1.7; }
.docs-webhooks table.data { margin-bottom: 8px; }

.lang-switch {
  display: flex;
  gap: 4px;
  margin: 0 0 12px;
}
.lang-switch button {
  flex: 1;
  appearance: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--sidebar-dim);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font: 600 12px var(--sans);
}
.lang-switch button.is-active {
  background: rgba(90,24,235,0.55);
  color: #fff;
  border-color: transparent;
}
.lang-switch-light button {
  background: #f7f5fb;
  border-color: var(--line);
  color: var(--muted);
}
.lang-switch-light button.is-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.auth-lang {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  margin: 0;
}
.lang-switch-auth {
  display: inline-flex;
  gap: 0;
  margin: 0;
  padding: 2px;
  background: #f4f1fa;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lang-switch-auth button {
  flex: none;
  min-width: 38px;
  padding: 4px 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 700 11px/1.2 var(--sans);
  letter-spacing: 0.04em;
}
.lang-switch-auth button.is-active {
  background: var(--accent);
  color: #fff;
}
.translations-table textarea {
  min-height: 64px;
  resize: vertical;
}
.translations-table .mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

html[dir="rtl"] {
  --sans: "IBM Plex Sans Arabic", "Plus Jakarta Sans", "Segoe UI", Tahoma, sans-serif;
}
html[dir="rtl"] body,
html[dir="rtl"] .auth-card,
html[dir="rtl"] .btn,
html[dir="rtl"] button.btn,
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea {
  font-family: var(--sans);
}
html[dir="rtl"] select {
  padding-right: 12px;
  padding-left: 36px;
  background-position: left 14px center;
}
html[dir="rtl"] .page-title,
html[dir="rtl"] .metric-value,
html[dir="rtl"] .auth-card h1 {
  font-family: var(--sans);
  letter-spacing: 0;
}
html[dir="rtl"] .nav-label,
html[dir="rtl"] .page-kicker,
html[dir="rtl"] .metric-label,
html[dir="rtl"] table.data th {
  letter-spacing: 0;
  text-transform: none;
}
html[dir="rtl"] table.data th,
html[dir="rtl"] table.data td { text-align: right; }
html[dir="rtl"] .org-switch {
  text-align: right;
  padding: 8px 10px 8px 28px;
}
html[dir="rtl"] .org-switch::after {
  right: auto;
  left: 12px;
}
html[dir="rtl"] .errorlist { padding-left: 0; padding-right: 16px; }
html[dir="rtl"] .messages li { padding: 12px 14px 12px 40px; }
html[dir="rtl"] .message-close { right: auto; left: 8px; }
html[dir="rtl"] .live-actions {
  margin-right: 0;
  margin-left: 4px;
  padding-right: 0;
  padding-left: 12px;
  border-right: 0;
  border-left: 1px solid var(--line);
}
html[dir="rtl"] .sidebar-toggle::before {
  margin-left: 0;
  margin-right: 3px;
  transform: rotate(-135deg);
}
html[dir="rtl"] .shell.is-collapsed .sidebar-toggle::before,
html[dir="rtl"].sidebar-collapsed .sidebar-toggle::before {
  margin-right: -3px;
  transform: rotate(45deg);
}

.mobile-bar,
.nav-scrim { display: none; }

@media (max-width: 1100px) {
  .grid-metrics, .grid-metrics.six, .grid-metrics.three, .layout-2, .layout-builder, .layout-3, .layout-split, .settings-meta, .sms-layout, .org-profile-form { grid-template-columns: 1fr; }
  #page-builder[data-pane="code"] .builder-work { grid-template-columns: 1fr; }
  .log-row { grid-template-columns: 1fr; }
  .log-row.is-head { display: none; }
  .live-actions { border-right: 0; padding-right: 0; margin-right: 0; }
  html[dir="rtl"] .live-actions { border-left: 0; padding-left: 0; margin-left: 0; }
  .portal-settings-card {
    position: static;
    max-height: none;
  }
}

@media (max-width: 880px) {
  .shell,
  .shell.is-collapsed,
  html.sidebar-collapsed .shell {
    display: block;
    grid-template-columns: none;
  }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 35;
    margin: -16px -16px 16px;
    padding: 10px 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }
  .mobile-menu {
    appearance: none;
    border: 0;
    background: #fff;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    box-shadow: 0 1px 0 rgba(18, 5, 47, 0.04);
    border: 1px solid var(--line);
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    flex-shrink: 0;
  }
  .mobile-menu-bars,
  .mobile-menu-bars::before,
  .mobile-menu-bars::after {
    display: block;
    width: 16px;
    height: 1.5px;
    background: var(--ink);
    border-radius: 2px;
    position: relative;
    transition: transform .2s ease, opacity .2s ease;
  }
  .mobile-menu-bars::before,
  .mobile-menu-bars::after {
    content: '';
    position: absolute;
    left: 0;
  }
  .mobile-menu-bars::before { top: -5px; }
  .mobile-menu-bars::after { top: 5px; }
  html.nav-open .mobile-menu-bars { background: transparent; }
  html.nav-open .mobile-menu-bars::before { top: 0; transform: rotate(45deg); }
  html.nav-open .mobile-menu-bars::after { top: 0; transform: rotate(-45deg); }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
  }
  .mobile-brand .brand-name { color: var(--ink); font-size: 15px; }
  .nav-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(18, 5, 47, 0.45);
    z-index: 50;
  }
  html.nav-open .nav-scrim { display: block; }
  html.nav-open,
  html.nav-open body { overflow: hidden; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 88vw);
    height: 100%;
    z-index: 60;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  html[dir="rtl"] .sidebar {
    inset: 0 0 0 auto;
    transform: translateX(105%);
  }
  html.nav-open .sidebar,
  html[dir="rtl"].nav-open .sidebar { transform: translateX(0); }
  .sidebar-toggle { display: none; }
  .shell.is-collapsed .brand-copy,
  html.sidebar-collapsed .brand-copy { display: block; }
  .shell.is-collapsed .nav-label,
  html.sidebar-collapsed .nav-label { display: block; }
  .shell.is-collapsed .nav a span,
  html.sidebar-collapsed .nav a span { display: inline; }
  .shell.is-collapsed .org-switcher,
  html.sidebar-collapsed .org-switcher { display: block; }
  .shell.is-collapsed .org-tz,
  html.sidebar-collapsed .org-tz { display: block; }
  .shell.is-collapsed .lang-switch,
  html.sidebar-collapsed .lang-switch { display: flex; }
  .shell.is-collapsed .sidebar-foot .signout,
  html.sidebar-collapsed .sidebar-foot .signout { display: block; }
  .shell.is-collapsed .nav a,
  html.sidebar-collapsed .nav a { justify-content: flex-start; padding: 10px 12px; }
  .shell.is-collapsed .brand,
  html.sidebar-collapsed .brand { padding: 0 10px 22px; justify-content: flex-start; }
  .main { padding: 16px 16px 40px; }
  .page-title { font-size: 28px; }
  .metric-value { font-size: 26px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar > .row-actions,
  .topbar > .btn { align-self: flex-start; }
  .filters .field,
  .search-field,
  .date-field,
  .time-field,
  .narrow-field { min-width: 0; flex: 1 1 100%; }
  .table-schedules { table-layout: auto; }
  .table-schedules .row-actions { flex-wrap: wrap; }
  table.data:has(.row-actions),
  table.data:has(.cell-dt),
  table.data:has(thead th:nth-child(n+4)) { min-width: 36rem; }
  .device-frame.phone,
  .device-frame.tablet { width: 100%; }
  .device-frame.phone iframe,
  .device-frame.tablet iframe { width: 100%; }
  .modal-overlay { padding: 16px; }
  .confirm-actions { flex-wrap: wrap; }
}

/* Two-factor authentication */
.twofa-steps { margin: 16px 0 8px; padding-inline-start: 20px; text-align: start; color: var(--ink-soft); font-size: 14px; }
.twofa-steps li { margin: 4px 0; }
.twofa-qr { display: flex; justify-content: center; margin: 8px 0; }
.twofa-qr svg { width: 200px; height: auto; display: block; border: 1px solid var(--line); border-radius: 14px; }
.twofa-secret { text-align: start; font-size: 13px; margin-bottom: 4px; }
.twofa-secret summary { cursor: pointer; color: var(--accent); }
.twofa-secret code { display: block; padding: 10px 12px; background: var(--paper); border-radius: 10px; word-break: break-all; letter-spacing: 0.04em; }
.twofa-code-input { letter-spacing: 0.3em; font-variant-numeric: tabular-nums; text-align: center; }
.twofa-codes { list-style: none; padding: 14px; margin: 16px 0 10px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; background: var(--paper); border-radius: 14px; }
.twofa-codes code { font-size: 15px; letter-spacing: 0.06em; }
.twofa-code-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.twofa-ack { display: flex !important; gap: 8px; align-items: center; font-size: 14px; margin-bottom: 14px; }
.btn.is-disabled { opacity: 0.45; pointer-events: none; }
.twofa-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.twofa-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.twofa-policy { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.twofa-policy p { margin: 4px 0 0; }
.twofa-hint { font-size: 13px; margin: 8px 0 0; }
.twofa-reset { border-top: 1px solid var(--line); padding-top: 12px; }
.twofa-reset p { margin: 0 0 8px; font-size: 13px; }
.twofa-policy.is-solo { border-top: 0; padding-top: 0; margin-top: 8px; }
.field-note { font-size: 12px; margin: 4px 0 0; }
.account-form .helptext { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.account-summary { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.account-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 22px; font-weight: 600;
}
.account-summary-text { flex: 1 1 220px; min-width: 0; }
.account-summary-text h3 { margin: 0; }
.account-summary-text p { margin: 2px 0 0; overflow-wrap: anywhere; }
.account-facts { display: flex; gap: 28px; flex-wrap: wrap; margin: 0; }
.account-facts dt { color: var(--muted); font-size: 12px; }
.account-facts dd { margin: 2px 0 0; font-weight: 600; }
.twofa-devices { margin-top: 12px; }
.sidebar-foot a.sidebar-account {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 10px;
  border-radius: 12px; color: var(--sidebar-text); min-width: 0;
}
.sidebar-foot a.sidebar-account:hover, .sidebar-foot a.sidebar-account.is-active { background: rgba(90, 24, 235, 0.35); color: #fff; }
.sidebar-account-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-account-label { font-size: 14px; }
.sidebar-account-email { font-size: 12px; color: var(--sidebar-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell.is-collapsed .sidebar-account-text,
html.sidebar-collapsed .sidebar-account-text { display: none; }
.shell.is-collapsed .sidebar-foot a.sidebar-account,
html.sidebar-collapsed .sidebar-foot a.sidebar-account { justify-content: center; padding: 10px 0; }
.twofa-devices { width: 100%; border-collapse: collapse; margin: 4px 0 0; font-size: 14px; }
.twofa-devices th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.twofa-devices td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.twofa-devices tr:last-child td { border-bottom: 0; }
.twofa-devices td.twofa-action { text-align: end; white-space: nowrap; }
/* Sidebar foot: language pill and collapse button share one row. */
.sidebar-tools { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.sidebar-tools .lang-switch {
  flex: 1; margin: 0; padding: 3px; gap: 2px; border-radius: 10px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10);
}
.sidebar-tools .lang-switch button {
  border: 0; background: transparent; color: var(--sidebar-text); opacity: 0.75;
  padding: 5px 8px; border-radius: 7px;
}
.sidebar-tools .lang-switch button:hover { opacity: 1; color: #fff; }
.sidebar-tools .lang-switch button.is-active { background: var(--accent); color: #fff; opacity: 1; }
.sidebar-tools { align-items: stretch; }
.sidebar-tools .sidebar-toggle {
  margin: 0; flex: none; width: 36px; height: auto; min-height: 34px; border-radius: 10px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10);
  color: var(--sidebar-text); opacity: 0.85;
}
.sidebar-tools .sidebar-toggle:hover { opacity: 1; color: #fff; background: rgba(255,255,255,0.10); }
.sidebar-tools .sidebar-toggle::before { content: none; }
.sidebar-tools .sidebar-toggle svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.sidebar-toggle-arrow { transform-origin: 14.5px 12px; transition: transform .2s ease; }
.shell.is-collapsed .sidebar-toggle-arrow,
html.sidebar-collapsed .sidebar-toggle-arrow { transform: scaleX(-1); }
[dir="rtl"] .sidebar-tools .sidebar-toggle svg { transform: scaleX(-1); }
.shell.is-collapsed .sidebar-tools,
html.sidebar-collapsed .sidebar-tools { justify-content: center; }


/* {% help %} tag: small "?" link next to a metric or setting */
.help-link { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1; text-decoration: none; vertical-align: middle; }
.help-link:hover { color: #5A18EB; border-color: #5A18EB; }


/* === settings-analytics === */
.sa-scope-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sa-group { margin-bottom: 16px; }
.sa-field { padding: 14px 0; border-top: 1px solid var(--line); }
.sa-group h3 + .sa-field { border-top: 0; }
.sa-field.is-overridden { box-shadow: inset 3px 0 0 #5A18EB; padding-left: 12px; }
.sa-field.has-error { box-shadow: inset 3px 0 0 var(--danger); padding-left: 12px; }
.sa-field-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sa-label { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); display: inline; }
.sa-help { margin: 4px 0 8px; font-size: 13px; }
.sa-control { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 20px; }
.sa-override { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; }
.sa-input { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sa-input.is-inherited { opacity: 0.5; }
.sa-input input[type=text] { width: 220px; max-width: 100%; }
.sa-unit { color: var(--muted); font-size: 13px; }
.sa-days { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.sa-chk { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--ink); }
.sa-hours-wrap { display: flex; flex-direction: column; gap: 8px; }
.sa-hours { display: flex; flex-direction: column; gap: 8px; }
.sa-hours.is-off { opacity: 0.4; }
.sa-hours-day { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sa-hours-name { width: 96px; font-size: 13px; font-weight: 600; }
.sa-hours-ranges { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.sa-range { display: inline-flex; align-items: center; gap: 6px; }
.sa-closed { display: none; font-size: 12px; }
.sa-hours-day.is-closed .sa-closed { display: inline; }
.sa-error { color: var(--danger); font-size: 13px; margin: 6px 0 0; }
.sa-savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sa-savebar p, .sa-savebar span { margin: 0; }
.sa-offer { border-left: 4px solid #5A18EB; }
.sa-rebuild-form { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; }
.sa-rebuild-form .field { margin: 0; }
.sa-rebuild-form p { flex-basis: 100%; margin: 0; }
/* === visitors === */
.vis-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.vis-filters { margin-bottom: 16px; }
.vis-filters summary { cursor: pointer; }
.vis-filter-form { margin-top: 16px; }
.vis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.vis-grid .field { display: flex; flex-direction: column; gap: 6px; }
.vis-grid select[multiple] { min-height: 90px; }
.vis-pair { display: flex; gap: 8px; }
.vis-pair input { width: 50%; }
.vis-filter-actions { display: flex; gap: 8px; margin-top: 16px; }
.vis-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vis-all { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.vis-table th a { color: inherit; text-decoration: none; }
.vis-tag { background: color-mix(in srgb, var(--tag, #5A18EB) 16%, white); color: var(--ink); border: 1px solid var(--tag, #5A18EB); }
.vis-tagform { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vis-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 8px 0 0; }
/* === integrations === */
.health-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #b8b2c8; margin-right: 4px; vertical-align: middle; }
.health-dot.ok { background: var(--ok); }
.health-dot.warn { background: #f79009; }
.health-dot.bad { background: var(--danger); }
.health-dot.off { background: #b8b2c8; }
.text-danger { color: var(--danger); }
.callout-warn { border-left: 4px solid #f79009; background: #fff6ed; padding: 12px 16px; border-radius: 8px; }
.card.callout-warn { border-left: 4px solid #f79009; background: #fff6ed; }
.code-block { background: #12052F; color: #ddd6f3; padding: 14px 16px; border-radius: 10px; overflow: auto; max-height: 520px; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.copy-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.copy-row code, table.setup-values code { word-break: break-all; }
table.setup-values th { width: 220px; text-align: left; color: var(--muted); font-weight: 600; }
.steps { padding-left: 20px; margin: 8px 0 12px; }
.steps li { margin-bottom: 10px; line-height: 1.5; }
.bullets { padding-left: 20px; }
.bullets li { margin-bottom: 8px; line-height: 1.5; }
.card.metric { padding: 16px 18px; }
.card.metric p { margin: 0 0 6px; font-size: 12px; }
.card.metric strong { font-size: 18px; word-break: break-word; }
/* === help === */
.help-search { display: flex; gap: 8px; margin: 0 0 20px; max-width: 560px; }
.help-search input[type=search] { flex: 1; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: var(--card); color: var(--ink); }
.help-muted { color: var(--muted); font-size: 14px; }
.help-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.help-list, .help-results { list-style: none; margin: 0; padding: 0; }
.help-list li, .help-results li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.help-list li:last-child, .help-results li:last-child { border-bottom: 0; }
.help-results p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.help-results a, .help-list a, .help-checklist a { color: var(--accent); font-weight: 600; text-decoration: none; }
.help-results a:hover, .help-list a:hover, .help-checklist a:hover { text-decoration: underline; }
.help-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.help-toc { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; font-size: 14px; }
.help-toc h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.help-toc ul { list-style: none; margin: 0 0 16px; padding: 0; }
.help-toc li a { display: block; padding: 4px 8px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.help-toc li a:hover, .help-toc li a.is-active, .help-toc li a[aria-current] { background: var(--paper); color: var(--accent); }
.help-body { line-height: 1.65; max-width: 80ch; }
.help-body h1 { display: none; }
.help-video { margin: 0 0 24px; }
.help-video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #12052F; }
.help-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.help-video figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.help-body h2 { font-family: var(--serif); font-weight: 500; margin: 32px 0 8px; padding-top: 8px; scroll-margin-top: 16px; }
.help-body h2:first-of-type { margin-top: 0; }
.help-body h3 { margin: 24px 0 6px; scroll-margin-top: 16px; }
.help-body table { border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.help-body th, .help-body td { border: 1px solid var(--line); padding: 6px 10px; text-align: start; vertical-align: top; }
.help-body a { color: var(--accent); }
.help-body :target { background: rgba(90, 24, 235, 0.07); border-radius: 6px; }
.help-support { margin: 32px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); }
.help-onboarding { margin-bottom: 16px; }
.help-progress { font-size: 13px; font-weight: 600; color: var(--accent); margin-inline-start: 8px; }
.help-checklist { list-style: none; margin: 8px 0 0; padding: 0; }
.help-checklist li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.help-checklist li.is-done a { color: var(--muted); font-weight: 500; text-decoration: line-through; }
.help-tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; flex: none; }
.help-checklist li.is-done .help-tick { background: var(--ok); border-color: var(--ok); }
.help-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 860px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; max-height: none; }
}

/* === venues === */
.fv { position: relative; }
.fv-stage { width: 100%; max-height: 72vh; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #f4f0e8; }
.fv-compact .fv-stage { max-height: 46vh; }
.fv-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; }
.fv-svg.is-panning { cursor: grabbing; }
.fv-svg.is-drawing { cursor: crosshair; }
.fv-paper { fill: #fff; }
.fv-grid { stroke: #e3dcef; stroke-width: 1; vector-effect: non-scaling-stroke; }
.fv-tools { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.fv-hint { margin: 8px 0 0; font-size: 13px; }
.ze-ap, .sm-ap { fill: #12052F; stroke: #fff; stroke-width: 3; vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 1px rgba(18, 5, 47, .9)) drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }  /* white ring + dark edge: visible on any plan */
.ze-ap.is-member, .ze-ap.is-picked { fill: #5A18EB; }
.ze-ap.is-picked { stroke: #F2994A; stroke-width: 3; }
.sm-ap { cursor: grab; }
.sm-ap.sm-manual { fill: #5A18EB; }
.sm-ap.is-offline { fill: #b42318; }
.sm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #12052F; margin: 0 4px 0 12px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(18, 5, 47, .9); }
.sm-dot.sm-manual { background: #5A18EB; }
.sm-dot.is-offline { background: #b42318; }
.sm-legend { margin-top: 8px; font-size: 13px; color: var(--muted); }
.ze-zone { cursor: pointer; }
.ze-label { fill: #12052F; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; pointer-events: none; font-weight: 600; }
.ze-vertex { fill: #fff; stroke: #5A18EB; stroke-width: 2; cursor: move; vector-effect: non-scaling-stroke; }
.ze-vertex.is-selected { fill: #5A18EB; }
.ze-mid { fill: #5A18EB; fill-opacity: .35; cursor: copy; }
.ze-draft { fill: none; stroke: #5A18EB; stroke-width: 2; stroke-dasharray: 6 4; }
.ze-draft-pt { fill: #5A18EB; }
.ze-draft-pt.is-first { fill: #fff; stroke: #5A18EB; stroke-width: 2; }
.zone-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.ze-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ze-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.ze-spacer { flex: 1; }
.ze-status { min-height: 1.3em; margin: 0 0 8px; }
.ze-status.is-error, .sm-status.is-error, .alert-error, #align-result.is-error, .align-result.is-error { color: var(--danger); }
.ze-status.is-ok, .sm-status.is-ok, .align-result.is-ok { color: var(--ok); }
.align-result.is-warn { color: var(--warn); }
.ze-list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.ze-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.ze-item:hover, .ze-item.is-selected { background: #f4f0e8; }
.ze-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.ze-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ze-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ze-aps { max-height: 260px; overflow: auto; margin-top: 8px; }
.ze-ap-row { display: flex; gap: 6px; align-items: center; margin: 2px 0; font-size: 13px; color: var(--ink); }
.ze-ap-row input { width: auto; }
.sensor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; margin-bottom: 16px; }
.chip-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.sm-chip { cursor: grab; }
.pk-pt { fill: #5A18EB; stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.pk-line { stroke: #5A18EB; stroke-width: 2; }
.pk-num { fill: #12052F; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 3px; pointer-events: none; }
.align-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 12px 0; }
.align-pairs { padding-left: 20px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
label.check-row, .field label.check-row { display: flex; gap: 10px; align-items: center; margin: 0; font-size: 14px; color: var(--ink); line-height: 1.35; }
.check-row input { width: auto; flex-shrink: 0; }
.note-card { border-left: 4px solid var(--warn); }
.wizard-steps { display: flex; flex-wrap: wrap; gap: 16px; list-style: none; padding: 0; margin: 0 0 16px; color: var(--muted); }
.wizard-steps .is-current { color: var(--accent); font-weight: 700; }
.wizard-steps .is-done { color: var(--ink); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form .field, .inline-form p { margin: 0; }
@media (max-width: 960px) {
  .zone-editor, .sensor-layout, .align-grid { grid-template-columns: 1fr; }
}
/* === analytics === */
.analytics-tabs { margin-bottom: 16px; }
.analytics-note { margin-bottom: 16px; background: #fff8eb; border-color: #f5d9a8; color: var(--warn); }
.analytics-empty { margin-bottom: 16px; }
.analytics-charts { margin-bottom: 16px; }
.kpi-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpi-changes { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin-top: 8px; font-size: 12px; }
.kpi-cap { color: var(--muted); font-size: 11px; margin-right: 6px; }
.chg { font-weight: 600; }
.chg.up { color: var(--ok); }
.chg.down { color: var(--danger); }
.chg.flat { color: var(--muted); }
.info-tip { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; margin-left: 4px; border-radius: 50%; background: var(--line); color: var(--muted); font-size: 10px; font-style: italic; cursor: help; }
.export-links { display: flex; gap: 6px; align-items: center; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }
.multi-facts { margin-bottom: 8px; }
.heat-wrap { overflow-x: auto; }
table.heat { border-collapse: separate; border-spacing: 2px; font-size: 10px; }
table.heat th { font-weight: 500; color: var(--muted); padding: 0 4px; text-align: left; }
table.heat td { width: 16px; height: 18px; border-radius: 3px; background: rgba(90, 24, 235, calc(0.06 + var(--v) / 100 * 0.94)); }
.period-form { align-items: flex-end; }
table.data th.sorted a { color: var(--ink); }
table.data th a { color: var(--muted); text-decoration: none; }
.spark { width: 100px; height: 28px; color: var(--accent); }
@media (max-width: 720px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
/* === spaces === */
.sp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.sp-tabs a { padding: 8px 16px; border-radius: 999px; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--line); }
.sp-tabs a.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sp-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sp-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0 12px; }
.sp-chips a.chip { text-decoration: none; }
.fv-zones a.sp-zone { cursor: pointer; }
.fv-zones a.sp-zone:hover polygon { stroke-width: 0.6; }
.sp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 20px; }
.sp-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.sp-picks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0 14px; }
.sp-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); margin: 0; }
.sp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.sp-dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 14px; }
.sp-dl dt { color: var(--muted); }
.sp-dl dd { margin: 0; font-weight: 600; text-align: right; }
.chart-box.tall { height: 320px; }
table.data th.num, table.data td.num { text-align: right; white-space: nowrap; }
.sp-diagram { width: 100%; overflow-x: auto; }
.sp-diagram svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.sp-scroll { overflow: auto; padding: 8px 0; }
.sp-tree { display: block; }
.sp-sites { display: flex; gap: 8px; flex-wrap: wrap; }
.sp-lane { display: flex; align-items: center; gap: 14px; padding: 6px 0; border-bottom: 1px solid #efeaf7; }
.sp-lane-flow { position: relative; flex: 1; min-height: 34px; display: flex; align-items: center; min-width: 0; }
.sp-band { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); background: rgba(90, 24, 235, 0.22); border-radius: 999px; }
.sp-band.is-other { background: rgba(107, 101, 120, 0.22); }
.sp-lane-nodes { position: relative; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 8px; }
.sp-node { background: #fff; border: 1px solid var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; }
.sp-node.muted { border-color: var(--line); font-weight: 400; }
.sp-arrow { color: var(--accent); font-weight: 700; }
.sp-lane-n { width: 70px; text-align: right; font-weight: 700; font-family: var(--serif); font-size: 20px; }
.sp-bnode { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 8px 0 0; background: #fff; }
.sp-bchildren { margin-left: 22px; padding-left: 14px; border-left: 2px solid var(--line); }
.sp-brow { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.sp-brow input[type=text] { flex: 1; min-width: 180px; }
.sp-bzones { margin: 8px 0 0; }
.sp-bzones summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; }
.sp-bzones .sp-picks { margin: 8px 0 0; }
.sp-bbtns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 640px) { .sp-lane { flex-direction: column; align-items: stretch; } .sp-lane-n { text-align: left; } }

/* === live === */
.live-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.live-side { display: grid; gap: 16px; }
.live-check label { display: flex; align-items: center; gap: 6px; margin-top: 22px; color: var(--ink); font-size: 13px; }
.live-status { font-size: 12px; color: var(--muted); }
.live-status.is-error { color: var(--danger); }
.live-note { font-size: 12px; color: var(--warn); }
.live-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 0; font-size: 12px; color: var(--muted); align-items: center; }
.live-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.dot.wifi, .live-dot.wifi { background: #5A18EB; fill: #5A18EB; }
.dot.ble, .live-dot.ble { background: #0e9384; fill: #0e9384; }
.dot.prox { background: transparent; border: 2px solid #6b6578; }
.live-dot { stroke: #fff; fill-opacity: .9; }
.live-dot.prox { fill: #fff; fill-opacity: .6; }
.live-dot.wifi.prox { stroke: #5A18EB; }
.live-dot.ble.prox { stroke: #0e9384; }
.live-dot.excluded { opacity: .45; }
.live-zone { fill: var(--zone, #5A18EB); fill-opacity: .1; stroke: var(--zone, #5A18EB); pointer-events: none; }
.live-zone[data-status="busy"] { fill: #f79009; fill-opacity: .22; }
.live-zone[data-status="full"], .live-zone[data-status="alert"] { fill: var(--danger); fill-opacity: .28; stroke: var(--danger); }
.live-zone-label { fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-opacity: .8; pointer-events: none; }
.live-zones .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.live-zone-row.alert td, .live-zone-row.full td { color: var(--danger); font-weight: 600; }
.live-zone-row.busy td { color: var(--warn); }
.live-count { font-variant-numeric: tabular-nums; }
.heat-image { pointer-events: none; }
.heat-ramp { display: inline-block; width: 120px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, rgba(90,24,235,.3), #f5a623, #d7263d); }
.path-ghost { stroke: var(--accent); stroke-opacity: .25; stroke-linejoin: round; }
.path-trail { stroke: var(--accent); stroke-linejoin: round; stroke-linecap: round; }
.path-marker { stroke: #fff; }
.path-controls { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.path-controls input[type=range] { flex: 1; }
.path-controls select { width: 84px; flex: none; }
tr.path-seek { cursor: pointer; }
tr.path-seek:hover td { background: #f3efff; }
.rule-form { display: grid; gap: 14px; max-width: 640px; }
.rule-form ul { list-style: none; padding: 0; margin: 0; }
.rule-form .helptext { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.rule-form .field-error { display: block; color: var(--danger); font-size: 12px; margin-top: 4px; }
@media (max-width: 900px) { .live-layout { grid-template-columns: 1fr; } }
.live-note.muted { color: var(--muted); }
.rule-form .btn { justify-self: start; }
/* === forecasting === */
.fc-site-form { margin-bottom: 12px; }
.fc-chart-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.fc-chart-head p { margin: 4px 0 0; max-width: 62ch; }
.fc-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.fc-tabs { margin: 0; }
.fc-note { margin: 10px 0 0; font-size: 13px; }
.fc-small { font-size: 22px; }
.fc-key { font-size: 12px; margin-top: 4px; }
.fc-rename { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.fc-rename input { width: 260px; max-width: 100%; }
.fc-special-card .btn, #segments td .btn { white-space: nowrap; }
.fc-progress { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; max-width: 360px; }
.fc-progress span { display: block; height: 100%; background: #5A18EB; }
.fc-error { white-space: pre-wrap; font-size: 12px; overflow-x: auto; }
.fc-special-card { margin-bottom: 16px; }
@media (max-width: 720px) { .fc-controls { width: 100%; } }
/* === reports === */
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.report-head h3 { margin: 0 0 4px; }
.report-head p { margin: 0; }
.table-scroll { overflow-x: auto; }
.table-scroll table.data td:not(:first-child) { white-space: nowrap; }
.js-freq.is-hidden { display: none; }
#schedule-form p.muted, .report-head p, .card > p.muted { font-size: 13px; margin: 4px 0 8px; }
/* === campaigns === */
.chip.cmp-sent { background: #ecfdf3; color: var(--ok); }
.chip.cmp-draft, .chip.cmp-pending, .chip.cmp-sending, .chip.cmp-scheduled { background: #f4f0e8; color: var(--ink-soft); }
.chip.cmp-failed { background: #fef3f2; color: var(--danger); }
.chip.cmp-skipped, .chip.cmp-cancelled { background: #fff6ed; color: var(--warn); }
.cmp-message { white-space: pre-wrap; background: #faf8ff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.cmp-radio { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; }
.cmp-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.cmp-live { align-self: start; position: sticky; top: 16px; }
.cmp-live .metric-value { font-size: 28px; margin-top: 2px; }
.cmp-test { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.cmp-test input { width: 150px; }
/* automated campaigns: rule builder, sentence, templates */
.chip[class*="auto-"] { white-space: nowrap; }
.chip.auto-live, .chip.auto-st-sent { background: #ecfdf3; color: var(--ok); }
.chip.auto-test, .chip.auto-st-test, .chip.auto-st-held_out { background: #f3efff; color: var(--accent); }
.chip.auto-off, .chip.auto-st-pending, .chip.auto-st-sending { background: #f4f0e8; color: var(--ink-soft); }
.chip.auto-st-failed { background: #fef3f2; color: var(--danger); }
.chip.auto-st-skipped, .chip.auto-st-cancelled { background: #fff6ed; color: var(--warn); }
.auto-sentence { font-size: 16px; line-height: 1.6; background: #faf8ff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; min-height: 26px; }
.auto-sentence strong { color: var(--accent); }
.auto-sentence-sm { font-size: 13px; color: var(--ink-soft); margin-top: 4px; max-width: 640px; }
.auto-sentence-sm strong { font-weight: 600; }
.auto-block { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.auto-word { flex: 0 0 64px; font-weight: 700; color: var(--accent); text-transform: uppercase; font-size: 13px; letter-spacing: .04em; padding-top: 30px; }
.auto-body { flex: 1 1 auto; min-width: 0; }
.auto-fields { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: flex-start; }
.auto-fields .field { min-width: 160px; }
.auto-cond { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.auto-cond-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
#delay-min { max-width: 140px; }
.auto-periods { margin: 18px 0 14px; }
.auto-preview { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.auto-preview-out { flex: 1 1 100%; }
.auto-preview-out .grid-metrics { margin: 8px 0; }
.auto-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.auto-template { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.auto-template:hover { border-color: var(--accent); }
.auto-template span { font-size: 13px; }
.auto-template.blank { border-style: dashed; }
@media (max-width: 640px) {
  .auto-block { flex-direction: column; gap: 4px; }
  .auto-word { padding-top: 0; }
}

/* === shared widgets (focus ring, 24 h time picker, multi-select, settings jump, API tokens) === */
input:focus, select:focus, textarea:focus, .flatpickr-alt:focus, .multi-select-button:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(90, 24, 235, 0.14);
}
input.flatpickr-time, .sa-input input.flatpickr-time { width: 110px; text-align: center; cursor: pointer; padding: 11px 12px; line-height: 18px; height: 42px; min-height: 42px; }
.inline-form > .btn:not(.sm), .token-create > .btn { min-height: 42px; }
.sa-range { display: inline-flex; align-items: center; gap: 8px; }
.sa-field input.flatpickr-time { width: 110px; }
.multi-select { position: relative; }
.multi-select-button {
  width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 11px 36px 11px 12px; font: 14px var(--sans); color: var(--muted); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b6578' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center;
}
.multi-select-button.has-value { color: var(--ink); }
.multi-select.is-open .multi-select-button { border-color: var(--accent); }
.multi-select-panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%; max-width: 360px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px;
}
.multi-select-search { margin-bottom: 6px; }
.multi-select-list { max-height: 260px; overflow: auto; }
.multi-select-option { display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px 8px; border-radius: 8px; font-size: 14px; color: var(--ink); cursor: pointer; }
.multi-select-option:hover { background: var(--paper); }
.multi-select-empty { margin: 6px 8px; color: var(--muted); font-size: 13px; }
.sa-jump { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.sa-scope + .sa-form, .sa-scope + form { display: block; margin-top: 16px; }
.sa-jump a { color: var(--ink); }
.token-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.token-head p { margin: 6px 0 0; }
.token-create { display: flex; gap: 8px; align-items: center; margin: 0; }
.token-create input { width: 220px; }

/* Stacked cards get a 16px gap (rule near .card); grid / flex containers space their cards with `gap`. */
:is(.card, :has(> .card)) + :is(.card, :has(> .card)) { margin-top: 16px; }
:where(.align-grid,.auth-screen,.brand,.brand-mark,.btn,.builder-preview,.builder-switch,.builder-toolbar,.builder-work,.card-head,.check-grid,.check-row,.chip,.chip-cloud,.cmp-checks,.cmp-radio,.cmp-test,.confirm-actions,.copy-row,.delivery-actions,.error-screen,.export-links,.fc-chart-head,.fc-controls,.fc-rename,.file-pick,.file-pick-btn,.filters,.fv-tools,.gallery-grid,.grid-metrics,.help-layout,.help-link,.help-search,.help-sections,.help-tick,.import-form,.info-tip,.inline-form,.kpi-changes,.lang-switch,.lang-switch-auth,.layout-2,.layout-3,.layout-split,.live-actions,.live-layout,.live-legend,.live-side,.location-add-btn,.location-pick-row,.log-row,.member-edit-actions,.mobile-bar,.mobile-brand,.mobile-menu,.modal-head,.multi-select-option,.nav,.org-profile-form,.page-tabs,.pager,.pager-links,.path-controls,.period-inputs,.portal-checks,.portal-grid,.preview-toolbar,.profile-facts,.radius-test-attrs,.radius-top,.report-head,.row-actions,.rule-form,.sa-chk,.sa-control,.sa-days,.sa-field-head,.sa-hours,.sa-hours-day,.sa-hours-ranges,.sa-hours-wrap,.sa-input,.sa-override,.sa-range,.sa-rebuild-form,.sa-savebar,.sa-scope-tabs,.sensor-layout,.settings-stack,.shell,.sidebar,.sidebar-account-text,.sidebar-toggle,.sidebar-tools,.sms-help,.sp-actions,.sp-bbtns,.sp-brow,.sp-cards,.sp-chips,.sp-dl,.sp-lane,.sp-lane-flow,.sp-lane-nodes,.sp-pick,.sp-picks,.sp-sites,.sp-tabs,.sp-two,.starter-row,.table-export,.temp-pass,.token-create,.token-head,.topbar,.twofa-ack,.twofa-actions,.twofa-code-actions,.twofa-codes,.twofa-policy,.twofa-qr,.twofa-title,.vis-actions,.vis-all,.vis-bulk,.vis-filter-actions,.vis-grid,.vis-inline,.vis-pair,.vis-tagform,.webhook-events,.wizard-steps,.ze-ap-row,.ze-item,.ze-row,.ze-side,.ze-toolbar,.zone-editor) > :is(.card, :has(> .card)) + :is(.card, :has(> .card)) { margin-top: 0; }

/* SMS gateway form: test before saving */
.gw-test { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; }
.gw-test-row { display: flex; gap: 8px; align-items: center; max-width: 460px; }
.gw-test-result { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.gw-test-result.is-ok { background: #ecfdf3; color: var(--ok); }
.gw-test-result.is-error { background: #fef3f2; color: var(--danger); }

/* Small forms in a card header (day picker + button) stay on one line */
.card-head .inline-form { flex-wrap: nowrap; align-items: center; }
.card-head .inline-form label { margin: 0; white-space: nowrap; }
.card-head .inline-form input, .card-head .inline-form .flatpickr-alt { width: 150px; }
input.flatpickr-alt.flatpickr-date { cursor: pointer; }
/* Zone map colour scale legend */
.sp-scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.sp-scale i { display: block; width: 220px; height: 10px; border-radius: 999px; }

/* Email list widget (textarea[data-email-list]) */
.email-list { display: grid; gap: 8px; }
.email-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.email-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 13px; color: var(--ink); }
.email-chip button { border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 50%; }
.email-chip button:hover { color: var(--danger); }
.email-add { display: flex; gap: 8px; align-items: center; max-width: 520px; }

/* Buttons never wrap their label; toggles in the two-column org form line up with the inputs beside them */
.btn, button.btn { white-space: nowrap; }
.gw-test-row input { flex: 1; }

/* Colour picker: a swatch the size of an input */
input[type=color] { width: 42px; min-width: 42px; height: 42px; padding: 4px; border-radius: 10px; cursor: pointer; background: #fff; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 6px; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 6px; }
.field.narrow-field { flex: 0 0 auto; }
/* Device tags: add form on one row, edit row on one line */
.tag-new { margin: 0; }
.tag-new .field { margin: 0; }
.tag-new .narrow-field { width: auto; }
.tag-new .field:first-of-type input { width: 260px; }
.tag-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-actions .vis-inline { margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.tag-actions input[type=text] { width: 200px; }

.tag-new .narrow-field { min-width: 0; flex: 0 0 auto; }

.docs-endpoint { margin-top: 16px; scroll-margin-top: 16px; }
.docs-endpoint h3 { margin-top: 0; }
.docs-endpoint pre { background: var(--ink); color: #efe9ff; padding: 14px 16px; border-radius: 14px; overflow: auto; font-size: 13px; }
.docs-verb { display: inline-block; background: var(--accent); color: #fff; border-radius: 6px; padding: 1px 8px; font-size: 12px; margin-right: 6px; }
.docs-list { padding-inline-start: 20px; line-height: 1.7; }

/* Choice between a few options (radio inputs): pill buttons like the tab bars, the chosen one in the accent. */
.choice-group { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-group label {
  position: relative; display: inline-flex; align-items: center; margin: 0;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font: 600 12px var(--sans); color: var(--ink); cursor: pointer;
}
.choice-group label:hover { border-color: var(--accent); color: var(--accent); }
.choice-group input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.choice-group label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice-group label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-group label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
/* Hour / minute boxes inside the calendar: flatpickr's own look, not the form input border. */
.flatpickr-calendar .flatpickr-time input.numInput {
  border: 0; border-radius: 0; padding: 0; background: transparent; height: 100%; box-shadow: none;
}

/* Loading feedback (static/js/app.js): a slim bar for slow navigation, a card for long report periods. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.page-loading { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.page-loading.is-long {
  pointer-events: auto;
  cursor: progress;
  background: rgba(244, 241, 250, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.page-loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  overflow: hidden;
  background: rgba(90, 24, 235, 0.15);
}
.page-loading-bar::before,
.page-loading-track span {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  background: var(--accent);
  border-radius: 999px;
  animation: page-loading-slide 1.3s ease-in-out infinite;
}
.page-loading-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(18, 5, 47, 0.18);
  padding: 22px 24px;
}
.page-loading-title { margin: 0 0 14px; font-weight: 600; color: var(--ink); }
.page-loading-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
}
.page-loading-body { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
@keyframes page-loading-slide {
  0% { left: -35%; }
  100% { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .page-loading-bar::before,
  .page-loading-track span { animation: none; left: 0; width: 100%; opacity: .6; }
}

/* ---- AI assistant (templates/assistant/, static/js/assistant.js) ---- */
.ai-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.ai-chats { position: sticky; top: 20px; padding: 14px; max-height: calc(100vh - 40px); overflow-y: auto; }
.ai-new { width: 100%; justify-content: center; }
.ai-chats-label { margin: 14px 4px 6px; color: var(--muted); }
.ai-chat-link { display: block; padding: 7px 10px; border-radius: 8px; color: var(--ink-soft); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.ai-chat-link:hover { background: var(--paper); }
.ai-chat-link.is-current { background: var(--paper); color: var(--accent); font-weight: 600; }
.ai-small { font-size: 12px; margin: 6px 0 0; }
.ai-main { display: flex; flex-direction: column; min-height: calc(100vh - 220px); }
.ai-usage { font-size: 12px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px; }
.ai-notice { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 13px; }
.ai-notice.warn { background: #fff6ed; color: var(--warn); border: 1px solid #fedf89; }
.ai-thread { flex: 1; display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; }
.ai-bubble { max-width: 860px; padding: 12px 16px; border-radius: 14px; line-height: 1.6; overflow-wrap: anywhere; font-size: 14px; }
.ai-bubble.user { align-self: flex-end; background: var(--ink); color: #fff; white-space: pre-wrap; }
.ai-bubble.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); }
.ai-bubble.assistant p { margin: 0 0 8px; }
.ai-bubble.assistant p:last-child { margin-bottom: 0; }
.ai-bubble.assistant ul, .ai-bubble.assistant ol { margin: 4px 0 8px; padding-left: 20px; }
.ai-bubble.assistant table { border-collapse: collapse; margin: 8px 0; font-size: 13px; font-variant-numeric: tabular-nums; display: block; overflow-x: auto; }
.ai-bubble.assistant th, .ai-bubble.assistant td { border-bottom: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.ai-bubble.assistant th { color: var(--muted); font-weight: 600; font-size: 12px; }
.ai-bubble.assistant code { background: var(--paper); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.ai-bubble.assistant a { color: var(--accent); }
.ai-bubble.error { align-self: flex-start; background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; }
.ai-meta { align-self: flex-start; margin-top: -6px; font-size: 12px; }
.ai-status { align-self: flex-start; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.ai-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: ai-pulse 1s infinite ease-in-out; }
@keyframes ai-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .ai-status::before { animation: none; } }
.ai-empty { text-align: center; padding: 30px 10px 10px; }
.ai-empty h2 { margin: 0 0 6px; font-family: var(--serif); font-weight: 500; }
.ai-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.ai-suggestion { border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.ai-suggestion:hover { border-color: var(--accent); color: var(--accent); }
.ai-form { position: sticky; bottom: 0; background: var(--paper); padding: 10px 0 4px; }
.ai-model { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.ai-model label { margin: 0; }
.ai-model select { width: auto; padding-top: 4px; padding-bottom: 4px; }
.ai-box { display: flex; gap: 10px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 14px; }
.ai-box textarea { flex: 1; border: 0; box-shadow: none; resize: none; min-height: 24px; max-height: 200px; padding: 6px 0; background: transparent; font: inherit; outline: none; }
.ai-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.ai-stats div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.ai-stats strong { font-size: 18px; }
.ai-settings-form { display: grid; gap: 6px; max-width: 420px; }
.ai-settings-form .btn { justify-self: start; margin-top: 8px; }
.ai-key-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-key-form input { flex: 1; min-width: 240px; }
.ai-members { margin: 8px 0 0; padding-left: 18px; }
.ai-panel { position: fixed; right: 24px; bottom: 24px; width: min(860px, 55vw); min-width: min(420px, calc(100vw - 48px)); height: min(720px, 75vh); background: rgba(245, 243, 251, 0.2); -webkit-backdrop-filter: blur(4px) saturate(130%); backdrop-filter: blur(4px) saturate(130%); border: 1px solid rgba(255, 255, 255, 0.7); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(18, 5, 47, 0.22); z-index: 60; display: flex; flex-direction: column; overflow: hidden; }
@media (max-width: 600px) { .ai-panel { right: 0; bottom: 0; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .ai-panel { background: var(--paper); } }
.ai-fab { position: fixed; right: 24px; bottom: 24px; z-index: 59; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; box-shadow: 0 10px 30px rgba(90, 24, 235, 0.35); cursor: pointer; display: grid; place-items: center; transition: transform .15s ease, box-shadow .15s ease; }
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(90, 24, 235, 0.45); }
.ai-fab:focus-visible { outline: 3px solid rgba(90, 24, 235, 0.35); outline-offset: 3px; }
.ai-fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.ai-panel-open .ai-fab { display: none; }
@media (prefers-reduced-motion: reduce) { .ai-fab { transition: none; } }
.ai-panel[hidden] { display: none; }
.ai-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid rgba(230, 225, 240, 0.8); background: rgba(255, 255, 255, 0.82); }
.ai-panel .ai-bubble.assistant { background: rgba(255, 255, 255, 0.94); }
.ai-panel .ai-suggestion { background: rgba(255, 255, 255, 0.9); }
.ai-panel .ai-box { background: rgba(255, 255, 255, 0.96); }
.ai-panel .ai-usage, .ai-panel .ai-meta, .ai-panel .ai-status, .ai-panel .ai-small, .ai-panel .ai-empty .muted { color: var(--ink-soft); }
.ai-panel .ai-usage, .ai-panel .ai-meta, .ai-panel .ai-status, .ai-panel .ai-small, .ai-panel .ai-empty, .ai-panel .ai-model label { color: var(--ink); font-weight: 500; text-shadow: 0 0 4px #fff, 0 0 10px #fff, 0 0 16px rgba(255, 255, 255, 0.9); }
.ai-panel-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ai-panel-chats { max-width: 260px; padding-top: 4px; padding-bottom: 4px; font-size: 12px; }
.ai-panel-close { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; }
.ai-panel-body { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 12px 14px 8px; }
.ai-panel-body .ai-thread { overflow-y: auto; min-height: 0; padding-right: 4px; }
.ai-panel-body .ai-bubble { max-width: min(100%, 760px); font-size: 13.5px; }
.ai-panel-body .ai-form, .ai-panel-body .ai-usage, .ai-panel-body .ai-notice { width: 100%; max-width: 900px; margin-left: auto; margin-right: auto; }
.ai-panel-body .ai-thread { padding-left: 4px; }
.ai-panel-body .ai-empty { padding-top: 16px; }
.ai-panel-body .ai-form { position: static; background: transparent; }
@media (max-width: 900px) {
  .ai-layout { grid-template-columns: 1fr; }
  .ai-chats { position: static; max-height: 220px; }
}
.ai-box textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* License page (accounts/license.html) */
.license-stopped { border-left: 4px solid var(--danger); }
.license-stopped h3 { color: var(--danger); }
.license-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.license-banner a { font-weight: 600; margin-left: 4px; }
