/* Layout: one phone-width column. Punch station first; manager tools in their own tabs. */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --ink: #17202c;
  --muted: #5b6676;
  --line: #d6dce5;
  --accent: #1f4fd1;
  --accent-ink: #ffffff;
  --in: #137a4a;
  --in-soft: #dcf2e6;
  --out: #a3570a;
  --out-soft: #fbead6;
  --none: #6b7482;
  --none-soft: #e7eaef;
  --danger: #b42318;
  --punch-ink: #ffffff;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --surface: #171e28; --ink: #e7ecf3; --muted: #9aa5b5; --line: #2a3443;
    --accent: #6b93ff; --accent-ink: #0c1220;
    --in: #4fd193; --in-soft: #143426; --out: #f2a65a; --out-soft: #3a2812;
    --none: #9aa5b5; --none-soft: #232c39; --danger: #ff8a7a; --punch-ink: #0c1220;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  -webkit-tap-highlight-color: transparent;
}
.app { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--f-display); margin: 0 0 6px; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.12rem; }
p { margin: 0 0 12px; }
code { font-family: var(--f-mono); font-size: 0.9em; }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Top bar */
.bar { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; line-height: 1.1; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); position: relative; flex: none; }
.logo::before { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 2.5px solid var(--accent-ink); border-radius: 50%; }
.logo::after { content: ""; position: absolute; left: 50%; top: 11px; width: 2.5px; height: 7px; margin-left: -1px; background: var(--accent-ink); border-radius: 2px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; }
.view, .pane { display: flex; flex-direction: column; gap: 16px; }

/* Tabs */
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; overflow-x: auto; }
.tab { flex: 1 0 auto; appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 0.9rem var(--f-body); padding: 9px 12px; border-radius: 9px; cursor: pointer; position: relative; }
.tab.is-active { background: var(--accent); color: var(--accent-ink); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 0.72rem; line-height: 18px; }

/* Punch station */
.station { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding-block: 26px; }
.clock { font-size: clamp(3rem, 16vw, 4.4rem); font-weight: 600; line-height: 1; letter-spacing: -0.03em; }
.today { color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 600; padding: 5px 12px; border-radius: 999px; font-size: 0.88rem; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st-in { background: var(--in-soft); color: var(--in); }
.st-out { background: var(--out-soft); color: var(--out); }
.st-none { background: var(--none-soft); color: var(--none); }
.punch {
  appearance: none; border: 0; cursor: pointer; margin-top: 16px; width: min(100%, 300px); aspect-ratio: 1.6; border-radius: 22px;
  background: var(--in); color: var(--punch-ink); font: 700 1.6rem var(--f-display);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 10px 24px -12px var(--in); transition: transform .12s ease, filter .12s ease;
}
.punch small { font: 600 0.8rem var(--f-body); opacity: .85; }
.punch.is-out { background: var(--out); box-shadow: 0 10px 24px -12px var(--out); }
.punch:active:not(:disabled) { transform: scale(0.98); }
.punch:disabled { opacity: .55; cursor: default; }
.loc { min-height: 1.2em; font-size: 0.85rem; color: var(--muted); }
.worked { font-size: 0.95rem; color: var(--muted); }
.worked b { color: var(--ink); font-family: var(--f-mono); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip { font-family: var(--f-mono); font-size: 0.82rem; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; color: var(--muted); }
.chip b { color: var(--ink); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
input, select {
  font: 500 1rem var(--f-body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; min-width: 0;
}
form { display: flex; flex-direction: column; gap: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; margin-top: 10px; }
.primary, .secondary {
  appearance: none; cursor: pointer; font: 700 0.95rem var(--f-body); padding: 12px 16px; border-radius: 10px;
}
.primary { border: 0; background: var(--accent); color: var(--accent-ink); }
.secondary { border: 1px solid var(--accent); background: transparent; color: var(--accent); }
.primary:disabled, .secondary:disabled { opacity: .55; cursor: default; }
.link-btn { appearance: none; border: 0; background: none; color: var(--accent); font: 600 0.9rem var(--f-body); cursor: pointer; padding: 6px 0; }
.link-btn.small { font-size: 0.82rem; }
.danger-btn { appearance: none; border: 1px solid var(--line); background: transparent; color: var(--danger); font: 600 0.82rem var(--f-body); padding: 6px 10px; border-radius: 8px; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.auth { max-width: 420px; width: 100%; margin: 24px auto 0; }
.auth-switch { margin-top: 14px; color: var(--muted); font-size: 0.9rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Tables and lists */
.tbl-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 0 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; }
td.mono { font-family: var(--f-mono); }
.dash { color: var(--muted); }
.fixed { font-size: 0.7rem; color: var(--out); margin-left: 4px; }
.empty { color: var(--muted); margin: 10px 0 0; }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tools input { width: auto; padding: 8px 10px; }
.tools .secondary { padding: 8px 12px; }
.summary { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
.summary b { color: var(--ink); font-family: var(--f-mono); }
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .who { min-width: 0; overflow-wrap: anywhere; }
.list .sub { display: block; font-size: 0.82rem; color: var(--muted); }
.list .acts { display: flex; gap: 8px; }
.role { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-left: 6px; }

.notice { border: 1px solid var(--line); border-left: 4px solid var(--out); background: var(--surface); border-radius: 10px; padding: 12px 16px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; max-width: calc(100% - 32px); z-index: 20; text-align: center; }
.foot { color: var(--muted); font-size: 0.78rem; text-align: center; }

@media (prefers-reduced-motion: reduce) { .punch { transition: none; } }

/* Company logo: shown on a light card so it reads in dark mode too */
.logo-card { display: inline-flex; align-items: center; justify-content: center; background: #ffffff; border-radius: 10px; padding: 4px 8px; border: 1px solid var(--line); flex: none; }
.logo-card img { display: block; height: 30px; width: auto; }
.auth-logo { align-self: center; margin: 0 auto 16px; padding: 10px 16px; border-radius: 14px; display: flex; width: max-content; }
.auth-logo img { height: 52px; }
.splash { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: opacity .35s ease; }
.splash.is-gone { opacity: 0; pointer-events: none; }
.logo-card.big { padding: 18px 26px; border-radius: 20px; box-shadow: 0 12px 30px -18px rgba(0,0,0,.35); }
.logo-card.big img { height: 78px; }
.splash-name { font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; color: var(--muted); letter-spacing: .02em; }
@media (prefers-reduced-motion: reduce) { .splash { transition: none; } }

/* Work from home */
:root { --wfh: #6b3fc4; --wfh-soft: #ece4fb; }
@media (prefers-color-scheme: dark) { :root { --wfh: #b99bff; --wfh-soft: #2b2342; } }
.st-wfh { background: var(--wfh-soft); color: var(--wfh); }
.wfh-today { margin-top: 6px; font-weight: 600; font-size: 0.88rem; color: var(--wfh); }
.field.wide { grid-column: 1 / -1; }
.list .status { margin-top: 0; }
.list .acts { flex-wrap: wrap; }
.decide-note { width: 100%; }

/* Requests: red flag while waiting, green when approved */
:root { --flag-red: #c62828; --flag-red-soft: #fde8e8; --flag-green: #1b8a4b; --flag-green-soft: #e1f5e9; --flag-grey: #8a93a0; --flag-grey-soft: #eceff3; --leave: #0f7c8c; --leave-soft: #dff3f5; }
@media (prefers-color-scheme: dark) { :root { --flag-red: #ff7b72; --flag-red-soft: #3a1d1d; --flag-green: #56d38e; --flag-green-soft: #16301f; --flag-grey: #9aa5b5; --flag-grey-soft: #232c39; --leave: #5fd0de; --leave-soft: #123236; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; margin: 6px 0 4px; flex-wrap: wrap; }
.seg-btn { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 0.9rem var(--f-body); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.seg-btn.is-on { background: var(--accent); color: var(--accent-ink); }
.flow { margin: 6px 0 0; }
.small { font-size: 0.82rem; margin-top: 10px; }
.field.check label { display: flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 500; font-size: 0.9rem; }
.field.check input { width: auto; }
.balance { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.balance div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.balance b { display: block; font: 600 1.3rem var(--f-mono); font-variant-numeric: tabular-nums; }
.balance span { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
@media (max-width: 420px) { .balance { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.flag-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 4px; }
.flag-dot.red { background: var(--flag-red); } .flag-dot.green { background: var(--flag-green); } .flag-dot.grey { background: var(--flag-grey); }
.req-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.req { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); border-left-width: 5px; min-width: 0; }
.req.red { border-left-color: var(--flag-red); background: var(--flag-red-soft); }
.req.green { border-left-color: var(--flag-green); background: var(--flag-green-soft); }
.req.grey { border-left-color: var(--flag-grey); background: var(--flag-grey-soft); }
.req svg { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.req.red svg { color: var(--flag-red); } .req.green svg { color: var(--flag-green); } .req.grey svg { color: var(--flag-grey); }
.req-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.req-title { font-weight: 700; }
.req-line { font-size: 0.86rem; color: var(--muted); }
.req-line b { color: var(--ink); font-weight: 600; }
.req-step { font-size: 0.84rem; font-weight: 600; }
.req.red .req-step { color: var(--flag-red); } .req.green .req-step { color: var(--flag-green); } .req.grey .req-step { color: var(--flag-grey); }
.req-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.req-acts input { flex: 1 1 160px; padding: 8px 10px; font-size: 0.9rem; }
.req-acts .primary, .req-acts .danger-btn { padding: 8px 12px; font-size: 0.85rem; }
.st-leave { background: var(--leave-soft); color: var(--leave); }
.member-edit { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; align-items: end; margin-top: 6px; }
.member-edit .field { flex: 1 1 150px; }
.member-edit input, .member-edit select { padding: 8px 10px; font-size: 0.9rem; }
.member-edit .secondary { padding: 8px 12px; font-size: 0.85rem; }
.place-sub { display: block; font-size: 0.78rem; color: var(--muted); }
