/* HRMS design system — "personnel ledger" theme.
   Tokens + components layered on top of Tailwind (CDN) utilities. */

:root {
  --ink: #1b2333;
  --ink-soft: #3a4660;
  --muted: #6b7385;
  --paper: #f5f3ee;
  --card: #ffffff;
  --line: #e6e2d8;
  --accent: #2f6f6a;        /* deep teal */
  --accent-deep: #245955;
  --warm: #c9883a;          /* amber */
  --ok: #2e7d5b;
  --ok-bg: #e7f1ec;
  --warn: #b07b2a;
  --warn-bg: #f6edda;
  --bad: #b3454a;
  --bad-bg: #f6e6e6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(27, 35, 51, .04), 0 8px 24px rgba(27, 35, 51, .06);
}

* { box-sizing: border-box; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv05", "ss01";
  margin: 0;
}

h1, h2, h3, .display {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -0.01em;
}

.tnum { font-variant-numeric: tabular-nums; }
.rec-id {
  font-family: "Space Grotesk", monospace;
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--muted);
}

/* ---- App shell ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--ink);
  color: #cfd6e4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.25rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--warm));
  display: grid; place-items: center;
  font-family: "Space Grotesk", sans-serif; font-weight: 700;
  color: #fff; font-size: .95rem;
}
.brand-name {
  font-family: "Space Grotesk", sans-serif; font-weight: 600;
  color: #fff; font-size: 1.05rem; letter-spacing: .02em;
}
.brand-name small { display: block; font-size: .62rem; color: #8a93a8;
  letter-spacing: .14em; text-transform: uppercase; font-weight: 500; }

.nav { padding: .9rem .7rem; overflow-y: auto; flex: 1; }
.nav-label {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .14em;
  color: #717c93; padding: .8rem .8rem .3rem;
}
.nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .8rem; border-radius: 9px;
  color: #c2cad9; text-decoration: none; font-size: .9rem;
  font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active { background: rgba(47, 111, 106, .22); color: #fff; }
.nav-link.active::before {
  content: ""; position: absolute; left: -.7rem; top: 50%;
  transform: translateY(-50%); width: 3px; height: 22px;
  background: var(--warm); border-radius: 0 3px 3px 0;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.6rem; background: rgba(247, 246, 243, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 1.15rem; margin: 0; font-weight: 600; }
.topbar-sub { font-size: .78rem; color: var(--muted); }
.user-chip { display: flex; align-items: center; gap: .6rem; }
.content { padding: 1.7rem 1.6rem 3rem; max-width: 1200px; width: 100%; }

/* ---- Avatar (signature element) ---- */
.avatar {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
  font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: .82rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.avatar.lg { width: 64px; height: 64px; border-radius: 14px; font-size: 1.3rem; }
.avatar.sm { width: 30px; height: 30px; border-radius: 8px; font-size: .68rem; }

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 1.2rem 1.3rem; }

.stat-card { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
  position: relative; overflow: hidden; }
.stat-card .label { font-size: .72rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); }
.stat-card .value { font-family: "Space Grotesk", sans-serif; font-weight: 600;
  font-size: 2rem; line-height: 1.1; margin-top: .35rem; color: var(--ink); }
.stat-card .foot { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.stat-card .tab { position: absolute; top: 0; left: 0; width: 4px; height: 100%; }

/* ---- Tables ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl thead th {
  text-align: left; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); font-weight: 600;
  padding: .55rem .85rem; border-bottom: 1px solid var(--line);
}
.tbl tbody td { padding: .7rem .85rem; border-bottom: 1px solid var(--line);
  vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #faf9f5; }
.tbl a.row-link { color: var(--ink); text-decoration: none; font-weight: 600; }
.tbl a.row-link:hover { color: var(--accent); }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .01em;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: #eef0f4; color: var(--ink-soft); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem .95rem; border-radius: 9px; font-size: .87rem;
  font-weight: 600; cursor: pointer; border: 1px solid transparent;
  text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { filter: brightness(.94); }
.btn-bad { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn-bad:hover { background: var(--bad-bg); }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; }

/* ---- Forms ---- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .8rem; font-weight: 600;
  color: var(--ink-soft); margin-bottom: .35rem; }
.input, .select, textarea.input {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--line);
  border-radius: 9px; font-size: .9rem; font-family: inherit; background: #fff;
  color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 106, .15);
}
.field-error { color: var(--bad); font-size: .78rem; margin-top: .3rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.1rem; }

.section-head { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.1rem; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { font-size: 1.05rem; margin: 0; }
.eyebrow { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); font-weight: 600; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.flash { padding: .7rem 1rem; border-radius: 9px; margin-bottom: 1.1rem;
  font-size: .87rem; background: var(--ok-bg); color: var(--ok);
  border: 1px solid #cfe6da; }

/* ---- Mobile ---- */
.menu-btn { display: none; background: none; border: none; cursor: pointer;
  color: var(--ink); padding: .3rem; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .scrim.show { display: block; position: fixed; inset: 0;
    background: rgba(27, 35, 51, .45); z-index: 40; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 1.2rem 1rem 3rem; }
  .hide-mobile { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
