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

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a1f35;
  --bg-card-hover: #222842;
  --card: #1a1f35;
  --bg-input: #151a2e;
  --border-color: #2a3150;
  --border-accent: #3b4570;
  --border: #2a3150;
  --text-primary: #e8ecf4;
  --text-secondary: #8892a8;
  --text-muted: #5a6380;
  --text: #e8ecf4;
  --accent-blue: #3b82f6;
  --accent: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.25);
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --gradient-blue: linear-gradient(135deg, #3b82f6, #06b6d4);
  --gradient-green: linear-gradient(135deg, #10b981, #34d399);
  --gradient-orange: linear-gradient(135deg, #f59e0b, #fbbf24);
  --gradient-red: linear-gradient(135deg, #ef4444, #f87171);
  --gradient-purple: linear-gradient(135deg, #8b5cf6, #a78bfa);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

.hidden {
  display: none !important;
}

.app-shell.hidden {
  display: none;
}

/* ========== LOGIN SCREEN ========== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.2), transparent 30%),
    radial-gradient(circle at bottom right, rgba(139, 92, 246, 0.18), transparent 35%),
    linear-gradient(180deg, #070b15 0%, #0a0e1a 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  border-radius: 24px;
  background: rgba(17, 24, 39, 0.72);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(24px);
  text-align: center;
}

.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(139, 92, 246, 0.28));
  box-shadow: 0 12px 32px rgba(59, 130, 246, 0.18);
}

.login-card h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.login-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.login-submit {
  width: 100%;
  justify-content: center;
  padding: 12px 18px;
  font-size: 14px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: 1px solid rgba(129, 140, 248, 0.25);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.28);
}

.login-submit:hover {
  background: linear-gradient(135deg, #4338ca, #6d28d9);
}

.login-message {
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.16);
  text-align: center;
}

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

.login-hint code {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--text-primary);
}

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

/* ========== SIDEBAR ========== */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-blue);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow-blue);
}

.sidebar-logo h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

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

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: rgba(10, 14, 26, 0.55);
}

.sidebar-user-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

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

.sidebar-logout-btn {
  width: 100%;
  justify-content: center;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
  user-select: none;
}

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

.nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent-blue);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  padding: 0;
}

.page-header {
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.page-body {
  padding: 24px 32px;
  overflow-x: auto;
}

/* ========== STAT CARDS ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

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

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.blue::before {
  background: var(--gradient-blue);
}

.stat-card.green::before {
  background: var(--gradient-green);
}

.stat-card.orange::before {
  background: var(--gradient-orange);
}

.stat-card.red::before {
  background: var(--gradient-red);
}

.stat-card.purple::before {
  background: var(--gradient-purple);
}

.stat-card.cyan::before {
  background: linear-gradient(135deg, #06b6d4, #67e8f9);
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.stat-card.blue .stat-icon {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
}

.stat-card.green .stat-icon {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

.stat-card.orange .stat-icon {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-orange);
}

.stat-card.red .stat-icon {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
}

.stat-card.purple .stat-icon {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
}

.stat-card.cyan .stat-icon {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
}

.revenue-chart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.revenue-chart-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.revenue-chart-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.revenue-chart-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.revenue-chart-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.revenue-chart-summary > div {
  min-width: 130px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

.revenue-chart-summary span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.revenue-chart-summary strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
}

.revenue-trend.up strong,
.revenue-trend.up span {
  color: var(--accent-green);
}

.revenue-trend.down strong,
.revenue-trend.down span {
  color: var(--accent-red);
}

.revenue-chart-body {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.revenue-chart-svg {
  display: block;
  width: 100%;
  min-width: 680px;
  height: 230px;
}

.revenue-grid-line {
  stroke: rgba(136, 146, 168, 0.16);
  stroke-width: 1;
}

.revenue-bar {
  fill: rgba(59, 130, 246, 0.28);
  transition: fill 0.2s;
}

.revenue-bar:hover {
  fill: rgba(59, 130, 246, 0.48);
}

.revenue-area {
  fill: url(#revenueLineFill);
}

.revenue-line {
  fill: none;
  stroke: var(--accent-green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.revenue-point {
  fill: var(--accent-green);
  stroke: var(--bg-card);
  stroke-width: 2;
}

.revenue-axis-label {
  fill: var(--text-muted);
  font-size: 11px;
}

.revenue-month-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.revenue-month-row {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(10, 14, 26, 0.35);
  border: 1px solid rgba(42, 49, 80, 0.65);
}

.revenue-month-row span {
  font-size: 11px;
  color: var(--text-muted);
}

.revenue-month-row strong {
  font-size: 13px;
  color: var(--text-primary);
}

.revenue-month-row em {
  font-size: 11px;
  color: var(--accent-green);
  font-style: normal;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

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

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.stat-sub .tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.tag-pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
}

.tag-done {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.tag-low {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

/* ========== SEARCH / FILTERS BAR ========== */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
}

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

.filter-input,
.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.search-input-wrapper .filter-input {
  padding-left: 40px;
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.filter-input::placeholder {
  color: var(--text-muted);
}

.filter-select {
  cursor: pointer;
  min-width: 140px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6380' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.filter-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.filter-date {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.filter-date:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.table-filter-wrap {
  min-width: 100%;
}

.table-quick-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) minmax(135px, 160px) minmax(135px, 160px) auto auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(10, 14, 26, 0.35);
  border-bottom: 1px solid var(--border-color);
}

.table-filter-search {
  min-width: 220px;
}

.table-filter-count {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.table-no-results td {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 16px;
}

.btn {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-small {
  padding: 7px 11px;
  font-size: 12px;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ========== DATA TABLE ========== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 100%;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: var(--bg-input);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  user-select: none;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(42, 49, 80, 0.5);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.data-table tbody tr:hover td {
  color: var(--text-primary);
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pending {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-orange);
}

.status-done {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

.status-confirmed {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

.status-cancelled {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
}

.status-active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
}

.priority-urgent,
.sla-overdue {
  background: rgba(239, 68, 68, 0.14);
  color: var(--accent-red);
}

.priority-normal,
.sla-soon {
  background: rgba(245, 158, 11, 0.14);
  color: var(--accent-orange);
}

.priority-low,
.sla-ok {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

.sla-closed {
  background: rgba(136, 146, 168, 0.12);
  color: var(--text-secondary);
}

.stock-low {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
}

.stock-watch {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-orange);
}

.stock-ok {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

/* ========== PAGINATION ========== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-info {
  font-weight: 500;
}

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

.pagination-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: white;
}

/* ========== DETAIL MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

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

.modal-close:hover {
  background: var(--accent-red);
  color: white;
}

.modal-body {
  padding: 20px 24px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-item label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.detail-item .val {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
}

.detail-item.full {
  grid-column: 1 / -1;
}

.dashboard-ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
}

.dashboard-ops-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  min-height: 260px;
}

.dashboard-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-panel-header h3 {
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dashboard-panel-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.panel-pill {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(59, 130, 246, 0.13);
  color: var(--accent-blue);
}

.panel-pill.danger {
  background: rgba(239, 68, 68, 0.13);
  color: var(--accent-red);
}

.panel-pill.ok {
  background: rgba(16, 185, 129, 0.13);
  color: var(--accent-green);
}

.low-stock-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.compact-list,
.workload-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-list-row,
.workload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(42, 49, 80, 0.5);
}

.compact-list-row strong,
.workload-name strong {
  display: block;
  color: var(--text-primary);
  font-size: 13px;
  word-break: break-word;
}

.compact-list-row span,
.workload-name span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.compact-list-row em {
  color: var(--accent-red);
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.workload-row {
  align-items: flex-start;
}

.workload-row.overloaded {
  border-left: 3px solid var(--accent-red);
  padding-left: 10px;
}

.workload-row.busy {
  border-left: 3px solid var(--accent-orange);
  padding-left: 10px;
}

.workload-row.ok {
  border-left: 3px solid var(--accent-green);
  padding-left: 10px;
}

.workload-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, 1fr));
  gap: 6px;
  min-width: 360px;
}

.workload-metrics span {
  border: 1px solid rgba(42, 49, 80, 0.75);
  border-radius: 6px;
  padding: 6px 7px;
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
}

.workload-metrics b {
  display: block;
  color: var(--text-primary);
  font-size: 13px;
}

.ticket-comment-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(42, 49, 80, 0.55);
}

.ticket-comment-box textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
}

.ticket-comment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticket-comment-actions span {
  font-size: 12px;
}

.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(42, 49, 80, 0.55);
}

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

.activity-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  font-size: 12px;
}

.activity-top strong {
  color: var(--text-primary);
  text-transform: capitalize;
}

.activity-top span,
.activity-body small {
  color: var(--text-muted);
}

.activity-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ========== LOADING/EMPTY ========== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 10px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
}

/* ========== RESPONSIVE ========== */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

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

  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .page-header {
    padding-left: 64px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .revenue-chart-header {
    flex-direction: column;
  }

  .revenue-chart-summary {
    justify-content: stretch;
    width: 100%;
  }

  .revenue-chart-summary > div {
    flex: 1 1 140px;
  }

  .dashboard-ops-grid {
    grid-template-columns: 1fr;
  }

  .compact-list-row,
  .workload-row,
  .dashboard-panel-header {
    align-items: flex-start;
  }

  .workload-row {
    flex-direction: column;
  }

  .workload-metrics {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    flex-direction: column;
  }

  .table-quick-filters {
    grid-template-columns: 1fr;
  }

  .table-filter-count {
    white-space: normal;
  }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-accent);
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeIn 0.35s ease forwards;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ===== AI Chat Widget ===== */
.ai-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.ai-chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transition: all 0.3s ease;
}

.ai-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(99, 102, 241, 0.6);
}

.ai-chat-panel {
  display: none;
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 380px;
  max-height: 520px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(15, 20, 40, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.ai-chat-panel.open {
  display: flex;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(99, 102, 241, 0.08);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 300px;
  max-height: 360px;
}

.ai-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease;
}

.ai-msg-bot {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.15);
  color: var(--text-primary, #e2e8f0);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.ai-msg-user {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ai-msg-typing {
  color: var(--text-muted, #94a3b8);
  font-style: italic;
}

.ai-chat-input {
  padding: 12px;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
  display: flex;
  gap: 8px;
  background: rgba(10, 15, 30, 0.6);
}

.ai-chat-input input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px;
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
}

.ai-chat-input input:focus {
  border-color: rgba(99, 102, 241, 0.5);
}

.ai-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ai-send-btn:hover {
  transform: scale(1.05);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Customer card in invoice/renew */
.customer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.customer-card:hover {
  border-color: #6366f1;
  background: var(--bg-card-hover);
}

.customer-card.selected {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}

#invoiceCustomerResults {
  display: grid;
  gap: 8px;
}

.invoice-customer-card {
  padding: 12px 14px;
}

.invoice-customer-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.invoice-customer-id {
  color: var(--text-primary, #e2e8f0);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  word-break: break-word;
}

.invoice-customer-plan {
  color: #818cf8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
  white-space: nowrap;
}

.invoice-customer-lines {
  display: grid;
  gap: 7px;
}

.invoice-customer-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.invoice-customer-line span {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.invoice-customer-line strong {
  color: var(--text-primary, #e2e8f0);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.invoice-customer-address strong {
  color: #cbd5e1;
}

.invoice-customer-card-selected {
  cursor: default;
}

@media (max-width: 560px) {
  .invoice-customer-card-head {
    display: grid;
  }

  .invoice-customer-plan {
    text-align: left;
    white-space: normal;
  }

  .invoice-customer-line {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

/* ========== CUSTOMER PROFILE ========== */
.search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); max-height: 300px; overflow-y: auto;
  box-shadow: var(--shadow-lg); margin-top: 4px;
}
.search-dropdown-item {
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.search-dropdown-item:hover { background: var(--bg-card-hover); }
.search-dropdown-item:last-child { border-bottom: none; }

.profile-header {
  display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap;
  padding: 24px; background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); margin-bottom: 20px;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--gradient-blue); display: flex; align-items: center;
  justify-content: center; font-size: 32px; font-weight: 700; color: #fff;
  flex-shrink: 0; box-shadow: 0 4px 15px rgba(59,130,246,0.3);
}
.profile-info { flex: 1; min-width: 200px; }
.profile-info h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.profile-info .profile-username { font-size: 13px; color: var(--accent-blue); font-weight: 500; }
.profile-badges { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.profile-badge {
  padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.profile-badge.online { background: rgba(16,185,129,0.15); color: #10b981; }
.profile-badge.offline { background: rgba(239,68,68,0.15); color: #ef4444; }
.profile-badge.plan { background: rgba(59,130,246,0.15); color: #3b82f6; }
.profile-badge.expiry-ok { background: rgba(16,185,129,0.15); color: #10b981; }
.profile-badge.expiry-warn { background: rgba(245,158,11,0.15); color: #f59e0b; }
.profile-badge.expiry-danger { background: rgba(239,68,68,0.15); color: #ef4444; }

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

.profile-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.profile-stat-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 16px; text-align: center;
}
.profile-stat-value { font-size: 24px; font-weight: 700; }
.profile-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.profile-detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.profile-detail-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 16px;
}
.profile-detail-card h4 {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
.profile-detail-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13px;
}
.profile-detail-row:last-child { border-bottom: none; }
.profile-detail-row .label { color: var(--text-muted); }
.profile-detail-row .value { font-weight: 500; text-align: right; }

.profile-tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  background: var(--bg-secondary); border-radius: var(--radius-md); padding: 4px;
  overflow-x: auto;
}
.profile-tab {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: all 0.2s;
  color: var(--text-muted); background: transparent; border: none;
}
.profile-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.profile-tab.active { color: #fff; background: var(--accent-blue); }

.profile-tab-content { display: none; }
.profile-tab-content.active { display: block; }

.profile-timeline {
  display: grid;
  gap: 10px;
}
.profile-timeline-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.profile-timeline-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-timeline-item strong {
  color: var(--text-primary);
}
.profile-timeline-item span,
.profile-timeline-item small {
  color: var(--text-muted);
  font-size: 11px;
}
.profile-timeline-item p {
  margin: 8px 0 4px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}
.profile-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.profile-photo-card {
  display: block;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
}
.profile-photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--bg-secondary);
}
.profile-photo-card div {
  padding: 10px 12px;
  display: grid;
  gap: 3px;
}
.profile-photo-card b {
  text-transform: capitalize;
}
.profile-photo-card span,
.profile-photo-card small {
  color: var(--text-muted);
  font-size: 11px;
}
