:root {
  --ground: #F3F2EE;
  --surface: #FFFFFF;
  --surface2: #FAFAF8;
  --ink: #16181B;
  --ink2: #3D4247;
  --muted: #5B6168;
  --line: #E2E0DA;
  --line2: #EFEDE8;
  --edge: #D3D0C8;
  --dash: #A9A59C;
  --accent: #FFC21A;
  --red: #A3261B; --red-bg: #FDE8E6; --red-bar: #B42318;
  --amber: #8A4B00; --amber-bg: #FEF0E1; --amber-bar: #C26A00;
  --green: #1F6B3E; --green-bg: #E3F3EA; --green-bar: #2F855A;
  --focus: #2563EB;
  --sans: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cond: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.35; -webkit-tap-highlight-color: transparent; }
a { color: var(--ink); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.screen { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: 0 0 calc(120px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 16px; }
.screen.form { padding-bottom: calc(32px + var(--safe-bottom)); gap: 20px; }
.pad { padding: 0 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack6 { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.span2 { grid-column: 1 / span 2; }

/* Top of screen */
.topbar { padding: calc(10px + env(safe-area-inset-top, 0px)) 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 54px; }
.topbar.center { display: grid; grid-template-columns: 1fr auto 1fr; }
.topbar.center > :first-child { justify-self: start; }
.topbar.center > :last-child { justify-self: end; }
.back, .navlink { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px; font-size: 17px; font-weight: 600; background: none; border: 0; }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink2); }
.mark { width: 14px; height: 14px; border-radius: 3px; background: var(--accent); border: 1.5px solid var(--ink); }
.title { font-family: var(--cond); font-weight: 700; font-size: 40px; line-height: 1.05; }
.title.md { font-size: 36px; }
.formtitle { font-family: var(--cond); font-weight: 700; font-size: 22px; }
.sub { font-size: 17px; color: var(--ink2); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.strong { font-weight: 700; }
.label { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.lbl { font-size: 15px; font-weight: 700; }

/* Cards and lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.card.pad16 { padding: 16px; }
.card.clip { overflow: hidden; }
a.card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; transition: border-color 0.15s; }
a.card:hover, a.card:active { border-color: var(--dash); }
.list > * + * { border-top: 1px solid var(--line2); }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px; }
.li.tight { padding: 4px 4px 4px 16px; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 16px; min-height: 48px; }
.big { font-size: 34px; font-weight: 700; line-height: 1.1; }
.unitword { font-size: 18px; font-weight: 600; color: var(--muted); }

/* Status */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.overdue { background: var(--red-bg); color: var(--red); }
.badge.soon { background: var(--amber-bg); color: var(--amber); }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.unknown { background: var(--line2); color: var(--ink2); }
.badge.pending { background: var(--amber-bg); color: var(--amber); }
.track { height: 8px; border-radius: 4px; background: #ECEAE4; overflow: hidden; }
.fill { height: 100%; border-radius: 4px; }
.fill.overdue { background: var(--red-bar); }
.fill.soon { background: var(--amber-bar); }
.fill.ok { background: var(--green-bar); }
.fill.unknown { background: var(--dash); }
.banner { margin: 0 16px; padding: 14px 12px 14px 16px; border-radius: 14px; display: flex; align-items: center; gap: 12px; }
.banner.overdue { background: var(--red-bg); color: var(--red); }
.banner.soon { background: var(--amber-bg); color: var(--amber); }
.note { border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 15px; font-weight: 600; line-height: 1.4; }
.note.ok { background: var(--green-bg); color: var(--green); }
.note.warn { background: var(--red-bg); color: var(--red); }
.note.info { background: var(--amber-bg); color: var(--amber); }
.pill { align-self: flex-start; min-height: 44px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.pill.wait { background: var(--amber-bg); color: var(--amber); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.good { color: var(--muted); font-weight: 600; padding-left: 0; }

/* Parts */
.pn { display: inline-flex; align-items: center; gap: 6px; background: var(--ground); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 13px; color: var(--ink2); }
.pn b { color: var(--ink); }
.mono { font-family: var(--mono); font-weight: 600; letter-spacing: 0.02em; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Controls */
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--edge); background: var(--surface); font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.chip .n { font-size: 13px; color: var(--muted); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.chip.on .n { color: #D9D9D9; }
.chip .flag { width: 8px; height: 8px; border-radius: 50%; background: var(--red-bar); }
.chip.on .flag { background: #FF8A80; }
.seg { display: grid; gap: 2px; padding: 2px; background: #E6E4DE; border-radius: 12px; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--ink2); font-size: 15px; font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14); }
.seg.big button { min-height: 58px; font-size: 19px; font-weight: 700; }
.seg button.on.pass { background: var(--green); color: #FFFFFF; }
.seg button.on.fail { background: var(--red); color: #FFFFFF; }
.in { width: 100%; height: 52px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--edge); background: var(--surface); font-size: 17px; }
.in::placeholder { color: #6B7178; }
.in.mono { font-family: var(--mono); font-weight: 600; text-transform: uppercase; }
.in.mono::placeholder { font-family: var(--sans); font-weight: 400; text-transform: none; }
.in.sm { width: 84px; height: 48px; padding: 0 10px; flex: none; font-weight: 700; }
.in.huge { height: 76px; font-size: 40px; font-weight: 700; border: 2px solid var(--ink); padding-right: 64px; }
.in.amt { width: 120px; height: 56px; font-size: 28px; font-weight: 700; flex: none; border: 2px solid var(--ink); }
textarea.in { height: 112px; padding: 12px 14px; resize: vertical; line-height: 1.4; }
select.in { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink2) 50%), linear-gradient(135deg, var(--ink2) 50%, transparent 50%); background-position: calc(100% - 20px) 23px, calc(100% - 14px) 23px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.suffix { position: relative; }
.suffix .in { padding-right: 44px; }
.suffix > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--muted); pointer-events: none; }
.suffix.huge > span { font-size: 22px; font-weight: 600; }
.btn { min-height: 56px; padding: 0 22px; border-radius: 14px; border: 2px solid var(--ink); background: var(--accent); color: var(--ink); font-size: 18px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 4px 0 var(--ink); }
.btn.block { width: 100%; height: 60px; font-size: 19px; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn2 { min-height: 48px; padding: 0 16px; border-radius: 12px; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn2:hover { background: var(--ground); }
.btn2:disabled { opacity: 0.55; }
.btn2.danger { border-color: var(--red); color: var(--red); }
.ghost { min-height: 52px; border-radius: 12px; border: 1.5px dashed var(--dash); background: transparent; color: var(--ink2); font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.icon { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--ink2); }
.icon:hover { background: var(--ground); }
.linkbtn { min-height: 44px; padding: 0 4px; border: 0; background: none; font-size: 15px; font-weight: 700; text-decoration: underline; }
.quick { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px dashed var(--dash); background: transparent; color: var(--ink2); font-size: 15px; font-weight: 600; }
.more { min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.more svg { transition: transform 0.15s; }
.more[aria-expanded='true'] svg { transform: rotate(180deg); }
.tabs { margin: 0 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: #E6E4DE; border-radius: 12px; }
.tabs button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--ink2); font-size: 16px; font-weight: 600; }
.tabs button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14); }

/* Info rows */
.irow { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px; border-top: 1px solid var(--line2); }
.irow.copy { padding-right: 4px; }
.irow .k { flex: 1; min-width: 0; font-size: 15px; color: var(--muted); }
.irow .v { font-size: 16px; font-weight: 600; text-align: right; }
.irow .v.mono { font-size: 15px; overflow-wrap: anywhere; }

/* Floating actions */
.actions { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 16px calc(24px + var(--safe-bottom)); pointer-events: none; z-index: 5; }
.actions > div { max-width: 528px; margin: 0 auto; display: flex; justify-content: flex-end; gap: 10px; }
.actions a, .actions button { pointer-events: auto; }
.fab { height: 56px; padding: 0 22px 0 16px; border-radius: 999px; border: 2px solid var(--ink); background: var(--accent); color: var(--ink); display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; box-shadow: 0 4px 0 var(--ink); }
.fab.alt { background: var(--surface); padding: 0 18px 0 14px; }

/* Sign in */
.who { min-height: 60px; padding: 0 18px; border-radius: 14px; border: 1.5px solid var(--edge); background: var(--surface); font-size: 19px; font-weight: 700; text-align: left; display: flex; align-items: center; justify-content: space-between; }
.dots { display: flex; gap: 16px; justify-content: center; padding: 8px 0; }
.dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); }
.dots span.on { background: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.keypad button { min-height: 64px; border-radius: 14px; border: 1.5px solid var(--edge); background: var(--surface); font-size: 26px; font-weight: 700; }
.keypad button:active { background: #E6E4DE; }
.keypad .blank { visibility: hidden; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; background: var(--ink); color: #FFFFFF; padding: 12px 18px; border-radius: 12px; font-size: 15px; font-weight: 600; z-index: 20; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
.update { margin: 8px 16px 0; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--ink); color: #FFFFFF; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; font-weight: 600; }
.update button { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--accent); color: var(--ink); font-weight: 700; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.err { color: var(--red); font-size: 15px; font-weight: 600; }

/* Office view (wide screens) */
.office { min-height: 100vh; padding-bottom: 40px; }
.owrap { max-width: 1360px; margin: 0 auto; padding: 0 24px; }
.obar { background: var(--surface); border-bottom: 1px solid var(--line); }
.obar-in { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
.otabs { display: flex; gap: 4px; flex: 1 1 auto; flex-wrap: wrap; }
.otabs a { min-height: 44px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--ink2); }
.otabs a:hover { background: var(--ground); }
.otabs a.on { background: var(--ink); color: #FFFFFF; }
.obar .pill { min-height: 40px; }
.ouser { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.ostack { display: flex; flex-direction: column; gap: 20px; padding-top: 24px; }
.tiles { display: flex; gap: 12px; flex-wrap: wrap; }
.tile { flex: 1 1 220px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; color: var(--ink2); }
.tv { font-size: 34px; font-weight: 700; line-height: 1.1; color: var(--ink); }
.osplit { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.otable { flex: 999 1 640px; min-width: 0; }
.otools { padding: 14px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
table.grid { width: 100%; min-width: 820px; border-collapse: collapse; }
table.grid th { text-align: left; border-bottom: 1px solid var(--line); padding: 0; white-space: nowrap; }
table.grid .th, table.grid .sort { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
table.grid .sort { border: 0; background: transparent; }
table.grid .sort:hover, table.grid .sort.on { color: var(--ink); }
table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--line2); font-size: 15px; vertical-align: middle; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover td { background: var(--surface2); }
table.grid tbody tr.sel td { background: #FFF6D6; }
.rowbtn { font-family: var(--cond); font-size: 20px; font-weight: 700; color: var(--ink); background: transparent; border: 0; padding: 0; min-height: 40px; display: inline-flex; align-items: center; white-space: nowrap; }
.rowbtn:hover { text-decoration: underline; }
.nowrap { white-space: nowrap; }
.opanel { flex: 1 1 360px; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.up { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); font-size: 15px; }
.udue { font-weight: 700; white-space: nowrap; }
.udue.overdue { color: var(--red); }
.udue.soon { color: var(--amber); }
.udue.ok, .udue.unknown { color: var(--ink2); }
.owork { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line2); border-radius: 12px; }
.owork:hover { border-color: var(--dash); }
@media (min-width: 1000px) {
  /* Phone screens opened from the office view get a little more room. */
  .screen { max-width: 640px; }
}
@media (min-width: 1000px) {
  .actions > div { max-width: 608px; }
}
