/* ============================================================
   EMPLOYEE INFORMATION SYSTEM — Design System
   Theme: Maroon & Gold · Corporate · Sharp · Bold
   Fonts: Libre Baskerville (headings) + Source Sans 3 (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@300;400;600;700;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Core Palette ── */
  --maroon:        #6B0F1A;
  --maroon-dark:   #4A0A12;
  --maroon-deep:   #2D0609;
  --heading-accent: var(--maroon-dark); /* headings/titles — swaps to a lighter tone in dark mode for readability */
  --maroon-mid:    #8B1A28;
  --maroon-light:  #A52233;
  --gold:          #C9963A;
  --gold-light:    #E8B84B;
  --gold-pale:     #F5D98A;
  --gold-muted:    #7A5A1E;

  /* ── UI Colors ── */
  --white:         #FFFFFF;
  --off-white:     #FAF8F5;
  --surface:       #F5F2EE;
  --border:        #E0D8CF;
  --border-dark:   #C8BCB0;
  --text:          #1A1108;
  --text-mid:      #3D2E1E;
  --text-muted:    #7A6A58;
  --text-light:    #A89880;

  /* ── Status Colors ── */
  --success:       #1A6B3C;
  --success-bg:    #EBF7F0;
  --danger:        #8B1A1A;
  --danger-bg:     #FCEAEA;
  --warning:       #7A5200;
  --warning-bg:    #FFF8E6;

  /* ── Layout ── */
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        14px;
  --radius-sm:     8px;
  --radius-md:     10px;
  --radius-lg:     20px;
  --radius-pill:   999px;

  /* ── Shadows ── */
  --shadow-sm:     0 1px 2px rgba(26,1,4,0.06), 0 1px 3px rgba(26,1,4,0.08);
  --shadow-md:     0 6px 20px rgba(26,1,4,0.09), 0 2px 6px rgba(26,1,4,0.06);
  --shadow-lg:     0 20px 50px rgba(26,1,4,0.16), 0 6px 16px rgba(26,1,4,0.08);
  --shadow-glow:   0 0 0 4px rgba(201,150,58,0.12);
}

/* ============================================================
   DARK THEME — toggled via data-theme="dark" on <html>
   Brand palette (maroon/gold) stays, UI surface colors flip.
   ============================================================ */
[data-theme="dark"] {
  --gold-light:    #F0C567;
  --heading-accent: #F0C567; /* was maroon-dark (#4A0A12) — invisible on dark surfaces; use gold accent instead */

  --white:         #241A12;
  --off-white:     #17110B;
  --surface:       #2C2117;
  --border:        #3E2F21;
  --border-dark:   #52402D;
  --text:          #F2E9DD;
  --text-mid:      #D9C9B4;
  --text-muted:    #A8927A;
  --text-light:    #7A6752;

  --success:       #3FCB7A;
  --success-bg:    rgba(63,203,122,0.12);
  --danger:        #F0605E;
  --danger-bg:     rgba(240,96,94,0.12);
  --warning:       #F0B94D;
  --warning-bg:    rgba(240,185,77,0.12);

  --shadow-sm:     0 1px 2px rgba(0,0,0,0.30), 0 1px 3px rgba(0,0,0,0.25);
  --shadow-md:     0 6px 20px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.25);
  --shadow-lg:     0 20px 50px rgba(0,0,0,0.5), 0 6px 16px rgba(0,0,0,0.3);
  --shadow-glow:   0 0 0 4px rgba(240,197,103,0.15);
}
[data-theme="dark"] .badge-draft,
[data-theme="dark"] .badge-cancelled,
[data-theme="dark"] .badge-inactive {
  background: #332818; color: #C9B89E; border-color: #52402D;
}
[data-theme="dark"] select.form-input option {
  color: #F2E9DD;
  background: #241A12;
}

/* ── Theme toggle switch (topbar) ── */
.theme-toggle-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-mid);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.theme-toggle-btn:hover { border-color: var(--gold); background: var(--white); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

html, body {
  height: 100%;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   ACCESSIBILITY — visible keyboard focus, system-wide
   ============================================================ */
a, button, input, select, textarea, .nav-item, .icon-btn, .step, .tab-btn {
  outline: none;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-item:focus-visible,
.icon-btn:focus-visible,
.step:focus-visible,
.tab-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.auth-body a:focus-visible,
.auth-body button:focus-visible,
.auth-body input:focus-visible,
.auth-body select:focus-visible {
  outline-color: var(--gold-light);
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Themed scrollbars everywhere (Firefox + WebKit) */
* { scrollbar-width: thin; scrollbar-color: var(--border-dark) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 0; }
*::-webkit-scrollbar-thumb:hover { background: var(--maroon-light); }

/* ============================================================
   AUTH PAGES — Login / Register / Forgot Password
   ============================================================ */

.auth-body {
  background: var(--maroon-deep);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle diagonal texture background */
.bg-layer {
  position: fixed; inset: 0; z-index: 0;
  background:
    linear-gradient(135deg, var(--maroon-deep) 0%, var(--maroon-dark) 40%, #3A080F 100%);
}

/* Gold accent lines — geometric, sharp */
.grid-overlay {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(201,150,58,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,150,58,0.06) 1px, transparent 1px);
  background-size: 52px 52px;
}

.auth-page {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* ── Left Panel ── */
.left-panel {
  display: flex; flex-direction: column; justify-content: center;
  padding: 64px 72px;
  gap: 40px;
  border-right: 1px solid rgba(201,150,58,0.15);
  position: relative;
}

/* Gold vertical accent line */
.left-panel::before {
  content: '';
  position: absolute; left: 0; top: 10%; bottom: 10%;
  width: 3px;
  background: linear-gradient(to bottom, transparent, var(--gold), transparent);
}

.brand { display: flex; align-items: center; gap: 16px; }
.brand-logo {
  width: 58px; height: 58px;
  object-fit: cover;
  border: 2px solid rgba(201,150,58,0.4);
  flex-shrink: 0;
}
.brand-text {
  font-family: 'Libre Baskerville', serif;
  font-size: 18px; font-weight: 700; line-height: 1.2;
  letter-spacing: 0.01em;
}
.brand-sub {
  font-size: 10px; color: var(--gold-light);
  letter-spacing: 2px; text-transform: uppercase; margin-top: 4px;
  font-weight: 600;
}

.hero-text h1 {
  font-family: 'Libre Baskerville', serif;
  font-size: clamp(30px, 3.5vw, 46px);
  font-weight: 700; line-height: 1.12;
  letter-spacing: -0.5px;
}
.hero-text h1 span {
  color: var(--gold-light);
}
.hero-text p {
  margin-top: 14px;
  font-size: 15px; color: rgba(255,255,255,0.55);
  line-height: 1.75; max-width: 380px;
  font-weight: 300;
}

.features { display: flex; flex-direction: column; gap: 2px; }
.feature-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}
.feature-item:hover {
  border-left-color: var(--gold);
  background: rgba(201,150,58,0.05);
}
.feature-icon { font-size: 18px; flex-shrink: 0; width: 22px; }
.feature-label { font-weight: 700; font-size: 13px; color: var(--white); letter-spacing: 0.01em; }
.feature-desc  { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 1px; }

/* ── Right Panel ── */
.right-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 60px 72px;
  background: rgba(0,0,0,0.2);
}

.card {
  width: 100%; max-width: 440px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(201,150,58,0.22);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-lg);
}

.card-header { margin-bottom: 28px; }
.card-header h2 {
  font-family: 'Libre Baskerville', serif;
  font-size: 26px; font-weight: 700; letter-spacing: -0.3px;
}
.card-header p { color: rgba(255,255,255,0.45); font-size: 13px; margin-top: 6px; }

/* Tabs */
.tabs {
  display: flex;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: 4px; margin-bottom: 24px; gap: 3px;
}
.tab-btn {
  flex: 1; padding: 9px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.45);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.3px; text-transform: uppercase;
  cursor: pointer; transition: all 0.2s;
}
.tab-btn.active {
  background: var(--maroon-light);
  color: var(--white);
  border: 1px solid rgba(201,150,58,0.3);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.form-panel { display: none; }
.form-panel.active { display: block; }

/* Auth form groups */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 7px;
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute; left: 13px; font-size: 14px;
  color: rgba(255,255,255,0.3); pointer-events: none;
}
.form-input {
  width: 100%;
  padding: 11px 13px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px; font-weight: 400;
  outline: none;
  transition: all 0.2s;
}
.form-input::placeholder { color: rgba(255,255,255,0.2); }
.form-input:focus {
  border-color: var(--gold-light);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 0 0 3px rgba(240,197,103,0.12);
}
/* Dropdown options always render on a light system background, so give them
   dark text — otherwise the light theme colors above make them invisible. */
select.form-input option {
  color: #1e293b;
  background: #fff;
}
/* Tell the browser this control's native popup (the open dropdown list)
   should use the light widget theme — without this, Chromium/Edge on a
   dark OS theme renders the option list in dark colors and ignores the
   color/background set above, making every option except the hovered
   one appear blank. */
select.form-input {
  color-scheme: light;
}

/* .form-input inside the dashboard (light pages) — the base style above is for the dark login panel */
.dashboard-body .form-input {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
}
.dashboard-body .form-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.dashboard-body .form-input:focus { border-color: var(--gold); background: var(--white); box-shadow: 0 0 0 3px rgba(201,150,58,0.15); }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Primary button */
.btn-primary {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--maroon-light), var(--maroon));
  border: none;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px; font-weight: 900;
  letter-spacing: 1.5px; text-transform: uppercase;
  cursor: pointer; transition: all 0.2s;
  margin-top: 6px;
  box-shadow: 0 4px 14px rgba(139,26,40,0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--maroon-deep);
  box-shadow: 0 6px 20px rgba(201,150,58,0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0px); box-shadow: 0 2px 8px rgba(139,26,40,0.3); }

.footer-note {
  text-align: center; font-size: 12px;
  color: rgba(255,255,255,0.3); margin-top: 18px;
}
.footer-note a { color: var(--gold-light); text-decoration: none; font-weight: 600; }
.footer-note a:hover { color: var(--gold-pale); }

/* Alerts */
.alert {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  margin-bottom: 16px;
  border-left: 4px solid;
}
.alert-error   { background: rgba(139,26,26,0.25); border-color: #EF4444; color: #FCA5A5; }
.alert-success { background: rgba(26,107,60,0.25); border-color: #10B981; color: #6EE7B7; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */

.dashboard-body {
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--maroon-deep) 0%, #22050A 100%);
  color: var(--white);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100;
  box-shadow: 2px 0 24px rgba(0,0,0,0.25);
}
.sidebar::after {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, transparent, var(--gold) 15%, var(--gold) 85%, transparent);
  opacity: 0.6;
}

.sidebar-brand {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(201,150,58,0.2);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo {
  width: 64px; height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
  flex-shrink: 0;
}
.sidebar-brand .brand-text {
  font-family: 'Libre Baskerville', serif;
  font-size: 12px; font-weight: 700; line-height: 1.35;
  color: var(--white);
}
.sidebar-brand .brand-sub {
  font-size: 9px; color: var(--gold);
  text-transform: uppercase; letter-spacing: 1.5px;
}

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(201,150,58,0.3); }

.nav-section {
  font-size: 9px; color: rgba(201,150,58,0.6);
  text-transform: uppercase; letter-spacing: 2px;
  padding: 12px 10px 5px;
  font-weight: 700;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  color: rgba(255,255,255,0.55);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: all 0.18s;
  margin-bottom: 2px;
  cursor: pointer; border: none; background: transparent; width: 100%;
  border-radius: var(--radius-sm);
  letter-spacing: 0.1px;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--white);
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(201,150,58,0.18), rgba(201,150,58,0.06));
  color: var(--gold-light);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--gold);
}
.nav-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 18px; height: 18px; color: currentColor; }
.nav-icon svg { display: block; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(201,150,58,0.15);
}
.user-info { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: 2px solid rgba(201,150,58,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900;
  color: var(--maroon-deep);
  flex-shrink: 0; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name  { font-size: 12px; font-weight: 700; color: var(--white); }
.user-role  { font-size: 10px; color: var(--gold); font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(107,15,26,0.06);
}
.topbar-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 17px; font-weight: 700;
  color: var(--heading-accent);
  letter-spacing: -0.2px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

.notif-btn {
  position: relative; background: none; border: none;
  border-radius: var(--radius-pill);
  cursor: pointer; font-size: 18px;
  padding: 7px; transition: background 0.15s;
}
.notif-btn:hover { background: var(--surface); }
.notif-badge {
  position: absolute; top: 3px; right: 3px;
  background: var(--maroon-light); color: white;
  border-radius: var(--radius-pill);
  font-size: 9px; font-weight: 900;
  min-width: 15px; height: 15px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  box-shadow: 0 0 0 2px var(--white);
}

.btn-logout {
  padding: 7px 16px;
  background: transparent;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dark);
  color: var(--text-muted);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none; display: flex; align-items: center; gap: 6px;
  letter-spacing: 0.3px;
}
.btn-logout:hover { background: var(--maroon); color: var(--white); border-color: var(--maroon); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.page-content { padding: 28px; flex: 1; }

/* ============================================================
   PAGE HEADERS
   ============================================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.page-header::after {
  content: '';
  position: absolute; left: 0; bottom: -1px; width: 64px; height: 2px;
  background: linear-gradient(90deg, var(--maroon), var(--gold));
  border-radius: var(--radius-pill);
}
.page-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 24px; font-weight: 700;
  color: var(--heading-accent); letter-spacing: -0.3px;
}
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; font-weight: 400; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 16px;
  transition: box-shadow 0.25s, transform 0.25s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 50px; height: 50px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
}
.stat-icon.blue   { background: rgba(107,15,26,0.06); border-color: rgba(107,15,26,0.12); }
.stat-icon.gold   { background: rgba(201,150,58,0.10); border-color: rgba(201,150,58,0.2); }
.stat-icon.green  { background: rgba(26,107,60,0.08);  border-color: rgba(26,107,60,0.15); }
.stat-icon.red    { background: rgba(139,26,26,0.08);  border-color: rgba(139,26,26,0.15); }
.stat-icon.purple { background: rgba(107,15,26,0.06);  border-color: rgba(107,15,26,0.12); }

.stat-value {
  font-family: 'Libre Baskerville', serif;
  font-size: 28px; font-weight: 700; color: var(--heading-accent);
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }

/* ============================================================
   TABLE CARDS
   ============================================================ */
.table-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden; margin-bottom: 22px;
  transition: box-shadow 0.25s;
}
.table-card:hover { box-shadow: var(--shadow-md); }
.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  background: var(--off-white);
  position: relative;
}
.table-header::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--maroon), var(--gold));
}
.table-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 15px; font-weight: 700; color: var(--heading-accent);
}

table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--maroon-deep);
  padding: 11px 14px;
  text-align: left;
  font-size: 10px; font-weight: 900;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase; letter-spacing: 1px;
  border-right: 1px solid rgba(255,255,255,0.06);
}
thead th:last-child { border-right: none; }

tbody td {
  padding: 12px 14px;
  font-size: 13px; color: var(--text-mid);
  border-bottom: 1px solid var(--border);
  font-weight: 400;
  transition: background 0.12s;
}
tbody tr:nth-child(even) td { background: rgba(107,15,26,0.012); }
tbody tr:hover td { background: rgba(107,15,26,0.035); }
tbody tr:last-child td { border-bottom: none; }

/* Status Badges — pill shaped */
.badge-status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 10px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.8px;
}
.badge-draft     { background: #F1F0EE; color: #5A4E42; border: 1px solid #D0C8BC; }
.badge-submitted { background: rgba(201,150,58,0.14); color: var(--warning); border: 1px solid rgba(201,150,58,0.35); }
.badge-approved  { background: var(--success-bg); color: var(--success); border: 1px solid rgba(26,107,60,0.25); }
.badge-rejected  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(139,26,26,0.25); }
.badge-pending   { background: rgba(201,150,58,0.14); color: var(--warning); border: 1px solid rgba(201,150,58,0.35); }
.badge-cancelled { background: #F1F0EE; color: #5A4E42; border: 1px solid #D0C8BC; }
.badge-active    { background: var(--success-bg); color: var(--success); border: 1px solid rgba(26,107,60,0.25); }
.badge-inactive  { background: #F1F0EE; color: #5A4E42; border: 1px solid #D0C8BC; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 12px; font-weight: 900;
  letter-spacing: 0.8px; text-transform: uppercase;
  cursor: pointer; transition: all 0.2s;
  text-decoration: none; border: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-blue, .btn-maroon {
  background: linear-gradient(135deg, var(--maroon-light), var(--maroon));
  color: var(--white);
  box-shadow: 0 3px 10px rgba(107,15,26,0.28);
}
.btn-blue:hover, .btn-maroon:hover {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: var(--white);
  box-shadow: 0 6px 16px rgba(107,15,26,0.35);
}
.btn-outline {
  background: transparent;
  color: var(--maroon);
  border: 1.5px solid var(--maroon);
}
.btn-outline:hover { background: var(--maroon); color: var(--white); box-shadow: 0 4px 12px rgba(107,15,26,0.25); }

.btn-danger {
  background: linear-gradient(135deg, #A52222, var(--danger));
  color: var(--white);
  box-shadow: 0 3px 10px rgba(139,26,26,0.28);
}
.btn-danger:hover { background: #A52222; box-shadow: 0 6px 16px rgba(139,26,26,0.35); }

.btn-success {
  background: linear-gradient(135deg, #1E7D47, var(--success));
  color: var(--white);
  box-shadow: 0 3px 10px rgba(26,107,60,0.28);
}
.btn-success:hover { background: #1E7D47; box-shadow: 0 6px 16px rgba(26,107,60,0.35); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--maroon-deep);
  box-shadow: 0 3px 10px rgba(201,150,58,0.3);
}
.btn-gold:hover { background: var(--gold-light); box-shadow: 0 6px 16px rgba(201,150,58,0.38); }

.btn-sm { padding: 6px 14px; font-size: 11px; }

.btn-outline-sm {
  padding: 6px 13px; font-size: 11px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--maroon);
  border: 1px solid var(--border-dark);
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 700; letter-spacing: 0.3px;
  cursor: pointer; transition: all 0.2s;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-outline-sm:hover { background: var(--maroon); color: var(--white); border-color: var(--maroon); transform: translateY(-1px); }

/* Icon buttons — used across Admin table action cells
   (Users, Employees, Departments, Positions, Units, Service Records, Backup) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  background: transparent;
  padding: 0;
}
.icon-btn:hover  { transform: scale(1.1); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn-default { color: var(--text-muted); border-color: var(--border); background: var(--surface); }
.icon-btn-default:hover { background: var(--border); color: var(--text); }
.icon-btn-warning { color: #d97706; border-color: #fde68a; background: #fffbeb; }
.icon-btn-warning:hover { background: #fde68a; }
.icon-btn-success { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; }
.icon-btn-success:hover { background: #bbf7d0; }
.icon-btn-danger { color: #ef4444; border-color: #fca5a5; background: #fff5f5; }
.icon-btn-danger:hover { background: #fca5a5; }

/* ============================================================
   FORM CARDS & FIELDS
   ============================================================ */
.profile-card, .form-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 3px solid var(--maroon);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: box-shadow 0.25s;
}
.profile-card:hover, .form-card:hover { box-shadow: var(--shadow-md); }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 16px;
}
.field-grid-3 { grid-template-columns: repeat(3, 1fr); }
.field-grid-2 { grid-template-columns: repeat(2, 1fr); }
.field-grid-1 { grid-template-columns: 1fr; }

.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label {
  font-size: 11px; font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase; letter-spacing: 0.8px;
}
.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px; font-weight: 400;
  color: var(--text);
  outline: none;
  transition: all 0.2s;
  background: #FDFCFB;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(201,150,58,0.15);
}
.field-group input:disabled {
  background: var(--surface);
  color: var(--text-muted);
  cursor: not-allowed;
}
.field-group textarea { resize: vertical; min-height: 75px; }

.section-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.sub-section-title {
  font-size: 12px; font-weight: 900;
  color: var(--heading-accent);
  margin-bottom: 14px;
  padding: 8px 14px;
  background: var(--off-white);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--gold);
  text-transform: uppercase; letter-spacing: 0.8px;
}

/* Search input */
.search-input {
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px; outline: none;
  background: var(--white);
  transition: all 0.2s;
}
.search-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,150,58,0.15); }

/* ============================================================
   PDS STEPPER
   ============================================================ */
.pds-stepper {
  display: flex; gap: 0; margin-bottom: 22px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 3px solid var(--maroon);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.step {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; flex: 1; min-width: 68px;
  cursor: pointer; position: relative;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute; top: 15px;
  left: calc(50% + 15px); right: calc(-50% + 15px);
  height: 2px; background: var(--border); z-index: 0;
}
.step.completed:not(:last-child)::after { background: var(--gold); }

.step-num {
  width: 30px; height: 30px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  z-index: 1; border: 2px solid var(--border);
  transition: all 0.25s;
}
.step.active .step-num {
  background: var(--maroon); color: var(--white); border-color: var(--maroon);
  box-shadow: 0 0 0 4px rgba(107,15,26,0.12);
}
.step.completed .step-num {
  background: var(--gold); color: var(--maroon-deep); border-color: var(--gold);
}
.step-label { font-size: 10px; color: var(--text-muted); text-align: center; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.step.active .step-label  { color: var(--maroon); }
.step.completed .step-label { color: var(--gold-muted); }

.pds-section {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 3px solid var(--maroon);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: none;
}
.pds-section.active { display: block; }

.section-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 20px; font-weight: 700; color: var(--heading-accent); margin-bottom: 4px;
}
.section-subtitle {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 22px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* Dynamic tables in PDS */
.dynamic-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.dynamic-table th {
  background: var(--maroon-deep);
  padding: 9px 10px;
  font-size: 10px; font-weight: 900;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase; letter-spacing: 0.8px;
  border-right: 1px solid rgba(255,255,255,0.06);
  text-align: left;
}
.dynamic-table td {
  padding: 5px 4px;
  border-bottom: 1px solid var(--border);
}
.dynamic-table td input,
.dynamic-table td select {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px; width: 100%;
  background: var(--white);
  font-family: 'Source Sans 3', sans-serif;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.dynamic-table td input:focus,
.dynamic-table td select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,150,58,0.15);
}

.form-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 26px; padding-top: 18px;
  border-top: 1px solid var(--border);
}

.radio-group { display: flex; gap: 18px; flex-wrap: wrap; }
.radio-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-mid); cursor: pointer; font-weight: 600;
}
.radio-label input[type="radio"] { width: 15px; height: 15px; accent-color: var(--maroon); }

.question-block {
  background: var(--off-white);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--maroon);
}
.question-text {
  font-size: 13px; color: var(--text-mid);
  margin-bottom: 10px; line-height: 1.65; font-weight: 600;
}

/* ============================================================
   LEAVE & SALN CARDS
   ============================================================ */
.credit-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 3px solid var(--maroon);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, transform 0.25s;
}
.credit-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.credit-value {
  font-family: 'Libre Baskerville', serif;
  font-size: 34px; font-weight: 700; color: var(--heading-accent);
}
.credit-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.credit-bar { height: 6px; background: var(--border); border-radius: var(--radius-pill); margin-top: 12px; overflow: hidden; }
.credit-bar-fill { height: 100%; transition: width 0.5s; border-radius: var(--radius-pill); }

.saln-summary { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.saln-box {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px; text-align: center;
  transition: box-shadow 0.2s;
}
.saln-box:hover { box-shadow: var(--shadow-sm); }
.saln-amount {
  font-family: 'Libre Baskerville', serif;
  font-size: 20px; font-weight: 700; color: var(--heading-accent);
}
.saln-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
  display: none; position: fixed; inset: 0;
  background: rgba(26,1,4,0.65);
  z-index: 999;
  align-items: center; justify-content: center; padding: 20px;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  border-top: 4px solid var(--maroon);
  padding: 32px;
  width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 20px; font-weight: 700; color: var(--heading-accent); margin-bottom: 18px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}

/* ============================================================
   SAVE INDICATOR
   ============================================================ */
.save-indicator {
  position: fixed; bottom: 22px; right: 22px;
  border-radius: var(--radius-sm);
  background: var(--maroon-deep);
  color: white; padding: 11px 18px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  display: none; z-index: 999;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--gold);
}
.save-indicator.show  { display: flex; align-items: center; gap: 8px; }
.save-indicator.success { border-left-color: #10B981; }
.save-indicator.error   { border-left-color: #EF4444; }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon  { font-size: 40px; margin-bottom: 10px; opacity: 0.5; }
.empty-title { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ============================================================
   PHOTO UPLOAD
   ============================================================ */
.photo-upload-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.photo-preview {
  width: 96px; height: 96px;
  border-radius: var(--radius-pill);
  object-fit: cover;
  border: 3px solid var(--border-dark);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   PASSWORD TOGGLE
   ============================================================ */
.pw-wrap {
  position: relative; display: flex; align-items: center; width: 100%;
}
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-eye {
  position: absolute; right: 10px;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.3);
  padding: 4px; display: flex; align-items: center; justify-content: center;
  transition: color 0.15s; flex-shrink: 0;
}
.pw-eye:hover, .pw-eye.active { color: var(--gold-light); }

.dashboard-body .pw-eye { color: var(--text-muted); }
.dashboard-body .pw-eye:hover,
.dashboard-body .pw-eye.active { color: var(--maroon); }

/* ============================================================
   VALIDATION STATES
   ============================================================ */
input.input-error, select.input-error, textarea.input-error {
  border-color: var(--danger) !important;
  border-bottom-color: var(--danger) !important;
}
.err-msg { color: var(--danger); font-size: 11px; margin-top: 4px; display: block; font-weight: 700; }
.pw-strength-bar { height: 3px; background: var(--border); margin-top: 5px; overflow: hidden; }
.pw-strength-fill { height: 100%; width: 0; transition: width 0.3s, background 0.3s; }

/* ============================================================
   ACTIONS CELL
   ============================================================ */
.actions-cell { display: flex; gap: 4px; flex-wrap: wrap; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse  { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.fade-in { animation: fadeIn 0.35s ease both; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .field-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .left-panel { padding: 36px 24px 16px; gap: 18px; }
  .features  { display: none; }
  .right-panel { padding: 0 20px 40px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .field-grid-3, .field-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .card { padding: 28px 20px; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .saln-summary { grid-template-columns: 1fr; }
  .page-content { padding: 18px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .form-nav, .pds-stepper, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
  .pds-section { display: block !important; box-shadow: none; border: none; }
}

/* ============================================================
   MOBILE & TABLET FIXES (added for live deployment)
   ============================================================ */
.main-content { min-width: 0; }               /* stop wide content from stretching the page */
.page-content { overflow-wrap: break-word; }
.page-content [style*="flex:1"] { min-width: 0; }
.inline-form { display: inline; margin: 0; }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--white); color: var(--heading-accent);
  cursor: pointer;
}
.menu-toggle:active { transform: scale(0.96); }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 90;
  background: rgba(26,1,4,0.5);
}
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll > table { margin: 0; }
.pds-stepper { -webkit-overflow-scrolling: touch; }

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .sidebar { width: min(280px, 84vw); height: 100vh; height: 100dvh; overflow-y: auto; }
  .sidebar.open { box-shadow: 8px 0 32px rgba(0,0,0,0.35); }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar-overlay { display: block; }

  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-right { gap: 6px; flex-shrink: 0; }
  .btn-logout { padding: 8px 10px; }
  .btn-logout .logout-text { display: none; }

  .page-content { padding: 18px 16px; }
  .page-title { font-size: 20px; }
  .page-header > * { min-width: 0; }

  /* tables: keep columns readable, scroll sideways inside the card */
  .table-scroll > table.table-wide { min-width: 720px; }
  .table-scroll > table.table-mid  { min-width: 520px; }
  .table-scroll thead th { white-space: nowrap; }
  /* keep row action buttons on one line so rows stay short */
  .table-scroll td > div[style*="display:flex"], .table-scroll .actions-cell { flex-wrap: nowrap !important; }
  .table-scroll td .badge-status { white-space: nowrap; }
  .table-header { padding: 14px 16px; }

  /* 16px text in fields stops phones from zooming in when a field is tapped */
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  select, textarea { font-size: 16px !important; max-width: 100%; }

  .search-bar, form[method=GET], form[method=get] { flex-wrap: wrap; }
  .search-bar > *, form[method=GET] > *, form[method=get] > * { max-width: 100%; }
  .search-input { min-width: 0; flex: 1 1 180px; }

  .form-nav { flex-wrap: wrap; gap: 10px; }
  .pds-section { padding: 20px 16px; }
  .modal { padding: 12px; }
  .modal-box { padding: 22px 18px; max-height: 92vh; }
  .profile-card, .form-card { padding: 20px 16px; }
  .profile-card > div[style*="display:flex"] { flex-wrap: wrap; }
  .stats-grid { gap: 12px; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; }
  .page-header { margin-bottom: 18px; }
  .page-header .btn { flex: 1 1 auto; justify-content: center; }
  .actions-cell { flex-wrap: nowrap; }
}
/* Page layouts written as inline grids: collapse on small screens */
@media (max-width: 900px) {
  .page-content [style*="repeat(3"], .page-content [style*="repeat(4"],
  .page-content [style*="1fr 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }
  .page-content [style*="1fr 3fr"], .page-content [style*="1.6fr 1fr"] { grid-template-columns: 1fr !important; }
  .stat-card { min-width: 0; }
  .stat-card > div:last-child { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 600px) {
  .page-content [style*="grid-template-columns"]:not(.stats-grid) { grid-template-columns: 1fr !important; }
  .page-content .stats-grid[style*="grid-template-columns"] { grid-template-columns: 1fr 1fr !important; }
  .stat-card { gap: 10px; padding: 14px 12px; }
  .stat-icon { width: 38px; height: 38px; font-size: 16px; }
  .stat-value { font-size: 22px; }
  .stat-label { letter-spacing: 0.3px; }
}
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
}
@media print {
  .menu-toggle, .sidebar-overlay { display: none !important; }
}
