/* ============================================
   APP CSS - Manajemen Penggilingan Padi
   Design: Modern, Dark Green Theme, Mobile First
   ============================================ */

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

/* === VARIABLES === */
:root {
  --primary: #1a7a4a;
  --primary-light: #22a05f;
  --primary-dark: #0f5233;
  --primary-glow: rgba(26, 122, 74, 0.3);
  --accent: #f5a623;
  --accent-light: #ffd27a;
  --danger: #e53e3e;
  --danger-light: #feb2b2;
  --info: #3182ce;
  --info-light: #bee3f8;
  --warning: #d69e2e;
  --warning-light: #fefcbf;
  --success: #38a169;
  --success-light: #c6f6d5;
  --purple: #805ad5;

  --bg-dark: #0d1f17;
  --bg-card: #162a1e;
  --bg-card2: #1c3426;
  --bg-sidebar: #0f2318;
  --bg-surface: #203b2c;
  --bg-input: #1a3226;

  --text-primary: #e8f5ee;
  --text-secondary: #8fb89f;
  --text-muted: #5a8570;
  --text-white: #ffffff;

  --border: rgba(26, 122, 74, 0.2);
  --border-hover: rgba(26, 122, 74, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(26, 122, 74, 0.3);

  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --topbar-height: 64px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --topbar-bg: rgba(13, 31, 23, 0.9);
  --overlay: rgba(0,0,0,0.6);
}

:root[data-theme="agri"] {
  --primary: #1f8f55;
  --primary-light: #28b36a;
  --primary-dark: #176a41;
  --primary-glow: rgba(40, 179, 106, 0.22);

  --accent: #f2a900;
  --accent-light: #ffd37a;
  --danger: #d64545;
  --danger-light: #ffd1d1;
  --info: #2b6cb0;
  --info-light: #d2e8ff;
  --warning: #c98a1a;
  --warning-light: #fff0c2;
  --success: #1f9d63;
  --success-light: #d3f6e4;
  --purple: #6b46c1;

  --bg-dark: #f3fbf6;
  --bg-card: #ffffff;
  --bg-card2: #f6fff9;
  --bg-sidebar: #e5f7ed;
  --bg-surface: #eefaf2;
  --bg-input: #ffffff;

  --text-primary: #0f2a1d;
  --text-secondary: #2b5a40;
  --text-muted: #5b8a73;
  --text-white: #0f2a1d;

  --border: rgba(31, 143, 85, 0.22);
  --border-hover: rgba(31, 143, 85, 0.4);

  --shadow-sm: 0 2px 10px rgba(15,42,29,0.06);
  --shadow-md: 0 6px 24px rgba(15,42,29,0.10);
  --shadow-lg: 0 14px 44px rgba(15,42,29,0.14);
  --shadow-glow: 0 0 18px rgba(40, 179, 106, 0.18);

  --topbar-bg: rgba(243, 251, 246, 0.86);
  --overlay: rgba(15,42,29,0.38);
}

:root[data-theme="rice"] {
  --primary: #1d8a50;
  --primary-light: #2aa865;
  --primary-dark: #16643b;
  --primary-glow: rgba(42, 168, 101, 0.20);

  --accent: #f4b400;
  --accent-light: #ffe29a;
  --danger: #d64545;
  --danger-light: #ffd1d1;
  --info: #1e88e5;
  --info-light: #d6ecff;
  --warning: #c98a1a;
  --warning-light: #fff0c2;
  --success: #1f9d63;
  --success-light: #d3f6e4;
  --purple: #6b46c1;

  --bg-dark: #fbfaf4;
  --bg-card: #ffffff;
  --bg-card2: #fffdf3;
  --bg-sidebar: #f1f7e8;
  --bg-surface: #f6fbef;
  --bg-input: #ffffff;

  --text-primary: #1c2a20;
  --text-secondary: #375a45;
  --text-muted: #6a8a76;
  --text-white: #1c2a20;

  --border: rgba(29, 138, 80, 0.20);
  --border-hover: rgba(29, 138, 80, 0.36);

  --shadow-sm: 0 2px 10px rgba(28,42,32,0.06);
  --shadow-md: 0 6px 24px rgba(28,42,32,0.10);
  --shadow-lg: 0 14px 44px rgba(28,42,32,0.14);
  --shadow-glow: 0 0 18px rgba(244, 180, 0, 0.18);

  --topbar-bg: rgba(251, 250, 244, 0.86);
  --overlay: rgba(28,42,32,0.34);
}

:root[data-theme="cms"] {
  --primary: #0f172a;
  --primary-light: #1e40af;
  --primary-dark: #0b1220;
  --primary-glow: rgba(15, 23, 42, 0.12);

  --accent: #2563eb;
  --accent-light: #93c5fd;
  --danger: #ef4444;
  --danger-light: #fecaca;
  --info: #2563eb;
  --info-light: #bfdbfe;
  --warning: #f59e0b;
  --warning-light: #fde68a;
  --success: #16a34a;
  --success-light: #bbf7d0;
  --purple: #7c3aed;

  --bg-dark: #f5f6f8;
  --bg-card: #ffffff;
  --bg-card2: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-input: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-white: #ffffff;

  --border: rgba(15, 23, 42, 0.10);
  --border-hover: rgba(15, 23, 42, 0.18);

  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 18px 60px rgba(15, 23, 42, 0.14);
  --shadow-glow: 0 0 18px rgba(37, 99, 235, 0.14);

  --topbar-bg: rgba(245, 246, 248, 0.86);
  --overlay: rgba(15, 23, 42, 0.34);
}

:root[data-theme="cms"] .nav-item.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

:root[data-theme="cms"] .nav-item.active::before {
  display: none;
}

:root[data-theme="cms"] .nav-item:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
}

:root[data-theme="cms"] .sidebar {
  border-right: 1px solid var(--border);
}

:root[data-theme="cms"] .sidebar-logo {
  background: transparent;
}

:root[data-theme="cms"] .card-title,
:root[data-theme="cms"] .topbar-breadcrumb .page-title,
:root[data-theme="cms"] .modal-title,
:root[data-theme="cms"] .tab.active,
:root[data-theme="cms"] tfoot td,
:root[data-theme="cms"] .user-info .user-name,
:root[data-theme="cms"] .activity-amount,
:root[data-theme="cms"] .queue-info .queue-name {
  color: var(--text-primary);
}

:root[data-theme="agri"] .btn-primary {
  box-shadow: 0 8px 18px rgba(31, 143, 85, 0.22);
}

:root[data-theme="agri"] .btn-primary:hover {
  box-shadow: 0 10px 26px rgba(31, 143, 85, 0.30);
  filter: none;
}

:root[data-theme="agri"] thead th {
  color: var(--text-secondary);
}

:root[data-theme="agri"] tbody tr:hover {
  background: rgba(31, 143, 85, 0.06);
}

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

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

button, input, select, textarea {
  font-family: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-dark);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ============================================
   LAYOUT
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-height);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
  display: block;
}

.sidebar-brand {
  overflow: hidden;
}

.sidebar-brand h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-black);
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-brand p {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

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

.nav-section {
  padding: 8px 16px 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: rgba(26, 122, 74, 0.15);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(26, 122, 74, 0.4), rgba(26, 122, 74, 0.2));
  color: var(--text-white);
  box-shadow: inset 0 0 0 1px var(--border-hover);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--primary-light);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-label {
  font-size: 14px;
  font-weight: 500;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.user-info {
  overflow: hidden;
}

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

.user-info .user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

@media (min-width: 769px) {
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
  }

  body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
  }

  body.sidebar-collapsed .sidebar-brand,
  body.sidebar-collapsed .nav-item .nav-label,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .user-info {
    display: none;
  }

  body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 12px 16px;
  }

  body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  body.sidebar-collapsed .nav-section {
    padding-left: 10px;
    padding-right: 10px;
  }
}

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

.topbar-toggle {
  display: flex;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.topbar-toggle:hover {
  background: var(--bg-surface);
}

.topbar-breadcrumb {
  flex: 1;
}

.topbar-breadcrumb .page-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.2;
}

.topbar-breadcrumb .lap-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.2;
}

.topbar-breadcrumb .page-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-breadcrumb .lap-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.topbar-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.topbar-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
}

/* === PAGE CONTENT === */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ============================================
   COMPONENTS
   ============================================ */

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

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

.card-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 18px;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* === STAT CARDS === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--primary-light));
}

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

.stat-card .stat-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-unit {
  font-size: 13px;
  color: var(--text-muted);
}

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

.stat-card .stat-change.up { color: var(--success); }
.stat-card .stat-change.down { color: var(--danger); }

.stat-card .stat-bg-icon {
  position: absolute;
  right: -10px;
  bottom: -10px;
  font-size: 70px;
  opacity: 0.06;
  pointer-events: none;
}

/* Color variants */
.stat-card.green { --card-accent: #22a05f; }
.stat-card.amber { --card-accent: #f5a623; }
.stat-card.blue  { --card-accent: #3182ce; }
.stat-card.red   { --card-accent: #e53e3e; }
.stat-card.purple { --card-accent: #805ad5; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 12px rgba(26, 122, 74, 0.4);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(26, 122, 74, 0.6);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-card2);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #e8942a);
  color: #000;
  font-weight: 700;
}
.btn-accent:hover { filter: brightness(1.1); }

.btn-danger {
  background: rgba(229, 62, 62, 0.15);
  color: var(--danger);
  border: 1px solid rgba(229, 62, 62, 0.3);
}
.btn-danger:hover {
  background: rgba(229, 62, 62, 0.25);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

.btn.btn-sm.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  gap: 0;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(56, 161, 105, 0.15);
  color: #48bb78;
  border: 1px solid rgba(56, 161, 105, 0.3);
}

.badge-warning {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
  border: 1px solid rgba(245, 166, 35, 0.3);
}

.badge-danger {
  background: rgba(229, 62, 62, 0.15);
  color: #fc8181;
  border: 1px solid rgba(229, 62, 62, 0.3);
}

.badge-info {
  background: rgba(49, 130, 206, 0.15);
  color: #63b3ed;
  border: 1px solid rgba(49, 130, 206, 0.3);
}

.badge-purple {
  background: rgba(128, 90, 213, 0.15);
  color: #b794f4;
  border: 1px solid rgba(128, 90, 213, 0.3);
}

/* === TABLES === */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

thead th {
  background: var(--bg-surface);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(26, 122, 74, 0.08);
  transition: var(--transition);
}

tbody tr:hover {
  background: rgba(26, 122, 74, 0.05);
}

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

tbody td .sub-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

tfoot td {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white);
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

/* === FORMS === */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
}

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

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

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a8570' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s, opacity 0.25s;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(229, 62, 62, 0.15);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* === SEARCH BAR === */
.search-bar {
  position: relative;
  flex: 1;
}

.search-bar input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.search-bar input:focus {
  border-color: var(--primary);
}

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

/* === TABS === */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  white-space: nowrap;
}

.tab:hover { color: var(--text-primary); }

.tab.active {
  background: var(--bg-card);
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
}

/* === PROGRESS BAR === */
.progress {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.6s ease;
}

/* === EMPTY STATE === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 54px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
}

/* === ALERTS === */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-icon { font-size: 18px; flex-shrink: 0; }
.alert-info { background: rgba(49, 130, 206, 0.1); border: 1px solid rgba(49, 130, 206, 0.3); color: #63b3ed; }
.alert-success { background: rgba(56, 161, 105, 0.1); border: 1px solid rgba(56, 161, 105, 0.3); color: #68d391; }
.alert-warning { background: rgba(245, 166, 35, 0.1); border: 1px solid rgba(245, 166, 35, 0.3); color: #fbd38d; }
.alert-danger { background: rgba(229, 62, 62, 0.1); border: 1px solid rgba(229, 62, 62, 0.3); color: #fc8181; }

/* === DIVIDER === */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ============================================
   DASHBOARD SPECIFIC
   ============================================ */

.chart-placeholder {
  height: 220px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  margin-top: 16px;
  flex-direction: column;
  gap: 8px;
}

.chart-placeholder .chart-icon { font-size: 36px; opacity: 0.4; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(26, 122, 74, 0.08);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-content { flex: 1; }
.activity-content .activity-text { font-size: 13px; color: var(--text-primary); }
.activity-content .activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.activity-amount { font-size: 13px; font-weight: 700; color: var(--text-white); white-space: nowrap; }

/* Queue items on dashboard */
.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: var(--transition);
}

.queue-item:hover {
  border-color: var(--border-hover);
}

.queue-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-dark);
  color: var(--primary-light);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.queue-info { flex: 1; overflow: hidden; }
.queue-info .queue-name { font-size: 13px; font-weight: 600; color: var(--text-white); }
.queue-info .queue-detail { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.queue-weight { font-size: 14px; font-weight: 700; color: var(--accent); }

/* ============================================
   MOBILE OVERLAY SIDEBAR
   ============================================ */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

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

  .main-content {
    margin-left: 0;
  }

  .topbar-toggle {
    display: flex;
  }

  .page-content {
    padding: 16px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card .stat-value {
    font-size: 20px;
  }

  .topbar {
    padding: 0 16px;
  }

  .page-content {
    padding: 12px;
  }

  .modal {
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .tabs {
    overflow-x: auto;
  }

  .btn-lg {
    padding: 12px 20px;
    font-size: 14px;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fade-up {
  animation: fadeInUp 0.4s ease both;
}

.animate-fade {
  animation: fadeIn 0.3s ease both;
}

/* Stagger children */
.stagger > * {
  animation: fadeInUp 0.4s ease both;
}
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.30s; }

/* === MISC UTILITIES === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-auto { margin-top: auto; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-white { color: var(--text-white); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius-sm); }
.hidden { display: none !important; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

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