/* ============================================================
   OHR HRMS — Design System
   Ported from antargyan-hrms HTML mockup
   ============================================================ */

/* === TOKENS === */
:root {
  --bg-1: #f3faf8; --bg-2: #e8f4f0; --bg-3: #d4ede5;
  --surface: #ffffff; --surface-dim: #f1f7f5; --surface-hover: #e2efea;
  --text: #1a1a1a; --text-secondary: #5a5a5a; --text-muted: #94978f; --text-on-dark: #ffffff;
  --border: rgba(0,0,0,0.06); --border-strong: rgba(0,0,0,0.1);
  --primary: #1a1a1a; --primary-soft: #eaf2ef; --primary-text: #ffffff;
  --accent: #0d9488; --accent-soft: #ccfbf1; --accent-text: #ffffff;
  --success: #5cb874; --success-soft: #e2f5e7;
  --danger: #e57373; --danger-soft: #fde8e8;
  --info: #4a90c2; --info-soft: #e8f1f9;
  --purple: #7c4dbd; --purple-soft: #f0e7f9;
  --shadow-card: 0 4px 20px rgba(15, 60, 55, 0.06);
  --shadow-lg: 0 8px 24px rgba(15, 60, 55, 0.09);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.2);
  --radius: 14px; --radius-lg: 20px; --radius-pill: 999px;
  --topbar-h: 76px; --sidebar-w: 260px;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg-1: #0d1614; --bg-2: #111c1a; --bg-3: #16221f;
  --surface: #1c2723; --surface-dim: #131e1b; --surface-hover: #243530;
  --text: #e6efeb; --text-secondary: #9aa39e; --text-muted: #6e7773;
  --border: rgba(255,255,255,0.06); --border-strong: rgba(255,255,255,0.1);
  --primary: #e6efeb; --primary-soft: #243530; --primary-text: #0d1614;
  --accent: #14b8a6; --accent-soft: #134e4a; --accent-text: #0d1614;
  --success: #7dd396; --success-soft: #1f3525;
  --danger: #ef8a8a; --danger-soft: #3a1f1f;
  --info: #7fb3d9; --info-soft: #1a2a3a;
  --purple: #b09cd0; --purple-soft: #2a1f3a;
  --shadow-card: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

/* === RTL / Arabic === */
[dir="rtl"] { --font-body: "Cairo", system-ui, -apple-system, sans-serif; }
[dir="rtl"] .submenu-item-badge { margin-inline-start: auto; }

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px; line-height: 1.5;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 40%, var(--bg-3) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; letter-spacing: -0.005em;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
input, select, textarea { font-family: inherit; }

/* === TOPBAR === */
.topbar {
  position: fixed; top: 0; inset-inline-start: 0; inset-inline-end: 0;
  height: var(--topbar-h); display: flex; align-items: center;
  padding: 0 28px; gap: 16px; z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; cursor: pointer; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--primary); display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-weight: 800; font-size: 20px;
  position: relative; transform: rotate(-3deg);
}
.brand-logo::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  background: var(--accent); border-radius: 50%;
  top: -4px; inset-inline-end: -4px; border: 3px solid var(--bg-2);
}
.brand-name { font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -0.03em; }

.topnav-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; position: relative; }
/* Scroll arrows — hidden by default, shown only when nav overflows */
.topnav-arrow {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-card);
  color: var(--text-secondary); flex-shrink: 0;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s, color 0.18s;
}
.topnav-arrow svg { width: 14px; height: 14px; }
.topnav-arrow:hover { color: var(--text); }
.topnav-arrow-visible { opacity: 1 !important; pointer-events: auto !important; }
.topnav {
  display: flex; align-items: center;
  background: var(--surface); border-radius: var(--radius-pill);
  padding: 5px; box-shadow: var(--shadow-card);
  gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav-item {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 500;
  color: var(--text-secondary); white-space: nowrap;
  transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
}
.topnav-item:hover { color: var(--text); background: var(--surface-hover); }
.topnav-item.active { color: var(--primary-text); background: var(--primary); font-weight: 600; }
.topnav-item svg { width: 15px; height: 15px; flex-shrink: 0; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.action-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px; background: var(--surface);
  border-radius: var(--radius-pill); box-shadow: var(--shadow-card);
  font-size: 13.5px; font-weight: 500; color: var(--text);
  transition: all 0.18s ease;
}
.action-pill:hover { background: var(--surface-hover); transform: translateY(-1px); }
.action-pill svg { width: 16px; height: 16px; }

.icon-circle {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); transition: all 0.18s ease;
  position: relative; flex-shrink: 0;
}
.icon-circle:hover { background: var(--surface-hover); transform: translateY(-1px); }
.icon-circle svg { width: 17px; height: 17px; }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  min-width: 17px; height: 17px; background: #ef4444;
  border-radius: 9px; border: 2px solid var(--surface);
  font-size: 9px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1; pointer-events: none;
}

/* === LAYOUT === */
.app {
  display: flex; padding-top: var(--topbar-h); height: 100vh;
  gap: 20px; padding-inline: 24px; padding-bottom: 24px;
}
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 22px 14px;
  overflow-y: auto;
}
.sidebar.hidden { display: none; }
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.sidebar-header { padding: 0 12px 18px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.sidebar-eyebrow {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; margin-bottom: 4px;
}
.sidebar-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; line-height: 1.1; }
.submenu-section { margin-bottom: 18px; }
.submenu-section:last-child { margin-bottom: 0; }
.submenu-section-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); padding: 4px 12px 8px; font-weight: 600;
}
.submenu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-pill);
  font-size: 13.5px; color: var(--text-secondary);
  transition: all 0.15s ease; cursor: pointer;
  font-weight: 500; margin-bottom: 2px;
}
.submenu-item:hover { background: var(--surface-hover); color: var(--text); }
.submenu-item.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.submenu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.submenu-item-badge {
  background: var(--primary); color: var(--primary-text);
  font-size: 10.5px; font-weight: 600; padding: 2px 8px;
  border-radius: var(--radius-pill); min-width: 22px; text-align: center;
}

/* === MAIN === */
.main { flex: 1; overflow-y: auto; padding-inline-end: 4px; }
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-title { font-size: 44px; font-weight: 700; color: var(--text); letter-spacing: -0.035em; line-height: 1; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 8px; }

.strip-mini { display: flex; align-items: center; gap: 22px; }
.strip-mini-item { display: flex; align-items: center; gap: 10px; }
.strip-mini-icon {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); box-shadow: var(--shadow-card);
}
.strip-mini-icon svg { width: 14px; height: 14px; }
.strip-mini-value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.strip-mini-label { font-size: 11.5px; color: var(--text-secondary); }

.strip-stats { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-top: 6px; }
.strip-stat { display: flex; flex-direction: column; gap: 6px; }
.strip-stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.strip-pill {
  height: 34px; padding: 0 18px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; font-weight: 600; font-size: 13px; white-space: nowrap;
}
.strip-pill.dark { background: var(--primary); color: var(--primary-text); min-width: 110px; }
.strip-pill.yellow { background: var(--accent); color: var(--accent-text); min-width: 70px; }
.strip-pill.striped {
  background: repeating-linear-gradient(45deg, var(--surface) 0 6px, var(--surface-dim) 6px 12px);
  color: var(--text); border: 1px solid var(--border); min-width: 90px;
}
.strip-pill.muted { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* === CARDS === */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 22px; }
.card-dark { background: var(--primary); color: var(--text-on-dark); }
[data-theme="dark"] .card-dark { background: #0d0d0d; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.card-title { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.card-action {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-dim); display: flex; align-items: center; justify-content: center;
  color: var(--text); transition: all 0.15s ease; flex-shrink: 0; cursor: pointer;
}
.card-action:hover { background: var(--surface-hover); }
.card-action svg { width: 13px; height: 13px; }
.card-dark .card-action { background: rgba(255,255,255,0.12); color: var(--text-on-dark); }

/* === DASHBOARD GRID === */
.dash-grid { display: grid; grid-template-columns: 320px 1fr 320px; gap: 18px; margin-top: 24px; }
@media (max-width: 1280px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.schedule-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 16px; }
.schedule-day { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-radius: 12px; cursor: pointer; transition: background 0.15s ease; }
.schedule-day:hover { background: var(--surface-hover); }
.schedule-day-name { font-size: 10.5px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; }
.schedule-day-num { font-size: 16px; font-weight: 600; color: var(--text); margin-top: 2px; }
.schedule-day.active { background: var(--accent-soft); }

.timeline-times { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.time-pill { width: 50px; height: 26px; border-radius: var(--radius-pill); background: var(--surface-dim); color: var(--text-secondary); font-size: 11.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.time-pill.dark { background: var(--primary); color: var(--primary-text); }
.time-pill.yellow { background: var(--accent); color: var(--accent-text); }
.timeline-events { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.timeline-event { padding: 8px 12px; border-radius: 14px; font-size: 12.5px; line-height: 1.3; }
.timeline-event.dark { background: var(--primary); color: var(--text-on-dark); }
.timeline-event.light { background: var(--surface-dim); color: var(--text); }
.timeline-event-title { font-weight: 600; font-size: 13px; }
.timeline-event-time { font-size: 11px; opacity: 0.7; margin-top: 1px; }

.row-item { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 14px; transition: background 0.15s ease; cursor: pointer; }
.row-item:hover { background: var(--surface-dim); }
.row-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.row-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.row-name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.row-meta { font-size: 11.5px; color: var(--text-muted); }
.row-salary { font-weight: 600; font-size: 13px; color: var(--text); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.gray { background: var(--surface-dim); color: var(--text-muted); }
.badge.yellow { background: #fff4c2; color: #8b6914; }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
[data-theme="dark"] .badge.yellow { background: #3a3320; color: #ffd93d; }

.attendance-stat { display: flex; gap: 28px; align-items: flex-end; margin-bottom: 4px; }
.attendance-num { display: flex; align-items: center; gap: 6px; font-size: 36px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.attendance-num svg { width: 18px; height: 18px; }
.attendance-num.green { color: var(--success); }
.attendance-num.red { color: #ff9090; }
.dot-grid { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; padding: 14px 0 4px; }
.dot { aspect-ratio: 1; border-radius: 50%; background: rgba(255,255,255,0.15); }
.dot.on { background: var(--accent); }
.dot.warm { background: #f4a847; }
.dot.hidden { background: transparent; pointer-events: none; }

.chart-card { grid-column: span 2; }
@media (max-width: 900px) { .chart-card { grid-column: auto; } }
.chart-legend { display: flex; align-items: center; gap: 14px; font-size: 12px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.chart-legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.chart-area { position: relative; height: 160px; margin-top: 8px; }
.chart-area svg { width: 100%; height: 100%; overflow: visible; }

.donut-card { display: flex; align-items: center; gap: 22px; }
.donut { width: 130px; height: 130px; border-radius: 50%; background: conic-gradient(var(--accent) 0deg 252deg, var(--primary) 252deg 360deg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; }
.donut::before { content: ""; position: absolute; inset: 14px; background: var(--surface); border-radius: 50%; }
.donut-center { position: relative; z-index: 1; text-align: center; }
.donut-num { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.donut-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; }
.donut-legend-row { display: flex; align-items: center; gap: 8px; }
.donut-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.donut-dot.yellow { background: var(--accent); }
.donut-dot.dark { background: var(--primary); }
.donut-legend-val { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.donut-legend-key { font-size: 11.5px; color: var(--text-secondary); margin-inline-start: 6px; }

/* === TABLES === */
.table-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; margin-top: 20px; }
.filter-pill { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; background: var(--surface); border-radius: var(--radius-pill); border: 1px solid var(--border); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-card); cursor: pointer; transition: all 0.15s ease; color: var(--text); }
.filter-pill:hover { background: var(--surface-hover); }
.filter-pill svg { width: 12px; height: 12px; opacity: 0.6; }
.filter-pill.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.filter-pill.active svg { opacity: 0.9; }
.filter-dropdown-backdrop { position: fixed; inset: 0; z-index: 50; background: transparent; }
.filter-dropdown { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 200px; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-card); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.filter-dropdown-item { display: block; width: 100%; text-align: left; padding: 8px 12px; border: none; background: transparent; border-radius: 8px; font-size: 13px; color: var(--text); cursor: pointer; transition: background 0.12s ease; }
.filter-dropdown-item:hover { background: var(--surface-hover); }
.filter-dropdown-item.selected { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.search-pill { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; padding: 9px 16px; background: var(--surface); border-radius: var(--radius-pill); box-shadow: var(--shadow-card); }
.search-pill svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.search-pill input { flex: 1; border: none; background: none; outline: none; color: var(--text); font-size: 13.5px; }
.search-pill input::placeholder { color: var(--text-muted); }

/* Employee picker */
.emp-picker-trigger { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; cursor: pointer; }
.emp-picker-trigger:hover { background: var(--surface-hover); }
.emp-picker-trigger-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.emp-picker-trigger-name { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-picker-trigger-meta { font-size: 12px; color: var(--text-muted); }
.emp-picker-trigger-placeholder { color: var(--text-muted); }
.emp-picker-chevron { width: 14px; height: 14px; opacity: 0.5; flex-shrink: 0; }
.emp-picker-search { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface-alt, var(--surface)); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; }
.emp-picker-search svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.emp-picker-search input { flex: 1; border: none; background: none; outline: none; color: var(--text); font-size: 13.5px; }
.emp-picker-search input::placeholder { color: var(--text-muted); }
.emp-picker-list { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin: 0 -6px; padding: 0 6px; }
.emp-picker-empty { padding: 24px 12px; text-align: center; color: var(--text-muted); font-size: 13px; }
.emp-picker-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: none; background: transparent; border-radius: 10px; cursor: pointer; text-align: left; transition: background 0.12s ease; }
.emp-picker-item:hover { background: var(--surface-hover); }
.emp-picker-item.selected { background: var(--accent); color: var(--accent-text); }
.emp-picker-item.selected .emp-picker-item-meta { color: rgba(255, 255, 255, 0.85); }
.emp-picker-item-text { min-width: 0; flex: 1; }
.emp-picker-item-name { font-weight: 600; font-size: 13.5px; color: inherit; }
.emp-picker-item-meta { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; margin-top: 2px; }
.emp-picker-item-sep { opacity: 0.5; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all 0.15s ease; white-space: nowrap; }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: #2a2a2a; transform: translateY(-1px); }
[data-theme="dark"] .btn-primary:hover { background: #fff; }
.btn-accent { background: var(--accent); color: var(--accent-text); }
.btn-accent:hover { background: #0b7d72; transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #d65d5d; transform: translateY(-1px); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s ease; }
.btn-icon:hover { background: var(--surface-hover); }
.btn-icon svg { width: 14px; height: 14px; }

.data-table-wrap { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: start; padding: 14px 18px; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px dashed var(--border-strong); white-space: nowrap; }
.data-table td { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.15s ease; cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface-dim); }
.table-cell-emp { display: flex; align-items: center; gap: 10px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 18px; padding-bottom: 8px; }
.page-btn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all 0.15s; background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.page-btn:hover { background: var(--surface-hover); }
.page-btn.active { background: var(--primary); color: var(--primary-text); }

/* === MODAL === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); width: 100%; max-width: 540px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-header { padding: 22px 24px 14px; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-dim); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.modal-close:hover { background: var(--surface-hover); }
.modal-close svg { width: 14px; height: 14px; }
.modal-body { padding: 4px 24px 18px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }

/* === FORMS === */
.form-row { margin-bottom: 14px; }
.form-row.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 11px 16px; background: var(--surface-dim); border: 1.5px solid transparent; border-radius: var(--radius-pill); font-size: 14px; color: var(--text); outline: none; transition: all 0.15s ease; }
.form-input:focus, .form-select:focus, .form-textarea:focus { background: var(--surface); border-color: var(--accent); }
.form-textarea { border-radius: var(--radius); min-height: 90px; resize: vertical; padding: 12px 16px; }
.form-select { appearance: none; cursor: pointer; }

/* === CARDS GRID === */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 4px; }
.dept-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 22px; transition: transform 0.2s ease, box-shadow 0.2s; cursor: pointer; }
.dept-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.dept-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.dept-icon svg { width: 22px; height: 22px; }
.dept-name { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.dept-meta { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }
.dept-stats { display: flex; gap: 22px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.dept-stat-num { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.dept-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* === DETAIL PAGE === */
.detail-grid { display: grid; grid-template-columns: 3fr 1.5fr; gap: 18px; margin-top: 4px; }
@media (max-width: 1024px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-avatar-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 18px; }
.detail-avatar {
  width: 100%; aspect-ratio: 1; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 700; color: var(--accent-text); overflow: hidden; margin-bottom: 14px;
}
.detail-info-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 22px; }
.detail-name { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.detail-role { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 500; }
.tag-pill.purple { background: var(--purple-soft); color: var(--purple); }
.tag-pill.green { background: var(--success-soft); color: var(--success); }
.tag-pill.blue { background: var(--info-soft); color: var(--info); }
.tag-pill.yellow { background: #fff4c2; color: #8b6914; }
.detail-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.detail-section-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.detail-list { display: flex; flex-direction: column; gap: 8px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.detail-row-label { font-size: 13px; color: var(--text-muted); }
.detail-row-val { font-size: 13.5px; font-weight: 500; color: var(--text); }

/* === APPROVAL CARDS === */
.approval-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 18px 22px; margin-bottom: 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
.approval-emp { display: flex; align-items: center; gap: 12px; }
.approval-details { display: flex; flex-direction: column; gap: 6px; }
.approval-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--text-secondary); }
.approval-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.approval-meta-item svg { width: 13px; height: 13px; opacity: 0.7; }
.approval-actions { display: flex; gap: 8px; }

/* === TOAST === */
.toast-host { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: var(--surface); border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500; animation: toastIn 0.25s ease forwards; }
.toast.success { color: var(--success); }
.toast.error { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* === STUB === */
.stub { padding: 80px 30px; text-align: center; }
.stub-icon { width: 72px; height: 72px; border-radius: 22px; background: var(--surface); display: flex; align-items: center; justify-content: center; margin: 0 auto 22px; box-shadow: var(--shadow-card); }
.stub-icon svg { width: 32px; height: 32px; color: var(--accent); }
.stub h3 { font-size: 26px; font-weight: 700; color: var(--text); margin-bottom: 8px; letter-spacing: -0.025em; }
.stub p { font-size: 14px; max-width: 380px; margin: 0 auto; color: var(--text-secondary); }

/* === ANIMATIONS === */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.page-anim > * { animation: fadeUp 0.4s ease backwards; }
.page-anim > *:nth-child(1) { animation-delay: 0.05s; }
.page-anim > *:nth-child(2) { animation-delay: 0.1s; }
.page-anim > *:nth-child(3) { animation-delay: 0.15s; }
.page-anim > *:nth-child(4) { animation-delay: 0.2s; }

/* === MOBILE SIDEBAR DRAWER === */
.mobile-menu-btn { display: none; }
.sidebar-backdrop { display: none; }

/* === RESPONSIVE === */

/* ── Tablet (≤ 1024px) ── */
@media (max-width: 1024px) {
  .topnav-item-label { display: none; }
  .action-pill span { display: none; }
  .app { padding-inline: 12px; gap: 12px; }
  .page-title { font-size: 32px; }
  .topbar { padding-inline: 12px; }
  .topnav-item { padding: 9px 12px; }
  .strip-mini { gap: 14px; }
  .strip-mini-value { font-size: 22px; }
  .detail-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .tasks-grid { grid-template-columns: 1fr; }
  .form-row.split { grid-template-columns: 1fr; }
  .approval-card { grid-template-columns: 1fr; gap: 12px; }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
  :root { --topbar-h: 60px; }

  /* Topbar */
  .topbar { padding-inline: 10px; gap: 8px; }
  .brand-name { display: none; }
  .brand-logo { width: 34px; height: 34px; font-size: 17px; }
  .topnav-wrap { overflow: hidden; }
  .topnav { padding: 3px; gap: 1px; }
  .topnav-item { padding: 7px 10px; }
  .topnav-item svg { width: 14px; height: 14px; }
  .topbar-actions { gap: 6px; }
  .icon-circle { width: 36px; height: 36px; }
  .icon-circle svg { width: 15px; height: 15px; }

  /* Hamburger button — visible on mobile */
  .mobile-menu-btn { display: flex !important; }

  /* Sidebar as drawer */
  .sidebar {
    position: fixed;
    top: 0; bottom: 0;
    inset-inline-start: 0;
    z-index: 200;
    width: 280px;
    max-width: 80vw;
    height: 100vh;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    padding-top: 22px;
  }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  /* Backdrop */
  .sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 199;
    backdrop-filter: blur(2px);
  }

  /* Layout */
  .app { padding-inline: 10px; gap: 0; padding-bottom: 16px; }
  .main { padding-inline-end: 0; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
  .page-title { font-size: 26px; }
  .page-subtitle { font-size: 13px; }

  /* Strip mini stats */
  .strip-mini { flex-wrap: wrap; gap: 10px; }
  .strip-mini-value { font-size: 20px; }
  .strip-mini-label { font-size: 10.5px; }
  .strip-stats { gap: 14px; }

  /* Cards */
  .card { padding: 16px; border-radius: 14px; }
  .card-title { font-size: 16px; }
  .cards-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Tables — horizontal scroll */
  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 500px; }
  .data-table th, .data-table td { padding: 10px 12px; font-size: 12.5px; }

  /* Table toolbar */
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .search-pill { min-width: unset; }

  /* Dashboard grid */
  .dash-grid { grid-template-columns: 1fr; gap: 12px; }
  .chart-card { grid-column: auto; }

  /* Dashboard tabs */
  .dash-tabs { width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .dash-tabs::-webkit-scrollbar { display: none; }
  .dash-tab { padding: 7px 12px; font-size: 0.8rem; }

  /* Calendar */
  .cal-cell { min-height: 60px; padding: 4px 3px; }
  .cal-header-cell { padding: 6px 2px; font-size: 0.7rem; }
  .cal-day { font-size: 0.75rem; }
  .cal-event { font-size: 0.6rem; padding: 1px 4px; }
  .cal-legend { flex-wrap: wrap; gap: 10px; }

  /* Analytics KPIs */
  .analytics-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px; gap: 10px; }
  .kpi-icon { width: 38px; height: 38px; }
  .kpi-value { font-size: 1.25rem; }

  /* Tasks grid */
  .tasks-grid { grid-template-columns: 1fr; }

  /* Modal */
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 85vh; border-radius: 16px 16px 0 0; }
  .modal-header { padding: 18px 18px 12px; }
  .modal-title { font-size: 18px; }
  .modal-body { padding: 4px 18px 14px; }
  .modal-footer { padding: 12px 18px 18px; flex-wrap: wrap; }

  /* Forms */
  .form-row.split { grid-template-columns: 1fr; }
  .form-input, .form-select, .form-textarea { padding: 10px 14px; font-size: 13px; }

  /* Buttons */
  .btn { padding: 8px 14px; font-size: 13px; }

  /* Approval cards */
  .approval-card { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .approval-actions { justify-content: flex-start; }

  /* Detail page */
  .detail-grid { grid-template-columns: 1fr; }
  .detail-name { font-size: 22px; }
  .detail-avatar { max-width: 200px; margin: 0 auto; }

  /* Donut chart */
  .donut-card { flex-direction: column; text-align: center; }
  .donut { width: 110px; height: 110px; margin: 0 auto; }

  /* Bar rows */
  .bar-label { width: 90px; font-size: 0.78rem; }

  /* Pagination */
  .pagination { gap: 4px; }
  .page-btn { min-width: 28px; height: 28px; font-size: 11.5px; }

  /* Toast */
  .toast-host { bottom: 12px; inset-inline-start: 12px; inset-inline-end: 12px; }
  .toast { font-size: 12.5px; padding: 10px 16px; }

  /* Auth */
  .auth-layout { padding: 1rem; }
  .auth-card { padding: 1.5rem; border-radius: 14px; }
}

/* ── Small phones (≤ 480px) ── */
@media (max-width: 480px) {
  .topnav-item { padding: 6px 8px; }
  .topnav-item svg { width: 13px; height: 13px; }
  .page-title { font-size: 22px; }
  .analytics-kpis { grid-template-columns: 1fr; }
  .kpi-card { flex-direction: row; }
  .strip-mini-item { flex-direction: column; align-items: flex-start; gap: 4px; }
  .strip-mini-value { font-size: 18px; }
  .cal-header-cell { font-size: 0.6rem; padding: 4px 1px; }
  .cal-cell { min-height: 48px; padding: 2px; }
  .cal-event { display: none; }
  .cal-day { font-size: 0.7rem; }
  .dept-stats { flex-direction: column; gap: 10px; }
}

/* === AUTH PAGES === */
.auth-layout {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-1);
  padding: 2rem;
}
.auth-card {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 2.5rem;
  width: 100%; max-width: 420px;
}
.auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; }
.auth-title { font-size: 1.5rem; font-weight: 800; color: var(--text); margin: 0 0 .25rem; }
.auth-subtitle { font-size: .9rem; color: var(--text-muted); margin: 0 0 1.5rem; }
.auth-field { margin-bottom: 1rem; }
.auth-field label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .35rem; }
.auth-field input {
  width: 100%; padding: .6rem .85rem; border-radius: var(--radius);
  border: 1.5px solid var(--border-strong); background: var(--surface-dim);
  font-size: .88rem; color: var(--text); outline: none;
  transition: border-color .2s;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-btn { width: 100%; margin-top: .5rem; padding: .7rem; font-size: .92rem; }
.auth-error {
  background: var(--danger-soft); color: var(--danger); border-radius: var(--radius);
  padding: .6rem .85rem; margin-bottom: 1rem; font-size: .85rem;
}
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .85rem; color: var(--text-muted); }
.auth-footer a { color: var(--accent); font-weight: 600; text-decoration: none; }
.validation-message { font-size: .78rem; color: var(--danger); margin-top: .2rem; }
.auth-info {
  background: rgba(13, 148, 136, 0.08); color: var(--accent); border-radius: var(--radius);
  padding: .6rem .85rem; margin-bottom: 1rem; font-size: .85rem;
}
.auth-tabs {
  display: flex; gap: 4px; background: var(--surface-hover); border-radius: 12px;
  padding: 4px; margin-bottom: 18px;
}
.auth-tab {
  flex: 1; padding: 8px 12px; border: none; background: transparent; border-radius: 9px;
  font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer;
  transition: all 0.15s ease;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-card); }
.auth-field-hint { display: block; margin-top: 4px; font-size: 11.5px; color: var(--text-muted); }
.auth-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.auth-checkbox input { width: 16px; height: 16px; cursor: pointer; }
.auth-otp-input {
  width: 100%; padding: 14px 18px; font-size: 22px; font-weight: 600; letter-spacing: 14px;
  text-align: center; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-family: ui-monospace, monospace;
  outline: none; transition: border-color 0.15s ease;
}
.auth-otp-input:focus { border-color: var(--accent); }
.auth-link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 500;
  padding: 4px 0;
}
.auth-link-btn:hover { text-decoration: underline; }
.auth-link-btn:disabled { color: var(--text-muted); cursor: not-allowed; text-decoration: none; }
.auth-divider {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 12px;
  font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.auth-social { display: flex; flex-direction: column; gap: 8px; }
.auth-social-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 14px; font-weight: 500; font-size: 13.5px;
  border: 1px solid var(--border);
}
.auth-social-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.auth-social-badge {
  margin-left: auto; padding: 2px 8px; border-radius: 99px;
  background: var(--surface-hover); color: var(--text-muted);
  font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
}
.auth-phone-row {
  display: flex; gap: 8px; align-items: stretch;
}
.auth-cc-select {
  flex: 0 0 auto; min-width: 100px;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer;
  outline: none; transition: border-color 0.15s ease;
}
.auth-cc-select:focus { border-color: var(--accent); }
.auth-phone-input {
  flex: 1; min-width: 0;
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px;
  outline: none; transition: border-color 0.15s ease;
}
.auth-phone-input:focus { border-color: var(--accent); }
.auth-phone-input::placeholder { color: var(--text-muted); }

/* Blazor-specific */
#blazor-error-ui { display: none; }

/* ── Import Button & Preview ─────────────────────────────── */

/* Summary bar */
.import-summary { display: flex; gap: 10px; align-items: center; padding: 10px 0 8px; font-size: 14px; flex-wrap: wrap; }
.import-valid   { color: #16a34a; font-weight: 700; }
.import-invalid { color: var(--danger, #dc2626); font-weight: 700; }
.import-sep     { color: var(--text-muted); }
.import-hint    { color: var(--text-secondary); font-size: 13px; }

/* Scrollable preview list */
.import-preview-scroll { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }

/* Each row card */
.import-row { border-radius: var(--radius, 8px); padding: 8px 12px; border: 1px solid transparent; }
.import-row-valid   { background: #f0fdf4; border-color: #bbf7d0; }
.import-row-invalid { background: #fff5f5; border-color: #fecaca; }

.import-row-num  { display: inline-block; font-size: 11px; font-weight: 600; color: var(--text-muted); min-width: 48px; }
.import-row-data { display: inline-flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.import-cell     { background: rgba(0,0,0,.04); border-radius: 4px; padding: 1px 6px; }

.import-row-errors { margin: 4px 0 0 52px; padding: 0 0 0 14px; color: var(--danger, #dc2626); font-size: 12px; }
.import-row-errors li { margin: 2px 0; }

/* Toast notification */
.import-toast { position: fixed; bottom: 28px; right: 28px; z-index: 9999;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-xl); padding: 14px 20px; min-width: 260px; max-width: 380px;
    font-size: 14px; font-weight: 500; animation: toast-in 0.25s ease; }
.import-toast-ok    { border-left: 4px solid #16a34a; color: #14532d; }
.import-toast-error { border-left: 4px solid var(--danger, #dc2626); color: var(--danger, #dc2626); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.loading-progress { display: none; }
