/* Coach Hours — shared design kit. Mobile-first, big touch targets, light + dark. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --line: #dfe4ee;
  --text: #16202f;
  --muted: #5d6a80;
  --primary: #2f5bea;
  --primary-ink: #ffffff;
  --primary-soft: #e3eaff;
  --go: #12a150;
  --go-soft: #dcf5e7;
  --stop: #e0493b;
  --stop-soft: #fde5e2;
  --warn: #c77800;
  --warn-soft: #fff1d6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .06);
  --tap: 52px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1320;
    --surface: #161d2e;
    --surface-2: #1d2539;
    --line: #2a3450;
    --text: #eef2fa;
    --muted: #9aa6bf;
    --primary: #6d8cff;
    --primary-ink: #0b1020;
    --primary-soft: #222e52;
    --go: #2fcf78;
    --go-soft: #173826;
    --stop: #ff6b5c;
    --stop-soft: #402020;
    --warn: #ffb547;
    --warn-soft: #3d2f14;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
  .btn.go { background: #178a47; }
  .btn.stop { background: #c43d30; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 17px/1.4 var(--font); color: var(--text); background: var(--bg);
  -webkit-tap-highlight-color: transparent; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 750; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* layout */
.wrap { max-width: 640px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 16px calc(96px + var(--safe-b)); }
.wrap.wide { max-width: 1100px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap-ok { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 8px; }

/* cards + lists */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: var(--tap);
  border-top: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-bottom: 0;
  width: 100%; text-align: left;
}
.item:first-child { border-top: 0; }
button.item, a.item { cursor: pointer; color: inherit; text-decoration: none; }
button.item:active, a.item:active { background: var(--surface-2); }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 4px 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--text); font-weight: 650; text-decoration: none;
  transition: transform .06s ease, filter .15s ease; user-select: none;
}
.btn:active { transform: scale(.98); filter: brightness(.95); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.go { background: var(--go); color: #fff; }
.btn.stop { background: var(--stop); color: #fff; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.outline { background: transparent; border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn.big { min-height: 76px; font-size: 22px; border-radius: 20px; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px; color: var(--text);
}
.icon-btn:active { background: var(--surface-2); }

/* chips (single/multi choice) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"], .chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 14px; font-weight: 650; color: var(--muted); }
.input, input[type=text], input[type=number], input[type=password], input[type=date], input[type=time],
input[type=tel], input[type=email], select, textarea {
  width: 100%; min-height: var(--tap); padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); outline: none; font-size: 17px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.money-input { position: relative; }
.money-input::before { content: "$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money-input input { padding-left: 28px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); cursor: pointer; }
.switch input { appearance: none; width: 52px; height: 32px; border-radius: 999px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked { background: var(--go); }
.switch input:checked::after { transform: translateX(20px); }

/* badges + status pills */
.badge { display: inline-flex; align-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--stop); color: #fff; font-size: 13px; font-weight: 700; justify-content: center; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.go { background: var(--go-soft); color: var(--go); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.stop { background: var(--stop-soft); color: var(--stop); }
.pill.info { background: var(--primary-soft); color: var(--primary); }
.banner { border-radius: var(--radius); padding: 14px 16px; background: var(--warn-soft); color: var(--text); display: flex; gap: 12px; align-items: center; }
.banner.info { background: var(--primary-soft); }
.banner.go { background: var(--go-soft); }
.banner.stop { background: var(--stop-soft); }

/* avatar initials */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 750; font-size: 15px; flex: none; color: #fff; }

/* bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabbar-inner { display: flex; width: 100%; max-width: 640px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 650; position: relative; }
.tab .ico { font-size: 22px; line-height: 1; }
.tab[aria-current="page"] { color: var(--primary); }
.tab .badge { position: absolute; top: 4px; left: calc(50% + 6px); height: 18px; min-width: 18px; font-size: 11px; padding: 0 5px; }

/* bottom sheet / modal */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 30, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto;
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); animation: up .2s ease;
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 22px; padding-bottom: 20px; }
  .sheet::before { display: none; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* toast */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(84px + var(--safe-b)); z-index: 80; display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
.toast { background: #1c2436; color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-weight: 600; max-width: 520px; animation: up .18s ease; pointer-events: auto; display: flex; gap: 12px; align-items: center; }
.toast.error { background: var(--stop); }
.toast button { background: none; border: 0; color: #9db4ff; font-weight: 700; cursor: pointer; }

/* big clock */
.clock { font-size: 56px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }

/* empty state */
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty .ico { font-size: 40px; margin-bottom: 8px; }

/* spinner */
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tables (admin, wide screens) */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 10px 12px; border-top: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
.table th { border-top: 0; font-size: 13px; color: var(--muted); font-weight: 700; background: var(--surface-2); }
.table td.right, .table th.right { text-align: right; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
