/* Payrol design system — pure CSS, no JS, CSP-strict friendly */
:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --ink: #17233b;
  --ink-2: #45526e;
  --dim: #8a94a8;
  --line: #e5e9f1;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: #eaf0fe;
  --ok: #0e9f6e;    --ok-soft: #e3f6ef;
  --warn: #b45309;  --warn-soft: #fdf1e0;
  --err: #dc2626;   --err-soft: #fdeaea;
  --sidebar: #0d1b33;
  --sidebar-2: #13264a;
  --sidebar-ink: #b7c3da;
  --shadow: 0 1px 2px rgba(23,35,59,.05), 0 4px 16px rgba(23,35,59,.06);
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 18px; }
h1 .dim { font-size: 15px; font-weight: 500; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em;
     margin: 28px 0 10px; color: var(--ink-2); text-transform: uppercase;
     font-size: 12.5px; letter-spacing: .06em; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content main { padding: 26px 34px 60px; max-width: 1240px; width: 100%; margin: 0 auto; }
.content.anon { justify-content: center; }
.content.anon main { display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 216px; flex-shrink: 0; padding: 20px 14px;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-ink); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px;
  font-weight: 750; color: #fff; letter-spacing: -.02em; padding: 2px 8px 18px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; box-shadow: 0 4px 12px rgba(59,130,246,.4);
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: #5c6f93; margin: 16px 8px 4px; font-weight: 700; }
.sidebar a {
  color: var(--sidebar-ink); padding: 7px 10px; border-radius: 8px;
  font-weight: 500; font-size: 13.5px;
}
.sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar a.active { background: rgba(59,130,246,.18); color: #fff; font-weight: 600;
  box-shadow: inset 2px 0 0 #3b82f6; }
.sidebar-foot { margin-top: auto; padding: 16px 8px 4px; font-size: 11px;
  color: #4d5f81; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 10px 34px; position: sticky; top: 0; z-index: 5;
}
.spacer { flex: 1; }
.user-chip { background: var(--accent-soft); color: var(--accent-2);
  padding: 5px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.user-chip.attention { background: var(--warn-soft); color: var(--warn); }
.user-chip:hover { text-decoration: none; filter: brightness(.97); }
.topbar-link { color: var(--ink-2); font-size: 13px; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin: 6px 0 22px; }
.card { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; color: var(--dim);
  box-shadow: var(--shadow); font-size: 12.5px; font-weight: 550; }
.card .big { font-size: 28px; font-weight: 750; color: var(--ink);
  letter-spacing: -.03em; line-height: 1.2; margin-bottom: 2px; }
.cols { display: flex; flex-wrap: wrap; gap: 26px; }
.cols section { flex: 1; min-width: 340px; }

/* ---------- tables ---------- */
table { border-collapse: separate; border-spacing: 0; width: 100%;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin: 10px 0 18px;
  box-shadow: var(--shadow); }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line);
  font-size: 13.5px; }
th { background: #f8fafd; font-weight: 650; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td, table tr:hover td { background: #fafbfe; }
td pre { margin: 0; font-size: 11.5px; white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
table.plain, table.plain td { border: none; background: none; box-shadow: none; }
table.plain tr:hover td { background: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { border-top: 2px solid var(--ink); font-weight: 700; }

/* status colors — used on td/span via .ok/.warn/.error */
.ok    { color: var(--ok);   font-weight: 600; }
.warn  { color: var(--warn); font-weight: 600; }
.error { color: var(--err);  font-weight: 600; }
.dim   { color: var(--dim); font-weight: 400; }
td.ok    { background: var(--ok-soft); }
td.warn  { background: var(--warn-soft); }
td.error { background: var(--err-soft); }
tr:hover td.ok { background: var(--ok-soft); }
tr:hover td.warn { background: var(--warn-soft); }
tr:hover td.error { background: var(--err-soft); }

/* ---------- forms ---------- */
form label { display: block; margin: 12px 0 5px; font-weight: 600;
  font-size: 12.5px; color: var(--ink-2); }
input, select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font: inherit; max-width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
button {
  padding: 9px 18px; border: none; border-radius: 9px; cursor: pointer;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #fff; font: inherit; font-weight: 650; margin-top: 10px;
  box-shadow: 0 1px 2px rgba(29,78,216,.35);
  transition: filter .12s, transform .05s;
}
button:hover { filter: brightness(1.07); }
button:active { transform: translateY(1px); }
button:disabled { background: #b6bfd0; box-shadow: none; cursor: default; }
button.secondary { background: #fff; color: var(--ink-2);
  border: 1px solid var(--line); box-shadow: none; }
button.secondary:hover { background: #f6f8fc; }
button.danger { background: #fff; color: var(--err);
  border: 1px solid #f3c6c6; box-shadow: none; }
button.danger:hover { background: var(--err-soft); }
button.linklike { background: none; color: var(--ink-2); padding: 0; margin: 0;
  box-shadow: none; font-weight: 500; font-size: 13px; }
button.linklike:hover { color: var(--err); filter: none; }
.btnlike { background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #fff; padding: 9px 18px; border-radius: 9px; display: inline-block;
  font-weight: 650; box-shadow: 0 1px 2px rgba(29,78,216,.35); }
.btnlike:hover { text-decoration: none; filter: brightness(1.07); }

.filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px; margin: 12px 0;
  box-shadow: var(--shadow); }
.filters label { margin: 0; }
.filters button, .filters .btnlike { margin-top: 0; }
.formgrid { max-width: 500px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow); }
.formgrid input, .authbox input { width: 100%; }
label.check { font-weight: 500; color: var(--ink); }
label.check input { width: auto; margin-right: 6px; }
.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 12px 0 18px; }
.actions button, .actions .btnlike { margin-top: 0; }

/* ---------- auth ---------- */
.authbox { width: 400px; max-width: 94vw; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 34px 34px 28px;
  box-shadow: 0 8px 40px rgba(23,35,59,.12); }
.authbox h1 { margin: 0 0 2px; font-size: 26px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.authbox button { width: 100%; margin-top: 18px; padding: 11px; }
.authbox p.dim { margin-top: 0; }

/* ---------- misc ---------- */
details { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 18px; margin: 14px 0;
  box-shadow: var(--shadow); }
summary { cursor: pointer; font-weight: 650; color: var(--ink-2); }
details[open] summary { margin-bottom: 8px; }
code { background: #eef2f9; padding: 2px 7px; border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
p.error { background: var(--err-soft); color: var(--err); padding: 10px 14px;
  border-radius: 9px; font-weight: 600; }
p.ok { background: var(--ok-soft); color: var(--ok); padding: 10px 14px;
  border-radius: 9px; font-weight: 600; }
p.warn { background: var(--warn-soft); color: var(--warn); padding: 10px 14px;
  border-radius: 9px; font-weight: 600; }
svg { max-width: 100%; }

.payslip { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 30px; max-width: 780px;
  box-shadow: var(--shadow); }

/* ---------- polish: motion, depth, a11y ---------- */
@media (prefers-reduced-motion: no-preference) {
  .content main { animation: rise .25s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); }
                    to { opacity: 1; transform: none; } }
  .card { transition: transform .15s ease, box-shadow .15s ease; }
  .card:hover { transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(23,35,59,.10); }
}
::selection { background: #cfdefb; }
:focus-visible { outline: 3px solid rgba(37,99,235,.45); outline-offset: 2px;
  border-radius: 6px; }
tr:nth-child(even) td { background: #fbfcfe; }
tr:nth-child(even):hover td { background: #f6f8fd; }
th { position: sticky; top: 49px; z-index: 3; }
.content.anon th { position: static; }
h1 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sidebar a { transition: background .12s, color .12s; }
.sidebar a.active { position: relative; }
summary:hover { color: var(--accent); }
input::placeholder { color: #b3bccb; }
table a { font-weight: 600; }
td .dim { font-size: 12px; }
.card .dim { margin-top: 3px; font-size: 11.5px; font-weight: 450; }
.authbox { animation: none; }
.auth-note { margin-top: 18px; text-align: center; font-size: 11.5px;
  color: var(--dim); border-top: 1px solid var(--line); padding-top: 14px; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .content main { padding: 18px; }
  .topbar { padding: 10px 18px; position: static; }
  th { position: static; }
  .cols section { min-width: 100%; }
}
@media print {
  .sidebar, .topbar, .actions, form { display: none !important; }
  body { background: #fff; }
  .payslip { border: none; box-shadow: none; }
}
