/* ==========================================================================
   Malaysia HR System — design tokens
   Palette inspired by pewter/tin (a Malaysian craft export) and songket gold,
   kept restrained: one deep ink-teal, one warm gold accent, cool neutrals.
   ========================================================================== */
:root {
  --ink: #10302E;          /* deep teal-black — sidebar, headings */
  --ink-2: #17423F;        /* lighter panel within sidebar */
  --accent: #C08A2E;       /* songket gold — used sparingly for actions/emphasis */
  --accent-soft: #F1E3C6;  /* pale gold wash for highlights */
  --leaf: #3C7A6B;         /* secondary accent — active states, links */
  --bg: #F4F6F4;           /* cool off-white page background */
  --panel: #FFFFFF;
  --border: #DDE3DE;
  --text: #17211F;
  --text-muted: #5C6A66;
  --danger: #B3432F;
  --success: #2F7D57;
  --warning: #C08A2E;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 48, 46, 0.06), 0 4px 14px rgba(16, 48, 46, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.4em 0;
}

a { color: var(--leaf); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--ink);
  color: #E7EFEC;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand .dot { color: var(--accent); }
.brand-sub {
  font-size: 0.72rem;
  color: #9FB6AE;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
}

.nav-group { margin-bottom: 22px; }
.nav-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7FA79B;
  margin: 0 0 8px 4px;
}
.nav-link {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: #D6E4DF;
  font-size: 0.92rem;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--ink-2); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--leaf); color: #fff; font-weight: 600; }

.sidebar-footer {
  margin-top: auto;
  font-size: 0.72rem;
  color: #7FA79B;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
}

.user-card {
  background: var(--ink-2);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 22px;
}
.user-name { font-size: 0.86rem; font-weight: 600; color: #fff; }
.user-role { font-size: 0.72rem; color: #9FB6AE; margin-top: 2px; }
.role-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.role-admin { background: var(--accent); color: #fff; }
.role-hr { background: var(--leaf); color: #fff; }
.role-employee { background: rgba(255,255,255,0.15); color: #E7EFEC; }

.logout-btn-sidebar {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #D6E4DF;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.logout-btn-sidebar:hover { background: rgba(255,255,255,0.08); }

/* ---------- Main content ---------- */
.main { padding: 30px 38px 60px; max-width: 1200px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header .eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--leaf);
  font-weight: 600;
  margin-bottom: 4px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 22px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-card .label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-card .value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ink);
}
.stat-card .value.accent { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--leaf); color: #fff; }
.btn-primary:hover { background: #2f6759; text-decoration: none; color: #fff; }
.btn-gold { background: var(--accent); color: #fff; }
.btn-gold:hover { background: #a5761f; color: #fff; text-decoration: none; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--leaf); color: var(--leaf); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #942f20; color: #fff; text-decoration: none; }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  padding: 10px 10px;
}
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFA; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-success { background: #E4F2E9; color: var(--success); }
.badge-warning { background: var(--accent-soft); color: #8B6320; }
.badge-danger { background: #F7E4E0; color: var(--danger); }
.badge-neutral { background: #EAEDEB; color: var(--text-muted); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
input, select, textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(60, 122, 107, 0.15);
}
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

.search-box { display: flex; gap: 8px; margin-bottom: 16px; }
.search-box input { flex: 1; max-width: 320px; }

/* ---------- Flash messages ---------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.88rem; font-weight: 500; }
.flash-success { background: #E4F2E9; color: var(--success); }
.flash-danger { background: #F7E4E0; color: var(--danger); }
.flash-warning { background: var(--accent-soft); color: #8B6320; }

/* ---------- Misc ---------- */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.disclaimer {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #6B4E17;
  margin-bottom: 20px;
}
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.app-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--text-muted);
  text-align: center;
}

@media print {
  .sidebar, .no-print { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; max-width: none; }
}
