/* ===================== Tokens ===================== */
:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #edf2f0;
  --border: #d9e2df;
  --text: #15201e;
  --muted: #586864;
  --accent: #0b6b68;
  --accent-strong: #08524f;
  --accent-soft: #dcefed;
  --on-accent: #ffffff;

  --present: #2b8a3e; --present-soft: #e1f2e4;
  --late: #b26b00;    --late-soft: #fbedd5;
  --absent: #c92a2a;  --absent-soft: #fbe3e3;
  --leave: #1f62c4;   --leave-soft: #e0eafb;
  --holiday: #7646b8; --holiday-soft: #eee6f8;
  --weekend: #77837f; --weekend-soft: #e9edec;
  --pending: #8a9592;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(16 32 30 / 6%), 0 4px 16px rgb(16 32 30 / 5%);
  --font-head: 'Sora', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1514; --surface: #151f1d; --surface-2: #1c2826; --border: #2a3835;
    --text: #e4ecea; --muted: #97a7a3;
    --accent: #3fb5ad; --accent-strong: #66cbc4; --accent-soft: #163a37; --on-accent: #062220;
    --present: #5cc06f; --present-soft: #173322;
    --late: #e5a33d;    --late-soft: #3a2b12;
    --absent: #f06b6b;  --absent-soft: #3d1a1a;
    --leave: #6aa1f2;   --leave-soft: #182a45;
    --holiday: #b28be8; --holiday-soft: #2c2140;
    --weekend: #8d9a96; --weekend-soft: #222d2b;
    --pending: #73817d;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1514; --surface: #151f1d; --surface-2: #1c2826; --border: #2a3835;
  --text: #e4ecea; --muted: #97a7a3;
  --accent: #3fb5ad; --accent-strong: #66cbc4; --accent-soft: #163a37; --on-accent: #062220;
  --present: #5cc06f; --present-soft: #173322;
  --late: #e5a33d;    --late-soft: #3a2b12;
  --absent: #f06b6b;  --absent-soft: #3d1a1a;
  --leave: #6aa1f2;   --leave-soft: #182a45;
  --holiday: #b28be8; --holiday-soft: #2c2140;
  --weekend: #8d9a96; --weekend-soft: #222d2b;
  --pending: #73817d;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
  color-scheme: dark;
}

/* ===================== Base ===================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.eyebrow { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
a { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ===================== Controls ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font: 600 0.92rem var(--font-body); cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--absent-soft); color: var(--absent); }
.btn-success { background: var(--present-soft); color: var(--present); }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: 500 0.85rem var(--font-body); cursor: pointer; }
.link:hover { text-decoration: underline; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center;
}
.icon-btn svg { width: 18px; height: 18px; }

.field { display: grid; gap: 6px; }
.field label, .field .label { font-weight: 600; font-size: 0.86rem; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 0.95rem var(--font-body);
}
textarea { min-height: 84px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent-soft); border-color: var(--accent); outline-offset: 0; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--absent); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
.field-error { color: var(--absent); font-size: 0.82rem; min-height: 0; }
.field-error:empty { display: none; }
.hint { color: var(--muted); font-size: 0.82rem; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.form-alert { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--absent-soft); color: var(--absent); font-size: 0.9rem; font-weight: 500; }
.form-alert.info { background: var(--accent-soft); color: var(--accent-strong); }

/* ===================== Login ===================== */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .login { grid-template-columns: minmax(380px, 5fr) 6fr; } }
.login-brand {
  background: var(--accent); color: #fff; padding: 32px 24px;
  background-image: radial-gradient(circle at 15% 110%, rgb(255 255 255 / 12%) 0 30%, transparent 31%),
                    radial-gradient(circle at 110% -10%, rgb(255 255 255 / 9%) 0 35%, transparent 36%);
}
:root[data-theme="dark"] .login-brand { background-color: #0d3f3c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .login-brand { background-color: #0d3f3c; } }
.login-brand-inner { max-width: 420px; margin: 0 auto; display: grid; gap: 20px; }
@media (min-width: 900px) { .login-brand { display: flex; align-items: center; padding: 48px; } }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.05rem var(--font-head); color: var(--text); }
.brand-link { text-decoration: none; border-radius: 10px; }
.brand-link:hover span { color: var(--accent); }
.brand .logo { width: 32px; height: 32px; color: var(--accent); flex: none; }
.brand-lg { font-size: 1.4rem; color: #fff; }
.brand-lg .logo { width: 44px; height: 44px; color: rgb(255 255 255 / 18%); }
.tagline { font: 600 1.5rem/1.3 var(--font-head); }
@media (min-width: 900px) { .tagline { font-size: 2rem; } }
.glance { background: rgb(255 255 255 / 10%); border: 1px solid rgb(255 255 255 / 18%); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 4px; }
.glance .eyebrow { color: rgb(255 255 255 / 75%); }
.glance-date { font: 600 1.05rem var(--font-head); }
.glance-bs { color: rgb(255 255 255 / 80%); font-size: 0.9rem; }
.glance-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 0.9rem; }
.glance-list li { display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.login-brand .dot { box-shadow: 0 0 0 2px rgb(255 255 255 / 70%); }
.dot-present { background: var(--present); } .dot-late { background: var(--late); } .dot-absent { background: var(--absent); }
.dot-leave { background: var(--leave); } .dot-holiday { background: var(--holiday); } .dot-weekend { background: var(--weekend); }
.dot-pending { background: transparent; border: 2px solid var(--pending); }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 32px 16px 48px; }
.login-form { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent); font: 600 0.82rem var(--font-body); padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.demo-box { border-top: 1px solid var(--border); padding-top: 16px; display: grid; gap: 10px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-acct { text-align: left; border: 1px dashed var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; font: 0.9rem var(--font-body); }
.demo-acct:hover { border-color: var(--accent); }
.demo-acct span { color: var(--muted); font-size: 0.74rem; overflow-wrap: anywhere; }
@media (max-width: 420px) { .demo-grid { grid-template-columns: 1fr; } }

/* ===================== App shell ===================== */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px 20px; padding: 10px 20px;
}
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 9px;
  font: 600 0.9rem var(--font-body); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
.badge { background: var(--absent); color: #fff; border-radius: 999px; font-size: 0.7rem; padding: 1px 7px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font: 700 0.8rem var(--font-head); flex: none; }
.avatar-sm { width: 30px; height: 30px; font-size: 0.7rem; }
.user-meta { display: grid; line-height: 1.2; }
.user-meta b { font-size: 0.88rem; }
.user-meta small { color: var(--muted); font-size: 0.75rem; text-transform: capitalize; }
@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; padding: 10px 16px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; margin: 0 -16px; padding: 0 16px; }
  .user-meta { display: none; }
}
@media (max-width: 420px) { .topbar .brand span { display: none; } }

.main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 40px; display: grid; gap: 20px; outline: none; }
@media (max-width: 640px) { .main { padding: 16px 16px 32px; gap: 16px; } }
.footer { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 0 16px 24px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
@media (max-width: 640px) { .card { padding: 16px; } }
.grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 960px) { .grid-2 { grid-template-columns: 3fr 2fr; } .grid-2.even { grid-template-columns: 1fr 1fr; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.toolbar .field { min-width: 150px; flex: 1 1 150px; }
.toolbar .field.grow { flex: 2 1 220px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===================== Stats ===================== */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  display: grid; gap: 4px; text-align: left; color: var(--text); font: inherit; min-width: 0;
  border-left: 4px solid var(--stat-color, var(--border));
}
button.stat { cursor: pointer; }
button.stat:hover { background: var(--surface-2); }
button.stat[aria-pressed="true"] { outline: 2px solid var(--stat-color, var(--accent)); outline-offset: -1px; }
.stat-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.stat-value { font: 700 1.6rem/1.1 var(--font-head); font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: 0.78rem; }
.c-present { --stat-color: var(--present); } .c-late { --stat-color: var(--late); } .c-absent { --stat-color: var(--absent); }
.c-leave { --stat-color: var(--leave); } .c-holiday { --stat-color: var(--holiday); } .c-pending { --stat-color: var(--pending); }
.c-accent { --stat-color: var(--accent); }

/* ===================== Status pills ===================== */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.st-present { background: var(--present-soft); color: var(--present); }
.st-late { background: var(--late-soft); color: var(--late); }
.st-absent { background: var(--absent-soft); color: var(--absent); }
.st-leave { background: var(--leave-soft); color: var(--leave); }
.st-holiday { background: var(--holiday-soft); color: var(--holiday); }
.st-weekend { background: var(--weekend-soft); color: var(--weekend); }
.st-pending { background: var(--surface-2); color: var(--muted); }
.st-approved { background: var(--present-soft); color: var(--present); }
.st-rejected { background: var(--absent-soft); color: var(--absent); }
.st-cancelled { background: var(--surface-2); color: var(--muted); }
.st-inactive { background: var(--surface-2); color: var(--muted); }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.tag.warn { background: var(--late-soft); color: var(--late); }

/* ===================== Tables ===================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.person b { display: block; font-weight: 600; }
.person small { color: var(--muted); font-size: 0.78rem; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
tr.is-inactive td { opacity: 0.6; }

/* ===================== Employee: check-in hero ===================== */
.hero { display: grid; gap: 24px; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 760px) { .hero { grid-template-columns: 1fr auto; padding: 28px 32px; } }
.greeting { font: 600 1.05rem var(--font-head); }
.clock { font: 600 clamp(2.6rem, 9vw, 3.8rem)/1 var(--font-mono); letter-spacing: -0.02em; margin: 10px 0 8px; font-variant-numeric: tabular-nums; }
.clock small { font-size: 0.4em; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.hero-date { font-weight: 600; }
.hero-meta { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.hero-action { display: grid; justify-items: center; gap: 10px; }
.punch {
  width: 188px; height: 188px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: var(--on-accent); display: grid; place-content: center; gap: 4px; text-align: center;
  font: 700 1.35rem var(--font-head); box-shadow: 0 0 0 10px var(--accent-soft), var(--shadow);
  transition: transform 0.1s, background 0.15s;
}
.punch:hover:not(:disabled) { background: var(--accent-strong); }
.punch:active:not(:disabled) { transform: scale(0.98); }
.punch:focus-visible { outline: 4px solid var(--text); outline-offset: 12px; border-radius: 50%; }
.punch small { font: 500 0.78rem var(--font-body); opacity: 0.85; }
.punch svg { width: 30px; height: 30px; margin: 0 auto 2px; }
.punch.out { background: var(--text); color: var(--surface); box-shadow: 0 0 0 10px var(--surface-2), var(--shadow); }
.punch.done { background: var(--present-soft); color: var(--present); box-shadow: 0 0 0 10px var(--surface-2); cursor: default; }
@media (max-width: 759px) { .hero-action { justify-items: stretch; } .punch { margin: 8px auto; } }
.punch-note { color: var(--muted); font-size: 0.84rem; text-align: center; max-width: 240px; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; }
.notice.holiday { background: var(--holiday-soft); color: var(--holiday); }
.notice.leave { background: var(--leave-soft); color: var(--leave); }
.notice.weekend { background: var(--weekend-soft); color: var(--text); }
.notice.warn { background: var(--late-soft); color: var(--late); }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-day { border-radius: 10px; padding: 8px 4px; text-align: center; display: grid; gap: 2px; font-size: 0.78rem; }
.week-day.st-none { background: var(--surface-2); }
.week-day b { font: 600 1rem var(--font-head); color: var(--text); }
.week-day.is-today { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ===================== Calendar ===================== */
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { text-align: center; min-width: 190px; }
.cal-title b { display: block; font: 600 1rem var(--font-head); }
.cal-title small { color: var(--muted); font-size: 0.8rem; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding-bottom: 4px; }
.cal-day {
  min-height: 68px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; justify-content: space-between; padding: 6px 7px; cursor: pointer; color: var(--text); font: inherit; text-align: left;
  position: relative;
}
.cal-day .ad { font: 600 0.95rem var(--font-head); }
.cal-day .bs { font-size: 0.68rem; color: var(--muted); align-self: flex-end; }
.cal-day .abbr { position: absolute; top: 6px; right: 7px; font: 700 0.62rem var(--font-mono); opacity: 0.9; }
.cal-day.st-present { background: var(--present-soft); border-color: transparent; }
.cal-day.st-late { background: var(--late-soft); border-color: transparent; }
.cal-day.st-absent { background: var(--absent-soft); border-color: transparent; }
.cal-day.st-leave { background: var(--leave-soft); border-color: transparent; }
.cal-day.st-holiday { background: var(--holiday-soft); border-color: transparent; }
.cal-day.st-weekend { background: var(--weekend-soft); border-color: transparent; }
.cal-day.st-present .abbr { color: var(--present); } .cal-day.st-late .abbr { color: var(--late); }
.cal-day.st-absent .abbr { color: var(--absent); } .cal-day.st-leave .abbr { color: var(--leave); }
.cal-day.st-holiday .abbr { color: var(--holiday); } .cal-day.st-weekend .abbr { color: var(--weekend); }
.cal-day.is-half { background-image: linear-gradient(135deg, transparent 50%, rgb(0 0 0 / 6%) 50%); }
.cal-day.is-today { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-day.is-selected { box-shadow: inset 0 0 0 2px var(--text); }
.cal-day.st-none { color: var(--muted); }
.cal-blank { visibility: hidden; }
@media (max-width: 520px) { .calendar { gap: 4px; } .cal-day { padding: 4px 5px; min-height: 48px; } .cal-day .bs { display: none; } .cal-day .abbr { top: auto; bottom: 4px; right: 5px; } }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 0.8rem; color: var(--muted); margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.day-detail { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.9rem; min-height: 46px; }

/* ===================== Leave ===================== */
.balances { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.balance { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 6px; }
.balance b { font: 700 1.3rem var(--font-head); }
.meter { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--leave); border-radius: inherit; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
.list-item:last-child { border-bottom: 0; }
.list-item .meta { color: var(--muted); font-size: 0.82rem; }
.list-item .reason { font-size: 0.88rem; grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 10px; font: 500 0.8rem var(--font-body); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: 600 0.84rem var(--font-body); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ===================== Settings ===================== */
.settings { display: grid; gap: 20px; }
.settings fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 0; display: grid; gap: 14px; }
.settings legend { font: 600 0.95rem var(--font-head); padding: 0 6px; }
.days-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.days-pick label { position: relative; }
.days-pick input { position: absolute; opacity: 0; inset: 0; }
.days-pick span { display: block; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.days-pick input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.days-pick input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ===================== Punch network / IP ===================== */
.net { display: inline-block; font-size: 0.74rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; margin-right: 6px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.net.ok { background: var(--accent-soft); color: var(--accent-strong); }
.net.warn { background: var(--late-soft); color: var(--late); }
.net-ip { font-size: 0.78rem; color: var(--muted); }
.net.est { background: transparent; border: 1px dashed var(--border); }
.net-now { font-size: 0.85rem; color: var(--muted); }
.net-now:empty { display: none; }
.net-now.blocked { background: var(--late-soft); color: var(--late); padding: 12px 14px; border-radius: var(--radius-sm); line-height: 1.7; }
.net-now.blocked .net-ip { color: inherit; }
.punch:disabled:not(.done) { opacity: 0.45; cursor: not-allowed; box-shadow: 0 0 0 10px var(--surface-2); }
.punch-net { display: grid; gap: 4px; }
.net-k { display: inline-block; width: 34px; font-size: 0.7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.stat .net-line { margin-top: 4px; }
.punch-detail { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 4px; font-size: 0.85rem; }
.punch-detail .label { font-weight: 600; font-size: 0.78rem; color: var(--muted); }
.net-rows { display: grid; gap: 10px; }
.net-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
@media (max-width: 560px) { .net-row { grid-template-columns: 1fr; } .net-row .net-del { justify-self: start; } }

/* ===================== Modal & toast ===================== */
.modal { border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgb(0 0 0 / 30%); max-height: calc(100vh - 32px); }
.modal::backdrop { background: rgb(10 20 18 / 45%); }
.modal form { display: grid; gap: 16px; padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head p { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 0.9rem; font-weight: 500; animation: toast-in 0.2s ease-out; display: flex; gap: 10px; align-items: center; }
.toast.error { background: var(--absent); color: #fff; }
.toast::before { content: '✓'; font-weight: 700; color: var(--present); }
:root[data-theme="dark"] .toast::before { color: #1e7a33; }
.toast.error::before { content: '!'; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---- Employee details page ---- */
a.person-link { color: inherit; text-decoration: none; border-radius: var(--radius-sm); }
a.person-link b { color: var(--accent-strong); }
a.person-link:hover b { text-decoration: underline; }
a.person-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.detail-title { margin-top: 10px; gap: 14px; }
.detail-title .avatar { width: 48px; height: 48px; font-size: 1rem; }
.detail-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.card-title { font-size: 1rem; margin-bottom: 12px; }
.facts { margin: 0; display: grid; gap: 10px; }
.facts > div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: baseline; }
.facts dt { color: var(--muted); font-size: 0.82rem; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---- Check-in modes / sessions ---- */
.mode-pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.mode-pick label { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.mode-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-pick input { margin-top: 3px; accent-color: var(--accent); }
.mode-pick b { display: block; }
.mode-pick small { color: var(--muted); font-size: 0.82rem; }
.tag.mode-tag { background: var(--accent-soft); color: var(--accent-strong); }
.ses-note { display: block; color: var(--muted); font: 500 0.72rem var(--font-body); white-space: nowrap; margin-top: 2px; cursor: help; }
.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sessions li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.sessions li > :last-child { margin-left: auto; }
.ses-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font: 700 0.72rem var(--font-head); }

/* ---- Live version: password screens ---- */
.card.narrow { max-width: 460px; margin: 24px auto; width: 100%; }
.card.narrow form { display: grid; gap: 14px; }
.facts.cred > div { grid-template-columns: 150px 1fr; }
