/* DOT Cowork portal: shared design tokens and shell styles (ported from the "DOT Cowork — Portals" artifact). */
:root {
  color-scheme: light;
  --accent:   #F15232;
  --accent-h: #D9421F;
  --ink:      #201e1d;
  --ground:   #f7f6f4;
  --surface:  #ffffff;
  --soft:     #efeeec;
  --body:     #4a4643;
  --kicker:   #8f8b88;
  --rule:     #e0ddd9;
  --success:  #2a7a4a;
  --warning:  #b7791f;
  --error:    #c0392b;
  --manager:  #2563eb;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 16px;
  background: var(--ground);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 52px; background: var(--surface); border-bottom: 1px solid var(--rule);
  padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
}
.logo { height: 30px; width: auto; display: block; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.role-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border: 1px solid var(--rule); color: var(--kicker);
}
.role-badge.manager { border-color: var(--manager); color: var(--manager); }
.avatar {
  width: 30px; height: 30px; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
}

/* Preview banner (removed once login ships) */
.preview-banner {
  background: var(--ink); color: rgba(255,255,255,.8);
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 8px max(20px, env(safe-area-inset-left, 0px));
}
.preview-banner strong { color: #fff; letter-spacing: .1em; text-transform: uppercase; margin-right: 8px; }

/* Live screens: summary tiles, contract cards, key-value rows */
.live { display: block; }
.hero-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-bottom: 22px; }
.hero-cell { background: var(--surface); padding: 18px 16px 16px; }
.hero-kicker { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--kicker); margin-bottom: 8px; }
.hero-val { font-size: 34px; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-val.accent { color: var(--accent); }
.hero-unit { font-size: 12px; color: var(--kicker); margin-top: 6px; }
.sub-head { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--kicker); margin: 26px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.card { background: var(--surface); border: 1px solid var(--rule); margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.card-title { font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.card-sub { font-size: 12px; color: var(--kicker); margin-top: 2px; }
.info-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 16px; border-bottom: 1px solid var(--rule); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-label { flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--kicker); }
.info-val { font-weight: 600; text-align: right; }
.note { font-size: 12px; color: var(--kicker); margin-top: 18px; }
.badge.ok { background: rgba(42,122,74,.1); color: var(--success); }
.badge.warn { background: rgba(183,121,31,.12); color: var(--warning); }
.badge.muted { background: var(--soft); color: var(--kicker); }
.card .badge, .card-head .badge { margin-top: 0; }
.msg { background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent); padding: 14px 16px; font-size: 13px; line-height: 1.5; }

/* Credits tile, booking forms, time-slot strips */
.hero-row.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .hero-row.three { grid-template-columns: 1fr; } }
.toolbar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--kicker); }
.field input, .field select {
  height: 40px; padding: 0 12px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 14px; outline: none; border-radius: 0; max-width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 18px; border: 1px solid var(--ink);
  background: var(--ink); color: #fff; font-family: inherit; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
}
.btn:hover { background: #333; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { height: 30px; padding: 0 12px; font-size: 10px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn.danger:hover { background: rgba(192,57,43,.08); }
.slots { display: flex; flex-wrap: wrap; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.slot {
  min-width: 52px; padding: 6px 8px; border: 1px solid transparent; font-family: inherit; font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums; text-align: center; background: rgba(42,122,74,.1); color: var(--success); cursor: pointer;
}
.slot:hover { border-color: var(--success); }
.slot.picked { background: var(--ink); color: #fff; }
.slot.mine { background: rgba(241,82,50,.12); color: var(--accent); cursor: default; }
.slot.taken, .slot.past { background: var(--soft); color: var(--kicker); cursor: default; text-decoration: line-through; }
.slot.mine:hover, .slot.taken:hover, .slot.past:hover { border-color: transparent; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--kicker); margin: 0 0 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; }
.cost { padding: 0 16px 6px; font-size: 13px; color: var(--body); }
.cost strong { color: var(--ink); }
.cost.bad { color: var(--error); }
.cost.flush { padding: 0; }
.legend .sw-free { background: rgba(42,122,74,.35); }
.legend .sw-mine { background: rgba(241,82,50,.35); }
.legend .sw-taken { background: var(--rule); }
.actions { display: flex; gap: 10px; padding: 12px 16px 16px; flex-wrap: wrap; }
.flash { padding: 12px 14px; margin-bottom: 14px; font-size: 13px; border-left: 3px solid var(--success); background: rgba(42,122,74,.08); }
.flash.error { border-left-color: var(--error); background: rgba(192,57,43,.08); color: var(--error); }

/* Tickets, notices, feedback, tables */
.field textarea {
  padding: 10px 12px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 14px; outline: none; border-radius: 0; resize: vertical; max-width: 100%;
}
.field textarea:focus { border-color: var(--accent); }
.pre { white-space: pre-wrap; word-wrap: break-word; }
.msg.team { border-left-color: var(--success); }
.msg strong { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--kicker); margin-bottom: 4px; }
.card.clickable, tr.clickable { cursor: pointer; }
.card.clickable:hover, tr.clickable:hover td { background: var(--soft); }
.notice-body { padding: 14px 16px; font-size: 13px; line-height: 1.6; color: var(--body); }
.faces { display: flex; gap: 6px; flex-wrap: wrap; }
.face { font-size: 24px; background: none; border: 1px solid transparent; padding: 4px 8px; cursor: pointer; opacity: .45; }
.face:hover { opacity: 1; }
.face.on { opacity: 1; border-color: var(--accent); background: rgba(241,82,50,.08); }
.table-wrap { overflow-x: auto; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--rule); }
table.grid { width: 100%; border-collapse: collapse; min-width: 520px; }
table.grid th { text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--kicker); padding: 10px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.grid td { font-size: 13px; padding: 11px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.grid tr:last-child td { border-bottom: none; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-bottom: 22px; }
@media (max-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }

/* Notice pop-up, nudges, referral programme */
.modal-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(32,30,29,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto; padding: 24px; border-top: 4px solid var(--accent); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-kicker { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.modal-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; margin-bottom: 6px; }
.modal-meta { font-size: 12px; color: var(--kicker); margin-bottom: 16px; }
.modal-body { font-size: 14px; line-height: 1.6; color: var(--body); margin-bottom: 22px; }
.msg.nudge { border-left-color: var(--accent); background: rgba(241,82,50,.06); margin: 16px 0 6px; }
.msg.nudge strong { font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--ink); margin-bottom: 2px; }
.msg.nudge .btn { margin-top: 10px; }
.card.program { padding: 4px 0 0; margin-bottom: 18px; }
.program-title { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); padding: 16px 16px 0; }
.program-tagline { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; padding: 6px 16px 0; }
.program-h { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--kicker); padding: 18px 16px 8px; }
.tiers { padding: 0 16px; display: grid; gap: 8px; }
.tier { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--rule); background: var(--surface); }
.tier-name { font-size: 14px; font-weight: 700; flex: 1; }
.tier-value { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.tier-tag { font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: var(--ink); color: #fff; padding: 3px 6px; }
.tier.best { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps { padding: 0 16px 6px; display: grid; gap: 10px; }
.step { display: flex; gap: 12px; align-items: baseline; font-size: 13px; line-height: 1.5; color: var(--body); }
.step-n { font-size: 20px; font-weight: 800; color: var(--accent); min-width: 14px; }

/* Admin: floor plan, checkboxes, misc */
.fpsvg { display: block; width: 100%; height: auto; }
.fp-card { padding: 14px 16px; overflow-x: auto; }
.fp-title { border: none; margin: 0 0 8px; padding: 0; }
.fp-host { min-width: 560px; }
.fpsvg text { fill: #4a4643; font-family: inherit; }
.fpsvg .cb { fill: #fff; stroke: #c7c7cc; stroke-width: 1.5; transition: fill .2s; }
.fpsvg .cn { font-weight: 700; fill: #4a4643; }
.fpsvg .st { fill: #9a9694; }
.fpsvg .lb { font-weight: 600; }
.fpsvg .cl { font-weight: 600; fill: #201e1d; }
.fpsvg .dt { fill: #8f8b88; }
.fpsvg .cm .cb { fill: #f1f1f3; stroke: #d7d7dc; stroke-width: 1; }
.fpsvg .cm .cn { fill: #8f8b88; font-weight: 600; }
.fpsvg .circ { fill: #f7f7f7; stroke: rgba(0,0,0,.07); }
.fpsvg .cg { cursor: pointer; }
.fpsvg .cg:hover .cb { stroke-width: 2.5; }
.fpsvg .cg.av .cb { fill: rgba(42,122,74,.12); stroke: rgba(42,122,74,.55); }
.fpsvg .cg.av .lb, .fpsvg .cg.av .cn { fill: #2a7a4a; }
.fpsvg .cg.oc .cb { fill: rgba(192,57,43,.12); stroke: rgba(192,57,43,.55); }
.fpsvg .cg.oc .lb, .fpsvg .cg.oc .cn { fill: #c0392b; }
.fpsvg .cg.pt .cb { fill: rgba(183,121,31,.14); stroke: rgba(183,121,31,.55); }
.fpsvg .cg.ex .cb { fill: rgba(183,121,31,.18); stroke: rgba(183,121,31,.7); }
.fpsvg .cg.ex .lb, .fpsvg .cg.ex .cn, .fpsvg .cg.pt .lb { fill: #b7791f; }
.fpsvg .cg.rs .cb { fill: rgba(37,99,235,.10); stroke: rgba(37,99,235,.5); }
.fpsvg .cg.rs .lb, .fpsvg .cg.rs .cn { fill: #2563eb; }
.fpsvg .cg.bk .cb { fill: rgba(241,82,50,.12); stroke: rgba(241,82,50,.6); }
.fpsvg .cg.bk .lb, .fpsvg .cg.bk .cn { fill: #F15232; }
.fpsvg .cg.na { cursor: default; }
.fpsvg .cg.na .cb { fill: #f4f4f5; stroke: #dcdce0; stroke-dasharray: 4 3; }
.gp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 16px; }
.gp-card { text-align: left; padding: 10px 12px; border: 1px solid var(--rule); background: var(--surface); font-family: inherit; cursor: pointer; }
.gp-name { font-size: 13px; font-weight: 800; }
.gp-meta { font-size: 11px; color: var(--kicker); margin: 2px 0 6px; }
.gp-status { font-size: 11px; font-weight: 700; }
.gp-who { font-size: 11px; color: var(--body); margin-top: 4px; min-height: 14px; }
.gp-card.av { border-color: rgba(42,122,74,.4); } .gp-card.av .gp-status { color: var(--success); }
.gp-card.oc { border-color: rgba(192,57,43,.4); } .gp-card.oc .gp-status { color: var(--error); }
.gp-card.ex, .gp-card.pt { border-color: rgba(183,121,31,.5); } .gp-card.ex .gp-status, .gp-card.pt .gp-status { color: var(--warning); }
.gp-card.rs { border-color: rgba(37,99,235,.4); } .gp-card.rs .gp-status { color: #2563eb; }
.gp-card.bk { border-color: rgba(241,82,50,.5); } .gp-card.bk .gp-status { color: var(--accent); }
.legend .sw-av { background: rgba(42,122,74,.35); } .legend .sw-oc { background: rgba(192,57,43,.35); }
.legend .sw-ex { background: rgba(183,121,31,.45); } .legend .sw-rs { background: rgba(37,99,235,.35); } .legend .sw-bk { background: rgba(241,82,50,.4); }
.fp-detail { margin: 14px 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 16px; }
.check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; }
.check.pad { padding: 0 16px 8px; display: flex; }
.btn-row.inline { display: inline-flex; margin: 6px 0 0 8px; }
.msg.internal { border-left-color: var(--warning); background: rgba(183,121,31,.07); }
.msg.warnmsg { border-left-color: var(--warning); }

/* Environment markers (shown only on staging, preview and local; never on production) */
html[data-env] { --env: #f5c400; --env-ink: #201e1d; }
html[data-env="preview"] { --env: #8e44ad; --env-ink: #ffffff; }
html[data-env="local"] { --env: #2c7be5; --env-ink: #ffffff; }
/* The bar is pinned under the stripe so it is always on screen; the page and sticky top bar make room for it. */
.env-bar {
  position: fixed; top: 5px; left: 0; right: 0; z-index: 999; height: 28px; line-height: 28px;
  background: var(--env); color: var(--env-ink); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 12px; font-weight: 800; letter-spacing: .06em; padding: 0 12px;
}
html[data-env] body { padding-top: 33px; }
html[data-env] .topbar { top: 33px; }
html[data-env] .login-screen { min-height: calc(100vh - 33px); }
html[data-env]::before {
  content: ''; position: fixed; top: 0; left: 0; right: 0; height: 5px; background: var(--env); z-index: 1000;
}
.env-tag {
  position: fixed; left: 0; bottom: 0; z-index: 1000; padding: 6px 12px;
  background: var(--env); color: var(--env-ink); font-size: 11px; font-weight: 800; letter-spacing: .14em;
  pointer-events: none;
}
.env-note {
  margin-bottom: 20px; padding: 10px 12px; font-size: 13px; font-weight: 700;
  background: var(--env); color: var(--env-ink);
}

/* Signed-in user in the top bar */
.user-name { font-size: 12px; font-weight: 600; color: var(--body); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-quiet {
  font-family: inherit; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--kicker); background: none; border: 1px solid var(--rule); padding: 6px 10px; cursor: pointer;
}
.btn-quiet:hover { background: var(--soft); color: var(--ink); }
@media (max-width: 520px) { .user-name { display: none; } }

/* Sign-in */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px max(20px, env(safe-area-inset-left, 0px));
}
.login-box { width: 100%; max-width: 380px; }
.login-logo { height: 46px; width: auto; display: block; margin-bottom: 36px; }
.login-heading { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 4px; }
.login-sub, .sent-note { font-size: 13px; color: var(--kicker); line-height: 1.5; margin-bottom: 24px; }
.sent-note strong { color: var(--ink); word-break: break-all; }
.login-label { display: block; margin-bottom: 8px; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--kicker); }
.login-input {
  width: 100%; height: 46px; margin-bottom: 12px; padding: 0 14px;
  border: 1px solid var(--ink); background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 15px; outline: none;
}
.login-input:focus { border-color: var(--accent); }
.code-input { height: 56px; text-align: center; font-size: 26px; font-weight: 800; letter-spacing: .5em; padding-left: .5em; }
.login-btn {
  width: 100%; height: 46px; margin-bottom: 16px; border: none; cursor: pointer;
  background: var(--ink); color: #fff; font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.login-btn:hover { background: #333; }
.login-btn.accent { background: var(--accent); }
.login-btn.accent:hover { background: var(--accent-h); }
.login-btn:disabled { opacity: .55; cursor: default; }
.login-note { font-size: 12px; color: var(--kicker); text-align: center; line-height: 1.6; }
.link { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; }
.link:disabled { color: var(--kicker); cursor: default; }
.login-msg { margin-top: 4px; padding: 10px 12px; font-size: 13px; background: rgba(192,57,43,.08); color: var(--error); border-left: 2px solid var(--error); }
.login-msg.info { background: var(--soft); color: var(--body); border-left-color: var(--accent); }

/* Location switcher (admin) */
.select-wrap { position: relative; min-width: 160px; }
.select-wrap::after {
  content: ''; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--kicker);
  pointer-events: none;
}
.select {
  width: 100%; height: 34px; padding: 0 28px 0 12px; appearance: none;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 12px;
}
.select:disabled { color: var(--kicker); background: var(--soft); }

/* Navigation */
.nav {
  display: flex; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border-bottom: 1px solid var(--rule);
  padding-left: max(20px, env(safe-area-inset-left, 0px));
}
.nav::-webkit-scrollbar { display: none; }
.nav-tab {
  padding: 12px 16px; white-space: nowrap; text-decoration: none;
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--kicker); border-bottom: 2px solid transparent;
}
.nav-tab:hover { color: var(--ink); }
.nav-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.nav-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Content */
.main {
  max-width: 780px; margin: 0 auto; padding-block: 24px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.main.wide { max-width: 1100px; }
.view { display: none; }
.view.active { display: block; }
.sh {
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--kicker);
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--rule);
}
.empty {
  background: var(--surface); border: 1px solid var(--rule); padding: 28px 20px; text-align: center;
}
.empty-title { font-size: 15px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--kicker); line-height: 1.5; }
.badge {
  display: inline-block; margin-top: 12px; padding: 3px 8px;
  font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  background: rgba(241,82,50,.1); color: var(--accent);
}

/* Phones: bottom navigation, a compact top bar, and tables shown as cards */
.bottombar, .sheet { display: none; }
@media (max-width: 720px) {
  .nav { display: none; }
  .bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    background: var(--surface); border-top: 1px solid var(--rule);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }
  .bb-item {
    flex: 1 1 0; min-width: 0; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 6px 2px; background: none; border: 0; border-top: 2px solid transparent; cursor: pointer; text-decoration: none; font-family: inherit;
    font-size: 9.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--kicker);
    -webkit-tap-highlight-color: transparent;
  }
  .bb-item svg { width: 22px; height: 22px; flex: none; }
  .bb-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bb-item.active { color: var(--ink); border-top-color: var(--accent); }
  .bb-item:focus-visible, .sheet-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

  .sheet { display: block; position: fixed; inset: 0; z-index: 300; }
  .sheet[hidden] { display: none; }
  .sheet-bg { position: absolute; inset: 0; background: rgba(32,30,29,.45); }
  .sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: 80vh; overflow-y: auto; background: var(--surface);
    border-top: 3px solid var(--accent); padding: 6px 0 env(safe-area-inset-bottom, 0px);
  }
  .sheet-item {
    display: block; width: 100%; text-align: left; padding: 16px 22px; background: none; border: 0; border-bottom: 1px solid var(--rule);
    font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none; cursor: pointer;
  }
  .sheet-item.active { color: var(--accent); }
  .sheet-panel:focus { outline: none; }
  .sheet-out { color: var(--kicker); border-bottom: 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }

  /* Top bar: logo and role on one row; the admin location picker gets a full-width row of its own */
  .topbar { height: auto; min-height: 52px; flex-wrap: wrap; row-gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .topbar-right { display: contents; }
  .topbar .btn-quiet { display: none; }
  .role-badge { margin-left: auto; }
  .select-wrap { order: 10; flex: 1 1 100%; min-width: 0; }
  .select { height: 42px; }

  /* 16px keeps iPhones from zooming in when a field is tapped */
  input:not(.code-input), select, textarea { font-size: 16px !important; }

  .main { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .env-tag { display: none; }
}
@media (min-width: 721px) { .bottombar, .sheet { display: none !important; } }

@media (max-width: 640px) {
  .table-wrap { overflow: visible; background: none; border: 0; }
  table.grid { min-width: 0; display: block; }
  table.grid thead { display: none; }
  table.grid tbody { display: block; }
  table.grid tr { display: block; background: var(--surface); border: 1px solid var(--rule); margin-bottom: 10px; }
  table.grid tr.clickable { cursor: pointer; }
  table.grid td { display: flex; gap: 14px; align-items: baseline; justify-content: space-between; text-align: right; padding: 10px 14px; word-break: break-word; }
  table.grid tr:last-child td { border-bottom: 1px solid var(--rule); }
  table.grid td:last-child, table.grid tr:last-child td:last-child { border-bottom: 0; }
  table.grid td::before { content: attr(data-label); flex: 0 0 34%; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--kicker); }
  table.grid td[data-label=""]::before { display: none; }
  table.grid td:empty { display: none; }
  table.grid td:first-child { font-weight: 700; background: var(--soft); }
}

/* Clickable dashboard tiles and alerts */
.hero-cell.is-link, .msg.is-link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.hero-cell.is-link:hover, .msg.is-link:hover { background: var(--soft); }
.hero-cell.is-link:focus-visible, .msg.is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Pop-up forms and the company picker */
.modal-form .field { margin-bottom: 12px; }
.modal-form .actions { padding: 6px 0 0; }
.modal-form .check.pad { display: block; margin: 4px 0 8px; font-size: 13px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 12px; }
@media (max-width: 520px) { .modal-grid { grid-template-columns: 1fr; } }
.card.pad-sm { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.pick-list { display: flex; flex-direction: column; border: 1px solid var(--rule); margin-bottom: 8px; }
.pick-list:empty { display: none; }
.pick-item { display: flex; justify-content: space-between; gap: 12px; text-align: left; padding: 11px 12px; background: var(--surface); border: 0; border-bottom: 1px solid var(--rule); font-family: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: var(--soft); }
.pick-name { font-weight: 700; }
.pick-sub { color: var(--kicker); white-space: nowrap; }

/* Electricity and stock */
.bar-cell { min-width: 90px; background: var(--soft); height: 10px; }
.bar-cell > i { display: block; height: 100%; background: var(--accent); }
.up { color: var(--error); font-weight: 600; }
.down { color: var(--success); font-weight: 600; }
.flat { color: var(--kicker); }
.low-qty { color: var(--error); font-weight: 700; }
.qty-input { width: 90px; text-align: right; }
.paste-area { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

table.grid .btn.small { white-space: nowrap; }
.btn-row + .sub-head, .note + .btn-row { margin-top: 12px; }
.btn-row > .sub-head { margin: 0; flex: 1 1 auto; }
.btn-row:has(> .sub-head) { align-items: center; margin-top: 18px; }

/* Daily meter entry */
.meter-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(220px, 2fr) minmax(200px, 2fr); gap: 8px 16px; padding: 12px 16px; border-top: 1px solid var(--rule); align-items: start; }
.meter-title { font-weight: 800; font-size: 15px; }
.meter-last { font-size: 12px; color: var(--kicker); margin-top: 2px; }
.meter-input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font-family: inherit; font-size: 18px; font-weight: 700; }
.meter-input:focus, .meter-note:focus { border-color: var(--accent); outline: none; }
.meter-calc { font-size: 12px; color: var(--body); margin-top: 6px; min-height: 16px; }
.meter-calc.bad, .meter-err { color: var(--error); font-weight: 600; }
.meter-more { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.meter-note { height: 34px; padding: 0 10px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font-family: inherit; font-size: 13px; width: 100%; }
.meter-err { grid-column: 1 / -1; font-size: 12px; }
.meter-err:empty { display: none; }
.meter-heading { margin: 18px 0 8px; }
@media (max-width: 720px) { .meter-row { grid-template-columns: 1fr; } .meter-input { font-size: 16px; } }

table.grid .btn-row { flex-wrap: nowrap; margin: 0; }

/* The day's meter readings on the dashboard, and the shared entry form */
.readings-card { background: var(--surface); border: 1px solid var(--rule); margin-bottom: 22px; }
.readings-card.pending { border-top: 4px solid var(--accent); }
.readings-card.done { border-top: 4px solid var(--success); }
.readings-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px 12px; flex-wrap: wrap; }
.readings-title { font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.readings-sub { font-size: 12px; color: var(--kicker); margin-top: 2px; }
.readings-warn { padding: 10px 16px; background: rgba(183,121,31,.1); color: var(--warning); font-size: 13px; font-weight: 600; border-top: 1px solid var(--rule); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.readings-card .entry-card { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.readings-form:empty { display: none; }
.entry-top { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
.entry-quick { display: flex; gap: 8px; padding-bottom: 2px; }
.meter-toggle { display: block; margin-top: 6px; font-size: 12px; text-align: left; }
.nav-tab.has-dot::after, .sheet-item.has-dot::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
@media (max-width: 720px) {
  .entry-card .actions .btn { width: 100%; height: 50px; font-size: 13px; }
  .entry-top { padding: 12px 14px; }
  .meter-row { padding: 12px 14px; gap: 6px; }
  .meter-input { height: 52px; font-size: 20px; }
  .readings-title { font-size: 15px; }
}

.bb-item { position: relative; }
.bb-item.has-dot::after { content: ''; position: absolute; top: 9px; left: calc(50% + 9px); width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }

.btn.show-more { width: 100%; margin: -8px 0 18px; }

/* Phone cards show only the essentials; the rest is on the record itself. */
@media (max-width: 640px) { table.grid td.sm-hide { display: none; } }
