:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1f2733;
  --muted: #6b7688;
  --line: #e4e8f0;
  /* Replenia brand — coral accent on navy ink (Calvin-Works kit v2.8) */
  --brand: #E5484D;
  --brand-dark: #C73B40;
  --brand-soft: #fdecec;
  --navy: #1F2A44;
  --coral: #FF6B6F;
  --success: #1f9d62;
  --success-soft: #e6f6ee;
  --warn: #c47f12;
  --warn-soft: #fbf1dd;
  --danger: #d23f44;
  --danger-soft: #fdeaea;
  --info: #2f6fd0;
  --info-soft: #e7f0fc;
  --field-bg: #ffffff;
  --hover: #fafbfe;
  --track: #eef1f6;
  --chip: #eef1f6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 14px rgba(20, 30, 60, .05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f1420;
  --panel: #161c2b;
  --ink: #e6e9f0;
  --muted: #98a3b8;
  --line: #273249;
  --brand: #5b7dff;
  --brand-dark: #7d97ff;
  --brand-soft: #1d2747;
  --success: #3ecf8e;
  --success-soft: #123026;
  --warn: #e3a948;
  --warn-soft: #352815;
  --danger: #ff6b70;
  --danger-soft: #371a1c;
  --info: #5b9bff;
  --info-soft: #13243f;
  --field-bg: #0f1521;
  --hover: #1b2335;
  --track: #232d44;
  --chip: #232d44;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 18px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .pill,
[data-theme="dark"] .badge.muted { color: #c2cce0; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; background: #0f1b34; color: #cdd6ea; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 22px; font-size: 18px; font-weight: 750; color: #fff; letter-spacing: -.02em; }
.brand span { color: var(--coral); }
.nav { padding: 6px 12px; overflow-y: auto; flex: 1; }
.nav-group { margin-top: 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6c7ba0; padding: 0 10px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: #c2cce4; font-weight: 500; margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--brand); color: #fff; }
.nav-link .ic { width: 18px; text-align: center; opacity: .9; }

/* Compact quick-actions grid inside the EmployeeHub sidebar. Three columns
   of small icon tiles with tiny labels — replaces the old big-card row on
   the dashboard. Each tile sits in a 60-ish-px square; tooltips on hover. */
.quick-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px 6px 10px;
}
/* Horizontal quick-actions strip across the top of the EmployeeHub
   dashboard. Tiles share the same shape + 16px icon size as the old
   sidebar grid, but laid out as a flex row that wraps. Lives on the
   light main-content background so the colours are flipped (dark tile
   text on a near-white tile). */
.quick-strip {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 14px; margin: 0 0 18px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px;
}
.quick-strip .quick-tile {
  flex: 1 1 88px; max-width: 110px; min-width: 78px;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line);
}
.quick-strip .quick-tile:hover {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.quick-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 8px 4px; border-radius: 8px; text-decoration: none;
  color: #c2cce4; background: rgba(255,255,255,.03); position: relative;
  border: 1px solid transparent; font-size: 10px; line-height: 1.1; text-align: center;
}
.quick-tile:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.quick-tile .ic { font-size: 16px; opacity: .95; }
.quick-tile .qa-badge {
  position: absolute; top: 2px; right: 2px;
  font-size: 9px; padding: 1px 4px; border-radius: 8px; line-height: 1;
  background: #d34a4a; color: #fff; font-weight: 700;
}
.quick-tile .qa-badge.warn { background: #d39231; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #8a97b6; }
.sidebar-foot a { color: #aebbe0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--navy); border-bottom: 1px solid var(--navy);
  display: flex; align-items: center; gap: 24px; padding: 12px 26px; position: sticky; top: 0; z-index: 5;
}
.topbar .brand { padding: 0; display: inline-flex; align-items: center; }
.topbar .brand img { display: block; height: 60px; }
.topnav { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.topnav a { color: #cdd7e6; font-weight: 600; }
.topnav a:hover { color: #fff; text-decoration: none; }
.topnav a.muted { color: #9fb0c6; }
.topbar .who { font-weight: 600; color: #cdd7e6; }
.topbar .who small { display: block; color: #9fb0c6; font-weight: 500; }
.bell { position: relative; text-decoration: none; font-size: 18px; line-height: 1; }
.bell:hover { text-decoration: none; }
.bell-badge { position: absolute; top: -7px; right: -9px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 100px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.content { padding: 26px; max-width: 1180px; width: 100%; }

/* Main content container + footer (top-bar layout) */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 26px 50px; }
.foot { text-align: center; padding: 22px; }
.foot small { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .page { padding: 16px; } }

/* ---------------- Page header ---------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }

/* ---------------- Cards ---------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------------- Stat grid ---------------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr !important; } }

/* ---------------- Mobile navigation (off-canvas) ---------------- */
.hamburger { display: none; background: transparent; border: none; color: var(--ink);
  font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.nav-overlay { display: none; }
@media (max-width: 900px) {
  .hamburger { display: inline-block; }
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease; }
  .app.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .app.nav-open .nav-overlay { display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 55; }
  .content { padding: 16px; }
  .topbar { padding: 0 14px; }
  .topbar .who { font-size: 13px; }
}

.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 28px; font-weight: 720; margin-top: 4px; letter-spacing: -.02em; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.accent { border-left: 3px solid var(--brand); }
.stat.danger { border-left: 3px solid var(--danger); }
.stat.warn { border-left: 3px solid var(--warn); }
.stat.success { border-left: 3px solid var(--success); }

/* ---------------- Tables ---------------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ---------------- Badges ---------------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 100px; font-size: 12px; font-weight: 600; line-height: 1.6; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.muted { background: var(--chip); color: var(--muted); }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }

.pill { display:inline-block; background:var(--chip); color:var(--muted); border-radius:100px; padding:1px 8px; font-size:11px; font-weight:600; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 8px; font-size: 13px;
  font-weight: 600; font-family: inherit; transition: .12s; text-decoration: none;
}
.btn:hover { border-color: #cfd6e4; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: #41506a; }
.field .hint { font-size: 11px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: var(--field-bg); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 70px; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------------- Progress ---------------- */
.progress { background: var(--track); border-radius: 100px; height: 8px; overflow: hidden; min-width: 80px; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 100px; }
.progress.success > span { background: var(--success); }
.progress-label { display: flex; align-items: center; gap: 8px; }
.progress-label small { color: var(--muted); font-variant-numeric: tabular-nums; width: 34px; text-align: right; }

/* ---------------- Misc ---------------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.person { display: flex; align-items: center; gap: 10px; }
.person small { color: var(--muted); display: block; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .ic { font-size: 30px; display: block; margin-bottom: 8px; opacity: .5; }
.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.flash.success { background: var(--success-soft); color: var(--success); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=text], .toolbar select { width: auto; min-width: 180px; }
.toolbar .spacer { flex: 1; }
.stars { color: #e0a92b; letter-spacing: 1px; }
.stars .off { color: #d7dce6; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------------- Login ---------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f1b34, #1F2A44); padding: 20px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 420px; padding: 32px; overflow: hidden; }
.login-logo-band { background: var(--navy); margin: -32px -32px 22px; padding: 30px 28px; border-radius: 14px 14px 0 0; text-align: center; }
.login-logo { width: 280px; max-width: 100%; display: block; margin: 0 auto; }
.login-sub { color: var(--muted); margin-bottom: 18px; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 6px; font-weight: 600; }
.ms-logo { display: inline-grid; grid-template-columns: 9px 9px; grid-gap: 2px; }
.ms-logo span { width: 9px; height: 9px; display: block; }
.ms-logo span:nth-child(1) { background: #f25022; }
.ms-logo span:nth-child(2) { background: #7fba00; }
.ms-logo span:nth-child(3) { background: #00a4ef; }
.ms-logo span:nth-child(4) { background: #ffb900; }
.login-card .field { margin-bottom: 14px; }
.demo-creds { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; font-size: 12px; color: var(--muted); }
.demo-creds code { background: #f1f3f8; padding: 1px 6px; border-radius: 5px; color: var(--ink); }
.demo-creds .demo-row { cursor: pointer; padding: 5px 8px; border-radius: 6px; display:flex; justify-content:space-between; }
.demo-creds .demo-row:hover { background: #f5f7fb; }
.sso-sep { display:flex; align-items:center; text-align:center; color:var(--muted); font-size:12px; margin:14px 0; }
.sso-sep::before, .sso-sep::after { content:""; flex:1; height:1px; background:var(--line); }
.sso-sep span { padding:0 10px; }
