:root {
  /* Manara's colours, as on the website: deep emerald and gold. Light unless the person chose otherwise (User::APPEARANCES). */
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --text: #17302a;
  --muted: #5a6d67;
  --line: #e3e0d6;
  --brand: #155044;
  --brand-ink: #ffffff;
  --brand-soft: #e3efe9;
  --gold: #9d7a2c;
  --danger: #b3261e;
  --danger-soft: #fbebeb;
  --warn: #8a5a00;
  --warn-soft: #f9eeda;
  --ok: #1f6f3f;
  --ok-soft: #e5f4e4;
  --side: #0c2b25;
  --side-text: rgb(255 255 255 / 0.86);
  --side-muted: rgb(255 255 255 / 0.58);
  --side-active: rgb(201 162 75 / 0.18);
  --side-active-text: #e6cf96;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(10 35 30 / 0.05), 0 6px 20px rgb(10 35 30 / 0.05);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1412;
  --surface: #151c19;
  --surface-2: #1c2521;
  --text: #e8ede9;
  --muted: #a2aea8;
  --line: #29332f;
  --brand: #4cbf98;
  --brand-ink: #06201a;
  --brand-soft: #17372d;
  --gold: #d8b25e;
  --danger: #f2827a;
  --danger-soft: #3a1d1b;
  --warn: #e6b45c;
  --warn-soft: #3a2e17;
  --ok: #7fd49a;
  --ok-soft: #183222;
  --side: #0a1d19;
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0e1412;
    --surface: #151c19;
    --surface-2: #1c2521;
    --text: #e8ede9;
    --muted: #a2aea8;
    --line: #29332f;
    --brand: #4cbf98;
    --brand-ink: #06201a;
    --brand-soft: #17372d;
    --gold: #d8b25e;
    --danger: #f2827a;
    --danger-soft: #3a1d1b;
    --warn: #e6b45c;
    --warn-soft: #3a2e17;
    --ok: #7fd49a;
    --ok-soft: #183222;
    --side: #0a1d19;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: linear-gradient(to left, var(--side) 240px, var(--bg) 240px); }
.side { background: var(--side); color: var(--side-text); padding: 20px 14px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand img { display: block; flex: none; }
.brand b { display: block; font-family: 'Reem Kufi', 'IBM Plex Sans Arabic', sans-serif; font-weight: 600; font-size: 22px; line-height: 1.15; color: var(--side-active-text); }
.brand small { display: block; font-size: 12px; color: var(--side-muted); }
.nav-label { font-size: 12px; color: var(--side-muted); padding: 14px 10px 4px; }
.nav a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--side-text); }
.nav a.active { background: var(--side-active); color: var(--side-active-text); font-weight: 600; }
.nav a:hover:not(.active) { background: rgb(255 255 255 / 0.06); }
.side .btn { background: transparent; color: var(--side-text); border-color: rgb(255 255 255 / 0.22); }
.side .btn:hover { background: rgb(255 255 255 / 0.08); }

/* The bar at the top of every page: the search on the right, the appearance and the account at the top left. */
.app-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.app-header-start { display: none; align-items: center; gap: 10px; }
.header-brand { padding: 0; }
.header-brand b { font-size: 19px; }
.header-search { flex: 1; min-width: 0; }
.app-header-tools { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.header-menu { position: relative; }
.header-menu > .btn { min-height: 36px; }
.menu-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30; width: max-content; min-width: 240px; max-width: calc(100vw - 32px); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgb(10 35 30 / 0.16); padding: 10px; display: grid; gap: 8px; }
.menu-panel form { margin: 0; }
.menu-panel > .btn, .menu-panel form > .btn { width: 100%; justify-content: center; min-height: 40px; font-size: 14px; }
.menu-who { display: grid; gap: 2px; padding: 2px 2px 10px; border-bottom: 1px solid var(--line); }
.account-button { gap: 8px; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 13px; font-weight: 700; }
.appearance { display: flex; gap: 2px; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.appearance button { flex: 1; font: inherit; font-size: 14px; border: 0; background: transparent; color: var(--muted); padding: 9px 10px; border-radius: 7px; cursor: pointer; }
.appearance button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(10 35 30 / 0.14); }
.appearance button:hover:not([aria-pressed="true"]) { color: var(--text); }
.main { min-width: 0; padding: 28px 32px 48px; max-width: 1180px; width: 100%; margin-inline: auto; }
@media (min-width: 1800px) { .main { max-width: 1400px; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.alert .value { color: var(--danger); }

.btn { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.small { padding: 3px 10px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* M11: a mosque has up to 13 tabs; on a desktop they wrap to a second row rather than hide past the edge. */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-color: var(--brand); font-weight: 600; }

form.stack, .stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.hint { font-size: 13px; color: var(--muted); }
.error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 9px; }
.success { background: var(--ok-soft); color: var(--ok); padding: 10px 12px; border-radius: 9px; }
.warning { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 9px; }
.account-notices { display: grid; gap: 8px; margin-bottom: 16px; }
.impersonating { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: var(--warn-soft); color: var(--warn); border: 1px solid currentColor; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.shot { display: block; max-width: 220px; border-radius: 8px; border: 1px solid var(--line); }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; }
.code-input { font-size: 26px; letter-spacing: 8px; text-align: center; direction: ltr; font-variant-numeric: tabular-nums; }
.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.day { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.day h3 { font-size: 14px; margin-bottom: 6px; }
.day .p { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; }
.day .p .iq { color: var(--muted); font-size: 12px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: var(--bg); }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 0 0 0 auto; width: 260px; z-index: 10; }
  .side { position: static; height: auto; }
  /* On a phone the top bar is the dark strip: the menu and the name, the appearance and the account, the search below. */
  .app-header { flex-wrap: wrap; margin: -20px -16px 16px; padding: 10px 16px; background: var(--side); color: var(--side-text); }
  .app-header-start { display: flex; }
  .app-header-start .btn, .header-menu > .btn { background: transparent; color: var(--side-text); border-color: rgb(255 255 255 / 0.22); min-height: 40px; min-width: 40px; justify-content: center; }
  .header-search { order: 3; flex-basis: 100%; }
  .header-current, .account-name { display: none; }
  .main { padding: 20px 16px 40px; }
  .week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
}

/* Server-rendered extras: inline field errors and the close button of the mobile menu. */
.field .err { font-size: 13px; color: var(--danger); }
.side-close { display: none; align-self: flex-end; }
@media (max-width: 820px) {
  .side.open .side-close { display: inline-flex; }
}
.inline { display: inline; }

/* U03: save and publish states, list paging. */
.dirty { color: var(--warn); font-size: 13px; margin-inline-start: 10px; }
/* C-18: hidden until the keyboard reaches it, the first stop on every page. */
.skip-link { position: absolute; inset-inline-start: 12px; top: -80px; z-index: 50; background: var(--surface); color: var(--brand); font-weight: 700; padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; }
.skip-link:focus { top: 12px; outline: 2px solid var(--brand); outline-offset: 2px; }
#content:focus { outline: none; }
.save-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
/* C-11: a page its reader may only look at, said once at its top. */
/* C-19: see dashboard.js; the field stays empty and its calendar button stays visible. */
input[data-empty]:not(:focus)::-webkit-datetime-edit { color: transparent; }
.read-only { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }
/* C-05: a long form's saving stays at the foot of the screen while any of its cards is in view. */
.save-bar.sticky { position: sticky; bottom: 0; z-index: 5; box-shadow: var(--shadow); }
html:has(.save-bar.sticky) { scroll-padding-bottom: 96px; }
.publish-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }

/* U03: on a phone, table rows become cards with each cell labelled by its column. */
@media (max-width: 640px) {
  .table-wrap { overflow-x: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin-bottom: 10px; background: var(--surface); }
  .table-wrap tr:last-child td { border-bottom: 1px solid var(--line); }
  .table-wrap td { border-bottom: 1px solid var(--line); padding: 7px 0; }
  .table-wrap tr td:last-child { border-bottom: none; }
  /* Label and value on one line; the first cell (the row's name) stands alone as the card title. */
  .table-wrap td[data-label]:not([data-label=""]):not(:first-child) { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
  .table-wrap td[data-label]:not([data-label=""]):not(:first-child)::before { content: attr(data-label); font-size: 12px; color: var(--muted); flex: 0 0 auto; }
  .table-wrap td:first-child { font-size: 15px; }
  .table-wrap td:empty { display: none; }
}

/* Staff: the command centre, the system page, the search at the top, a mosque's path, list tools. */
[x-cloak] { display: none !important; }
.search { position: relative; max-width: 560px; }
.search input { padding: 10px 14px; border-radius: 10px; }
.search-results { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgb(10 35 30 / 0.16); max-height: 70vh; overflow: auto; padding: 6px; }
.search-label { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); padding: 8px 10px 4px; }
.search-row { display: flex; flex-direction: column; padding: 7px 10px; border-radius: 8px; color: var(--text); }
.search-row:hover, .search-row:focus { background: var(--surface-2); outline: none; }
.search .empty { padding: 14px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; color: var(--text); }
.kpi.warn { border-inline-start-color: var(--warn); }
.kpi.accent { border-inline-start-color: var(--gold); }
a.kpi[href]:hover { border-color: var(--brand); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 30px; font-weight: 700; line-height: 1.2; margin-top: auto; }
.todo { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.todo-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.todo-head { display: flex; align-items: center; gap: 8px; }
.todo-head .btn { margin-inline-start: auto; }
.todo ul { margin: 10px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; font-size: 14px; }
.system-line { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 16px; padding: 12px 16px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.system-line.ok { background: var(--ok-soft); color: var(--ok); }
.system-line .hint { color: inherit; font-weight: 400; }
.facts { margin: 0 0 10px; padding-inline-start: 18px; display: grid; gap: 6px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }
.crumbs [aria-current] { color: var(--text); }
.list-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.list-tools input { flex: 1 1 260px; max-width: 420px; }
.list-tools select { flex: 0 1 240px; width: auto; }
.login .brand b { color: var(--brand); }
.login .brand small { color: var(--muted); }

/* Phase 2: a customer's profile, the contact log, selections and their bulk actions. */
.states { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.state { display: inline-flex; align-items: center; gap: 6px; }
.grid.profile-facts { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
/* A customer's profile: its tabs right under its name; on the tabs other than the summary, its facts in one line. */
.profile-tabs { margin-top: 14px; }
.facts-strip { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.facts-strip .hint { margin-inline-end: 4px; }
@media (max-width: 640px) {
  .grid.profile-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.profile-facts .card.fact { padding: 12px; }
  .fact .value { font-size: 15px; }
}
.fact .label { color: var(--muted); font-size: 13px; }
.fact .value { font-size: 17px; font-weight: 600; margin: 2px 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); margin-bottom: 16px; }
.grid.two > .card + .card { margin-top: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { border-inline-start: 3px solid var(--brand); padding: 4px 12px; }
.timeline li.change { border-inline-start-color: var(--line); }
.timeline-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.timeline-body { margin-top: 4px; white-space: pre-line; }
.lead-origin { display: grid; gap: 4px; justify-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lead-origin:last-child { border-bottom: none; }
.lead-panel { border-color: var(--brand); }
.hint.due { color: var(--warn); font-weight: 600; }
.pick { width: 1%; white-space: nowrap; }
.pick input { width: 18px; height: 18px; }
th.pick { font-size: 0; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.inline-field select, .inline-field input[type="date"] { width: auto; }
.bulk-bar { display: grid; gap: 10px; margin-bottom: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-2); }
.bulk-select, .bulk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bulk-count { font-size: 13px; color: var(--muted); }
.bulk-count.on { color: var(--brand); font-weight: 600; }
.bulk-result ul { margin: 6px 0; padding-inline-start: 18px; }
@media (max-width: 640px) {
  .table-wrap td.pick { display: block; width: auto; }
  .table-wrap td.pick::before { content: none !important; }
}
.list-tools .inline-field { white-space: nowrap; flex: 0 0 auto; }
/* A list's search and filters: on a phone, the search the whole width, the filters one sliding row, exporting after them. */
.list-search { max-width: 260px; }
.filter-chips { margin-bottom: 12px; }
@media (max-width: 640px) {
  .list-head-tools { width: 100%; }
  .list-search { max-width: none; flex: 1 1 100%; }
  .list-head-tools .secondary-action { order: 2; }
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .filter-chips .btn { flex: none; }
  .bulk-bar { padding: 8px; gap: 8px; }
}
@media (max-width: 640px) {
  /* With a tick box first, the row's name is still the card's title. */
  .table-wrap td.pick + td { display: block !important; font-size: 15px; }
  .table-wrap td.pick + td::before { content: none !important; }
}

/* Phase 3: plans and their impact, policies, invoices and payments. */
.impact, .policy-effects { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.impact ul, .policy-effects ol { margin: 8px 0 0; padding-inline-start: 20px; display: grid; gap: 4px; }
.bad-text { color: var(--danger); font-weight: 600; }
.warn-text { color: var(--warn); }
.sub-row td { background: var(--surface-2); font-size: 13px; }
.add-person { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.add-person h3, .invoice-form h3 { font-size: 15px; margin: 0; }
.invoice-form { border: 1px solid var(--brand); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.profile-facts strong { display: block; }
@media (max-width: 640px) {
  /* A payment under its invoice, and a form under a row: one block, without the columns' labels. */
  .table-wrap tr.sub-row td, .table-wrap td[colspan] { display: block !important; }
  .table-wrap tr.sub-row td::before, .table-wrap td[colspan]::before { content: none !important; }
}

/* Phase 3, closing: several buttons in a table cell; a label only screen readers read. */
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Phase 4: the website's editor (form beside its preview), its images, and the message centre. */
fieldset.bare { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 12px; }
fieldset.field-group legend { padding: 0 6px; font-weight: 600; }
.tabs.compact { border: 0; margin: 0; }
.tabs.compact a { padding: 6px 10px; }
.slug-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.slug-input span { padding: 0 10px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.slug-input input { border: 0; border-radius: 0; flex: 1; min-width: 0; }
.site-editor { display: grid; gap: 18px; align-items: start; }
.site-editor.with-preview { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.editor-form { min-width: 0; }
.editor-bar { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); flex-wrap: wrap; }
.publish-note { flex: 1 1 180px; min-width: 0; }
.block-card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.block-card.hidden-block { opacity: .72; border-style: dashed; }
.block-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 12px; }
.block-toggle { all: unset; cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; flex: 1 1 200px; min-width: 0; }
.block-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.block-body { border-top: 1px solid var(--line); padding: 12px; }
/* Moving a section or an item up or down: a target the size of a finger on a touch screen. */
@media (pointer: coarse), (max-width: 640px) {
  .btn.move { min-width: 44px; min-height: 44px; justify-content: center; font-size: 16px; }
}
.items-field { display: grid; gap: 8px; }
.items-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.item-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: var(--surface-2); }
.item-fields { flex: 1; display: grid; gap: 8px; min-width: 0; }
.item-tools { display: flex; flex-direction: column; gap: 6px; }
.media-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.media-pick img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.media-pick select { flex: 1 1 180px; min-width: 0; }
.upload-box { display: grid; gap: 8px; margin-top: 8px; padding: 10px; border: 1px dashed var(--line); border-radius: 9px; }
.preview-pane { position: sticky; top: 12px; display: grid; gap: 10px; min-width: 0; }
.preview-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.preview-frame { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.preview-frame.phone { max-width: 392px; margin-inline: auto; border-radius: 26px; border-width: 6px; border-color: var(--side); }
.preview-frame iframe { display: block; border: 0; background: #fff; }
.media-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.media-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: grid; }
.media-card > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.media-card > .stack { padding: 10px; }
.mail-preview { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface-2); display: grid; gap: 8px; }
.mail-body { background: var(--surface); border-radius: 8px; padding: 12px 14px; line-height: 1.9; }
.mail-invoice { background: var(--surface); border-radius: 8px; padding: 12px 14px; display: grid; gap: 4px; }
.mail-line { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 4px 0; }
@media (max-width: 1100px) {
  .site-editor.with-preview { grid-template-columns: minmax(0, 1fr); }
  .preview-pane { position: static; }
}
@media (max-width: 640px) {
  .item-row { flex-direction: column; }
  .item-tools { flex-direction: row; }
  /* On a phone, saving and publishing stay at the foot of the screen while the sections are edited:
     compact, and back in their place while a field is being typed in, not over it or the keyboard. */
  .editor-bar { padding: 8px 10px; gap: 6px; border-radius: 12px 12px 0 0; margin-inline: -4px; }
  .editor-bar .btn { min-height: 40px; }
  .editor-bar .publish-note { order: 5; flex-basis: 100%; padding-block: 6px; }
  .editor-bar .dirty, .editor-bar .hint { flex-basis: 100%; margin: 0; }
  .editor-form:has(fieldset :focus) .editor-bar { position: static; }
  html:has(.editor-bar) { scroll-padding-bottom: 140px; }
  .save-bar.sticky { padding: 8px 10px; border-radius: 12px 12px 0 0; margin-inline: -4px; }
  .save-bar.sticky .dirty { flex-basis: 100%; margin: 0; }
  form:has(:focus) > .save-bar.sticky { position: static; }
}

/* Phase 5: a screen's profile (diagnosis, connection by the hour, screenshots), the audit's filters, a bulk action waiting for confirmation. */
.diag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.diag { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; border: 1px solid var(--line); border-inline-start: 4px solid var(--muted); border-radius: 9px; padding: 10px 12px; }
.diag p { margin: 4px 0 0; color: var(--muted); }
.diag.bad { border-inline-start-color: var(--danger); background: var(--danger-soft); }
.diag.warn { border-inline-start-color: var(--warn); background: var(--warn-soft); }
.diag.ok { border-inline-start-color: var(--ok); background: var(--ok-soft); }
.card.fact { margin: 0; }
.uptime { display: grid; gap: 4px; overflow-x: auto; }
.uptime-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 44px; gap: 8px; align-items: center; font-size: 13px; }
.uptime-hours { display: grid; grid-template-columns: repeat(24, minmax(6px, 1fr)); gap: 2px; direction: ltr; }
.uptime-hours i { display: block; height: 16px; border-radius: 2px; background: var(--danger-soft); }
.uptime-hours i.on { background: var(--ok); }
.uptime-hours i.later { background: var(--surface-2); }
.uptime-share { text-align: end; color: var(--muted); }
.uptime-axis .uptime-hours { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 400; }
.shot-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.shot { margin: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; display: block; }
.shot figcaption { padding: 8px 10px; font-size: 13px; }
pre.raw { white-space: pre-wrap; word-break: break-all; font-size: 12px; background: var(--surface-2); border-radius: 8px; padding: 10px; max-height: 360px; overflow: auto; }
details.card > summary { cursor: pointer; }
.audit-filters > .field { flex: 1 1 150px; }
.bulk-confirm { margin-top: 8px; }
.status-legend { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.settings-links { display: flex; flex-wrap: wrap; gap: 8px; }
.terms-preview { margin: 0; padding: 12px 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.terms-preview dt { color: var(--muted); font-size: 13px; }
.terms-preview dd { margin: 2px 0 0; }
@media (max-width: 640px) {
  .uptime-row { grid-template-columns: 74px minmax(0, 1fr) 36px; font-size: 12px; }
  .diag { flex-direction: column; }
}

/* The paid templates: their pictures, and a neutral stand-in until one is drawn. */
.template-placeholder { display: grid; place-items: center; border-radius: 6px; background: repeating-linear-gradient(135deg, var(--surface-2) 0 10px, var(--surface) 10px 20px); border: 1px dashed var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.template-card { display: grid; gap: 8px; align-content: start; }
.template-card img, .template-card .template-placeholder { width: 100%; aspect-ratio: 16 / 9; height: auto; border-radius: 8px; object-fit: cover; }
.template-shot { display: grid; justify-items: center; gap: 8px; width: 100%; }
.template-shot img, .template-shot .template-placeholder { width: 100%; border-radius: 10px; box-shadow: 0 0 0 6px #1b1b1b, 0 8px 30px rgb(0 0 0 / .25); }
.template-shot.land img, .template-shot.land .template-placeholder { aspect-ratio: 16 / 9; }
.template-shot.port img, .template-shot.port .template-placeholder { aspect-ratio: 9 / 16; max-width: 320px; }
