/* ============================================================
   AttendanceHR v2 — premium light theme
   Type: Plus Jakarta Sans (one family, 400/600/800)
   Palette: Ink #16202e · Paper #f5f6fa · Royal #3454d1 · Mint #0f9d8a
            Rose #d6455d · Amber #c77414 · Line #e5e8f0
   ============================================================ */
:root {
  --primary: #3454d1;
  --primary-deep: #2a43ab;
  --primary-soft: #eaeefc;
  --teal: #0f9d8a;
  --teal-soft: #e3f5f1;
  --rose: #d6455d;
  --rose-soft: #fcebee;
  --amber: #c77414;
  --amber-soft: #fdf1e0;
  --violet: #7048c8;
  --violet-soft: #f0eafa;
  --bg: #f5f6fa;
  --card: #ffffff;
  --ink: #16202e;
  --muted: #68758a;
  --border: #e5e8f0;
  --editable: #fffbea;
  --calculated: #eefaf4;
  --sidebar-w: 252px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(22, 32, 46, .04), 0 10px 28px -12px rgba(22, 32, 46, .10);
  --shadow-lift: 0 2px 4px rgba(22, 32, 46, .06), 0 18px 36px -14px rgba(52, 84, 209, .22);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(52, 84, 209, .055), transparent 60%),
    radial-gradient(700px 380px at -10% 110%, rgba(15, 157, 138, .05), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-deep); }
::selection { background: rgba(52, 84, 209, .18); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #cdd3e1; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b2bace; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(175deg, #101828 0%, #15223c 70%, #182747 100%);
  color: #c3cde2;
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  z-index: 100;
}
.sidebar .brand {
  padding: 22px 20px 16px;
  font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: #fff;
  display: flex; align-items: center; gap: 11px;
}
.sidebar .brand .logo {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary) 0%, #5a7af0 55%, var(--teal) 130%);
  box-shadow: 0 6px 16px -6px rgba(52, 84, 209, .8), inset 0 1px 0 rgba(255,255,255,.35);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 12px 22px; }
.sidebar .nav-section {
  font-size: 11px; font-weight: 700; color: #5f7093;
  margin: 18px 12px 6px; letter-spacing: .02em;
}
.sidebar a.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 12px; margin: 2px 0;
  color: #c3cde2; border-radius: 11px; font-weight: 600; font-size: 13.5px;
  transition: background .14s, color .14s;
}
.sidebar a.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar a.nav-link.active {
  background: linear-gradient(135deg, var(--primary), #4a67e0);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(52, 84, 209, .9), inset 0 1px 0 rgba(255,255,255,.22);
}
.sidebar .icon { width: 20px; text-align: center; opacity: .92; font-size: 14px; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 90;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(12px) saturate(1.3);
  border-bottom: 1px solid var(--border);
  padding: 11px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--teal) 45%, transparent 75%);
  opacity: .55;
}
.topbar .page-title { font-size: 17px; font-weight: 800; letter-spacing: -.015em; }
.topbar .user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.topbar .today-chip {
  background: var(--primary-soft); color: var(--primary-deep);
  padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 12px;
}
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.content { padding: 24px 26px 56px; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 20px; overflow: hidden;
}
.card .card-head {
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(180deg, #fbfcfe, #fff);
}
.card .card-head h3 { margin: 0; font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; }
.card .card-body { padding: 18px 20px; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 16px 13px; position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi .value {
  font-size: 23px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi .sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--primary); border-radius: 4px 0 0 4px;
}
.kpi::after {
  content: ""; position: absolute; right: -36px; top: -36px; width: 96px; height: 96px;
  border-radius: 50%; background: var(--primary-soft); opacity: .55;
}
.kpi > * { position: relative; z-index: 1; }
.kpi.green::before { background: var(--teal); } .kpi.green::after, .kpi.teal::after { background: var(--teal-soft); }
.kpi.red::before { background: var(--rose); } .kpi.red::after { background: var(--rose-soft); }
.kpi.orange::before, .kpi.amber::before { background: var(--amber); }
.kpi.orange::after, .kpi.amber::after { background: var(--amber-soft); }
.kpi.purple::before { background: var(--violet); } .kpi.purple::after { background: var(--violet-soft); }
.kpi.teal::before { background: var(--teal); }
.kpi.grey::before { background: #9aa6bb; } .kpi.grey::after { background: #eef1f6; }

/* ---------- filter bar ---------- */
.filter-bar {
  position: sticky; top: 58px; z-index: 80;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 16px; margin-bottom: 20px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
}
.filter-bar .field { display: flex; flex-direction: column; gap: 5px; }
.filter-bar label { font-size: 11.5px; font-weight: 700; color: var(--muted); }

/* ---------- forms ---------- */
select, input[type=text], input[type=number], input[type=date], input[type=time],
input[type=email], input[type=password], input[type=file], textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7.5px 11px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px rgba(52, 84, 209, .14);
}
select:hover, input:hover { border-color: #ccd3e2; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 15px; }
.form-grid .field { display: flex; flex-direction: column; gap: 5px; }
.form-grid label { font-size: 12px; font-weight: 700; color: var(--muted); }
.checkbox-row { display: flex; align-items: center; gap: 8px; padding-top: 22px; font-weight: 600; }
input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; }
.validation-summary-errors, .field-validation-error { color: var(--rose); font-size: 12.5px; font-weight: 600; }
.validation-summary-errors ul { margin: 6px 0; padding-left: 18px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 15px; font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
  background: linear-gradient(180deg, #4663df, var(--primary));
  color: #fff; transition: transform .13s, box-shadow .13s, background .13s;
  text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(22,32,46,.12), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn:hover { background: linear-gradient(180deg, #3d58d6, var(--primary-deep)); color: #fff; transform: translateY(-1px); box-shadow: 0 8px 18px -8px rgba(52,84,209,.65); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--border); box-shadow: 0 1px 2px rgba(22,32,46,.05); }
.btn.secondary:hover { background: #f5f7fd; box-shadow: 0 6px 14px -8px rgba(22,32,46,.25); }
.btn.success { background: linear-gradient(180deg, #16b096, var(--teal)); }
.btn.success:hover { background: linear-gradient(180deg, #0f9d8a, #0c8475); }
.btn.danger { background: linear-gradient(180deg, #e05a70, var(--rose)); }
.btn.danger:hover { background: #bd3a51; }
.btn.warning { background: linear-gradient(180deg, #d98a2b, var(--amber)); }
.btn.warning:hover { background: #ad640f; }
.btn.teal { background: linear-gradient(180deg, #16b096, var(--teal)); }
.btn.teal:hover { background: #0c8475; }
.btn.sm { padding: 5.5px 11px; font-size: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.grid thead th {
  position: sticky; top: 0; z-index: 5;
  background: #f3f5fb; color: #4a5872; font-weight: 700; font-size: 11.5px;
  padding: 11px 11px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
  box-shadow: 0 1px 0 var(--border);
}
table.grid tbody td { padding: 8px 11px; border-bottom: 1px solid #eef0f6; vertical-align: middle; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.grid tbody tr { transition: background .1s; }
table.grid tbody tr:hover { background: #f6f8ff; }
td.editable { background: var(--editable); }
td.calc { background: var(--calculated); color: #0b6e4f; font-weight: 700; }
td.num, th.num { text-align: right; }
tr.row-locked { opacity: .6; }
tr.row-off { background: #fafbfd; }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 3.5px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
}
.badge.success { background: var(--teal-soft); color: #0b6e5f; }
.badge.danger { background: var(--rose-soft); color: #a62a40; }
.badge.warning { background: var(--amber-soft); color: #955208; }
.badge.primary { background: var(--primary-soft); color: var(--primary-deep); }
.badge.secondary { background: #eceff5; color: #4a5872; }
.badge.purple { background: var(--violet-soft); color: #532fa3; }
.badge.teal { background: var(--teal-soft); color: #0b6e5f; }
.badge.info { background: #e3f2fb; color: #175e85; }
.badge.darkred { background: #fbe3e9; color: #8c1f38; }
.badge.indigo { background: #e7e9fc; color: #37389e; }
.badge.orange { background: #fdeadb; color: #9a4e07; }
.badge.amber { background: var(--amber-soft); color: #8d5106; }

/* ---------- toast ---------- */
.toast-holder { position: fixed; top: 18px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-left: 5px solid var(--primary);
  border-radius: 12px; box-shadow: var(--shadow-lift); padding: 13px 16px;
  min-width: 280px; max-width: 440px; font-weight: 700; font-size: 13px;
  animation: slideIn .28s cubic-bezier(.2,.9,.3,1.2);
}
.toast.success { border-left-color: var(--teal); }
.toast.danger { border-left-color: var(--rose); }
.toast.warning { border-left-color: var(--amber); }
@keyframes slideIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }

/* ---------- charts ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(390px, 1fr)); gap: 20px; margin-bottom: 20px; }
.chart-card { min-height: 290px; }
.chart-card canvas { max-height: 240px; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(760px 420px at 20% 15%, rgba(52, 84, 209, .35), transparent 60%),
    radial-gradient(640px 420px at 85% 85%, rgba(15, 157, 138, .28), transparent 60%),
    linear-gradient(165deg, #101828 0%, #15223c 60%, #182747 100%);
}
.login-card {
  background: #fff; border-radius: 22px;
  box-shadow: 0 32px 80px -16px rgba(5, 12, 28, .55), inset 0 1px 0 rgba(255,255,255,.6);
  padding: 38px 36px; width: 410px; max-width: 92vw;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; font-weight: 600; }
.login-card .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.login-card label { font-size: 12px; font-weight: 700; color: var(--muted); }
.login-card input { width: 100%; }

/* ---------- misc ---------- */
.lock-banner {
  background: var(--amber-soft); border: 1px solid #f3d9ae; color: #8d5106;
  border-radius: 12px; padding: 11px 15px; margin-bottom: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 9px;
}
.empty { text-align: center; color: var(--muted); padding: 40px 10px; font-weight: 600; }
.skeleton {
  background: linear-gradient(90deg, #edf0f7 25%, #e2e7f2 37%, #edf0f7 63%);
  background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 10px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 5.5px 12px; border: 1px solid var(--border); border-radius: 9px; background: #fff; font-weight: 700;
}
.pagination span.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.help-section h4 { margin: 20px 0 6px; font-weight: 800; }
.help-section p, .help-section li { color: #3a4659; line-height: 1.65; }
.help-section code { background: #f1f3fa; border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.inline-warning { color: #955208; font-size: 12px; font-weight: 700; }
.text-muted { color: var(--muted); }
.mt-2 { margin-top: 10px; } .mb-0 { margin-bottom: 0; }
.hide { display: none !important; }

/* page-level busy state (filter changes, navigation) */
body.busy .content { opacity: .45; pointer-events: none; transition: opacity .2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.print-only { display: none; }
@media print {
  .print-only { display: flex !important; }
  .sidebar, .topbar, .filter-bar, .btn, .btn-row, .no-print { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .filter-bar { position: static; }
}
