/* ================================================================
   Pricing Management System — Design System v4
   Font: Plus Jakarta Sans (display) + Inter (data/mono)
   ================================================================ */

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

/* ── Dark theme ── */
:root, [data-theme="dark"] {
  --bg-base:      #0d1117;
  --bg-surface:   #161b27;
  --bg-elevated:  #1c2333;
  --bg-overlay:   #202840;
  --bg-hover:     rgba(255,255,255,.04);
  --bg-active:    rgba(255,255,255,.07);

  --border:       rgba(255,255,255,.07);
  --border-mid:   rgba(255,255,255,.10);
  --border-focus: rgba(99,102,241,.5);

  --text-primary:   #e8edf5;
  --text-secondary: #8892a4;
  --text-muted:     #4b5568;
  --text-on-color:  #ffffff;

  --indigo:       #6366f1;
  --indigo-light: #818cf8;
  --indigo-dim:   rgba(99,102,241,.14);
  --indigo-glow:  rgba(99,102,241,.3);

  --violet:       #8b5cf6;
  --violet-dim:   rgba(139,92,246,.14);

  --emerald:      #10b981;
  --emerald-dim:  rgba(16,185,129,.13);
  --amber:        #f59e0b;
  --amber-dim:    rgba(245,158,11,.13);
  --rose:         #f43f5e;
  --rose-dim:     rgba(244,63,94,.13);
  --sky:          #38bdf8;
  --sky-dim:      rgba(56,189,248,.13);
  --orange:       #fb923c;
  --orange-dim:   rgba(251,146,60,.13);

  --sidebar-w:    234px;
  --sidebar-w-sm: 62px;
  --topbar-h:     60px;
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;
  --radius-xl:    20px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 4px 16px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.6), 0 4px 12px rgba(0,0,0,.4);

  --transition: 0.18s cubic-bezier(.4,0,.2,1);
  --transition-slow: 0.28s cubic-bezier(.4,0,.2,1);
}

/* ── Light theme ── */
[data-theme="light"] {
  --bg-base:      #f3f4f8;
  --bg-surface:   #ffffff;
  --bg-elevated:  #f8f9fc;
  --bg-overlay:   #eef0f6;
  --bg-hover:     rgba(0,0,0,.03);
  --bg-active:    rgba(99,102,241,.06);

  --border:       rgba(0,0,0,.07);
  --border-mid:   rgba(0,0,0,.10);
  --border-focus: rgba(99,102,241,.4);

  --text-primary:   #111827;
  --text-secondary: #4b5568;
  --text-muted:     #9ca3af;
  --text-on-color:  #ffffff;

  --indigo:       #4f46e5;
  --indigo-light: #6366f1;
  --indigo-dim:   rgba(79,70,229,.09);
  --indigo-glow:  rgba(79,70,229,.2);

  --violet:       #7c3aed;
  --violet-dim:   rgba(124,58,237,.09);

  --emerald:      #059669;
  --emerald-dim:  rgba(5,150,105,.09);
  --amber:        #d97706;
  --amber-dim:    rgba(217,119,6,.09);
  --rose:         #e11d48;
  --rose-dim:     rgba(225,29,72,.09);
  --sky:          #0284c7;
  --sky-dim:      rgba(2,132,199,.09);
  --orange:       #ea580c;
  --orange-dim:   rgba(234,88,12,.09);

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 14px;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Data / numbers use Inter */
.mono, code, .stat-value, .req-id { font-family: 'Inter', monospace; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px 0 0;
  z-index: 200;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding-left: 8px;
  transition: width var(--transition-slow);
}
.app-layout.sidebar-collapsed + * .topbar-left,
body.sidebar-collapsed .topbar-left { width: var(--sidebar-w-sm); }

/* Hamburger */
.sidebar-toggle {
  width: 36px; height: 36px;
  border: none; background: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Brand */
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  padding: 6px 8px 6px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  overflow: hidden; flex: 1;
}
.topbar-brand:hover { background: var(--bg-hover); }

.brand-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; overflow: hidden;
  box-shadow: 0 2px 12px var(--indigo-glow);
  position: relative;
}
.brand-logo::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.15), transparent);
  border-radius: inherit;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; position: relative; z-index: 1; }

.brand-text { display: flex; flex-direction: column; overflow: hidden; }
.brand-name {
  font-size: 13.5px; font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.brand-sub { font-size: 10px; color: var(--text-muted); white-space: nowrap; line-height: 1.3; }

/* Centre */
.topbar-center {
  flex: 1; display: flex; align-items: center;
  justify-content: center; padding: 0 16px;
}

/* Right */
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Sun/Moon Theme Toggle — SIGNATURE ELEMENT ── */
.theme-toggle {
  position: relative;
  width: 52px; height: 28px;
  border-radius: 28px;
  border: 1.5px solid var(--border-mid);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: all var(--transition);
  flex-shrink: 0;
}

/* Dark mode track — deep night blue */
[data-theme="dark"] .theme-toggle {
  background: linear-gradient(135deg, #1a1f3a 0%, #0f1729 100%);
  border-color: rgba(99,102,241,.3);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.5), 0 0 0 1px rgba(99,102,241,.1);
}
/* Light mode track — warm sky */
[data-theme="light"] .theme-toggle {
  background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 50%, #f0abfc 100%);
  border-color: rgba(56,189,248,.4);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.1), 0 0 0 1px rgba(56,189,248,.2);
}

/* Stars in dark mode */
.theme-toggle .t-stars {
  position: absolute; inset: 0;
  opacity: 0; transition: opacity var(--transition-slow);
}
[data-theme="dark"] .theme-toggle .t-stars { opacity: 1; }
.t-star {
  position: absolute;
  background: #fff; border-radius: 50%;
}
.t-star:nth-child(1) { width: 2px; height: 2px; top: 5px;  left: 8px;  opacity: .8; }
.t-star:nth-child(2) { width: 1.5px; height: 1.5px; top: 10px; left: 14px; opacity: .5; }
.t-star:nth-child(3) { width: 1.5px; height: 1.5px; top: 6px;  left: 18px; opacity: .6; }

/* Clouds in light mode */
.theme-toggle .t-cloud {
  position: absolute;
  width: 12px; height: 6px;
  background: rgba(255,255,255,.7);
  border-radius: 6px;
  top: 8px; left: 6px;
  opacity: 0;
  transition: opacity var(--transition-slow);
}
[data-theme="light"] .theme-toggle .t-cloud { opacity: 1; }

/* The thumb — sun or moon */
.theme-toggle .t-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  transition: transform var(--transition-slow), background var(--transition-slow),
              box-shadow var(--transition-slow);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  z-index: 2;
}
/* Moon (dark mode) */
[data-theme="dark"] .theme-toggle .t-thumb {
  transform: translateX(0px);
  background: linear-gradient(135deg, #c7d2fe, #818cf8);
  box-shadow: 0 2px 8px rgba(129,140,248,.6), inset 0 1px 0 rgba(255,255,255,.3);
}
/* Sun (light mode) */
[data-theme="light"] .theme-toggle .t-thumb {
  transform: translateX(24px);
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  box-shadow: 0 2px 10px rgba(245,158,11,.6), 0 0 0 2px rgba(253,230,138,.4),
              inset 0 1px 0 rgba(255,255,255,.4);
}

/* Moon crater detail */
[data-theme="dark"] .theme-toggle .t-thumb::before {
  content: '';
  position: absolute; top: 3px; right: 4px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(99,102,241,.4);
  box-shadow: -3px 4px 0 1px rgba(99,102,241,.25);
}
/* Sun ray glow */
[data-theme="light"] .theme-toggle .t-thumb::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251,191,36,.3) 0%, transparent 70%);
  animation: sunPulse 2s ease-in-out infinite;
}
@keyframes sunPulse {
  0%, 100% { transform: scale(1); opacity: .6; }
  50%       { transform: scale(1.3); opacity: .9; }
}

/* ── Profile button ── */
.profile-wrap { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 10px 5px 5px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  cursor: pointer; color: var(--text-primary);
  transition: all var(--transition);
  font-family: inherit;
}
.profile-btn:hover {
  border-color: var(--indigo);
  background: var(--bg-overlay);
  box-shadow: 0 0 0 3px var(--indigo-dim);
}

.profile-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.profile-info { display: flex; flex-direction: column; gap: 0; }
.profile-name {
  font-size: 12.5px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; max-width: 100px;
  overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.profile-role {
  font-size: 10px; color: var(--text-muted);
  white-space: nowrap; text-transform: capitalize; line-height: 1;
}
.profile-caret {
  font-size: 13px; color: var(--text-muted);
  transition: transform var(--transition);
}
.profile-btn[aria-expanded="true"] .profile-caret { transform: rotate(180deg); }

/* Dropdown */
.profile-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 240px;
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-8px) scale(.96);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 300; overflow: hidden;
}
.profile-dropdown.open {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
}
.dropdown-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, var(--indigo-dim), var(--violet-dim));
  border-bottom: 1px solid var(--border);
}
.dropdown-avatar {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.dropdown-name { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.dropdown-username { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.dropdown-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .06em; margin-top: 4px;
}
.badge-admin   { background: var(--violet-dim); color: var(--violet); }
.badge-creator { background: var(--indigo-dim); color: var(--indigo); }
.badge-pricer  { background: var(--emerald-dim); color: var(--emerald); }

.dropdown-divider { border: none; border-top: 1px solid var(--border); }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 16px;
  border: none; background: none;
  color: var(--text-secondary); font-size: 13px;
  font-family: inherit; cursor: pointer;
  transition: all var(--transition); text-align: left;
}
.dropdown-item i { font-size: 15px; }
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger:hover { background: var(--rose-dim); color: var(--rose); }

/* ================================================================
   SIDEBAR
   ================================================================ */
.app-sidebar {
  position: fixed;
  top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: width var(--transition-slow);
  overflow: hidden;
}
.app-sidebar.collapsed { width: var(--sidebar-w-sm); }

.sidebar-section-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 16px 16px 6px;
  white-space: nowrap; overflow: hidden;
  opacity: 1; transition: opacity var(--transition);
}
.app-sidebar.collapsed .sidebar-section-label { opacity: 0; }

.sidebar-nav {
  flex: 1; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; overflow-x: hidden;
}

/* Nav item */
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap; overflow: hidden;
  cursor: pointer;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Active state — each nav item has its own color */
.nav-item.active {
  font-weight: 600;
}
.nav-item[data-nav="dashboard"].active        { background: var(--indigo-dim);  color: var(--indigo);  }
.nav-item[data-nav="new-request"].active      { background: var(--emerald-dim); color: var(--emerald); }
.nav-item[data-nav="admin"].active            { background: var(--violet-dim);  color: var(--violet);  }
.nav-item[data-nav="admin/settings"].active   { background: var(--amber-dim);   color: var(--amber);   }

/* Animated pill glow — signature */
.nav-active-pill {
  position: absolute;
  left: 0; top: 15%; bottom: 15%;
  width: 3px; border-radius: 0 3px 3px 0;
}
.nav-item[data-nav="dashboard"].active .nav-active-pill        { background: var(--indigo);  box-shadow: 0 0 8px var(--indigo-glow); }
.nav-item[data-nav="new-request"].active .nav-active-pill      { background: var(--emerald); box-shadow: 0 0 8px rgba(16,185,129,.4); }
.nav-item[data-nav="admin"].active .nav-active-pill            { background: var(--violet);  box-shadow: 0 0 8px var(--violet-dim); }
.nav-item[data-nav="admin/settings"].active .nav-active-pill   { background: var(--amber);   box-shadow: 0 0 8px var(--amber-dim); }

.nav-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
  border-radius: 6px;
  transition: background var(--transition);
}
.nav-label { transition: opacity var(--transition-slow); line-height: 1; }
.app-sidebar.collapsed .nav-label  { opacity: 0; width: 0; pointer-events: none; }
.app-sidebar.collapsed .nav-item   { justify-content: center; padding: 10px 0; }
.app-sidebar.collapsed .nav-icon   { width: 38px; }

/* Tooltip on collapsed */
.app-sidebar.collapsed .nav-item { position: relative; }

/* Sidebar footer */
.sidebar-footer {
  padding: 10px 10px 14px;
  border-top: 1px solid var(--border);
}
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px;
  transition: all var(--transition);
  font-family: inherit;
}
.sidebar-collapse-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.collapse-icon { transition: transform var(--transition-slow); }
.app-sidebar.collapsed .collapse-icon { transform: rotate(180deg); }

/* ================================================================
   MAIN LAYOUT
   ================================================================ */
#root { min-height: 100vh; display: flex; flex-direction: column; }

.app-layout {
  display: flex; min-height: 100vh;
  padding-top: var(--topbar-h);
  padding-left: var(--sidebar-w);
  transition: padding-left var(--transition-slow);
}
.app-layout.sidebar-collapsed { padding-left: var(--sidebar-w-sm); }

.main-content {
  flex: 1; display: flex; min-width: 0;
  background: var(--bg-base);
}

/* Admin inner panel */
.admin-sidebar-inner {
  width: 200px; flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.admin-sidebar-inner a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition); white-space: nowrap;
}
.admin-sidebar-inner a:hover  { background: var(--bg-hover); color: var(--text-primary); }
.admin-sidebar-inner a.active { background: var(--indigo-dim); color: var(--indigo); font-weight: 600; }
.admin-sidebar-inner .section-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
  padding: 10px 10px 4px;
}

.page-body {
  flex: 1; padding: 28px 28px 40px;
  max-width: 1200px; width: 100%; min-width: 0;
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.card-sm { padding: 12px 16px; border-radius: var(--radius); }

/* ── Stat Cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative; overflow: hidden;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.stat-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--card-color-dim, var(--indigo-dim)) 0%, transparent 60%);
  opacity: 0; transition: opacity var(--transition);
}
.stat-card:hover { border-color: var(--card-color, var(--indigo)); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-card:hover::before { opacity: 1; }
.stat-label {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.stat-icon-wrap {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; margin-bottom: 10px;
}
.stat-value {
  font-size: 32px; font-weight: 800; line-height: 1;
  font-family: 'Inter', monospace;
  color: var(--text-primary);
}

/* ── Request Cards ── */
.req-list { display: flex; flex-direction: column; gap: 8px; }
.req-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; gap: 14px;
}
.req-card:hover {
  border-color: var(--indigo);
  background: var(--bg-elevated);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.req-card .req-info { flex: 1; min-width: 0; }
.req-card .req-title {
  font-weight: 600; font-size: 14px; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px;
}
.req-card .req-meta {
  font-size: 12px; color: var(--text-muted);
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
}
.req-card .req-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0;
}

/* ================================================================
   BADGES
   ================================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-open     { background: var(--indigo-dim);  color: var(--indigo-light); }
.badge-assigned { background: var(--amber-dim);   color: var(--amber);  }
.badge-pricing  { background: var(--violet-dim);  color: var(--violet); }
.badge-priced   { background: var(--sky-dim);     color: var(--sky);    }
.badge-approved { background: var(--emerald-dim); color: var(--emerald);}
.badge-closed   { background: var(--bg-overlay);  color: var(--text-muted); }
.badge-reopened { background: var(--orange-dim);  color: var(--orange); }
.badge-low      { color: var(--text-muted); background: var(--bg-overlay); }
.badge-medium   { color: var(--amber);   background: var(--amber-dim); }
.badge-high     { color: var(--rose);    background: var(--rose-dim); }

/* ================================================================
   AVATAR
   ================================================================ */
.avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar-admin, .profile-avatar.avatar-admin, .dropdown-avatar.avatar-admin
  { background: linear-gradient(135deg, var(--violet), #5b21b6); }
.avatar-creator, .profile-avatar.avatar-creator, .dropdown-avatar.avatar-creator
  { background: linear-gradient(135deg, var(--indigo), #3730a3); }
.avatar-pricer, .profile-avatar.avatar-pricer, .dropdown-avatar.avatar-pricer
  { background: linear-gradient(135deg, var(--emerald), #065f46); }

/* ================================================================
   FORM
   ================================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-label.required::after { content: ' *'; color: var(--amber); }

.inp {
  background: var(--bg-base);
  border: 1.5px solid var(--border-mid);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  width: 100%; font-size: 13px;
  font-family: inherit; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.inp:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-dim);
  background: var(--bg-surface);
}
.inp.err { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-dim); }
.inp::placeholder { color: var(--text-muted); }
select.inp { cursor: pointer; }
textarea.inp { resize: vertical; min-height: 68px; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; border: none; cursor: pointer; border-radius: var(--radius-sm);
  font-family: 'Plus Jakarta Sans', inherit;
  font-weight: 600; font-size: 13px; padding: 9px 17px;
  transition: all var(--transition); white-space: nowrap; text-decoration: none;
}
.btn:hover   { transform: translateY(-1px); box-shadow: var(--shadow-sm); filter: brightness(1.08); }
.btn:active  { transform: translateY(0); box-shadow: none; filter: brightness(.95); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }

.btn-primary { background: linear-gradient(135deg, var(--indigo), var(--violet)); color: #fff; box-shadow: 0 2px 8px var(--indigo-glow); }
.btn-success { background: linear-gradient(135deg, var(--emerald), #047857); color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,.3); }
.btn-danger  { background: linear-gradient(135deg, var(--rose), #be123c); color: #fff; box-shadow: 0 2px 8px rgba(244,63,94,.3); }
.btn-warning { background: linear-gradient(135deg, var(--amber), #b45309); color: #fff; box-shadow: 0 2px 8px rgba(245,158,11,.3); }
.btn-ghost {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-mid);
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-mid); }
.btn-sm   { padding: 5px 12px; font-size: 12px; border-radius: 7px; }
.btn-lg   { padding: 12px 28px; font-size: 14px; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn-icon  { padding: 7px; width: 34px; height: 34px; }

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 12px; flex-wrap: wrap;
}
.page-title    { font-size: 19px; font-weight: 800; color: var(--text-primary); }
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.section-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 10px;
}

/* ================================================================
   ITEMS TABLE
   ================================================================ */
.items-header {
  display: grid;
  grid-template-columns: 28px 3fr 80px 110px 120px 100px 32px;
  gap: 6px; padding: 0 4px; margin-bottom: 6px;
}
.items-header span {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.item-row {
  display: grid;
  grid-template-columns: 28px 3fr 80px 110px 120px 100px 32px;
  gap: 6px; align-items: center;
  background: var(--bg-base); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px; margin-bottom: 6px;
  transition: border-color var(--transition);
}
.item-row:focus-within { border-color: var(--indigo); }
.item-num  { font-size: 11px; color: var(--text-muted); font-weight: 700; text-align: center; }
.item-total {
  background: var(--bg-elevated); border: 1.5px solid var(--border);
  border-radius: 6px; padding: 6px; text-align: center;
  font-weight: 700; font-size: 12px; color: var(--emerald);
  font-family: 'Inter', monospace;
}

/* ================================================================
   PRICING ITEM
   ================================================================ */
.pricing-item {
  background: var(--bg-base); border: 1.5px solid var(--indigo-dim);
  border-radius: var(--radius); padding: 16px; margin-bottom: 10px;
  transition: border-color var(--transition);
}
.pricing-item:focus-within { border-color: var(--indigo); }
.pricing-item-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.pricing-item-ref  { font-size: 12px; color: var(--text-muted); }

/* ================================================================
   ACTIVITY LOG
   ================================================================ */
.activity-log { display: flex; flex-direction: column; }
.activity-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--indigo); margin-top: 6px; flex-shrink: 0;
}
.activity-text { font-size: 13px; color: var(--text-primary); flex: 1; }
.activity-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; margin-top: 3px; }

/* ================================================================
   DEADLINE CHIP
   ================================================================ */
.deadline-chip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1.5px solid;
}
.deadline-chip.ok      { background: var(--emerald-dim); border-color: rgba(16,185,129,.25); }
.deadline-chip.warn    { background: var(--amber-dim);   border-color: rgba(245,158,11,.25); }
.deadline-chip.expired { background: var(--rose-dim);    border-color: rgba(244,63,94,.25); }
.deadline-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.deadline-value { font-size: 13px; font-weight: 700; }
.deadline-chip.ok .deadline-value      { color: var(--emerald); }
.deadline-chip.warn .deadline-value    { color: var(--amber); }
.deadline-chip.expired .deadline-value { color: var(--rose); }

/* ================================================================
   TOAST
   ================================================================ */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  padding: 11px 22px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; z-index: 9999;
  white-space: nowrap; animation: toastIn .22s ease;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px;
}
.toast-success { background: var(--bg-surface); border: 1.5px solid var(--emerald); color: var(--emerald); }
.toast-error   { background: var(--bg-surface); border: 1.5px solid var(--rose);    color: var(--rose);    }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ================================================================
   MODAL
   ================================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 400; display: flex; align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-surface); border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl); padding: 26px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.modal-header { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 18px; }
.modal-footer { display: flex; gap: 10px; margin-top: 22px; }

/* ================================================================
   FILTER BAR
   ================================================================ */
.filter-bar { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-btn {
  padding: 5px 13px; border-radius: 20px;
  border: 1.5px solid var(--border-mid);
  background: transparent; color: var(--text-muted);
  font-size: 12px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: all var(--transition);
}
.filter-btn:hover  { border-color: var(--indigo); color: var(--indigo); }
.filter-btn.active { background: var(--indigo-dim); border-color: var(--indigo); color: var(--indigo-light); font-weight: 600; }

/* ================================================================
   SAVE STATUS
   ================================================================ */
.save-status { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; font-weight: 500; }
.save-status.saved  { color: var(--emerald); }
.save-status.saving { color: var(--amber); }
.save-status.error  { color: var(--rose); }

/* ================================================================
   DATA ROW
   ================================================================ */
.data-row {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 7px;
  display: flex; align-items: center; gap: 12px;
  transition: all var(--transition);
}
.data-row:hover { border-color: var(--indigo); transform: translateX(2px); }
.data-row .row-main { flex: 1; min-width: 0; }
.data-row .row-title { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.data-row .row-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.data-row .row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ================================================================
   PERMISSIONS TABLE
   ================================================================ */
.perms-table { width: 100%; border-collapse: collapse; }
.perms-table th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted);
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .05em;
}
.perms-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-secondary);
}
.perms-table tr.section-divider td {
  padding: 14px 12px 4px; font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: none;
}

/* ================================================================
   TOGGLE SWITCH
   ================================================================ */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; background: var(--bg-overlay);
  border-radius: 20px; cursor: pointer;
  transition: background .2s; border: 1.5px solid var(--border-mid);
}
.toggle input:checked + .toggle-track { background: var(--indigo); border-color: var(--indigo); }
.toggle-track::after {
  content: ''; position: absolute;
  width: 14px; height: 14px; background: #fff;
  border-radius: 50%; top: 2px; left: 2px;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }

/* ================================================================
   GRAND TOTAL
   ================================================================ */
.grand-total {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 14px; padding: 14px 18px;
  background: var(--bg-base); border: 1.5px solid var(--indigo-dim);
  border-radius: var(--radius); margin-top: 10px;
}
.grand-total .total-label { font-size: 13px; color: var(--text-muted); }
.grand-total .total-value {
  font-size: 22px; font-weight: 800; color: var(--emerald);
  font-family: 'Inter', monospace;
}

/* ================================================================
   SEARCH BOX
   ================================================================ */
.search-box { position: relative; flex: 1; max-width: 300px; }
.search-box .inp { padding-left: 36px; }
.search-box .search-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%); color: var(--text-muted);
  font-size: 15px; pointer-events: none;
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state .empty-icon  { font-size: 42px; margin-bottom: 14px; opacity: .5; }
.empty-state .empty-title { font-size: 15px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state .empty-sub   { font-size: 13px; }

/* ================================================================
   ERROR / SUCCESS BOXES
   ================================================================ */
.error-box {
  background: var(--rose-dim); border: 1.5px solid rgba(244,63,94,.25);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--rose); font-size: 13px;
}
.success-box {
  background: var(--emerald-dim); border: 1.5px solid rgba(16,185,129,.25);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--emerald); font-size: 13px;
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-page {
  min-height: 100vh; background: var(--bg-base);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background-image: radial-gradient(ellipse at 20% 50%, var(--indigo-dim) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 20%, var(--violet-dim) 0%, transparent 50%);
}
.login-box { width: 100%; max-width: 390px; }
.login-logo {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin: 0 auto 16px; overflow: hidden;
  box-shadow: 0 8px 32px var(--indigo-glow), 0 0 0 1px rgba(255,255,255,.1);
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.login-title { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-sub   { text-align: center; font-size: 12px; color: var(--indigo-light); margin-bottom: 24px; font-weight: 500; }

/* ================================================================
   MISC
   ================================================================ */
.divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.flex    { display: flex; }
.flex-1  { flex: 1; }
.items-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.gap-2  { gap: 8px; }  .gap-3  { gap: 12px; }
.mb-2   { margin-bottom: 8px; }  .mb-3 { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; }
.mt-3   { margin-top: 12px; }    .mt-4 { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.text-muted  { color: var(--text-muted); }
.text-small  { font-size: 12px; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.font-bold   { font-weight: 700; }
.w-full      { width: 100%; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .app-sidebar    { transform: translateX(-100%); transition: transform var(--transition-slow); }
  .app-sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .app-layout     { padding-left: 0 !important; }
  .topbar-left    { width: auto !important; }
  .page-body      { padding: 16px; }
  .brand-text     { display: none; }
  .profile-info   { display: none; }
  .items-header   { display: none; }
  .item-row       { grid-template-columns: 1fr; }
  .grid-3         { grid-template-columns: 1fr 1fr; }
  .admin-sidebar-inner { display: none; }
  .topbar-center  { display: none; }
}
@media (max-width: 480px) {
  .page-body { padding: 12px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2    { grid-template-columns: 1fr; }
  .grid-3    { grid-template-columns: 1fr; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
