/* Rapid iPhone Repair time clock. Phone first: one column, big tap targets. */

:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #16202c;
  --muted: #5b6878;
  --line: #d9dfe7;
  --brand: #0b5cab;
  --brand-ink: #ffffff;
  --brand-soft: #e6f0fb;
  --good: #14804a;
  --good-soft: #e3f5eb;
  --warn: #9a5b00;
  --warn-soft: #fff3d6;
  --bad: #b3261e;
  --bad-soft: #fde8e6;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161d;
    --card: #1a222c;
    --ink: #e8edf3;
    --muted: #9aa7b6;
    --line: #2d3947;
    --brand: #4b9bea;
    --brand-ink: #06121f;
    --brand-soft: #16304b;
    --good: #55c98b;
    --good-soft: #143424;
    --warn: #f0b64a;
    --warn-soft: #3a2c0c;
    --bad: #ff8a80;
    --bad-soft: #43201d;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
[hidden] { display: none !important; }
a { color: var(--brand); }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
p { margin: 0 0 10px; }
small, .muted { color: var(--muted); }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--brand); color: var(--brand-ink); }
.brand { color: inherit; text-decoration: none; font-weight: 700; white-space: nowrap; }
@media (max-width: 480px) { .brand span { display: none; } }
.brand span { font-weight: 400; opacity: .85; }
.who { font-size: .85rem; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; padding: 9px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; min-height: 40px; display: flex; align-items: center; gap: 6px; }
.tabs a.on { background: var(--brand-soft); color: var(--brand); }
.tabs .sep { flex: 0 0 1px; background: var(--line); margin: 6px 4px; }
.count { background: var(--bad); color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 7px; font-weight: 700; }

main { max-width: 980px; margin: 0 auto; padding: 16px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
main.narrow { max-width: 520px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.card.tight { padding: 12px 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row.top-align { align-items: flex-start; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.none { color: var(--muted); padding: 6px 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.big { font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.num { font-variant-numeric: tabular-nums; }

/* buttons */
button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 10px 16px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-good { background: var(--good); color: #fff; border-color: var(--good); }
.btn-bad { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); padding: 8px 10px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn-clock { width: 100%; min-height: 84px; font-size: 1.5rem; border-radius: 16px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns.bar { margin-top: 8px; }
h2.gap { margin-top: 16px; }
form.gap { margin-top: 14px; }

/* forms */
label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 4px; }
input, select, textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); min-height: 44px; }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; padding: 0; vertical-align: middle; margin-right: 8px; }
.check { display: flex; align-items: center; font-weight: 500; }
.field { margin: 0 0 12px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fields .wide { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-weight: 600; }
.note { background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; }
.note ul { margin: 6px 0 0; padding-left: 20px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.good { background: var(--good-soft); color: var(--good); }
.secret { font-size: 1.8rem; font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; user-select: all; }

/* tags */
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 700; background: var(--line); color: var(--ink); white-space: nowrap; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.info { background: var(--brand-soft); color: var(--brand); }

/* the clock card */
.clock-card { text-align: center; padding: 22px 16px; }
.clock-card .state { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.clock-card .state.in { color: var(--good); }
.clock-card .elapsed { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; margin: 6px 0 14px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 1.3rem; }

/* week views */
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.weeknav .label { font-weight: 700; text-align: center; flex: 1; }
.days { display: grid; grid-template-columns: 1fr; gap: 10px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.day h3 { margin: 0 0 6px; font-size: .95rem; display: flex; justify-content: space-between; }
.shift { display: flex; justify-content: space-between; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; margin: 0 0 6px; border-radius: 8px; background: var(--brand-soft); border: 0; min-height: 0; font-weight: 500; font-size: .92rem; color: var(--ink); }
.shift.me { outline: 2px solid var(--brand); }
.shift .t { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.off { font-size: .85rem; color: var(--warn); margin: 0 0 6px; }
.add { width: 100%; border-style: dashed; color: var(--muted); min-height: 38px; font-size: .9rem; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.pills button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* the office's all-stores calendar */
.pool { position: sticky; top: 57px; z-index: 4; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.pool-head { font-size: .88rem; margin: 0 0 8px; color: var(--muted); }
.pool-head b { color: var(--ink); }
.pool-list { display: flex; gap: 6px; flex-wrap: wrap; max-height: 132px; overflow-y: auto; }
.person { min-height: 38px; padding: 6px 12px; border-radius: 999px; font-size: .9rem; font-weight: 600; cursor: grab; }
.person small { font-weight: 500; }
.person.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.person.on small { color: inherit; }
.ov { display: grid; gap: 4px; margin: 0 0 14px; grid-template-columns: 58px repeat(1, minmax(0, 1fr)); }
.ov.n2 { grid-template-columns: 58px repeat(2, minmax(0, 1fr)); }
.ov.n3 { grid-template-columns: 58px repeat(3, minmax(0, 1fr)); }
.ov.n4 { grid-template-columns: 58px repeat(4, minmax(0, 1fr)); }
.ov.n5 { grid-template-columns: 58px repeat(5, minmax(0, 1fr)); }
.ov.n6 { grid-template-columns: 58px repeat(6, minmax(0, 1fr)); }
.ov-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-height: 0; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-weight: 500; text-align: center; }
.ov-head.corner { background: transparent; border: 0; }
.ov-head small { color: var(--muted); font-size: .74rem; }
.ov-day { display: flex; flex-direction: column; padding: 8px 4px; font-size: .82rem; color: var(--muted); }
.ov-day b { color: var(--ink); font-size: .95rem; }
.ov-day.today b { color: var(--brand); }
.ov-day .off { color: var(--warn); font-size: .7rem; line-height: 1.25; margin: 2px 0 0; }
.cell { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 64px; padding: 6px 6px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.cell.today { border-color: var(--brand); }
.cell.over { outline: 2px dashed var(--brand); background: var(--brand-soft); }
.cell .plus { position: absolute; right: 8px; bottom: 2px; color: var(--muted); font-weight: 700; }
.chip { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 0; padding: 5px 8px; border: 0; border-radius: 8px; background: var(--brand-soft); color: var(--ink); font-size: .86rem; font-weight: 600; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: grab; }
.chip small { color: var(--muted); font-weight: 500; font-size: .72rem; }
@media (max-width: 600px) { .pool-list { max-height: 88px; } .person { min-height: 34px; padding: 4px 10px; font-size: .84rem; } }

@media (min-width: 900px) {
  .days.grid { grid-template-columns: repeat(7, 1fr); gap: 8px; }
  .days.grid .shift { flex-direction: column; align-items: flex-start; gap: 0; }
}

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 800; border-bottom: 0; }
tr.inactive td { color: var(--muted); }

/* dialog and toast */
dialog { border: 0; border-radius: 16px; padding: 18px; width: min(480px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(8, 15, 25, .55); }
dialog h2 { font-size: 1.15rem; margin-bottom: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; max-width: calc(100vw - 32px); z-index: 50; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.toast.bad { background: var(--bad); color: #fff; }

@media print {
  .top, .tabs, .no-print, .toast, dialog { display: none !important; }
  body, :root { background: #fff; color: #000; }
  .card { border: 0; padding: 0; }
  main { max-width: none; padding: 0; }
}
