/*
 * Working screens (auth, account, billing, privacy, legal, staff): the shared frame every owner and staff screen
 * uses, the plain words for the state of an order or payment, tables that stack on a phone, and the staff desk.
 * Registered by the auth module (Module(stylesheets=...)), so it loads on every page. Tokens from brand.css only.
 */

/* ---------- One calm column: the frame for every working screen ----------
   A clear title, a short lead, then white cards. Phone first; on a desk it is the same column, centred. */
.work { max-width: 44rem; margin-left: auto; margin-right: auto; }
.work > h1 { margin-bottom: var(--s-3); }
.work > .lead { margin-bottom: var(--s-5); }
.work > .card + .card, .work > .card + section, .work > section + .card { margin-top: var(--s-4); }
.work > section + section { margin-top: var(--s-6); }
.work .card-title { font-size: var(--step-1); }
.work > .back { margin-bottom: var(--s-1); }
.work > .specimen { margin-bottom: var(--s-3); }
.work > .claimed { margin-bottom: var(--s-3); }
.work .table-wrap { margin-bottom: var(--s-4); }
.work .go-links { max-width: none; }
.work table, .work td, .work tbody th { font-size: 1rem; }
.work-cards { display: grid; gap: var(--s-4); margin-bottom: var(--s-6); }
.work-cards > .card { margin: 0; }
.outreach-stop { margin-top: 0; }

/* Account sub-navigation */
.account-tabs { border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.account-tabs ul, .state-filter { list-style: none; margin: 0; padding: 0; }
.account-tabs a, .state-filter a {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 0.75rem;
  color: var(--ink); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent;
}
.account-tabs a:hover, .state-filter a:hover { color: var(--brand); }
.account-tabs a[aria-current="page"], .state-filter a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--action); }
.account-tabs .cluster { gap: 0; }
.state-filter { margin-bottom: 1rem; }

/* Filter and search forms on admin pages */
.filter-form { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: flex-end; margin-bottom: 1rem; }
.filter-form .field { flex: 1 1 12rem; max-width: 22rem; margin-bottom: 1rem; }
.filter-form .button { margin-bottom: 1rem; }

/* Long identifiers, emails and JSON details wrap instead of overflowing tables and panels */
code.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-list dt { overflow-wrap: anywhere; }
/* A count bar in ink: green is a record's answer, never a chart colour. */
meter { width: 100%; min-width: 6rem; height: 0.75rem; -webkit-appearance: none; appearance: none; background: var(--paper-2); border-radius: 2px; }
meter::-webkit-meter-bar { background: var(--paper-2); border: 0; border-radius: 2px; height: 0.75rem; }
meter::-webkit-meter-optimum-value, meter::-webkit-meter-suboptimum-value { background: var(--ink-2); border-radius: 2px; }
meter::-moz-meter-bar { background: var(--ink-2); }

/* ---------- The state of a thing in progress (an order, a payment, a member, a job) ----------
   A plain word with a small shape, in ink or blue. Green, amber and red belong to a record's status, so a state
   never borrows them. Waiting for you is blue; done is ink with a tick; stopped is grey with a dashed ring; a thing
   staff must deal with now is white on ink. */
.state { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 1rem; line-height: 1.3; color: var(--ink); }
.state::before { content: ""; flex: none; width: 0.65rem; height: 0.65rem; border-radius: 50%; border: 2px solid currentColor; }
.state--done::before { background: currentColor; }
.state--todo { color: var(--brand); }
.state--todo::before { border: 0; border-radius: 0; width: 0.6rem; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.state--neutral { color: var(--ink-2); }
.state--off { color: var(--ink-3); font-weight: 600; }
.state--off::before { border-style: dashed; }
.state--alert { color: #fff; background: var(--ink); padding: 0.15rem 0.6rem; border-radius: 999px; }
.state--alert::before { border: 0; border-radius: 0; background: currentColor; clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
/* The kit's badge tones for a state, in the same words and shapes (never the status colours). */
.badge-done { color: var(--ink); background: var(--paper-2); }
.badge-todo { color: var(--brand); background: var(--brand-soft); border-color: var(--brand); }
.badge-todo::before { border-radius: 0; width: 0.5rem; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.badge-off { color: var(--ink-3); border-style: dashed; }
.badge-off::before { background: transparent; border: 1.5px dashed currentColor; }
.badge-alert { color: #fff; background: var(--ink); border-color: var(--ink); }
.badge-alert::before { border-radius: 0; clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
.badge { font-size: 1rem; }

/* ---------- Tables that scan on a phone: each row becomes a small card, each cell says what it is ----------
   Give the table class "table-stack" and each cell a data-label. On a wider screen it is an ordinary table. */
@media (max-width: 43.99rem) {
  .table-wrap:has(> .table-stack) { overflow: visible; border: 0; background: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-stack caption { display: block; padding-left: 0; }
  .table-stack tr { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s-3) var(--s-4); }
  .table-stack tr + tr { margin-top: var(--s-3); }
  .table-stack td { border: 0; padding: 0.3rem 0; text-align: left; }
  .table-stack td[data-label] { position: relative; padding-left: calc(min(35%, 9rem) + var(--s-3)); min-height: 1.9rem; }
  .table-stack td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 0.3rem; width: min(35%, 9rem);
    font-weight: 600; color: var(--ink-2); font-size: 0.95rem; line-height: 1.5; }
  .table-stack td.numeric { text-align: left; font-family: var(--font-sans); }
  .table-stack tbody tr:hover td { background: none; }
}

/* ---------- Staff desks: dense, never cluttered. A light frame, like everything else ---------- */
.admin-nav { background: var(--paper); border: 1px solid var(--rule); color: var(--ink); }
.admin-nav .admin-nav-title { font-family: var(--font-sans); font-size: 1rem; letter-spacing: 0; color: var(--ink-2); }
.admin-nav a { color: var(--ink); font-weight: 600; font-size: 1rem; }
.admin-nav a:hover { background: var(--paper-2); color: var(--ink); }
.admin-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }
.admin-nav :focus-visible { outline-color: var(--action); }
/* On a phone the staff menu is one strip that scrolls sideways inside itself, so the desk starts on the first screen. */
@media (max-width: 55.99rem) {
  .admin-shell { gap: var(--s-4); padding-top: var(--s-4); }
  .admin-nav { padding: var(--s-1); }
  .admin-nav .admin-nav-title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .admin-nav ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; }
  .admin-nav li { flex: none; }
  .admin-content { padding: var(--s-4); }
  .admin-content .detail-list > div { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
}
.admin-content th { font-size: 0.95rem; color: var(--ink-2); }
.admin-content td { line-height: 1.4; }
.admin-content { overflow-wrap: break-word; }
.admin-content td .src { display: inline-block; margin-top: 0.15rem; }
.admin-content .table-wrap { margin-bottom: var(--s-5); }
.admin-content .lead { color: var(--ink-2); }
.admin-content .nowrap, .admin-content td.when { white-space: nowrap; }
.admin-content td.details { min-width: 18rem; }
/* Headline figures on every staff page: ruled rows (what it is, what it means, the number on the right), never a
   grid of tiles. "All fine" carries no mark; due soon keeps the diamond and trouble the octagon, both in ink. */
.admin-content .stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s-6); margin: 0 0 var(--s-6); }
@media (min-width: 64rem) { .admin-content .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.admin-content .stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem var(--s-4); align-content: start;
  background: none; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; padding: var(--s-3) 0 var(--s-3) 1.7rem; }
.admin-content .stat-title { grid-column: 1; font-size: 1rem; color: var(--ink); }
.admin-content .stat-value { grid-column: 2; grid-row: 1 / span 3; align-self: center; text-align: right; font-size: 1.75rem; line-height: 1; letter-spacing: 0; }
.admin-content .stat-detail { grid-column: 1; font-size: 0.95rem; line-height: 1.4; }
.admin-content .stat-link { grid-column: 1; margin-top: 0 !important; }
.admin-content .stat-link a { display: inline-flex; align-items: center; min-height: 44px; }
.admin-content .stat::after { top: calc(var(--s-3) + 0.4rem); left: 0.2rem; right: auto; }
.admin-content .stat-good::after { content: none; }
.admin-content .stat-warn::after { background: var(--brand); }
.admin-content .stat-bad::after { background: var(--ink); }

/* Legal documents */
.prose { max-width: 46rem; }
.prose h2 { margin-top: 2rem; }
.prose li + li { margin-top: 0.4rem; }

/* The simulator says what it is beside the heading, in reading type. */
.sim-tag { font-weight: 400; font-size: 1rem; color: var(--ink-2); white-space: nowrap; }
.sim-price { margin: 0; font-weight: 700; font-size: var(--step-2); font-variant-numeric: tabular-nums; }
.sim-price small { font-size: 1rem; font-weight: 400; color: var(--ink-2); }
.sim-actions { display: grid; gap: var(--s-3); }
.work td.when { white-space: nowrap; }

/* ---------- Look v3 on a desk (.work--side): a task page keeps its reading column and puts its one form (claim, adding
   carriers) or the order's progress beside it (sticky), instead of the phone column centred. Phones are unchanged. ---------- */
@media (min-width: 66rem) {
  .work--side { max-width: 1240px; display: grid;
    grid-template-columns: minmax(0, 1fr) 28rem; column-gap: 3.5rem; align-items: start; }
  .work--side > * { grid-column: 1; min-width: 0; margin-top: 0; }
  .work--side > * + * { margin-top: var(--s-4); }
  .work--side > :is(.card-form, [aria-labelledby="progress-title"], .watch-add-after) {
    grid-column: 2; grid-row: 1 / span 40; position: sticky; top: 6.5rem; margin-top: 0; }
}
