/* ============================================================
   PORT LOGIC ERP — Employee Directory Module
   Dark professional theme, mobile-first
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ---- Backgrounds (comfortable dark navy — easy on the eyes) ---- */
  --bg:       #0d1e33;
  --bg2:      #101f30;
  --surface:  #152f4a;
  --surface2: #1b3857;
  --surface3: #22415f;

  /* ---- Borders ---- */
  --border:   rgba(148,163,184,0.13);
  --border2:  rgba(148,163,184,0.2);
  --border3:  rgba(148,163,184,0.3);

  /* ---- Brand / Indigo ---- */
  --indigo:     #6366f1;
  --indigo-d:   #4f46e5;
  --indigo-l:   #a5b4fc;
  --indigo-bg:  rgba(99,102,241,0.1);
  --indigo-bg2: rgba(99,102,241,0.18);
  --violet:     #8b5cf6;
  --cyan:       #38bdf8;
  --green:      #34d399;
  --green-bg:   rgba(52,211,153,0.1);
  --red:        #f87171;
  --red-bg:     rgba(248,113,113,0.1);
  --yellow:     #fbbf24;
  --yellow-bg:  rgba(251,191,36,0.1);
  --orange:     #fb923c;

  /* ---- Text (bright, easy to read on dark navy) ---- */
  --text:   #eef3fb;
  --text2:  #bdd2e8;
  --text3:  #80a0c0;
  --text4:  #4e6e8e;

  /* ---- Gradients ---- */
  --grad:        linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --grad-hero:   linear-gradient(150deg, #162346 0%, #2a3d8c 40%, #3f5bc6 72%, #5b5ef8 100%);
  --grad-green:  linear-gradient(135deg, #059669, #34d399);
  --grad-red:    linear-gradient(135deg, #dc2626, #f87171);
  --grad-cyan:   linear-gradient(135deg, #0891b2, #38bdf8);
  --grad-gold:   linear-gradient(135deg, #d97706, #fbbf24);

  /* ---- Shadows (richer depth) ---- */
  --shadow-xs: 0 1px 3px rgba(0,0,0,0.35);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --shadow:    0 4px 20px rgba(0,0,0,0.45);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg: 0 16px 56px rgba(0,0,0,0.6);
  --shadow-xl: 0 32px 80px rgba(0,0,0,0.65);
  --shadow-indigo: 0 8px 32px rgba(99,102,241,0.4);

  /* ---- Radii ---- */
  --r-xs: 5px;  --r-sm: 9px;  --r: 13px;
  --r-md: 16px; --r-lg: 22px; --r-xl: 30px; --r-full: 9999px;

  /* ---- Transitions ---- */
  --ease:   cubic-bezier(0.4,0,0.2,1);
  --spring: cubic-bezier(0.34,1.56,0.64,1);
  --t:    all 0.22s var(--ease);
  --ts:   all 0.32s var(--ease);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; background: none; }
input, select, textarea { font-family: inherit; outline: none; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--indigo); }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: sticky; top: 0; z-index: 200;
  background: rgba(10,26,48,0.96);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(124,58,237,0.15);
  padding: 0 1.5rem; height: 62px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1rem; letter-spacing: -0.2px; white-space: nowrap;
}
.navbar-brand img {
  height: 44px; width: auto;
  filter: drop-shadow(0 2px 12px rgba(99,102,241,0.65));
}
.navbar-brand .brand-name { color: var(--text); }
.navbar-brand .brand-accent { color: var(--indigo-l); }
.module-badge {
  background: var(--indigo-bg); color: var(--indigo-l);
  border: 1px solid rgba(124,58,237,0.3); border-radius: var(--r-full);
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 10px; text-transform: uppercase; white-space: nowrap;
}
.navbar-actions { display: flex; align-items: center; gap: 0.5rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.5rem 1.1rem; border-radius: var(--r-sm);
  font-size: 0.85rem; font-weight: 500; transition: var(--t);
  white-space: nowrap; cursor: pointer; border: none; min-height: 38px;
}
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 3px 14px rgba(124,58,237,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-indigo); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--surface3); color: var(--text); border-color: var(--border3); }
.btn-danger  { background: var(--grad-red);   color: #fff; box-shadow: 0 3px 12px rgba(239,68,68,0.3); }
.btn-danger:hover  { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(239,68,68,0.4); }
.btn-success { background: var(--grad-green); color: #fff; box-shadow: 0 3px 12px rgba(16,185,129,0.3); }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,185,129,0.4); }
.btn-ghost { background: transparent; color: var(--text3); }
.btn-ghost:hover { background: var(--surface2); color: var(--text2); }
.btn-icon {
  width: 36px; height: 36px; padding: 0; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.875rem; transition: var(--t);
}
.btn-sm  { padding: 0.35rem 0.85rem; font-size: 0.78rem; min-height: 32px; }
.btn-lg  { padding: 0.7rem 1.6rem;   font-size: 0.95rem; font-weight: 600; min-height: 46px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 0.72rem; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.form-control {
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); border-radius: var(--r-sm);
  padding: 0.6rem 0.9rem; font-size: 0.875rem; transition: var(--t); width: 100%;
}
.form-control:focus {
  border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-bg); outline: none;
}
.form-control::placeholder { color: var(--text4); }
select.form-control { cursor: pointer; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr;     gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.search-wrapper { position: relative; }
.search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text4); font-size: 0.85rem; pointer-events: none;
}
.search-wrapper .form-control { padding-left: 2.5rem; }
.clear-search {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text4); font-size: 0.75rem; padding: 4px; transition: var(--t);
  display: inline-flex; align-items: center; border-radius: 50%;
}
.clear-search:hover { color: var(--text); background: var(--surface3); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: 0.67rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; white-space: nowrap;
}
.badge-purple  { background: var(--indigo-bg);  color: var(--indigo-l); border: 1px solid rgba(124,58,237,0.25); }
.badge-cyan    { background: rgba(6,182,212,.12);color: #22d3ee;        border: 1px solid rgba(6,182,212,.25); }
.badge-green   { background: var(--green-bg);   color: #34d399;        border: 1px solid rgba(16,185,129,.25); }
.badge-red     { background: var(--red-bg);     color: #f87171;        border: 1px solid rgba(239,68,68,.25); }
.badge-yellow  { background: var(--yellow-bg);  color: #fbbf24;        border: 1px solid rgba(245,158,11,.25); }
.badge-gray    { background: var(--surface3);   color: var(--text3);   border: 1px solid var(--border2); }
.badge-active  { background: var(--green-bg);   color: #34d399;        border: 1px solid rgba(16,185,129,.25); }
.badge-inactive{ background: var(--red-bg);     color: #f87171;        border: 1px solid rgba(239,68,68,.25); }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  border-radius: 12px; background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(124,58,237,0.3); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xl { width: 68px;  height: 68px;  font-size: 1.6rem;  border-radius: 14px; }
.avatar-lg { width: 52px;  height: 52px;  font-size: 1.25rem; }
.avatar-md { width: 42px;  height: 42px;  font-size: 0.95rem; }
.avatar-sm { width: 32px;  height: 32px;  font-size: 0.78rem; border-radius: 8px; }
.avatar-xs { width: 26px;  height: 26px;  font-size: 0.68rem; border-radius: 6px; }

.av-a,.av-n { background: linear-gradient(135deg,#7c3aed,#5b5ef8); }
.av-b,.av-o { background: linear-gradient(135deg,#0ea5e9,#2563eb); }
.av-c,.av-p { background: linear-gradient(135deg,#10b981,#059669); }
.av-d,.av-q { background: linear-gradient(135deg,#f59e0b,#d97706); }
.av-e,.av-r { background: linear-gradient(135deg,#ef4444,#dc2626); }
.av-f,.av-s { background: linear-gradient(135deg,#ec4899,#db2777); }
.av-g,.av-t { background: linear-gradient(135deg,#8b5cf6,#7c3aed); }
.av-h,.av-u { background: linear-gradient(135deg,#14b8a6,#0d9488); }
.av-i,.av-v { background: linear-gradient(135deg,#f97316,#ea580c); }
.av-j,.av-w { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.av-k,.av-x { background: linear-gradient(135deg,#a78bfa,#7c3aed); }
.av-l,.av-y { background: linear-gradient(135deg,#34d399,#10b981); }
.av-m,.av-z { background: linear-gradient(135deg,#fb923c,#f97316); }

/* ============================================================
   HERO SECTION
   ============================================================ */
.page-hero {
  background: var(--grad-hero);
  padding: 3.5rem 1.5rem 4rem; text-align: center;
  color: white; position: relative; overflow: hidden;
}
.page-hero::before {
  content: ''; position: absolute;
  top: -100px; right: -120px; width: 380px; height: 380px;
  border-radius: 50%; background: rgba(255,255,255,0.04); pointer-events: none;
}
.page-hero::after {
  content: ''; position: absolute;
  bottom: -80px; left: -80px; width: 280px; height: 280px;
  border-radius: 50%; background: rgba(255,255,255,0.04); pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }
.hero-breadcrumb {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; color: rgba(255,255,255,0.5);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 1rem;
}
.hero-breadcrumb i { font-size: 0.65rem; }
.hero-breadcrumb span:last-child { color: rgba(255,255,255,0.8); }
.page-hero h1 {
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  font-weight: 800; letter-spacing: -0.5px; line-height: 1.15;
  color: white; margin-bottom: 0.5rem;
}
.page-hero .hero-sub {
  font-size: 0.95rem; color: rgba(255,255,255,0.65); margin-bottom: 2rem;
  max-width: 480px; margin-left: auto; margin-right: auto;
}
.page-hero .hero-sub strong { color: rgba(255,255,255,0.9); }
.hero-search { max-width: 540px; margin: 0 auto; }
.hero-search .form-control {
  height: 52px; border-radius: 12px; font-size: 0.95rem;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: white; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.hero-search .form-control::placeholder { color: rgba(255,255,255,0.45); }
.hero-search .form-control:focus {
  background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.4);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 0 3px rgba(255,255,255,0.1);
}
.hero-search .search-icon { color: rgba(255,255,255,0.45); }
.hero-search .clear-search { color: rgba(255,255,255,0.5); }
.hero-search .clear-search:hover { color: white; background: rgba(255,255,255,0.1); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1.5rem;
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  position: sticky; top: 62px; z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}
.filter-label {
  font-size: 0.7rem; font-weight: 700; color: var(--text4);
  white-space: nowrap; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.1em;
  display: flex; align-items: center; gap: 5px;
}
.filter-group {
  display: flex; align-items: center; gap: 0;
  flex-shrink: 0; border: 1px solid var(--border2);
  border-radius: var(--r-sm); overflow: hidden; background: var(--surface2);
}
.filter-group-label {
  padding: 0.42rem 0.7rem; font-size: 0.65rem; font-weight: 700;
  color: var(--text4); text-transform: uppercase; letter-spacing: 0.08em;
  white-space: nowrap; background: var(--surface3); border-right: 1px solid var(--border2);
  user-select: none;
}
.filter-select {
  background: transparent; border: none;
  color: var(--text2); padding: 0.42rem 0.75rem;
  font-size: 0.83rem; font-weight: 500; cursor: pointer; transition: var(--t);
  min-width: 120px;
}
.filter-select:focus { outline: none; color: var(--text); }
.filter-divider { width: 1px; background: var(--border2); align-self: stretch; }

/* ============================================================
   FILTER GROUP (native select + color-scheme:dark for dark dropdown)
   ============================================================ */
.filter-group {
  display: flex; align-items: stretch; flex-shrink: 0;
  border: 1px solid var(--border2); border-radius: var(--r-sm);
  overflow: hidden; background: var(--surface2);
  transition: var(--t);
}
.filter-group:focus-within { border-color: var(--indigo); box-shadow: 0 0 0 2px var(--indigo-bg); }
.filter-group:hover { border-color: var(--border3); }

.filter-group-label {
  padding: 0 0.65rem; font-size: 0.62rem; font-weight: 700;
  color: var(--text4); text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--surface3); border-right: 1px solid var(--border2);
  display: flex; align-items: center; white-space: nowrap; user-select: none;
}
.filter-select {
  /* color-scheme:dark makes the browser render the dropdown list in dark mode */
  color-scheme: dark;
  background: transparent; border: none; outline: none;
  color: var(--text2); padding: 0.45rem 0.65rem;
  font-size: 0.83rem; font-weight: 500; cursor: pointer;
  min-width: 120px; font-family: inherit;
}
.filter-select option {
  background: #1b3857; color: #bdd2e8;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-area { padding: 1.25rem 1.5rem; max-width: 1500px; margin: 0 auto; }
.results-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem;
}
.results-count { font-size: 0.82rem; color: var(--text4); }
.results-count strong { color: var(--indigo-l); font-weight: 700; }
.results-count .filter-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--indigo-bg); color: var(--indigo-l);
  border: 1px solid rgba(124,58,237,0.2); border-radius: var(--r-full);
  padding: 2px 8px; font-size: 0.7rem; font-weight: 600;
  margin-left: 0.5rem;
}

/* ============================================================
   EMPLOYEE CARDS
   ============================================================ */
.employees-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.875rem;
}
.emp-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 1rem;
  display: flex; flex-direction: column; gap: 0.65rem;
  transition: var(--ts); position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
/* Color accent top stripe */
.emp-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad); opacity: 0; transition: var(--t);
}
.emp-card:hover {
  transform: translateY(-4px); border-color: rgba(124,58,237,0.3);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(124,58,237,0.15);
}
.emp-card:hover::before { opacity: 1; }

.emp-card-header { display: flex; align-items: center; gap: 0.75rem; }
.emp-card-info   { flex: 1; min-width: 0; }
.emp-name {
  font-size: 0.92rem; font-weight: 700; color: var(--text);
  line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.emp-title {
  font-size: 0.76rem; color: var(--text3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Chips row — dept badge + org items in one line */
.emp-chips {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}

.emp-meta { display: flex; flex-direction: column; gap: 5px; }
.emp-meta-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.78rem; color: var(--text3);
}
.emp-meta-row i { width: 13px; text-align: center; color: var(--indigo-l); font-size: 0.7rem; flex-shrink: 0; }
.btn-view {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  padding: 0.38rem 0.9rem; border-radius: var(--r-sm);
  font-size: 0.75rem; font-weight: 600; transition: var(--t);
  background: var(--indigo-bg); color: var(--indigo-l);
  border: 1px solid rgba(124,58,237,0.25);
}
.btn-view:hover {
  background: var(--indigo); color: white;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4); transform: translateY(-1px);
}

/* ============================================================
   EMPLOYEE CARD — CONTACT ROWS
   ============================================================ */
.emp-org-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.76rem; color: var(--text3);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 3px 9px;
}
.emp-org-item i { color: var(--indigo-l); font-size: 0.68rem; }
.emp-org-avaya {
  color: var(--indigo-l); font-weight: 600;
  background: var(--indigo-bg); border-color: rgba(99,102,241,0.25);
}
.emp-org-avaya i { color: var(--indigo-l); }

.emp-contacts { display: flex; flex-direction: column; gap: 6px; }

.emp-contact-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: var(--r-sm);
  transition: var(--t);
}
.emp-contact-row:hover { background: var(--surface2); }

.ec-icon {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
}
.ec-mobile  { background: rgba(16,185,129,.12);  color: #34d399; }
.ec-avaya   { background: rgba(124,58,237,.12);  color: var(--indigo-l); }
.ec-direct  { background: rgba(56,189,248,.12);  color: var(--cyan); }
.ec-email   { background: rgba(91,94,248,.12);   color: var(--indigo-l); }
.ec-pemail  { background: rgba(245,158,11,.12);  color: #fbbf24; }

.ec-body { flex: 1; min-width: 0; }
.ec-label { font-size: 0.64rem; color: var(--text4); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; display: block; }
.ec-value { font-size: 0.81rem; color: var(--text2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ec-value a { color: var(--text2); }
.ec-value a:hover { color: var(--indigo-l); }

.ec-btns { display: flex; gap: 4px; flex-shrink: 0; }
.ec-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border2);
  background: var(--surface2); color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; transition: var(--t); flex-shrink: 0;
}
.ec-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.ec-btn.call:hover    { background: rgba(16,185,129,.15); color: #34d399;         border-color: rgba(16,185,129,.3); }
.ec-btn.whatsapp:hover{ background: rgba(37,211,102,.15); color: #25d366;         border-color: rgba(37,211,102,.3); }
.ec-btn.mail:hover    { background: var(--indigo-bg);     color: var(--indigo-l); border-color: rgba(124,58,237,.3); }
.ec-btn.copy:hover    { background: rgba(56,189,248,.12); color: var(--cyan);     border-color: rgba(56,189,248,.3); }

/* Secondary contact row (shown below primary — slightly muted) */
.emp-contact-secondary {
  opacity: 0.82;
  border-top: 1px dashed var(--border);
  margin-top: 1px;
  padding-top: 6px !important;
}
.emp-contact-secondary .ec-label { font-size: 0.6rem; }
.emp-contact-secondary .ec-value { font-size: 0.78rem; }

/* Card footer */
.emp-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 0.6rem; border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ============================================================
   STAR BUTTON (favorites toggle)
   ============================================================ */
.star-btn { color: var(--text4); width: 32px; height: 32px; border-radius: 8px; }
.star-btn:hover         { background: var(--yellow-bg); color: var(--yellow); border-color: rgba(251,191,36,0.35); }
.star-btn.is-fav        { color: var(--yellow); background: var(--yellow-bg); border-color: rgba(251,191,36,0.35); }
.star-btn.is-fav:hover  { background: var(--red-bg); color: var(--red); border-color: rgba(248,113,113,0.3); }

/* ============================================================
   PINNED CONTACTS SECTION
   ============================================================ */
.pinned-section {
  background: var(--surface); border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--r-md); padding: 1rem 1rem 0.875rem;
  box-shadow: 0 0 0 1px rgba(99,102,241,0.07), var(--shadow-sm);
  margin-bottom: 1.25rem;
}
.pinned-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.7rem; font-weight: 700; color: var(--indigo-l);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.75rem;
}
.pinned-count {
  background: var(--indigo-bg); color: var(--indigo-l);
  border-radius: var(--r-full); padding: 1px 8px;
  font-size: 0.65rem; border: 1px solid rgba(99,102,241,0.25);
}
.pinned-grid {
  display: flex; gap: 0.65rem;
  overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin; scrollbar-color: var(--surface3) transparent;
}
.pinned-card {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 0.75rem;
  min-width: 175px; max-width: 195px; flex-shrink: 0;
  position: relative; display: flex; flex-direction: column; gap: 0.5rem;
  transition: var(--t);
}
.pinned-card:hover { border-color: rgba(99,102,241,0.3); box-shadow: var(--shadow-sm); }
.pinned-unpin {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface3); color: var(--text4);
  font-size: 0.62rem; display: flex; align-items: center; justify-content: center;
  transition: var(--t); cursor: pointer;
}
.pinned-unpin:hover { background: var(--red-bg); color: var(--red); }
.pinned-card-top { display: flex; align-items: center; gap: 8px; padding-right: 18px; }
.pinned-info { min-width: 0; flex: 1; }
.pinned-name  { font-size: 0.8rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinned-title { font-size: 0.68rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.pinned-ext   { font-size: 0.7rem; color: var(--indigo-l); display: flex; align-items: center; gap: 5px; }
.pinned-ext i { font-size: 0.62rem; }
.pinned-actions { display: flex; align-items: center; gap: 4px; }

/* ============================================================
   RECENTLY VIEWED SECTION
   ============================================================ */
.recent-section { margin-bottom: 1rem; }
.recent-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.68rem; font-weight: 700; color: var(--text4);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem;
}
.recent-header i { margin-right: 5px; }
.recent-clear {
  font-size: 0.68rem; color: var(--text4); background: none; border: none;
  cursor: pointer; font-family: inherit; padding: 2px 7px;
  border-radius: var(--r-sm); transition: var(--t);
}
.recent-clear:hover { color: var(--red); background: var(--red-bg); }
.recent-strip {
  display: flex; gap: 0.5rem;
  overflow-x: auto; padding-bottom: 2px; scrollbar-width: none;
}
.recent-strip::-webkit-scrollbar { display: none; }
.recent-pill {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--r-full); padding: 4px 12px 4px 4px;
  cursor: pointer; transition: var(--t); white-space: nowrap;
  font-family: inherit; color: var(--text2); flex-shrink: 0;
}
.recent-pill:hover { background: var(--surface2); border-color: rgba(99,102,241,0.3); color: var(--text); }
.recent-pill-name { font-size: 0.78rem; font-weight: 500; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 5rem 2rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.empty-icon {
  width: 70px; height: 70px; border-radius: var(--r-md);
  background: var(--indigo-bg); display: flex; align-items: center;
  justify-content: center; font-size: 2rem; color: var(--indigo-l);
}
.empty-state h3 { font-size: 1rem; color: var(--text2); }
.empty-state p  { font-size: 0.85rem; color: var(--text3); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(5,12,26,0.75); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--r-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl);
  transform: translateY(24px) scale(0.97); opacity: 0;
  transition: transform 0.28s var(--spring), opacity 0.2s var(--ease);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); opacity: 1; }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 680px; }
.modal-header {
  padding: 1.3rem 1.5rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.modal-close {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--surface2); color: var(--text3); font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; transition: var(--t);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem;
}

/* Employee Detail Modal */
.emp-detail-header {
  display: flex; align-items: center; gap: 1.25rem; padding: 1.5rem;
  background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(6,182,212,0.04));
  border-bottom: 1px solid var(--border);
}
.emp-detail-name { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.emp-detail-title { color: var(--text3); font-size: 0.83rem; margin-top: 2px; }
.emp-detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.emp-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; padding: 1.5rem; }
.emp-detail-item { display: flex; flex-direction: column; gap: 3px; }
.emp-detail-label { font-size: 0.67rem; color: var(--text4); text-transform: uppercase; letter-spacing: 0.09em; }
.emp-detail-value { font-size: 0.875rem; color: var(--text2); font-weight: 500; }
.emp-detail-value a { color: var(--indigo-l); }
.emp-detail-value a:hover { text-decoration: underline; }
.emp-detail-actions {
  display: flex; gap: 0.6rem; padding: 1rem 1.5rem;
  border-top: 1px solid var(--border); flex-wrap: wrap;
  background: var(--surface2); border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ============================================================
   FLASH / ALERTS
   ============================================================ */
.flash-wrap { padding: 0 1.5rem; margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.alert {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.8rem 1rem; border-radius: var(--r-sm);
  font-size: 0.85rem; font-weight: 500; animation: slideDown 0.3s var(--ease);
}
.alert-success { background: var(--green-bg); color: #34d399; border: 1px solid rgba(16,185,129,.25); }
.alert-error   { background: var(--red-bg);   color: #f87171; border: 1px solid rgba(239,68,68,.25); }
.alert-warning { background: var(--yellow-bg);color: #fbbf24; border: 1px solid rgba(245,158,11,.25); }
.alert-close { margin-left: auto; background: none; border: none; color: inherit; opacity: 0.6; cursor: pointer; font-size: 1rem; }
.alert-close:hover { opacity: 1; }

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.875rem 1.1rem; border-radius: var(--r);
  background: var(--surface2); border: 1px solid var(--border2);
  box-shadow: var(--shadow-lg); font-size: 0.85rem; color: var(--text2);
  max-width: 320px; pointer-events: all; animation: toastIn 0.35s var(--spring);
}
.toast.out { animation: toastOut 0.3s var(--ease) forwards; }
.toast-success { border-color: rgba(16,185,129,.3); }
.toast-success .t-icon { color: #34d399; }
.toast-error { border-color: rgba(239,68,68,.3); }
.toast-error .t-icon { color: #f87171; }
.toast-warning { border-color: rgba(245,158,11,.3); }
.toast-warning .t-icon { color: #fbbf24; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 1.5rem; position: relative; overflow: hidden;
}
.login-bg-glow {
  position: absolute; border-radius: 50%; pointer-events: none;
}
.login-bg-glow-1 {
  width: 600px; height: 600px; top: -250px; left: -200px;
  background: radial-gradient(circle, rgba(124,58,237,0.18) 0%, transparent 65%);
}
.login-bg-glow-2 {
  width: 500px; height: 500px; bottom: -200px; right: -150px;
  background: radial-gradient(circle, rgba(91,94,248,0.15) 0%, transparent 65%);
}
.login-bg-glow-3 {
  width: 300px; height: 300px; top: 40%; left: 50%;
  background: radial-gradient(circle, rgba(6,182,212,0.07) 0%, transparent 65%);
}
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 400px;
  background: rgba(15,32,58,0.94); border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--r-xl); padding: 2.5rem;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(124,58,237,0.12);
  backdrop-filter: blur(24px);
}
.login-erp-tag {
  text-align: center; font-size: 0.65rem; font-weight: 700; color: var(--text4);
  text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 1.5rem;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-erp-tag::before, .login-erp-tag::after {
  content: ''; flex: 1; height: 1px; background: var(--border2);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.login-logo img {
  height: 48px; width: auto;
  filter: drop-shadow(0 0 16px rgba(124,58,237,0.5));
}
.login-heading { text-align: center; font-size: 1.45rem; font-weight: 800; color: var(--text); }
.login-sub { text-align: center; font-size: 0.82rem; color: var(--text3); margin: 0.35rem 0 1.75rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.input-icon-wrap { position: relative; }
.input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text4); font-size: 0.85rem; pointer-events: none; }
.input-icon-wrap .form-control { padding-left: 2.5rem; height: 48px; font-size: 0.9rem; }
.toggle-pw { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--text4); font-size: 0.85rem; transition: var(--t); }
.toggle-pw:hover { color: var(--text2); }
.login-opts { display: flex; align-items: center; justify-content: space-between; font-size: 0.8rem; color: var(--text3); }
.cb-label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.cb-label input[type="checkbox"] { accent-color: var(--indigo); width: 14px; height: 14px; }
.login-submit {
  width: 100%; height: 48px; border-radius: var(--r-sm);
  font-size: 0.95rem; font-weight: 700; background: var(--grad); color: #fff;
  transition: var(--ts); box-shadow: 0 4px 20px rgba(124,58,237,0.4);
  margin-top: 0.25rem; letter-spacing: 0.02em;
}
.login-submit:hover { transform: translateY(-2px); box-shadow: 0 10px 36px rgba(124,58,237,0.55); }
.login-submit:active { transform: translateY(0); }
.login-back { text-align: center; font-size: 0.8rem; color: var(--text4); margin-top: 1.5rem; }
.login-back a { color: var(--indigo-l); font-weight: 500; }
.login-back a:hover { text-decoration: underline; }

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 0.9rem; color: var(--text);
}
.sidebar-brand img {
  height: 36px; width: auto;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,0.55));
}
.sidebar-badge {
  margin-left: auto; font-size: 0.58rem; background: var(--indigo-bg);
  color: var(--indigo-l); border-radius: var(--r-full);
  padding: 2px 7px; font-weight: 700; letter-spacing: 0.08em;
  border: 1px solid rgba(124,58,237,0.25); white-space: nowrap; text-transform: uppercase;
}
.sidebar-nav { flex: 1; padding: 0.75rem; display: flex; flex-direction: column; gap: 2px; }
.sidebar-section {
  font-size: 0.62rem; font-weight: 700; color: var(--text4);
  text-transform: uppercase; letter-spacing: 0.12em;
  padding: 0.875rem 0.75rem 0.4rem;
}
.sidebar-item {
  display: flex; align-items: center; gap: 9px;
  padding: 0.575rem 0.85rem; border-radius: var(--r-sm);
  font-size: 0.85rem; font-weight: 500; color: var(--text3);
  transition: var(--t); cursor: pointer; border: none; width: 100%;
  text-align: left; background: none;
}
.sidebar-item i { width: 17px; text-align: center; font-size: 0.85rem; flex-shrink: 0; }
.sidebar-item:hover { background: var(--surface2); color: var(--text2); }
.sidebar-item.active {
  background: var(--indigo-bg); color: var(--indigo-l); font-weight: 600;
  border-left: 3px solid var(--indigo);
  margin-left: -3px; padding-left: calc(0.85rem + 3px);
}
.sidebar-count {
  margin-left: auto; background: var(--surface3); color: var(--text4);
  font-size: 0.65rem; font-weight: 700; padding: 2px 7px;
  border-radius: var(--r-full); min-width: 20px; text-align: center;
  border: 1px solid var(--border2);
}
.sidebar-item.active .sidebar-count { background: var(--indigo-bg2); color: var(--indigo-l); border-color: rgba(124,58,237,0.3); }
.sidebar-footer { padding: 0.75rem; border-top: 1px solid var(--border); }

.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  padding: 0.875rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
  background: var(--surface); position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 rgba(124,58,237,0.1);
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.mobile-menu-btn {
  display: none; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r-sm); width: 36px; height: 36px; color: var(--text3);
  align-items: center; justify-content: center; font-size: 0.95rem; transition: var(--t);
}
.mobile-menu-btn:hover { color: var(--text); background: var(--surface3); }
.topbar-title { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.admin-content { flex: 1; padding: 1.5rem; background: var(--bg); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  padding: 1.25rem; display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm); transition: var(--ts);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border2); }
.stat-icon {
  width: 46px; height: 46px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0;
}
.si-purple { background: var(--indigo-bg);      color: var(--indigo-l); }
.si-cyan   { background: rgba(6,182,212,.12);   color: var(--cyan); }
.si-green  { background: var(--green-bg);        color: #34d399; }
.si-yellow { background: var(--yellow-bg);       color: #fbbf24; }
.stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1; letter-spacing: -0.5px; color: var(--text); }
.stat-label { font-size: 0.68rem; color: var(--text4); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 600; }

/* Tables */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm);
}
.table-toolbar {
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); background: var(--surface2);
}
.table-title { font-size: 0.875rem; font-weight: 700; color: var(--text); }
.table-spacer { flex: 1; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 0.65rem 1rem; text-align: left;
  font-size: 0.67rem; font-weight: 700; color: var(--text4);
  text-transform: uppercase; letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border2); white-space: nowrap;
  background: var(--surface2);
}
tbody td {
  padding: 0.75rem 1rem; font-size: 0.85rem; color: var(--text3);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
/* Phone + email columns: allow stacking (Ext=5, DirectPhone=6, Mobile=7, Email=8) */
#emp-table td:nth-child(5),
#emp-table td:nth-child(6),
#emp-table td:nth-child(7),
#emp-table td:nth-child(8) { white-space: normal; }
.td-primary { color: var(--text); font-weight: 600; }
.td-sub { font-size: 0.72rem; color: var(--text4); margin-top: 1px; }
tbody tr { transition: var(--t); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
/* Sticky actions column */
tbody td:last-child, thead th:last-child {
  position: sticky; right: 0;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 1; max-width: none; overflow: visible;
}
tbody tr:hover td:last-child { background: var(--surface2); }
thead th:last-child { background: var(--surface2); }
.t-actions { display: flex; gap: 6px; align-items: center; }
.btn-edit { background: var(--surface2); color: var(--text3); border: 1px solid var(--border2); }
.btn-edit:hover { background: var(--indigo-bg); color: var(--indigo-l); border-color: rgba(124,58,237,.3); }
.btn-del  { background: var(--surface2); color: var(--text3); border: 1px solid var(--border2); }
.btn-del:hover  { background: var(--red-bg); color: #f87171; border-color: rgba(239,68,68,.3); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes toastIn {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0) scale(1); opacity: 1; }
  to   { transform: translateX(120%) scale(0.9); opacity: 0; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.4s var(--ease) both; }
.fi-1 { animation-delay: 0.04s; }
.fi-2 { animation-delay: 0.09s; }
.fi-3 { animation-delay: 0.14s; }
.fi-4 { animation-delay: 0.19s; }

/* Sidebar overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(5,14,28,0.65); z-index: 299; backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   RESPONSIVE — TABLET 1100px
   ============================================================ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 210px; }
}

/* ============================================================
   RESPONSIVE — ADMIN SIDEBAR 900px
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0; z-index: 300;
    width: 240px; box-shadow: var(--shadow-xl); transition: var(--ts);
  }
  .sidebar.open { left: 0; }
  .mobile-menu-btn { display: inline-flex; }
  .admin-content { padding: 1rem; }
  .admin-topbar { padding: 0.75rem 1rem; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   RESPONSIVE — PHONE 768px
   ============================================================ */
@media (max-width: 768px) {
  /* Navbar */
  .navbar { padding: 0 1rem; height: 56px; }
  .navbar-brand { gap: 8px; font-size: 0.95rem; }
  .navbar-brand img { height: 30px; }

  /* Filter bar: 2-column grid — all filters visible, no scrolling */
  .filter-bar {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0.5rem; padding: 0.75rem 1rem; top: 56px;
    overflow-x: visible; flex-wrap: unset;
  }
  .filter-label { display: none; }
  .filter-group { width: 100%; flex-shrink: unset; }
  .filter-group-label { padding: 0 0.5rem; font-size: 0.6rem; }
  .filter-select { min-width: 0; width: 100%; padding: 0.42rem 0.5rem; font-size: 0.8rem; }
  /* Reset button spans full width */
  .filter-bar > .btn { grid-column: 1 / -1; justify-self: start; }

  /* Hero */
  .page-hero { padding: 2rem 1rem 2.75rem; }
  .page-hero h1 { font-size: 1.65rem; }
  .page-hero .hero-sub { font-size: 0.875rem; margin-bottom: 1.75rem; }
  .hero-search .form-control { height: 48px; font-size: 0.9rem; }

  /* Content & grid */
  .content-area { padding: 0.875rem 1rem; }
  .employees-grid { grid-template-columns: 1fr; gap: 0.875rem; }
  .emp-card { padding: 1rem; }

  /* Contact rows touch targets */
  .ec-btn { width: 38px; height: 38px; border-radius: 9px; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Bottom-sheet modals */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92vh; max-width: 100%; }
  .modal-sm, .modal-lg { max-width: 100%; }
  .modal-header { padding: 1.1rem 1.25rem 0.875rem; }
  .modal-body { padding: 1.25rem; }
  .modal-footer { padding: 0.875rem 1.25rem; }
  .emp-detail-header { padding: 1.25rem; }
  .emp-detail-grid { grid-template-columns: 1fr; padding: 1.25rem; }
  .emp-detail-actions { padding: 0.875rem 1.25rem; }

  /* Login */
  .login-card { padding: 2rem 1.25rem; border-radius: var(--r-lg); }

  /* Admin employee table: hide Title, Branch, Ext on mobile (9-col table) */
  #emp-table th:nth-child(2), #emp-table td:nth-child(2),
  #emp-table th:nth-child(4), #emp-table td:nth-child(4),
  #emp-table th:nth-child(5), #emp-table td:nth-child(5),
  #emp-table th:nth-child(8), #emp-table td:nth-child(8) { display: none; }

  /* Allow multi-line in Direct Phone + Mobile */
  #emp-table td:nth-child(6),
  #emp-table td:nth-child(7) { white-space: normal; max-width: 140px; }
}

/* ============================================================
   RESPONSIVE — SMALL PHONE 480px
   ============================================================ */
@media (max-width: 480px) {
  /* Navbar: hide module badge, shrink admin button to icon only */
  .navbar-brand .module-badge { display: none; }
  .nav-btn-text { display: none; }
  .navbar-actions .btn { padding: 0.45rem 0.7rem; min-height: 34px; }

  /* Filter bar: single column on very small screens */
  .filter-bar { grid-template-columns: 1fr; }

  /* Hero: hide breadcrumb, tighter */
  .hero-breadcrumb { display: none; }
  .page-hero { padding: 1.75rem 1rem 2.25rem; }
  .page-hero h1 { font-size: 1.4rem; }
  .page-hero .hero-sub { font-size: 0.82rem; margin-bottom: 1.2rem; }
  .hero-search .form-control { height: 46px; }

  /* Cards */
  .emp-card { padding: 0.875rem; border-radius: var(--r); }
  .avatar-lg { width: 46px; height: 46px; font-size: 1.1rem; border-radius: 10px; }
  .emp-name { font-size: 0.875rem; }
  .emp-title { font-size: 0.74rem; }
  .ec-icon { width: 26px; height: 26px; font-size: 0.68rem; border-radius: 6px; }
  .ec-label { font-size: 0.6rem; }
  .ec-value { font-size: 0.77rem; }
  .ec-btn { width: 36px; height: 36px; font-size: 0.77rem; }
  .btn-view { font-size: 0.74rem; padding: 0.38rem 0.75rem; }
  .emp-org-item { font-size: 0.72rem; padding: 2px 7px; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr; }

  /* Toast */
  #toast-container { bottom: 0.75rem; right: 0.75rem; left: 0.75rem; }
  .toast { max-width: none; font-size: 0.82rem; }

  /* Login */
  .login-card { padding: 1.75rem 1.1rem; }
  .login-heading { font-size: 1.25rem; }
}

/* ============================================================
   GRID BREAKPOINTS
   ============================================================ */
@media (min-width: 560px) and (max-width: 900px) {
  .employees-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .employees-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ============================================================
   MOBILE TOUCH & PERFORMANCE IMPROVEMENTS
   ============================================================ */

/* Prevent tap highlight on interactive elements */
a, button { -webkit-tap-highlight-color: transparent; }

/* Better touch scrolling inside modals and tables */
.modal, .table-scroll, .pinned-grid, .recent-strip {
  -webkit-overflow-scrolling: touch;
}

/* Larger minimum tap targets on mobile */
@media (max-width: 768px) {
  /* Action buttons in cards: larger targets */
  .ec-btn, .star-btn { width: 42px; height: 42px; border-radius: 10px; font-size: 0.9rem; }
  .btn-view { padding: 0.45rem 1rem; font-size: 0.78rem; min-height: 38px; }

  /* Better topbar on admin: wrap actions */
  .topbar-right { gap: 0.4rem; }
  .topbar-right .btn { font-size: 0.75rem; padding: 0.3rem 0.65rem; min-height: 32px; }

  /* Stat cards: compact but readable */
  .stat-card { padding: 1rem; gap: 0.75rem; }
  .stat-icon { width: 40px; height: 40px; font-size: 1rem; }
  .stat-value { font-size: 1.4rem; }

  /* Modal: ensure body scrolls on small screens */
  .modal { max-height: 95vh; }
  .modal-body { overflow-y: auto; max-height: 55vh; }

  /* Prevent filter overflow */
  .filter-bar { max-width: 100vw; overflow-x: hidden; }

  /* Employee detail actions: wrap nicely */
  .emp-detail-actions { gap: 0.5rem; }
  .emp-detail-actions .btn { flex: 1; justify-content: center; min-width: 0; font-size: 0.8rem; }
}

@media (max-width: 480px) {
  /* Admin topbar: stack on very small */
  .admin-topbar { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .topbar-right { width: 100%; justify-content: flex-start; }

  /* Pinned grid: scrollable horizontal strip */
  .pinned-card { min-width: 155px; max-width: 170px; }

  /* Employee name: allow wrapping on very small */
  .emp-name { white-space: normal; line-height: 1.3; }
}
