/* =============================================
   EDITORIAL MONOLITH — AL-DORZY ADMIN
   Exact Color Match from Stitch Project
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* =============================================
   CSS VARIABLES — LIGHT MODE (Stitch Exact)
   ============================================= */
:root {
  /* PRIMARY = Terracotta Red (from Stitch: #D92D20) */
  --primary:              #D92D20;
  --primary-hover:        #B42318;
  --primary-light:        #FEF3F2;
  --primary-border:       #FECDCA;
  --on-primary:           #ffffff;

  /* SECONDARY */
  --secondary:            #475467;
  --secondary-bg:         #F9FAFB;
  --on-secondary:         #101828;

  /* SURFACE / BACKGROUND (Stitch exact) */
  --background:           #F9FAFB;
  --surface:              #FFFFFF;
  --surface-secondary:    #F2F4F7;
  --surface-tertiary:     #EAECF0;
  --surface-hover:        #F9FAFB;

  /* TEXT (Stitch exact) */
  --text-primary:         #101828;
  --text-secondary:       #344054;
  --text-tertiary:        #475467;
  --text-placeholder:     #98A2B3;
  --text-disabled:        #D0D5DD;

  /* BORDER */
  --border:               #D0D5DD;
  --border-light:         #EAECF0;
  --border-focus:         #D92D20;

  /* SIDEBAR (White — Stitch exact) */
  --sidebar-bg:           #FFFFFF;
  --sidebar-border:       #EAECF0;
  --sidebar-text:         #344054;
  --sidebar-text-active:  #D92D20;
  --sidebar-hover-bg:     #FEF3F2;
  --sidebar-active-bg:    #FFF5F4;
  --sidebar-active-border:#D92D20;
  --sidebar-label:        #98A2B3;
  --sidebar-header-bg:    #FFFFFF;

  /* TOPBAR (White) */
  --topbar-bg:            #FFFFFF;
  --topbar-border:        #EAECF0;

  /* STATUS — exact Stitch style */
  --success:              #027A48;
  --success-bg:           #ECFDF3;
  --success-text:         #027A48;
  --warning:              #B54708;
  --warning-bg:           #FFFAEB;
  --warning-text:         #B54708;
  --error:                #B42318;
  --error-bg:             #FEF3F2;
  --error-text:           #B42318;
  --info:                 #175CD3;
  --info-bg:              #EFF8FF;
  --info-text:            #175CD3;
  --purple:               #5925DC;
  --purple-bg:            #F4F3FF;
  --purple-text:          #5925DC;
  --pink:                 #C11574;
  --pink-bg:              #FDF2FA;
  --pink-text:            #C11574;

  /* TYPOGRAPHY */
  --font-serif:           'Outfit', sans-serif;
  --font-sans:            'Plus Jakarta Sans', sans-serif;

  /* LAYOUT */
  --sidebar-width:          240px;
  --sidebar-collapsed-width: 68px;
  --topbar-height:          64px;

  /* TRANSITIONS */
  --transition-fast:  150ms cubic-bezier(0.25, 1, 0.5, 1);
  --transition-base:  300ms cubic-bezier(0.25, 1, 0.5, 1);
  --transition-slow:  500ms cubic-bezier(0.25, 1, 0.5, 1);

  /* SHADOWS (Stitch-style: very subtle) */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.10), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 8px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 24px rgba(16, 24, 40, 0.12), 0 4px 8px rgba(16, 24, 40, 0.06);
  --shadow-red: 0 4px 12px rgba(217, 45, 32, 0.25);

  /* RADIUS */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* =============================================
   DARK MODE
   ============================================= */
[data-theme="dark"] {
  --primary:              #F97066;
  --primary-hover:        #D92D20;
  --primary-light:        rgba(249,112,102,0.12);
  --primary-border:       rgba(249,112,102,0.25);

  --background:           #0C111D;
  --surface:              #161B27;
  --surface-secondary:    #1D2939;
  --surface-tertiary:     #253345;
  --surface-hover:        #1D2939;

  --text-primary:         #F9FAFB;
  --text-secondary:       #E4E7EC;
  --text-tertiary:        #98A2B3;
  --text-placeholder:     #667085;

  --border:               #344054;
  --border-light:         #1D2939;
  --border-focus:         #F97066;

  --sidebar-bg:           #0C111D;
  --sidebar-border:       #1D2939;
  --sidebar-text:         #667085;
  --sidebar-text-active:  #F97066;
  --sidebar-hover-bg:     #1D2939;
  --sidebar-active-bg:    rgba(249,112,102,0.1);
  --sidebar-active-border:#F97066;
  --sidebar-label:        #344054;
  --sidebar-header-bg:    #0C111D;

  --topbar-bg:            #161B27;
  --topbar-border:        #1D2939;

  --success-bg:           #054F31;
  --success-text:         #6CE9A6;
  --warning-bg:           #4E1D09;
  --warning-text:         #FDB022;
  --error-bg:             #55160C;
  --error-text:           #FDA29B;
  --info-bg:              #102A56;
  --info-text:            #84CAFF;
  --purple-bg:            #2D1B69;
  --purple-text:          #BDB4FE;
  --pink-bg:              #530043;
  --pink-text:            #F670C7;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.45);
  --shadow-lg: 0 12px 24px rgba(0,0,0,0.55);
  --shadow-red: 0 4px 12px rgba(249,112,102,0.25);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-base), color var(--transition-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Dashboard V2 Enhancements */
.dashboard-v2 .page-title {
  background: linear-gradient(90deg, var(--text-primary) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.premium-list-card .card-header {
  border-bottom: 1px solid rgba(0,0,0,0.03);
  padding: 18px 24px;
}

.list-item-hover:hover {
  background: var(--surface-secondary) !important;
  transform: translateX(4px);
}

.premium-table {
  width: 100%;
  border-collapse: collapse;
}

.premium-table th {
  text-align: left;
  padding: 14px 20px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  background: var(--surface-secondary);
}

.premium-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.2s;
}

.row-hover:hover td {
  background: var(--surface-secondary);
}

.chart-bar-primary:hover {
  filter: brightness(1.1);
  transform: scaleX(1.1);
  z-index: 10;
}

.chart-bar-secondary:hover {
  opacity: 0.6 !important;
}

.workflow-stat-item:active {
  transform: scale(0.95) !important;
}

/* Premium Stat Cards */
.stat-card.premium {
  border: 1px solid rgba(0,0,0,0.04);
  background: linear-gradient(135deg, #fff 0%, #fefeff 100%);
}

[data-theme="dark"] .stat-card.premium {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-secondary) 100%);
  border-color: rgba(255,255,255,0.05);
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* =============================================
   SIDEBAR — White/Light (Stitch Exact)
   ============================================= */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

/* Sidebar Header */
.sidebar-header {
  height: var(--topbar-height);
  background: var(--sidebar-header-bg);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  overflow: hidden;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-base), width var(--transition-base);
}

.logo-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.logo-sub {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Collapsed sidebar: hide text labels */
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .badge,
.sidebar.collapsed .admin-info {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-light); }

.nav-section {
  margin-bottom: 24px;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-label);
  padding: 0 10px;
  margin-bottom: 6px;
  display: block;
  white-space: nowrap;
  transition: opacity var(--transition-base);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  transition: all var(--transition-fast);
  cursor: pointer;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--primary);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
  border-left-color: var(--sidebar-active-border);
}

.nav-item .material-icons-round {
  font-size: 19px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
}

.nav-item:hover .material-icons-round,
.nav-item.active .material-icons-round {
  color: var(--primary);
}

.nav-item .badge {
  margin-left: auto;
  background: var(--primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: 14px 12px;
  flex-shrink: 0;
  background: var(--sidebar-header-bg);
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 2px 0;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px solid var(--primary-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.admin-info {
  flex: 1;
  overflow: hidden;
  transition: opacity var(--transition-base), width var(--transition-base);
}

.admin-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-role {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
  background: var(--background);
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: clip; /* use clip instead of hidden so position:sticky still works */
}

.main-content.expanded {
  margin-left: var(--sidebar-collapsed-width);
  max-width: calc(100vw - var(--sidebar-collapsed-width));
}

/* =============================================
   TOPBAR
   ============================================= */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-left { display: flex; align-items: center; gap: 14px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.page-breadcrumb {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-bar .material-icons-round {
  font-size: 17px;
  color: var(--text-tertiary);
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-primary);
  width: 200px;
}

.search-bar input::placeholder { color: var(--text-placeholder); }

.btn-icon {
  width: 38px;
  height: 38px;
  background: none;
  border: 1px solid var(--border-light);
  cursor: pointer;
  color: var(--text-tertiary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--border);
}

.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--topbar-bg);
}

.mobile-only { display: none; }

/* =============================================
   VIEW CONTAINER & RESPONSIVE GRIDS
   ============================================= */
.view-container {
  flex: 1;
  padding: 28px 24px;
  overflow-y: auto;
  overflow-x: clip; /* clip instead of hidden to allow position:sticky in children */
  background: var(--background);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-weight: 400;
}

.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* =============================================
   BUTTONS — Stitch Exact
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.25;
}

/* Primary: Solid Red */
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-red);
}

/* Secondary: White with border */
.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--surface-secondary);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--primary-border);
}

.btn-danger:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border-light);
}

.btn-ghost:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid #ABEFC6;
}

.btn-success:hover { background: var(--success); color: #fff; border-color: var(--success); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.btn .material-icons-round { font-size: 17px; }

/* =============================================
   CARDS — Stitch Exact (White, Light Shadow)
   ============================================= */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

[data-theme="dark"] .card {
  background: var(--surface);
  border-color: var(--border-light);
}

.card-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-body { padding: 20px; }

/* =============================================
   STAT CARDS — Stitch Exact (White, No colored border)
   ============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--error); }
.stat-change .material-icons-round { font-size: 14px; }

/* Stat icon — circular with pastel BG */
.stat-icon {
  position: absolute;
  top: 18px; right: 18px;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Each card icon color */
.stat-card:nth-child(1) .stat-icon { background: #EFF8FF; color: #175CD3; }
.stat-card:nth-child(2) .stat-icon { background: #F4F3FF; color: #5925DC; }
.stat-card:nth-child(3) .stat-icon { background: #ECFDF3; color: #027A48; }
.stat-card:nth-child(4) .stat-icon { background: #FFFAEB; color: #B54708; }

.stat-icon .material-icons-round { font-size: 20px; }

/* =============================================
   TABLES — Stitch Exact
   ============================================= */
.table-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.table-toolbar {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  background: var(--surface);
}

.table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.table-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.table-search .material-icons-round { font-size: 16px; color: var(--text-tertiary); }
.table-search input { background: none; border: none; outline: none; font-family: var(--font-sans); font-size: 13px; color: var(--text-primary); width: 100%; }
.table-search input::placeholder { color: var(--text-placeholder); }

.table-filter { display: flex; gap: 8px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; }

thead { background: var(--surface-secondary); }

thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

thead th:hover { color: var(--text-primary); }

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

tbody tr:hover { background: var(--surface-secondary); }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-pagination {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-card { border: 1px solid var(--border-light); background: #fff; box-shadow: var(--shadow-sm); }
.chart-type-toggle .btn { border-radius: 6px; padding: 4px 12px; font-size: 11px; transition: all 0.2s; }
.chart-type-toggle .btn:hover { background: var(--surface-secondary); }

.wallet-card-premium {
  color: #fff;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.wallet-card-premium:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.workflow-stat-item {
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.workflow-stat-item:hover {
  background: var(--surface-secondary) !important;
}

[data-theme="dark"] .workflow-stat-item {
  background: var(--surface) !important;
}

.glass-card {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.page-btn {
  min-width: 34px; height: 34px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.page-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.page-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =============================================
   STATUS BADGES — Stitch Exact
   ============================================= */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Status mapping — Stitch exact */
.status-delivered  { background: var(--success-bg);  color: var(--success-text); }
.status-active     { background: var(--success-bg);  color: var(--success-text); }
.status-received   { background: var(--success-bg);  color: var(--success-text); }
.status-approved   { background: var(--success-bg);  color: var(--success-text); }
.status-published  { background: var(--success-bg);  color: var(--success-text); }

.status-pending    { background: var(--warning-bg);  color: var(--warning-text); }
.status-draft      { background: var(--warning-bg);  color: var(--warning-text); }
.status-expired    { background: var(--warning-bg);  color: var(--warning-text); }

.status-processing { background: var(--info-bg);     color: var(--info-text); }
.status-pickup     { background: var(--info-bg);     color: var(--info-text); }

.status-confirmed  { background: var(--purple-bg);   color: var(--purple-text); }

.status-shipped    { background: var(--pink-bg);     color: var(--pink-text); }

.status-cancelled  { background: var(--error-bg);    color: var(--error-text); }
.status-inactive   { background: var(--error-bg);    color: var(--error-text); }
.status-rejected   { background: var(--error-bg);    color: var(--error-text); }

/* =============================================
   FORM CONTROLS — Stitch Exact
   ============================================= */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-control {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 13px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder { color: var(--text-placeholder); }

.form-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 36px 9px 13px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* =============================================
   GRID & LAYOUT
   ============================================= */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  color: var(--text-primary);
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--primary);
  animation: toastSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
.toast.info    { border-left-color: var(--info); }

.toast .material-icons-round { font-size: 18px; flex-shrink: 0; }
.toast.success .material-icons-round { color: var(--success); }
.toast.error   .material-icons-round { color: var(--error); }
.toast.warning .material-icons-round { color: var(--warning); }
.toast.info    .material-icons-round { color: var(--info); }

.toast-msg { font-size: 13.5px; font-weight: 500; flex: 1; color: var(--text-secondary); }
.toast-close { background: none; border: none; color: var(--text-placeholder); cursor: pointer; display: flex; align-items: center; padding: 0; }
.toast-close:hover { color: var(--text-primary); }

@keyframes toastSlide {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-lg { max-width: 780px; }

@keyframes modalIn {
  from { transform: scale(0.94) translateY(20px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.modal-body { padding: 20px; }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* =============================================
   UPLOAD ZONE
   ============================================= */
.upload-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  background: var(--surface-secondary);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone .material-icons-round { font-size: 36px; color: var(--text-tertiary); margin-bottom: 10px; display: block; }
.upload-zone p { font-size: 13.5px; color: var(--text-secondary); font-weight: 500; }
.upload-zone span { font-size: 12px; color: var(--text-tertiary); }

/* =============================================
   CHART
   ============================================= */
.chart-wrapper {
  height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding-top: 12px;
}

.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.chart-bar {
  width: 100%;
  max-width: 32px;
  border-radius: 4px 4px 0 0;
  background: var(--primary);
  transition: opacity var(--transition-fast);
  cursor: pointer;
  min-height: 4px;
  opacity: 0.8;
}

.chart-bar:hover { opacity: 1; }
.chart-bar.secondary { background: var(--border-light); }

.chart-label { font-size: 10px; color: var(--text-tertiary); font-weight: 600; }

/* =============================================
   ORDER FLOW
   ============================================= */
.order-flow {
  display: flex;
  gap: 0;
  overflow-x: auto;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.flow-item {
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 14px 10px;
  background: var(--surface);
  border-right: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.flow-item:last-child { border-right: none; }
.flow-item:hover { background: var(--primary-light); }
.flow-item.active { background: var(--primary-light); }

.flow-item.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
}

.flow-count {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1;
}

.flow-label { font-size: 11px; color: var(--text-tertiary); font-weight: 600; margin-top: 3px; }

/* =============================================
   POS LAYOUT
   ============================================= */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  height: calc(100vh - var(--topbar-height) - 140px);
  min-height: unset;
}

.pos-products-panel {
  overflow-y: auto;
  height: 100%;
}

.pos-cart-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 100%;
}

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.pos-product-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  border: 1.5px solid var(--border-light);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.pos-product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.pos-product-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.pos-product-img {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.pos-product-img .material-icons-round { font-size: 32px; }
.pos-product-info { padding: 8px 10px; }
.pos-product-category { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.pos-product-name { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; line-height: 1.3; }
.pos-product-price { font-size: 13px; font-weight: 700; color: var(--primary); }
.pos-product-stock { font-size: 10px; color: var(--text-tertiary); }
.pos-product-stock.low { color: var(--error); font-weight: 600; }

/* Stock Badge */
.stock-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--error);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 1;
}

.pos-product-card.low-stock {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}

.cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-secondary);
  color: var(--text-primary);
}

.cart-items { flex: 1; overflow-y: auto; }

.cart-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}

.cart-item-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.4; word-break: break-word; }
.cart-item-price { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.cart-item-delete {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--error);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.cart-item-delete:hover {
  background: var(--error-bg);
}

.cart-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-item-total {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  text-align: right;
}

.qty-control { display: flex; align-items: center; gap: 6px; }

.qty-btn {
  width: 26px; height: 26px;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-primary);
  font-weight: 700;
  transition: all var(--transition-fast);
  line-height: 1;
}

.qty-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.qty-val { font-size: 13px; font-weight: 700; min-width: 20px; text-align: center; color: var(--text-primary); }

.cart-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.cart-total-row.total {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1.5px solid var(--border);
}

/* Payment Methods */
.payment-methods {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.payment-btn {
  flex: 1;
  min-width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: var(--surface-secondary);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
}

.payment-btn:hover {
  background: var(--surface);
  border-color: var(--primary);
}

.payment-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.payment-btn .material-icons-round {
  font-size: 20px;
}

.payment-btn span:last-child {
  font-size: 11px;
  font-weight: 600;
}

/* =============================================
   CHAT / CONVERSATIONS
   ============================================= */
.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  height: 600px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.chat-list { border-right: 1px solid var(--border-light); overflow-y: auto; }
.chat-list-header { padding: 14px 16px; border-bottom: 1px solid var(--border-light); background: var(--surface-secondary); }
.chat-list-title { font-family: var(--font-serif); font-size: 15px; font-weight: 600; color: var(--text-primary); }

.chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.chat-item:hover { background: var(--surface-secondary); }

.chat-item.active {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
}

.chat-avatar {
  width: 40px; height: 40px;
  background: var(--surface-secondary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  border: 1.5px solid var(--border-light);
}

.chat-info { flex: 1; overflow: hidden; }
.chat-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.chat-preview { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.chat-time { font-size: 10.5px; color: var(--text-tertiary); flex-shrink: 0; }

.chat-window { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.chat-window-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-secondary);
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--background);
  min-height: 0;
}

.msg {
  max-width: 68%;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  border-radius: var(--radius-md);
}

.msg-customer {
  background: var(--surface);
  color: var(--text-primary);
  align-self: flex-start;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
}

.msg-admin {
  background: var(--primary);
  color: #ffffff;
  align-self: flex-end;
  box-shadow: var(--shadow-red);
}

.msg-time { font-size: 10.5px; opacity: 0.6; margin-top: 4px; }

.chat-input-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex; gap: 10px; align-items: center;
  background: var(--surface);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* =============================================
   SWITCH TOGGLE
   ============================================= */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-track {
  width: 40px; height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(16,24,40,0.2);
}

.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(18px); }

.toggle-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* =============================================
   MISC UTILITIES
   ============================================= */
.text-primary-color { color: var(--primary); }
.text-muted         { color: var(--text-tertiary); }
.text-sm            { font-size: 12px; }
.text-xs            { font-size: 11px; }
.font-serif         { font-family: var(--font-serif); }
.font-bold          { font-weight: 700; }
.mb-4               { margin-bottom: 16px; }
.mb-5               { margin-bottom: 20px; }
.mb-6               { margin-bottom: 24px; }
.mt-4               { margin-top: 16px; }

.divider {
  height: 1px;
  background: var(--border-light);
  margin: 18px 0;
}

/* Tag pills */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-secondary);
  color: var(--text-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tag:hover, .tag.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-state .material-icons-round { font-size: 48px; margin-bottom: 12px; opacity: 0.3; display: block; }
.empty-state h3 { font-family: var(--font-serif); font-size: 18px; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; line-height: 1.6; color: var(--text-tertiary); }

/* Progress bar */
.progress-bar {
  height: 5px;
  background: var(--surface-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tab bar */
.tab-bar {
  display: flex;
  border-bottom: 1.5px solid var(--border-light);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 20px;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab-item {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-sans);
}

.tab-item:hover  { color: var(--text-primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* RTE */
.rte-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  flex-wrap: wrap;
}

.rte-btn {
  width: 30px; height: 30px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.rte-btn:hover { background: var(--surface-tertiary); color: var(--primary); }

.rte-content {
  min-height: 140px;
  padding: 12px;
  outline: none;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.rte-content:focus { border-color: var(--primary); }

/* Notification rows */
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.notif-row:hover { background: var(--surface-secondary); }
.notif-row.unread { background: var(--primary-light); border-left: 3px solid var(--primary); }

.notif-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.notif-title   { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.notif-desc    { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; line-height: 1.5; }
.notif-time    { font-size: 11px; color: var(--text-tertiary); flex-shrink: 0; white-space: nowrap; }

/* Image previews */
.img-preview-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.img-preview {
  width: 80px; height: 80px;
  background: var(--surface-secondary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
  border: 1.5px solid var(--border);
}

.img-preview img { width: 100%; height: 100%; object-fit: cover; }

.img-preview-rm {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px;
  background: rgba(16,24,40,0.6);
  color: white;
  border: none; cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1;
}

/* Dropdown */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  display: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.dropdown-menu.open { display: block; animation: fadeDown 0.18s ease; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-family: var(--font-sans);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: var(--surface-secondary); color: var(--text-primary); }
.dropdown-item .material-icons-round { font-size: 16px; color: var(--text-tertiary); }

/* =============================================
   PAGE ANIMATIONS
   ============================================= */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-anim { animation: fadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1); }

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }

/* =============================================
   ANALYTICS MINI CARDS
   ============================================= */
.analytics-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.analytics-mini-card {
  background: var(--surface);
  padding: 16px;
  text-align: center;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.analytics-mini-val {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
}

.analytics-mini-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .pos-layout   { grid-template-columns: 1fr; height: auto; }
  .chat-layout  { grid-template-columns: 1fr; height: auto; }
  .chat-list    { display: none; }
  .grid-4       { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    width: 260px !important;
  }

  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }

  .topbar { padding: 0 16px; }
  .view-container { padding: 18px 16px; }
  .mobile-only { display: flex; }
  .search-bar { display: none; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .pos-layout, .chat-layout { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
  .view-container { padding: 14px 12px; }
}

/* =========================================================
   OMNICHANNEL POS TERMINAL & 80MM THERMAL RECEIPT STYLES
   ========================================================= */
.pos-terminal-bar {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}

.pos-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #059669;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pos-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: posPulse 1.8s infinite;
}

@keyframes posPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.pos-barcode-scanner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-secondary);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  flex: 1;
  max-width: 380px;
  transition: all var(--transition-fast);
}

.pos-barcode-scanner:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.pos-barcode-scanner input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
}

.pos-category-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  margin-bottom: 14px;
}

.pos-category-pills::-webkit-scrollbar {
  height: 4px;
}

.pos-cat-pill {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.pos-cat-pill:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--border);
}

.pos-cat-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-light);
}

.pos-cat-pill .count {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
}

.pos-cat-pill.active .count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* 80mm Thermal Receipt styling */
.pos-receipt-wrapper {
  background: #f1f3f5;
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: center;
}

.pos-receipt-paper {
  background: #ffffff;
  color: #111827;
  width: 100%;
  max-width: 340px;
  padding: 24px 20px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.1);
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.45;
  border-top: 4px dashed #cbd5e1;
  border-bottom: 4px dashed #cbd5e1;
  position: relative;
}

.pos-receipt-paper .r-center { text-align: center; }
.pos-receipt-paper .r-bold { font-weight: 700; }
.pos-receipt-paper .r-title { font-size: 16px; font-weight: 800; letter-spacing: 0.5px; margin-bottom: 4px; }
.pos-receipt-paper .r-divider { border-top: 1px dashed #64748b; margin: 10px 0; }
.pos-receipt-paper .r-double-divider { border-top: 2px dashed #334155; margin: 10px 0; }
.pos-receipt-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }

@media print {
  body * { visibility: hidden !important; }
  .pos-receipt-paper, .pos-receipt-paper * {
    visibility: visible !important;
  }
  .pos-receipt-paper {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 80mm !important;
    box-shadow: none !important;
    padding: 0 !important;
    border: none !important;
  }
}

/* =============================================
   POS STICKY PANEL FIX
   ============================================= */

/* When POS page is active, allow sticky to work by fixing overflow chain */
body.pos-active main,
body.pos-active .admin-main,
.pos-sticky-fix {
  overflow: visible !important;
}

/* Ensure pos-cart-panel sticky works correctly */
.pos-cart-panel {
  position: sticky !important;
  top: calc(var(--topbar-height) + 16px) !important;
  align-self: flex-start !important;
  max-height: calc(100vh - var(--topbar-height) - 90px) !important;
}

/* =============================================
   NOTIFICATION SYSTEM STYLES
   ============================================= */
.topbar-notif-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--topbar-bg, #ffffff);
  box-shadow: 0 0 0 0 rgba(217, 45, 32, 0.7);
  animation: notifPulse 2s infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes notifPulse {
  0% {
    transform: scale(0.96);
    box-shadow: 0 0 0 0 rgba(217, 45, 32, 0.7);
  }
  70% {
    transform: scale(1.06);
    box-shadow: 0 0 0 7px rgba(217, 45, 32, 0);
  }
  100% {
    transform: scale(0.96);
    box-shadow: 0 0 0 0 rgba(217, 45, 32, 0);
  }
}

.notif-bell-shake {
  animation: notifShake 0.9s ease-in-out infinite !important;
  transform-origin: top center;
  color: var(--primary) !important;
}

@keyframes notifShake {
  0% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-14deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-10deg); }
  75% { transform: rotate(4deg); }
  90% { transform: rotate(-4deg); }
  100% { transform: rotate(0); }
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: -10px;
  width: 390px;
  max-width: 92vw;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(16, 24, 40, 0.16), 0 4px 12px rgba(16, 24, 40, 0.08);
  z-index: 320;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: notifFadeDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notifFadeDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notif-header {
  padding: 14px 18px;
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notif-header-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-header-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.notif-count-pill {
  font-size: 10.5px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid var(--primary-border);
}

.notif-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-sound-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: #FEF3F2;
  color: #D92D20;
  border: 1px solid #FECDCA;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.notif-sound-tag.looping {
  animation: notifPulse 1.2s infinite;
}

.notif-sound-tag.muted {
  background: var(--surface-tertiary);
  color: var(--text-tertiary);
  border-color: var(--border-light);
}

.notif-sound-tag .material-icons-round {
  font-size: 13px;
}

.notif-mark-all-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.notif-mark-all-btn:hover {
  background: var(--primary-light);
  text-decoration: underline;
}

.notif-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  position: relative;
  text-align: left;
  border-left: 3px solid transparent;
}

.notif-item:hover {
  background: var(--surface-secondary);
}

.notif-item.unread {
  background: #FFF8F7;
  border-left-color: var(--primary);
}

[data-theme="dark"] .notif-item.unread {
  background: rgba(217, 45, 32, 0.12);
  border-left-color: var(--primary);
}

.notif-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.notif-icon-box.order {
  background: #FEF3F2;
  color: #D92D20;
}

.notif-icon-box.payment {
  background: #ECFDF3;
  color: #039855;
}

.notif-icon-box.stock {
  background: #FFFAEB;
  color: #DC6803;
}

.notif-icon-box.booking {
  background: #EFF8FF;
  color: #175CD3;
}

.notif-icon-box.system {
  background: #F4F3FF;
  color: #5925DC;
}

.notif-icon-box .material-icons-round {
  font-size: 19px;
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item.unread .notif-title {
  font-weight: 700;
  color: var(--primary);
}

.notif-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 2px 0 5px;
}

.notif-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-time {
  font-size: 11px;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.notif-time .material-icons-round {
  font-size: 12px;
}

.notif-dot-unread {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
}

.notif-empty .material-icons-round {
  font-size: 42px;
  color: var(--text-disabled);
  margin-bottom: 10px;
}

.notif-empty-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.notif-empty-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}

.notif-panel-footer {
  padding: 10px 16px;
  background: var(--surface-secondary);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.notif-footer-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.notif-footer-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.notif-footer-btn .material-icons-round {
  font-size: 14px;
}

.notif-footer-btn.btn-test {
  color: var(--primary);
  border-color: var(--primary-border);
  background: var(--primary-light);
}

.notif-footer-btn.btn-test:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}


