/* CF Time Keeper. Colors are tokens; --brand* are set at runtime from each business's chosen color. */
:root {
  --brand: #f51f6f;
  --brand-2: #ff4d8d;
  --brand-ink: #ffffff;
  --brand-soft: #fff0f5;
  --brand-text: #b3134f;
  --bg: #f4f4f7;
  --card: #ffffff;
  --field: #fafafc;
  --ink: #111114;
  --sub: #6b6b76;
  --line: #e6e6ec;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0e; --card: #17171c; --field: #1f1f26; --ink: #f4f4f7; --sub: #9d9dab; --line: #2b2b34;
    --ok: #4ade80; --ok-soft: #10301c; --bad: #f87171; --bad-soft: #3b1219; --warn: #fbbf24; --warn-soft: #3a2a06;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0e; --card: #17171c; --field: #1f1f26; --ink: #f4f4f7; --sub: #9d9dab; --line: #2b2b34;
  --ok: #4ade80; --ok-soft: #10301c; --bad: #f87171; --bad-soft: #3b1219; --warn: #fbbf24; --warn-soft: #3a2a06;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-text); }
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 16px 96px; }
.app.wide { max-width: 1040px; }
.loading { padding: 64px 0; text-align: center; color: var(--sub); }
.hidden { display: none !important; }

/* Header */
.hdr { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; margin: 0 -16px; padding: 12px 16px;
  background: var(--brand); color: var(--brand-ink); padding-top: max(12px, env(safe-area-inset-top)); }
.hdr .logo { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.18); display: grid; place-items: center; overflow: hidden; flex: none; }
.hdr .logo img { width: 100%; height: 100%; object-fit: cover; }
.hdr .ttl { flex: 1; min-width: 0; }
.hdr .t1 { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr .t2 { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { border: 0; border-radius: 999px; padding: 7px 12px; background: rgba(255,255,255,.18); color: inherit; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }

/* Cards and forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.card h2, .card h3 { margin: 0 0 6px; font-size: 16px; }
h1.big { font-size: 24px; margin: 18px 2px 4px; }
.note { color: var(--sub); font-size: 13px; }
label.fl { display: block; font-size: 13px; font-weight: 600; color: var(--sub); margin: 12px 0 6px; }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=date], input[type=month], input[type=time], select, textarea {
  width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.row > .auto { flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 16px;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; cursor: pointer; min-height: 44px; }
.btn.block { width: 100%; margin-top: 12px; }
.btn.gray { background: var(--field); color: var(--ink); border: 1px solid var(--line); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.small { padding: 7px 11px; min-height: 34px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.msg { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.badge { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; text-align: center; margin-left: 4px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--field); border: 1px solid var(--line); color: var(--sub); }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.brand { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }

/* Tables */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px -4px 0; }
table.t { border-collapse: collapse; width: 100%; font-size: 13px; }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; vertical-align: top; white-space: nowrap; }
table.t th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--sub); font-weight: 700; }
table.t td.r, table.t th.r { text-align: right; }
table.t input { padding: 6px 7px; border-radius: 8px; min-width: 92px; font-size: 13px; }
table.t tr.total td { font-weight: 800; border-top: 2px solid var(--line); }

/* Staff home */
.hero { text-align: center; padding: 18px 0 4px; }
.clock { font-size: 44px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.date { color: var(--sub); }
.loc { display: inline-block; margin-top: 8px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--field); color: var(--sub); }
.loc.ok { background: var(--ok-soft); color: var(--ok); }
.loc.bad { background: var(--warn-soft); color: var(--warn); }
.cam { width: 180px; height: 180px; margin: 18px auto 6px; border-radius: 50%; overflow: hidden; background: var(--field);
  border: 4px solid var(--brand); box-shadow: 0 0 0 6px var(--brand-soft); }
.cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.punch { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.punch button { border: 0; border-radius: 18px; padding: 20px 8px; font-size: 20px; font-weight: 800; cursor: pointer; color: #fff; min-height: 84px; }
.punch button small { display: block; font-size: 12px; font-weight: 600; opacity: .85; }
.punch .in { background: var(--brand); color: var(--brand-ink); }
.punch .out { background: #33333d; }
.punch button:disabled { opacity: .4; cursor: default; }

/* Bottom tabs */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.tabbar .in2 { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar button { border: 0; background: none; padding: 8px 0 9px; font-size: 11px; font-weight: 600; color: var(--sub); cursor: pointer; position: relative; }
.tabbar button svg { display: block; width: 22px; height: 22px; margin: 0 auto 2px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--brand-text); }
.tabbar .badge { position: absolute; top: 4px; left: 55%; }

/* Admin */
.subnav { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.subnav button { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 13px; font-size: 13px; font-weight: 600; cursor: pointer; }
.subnav button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kpi .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--sub); }
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--field); flex: none; }
.slip { font-size: 13px; }
.slip .line { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.slip .gross { font-weight: 800; font-size: 16px; color: var(--ok); border-top: 2px solid var(--line); margin-top: 6px; padding-top: 8px; }

/* Color wheel */
.wheel-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.wheel { position: relative; width: 200px; height: 200px; flex: none; touch-action: none; cursor: crosshair; }
.wheel canvas { width: 200px; height: 200px; border-radius: 50%; display: block; }
.wheel .dot { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.3); pointer-events: none; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.swatches span { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); }
input[type=range] { width: 100%; accent-color: var(--brand); }

/* Landing */
.landing { text-align: center; padding-top: 48px; }
.landing .mark { width: 84px; height: 84px; border-radius: 22px; margin: 0 auto 16px; background: var(--brand); display: grid; place-items: center; }
.landing h1 { font-size: 28px; margin: 0; }
.gbtn { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; border-radius: 12px; padding: 12px 18px; font-weight: 600; cursor: pointer; min-height: 48px; }
.gbtn svg { width: 20px; height: 20px; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: .2s; z-index: 20;
  background: #222; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 16px; }
.modal .box { background: var(--card); border-radius: 22px; padding: 22px; width: 100%; max-width: 380px; text-align: center; }
.modal .box .ic { font-size: 44px; }
.modal .box .big { font-size: 20px; font-weight: 800; margin: 6px 0; }
@media (max-width: 380px) { .clock { font-size: 38px; } .punch button { font-size: 18px; } }
