/* ─── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  background: #f4f6f9;
  color: #2d3748;
  margin: 0;
  overflow-x: hidden;
}

/* ─── SIDEBAR ──────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 240px;
  height: 100vh;
  background: #1e293b;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-nav span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-footer span { display: none; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-nav a i { margin: 0; font-size: 1.2rem; }

.sidebar-header {
  padding: 20px 18px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-nav {
  list-style: none;
  padding: 8px 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

.sidebar-nav li { margin: 0; }

.nav-section {
  padding: 10px 18px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: #64748b;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover { background: #273449; color: #e2e8f0; }
.sidebar-nav a.active { background: #273449; color: #60a5fa; border-left-color: #3b82f6; }
.sidebar-nav a i { font-size: 1rem; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid #334155;
  flex-shrink: 0;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

.sidebar-footer a:hover { color: #e2e8f0; }

/* ─── MAIN CONTENT ──────────────────────────────────────────────────────────── */
.main-content {
  margin-left: 240px;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

.sidebar.collapsed ~ .main-content { margin-left: 60px; }

/* ─── TOPBAR ────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  z-index: 100;
}

/* ─── CARDS & PAGE ──────────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.25rem;
  padding-top: 1.25rem;
}

.card {
  border: none;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
}

/* ─── STAT CARDS ────────────────────────────────────────────────────────────── */
.stat-card {
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card .stat-icon { font-size: 2.5rem; opacity: .8; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-card .stat-label { font-size: .8rem; opacity: .85; }

/* ─── BADGES ────────────────────────────────────────────────────────────────── */
.badge-soft-success { background: #dcfce7; color: #16a34a; }
.badge-soft-warning { background: #fef9c3; color: #ca8a04; }
.badge-soft-info    { background: #e0f2fe; color: #0369a1; }
.badge-soft-danger  { background: #fee2e2; color: #dc2626; }
.badge-soft-secondary { background: #f1f5f9; color: #64748b; }

/* ─── TABLES ────────────────────────────────────────────────────────────────── */
.table th { font-weight: 600; font-size: .8rem; text-transform: uppercase; color: #64748b; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ─── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn-xs {
  padding: .15rem .4rem;
  font-size: .75rem;
  border-radius: .25rem;
}

/* ─── FORMS ─────────────────────────────────────────────────────────────────── */
.form-label { font-weight: 600; font-size: .85rem; }
.form-control:focus, .form-select:focus { border-color: #3b82f6; box-shadow: 0 0 0 .15rem rgba(59,130,246,.15); }

/* ─── PRINT ─────────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print, .btn { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .card { box-shadow: none !important; }
}

/* ─── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-240px); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ─── SCROLLBAR ─────────────────────────────────────────────────────────────── */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

/* ─── DATATABLES ────────────────────────────────────────────────────────────── */
.dataTables_wrapper .dataTables_filter input { border-radius: 6px; border: 1px solid #e2e8f0; padding: 4px 8px; }
.dataTables_wrapper .dataTables_length select { border-radius: 6px; border: 1px solid #e2e8f0; padding: 4px 8px; }

/* ─── WORK ORDER STATUS ─────────────────────────────────────────────────────── */
.status-open { background: #fef9c3; color: #92400e; }
.status-in_progress { background: #e0f2fe; color: #075985; }
.status-done { background: #dcfce7; color: #166534; }
.status-cancelled { background: #f1f5f9; color: #475569; }

/* ─── LOGIN PAGE ────────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo { font-size: 2rem; color: #3b82f6; }
