:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e5e7eb;
  --brand: #2456d6; --brand-dark: #1a43ad; --ok: #15803d; --ok-bg: #dcfce7;
  --late: #b45309; --late-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2;
  --info: #1d4ed8; --info-bg: #dbeafe; --grey-bg: #f1f2f4;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }
.wrap { max-width: 1150px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); } .small { font-size: .85em; } .nowrap { white-space: nowrap; }

.topbar { background: #111827; color: #fff; }
.topbar-in { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.05rem; margin-right: auto; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: #d1d5db; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.nav a:hover, .nav a.active { background: #374151; color: #fff; }
.count { background: #ef4444; color: #fff; border-radius: 10px; padding: 0 6px; font-size: .8em; }
.menu-btn { display: none; background: #374151; color: #fff; border: 0; border-radius: 6px; padding: 6px 12px; }
@media (max-width: 760px) {
  .menu-btn { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; padding-bottom: 10px; }
  .nav-open .nav { display: flex; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 12px 0; }
.card h2:first-child, .card h1:first-child { margin-top: 0; }
.form label { display: block; margin: 0 0 12px; font-weight: 500; }
.form label.radio, label.radio { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 6px 0; }
input, select, textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #cbd2dc; border-radius: 7px; background: #fff; margin-top: 4px; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; padding: 10px 14px; }
fieldset.days, .days { display: flex; flex-wrap: wrap; gap: 4px 18px; border: 0; padding: 0; margin: 0; }
fieldset[disabled] { opacity: .5; }
legend { font-weight: 600; padding: 0 4px; }
.grid2, .grid3, .grid4 { display: grid; gap: 0 16px; }
.grid2 { grid-template-columns: repeat(2, 1fr); } .grid3 { grid-template-columns: repeat(3, 1fr); } .grid4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filters label { margin: 0; font-weight: 500; }
.filters input, .filters select { width: auto; min-width: 150px; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: 150px; margin: 0; }

.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 7px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-dark); }
.btn-sm { padding: 4px 10px; font-size: .88em; }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid #c7d2fe; }
.btn-ghost:hover { background: #eef2ff; }
.btn-danger { background: var(--bad); } .btn-danger:hover { background: #991b1b; }
.btn-block { width: 100%; }
.btn-big { font-size: 1.3rem; padding: 16px 48px; border-radius: 12px; margin-top: 10px; }
.btn-out { background: #dc2626; } .btn-out:hover { background: #b91c1c; }

.flash { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.flash-ok { background: var(--ok-bg); color: #14532d; }
.flash-err { background: var(--bad-bg); color: #7f1d1d; }
.flash-warn { background: var(--late-bg); color: #78350f; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .88em; }
.s-late b { color: var(--late); } .s-absent b { color: var(--bad); } .s-notin b { color: var(--info); }

.punch { text-align: center; padding: 24px; }
.clock { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.done { color: var(--ok); font-weight: 600; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f9fafb; font-size: .82em; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.dim td { color: #9ca3af; background: #fafafa; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .85em; font-weight: 600; white-space: nowrap; background: var(--grey-bg); color: #374151; }
.b-present, .b-lv-approved { background: var(--ok-bg); color: var(--ok); }
.b-late, .b-lv-pending { background: var(--late-bg); color: var(--late); }
.b-absent, .b-lv-rejected { background: var(--bad-bg); color: var(--bad); }
.b-notin, .b-leave { background: var(--info-bg); color: var(--info); }
.t-late { color: var(--late); font-weight: 600; } .t-absent { color: var(--bad); font-weight: 600; }
.foot { color: var(--muted); font-size: .85em; padding: 24px 16px; }
code { background: var(--grey-bg); padding: 1px 5px; border-radius: 4px; }
