@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ==============================
   DESIGN TOKENS
============================== */
:root {
  --primary: #1A3C6E;
  --primary-light: #2557A7;
  --primary-dark: #0F2544;
  --accent: #E8821A;
  --accent-light: #F5A04A;
  --success: #0F7B55;
  --success-light: #D1FAE5;
  --warning: #B45309;
  --warning-light: #FEF3C7;
  --danger: #C0392B;
  --danger-light: #FEE2E2;
  --info: #1D6FA4;
  --info-light: #DBEAFE;

  /* Light Mode */
  --bg-base: #F4F6FB;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F0F4FF;
  --bg-surface-3: #E8EDF8;
  --border: #D4DCF0;
  --border-strong: #A3B0D0;
  --text-primary: #0F1F3D;
  --text-secondary: #4A5A7A;
  --text-muted: #8A98B8;
  --shadow-sm: 0 1px 3px rgba(26,60,110,0.08), 0 1px 2px rgba(26,60,110,0.04);
  --shadow-md: 0 4px 12px rgba(26,60,110,0.10), 0 2px 6px rgba(26,60,110,0.06);
  --shadow-lg: 0 10px 30px rgba(26,60,110,0.14), 0 4px 12px rgba(26,60,110,0.08);
  --shadow-xl: 0 20px 50px rgba(26,60,110,0.18), 0 8px 24px rgba(26,60,110,0.10);

  --sidebar-w: 260px;
  --sidebar-collapsed-w: 64px;
  --topbar-h: 64px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-base: #0A0F1E;
  --bg-surface: #111827;
  --bg-surface-2: #1A2336;
  --bg-surface-3: #232F46;
  --border: #1E2D47;
  --border-strong: #2A3D60;
  --text-primary: #EEF2FF;
  --text-secondary: #94A3B8;
  --text-muted: #4B5A72;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.40);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.50);
  --primary-light: #3B72D4;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

h1,h2,h3,h4,h5,h6 { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 600; letter-spacing: -0.01em; }

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ==============================
   SCROLLBAR
============================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* ==============================
   LAYOUT
============================== */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width 0.28s cubic-bezier(0.4,0,0.2,1), box-shadow 0.28s, background var(--transition);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

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

/* Collapsed: hide text, center icons */
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .nav-badge         { display: none !important; }
.sidebar.collapsed .nav-item          { justify-content: center; }
.sidebar.collapsed .sidebar-user      { justify-content: center; }

/* Expanded: labels fade in */
.sidebar:not(.collapsed) .nav-label,
.sidebar:not(.collapsed) .nav-section-label,
.sidebar:not(.collapsed) .sidebar-logo-text,
.sidebar:not(.collapsed) .sidebar-user-info {
  animation: sidebarFadeIn 0.2s ease forwards;
}
@keyframes sidebarFadeIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Toggle button — always visible, bottom of logo area */
.sidebar-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.sidebar-pin:hover  { background: var(--bg-surface-2); color: var(--primary-light); }
.sidebar-pin.pinned { color: var(--primary-light); }

/* Tooltip */
.nav-tooltip {
  position: fixed;
  left: calc(var(--sidebar-collapsed-w) + 10px);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.12s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.nav-tooltip.visible { opacity: 1; }
.nav-tooltip::before {
  content: '';
  position: absolute;
  left: -5px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border: 5px solid transparent;
  border-right-color: #1e293b;
  border-left-width: 0;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
}
.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed-w);
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  transition: background var(--transition);
  box-shadow: var(--shadow-sm);
}

.page-content {
  flex: 1;
  padding: 28px;
  animation: pageIn 0.35s ease;
}

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

/* ==============================
   SIDEBAR STYLES
============================== */
.sidebar-logo {
  padding: 14px 10px 14px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.sidebar-logo .sidebar-pin { margin-left: auto; flex-shrink: 0; }

/* Collapsed: hide logo image/icon, center only the toggle button */
.sidebar.collapsed .sidebar-logo {
  padding: 14px 0;
  justify-content: center;
}
.sidebar.collapsed .sidebar-logo .sidebar-pin { margin-left: 0; }
.sidebar.collapsed .sidebar-logo-icon,
.sidebar.collapsed .sidebar-logo img { display: none; }

.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(26,60,110,0.3);
}

.sidebar-logo-text { overflow: hidden; min-width: 0; }
.sidebar-logo-text .app-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--primary);
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
}
[data-theme="dark"] .sidebar-logo-text .app-name { color: var(--text-primary); }
.sidebar-logo-text .app-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary);
  border-radius: 0 3px 3px 0;
  transform: scaleY(0);
  transition: transform var(--transition);
}
.nav-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(26,60,110,0.12), rgba(37,87,167,0.08));
  color: var(--primary-light);
  font-weight: 600;
}
[data-theme="dark"] .nav-item.active { color: #7EB3FF; background: rgba(59,114,212,0.15); }
.nav-item.active::before { transform: scaleY(1); }
.nav-item .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.75; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--bg-surface-2); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.8rem;
  flex-shrink: 0;
}
.user-info { overflow: hidden; flex: 1; }
.user-name { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--text-muted); }

/* ==============================
   TOPBAR STYLES
============================== */
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.1rem; font-weight: 700; }
.breadcrumb { font-size: 0.78rem; color: var(--text-muted); }
.breadcrumb span { color: var(--text-secondary); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--bg-surface-2); color: var(--text-primary); }

.theme-toggle {
  width: 54px; height: 28px;
  background: var(--bg-surface-3);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid var(--border);
  display: flex; align-items: center; padding: 2px;
}
.theme-toggle-thumb {
  width: 22px; height: 22px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
}
[data-theme="dark"] .theme-toggle { background: var(--primary-light); }
[data-theme="dark"] .theme-toggle-thumb { transform: translateX(26px); }

/* ==============================
   CARDS & CONTAINERS
============================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), background var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 0.95rem; font-weight: 700; }
.card-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card::after {
  content: '';
  position: absolute; right: -20px; top: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.06;
}
.stat-card.blue::after { background: var(--primary); }
.stat-card.orange::after { background: var(--accent); }
.stat-card.green::after { background: var(--success); }
.stat-card.red::after { background: var(--danger); }

.stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; margin-bottom: 14px;
}
.stat-icon.blue { background: rgba(26,60,110,0.1); color: var(--primary-light); }
.stat-icon.orange { background: rgba(232,130,26,0.1); color: var(--accent); }
.stat-icon.green { background: rgba(15,123,85,0.1); color: var(--success); }
.stat-icon.red { background: rgba(192,57,43,0.1); color: var(--danger); }

.stat-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.stat-trend { font-size: 0.75rem; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ==============================
   GRID LAYOUTS
============================== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ==============================
   TABLES
============================== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg-surface-2); }
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-surface-2); }

/* ==============================
   BADGES / STATUS
============================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 600;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.pending { background: var(--warning-light); color: var(--warning); }
.badge.approved { background: var(--success-light); color: var(--success); }
.badge.rejected { background: var(--danger-light); color: var(--danger); }
.badge.draft { background: var(--bg-surface-3); color: var(--text-muted); }
.badge.issued { background: var(--info-light); color: var(--info); }
.badge.received { background: var(--success-light); color: var(--success); }
.badge.partial { background: var(--warning-light); color: var(--warning); }
.badge.voided  { background: #f3e8ff; color: #7c3aed; }

/* ==============================
   BUTTONS
============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 18px; border-radius: var(--radius);
  font-size: 0.84rem; font-weight: 600;
  transition: all var(--transition);
  position: relative; overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.15s;
}
.btn:hover::after { opacity: 0.08; }
.btn:active { transform: scale(0.97); }

.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; box-shadow: 0 4px 12px rgba(26,60,110,0.25); }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(26,60,110,0.35); transform: translateY(-1px); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: white; box-shadow: 0 4px 12px rgba(232,130,26,0.25); }
.btn-success { background: linear-gradient(135deg, var(--success), #15a86e); color: white; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #e74c3c); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary-light); background: rgba(26,60,110,0.05); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 11px 24px; font-size: 0.95rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--radius); }

/* ==============================
   FORMS
============================== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-label.required::after { content: ' *'; color: var(--danger); }

.form-control {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.86rem;
  transition: all var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,87,167,0.12);
}
.form-control::placeholder { color: var(--text-muted); }
[data-theme="dark"] .form-control { background: var(--bg-surface-2); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

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

.form-section {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.form-section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem; font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}
[data-theme="dark"] .form-section-title { color: #7EB3FF; }

/* ==============================
   MODALS
============================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%; max-width: 620px;
  max-height: 88vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1100px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px) scale(0.96); } to { opacity: 1; transform: none; } }

.modal-header {
  padding: 22px 24px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface); z-index: 2;
  flex-shrink: 0;
}
.modal-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--bg-surface);
  flex-shrink: 0;
}

/* ==============================
   ALERTS & TOASTS
============================== */
#toast-container {
  position: fixed; right: 20px; bottom: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  min-width: 260px; max-width: 360px;
  box-shadow: var(--shadow-xl);
  display: flex; align-items: flex-start; gap: 12px;
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-content .toast-title { font-weight: 700; font-size: 0.84rem; }
.toast-content .toast-msg { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ==============================
   PAGE HEADERS
============================== */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header-info .page-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.4rem; font-weight: 800; }
.page-header-info .page-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 3px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; }

/* ==============================
   SEARCH & FILTERS
============================== */
.search-bar {
  position: relative; display: flex; align-items: center;
}
.search-bar svg {
  position: absolute; left: 12px;
  color: var(--text-muted); width: 16px; height: 16px; pointer-events: none;
}
.search-bar input {
  padding-left: 38px;
  width: 260px;
}

.filters-row {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 18px; flex-wrap: wrap;
}

/* ==============================
   EMPTY STATE
============================== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state .empty-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1rem; font-weight: 700; color: var(--text-secondary); }
.empty-state .empty-desc { font-size: 0.82rem; margin-top: 6px; }

/* ==============================
   ITEMS TABLE IN FORMS
============================== */
.items-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.items-table th { background: var(--bg-surface-3); }
.item-row-input {
  padding: 5px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.82rem;
  width: 100%;
  transition: all var(--transition);
}
.item-row-input:focus { outline: none; border-color: var(--primary-light); background: var(--bg-surface); }

/* ==============================
   PROGRESS & STEPS
============================== */
.steps-bar {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 28px;
}
.step {
  display: flex; align-items: center; gap: 8px;
  flex: 1;
  position: relative;
}
.step:last-child { flex: none; }
.step-circle {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  border: 2px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0; z-index: 1;
}
.step.active .step-circle { border-color: var(--primary-light); background: var(--primary-light); color: white; }
.step.done .step-circle { border-color: var(--success); background: var(--success); color: white; }
.step-line {
  flex: 1; height: 2px; background: var(--border);
  transition: background var(--transition);
}
.step.done .step-line { background: var(--success); }
.step-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.step.active .step-label { color: var(--primary-light); }
.step.done .step-label { color: var(--success); }

/* ==============================
   CHARTS (pure CSS sparklines)
============================== */
.mini-chart { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.mini-bar {
  flex: 1; border-radius: 3px 3px 0 0;
  background: var(--primary-light);
  opacity: 0.3;
  transition: all var(--transition);
  min-width: 6px;
}
.mini-bar.active { opacity: 1; }
.mini-bar:hover { opacity: 0.8; }

/* ==============================
   PRINT / PDF STYLES
============================== */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin: 0; }
  .page-content { padding: 0; }
  body { background: white; color: black; }
}

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); width: 260px; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ==============================
   UTILITIES
============================== */
.text-primary-c { color: var(--primary-light); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.font-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* ==============================
   AVATAR GROUP
============================== */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.68rem; }

/* ==============================
   AMOUNT INPUT GROUP
============================== */
.input-group { display: flex; align-items: stretch; }
.input-group-prefix {
  padding: 0 12px;
  background: var(--bg-surface-3);
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  display: flex; align-items: center;
  font-size: 0.84rem; color: var(--text-muted);
}
.input-group .form-control { border-radius: 0 var(--radius) var(--radius) 0; }

/* ==============================
   DROPDOWN
============================== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 180px;
  z-index: 500;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.dropdown-item {
  padding: 9px 16px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition);
  display: flex; align-items: center; gap: 10px;
}
.dropdown-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ==============================
   CONFIRMATION DIALOG
============================== */
.confirm-modal { max-width: 420px; }
.confirm-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin: 0 auto 16px;
}
.confirm-icon.danger { background: var(--danger-light); }
.confirm-icon.warning { background: var(--warning-light); }

/* ==============================
   ROLE BADGES (sidebar & topbar)
============================== */
.role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.role-badge.role-superuser        { background: rgba(139,47,201,0.15); color: #8B2FC9; }
.role-badge.role-admin            { background: rgba(26,60,110,0.15);  color: var(--primary-light); }
.role-badge.role-approver         { background: rgba(15,123,85,0.15);  color: var(--success); }
.role-badge.role-requester        { background: rgba(180,83,9,0.15);   color: var(--warning); }
.role-badge.role-asesor           { background: rgba(8,145,178,0.15);  color: #0891b2; }
.role-badge.role-operario_bordado { background: rgba(217,119,6,0.15);  color: #d97706; }

.topbar-user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--radius-lg);
  background: var(--bg-surface-2); border: 1px solid var(--border);
}

/* ==============================
   AUTH SPINNER
============================== */
.auth-spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: rgba(255,255,255,0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==============================
   PREMIUM LOGIN REDESIGN
============================== */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #060d1f 0%, #0f1f3d 40%, #1a2f5e 70%, #0b1629 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Orbs */
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.login-orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(37,87,167,0.35) 0%, transparent 70%);
  top: -200px; left: -150px;
  animation: orbFloat 8s ease-in-out infinite;
}
.login-orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(232,130,26,0.2) 0%, transparent 70%);
  bottom: -150px; right: -100px;
  animation: orbFloat 10s ease-in-out infinite reverse;
}
.login-orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(139,47,201,0.15) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  animation: orbFloat 12s ease-in-out infinite 2s;
}
@keyframes orbFloat {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-30px) scale(1.05); }
}

/* Dot grid */
.login-dots {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

/* Card wrapper */
.login-card-wrap {
  display: flex;
  position: relative; z-index: 10;
  width: min(940px, 95vw);
  min-height: 560px;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.07);
  animation: loginCardIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}

/* Branding panel */
.login-branding {
  width: 380px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #1a3c6e 0%, #0f2544 50%, #0a1729 100%);
  border-right: 1px solid rgba(255,255,255,0.08);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.login-branding::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 20%, rgba(232,130,26,0.12) 0%, transparent 60%);
  pointer-events: none;
}
.login-brand-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #e8821a, #f5a04a);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(232,130,26,0.35);
}
.login-brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.75rem; font-weight: 800;
  color: white; letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.login-brand-sub {
  font-size: 0.82rem; color: rgba(255,255,255,0.5);
  margin-bottom: 40px;
}
.login-features { display: flex; flex-direction: column; gap: 22px; margin-top: auto; }
.login-feature {
  display: flex; align-items: flex-start; gap: 14px;
}
.login-feature-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.login-feature-title {
  font-size: 0.84rem; font-weight: 600; color: rgba(255,255,255,0.85);
  margin-bottom: 2px;
}
.login-feature-desc {
  font-size: 0.73rem; color: rgba(255,255,255,0.4);
}

/* Form panel */
.login-form-panel {
  flex: 1;
  background: #ffffff;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
}
[data-theme="dark"] .login-form-panel { background: #111827; }

.login-form-header { margin-bottom: 32px; }
.login-form-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.6rem; font-weight: 800;
  color: var(--text-primary); letter-spacing: -0.02em;
}
.login-form-subtitle {
  font-size: 0.84rem; color: var(--text-muted); margin-top: 6px;
}

.login-form-body { flex: 1; }

/* Login inputs */
.login-input-group { margin-bottom: 20px; }
.login-label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 8px;
}
.login-input-wrap { position: relative; }
.login-input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted); pointer-events: none;
}
.login-input {
  width: 100%;
  padding: 13px 46px 13px 44px;
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-family: inherit;
  transition: all var(--transition);
}
.login-input:focus {
  outline: none;
  border-color: var(--primary-light);
  background: var(--bg-surface);
  box-shadow: 0 0 0 4px rgba(37,87,167,0.1);
}
.login-input::placeholder { color: var(--text-muted); }
[data-theme="dark"] .login-input { background: var(--bg-surface-2); }
[data-theme="dark"] .login-input:focus { background: var(--bg-surface-3); }

.login-eye-btn {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  cursor: pointer; border: none; background: none;
  color: var(--text-muted); padding: 4px;
  transition: color var(--transition);
}
.login-eye-btn:hover { color: var(--text-primary); }

/* Error message */
.login-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 16px;
  border-left: 3px solid var(--danger);
}
.login-error.hidden { display: none; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60%  { transform: translateX(-6px); }
  40%,80%  { transform: translateX(6px); }
}
.login-error.shake { animation: shake 0.4s ease; }

/* Login button */
.login-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none; border-radius: var(--radius-lg);
  font-size: 0.95rem; font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 6px 20px rgba(26,60,110,0.4);
  transition: all 0.25s ease;
  margin-top: 24px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.login-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}
.login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(26,60,110,0.5);
}
.login-btn:active:not(:disabled) { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.8; cursor: not-allowed; }

.login-btn-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.login-btn-spinner.hidden { display: none; }

/* Demo accounts */
.login-demo { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); }
.login-demo-label {
  font-size: 0.72rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px;
}
.login-demo-accounts { display: flex; flex-wrap: wrap; gap: 8px; }
.login-demo-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 99px;
  background: var(--bg-surface-2); border: 1px solid var(--border);
  font-size: 0.75rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.login-demo-chip:hover { border-color: var(--primary-light); color: var(--primary-light); background: var(--bg-surface); }

.role-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.role-dot.superuser        { background: #8B2FC9; }
.role-dot.admin            { background: var(--primary-light); }
.role-dot.approver         { background: var(--success); }
.role-dot.requester        { background: var(--warning); }
.role-dot.asesor           { background: #0891b2; }
.role-dot.operario_bordado { background: #d97706; }

/* Responsive login */
@media (max-width: 720px) {
  .login-branding { display: none; }
  .login-form-panel { padding: 36px 28px; }
}


/* ==============================
   SKELETON LOADING
============================== */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 16px;
}
.skeleton-line  { height: 14px; margin-bottom: 10px; border-radius: 6px; }
.skeleton-title { height: 20px; width: 40%; margin-bottom: 16px; border-radius: 6px; }
.skeleton-stat  { height: 64px; border-radius: var(--radius-xl); }
.skeleton-row   { height: 48px; margin-bottom: 8px; border-radius: var(--radius); }
