/* Desk on the Go, company app: the brand colours everywhere (charcoal and amber), and the screens for
   creating a company, joining one and waiting to be accepted. Loaded after app.css and staff.css. */

:root {
  --accent: #2C2C2A; --on-accent: #FFFFFF; --accent-ink: #2C2C2A; --accent-2: #EF9F27; --brand-amber: #EF9F27;
  --bg: #F5F4F0; --surface: #FFFFFF; --surface-2: #F1EFE8; --ink: #2C2C2A; --muted: #5F5E5A;
  --border: #E3E1D9; --border-strong: #CBC8BE;
  --amber-ink: #8F5A0B; --amber-soft: #FBEBD2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #EF9F27; --on-accent: #2C2C2A; --accent-ink: #F5B95C;
    --bg: #181816; --surface: #22221F; --surface-2: #2A2A27; --ink: #F1EFE8; --muted: #B4B2A9;
    --border: #3A3935; --border-strong: #4D4B46; --amber-ink: #F5B95C; --amber-soft: #3A2D17;
  }
}
:root[data-theme="dark"] {
  --accent: #EF9F27; --on-accent: #2C2C2A; --accent-ink: #F5B95C;
  --bg: #181816; --surface: #22221F; --surface-2: #2A2A27; --ink: #F1EFE8; --muted: #B4B2A9;
  --border: #3A3935; --border-strong: #4D4B46; --amber-ink: #F5B95C; --amber-soft: #3A2D17;
}

/* ---------- before you are in: welcome, create, join, waiting ---------- */
.ob { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; background: var(--bg); }
.ob-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 20px 14px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.ob-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: inherit; text-decoration: none; }
.ob-top .link-btn { font-size: 14px; }
.ob-main { display: grid; justify-items: center; align-content: start; padding: 28px 20px 64px; }
.ob-card { width: 100%; max-width: 440px; display: grid; gap: 18px; }
.ob-card h1 { font-size: 26px; letter-spacing: -0.01em; }
.ob-card .lead { color: var(--muted); font-size: 16px; }
.ob-card form { display: grid; gap: 14px; }
.ob-actions { display: grid; gap: 10px; }
.ob-card .btn { min-height: 48px; font-size: 16px; }
.ob-card .btn.sm { min-height: 38px; font-size: 14px; }
.ob-foot { font-size: 14px; color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-ink); font: 500 14px var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.ob-help { font-size: 13px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--border); margin-top: 6px; }

/* app.css styles text, email and phone boxes but not password ones; without this a password box is plain
   while hidden and only looks right (and full width) once "Show" turns it into a text box. */
input[type="password"] {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: 400 16px/1.4 var(--font);
}
.pw-row { display: flex; gap: 8px; align-items: stretch; }
.pw-row input[type="password"], .pw-row input[type="text"] { flex: 1 1 0; min-width: 0; width: 0; }
.pw-row .btn { min-height: 46px; flex: none; min-width: 68px; }
.confirm input[type="password"], .confirm input[type="text"] { min-height: 40px; }
.ob-card .chips.wrap, .chips.wrap { flex-wrap: wrap; overflow: visible; }
.ob-card .btn.danger { background: transparent; }

/* progress through the steps */
.ob-steps { display: grid; gap: 8px; }
.ob-steps .label { color: var(--amber-ink); }
.ob-bar { height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.ob-bar span { display: block; height: 100%; background: var(--brand-amber); border-radius: 999px; }

/* big choices (number of users) */
.choice-list { display: grid; gap: 10px; }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 12px 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-weight: 500; font-size: 16px;
}
.choice span small { font-weight: 400; font-size: 13px; color: var(--muted); }
.choice input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--amber-soft); }
.choice input:focus-visible + span { box-shadow: var(--focus); }

/* the company a code belongs to */
.company-card { display: grid; gap: 4px; padding: 18px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.company-card .label { color: var(--amber-ink); }
.company-card strong { font-size: 22px; line-height: 1.2; }

/* the join code */
.code-input { font: 600 24px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; text-align: center; min-height: 60px; }
.code-box { display: grid; gap: 6px; justify-items: center; padding: 20px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.code-box .code { font: 600 34px/1.1 var(--font); letter-spacing: .12em; font-variant-numeric: tabular-nums; user-select: all; }
.code-box .label { color: var(--amber-ink); }
.share-row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.share-row > :first-child { grid-column: 1 / -1; }
.share-row .btn { min-width: 0; padding-inline: 10px; }

/* a short list being built (departments during set-up) */
.mini-list { display: grid; gap: 8px; }
.mini-list .mini { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-weight: 500; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; width: auto; }
.add-row .btn { min-height: 44px; }

.wait-facts { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.wait-facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border-top: 1px solid var(--border); }
.wait-facts div:first-child { border-top: 0; }
.wait-facts span:first-child { color: var(--muted); }
.wait-facts span:last-child { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-amber); margin-right: 8px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- inside the app ---------- */
/* how many of the plan's users are in use */
.plan { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.plan-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.plan-top strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.plan .ob-bar span { background: var(--accent); }
.plan.full { border-color: color-mix(in oklab, var(--alert) 50%, var(--border)); background: var(--alert-bg); }
.plan.full .ob-bar span { background: var(--alert); }

/* Manage has five tabs. On a phone they are made narrow enough to all be seen at once; on a very narrow
   phone the last one drops to a second line rather than hiding off the edge. */
@media (max-width: 520px) {
  #page > .tabs { gap: 0; flex-wrap: wrap; }
  #page > .tabs .tab { flex: 1 1 auto; padding-inline: 4px; font-size: 13px; gap: 4px; }
  #page > .tabs .tab .count { padding: 0 5px; }
}
.confirm input { min-height: 40px; }

/* back office (us): one line per company, numbers only */
.bo-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bo-totals div { display: grid; gap: 2px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.bo-totals strong { font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.bo-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--border); }
.bo-row:first-child { border-top: 0; }
.bo-row .who { display: grid; min-width: 0; }
.bo-row .who span { font-size: 13px; color: var(--muted); }
.bo-row .num { font-variant-numeric: tabular-nums; text-align: right; font-weight: 500; white-space: nowrap; }
.bo-row select { width: auto; min-height: 36px; padding: 4px 8px; font-size: 14px; }
/* a company's feature switches: a full-width line under its numbers */
.bo-features { grid-column: 1 / -1; display: grid; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--border); }
.bo-feature { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 6px 0; cursor: pointer; }
.bo-feature input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--ink, #2C2C2A); }
.bo-feature small { display: block; font-size: 13px; color: var(--muted); }
.ob-card.wide { max-width: 640px; }

/* a join request */
.req { display: grid; gap: 12px; padding: 14px; border-top: 1px solid var(--border); }
.req:first-child { border-top: 0; }
.req-top { display: flex; gap: 12px; align-items: center; }
.req-top .who { display: grid; min-width: 0; }
.req-top .who span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.req-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.req-acts select { width: auto; min-height: 38px; padding: 6px 10px; font-size: 14px; flex: 1 1 100%; }

.install-card { grid-template-columns: minmax(0, 1fr); }
.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-row .av { width: 72px; height: 72px; font-size: 24px; }

/* a photo opened large */
.photo-big { display: grid; justify-items: center; gap: 12px; padding: 20px 0 8px; }
.photo-big img { width: min(280px, 80vw); height: min(280px, 80vw); border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
img.av[data-av-of] { cursor: zoom-in; }

/* getting started, on Home for a new company */
.setup { max-width: 760px; margin: 12px auto 0; padding: 0 16px; }
.setup-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.setup-card h2 { font-size: 16px; }
.setup-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.setup-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.setup-list .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; }
.setup-list li.done .tick { background: var(--done); border-color: var(--done); color: #fff; }
.setup-list li.done .tick .icon { width: 14px; height: 14px; }
.setup-list li.done span.txt { color: var(--muted); }
.setup-list li .btn { margin-left: auto; }
@media (min-width: 960px) { .setup { padding: 0 24px; } }

/* ---------- the free trial, plans and paying ---------- */
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 10px; }
.stepper .btn { min-height: 52px; padding: 0; font-size: 26px; line-height: 1; }
.stepper output { text-align: center; font-size: 17px; }
.stepper output strong { font-size: 28px; font-variant-numeric: tabular-nums; }
.trial-note { margin: 14px 0 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm, 10px); background: var(--surface-2); font-size: 14px; }
.plan-choice span { display: grid; gap: 2px; }
.billing-card { grid-template-columns: 1fr auto; align-items: center; }
.billing-card > div { display: grid; gap: 2px; min-width: 0; }
#pay-form [data-pay-go] { font-variant-numeric: tabular-nums; }
.check-row { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--ink, #2C2C2A); }
.check-row span { display: grid; gap: 2px; }
.check-row small { font-size: 13px; color: var(--muted); }
.plan-acts { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 10px; }
.bo-extra { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; border-top: 1px dashed var(--border); }

/* ---------- Uploads: photos, documents and short videos ---------- */
.files { display: grid; gap: 10px; }
.files [data-files], .files [data-stage-list] { display: grid; gap: 8px; }
.file-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.file-tile { position: relative; aspect-ratio: 1; }
.file-tile .file-open { width: 100%; height: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm, 10px); overflow: hidden; background: var(--surface-2); display: block; cursor: pointer; }
.file-tile img, .file-tile .skel { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0; }
.file-video { display: grid; place-content: center; justify-items: center; gap: 4px; width: 100%; height: 100%; background: #2C2C2A; color: #F1EFE8; font-size: 12px; }
.file-video .icon { width: 28px; height: 28px; fill: currentColor; }
.file-row { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 6px 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm, 10px); background: var(--surface); }
.file-row .file-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
button.file-open { cursor: pointer; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row.failed { border-color: var(--danger, #B42318); }
.file-row.failed .file-open { color: var(--danger, #B42318); }
.file-x { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.file-tile .file-x { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; background: rgb(24 24 22 / .72); color: #fff; }
.file-x .icon { width: 18px; height: 18px; }
.file-error, [data-stage-msg]:not(:empty) { color: var(--danger, #B42318); }
.stage-choice { display: flex; gap: 8px; margin-top: 8px; }
.files-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.files-btn .icon { width: 16px; height: 16px; }
.files [data-file-add], .files [data-stage-add] { justify-self: start; }
dialog.files-dialog { z-index: 1; }
/* a photo or a video, large */
dialog.file-viewer { border: 0; padding: 0; margin: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; background: #181816; color: #F1EFE8; }
dialog.file-viewer[open] { display: grid; grid-template-rows: auto 1fr auto; }
dialog.file-viewer::backdrop { background: #181816; }
dialog.file-viewer .icon-btn { justify-self: end; margin: 10px; color: #F1EFE8; }
.file-stage { min-height: 0; display: grid; place-items: center; padding: 0 8px; }
.file-stage img, .file-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
dialog.file-viewer p { margin: 0; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); text-align: center; color: #B4B2A9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The test copy says so on every screen: a small tab hanging from the very top edge, clear of the header's text. */
html[data-env="test"]::before {
  content: "TEST COPY"; position: fixed; z-index: 9999; top: 0; left: 50%; transform: translateX(-50%);
  padding: 0 9px; border-radius: 0 0 7px 7px; background: #EF9F27; color: #2C2C2A; border: 1px solid #8F5A0B; border-top: 0;
  font: 600 9px/13px Poppins, Arial, sans-serif; letter-spacing: .1em; pointer-events: none;
}
