:root {
  --bg: #000;
  --surface: #111;
  --surface-2: #1a1a1a;
  --line: #262626;
  --text: #f5f5f5;
  --muted: #8c8c8c;
  --dim: #5c5c5c;
  --white: #fff;
  --on: #34d399;
  --on-bg: rgba(52, 211, 153, .12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, .12);
  --bad: #f87171;
  --bad-bg: rgba(248, 113, 113, .12);
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--white); }
.num { font-variant-numeric: tabular-nums; }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.logo-mark { width: 56px; height: 56px; border-radius: 14px; background: var(--white); color: #000; display: grid; place-items: center; font-weight: 800; font-size: 30px; letter-spacing: -1px; }

/* ---------- shell ---------- */
.shell { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--safe-t) + 64px) 16px calc(var(--safe-b) + 96px); }
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; background: rgba(0,0,0,.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding-top: var(--safe-t); }
.topbar-in { max-width: 560px; margin: 0 auto; height: 56px; padding: 0 12px 0 16px; display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 800; letter-spacing: .14em; font-size: 15px; flex: 1; display: flex; align-items: center; gap: 10px; }
.brand .logo-mark { width: 28px; height: 28px; font-size: 16px; border-radius: 8px; letter-spacing: 0; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; position: relative; cursor: pointer; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.badge { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #000; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.badge[hidden] { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: rgba(0,0,0,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar-in { max-width: 560px; margin: 0 auto; display: flex; }
.tab { flex: 1; border: 0; background: none; padding: 9px 2px 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--dim); font-size: 11px; font-weight: 600; cursor: pointer; position: relative; }
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--white); }
.tab .badge { top: 3px; right: calc(50% - 22px); }

h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.02em; margin: 8px 0 16px; font-weight: 800; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 26px 0 10px; font-weight: 700; }
h2:first-child { margin-top: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 10px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; }
.item + .item { border-top: 1px solid var(--line); }
button.item:active { background: var(--surface-2); }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--muted); font-size: 13px; }
.item .r { text-align: right; flex-shrink: 0; }
.chev { color: var(--dim); flex-shrink: 0; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.on { background: var(--on-bg); color: var(--on); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex-shrink: 0; }
.dot.on { background: var(--on); box-shadow: 0 0 0 4px var(--on-bg); }

/* ---------- clock ---------- */
.clock-card { text-align: center; padding: 26px 16px 22px; }
.clock-status { font-size: 14px; color: var(--muted); min-height: 21px; }
.clock-timer { font-size: 44px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 18px; }
.clock-btn { width: 190px; height: 190px; border-radius: 50%; border: 0; cursor: pointer; font-weight: 800; font-size: 20px; letter-spacing: .06em; background: var(--white); color: #000; box-shadow: 0 0 0 10px #161616, 0 0 0 11px var(--line); transition: transform .12s; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.clock-btn:active { transform: scale(.96); }
.clock-btn.out { background: #000; color: var(--white); box-shadow: 0 0 0 10px var(--on-bg), 0 0 0 11px var(--on); }
.clock-btn svg { width: 30px; height: 30px; }
.clock-btn:disabled { opacity: .6; }
.loc-note { margin-top: 18px; font-size: 12px; color: var(--dim); display: flex; align-items: center; justify-content: center; gap: 6px; }

.stat-big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; margin-bottom: 6px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.split .card { margin: 0; }
.deposit { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.deposit svg { width: 22px; height: 22px; flex-shrink: 0; }

.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 110px; margin-top: 16px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar i { display: block; width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: var(--white); min-height: 3px; }
.bar i.zero { background: var(--line); }
.bar i.today { background: var(--on); }
.bar span { font-size: 11px; color: var(--muted); font-weight: 600; }
.bar b { font-size: 11px; font-weight: 600; color: var(--text); }

/* ---------- forms ---------- */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.input, select.input, textarea.input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; outline: none; font-size: 16px; }
.input:focus { border-color: #555; }
textarea.input { min-height: 88px; resize: vertical; }
input[type="date"].input, input[type="datetime-local"].input { min-height: 50px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 14px 18px; font-weight: 700; cursor: pointer; background: var(--white); color: #000; font-size: 15px; text-decoration: none; }
.btn:active { opacity: .85; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.ok { background: var(--on); color: #000; }
.btn.sm { padding: 9px 13px; font-size: 13px; border-radius: 10px; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.err { background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 11px 14px; font-size: 14px; margin-bottom: 14px; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--white); color: #000; }

.action-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.action { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: left; cursor: pointer; width: 100%; }
.action:active { background: var(--surface-2); }
.action .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; flex-shrink: 0; }
.action .ic svg { width: 22px; height: 22px; }
.action .t { font-weight: 700; }
.action .s { font-size: 13px; color: var(--muted); }

.weeknav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.weeknav .lbl { flex: 1; text-align: center; font-weight: 700; }
.weeknav .lbl small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }

/* ---------- payroll ---------- */
.pay-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.pay-row + .pay-row { border-top: 1px solid var(--line); }
.check { width: 44px; height: 44px; border-radius: 12px; border: 2px solid #444; background: transparent; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; color: transparent; }
.check svg { width: 24px; height: 24px; }
.check.done { background: var(--on); border-color: var(--on); color: #000; }
.check:disabled { opacity: .35; cursor: default; }
.changed { color: var(--warn); font-size: 12px; margin-top: 3px; }

/* ---------- auth ---------- */
.auth { max-width: 420px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--safe-t) + 48px) 20px 40px; display: flex; flex-direction: column; }
.auth .logo-mark { margin-bottom: 26px; }
.auth h1 { font-size: 30px; margin: 0 0 6px; }
.auth .sub { color: var(--muted); margin: 0 0 28px; }
.wordmark { font-weight: 800; letter-spacing: .18em; font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* ---------- sheet ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.7); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: #0d0d0d; border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; padding: 8px 16px calc(var(--safe-b) + 22px); animation: up .2s ease-out; }
.sheet-grab { width: 40px; height: 5px; background: #333; border-radius: 3px; margin: 4px auto 12px; }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.sheet-head h3 { flex: 1; margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 600px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; border-bottom: 1px solid var(--line); } }

.qr-box { background: #fff; border-radius: 16px; padding: 16px; width: 252px; height: 252px; margin: 6px auto 14px; display: grid; place-items: center; }
.qr-box svg { width: 220px; height: 220px; display: block; }
.linkbox { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; font-size: 13px; word-break: break-all; color: var(--muted); margin-bottom: 12px; }

#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 88px); transform: translateX(-50%) translateY(20px); background: var(--white); color: #000; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); }

.banner { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.banner .x { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.notif { padding: 14px 16px; }
.notif + .notif { border-top: 1px solid var(--line); }
.notif.unread { background: #151515; }
.notif .t { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.notif .b { color: #cfcfcf; font-size: 14px; margin-top: 2px; }
.notif .w { color: var(--dim); font-size: 12px; margin-top: 4px; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv span:first-child { color: var(--muted); }
.spin { width: 22px; height: 22px; border: 3px solid #333; border-top-color: #fff; border-radius: 50%; animation: sp .8s linear infinite; margin: 30px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }
label.f.row { display: flex; } label.f.row > span { display: inline; margin: 0; }
