/* Chronix — mobile-first plain CSS */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1d4ed8;
  --brand-dark: #1e40af;
  --ok: #047857;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 0.75rem;
  background: #111827; color: #fff;
  padding: 0.6rem 1rem;
  position: sticky; top: 0; z-index: 10;
  flex-wrap: wrap;
}
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; margin-right: auto; }
.nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav a { color: #d1d5db; text-decoration: none; padding: 0.4rem 0.6rem; border-radius: 8px; }
.nav a:hover { background: #1f2937; color: #fff; }
.who { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: #d1d5db; }
.who-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 999px; background: #374151; color: #fff; }
.role-admin { background: #7c3aed; }
.role-it { background: #0369a1; }
.role-employee { background: #047857; }
.link-btn { background: none; border: none; color: #93c5fd; cursor: pointer; font-size: 0.85rem; padding: 0.4rem; }
/* Layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 2rem 1rem; }
h1 { font-size: 1.35rem; margin: 0.25rem 0 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card-title { font-weight: 700; margin-bottom: 0.75rem; }
details.card summary.card-title { cursor: pointer; }
.narrow { max-width: 26rem; margin: 2rem auto; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
/* Flash */
.flash { padding: 0.7rem 0.9rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.9rem; }
.flash-success { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
/* Forms */
.form label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 0.7rem; }
.form input, .form select {
  display: block; width: 100%; margin-top: 0.25rem;
  padding: 0.6rem 0.7rem; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.form input:focus, .form select:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 0.75rem; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.btn {
  display: inline-block; padding: 0.6rem 1rem; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 0.95rem; cursor: pointer; text-decoration: none; text-align: center;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.small { padding: 0.35rem 0.6rem; font-size: 0.82rem; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: end; }
.filters label { margin-bottom: 0; min-width: 9rem; flex: 1; }
.inline-form { display: inline; }
.inline-activate { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.inline-activate input { width: auto; flex: 1; min-width: 8rem; margin-top: 0; }
.inline-details { display: inline-block; margin-left: 0.4rem; }
.inline-details summary { list-style: none; cursor: pointer; }
/* AUX hour grid */
.auxgrid-wrap { border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; margin: 0 0 0.75rem; }
.auxgrid-wrap legend { font-weight: 700; font-size: 0.88rem; padding: 0 0.4rem; }
.auxgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
@media (min-width: 640px) { .auxgrid { grid-template-columns: repeat(6, 1fr); } }
.auxcell { font-size: 0.8rem; font-weight: 700; }
.auxcell input { margin-top: 0.2rem; padding: 0.45rem 0.4rem; }
.auxhour { display: block; font-weight: 400; color: var(--muted); font-size: 0.68rem; }
/* Tables */
.table-card { padding: 0.5rem; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 640px; }
.tbl th, .tbl td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { background: #f9fafb; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.tbl tr.totalrow td { background: #f9fafb; border-top: 2px solid var(--line); }
.pill { font-size: 0.75rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; background: #e5e7eb; }
.pill-Present { background: #d1fae5; color: var(--ok); }
.pill-Absent { background: #fee2e2; color: var(--danger); }
.pill-Leave { background: #fef3c7; color: var(--warn); }
.pill-WeekOff { background: #e0e7ff; color: #4338ca; }
/* Stat cards (employee home) */
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 0.5rem; text-align: center; }
.stat-num { display: block; font-size: 1.4rem; font-weight: 800; }
.stat-lbl { font-size: 0.72rem; color: var(--muted); }
.actions { white-space: nowrap; }
.actions .btn { margin-right: 0.25rem; }
code { background: #f3f4f6; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }

/* ---- Record sheet ---- */
.sheet-scroll { max-height: 70vh; overflow: auto; }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: 0.82rem; min-width: 2200px; }
table.sheet th, table.sheet td { border-bottom: 1px solid var(--line, #e5e7eb); border-right: 1px solid var(--line, #e5e7eb); padding: 0.35rem 0.5rem; white-space: nowrap; text-align: center; }
table.sheet thead th { background: var(--card-head, #f3f4f6); position: sticky; top: 0; z-index: 3; font-size: 0.75rem; }
table.sheet .sticky-col { position: sticky; left: 0; background: var(--card, #fff); z-index: 2; text-align: left; }
table.sheet thead .sticky-col { z-index: 4; }
table.sheet td.aux-hit { background: #fef9c3; font-weight: 700; }
table.sheet td.remarks { text-align: left; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.import-box { margin-top: 0.75rem; }
.import-box summary { display: inline-block; cursor: pointer; }
.import-box .form { margin-top: 0.75rem; }
.ok-card { border-left: 4px solid var(--ok, #16a34a); }
.warn-card { border-left: 4px solid var(--warn, #b45309); }
.skip-list { margin: 0.5rem 0 0 1.2rem; font-size: 0.85rem; }
.small { font-size: 0.82rem; }
.pad { padding: 1rem; }
