* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  overflow-x: hidden;
}

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

/* ---- Sidebar ---- */
#sidebar {
  width: 240px;
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s;
}
#sidebar.collapsed { transform: translateX(-240px); }
.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid #2a2a3e;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-header h2 { font-size: 20px; color: #4fc3f7; }
.sidebar-header .badge {
  background: #4fc3f7; color: #0f0f1a; font-size: 10px;
  padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
#sidebar nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; color: #999; text-decoration: none;
  font-size: 14px; cursor: pointer; transition: all 0.2s;
}
.nav-item:hover { background: #25253e; color: #fff; }
.nav-item.active { background: #2a2a4e; color: #4fc3f7; border-left: 3px solid #4fc3f7; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid #2a2a3e;
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-footer span { font-size: 13px; color: #aaa; }

/* ---- Main ---- */
#main { flex: 1; padding: 0; display: flex; flex-direction: column; }
.main-header {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px; background: #1a1a2e; border-bottom: 1px solid #2a2a3e;
}
.main-header h1 { font-size: 20px; font-weight: 600; flex: 1; }
.header-right { display: flex; align-items: center; gap: 12px; }
.live-dot { font-size: 12px; color: #4caf50; display: flex; align-items: center; gap: 4px; }

#page-content { padding: 24px; overflow-y: auto; }

/* ---- Cards ---- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: #1a1a2e; border-radius: 12px; padding: 20px;
  border: 1px solid #2a2a3e; transition: border-color 0.2s;
}
.stat-card:hover { border-color: #4fc3f7; }
.stat-card .label { font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: #fff; margin-top: 4px; }
.stat-card .change { font-size: 12px; margin-top: 4px; }
.stat-card .change.up { color: #4caf50; }
.stat-card .change.down { color: #f44336; }
.stat-card .icon { font-size: 24px; margin-bottom: 8px; }

/* ---- Tables ---- */
.table-container {
  background: #1a1a2e; border-radius: 12px; border: 1px solid #2a2a3e;
  overflow-x: auto; margin-bottom: 24px;
}
.table-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid #2a2a3e;
}
.table-header h3 { font-size: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 12px 16px; color: #888; font-weight: 500;
  border-bottom: 1px solid #2a2a3e; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid #25253e; }
tbody tr:hover { background: #25253e; cursor: pointer; }

.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.status-badge.completed { background: #1b3a2a; color: #4caf50; }
.status-badge.in_progress { background: #1a2a4a; color: #42a5f5; }
.status-badge.requested { background: #2a2a1a; color: #ffc107; }
.status-badge.accepted { background: #1a2a2a; color: #26a69a; }
.status-badge.cancelled { background: #3a1a1a; color: #ef5350; }
.status-badge.open { background: #2a2a1a; color: #ffc107; }
.status-badge.resolved { background: #1b3a2a; color: #4caf50; }
.status-badge.pending { background: #2a2a1a; color: #ffc107; }

/* ---- Buttons ---- */
.btn {
  padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
  background: #2a2a3e; color: #e0e0e0; transition: all 0.2s;
}
.btn:hover { background: #3a3a4e; }
.btn-primary { background: #4fc3f7; color: #0f0f1a; font-weight: 600; }
.btn-primary:hover { background: #29b6f6; }
.btn-danger { background: #ef5350; color: #fff; }
.btn-danger:hover { background: #e53935; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline { background: transparent; border: 1px solid #3a3a4e; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Inputs ---- */
input, select, textarea {
  padding: 10px 12px; border: 1px solid #3a3a4e; border-radius: 6px;
  font-size: 13px; background: #1a1a2e; color: #e0e0e0; width: 100%;
}
input:focus, select:focus { outline: none; border-color: #4fc3f7; }
.filter-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px;
}
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; }

/* ---- Login ---- */
#login-overlay {
  display: flex; position: fixed; inset: 0; background: #0f0f1a;
  align-items: center; justify-content: center; z-index: 1000;
}
#login-box {
  background: #1a1a2e; border-radius: 16px; padding: 40px 32px;
  width: 380px; border: 1px solid #2a2a3e;
}
#login-box h2 { text-align: center; margin-bottom: 4px; }
#login-box p { font-size: 13px; color: #888; text-align: center; margin-bottom: 24px; }
#login-box input { margin-bottom: 12px; }
.error-text { color: #ef5350; font-size: 13px; margin-bottom: 8px; text-align: center; }
.login-hint { margin-top: 16px !important; font-size: 11px !important; color: #666 !important; }

/* ---- Charts ---- */
.charts-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px;
}
.chart-card {
  background: #1a1a2e; border-radius: 12px; padding: 20px; border: 1px solid #2a2a3e;
}
.chart-card h4 { font-size: 14px; margin-bottom: 12px; color: #aaa; }
.chart-card canvas { max-height: 280px; }

/* ---- Modal ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  align-items: center; justify-content: center; z-index: 2000;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #1a1a2e; border-radius: 12px; padding: 32px;
  width: 500px; max-width: 90vw; max-height: 80vh; overflow-y: auto;
  border: 1px solid #2a2a3e;
}
.modal-box h3 { margin-bottom: 16px; }
.modal-box .field { margin-bottom: 12px; }
.modal-box .field label { display: block; font-size: 12px; color: #888; margin-bottom: 4px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  #sidebar { position: fixed; inset: 0; z-index: 100; transform: translateX(-240px); }
  #sidebar.open { transform: translateX(0); }
  #menu-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (min-width: 769px) { #menu-toggle { display: none; } }
