/* Cloud dashboard. Same look as the place server's dashboard (place/public/style.css):
   flat, light, one accent colour, no gradients. */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e2e5ea;
  --line-strong: #cbd1d9;
  --text: #17202e;
  --muted: #5f6b7c;
  --accent: #1d4ed8;
  --accent-soft: #eaf0fe;
  --good: #15803d;
  --good-soft: #e6f4ea;
  --warn: #b45309;
  --warn-soft: #fdf1dc;
  --present: #0e7490;
  --present-soft: #e0f3f7;
  --offline: #7b8594;
  --offline-soft: #eef0f3;
  --danger: #b91c1c;
  --danger-soft: #fdecec;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- Shared controls ---- */

button, input, select {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}
input::placeholder { color: #8a94a3; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { cursor: pointer; font-weight: 500; }
button:hover { background: #f3f4f6; }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1a43bd; }
button.danger { color: var(--danger); border-color: #e6b8b8; }
button.danger:hover { background: var(--danger-soft); }
button.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; }
button.link:hover { text-decoration: underline; background: none; }
button.link.danger { color: var(--danger); }
a { color: var(--accent); }

h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.ok { color: var(--good); }
.mono, td.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.row.end { margin-bottom: 0; }
.grow { flex: 1; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
}
.panel > :last-child { margin-bottom: 0; }

.notice, .warning { border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid; }
.notice { background: var(--accent-soft); border-color: #c5d4fb; }
.warning { background: var(--warn-soft); border-color: #efd29b; color: #7a3d05; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--offline-soft); color: var(--muted); white-space: nowrap; }
.badge.role { background: var(--accent-soft); color: var(--accent); }
.badge.active, .badge.pending, .badge.waiting { background: var(--warn-soft); color: var(--warn); }
.badge.idle, .badge.inside, .badge.online, .badge.done { background: var(--good-soft); color: var(--good); }
.badge.present, .badge.locked { background: var(--present-soft); color: var(--present); }
.badge.outside, .badge.failed { background: var(--danger-soft); color: var(--danger); }
.badge.count { background: var(--danger); color: #fff; margin-left: 6px; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--offline); margin-right: 6px; }
.dot.online { background: var(--good); }

/* Active means the phone is in use (attention), idle means it is not (fine),
   present means it is put away but still on the office Wi-Fi. */
.avatar, .marker.person {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--offline);
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.avatar.active, .marker.person.active { background: var(--warn); }
.avatar.idle, .marker.person.idle { background: var(--good); }
.avatar.present, .marker.person.present { background: var(--present); }
.avatar.photo, .marker.person:has(img) { padding: 0; overflow: hidden; background: var(--panel); }
.avatar.photo { box-shadow: 0 0 0 2px var(--offline); }
.avatar.photo.active { box-shadow: 0 0 0 2px var(--warn); }
.avatar.photo.idle { box-shadow: 0 0 0 2px var(--good); }
.avatar.photo.present { box-shadow: 0 0 0 2px var(--present); }
.avatar img, .marker.person img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.who-cell { display: flex; align-items: center; gap: 10px; }
.photo-preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); flex: none; }

/* ---- Header ---- */

header {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 4px 16px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; margin: 0; white-space: nowrap; }
.logo { width: 20px; height: 20px; border-radius: 5px; background: var(--accent); flex: none; }
/* The row of tabs scrolls sideways when it does not fit; an arrow at the edge says there are more. */
.nav-wrap { position: relative; flex: 1; min-width: 0; }
header nav { position: relative; display: flex; gap: 2px; overflow-x: auto; min-width: 0; align-items: stretch; scrollbar-width: none; }
header nav::-webkit-scrollbar { display: none; }
.nav-wrap::before, .nav-wrap::after {
  position: absolute; top: 0; bottom: 1px; width: 26px; z-index: 1; pointer-events: none;
  display: none; align-items: center; justify-content: center;
  background: var(--panel); color: var(--muted); font-size: 18px; font-weight: 700;
}
.nav-wrap::before { content: "\2039"; left: 0; border-right: 1px solid var(--line); }
.nav-wrap::after { content: "\203A"; right: 0; border-left: 1px solid var(--line); }
.nav-wrap.more-left::before, .nav-wrap.more-right::after { display: flex; }
header nav button {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; padding: 17px 12px 15px; color: var(--muted); white-space: nowrap;
}
header nav button:hover { color: var(--text); background: none; }
header nav button.on { color: var(--accent); border-bottom-color: var(--accent); }
header nav .divider { flex: none; width: 1px; background: var(--line); margin: 12px 8px; }
header select { max-width: 200px; padding: 6px 8px; }
.who { color: var(--muted); white-space: nowrap; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--offline); margin-right: 6px; }
.live-dot.on { background: var(--good); }

/* On a laptop the tabs get a row of their own, so none of them is squeezed out by the rest of the header. */
@media (max-width: 1500px) {
  header { flex-wrap: wrap; padding-top: 6px; }
  header .brand { flex: 1; }
  .nav-wrap { order: 5; flex-basis: 100%; }
  header nav button { padding: 11px 12px 10px; }
  header nav .divider { margin: 8px; }
}

main { padding: 24px; max-width: 1440px; margin: 0 auto; }

.page-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 16px; }
.page-title h1 { font-size: 20px; margin: 0; }

.place-offline {
  display: flex; align-items: center; gap: 10px;
  background: var(--danger-soft); color: var(--danger); border: 1px solid #f1c4c4;
  border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; font-weight: 600;
}
.place-offline .dot { background: var(--danger); margin: 0; flex: none; }
.stale .person-row, .stale .stat .value { opacity: 0.6; }

.columns { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .columns { grid-template-columns: minmax(0, 1fr); } }

/* Tiles share the row, but a row of two does not stretch them across the screen. */
.stats { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.stat { flex: 1 1 170px; max-width: 320px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1.15; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat.active .value { color: var(--warn); }
.stat.idle .value, .stat.inside .value { color: var(--good); }
.stat.present .value { color: var(--present); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.table-wrap th, .table-wrap td { white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; }
tr.pick { cursor: pointer; }
tr.pick:hover td { background: #f3f4f6; }
tr.pick.on td { background: var(--accent-soft); }

.item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; padding-bottom: 0; }
.item .title { font-weight: 600; }
.item.row { justify-content: space-between; margin: 0; }

.login { max-width: 380px; margin: 14vh auto 0; padding: 28px; }
.login .brand { font-size: 20px; margin-bottom: 4px; }
.login input { width: 100%; margin-bottom: 10px; }
.login button { width: 100%; }

.tools { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.tools button { border: 0; border-right: 1px solid var(--line-strong); border-radius: 0; }
.tools button:last-child { border-right: 0; }
.tools button.on { background: var(--accent); color: #fff; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---- Overview and empty states ---- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; cursor: pointer; text-align: left; font-weight: 400; }
.card:hover { border-color: var(--accent); background: var(--panel); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-name { font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.card-sub { color: var(--muted); font-size: 12.5px; min-height: 19px; overflow-wrap: anywhere; }
.card-figures { display: flex; gap: 24px; margin-top: 14px; }
.card-figures .value { font-size: 24px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.card-figures .value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.card-figures .value.alert { color: var(--danger); }
.card-figures .label { color: var(--muted); font-size: 12.5px; }

.empty { text-align: center; padding: 40px 20px; }
.empty h2 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 480px; margin: 0 auto 16px; }

/* ---- Forms ---- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 12px; }
.form-grid input, .form-grid select { width: 100%; min-width: 0; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; }
.checks label { display: flex; align-items: center; gap: 6px; }
.checks input { padding: 0; width: 16px; height: 16px; min-height: 0; }
.edit-box { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin: 4px 0 8px; white-space: normal; }

.key-box { border: 1px solid #c5d4fb; background: var(--accent-soft); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.key-box h2 { margin-bottom: 4px; }
.key-value { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 14px; }
.key-value code { flex: 1 1 260px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; padding: 9px 12px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; user-select: all; }
.steps { margin: 0 0 12px; padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.steps code, p code { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }

/* ---- Floor plans ---- */

.map { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.map img { max-width: 100%; max-height: 70vh; display: block; border: 1px solid var(--line); border-radius: 6px; }
.map.placing { cursor: crosshair; }
.marker { position: absolute; transform: translate(-50%, -50%); line-height: 1.2; white-space: nowrap; }
.marker.ap { width: 14px; height: 14px; border: 2px solid var(--accent); border-radius: 3px; background: #fff; }
.marker .tag {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 600; color: var(--text); background: rgba(255, 255, 255, 0.92);
  padding: 1px 5px; border-radius: 3px; border: 1px solid var(--line);
}
.marker.person { border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); cursor: pointer; z-index: 2; }
.marker.person.outside { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.marker.person:has(img) { width: 36px; height: 36px; border-width: 3px; border-color: var(--offline); }
.marker.person.active:has(img) { border-color: var(--warn); }
.marker.person.idle:has(img) { border-color: var(--good); }
.marker.person.present:has(img) { border-color: var(--present); }
.marker.person.outside:has(img) { border-color: var(--danger); }

.person-row { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 6px; cursor: pointer; }
.person-row:hover { background: #f3f4f6; }
.person-row.on { background: var(--accent-soft); }
.person-row .name { font-weight: 600; }
.person-row .sub { font-size: 12.5px; color: var(--muted); }
.people-list { max-height: 420px; overflow-y: auto; margin: 0 -10px; }
.clock { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

.editor { outline: none; }
.editor-bar { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin-bottom: 16px; }
.editor-bar label { white-space: nowrap; }
.editor-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .editor-body { grid-template-columns: minmax(0, 1fr); } }
.editor-stage { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; text-align: center; overflow-x: auto; }
.editor-canvas { border: 1px solid var(--line-strong); touch-action: none; user-select: none; display: block; margin: 0 auto; max-width: 100%; height: auto; }
.editor-side { position: sticky; top: 72px; margin: 0; }
.editor-side .field { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.editor-side .help { padding-left: 18px; margin: 0 0 12px; color: var(--muted); }
.editor-side .help li { margin-bottom: 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; padding: 0; border-radius: 6px; }
.swatches button.on { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Street map (OpenStreetMap) ---- */

.osm { height: 68vh; min-height: 360px; border: 1px solid var(--line); border-radius: 6px; z-index: 0; }
.osm.small { height: 56vh; margin-top: 12px; }
.osm .marker.person { cursor: pointer; }
.leaflet-container { font: inherit; }
.corner { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: move; }

/* ---- Performance and the day in detail ---- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; text-align: center; }
.tile-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-label { color: var(--muted); font-size: 13px; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--offline-soft); min-width: 120px; }
.bar span { display: block; height: 100%; }
.bar .phone { background: var(--warn); }
.bar .away { background: var(--good); }
.bar .other { background: var(--accent); }
.timeline { position: relative; height: 28px; border-radius: 6px; background: var(--offline-soft); overflow: hidden; margin: 6px 0 4px; }
.timeline span { position: absolute; top: 0; bottom: 0; min-width: 2px; }
.timeline .active { background: var(--warn); }
.timeline .idle { background: var(--good); }
.timeline .locked { background: var(--present); }
.timeline .outside { background: var(--danger); }
.timeline-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.periods { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 8px; }
.periods th { position: sticky; top: 0; background: var(--panel); }

/* ---- On a phone ---- */

@media (max-width: 860px) {
  header { padding: 8px 12px 0; }
  .nav-wrap { margin: 0 -12px; }
  header nav { padding: 0 4px; }
  header nav button { padding: 12px 12px 10px; }
  header nav .divider { margin: 8px 6px; }
  header .switchers { order: 4; flex-basis: 100%; }
  header .switchers select { flex: 1; max-width: none; min-width: 0; }
  header .who.name { display: none; }
  header nav .phone-only { display: block; }
}
.switchers { display: flex; gap: 8px; align-items: center; }
.phone-only { display: none; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  main { padding: 12px; }
  .panel { padding: 14px; }
  .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; max-width: none; }
  .stat .value { font-size: 22px; }
  .row > input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), .row > select { flex: 1 1 140px; min-width: 0; }
  .osm { height: 60vh; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .login { margin: 6vh 12px 0; }
  .editor-side { position: static; }
  .tools { flex-wrap: wrap; }
  .tools button { flex: 1 1 auto; }
  input[type="checkbox"], input[type="radio"] { min-height: 0; }
  button, input, select { min-height: 40px; }
  .checks input { min-height: 0; }
  .card-figures { gap: 18px; }
  .people-list { max-height: none; }

}

.phone-line { display: flex; align-items: center; gap: 6px; }

/* ---- Tables on a phone: one card per row ---- */

/* A wide table would show only its first column on a phone. Each row becomes a
   block instead: the name, then every figure as a label and its value. */
@media (max-width: 600px) {
  table.stack, table.stack tr, table.stack td { display: block; }
  table.stack tr:has(th) { display: none; }
  table.stack tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; padding-bottom: 0; }
  table.stack tr.pick { padding: 10px 8px; border-radius: 6px; }
  table.stack td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 3px 0; border: 0; white-space: normal; text-align: right; overflow-wrap: anywhere;
  }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); text-align: left; flex: none; }
  table.stack td:first-child { text-align: left; padding-bottom: 6px; }
  table.stack td button { white-space: nowrap; overflow-wrap: normal; flex: none; }
  table.stack td.split { padding-top: 6px; }
  table.stack td.split:empty { display: none; }
  table.stack td.split .bar { flex: 1; }
  table.stack td.actions { justify-content: flex-end; }
  table.stack .phone-line { justify-content: flex-end; }
  tr.pick.on td, tr.pick:hover td { background: none; }
  table.stack tr.pick.on { background: var(--accent-soft); }
}

/* ---- Reading width, notes and states ---- */

/* Sentences stay a comfortable length on a wide screen. */
.panel > p, .lead, .off-note, .notice, .warning, .ok-box, .key-box > div, .steps { max-width: 84ch; }
.lead { color: var(--muted); margin-bottom: 16px; }

/* Said once where a feature that is turned off would have been. */
.off-note { color: var(--muted); border-left: 3px solid var(--line-strong); padding: 2px 0 2px 10px; margin: 0 0 12px; }

.ok-box { border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid #b7dfc3; background: var(--good-soft); color: #0f5c2c; }
.warning.call { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; max-width: none; }
.warning.call > div { flex: 1 1 280px; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 8px 0; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* Rows and cards that are clicked show where the keyboard is too. */
.card:focus-visible, .person-row:focus-visible, tr.pick:focus-visible, a:focus-visible, .choice:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
tr.pick:focus-visible { outline-offset: -2px; }

.field { display: block; min-width: 0; }
.field input, .field select { width: 100%; min-width: 0; }
.form-grid.narrow { grid-template-columns: repeat(auto-fit, minmax(200px, 320px)); }
.login .field { margin-bottom: 10px; }
.login .field input { margin-bottom: 0; }

/* ---- Settings ---- */

.setting-list { border-top: 1px solid var(--line); }
.setting { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.setting-list > .setting:last-child { border-bottom: 0; padding-bottom: 0; }
.setting.number { cursor: default; padding-left: 58px; background: none; }
.setting-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.setting-name { font-weight: 600; }
.setting-about { color: var(--muted); max-width: 78ch; }
.setting-warning { background: var(--warn-soft); border: 1px solid #efd29b; color: #7a3d05; border-radius: 6px; padding: 6px 10px; margin-top: 4px; max-width: 78ch; }
.setting.off .setting-name { color: var(--muted); }
.when-off { color: #7a8494; }
.number-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0; }
.number-row input { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
input[aria-invalid="true"] { border-color: var(--danger); }
input:disabled, select:disabled { background: var(--bg); color: var(--muted); }

/* An on/off switch: a checkbox drawn as a track with a knob. */
input.switch {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 44px; height: 24px; min-height: 0; padding: 0; margin: 1px 0 0;
  border: 0; border-radius: 12px; background: #9aa3b0; position: relative; cursor: pointer;
}
input.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left 0.12s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::before { left: 23px; }
input.switch:disabled { opacity: 0.5; cursor: default; }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { input.switch::before { transition: none; } }

/* Stays in view at the bottom so Save is never a scroll away. */
.save-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px 8px 0 0; border-bottom: 0;
  padding: 12px 18px; margin-top: 16px;
}
.save-bar.dirty { border-color: var(--accent); box-shadow: 0 -2px 8px rgba(23, 32, 46, 0.08); }
.save-state { flex: 1 1 240px; min-width: 0; }

/* ---- Kinds of place and the workplace code ---- */

.choices { border: 0; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; min-width: 0; }
.choices legend { padding: 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px 14px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { flex: none; width: 16px; height: 16px; min-height: 0; padding: 0; margin: 3px 0 0; accent-color: var(--accent); }
.choice-title { display: block; font-weight: 600; }
.choice-text { display: block; color: var(--muted); font-size: 13px; }

.place-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 26px; font-weight: 700; letter-spacing: 0.14em;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 14px; user-select: all;
}
.place-code.small { font-size: 14px; padding: 2px 8px; letter-spacing: 0.1em; }
.qr { margin: 0; text-align: center; font-size: 12px; color: var(--muted); max-width: 170px; }
.qr svg { display: block; width: 160px; height: 160px; border-radius: 6px; background: #fff; }
.qr figcaption { margin-top: 4px; }
.code-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 14px; }
.code-line { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-top: 6px; }
.code-line button:not(.link) { padding: 2px 10px; min-height: 0; }
.steps strong { font-weight: 600; }
.steps button { margin-left: 4px; }

@media (max-width: 760px) {
  .setting.number { padding-left: 0; }
  .save-bar { margin: 16px -12px 0; border-radius: 0; border-left: 0; border-right: 0; padding: 10px 12px; }
  .save-bar button { flex: 1 1 0; }
  .save-state { flex-basis: 100%; }
  .place-code { font-size: 22px; }
  .item.row > div:first-child, .item .row > .grow { flex: 1 1 100%; }
  .page-title h1 { flex-basis: 100%; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 8px; }

  /* Everything that is tapped is at least 40px tall, and wide enough for a thumb. */
  button.link { min-width: 40px; padding: 2px 8px; }
  .code-line button:not(.link) { padding: 8px 12px; min-height: 40px; }
  .checks label { min-height: 40px; }
  td.actions a, .item a { display: inline-flex; align-items: center; min-height: 40px; }
  .leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }
}

/* ---- Self-service: sign-up switch and the getting-started checklist ---- */

label.switch { display: flex; gap: 8px; align-items: center; font-weight: 500; }
label.switch input { width: auto; margin: 0; }
.checklist ol { padding-left: 0; list-style: none; margin: 0; }
.checklist li { padding: 6px 0; }
.checklist li.done { color: var(--good); }
.checklist .tick { display: inline-block; width: 1.4em; font-weight: 700; }
