/* ═══════════════════════════════════════════════════════════
   GREEN TRADE MEDICAL CRM — Design System v4.0
   Company Identity: Graphik Arabic + Poppins
   Brand Palette: Green Trade Medical Identity
   ═══════════════════════════════════════════════════════════ */

/* ── Company Fonts: Graphik Arabic ───────────────────────── */
@font-face {
  font-family: 'Graphik Arabic';
  src: url('/static/fonts/Graphik Arabic.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Arabic';
  src: url('/static/fonts/Graphik Arabic Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Arabic';
  src: url('/static/fonts/Graphik Arabic Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Arabic';
  src: url('/static/fonts/Graphik Arabic SemiBold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Arabic';
  src: url('/static/fonts/Graphik Arabic Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Graphik Arabic';
  src: url('/static/fonts/Graphik Arabic Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ── Company Fonts: Poppins (English) ────────────────────── */
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/Poppins-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/Poppins-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/Poppins-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/Poppins-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/Poppins-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/static/fonts/Poppins-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* fallback: Google Fonts Inter only (no Arabic Google font needed now) */
@import url(https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap);

:root {
  /* ── Brand Colors — matches the Tender Intelligence app's identity ── */
  --brand:        #08302f;   /* Primary dark green */
  --brand-deep:   #041d1d;   /* Darker shade */
  --brand-mid:    #00ff91;   /* Accent mint/emerald */
  --brand-light:  #65feab;   /* Light accent */
  --brand-glow:   rgba(0,255,145,.18);
  --brand-faint:  #eafff5;

  /* Secondary brand accent — same emerald family (no gold) */
  --accent:       #00ff91;
  --accent-deep:  #00bf6c;
  --accent-light: #9dffc4;
  --accent-faint: #eafff5;

  /* Sidebar — white, matches Tender Intelligence's sidebar exactly */
  --sb-bg:        #ffffff;
  --sb-surface:   #f7faf9;
  --sb-border:    #e7eeec;
  --sb-item:      #f7faf9;
  --sb-item-hov:  #e6fff4;
  --sb-item-act:  #e6fff4;
  --sb-text:      #5e6f6d;
  --sb-text-act:  #08302f;
  --sb-label:     #9aa6a4;
  --sb-width:     248px;

  /* Surface */
  --bg-base:      #f7faf9;
  --bg-card:      #ffffff;
  --bg-card2:     #f8faf9;
  --bg-input:     #f5f8f6;
  --surface-1:    rgba(255,255,255,.93);
  --surface-2:    rgba(255,255,255,.62);

  /* Text */
  --tx-1:  #0a120d;
  --tx-2:  #1a2e22;
  --tx-3:  #4a6355;
  --tx-4:  #8aa898;
  --tx-inv:#ffffff;

  /* Semantic */
  --green:   #08302f;
  --green-l: #d4edda;
  --blue:    #1a56db;
  --blue-l:  #dbeafe;
  --amber:   #d97706;
  --amber-l: #fdf0c9;
  --red:     #cc2222;
  --red-l:   #fee2e2;
  --purple:  #6d28d9;
  --purple-l:#ede9fe;
  --teal:    #0d9488;
  --teal-l:  #ccfbf1;
  --rose:    #e11d48;
  --rose-l:  #ffe4e6;

  /* Border & Shadow */
  --border:     #e7eeec;
  --border-2:   #c8d8cc;
  --sh-xs:  0 1px 2px rgba(0,0,0,.04);
  --sh-sm:  0 2px 8px rgba(0,0,0,.06),0 1px 3px rgba(0,0,0,.04);
  --sh-md:  0 4px 20px rgba(0,0,0,.08),0 2px 8px rgba(0,0,0,.04);
  --sh-lg:  0 12px 40px rgba(0,0,0,.10),0 4px 12px rgba(0,0,0,.05);
  --sh-xl:  0 24px 64px rgba(0,0,0,.14);
  --sh-brand: 0 2px 8px rgba(0,0,0,.12);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-2xl:32px;
  --r-full:9999px;

  /* Motion */
  --ease:   cubic-bezier(.22,1,.36,1);
  --ease-b: cubic-bezier(.34,1.56,.64,1);
  --t-fast: 120ms;
  --t-mid:  220ms;
  --t-slow: 380ms;

  /* Typography — Company Identity Fonts */
  --font-en: 'Poppins', 'Inter', system-ui, sans-serif;
  --font-ar: 'Graphik Arabic', 'Poppins', 'Inter', system-ui, sans-serif;
  --font: var(--font-ar);

  /* Layout */
  --topbar-h: 58px;
  --content-max: 1440px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*,::before,::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:15px; -webkit-tap-highlight-color:transparent; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--tx-1);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ══════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════ */

#app-shell {
  display: flex;
  min-height: 100dvh;
  position: relative;
}

/* Sidebar Overlay (mobile) */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  backdrop-filter: blur(2px);
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════ */

#sidebar {
  width: var(--sb-width);
  height: 100dvh;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  overflow: hidden;
  z-index: 300;
  border-left: 1px solid var(--sb-border);
  transition: transform var(--t-mid) var(--ease);
}


/* Sidebar Header */
.sidebar-header {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
  position: relative;
}

.sidebar-logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.sidebar-brand-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--accent-deep);
  background: var(--brand-faint);
  border: 1px solid rgba(0,255,145,.2);
  padding: 3px 8px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

/* User mini card */
.sidebar-user {
  padding: 12px 14px;
  margin: 8px 10px;
  border-radius: var(--r-md);
  background: var(--sb-item);
  border: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.sidebar-user:hover { background: var(--sb-item-hov); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--accent-deep);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-mid);
  box-shadow: 0 0 6px rgba(0,255,145,.6);
  flex-shrink: 0;
}

/* Scrollable nav area */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 4px; }

/* Section Labels */
.sidebar-section-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--sb-label);
  padding: 16px 8px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Nav Items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--sb-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  margin-bottom: 2px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover {
  background: var(--sb-item-hov);
  color: var(--brand);
}
.nav-item.active {
  background: var(--sb-item-act);
  color: var(--sb-text-act);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--brand-mid);
  border-radius: 4px 0 0 4px;
}
.nav-item.hidden { display: none; }
.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
  opacity: .75;
}
.nav-item.active i { opacity: 1; }
.nav-label-en, .nav-label-ar {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge on nav items */
.nav-badge {
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--sb-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  width: 100%;
}
.sidebar-footer-btn:hover {
  background: rgba(239,68,68,.1);
  color: #dc2626;
}
.sidebar-footer-btn i { width: 18px; text-align: center; font-size: 13px; }

/* ══════════════════════════════════════════════════════════
   MAIN CONTENT AREA
   ══════════════════════════════════════════════════════════ */

#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Top Bar */
#topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: var(--sh-xs);
}

.topbar-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  align-items: center;
  justify-content: center;
  color: var(--tx-3);
  transition: all var(--t-fast);
  cursor: pointer;
}
.topbar-menu-btn:hover { background: var(--bg-base); color: var(--tx-1); }

.topbar-breadcrumb {
  flex: 1;
  min-width: 0;
}
.topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--tx-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-subtitle {
  font-size: 11px;
  color: var(--tx-4);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx-3);
  cursor: pointer;
  transition: all var(--t-fast);
  position: relative;
  background: transparent;
}
.topbar-icon-btn:hover { background: var(--bg-base); color: var(--tx-1); }
.topbar-icon-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--bg-card);
}

/* Page Content */
#page-content {
  flex: 1;
  padding: 24px 20px;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* ══════════════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════════════ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header-left { min-width: 0; flex: 1; }
.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--tx-1);
  letter-spacing: -.3px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.page-title-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--brand-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-size: 16px;
  flex-shrink: 0;
}
.page-subtitle {
  font-size: 13px;
  color: var(--tx-4);
  margin-top: 4px;
}
.page-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx-1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i {
  color: var(--brand);
  font-size: 13px;
}
.card-body { padding: 20px; }
.card-body-sm { padding: 14px 16px; }
.card-body-lg { padding: 24px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card2);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Glass Card */
.card-glass {
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
}

/* ══════════════════════════════════════════════════════════
   KPI / STAT CARDS
   ══════════════════════════════════════════════════════════ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  box-shadow: var(--sh-sm);
  cursor: default;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--kpi-color, var(--brand));
  opacity: .7;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}

.kpi-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 12px;
  background: var(--kpi-bg, var(--brand-faint));
  color: var(--kpi-color, var(--brand));
}
.kpi-card-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--tx-1);
  letter-spacing: -.5px;
  line-height: 1.1;
}
.kpi-card-label {
  font-size: 12px;
  color: var(--tx-4);
  margin-top: 4px;
  font-weight: 500;
}
.kpi-card-delta {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-card-delta.up { color: var(--green); }
.kpi-card-delta.down { color: var(--red); }
.kpi-card-delta.neutral { color: var(--tx-4); }

/* Colored KPI variants */
.kpi-green  { --kpi-color: #08302f; --kpi-bg: #f0faf5; }
.kpi-blue   { --kpi-color: #2563eb; --kpi-bg: #eff6ff; }
.kpi-amber  { --kpi-color: #d97706; --kpi-bg: #fffbeb; }
.kpi-red    { --kpi-color: #dc2626; --kpi-bg: #fef2f2; }
.kpi-purple { --kpi-color: #7c3aed; --kpi-bg: #f5f3ff; }
.kpi-teal   { --kpi-color: #0d9488; --kpi-bg: #f0fdfa; }
.kpi-rose   { --kpi-color: #e11d48; --kpi-bg: #fff1f2; }

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  line-height: 1;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--t-fast);
}
.btn:hover::after { background: rgba(255,255,255,.08); }
.btn:active::after { background: rgba(0,0,0,.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-xs  { padding: 5px 12px; font-size: 11px; border-radius: var(--r-xs); }
.btn-sm  { padding: 7px 14px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; border-radius: var(--r-md); }
.btn-xl  { padding: 14px 32px; font-size: 16px; border-radius: var(--r-lg); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: white;
  box-shadow: var(--sh-brand), 0 0 0 rgba(0,255,145,0);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,.18), 0 6px 20px rgba(0,255,145,.28);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-2);
  color: var(--tx-2);
}
.btn-secondary:hover { background: var(--bg-base); border-color: var(--tx-4); }

.btn-ghost {
  background: transparent;
  color: var(--tx-3);
}
.btn-ghost:hover { background: var(--bg-base); color: var(--tx-1); }

.btn-danger {
  background: linear-gradient(135deg, var(--red), #b91c1c);
  color: white;
  box-shadow: 0 4px 16px rgba(220,38,38,.2);
}

.btn-success {
  background: linear-gradient(135deg, var(--green), #08302f);
  color: white;
}

.btn-amber {
  background: linear-gradient(135deg, var(--amber), #b45309);
  color: white;
}

.btn-blue {
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: white;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-sm);
}
.btn-icon.btn-xs { width: 28px; height: 28px; }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn-icon.btn-lg { width: 42px; height: 42px; }

/* ══════════════════════════════════════════════════════════
   BADGES & CHIPS
   ══════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}
.badge-xs { padding: 2px 7px; font-size: 10px; }
.badge-lg { padding: 5px 12px; font-size: 13px; }

.badge-green  { background: var(--green-l);  color: #08302f; }
.badge-blue   { background: var(--blue-l);   color: #1e40af; }
.badge-amber  { background: var(--amber-l);  color: #92400e; }
.badge-red    { background: var(--red-l);    color: #991b1b; }
.badge-purple { background: var(--purple-l); color: #6d28d9; }
.badge-teal   { background: var(--teal-l);   color: #0f766e; }
.badge-gray   { background: #f1f5f9;         color: #475569; }
.badge-rose   { background: var(--rose-l);   color: #9f1239; }

/* Role badge */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .2px;
}
.pos-ceo   { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.pos-bum   { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.pos-sm    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.pos-pm    { background: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }
.pos-kam   { background: #d4edda; color: #08302f; border: 1px solid #bbf7d0; }
.pos-ss    { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.pos-sup   { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.pos-mr    { background: #f5f3ff; color: #5b21b6; border: 1px solid #e9d5ff; }
.pos-admin { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ══════════════════════════════════════════════════════════
   FORMS & INPUTS
   ══════════════════════════════════════════════════════════ */

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tx-2);
  margin-bottom: 6px;
}
.form-label span { color: var(--red); margin-right: 2px; }
.form-hint { font-size: 11px; color: var(--tx-4); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--red); margin-top: 4px; }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--tx-1);
  background: var(--bg-input);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  font-family: inherit;
  line-height: 1.5;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.input::placeholder { color: var(--tx-4); }
.input-sm { padding: 7px 11px; font-size: 12.5px; border-radius: var(--r-xs); }
.input-lg { padding: 11px 16px; font-size: 15px; border-radius: var(--r-md); }

.select { cursor: pointer; appearance: none; padding-left: 36px; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 11px;
  color: var(--tx-4);
  position: absolute;
  right: auto;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.textarea { resize: vertical; min-height: 90px; }

/* Input with icon */
.input-group { position: relative; }
.input-group .input { padding-right: 42px; }
.input-group-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tx-4);
  font-size: 13px;
  pointer-events: none;
}
.input-group-icon-left {
  right: auto;
  left: 13px;
}
.input-group .input.icon-left { padding-right: 13px; padding-left: 40px; }

/* Search input */
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap .input {
  padding-right: 38px;
}
.search-input-wrap::before {
  content: '\f002';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 13px;
  color: var(--tx-4);
  font-size: 12px;
  pointer-events: none;
}

/* Form grid */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ══════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════ */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead tr {
  background: var(--bg-card2);
}
.table th {
  padding: 11px 16px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-4);
  letter-spacing: .4px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--tx-2);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr {
  transition: background var(--t-fast);
}
.table tbody tr:hover { background: var(--bg-card2); }
.table .td-action {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ══════════════════════════════════════════════════════════
   GRID LAYOUTS
   ══════════════════════════════════════════════════════════ */

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

/* ══════════════════════════════════════════════════════════
   AVATAR
   ══════════════════════════════════════════════════════════ */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
}
.av-xs  { width: 24px; height: 24px; font-size: 10px; }
.av-sm  { width: 32px; height: 32px; font-size: 12px; }
.av-md  { width: 40px; height: 40px; font-size: 15px; }
.av-lg  { width: 48px; height: 48px; font-size: 18px; }
.av-xl  { width: 64px; height: 64px; font-size: 22px; }
.av-2xl { width: 80px; height: 80px; font-size: 28px; }

/* Avatar stack */
.avatar-stack {
  display: flex;
  flex-direction: row-reverse;
}
.avatar-stack .avatar {
  border: 2px solid var(--bg-card);
  margin-left: -8px;
}
.avatar-stack .avatar:last-child { margin-left: 0; }

/* ══════════════════════════════════════════════════════════
   LOADING & SKELETON
   ══════════════════════════════════════════════════════════ */

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--r-sm);
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 14px;
  color: var(--tx-4);
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.spinner-lg { width: 44px; height: 44px; border-width: 4px; }

/* ══════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 12px;
  text-align: center;
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-xl);
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--tx-4);
  margin-bottom: 4px;
}
.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--tx-2);
}
.empty-state-sub {
  font-size: 13px;
  color: var(--tx-4);
  max-width: 300px;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,15,12,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadein .18s var(--ease);
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  max-width: 540px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slidein .22s var(--ease);
  border: 1px solid var(--border);
}
.modal-box-lg { max-width: 720px; }
.modal-box-xl { max-width: 900px; }
@keyframes slidein { from { opacity:0; transform:translateY(24px) scale(.97); } to { opacity:1; transform:none; } }

.modal-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--tx-1);
}
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--tx-4);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--bg-base); color: var(--tx-1); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-card2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--tx-1);
  color: white;
  box-shadow: var(--sh-lg);
  animation: toast-in .28s var(--ease-b);
  border: 1px solid rgba(255,255,255,.08);
  max-width: 360px;
}
@keyframes toast-in {
  from { opacity:0; transform:translateX(-24px) scale(.95); }
  to   { opacity:1; transform:none; }
}
.toast.success { background: #08302f; border-color: rgba(0,255,145,.25); }
.toast.error   { background: #7f1d1d; border-color: rgba(248,113,113,.2); }
.toast.info    { background: #1e3a5f; border-color: rgba(96,165,250,.2); }
.toast.warning { background: #78350f; border-color: rgba(251,191,36,.2); }
.toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.toast-title { font-size: 13px; font-weight: 700; line-height: 1.4; }
.toast-body  { font-size: 12px; color: rgba(255,255,255,.65); margin-top: 2px; line-height: 1.4; }

/* ══════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-base);
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  width: fit-content;
  flex-wrap: wrap;
}
.tab {
  padding: 7px 16px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tx-3);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.tab:hover { color: var(--tx-1); }
.tab.active {
  background: var(--bg-card);
  color: var(--brand);
  box-shadow: var(--sh-xs);
}

/* Underline tabs variant */
.tabs-line {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}
.tab-line {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tx-4);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.tab-line:hover { color: var(--tx-1); }
.tab-line.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ══════════════════════════════════════════════════════════
   PROGRESS
   ══════════════════════════════════════════════════════════ */

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--brand);
  transition: width .6s var(--ease);
}
.progress-bar-sm { height: 4px; }
.progress-bar-lg { height: 10px; }

/* Circular progress */
.progress-ring { transform: rotate(-90deg); }
.progress-ring-track { fill: none; stroke: var(--border); }
.progress-ring-fill { fill: none; stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }

/* ══════════════════════════════════════════════════════════
   DROPDOWN & MENU
   ══════════════════════════════════════════════════════════ */

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  z-index: 500;
  overflow: hidden;
  animation: fadein .15s var(--ease);
}
.dropdown-menu-right { left: auto; right: 0; }
.dropdown-item {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--tx-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--t-fast);
}
.dropdown-item:hover { background: var(--bg-base); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: var(--red-l); }
.dropdown-item i { width: 16px; text-align: center; font-size: 12px; color: var(--tx-4); }
.dropdown-item.danger i { color: var(--red); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }
.dropdown-label {
  padding: 6px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--tx-4);
}

/* ══════════════════════════════════════════════════════════
   VISIT / CHECK-IN TRACKER
   ══════════════════════════════════════════════════════════ */

.visit-tracker {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  border-radius: var(--r-xl);
  padding: 20px;
  color: white;
  position: relative;
  overflow: hidden;
}
.visit-tracker::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2300ff91' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: .5;
}
.visit-tracker-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #65feab;
  background: rgba(0,255,145,.15);
  padding: 4px 10px;
  border-radius: var(--r-full);
  margin-bottom: 12px;
}
.visit-tracker-pulse::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #65feab;
  animation: pulse-dot 1.4s infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(74,222,128,.5); }
  50% { box-shadow: 0 0 0 5px rgba(74,222,128,0); }
}

/* ══════════════════════════════════════════════════════════
   PIPELINE / KANBAN
   ══════════════════════════════════════════════════════════ */

.pipeline-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.pipeline-col {
  min-width: 260px;
  flex-shrink: 0;
}
.pipeline-col-header {
  padding: 10px 14px;
  border-radius: var(--r-md) var(--r-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1px;
}
.pipeline-col-title { font-size: 12px; font-weight: 700; }
.pipeline-col-count {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,.25);
  padding: 2px 7px;
  border-radius: var(--r-full);
}
.pipeline-cards { display: flex; flex-direction: column; gap: 8px; }
.pipeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  box-shadow: var(--sh-xs);
  cursor: pointer;
  transition: all var(--t-fast);
}
.pipeline-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-sm);
  border-color: var(--brand);
}

/* ══════════════════════════════════════════════════════════
   TIMELINE / ACTIVITY FEED
   ══════════════════════════════════════════════════════════ */

.timeline { position: relative; padding-right: 24px; }
.timeline::before {
  content: '';
  position: absolute;
  right: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: 20px;
  display: flex;
  gap: 14px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  right: -24px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid var(--bg-card);
  flex-shrink: 0;
}
.timeline-body { flex: 1; min-width: 0; }
.timeline-time { font-size: 11px; color: var(--tx-4); margin-top: 3px; }

/* ══════════════════════════════════════════════════════════
   CHARTS WRAPPER
   ══════════════════════════════════════════════════════════ */

.chart-wrap {
  position: relative;
  width: 100%;
}
.chart-wrap canvas { max-width: 100%; }

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════ */

#login-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: .5;
}
.login-orb-1 { width: 480px; height: 480px; background: radial-gradient(circle, rgba(0,255,145,.35) 0%, transparent 70%); top: -160px; right: -140px; }
.login-orb-2 { width: 380px; height: 380px; background: radial-gradient(circle, rgba(0,255,145,.22) 0%, transparent 70%); bottom: -120px; left: -100px; }

.login-container {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
}

.login-logo-wrap {
  margin-bottom: 28px;
  text-align: center;
}
.login-logo-ring {
  width: 168px;
  height: 116px;
  border-radius: var(--r-2xl);
  margin: 0 auto 20px;
  background: conic-gradient(from 180deg, #00ff91, #08302f, #00ff91);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 44px rgba(0,255,145,.4);
}
.login-logo-ring-inner {
  width: 150px;
  height: 98px;
  border-radius: calc(var(--r-2xl) - 8px);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-logo-wrap img {
  width: 118px;
  height: auto;
  object-fit: contain;
}
.login-logo-sub {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--tx-4);
  margin-top: 10px;
}

.login-box {
  width: 100%;
  background: transparent;
  padding: 0;
}

.login-hello {
  font-size: 24px;
  font-weight: 800;
  color: var(--tx-1);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  text-align: center;
}
.login-sub {
  font-size: 13px;
  color: var(--tx-4);
  margin-bottom: 28px;
  text-align: center;
}

.login-field {
  position: relative;
  margin-bottom: 14px;
}
.login-input {
  width: 100%;
  padding: 13px 42px 13px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--tx-1);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--t-fast);
}
.login-input::placeholder { color: var(--tx-4); }
.login-input:focus {
  outline: none;
  border-color: #00c76e;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,255,145,.15);
}
.login-field-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tx-4);
  font-size: 14px;
  pointer-events: none;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #00ff91, #00c76e);
  border: none;
  border-radius: var(--r-md);
  color: #04241a;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  transition: all var(--t-mid);
  box-shadow: 0 10px 26px rgba(0,255,145,.4);
  position: relative;
  overflow: hidden;
}
.login-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.25), transparent);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.login-btn:hover::before { opacity: 1; }
.login-btn:hover { box-shadow: 0 12px 32px rgba(0,255,145,.5); transform: translateY(-1px); }
.login-btn:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}
.login-forgot {
  font-size: 12px;
  color: var(--tx-4);
  cursor: pointer;
  transition: color var(--t-fast);
}
.login-forgot:hover { color: #00c76e; }
.login-biometric {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tx-4);
  cursor: pointer;
  transition: color var(--t-fast);
}
.login-biometric:hover { color: #00c76e; }
.login-biometric i { font-size: 16px; }

/* ══════════════════════════════════════════════════════════
   HOME / PERSONAL DASHBOARD
   ══════════════════════════════════════════════════════════ */

.home-hero {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px 28px;
  color: var(--tx-1);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-sm);
}
.home-hero::before {
  content: '';
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,255,145,.22) 0%, transparent 70%);
  top: -140px;
  left: -100px;
  filter: blur(10px);
  pointer-events: none;
}
.home-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
}
.home-hero-greeting {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx-4);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.home-hero-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--tx-1);
  margin-bottom: 4px;
}
.home-hero-role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tx-3);
  background: var(--accent-faint);
  padding: 4px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
}

/* Today's visit count ring */
.hero-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.hero-ring-label {
  font-size: 10px;
  color: var(--tx-4);
  text-align: center;
  letter-spacing: .3px;
}
.hero-ring-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--tx-1);
  line-height: 1;
}

/* Today schedule strip */
.schedule-strip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.schedule-strip-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.schedule-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
  cursor: pointer;
}
.schedule-item:last-child { border-bottom: none; }
.schedule-item:hover { background: var(--bg-card2); }
.schedule-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-4);
  min-width: 44px;
  text-align: center;
}
.schedule-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--brand-faint);
}
.schedule-dot.done { background: var(--tx-4); box-shadow: none; }
.schedule-dot.active { animation: pulse-dot 1.4s infinite; }
.schedule-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx-1);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-status { flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   COLLECTION / A/R
   ══════════════════════════════════════════════════════════ */

.ar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  transition: all var(--t-fast);
}
.ar-card:hover {
  border-color: var(--brand);
  box-shadow: var(--sh-sm);
  transform: translateY(-1px);
}
.ar-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ar-card-body { flex: 1; min-width: 0; }
.ar-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--tx-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.ar-card-amount {
  font-size: 17px;
  font-weight: 800;
  color: var(--tx-1);
  letter-spacing: -.3px;
}
.ar-card-meta {
  font-size: 11px;
  color: var(--tx-4);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════
   USER / TEAM CARDS
   ══════════════════════════════════════════════════════════ */

.user-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  box-shadow: var(--sh-sm);
  transition: all var(--t-fast);
  cursor: pointer;
}
.user-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-md);
  border-color: var(--brand);
}
.user-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx-1);
}
.user-card-role {
  font-size: 12px;
  color: var(--tx-4);
}
.user-card-stats {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  justify-content: center;
}
.user-card-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.user-card-stat-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--tx-1);
}
.user-card-stat-lbl {
  font-size: 10px;
  color: var(--tx-4);
}

/* ══════════════════════════════════════════════════════════
   PLAN / WEEKLY CARDS
   ══════════════════════════════════════════════════════════ */

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-sm);
}
.plan-card-top {
  padding: 16px;
  background: linear-gradient(135deg, var(--bg-card2), var(--bg-card));
  border-bottom: 1px solid var(--border);
}
.plan-card-body { padding: 16px; }
.plan-visit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.plan-visit-row:last-child { border-bottom: none; }
.plan-visit-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-faint);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.plan-visit-name { font-size: 13px; font-weight: 600; color: var(--tx-1); flex: 1; min-width: 0; }
.plan-visit-day { font-size: 11px; color: var(--tx-4); flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   STOCK
   ══════════════════════════════════════════════════════════ */

.stock-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.stock-row:hover { background: var(--bg-card2); }
.stock-row:last-child { border-bottom: none; }
.stock-level {
  height: 5px;
  border-radius: var(--r-full);
  background: var(--border);
  overflow: hidden;
  flex: 1;
  min-width: 60px;
}
.stock-level-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--brand);
  transition: width .6s var(--ease);
}

/* ══════════════════════════════════════════════════════════
   CHAT
   ══════════════════════════════════════════════════════════ */

.chat-wrap {
  display: flex;
  height: calc(100dvh - var(--topbar-h) - 48px - 48px);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-card);
}
.chat-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg { display: flex; gap: 8px; max-width: 72%; }
.chat-msg.mine { flex-direction: row-reverse; align-self: flex-end; }
.chat-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 100%;
  word-break: break-word;
}
.chat-msg:not(.mine) .chat-bubble {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--tx-1);
  border-bottom-right-radius: 4px;
}
.chat-msg.mine .chat-bubble {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: white;
  border-bottom-left-radius: 4px;
}
.chat-input-wrap {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

/* ══════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════ */

.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.items-end    { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.flex-1 { flex: 1; min-width: 0; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden  { display: none !important; }
.pointer { cursor: pointer; }
.rounded-full { border-radius: 9999px; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.sticky-top { position: sticky; top: 0; z-index: 10; }

/* Text sizes */
.text-xs  { font-size: 11px; }
.text-sm  { font-size: 12px; }
.text-md  { font-size: 14px; }
.text-lg  { font-size: 16px; }
.text-xl  { font-size: 18px; }
.text-2xl { font-size: 22px; }

/* Text colors */
.text-brand    { color: var(--brand); }
.text-1        { color: var(--tx-1); }
.text-2        { color: var(--tx-2); }
.text-3        { color: var(--tx-3); }
.text-4        { color: var(--tx-4); }
.text-green    { color: var(--green); }
.text-red      { color: var(--red); }
.text-amber    { color: var(--amber); }
.text-blue     { color: var(--blue); }
.text-purple   { color: var(--purple); }
.text-white    { color: white; }

/* Font weights */
.font-400 { font-weight: 400; }
.font-500 { font-weight: 500; }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }
.font-800 { font-weight: 800; }

/* Margins & Padding */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.p-8   { padding: 8px; }
.p-12  { padding: 12px; }
.p-16  { padding: 16px; }
.p-20  { padding: 20px; }
.p-24  { padding: 24px; }

/* Section separator */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Monospace */
.mono { font-family: 'Menlo', 'Monaco', 'Courier New', monospace; }

/* Scrollbar styling */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--tx-4); }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes slideRight { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes bounceIn { 0% { opacity: 0; transform: scale(.7); } 60% { transform: scale(1.05); } 80% { transform: scale(.97); } 100% { opacity: 1; transform: scale(1); } }

.animate-fade   { animation: fadeIn .25s var(--ease); }
.animate-up     { animation: slideUp .3s var(--ease); }
.animate-right  { animation: slideRight .3s var(--ease); }
.animate-scale  { animation: scaleIn .28s var(--ease); }

/* Staggered children */
.stagger > * { animation: slideUp .3s var(--ease) both; }
.stagger > *:nth-child(1)  { animation-delay: 0ms; }
.stagger > *:nth-child(2)  { animation-delay: 50ms; }
.stagger > *:nth-child(3)  { animation-delay: 100ms; }
.stagger > *:nth-child(4)  { animation-delay: 150ms; }
.stagger > *:nth-child(5)  { animation-delay: 200ms; }
.stagger > *:nth-child(6)  { animation-delay: 250ms; }
.stagger > *:nth-child(7)  { animation-delay: 300ms; }
.stagger > *:nth-child(8)  { animation-delay: 350ms; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --sb-width: 260px;
    --topbar-h: 52px;
  }

  /* Sidebar slides in on mobile */
  #sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    transform: translateX(100%);
    z-index: 400;
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: var(--sh-xl);
  }
  #sidebar-overlay.open { display: block; }

  .topbar-menu-btn { display: flex; }

  #page-content { padding: 16px 14px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }

  .modal-box { margin: 12px; max-width: calc(100% - 24px); }
  .page-header { flex-direction: column; }
  .page-header-right { width: 100%; }

  .chat-sidebar { display: none; }
  .chat-wrap { height: calc(100dvh - var(--topbar-h) - 32px - 52px); }

  .table th, .table td { padding: 10px 12px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .login-box { padding: 24px 20px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .pipeline-board { gap: 10px; }
  .pipeline-col { min-width: 240px; }
}

/* ══════════════════════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════════════════════ */

@media print {
  #sidebar, #topbar, .btn, .toast-container { display: none !important; }
  #main { margin: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
