/* Both portals (D-139). Control Center's sign-in pages wear its white (D-178), the Business portal wears Dunes (D-135).
   Phones first: 16 px gutter, 16 px inputs (no zoom on focus), safe areas, nothing wider than the screen. No color-mix()
   (iOS 15 is tier B). Headings Gloock (D-128), UI Bricolage Grotesque. */
@font-face { font-family: "Gloock"; src: url("/static/fonts/gloock.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("/static/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

.theme-paper {
  --bg: #f2eeeb; --ink: #17110f; --mute: #6d6663; --line: #e6e0dc; --card: #fff; --accent: #c9183a; --accent-ink: #fff; --danger: #b3142f;
  --soft: #6d6663; --glass: #fff; --glass-hi: #fff; --on-accent: #fff; --button: #c9183a; --on-button: #fff; --ok: #17794a;
  color-scheme: light; background: #fff;
}
.theme-paper .sky { display: none; }
.theme-dunes {
  --bg: #6e2a48; --ink: #fff6f4; --soft: rgb(255 246 244 / .74); --line: rgb(255 255 255 / .18);
  --glass: rgb(255 255 255 / .14); --glass-hi: rgb(255 255 255 / .2); --accent: #ffc2cf; --on-accent: #5a1236;
  --button: #fff; --on-button: #5a1236; --danger: #ffd0d8; --ok: #d8ffe6;
  background: #6e2a48;
}
.theme-dunes .sky {
  background:
    radial-gradient(62% 22% at 50% 100%, rgb(255 160 120 / .6), rgb(255 80 130 / 0) 100%),
    linear-gradient(180deg, #938ba9 0%, #8a6f8e 18%, #a3324a 40%, #c8203e 55%, #7a1636 72%, #3a0b20 100%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--ink);
  font: 400 15px/1.5 "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  overflow-x: hidden;
}
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
h1, h2, h3 { font-family: "Gloock", Georgia, serif; font-weight: 400; line-height: 1.12; margin: 0 0 .4em; letter-spacing: -.005em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0 0 .9em; }
a { color: inherit; }
.muted { color: var(--soft); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); margin-bottom: .6em; }

/* ---------- header and tabs ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 8px; max-width: 880px; margin: 0 auto; }
.brand { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; text-decoration: none; min-width: 0; }
.brand img { display: block; height: 24px; width: auto; }
.brand span { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 6px; padding: 6px 16px 10px; max-width: 880px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--soft); background: var(--glass); font-size: 14px; }
.tabs a[aria-current="page"] { background: var(--button); color: var(--on-button); font-weight: 600; }

/* ---------- layout ---------- */
.wrap { max-width: 880px; margin: 0 auto; padding: 8px 16px 40px; }
.door { max-width: 440px; margin: 0 auto; padding: 28px 16px 40px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.door .brand { justify-content: center; flex-direction: column; align-items: center; gap: 6px; }
.door .brand img { height: 34px; }
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.card { background: var(--glass); border-radius: 22px; padding: 20px 18px; box-shadow: inset 0 1px 0 var(--glass-hi), inset 0 0 0 1px var(--line); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card { -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15); }
}
.card + .card, .grid + .card, .card + .grid { margin-top: 14px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 6px 0 2px; }
.stat { background: var(--glass); border-radius: 16px; padding: 12px; min-width: 0; }
.stat b { display: block; font: 400 24px/1.1 "Gloock", Georgia, serif; overflow-wrap: anywhere; }
.stat span { font-size: 12px; color: var(--soft); }
.foot { margin-top: 28px; text-align: center; font-size: 12px; color: var(--soft); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.list li:first-child { border-top: 0; }
.list li { flex-wrap: wrap; row-gap: 8px; }
.list .who { min-width: 0; flex: 1 1 190px; }
.list .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .who span:not(.pill) { display: block; font-size: 13px; color: var(--soft); overflow-wrap: anywhere; }
.list .acts { display: flex; gap: 6px; flex: none; }
.pill { display: inline-block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--glass-hi); color: var(--ink); vertical-align: 2px; }
.pill.warn { background: rgb(255 60 90 / .28); }
.empty { color: var(--soft); padding: 8px 0 0; }

/* ---------- forms and buttons ---------- */
form { display: grid; gap: 12px; margin-top: 8px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--soft); }
input, select {
  font: inherit; font-size: 16px; color: var(--ink); width: 100%; min-height: 48px; padding: 12px 14px;
  border-radius: 14px; border: 0; background: rgb(0 0 0 / .22); box-shadow: inset 0 0 0 1px var(--line); outline: none;
  -webkit-appearance: none; appearance: none;
}
.theme-dunes input, .theme-dunes select { background: rgb(40 0 20 / .28); }
.theme-paper input, .theme-paper select { background: #fff; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%), linear-gradient(135deg, var(--soft) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
select option { color: #111; }
input:focus-visible, select:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
input[readonly] { font-size: 14px; }
button, .go, .ghost {
  font: inherit; font-weight: 600; border: 0; cursor: pointer; border-radius: 999px; min-height: 48px; padding: 12px 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.go { background: var(--button); color: var(--on-button); width: 100%; font-size: 16px; }
.ghost { background: var(--glass-hi); color: var(--ink); }
[data-sign-out] { white-space: nowrap; flex: none; }
.card > .small:last-child { margin-top: 14px; }
.small.ghost, button.small { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.danger { color: var(--danger); }
button:disabled { opacity: .55; cursor: default; }
button.busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.busy::after { animation-duration: 2s; } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.error { color: var(--danger); font-size: 14px; margin: 10px 0 0; }
.note { font-size: 14px; padding: 12px 14px; border-radius: 14px; background: rgb(255 60 90 / .18); margin: 12px 0 0; }

/* The one-time link box. */
.linkbox { margin-top: 12px; padding: 14px; border-radius: 16px; background: rgb(0 0 0 / .24); box-shadow: inset 0 0 0 1px var(--accent); display: grid; gap: 10px; }
.linkbox[hidden] { display: none; }
.linkbox p { margin: 0; font-size: 13px; color: var(--soft); }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); max-width: calc(100vw - 32px);
  background: var(--button); color: var(--on-button); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgb(0 0 0 / .35); z-index: 9; }
[hidden] { display: none !important; }
.bare .card h1 { font-size: 32px; }

/* Control Center Money (worker P): the Ledger / Rates switch, the preview's checkboxes, and grid fields that never squeeze. */
.money-nav { margin: 0 0 12px; gap: 6px; }
.money-nav > * { flex: 0 0 auto; }
.money-nav a[aria-current="page"] { background: var(--button); color: var(--on-button); }
label.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); min-height: 44px; }
label.check input { width: 22px; height: 22px; min-height: 0; padding: 0; flex: none; border-radius: 6px; accent-color: var(--accent); -webkit-appearance: checkbox; appearance: auto; box-shadow: none; }
.grid.two > label { min-width: 0; }
details.act > summary { cursor: pointer; padding: 10px 0; list-style-position: inside; }

/* ---------- Services and Costs (worker O) ---------- */
.tone { display: inline-block; min-width: 54px; text-align: center; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; }
.tone-green { background: rgb(155 230 180 / .2); color: var(--ok); }
.tone-amber { background: rgb(255 196 92 / .22); color: #ffd27a; }
.tone-red { background: rgb(255 60 90 / .32); color: #fff; }
.theme-dunes .tone-amber { color: #fff0c2; }
.list .who .incident { display: block; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: rgb(0 0 0 / .22); box-shadow: inset 2px 0 0 var(--accent); color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.list .who .incident button { margin-top: 8px; }
.list .who b .tone { white-space: nowrap; }
.list .who:has(.incident) b { white-space: normal; }
textarea { font: inherit; font-size: 16px; color: var(--ink); width: 100%; min-height: 96px; padding: 12px 14px; border-radius: 14px; border: 0; resize: vertical;
  background: rgb(0 0 0 / .22); box-shadow: inset 0 0 0 1px var(--line); outline: none; -webkit-appearance: none; appearance: none; }
textarea:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.theme-dunes textarea { background: rgb(40 0 20 / .28); }
@media (min-width: 720px) { form.filters { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; } }
[data-services] .stats .stat b { transition: color .3s; }
.list .who span.tone { display: inline-block; }
.list .who .meta { font-size: 12px; opacity: .8; margin-top: 2px; }
.list .who .meta span { display: inline; font-size: inherit; }
.money-stats { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.money-stats .stat b { font-size: 20px; white-space: nowrap; overflow-wrap: normal; }
/* Approvals (worker U): her pictures once opened, small and upright, never recoloured. */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 12px 0 0; }
.thumbs figure { margin: 0; display: grid; gap: 4px; }
.thumbs img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: rgb(0 0 0 / .24); display: block; }
.thumbs figcaption { font-size: 12px; color: var(--soft); }
.list.replies li { padding-left: 12px; box-shadow: inset 2px 0 0 var(--accent); }
.list.wrap .who b { white-space: normal; overflow: visible; }
.stats.costs .stat b { font-size: 20px; white-space: nowrap; }

/* Worker U: a row's buttons wrap instead of pushing past a 360 px screen. */
.list .acts { flex-wrap: wrap; max-width: 100%; }

/* Worker S: Control Center Songs. The player and the change forms take the row's full width. */
.list.songs .who b { white-space: normal; }
.list.songs .who b .pill { margin-left: 4px; }
.list.songs audio { display: block; width: 100%; max-width: 100%; height: 40px; margin-top: 8px; }
.list.songs details.act { flex: 1 1 100%; min-width: 0; }
