*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; background: #f4f5f7; color: #172b4d !important; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #1b2a3b; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; position: fixed; height: 100vh; overflow-y: auto; z-index: 100; transition: transform 0.25s ease; }
.content { margin-left: 230px; flex: 1; padding: 28px 32px; min-width: 0; }

.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,0.1); background: #ffffff; }
.brand-logo { width: 150px; height: auto; object-fit: contain; }

.nav-links { list-style: none; padding: 12px 0; flex: 1; }
.nav-links li a { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: rgba(255,255,255,0.85); text-decoration: none; font-size: 13.5px; transition: background .15s, color .15s; }
.nav-links li a:hover, .nav-links li a.active { background: rgba(255,255,255,0.1); color: #ffffff; }
.nav-links li a.active { border-left: 3px solid #f5a623; }
.nav-icon { font-size: 10px; opacity: 0.6; }
.nav-sep { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 18px; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; color: rgba(255,255,255,0.5); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.logout-btn { color: rgba(255,255,255,0.5); text-decoration: none; font-size: 12px; }
.logout-btn:hover { color: #fff; }

.hamburger { display: none; position: fixed; top: 12px; left: 12px; z-index: 200; background: #1b2a3b; border: none; border-radius: 6px; padding: 8px 10px; cursor: pointer; flex-direction: column; gap: 5px; }
.hamburger span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; transition: all 0.2s; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 600; color: #172b4d !important; }
.page-subtitle { font-size: 13px; color: #5e6c84 !important; margin-top: 2px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; border: none; transition: background .15s; white-space: nowrap; }
.btn-primary { background: #f5a623; color: #1a1a2e; }
.btn-primary:hover { background: #e09515; }
.btn-secondary { background: #fff; color: #172b4d; border: 1px solid #dfe1e6; }
.btn-secondary:hover { background: #f4f5f7; }
.btn-danger { background: #de350b; color: #fff; }
.btn-danger:hover { background: #bf2600; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.card { background: #fff; border-radius: 8px; border: 1px solid #dfe1e6; margin-bottom: 20px; }
.card-body { padding: 20px 24px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 8px; border: 1px solid #dfe1e6; padding: 18px 20px; border-top: 3px solid #dfe1e6; }
.stat-label { font-size: 11px; color: #5e6c84 !important; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-number { font-size: 28px; font-weight: 700; color: #172b4d; margin: 4px 0 2px; }
.stat-value { font-size: 28px; font-weight: 700; color: #172b4d; margin: 4px 0 2px; }
.stat-sub { font-size: 12px; color: #5e6c84 !important; }
.stat-link { font-size: 12px; color: #1a6cf0; text-decoration: none; display: inline-block; margin-top: 6px; }
.stat-blue { border-top-color: #1a6cf0; } .stat-blue .stat-value { color: #1a6cf0; }
.stat-orange { border-top-color: #f5a623; } .stat-orange .stat-value { color: #f5a623; }
.stat-green { border-top-color: #36b37e; } .stat-green .stat-value { color: #36b37e; }
.stat-purple { border-top-color: #6554c0; } .stat-purple .stat-value { color: #6554c0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
thead th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600; color: #42526e !important; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 2px solid #dfe1e6; white-space: nowrap; }
tbody td { padding: 11px 14px; border-bottom: 1px solid #f4f5f7; font-size: 13.5px; vertical-align: middle; color: #172b4d !important; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-green { background: #e3fcef; color: #006644; }
.badge-blue { background: #e9f2ff; color: #0747a6; }
.badge-yellow { background: #fffae6; color: #974f0c; }
.badge-red { background: #ffebe6; color: #bf2600; }
.badge-gray { background: #f4f5f7; color: #5e6c84; }
.badge-grey { background: #f4f5f7; color: #5e6c84; }
.badge-purple { background: #eae6ff; color: #403294; }
.badge-orange { background: #fff7e6; color: #974f0c; }

.priority-high { color: #bf2600; font-weight: 600; }
.priority-medium { color: #974f0c; }
.priority-low { color: #006644; }

.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: #f4f5f7; border-radius: 3px; min-width: 40px; }
.progress-fill { height: 100%; background: #f5a623; border-radius: 3px; }
.progress-pct { font-size: 12px; color: #5e6c84; min-width: 30px; }

.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-input { padding: 7px 12px; border: 1px solid #dfe1e6; border-radius: 6px; font-size: 13px; background: #fff; color: #172b4d; min-width: 0; flex: 1; max-width: 300px; }
.filter-input:focus { outline: none; border-color: #f5a623; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: #42526e !important; text-transform: uppercase; letter-spacing: 0.4px; }
input, select, textarea { padding: 8px 12px; border: 1px solid #dfe1e6; border-radius: 6px; font-size: 13.5px; color: #172b4d !important; background: #fff; font-family: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #f5a623; box-shadow: 0 0 0 2px rgba(245,166,35,0.15); }
textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid #f4f5f7; flex-wrap: wrap; }
.required-star { color: #de350b !important; font-style: normal !important; text-transform: none !important; font-size: 14px !important; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f0f0f0; padding: 20px; }
.login-card { background: #fff; border-radius: 12px; padding: 36px 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand img { width: 180px; height: auto; margin-bottom: 12px; }
.login-error { background: #ffebe6; border: 1px solid #ff7452; color: #bf2600; padding: 9px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.login-card .form-group { margin-bottom: 14px; }
.login-card input { width: 100%; }
.login-card .btn { width: 100%; justify-content: center; padding: 10px; margin-top: 4px; }

.action-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 48px 20px; color: #5e6c84; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: #172b4d; margin-bottom: 6px; }
.section-title { font-size: 14px; font-weight: 600; color: #172b4d !important; margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .content { padding: 20px 20px; }
}

@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .hamburger { display: flex; }
  .content { margin-left: 0; padding: 60px 14px 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 12px 14px; }
  .stat-number, .stat-value { font-size: 22px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
  .page-header > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
  .page-title { font-size: 18px; }
  .filters form { flex-direction: column; align-items: stretch; }
  .filters form .filter-input { max-width: 100%; }
  .filters form .btn { width: 100%; justify-content: center; }
  .table-wrap { border-radius: 8px; }
  table { min-width: 600px; }
  thead th, tbody td { padding: 8px 10px; font-size: 12px; }
  .card-body { padding: 14px 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-group.full { grid-column: 1; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }
  .login-card { padding: 28px 20px; }
  .two-col { grid-template-columns: 1fr; }
}

/* ── Dark Mode ────────────────────────────────────────────────────────────── */
body.dark { background: #0f1724; color: #c9d1d9 !important; }
body.dark .content { color: #c9d1d9; }
body.dark .card { background: #1c2333; border-color: #30363d; }
body.dark .card-body { background: #1c2333; }
body.dark .page-title { color: #e6edf3 !important; }
body.dark .page-subtitle { color: #8b949e !important; }
body.dark .stat-card { background: #1c2333; border-color: #30363d; }
body.dark .stat-number, body.dark .stat-value { color: #e6edf3 !important; }
body.dark .stat-label { color: #8b949e !important; }
body.dark .stat-sub { color: #8b949e !important; }
body.dark table { color: #c9d1d9 !important; }
body.dark thead th { color: #8b949e !important; border-bottom-color: #30363d; background: #161b22; }
body.dark tbody td { color: #c9d1d9 !important; border-bottom-color: #21262d; }
body.dark tbody tr:hover { background: #21262d; }
body.dark .btn-secondary { background: #21262d; color: #c9d1d9; border-color: #30363d; }
body.dark .btn-secondary:hover { background: #30363d; }
body.dark input, body.dark select, body.dark textarea { background: #0d1117; color: #c9d1d9 !important; border-color: #30363d; }
body.dark input:focus, body.dark select:focus, body.dark textarea:focus { border-color: #f5a623; }
body.dark label { color: #8b949e !important; }
body.dark .filter-input { background: #0d1117; color: #c9d1d9; border-color: #30363d; }
body.dark .badge-gray { background: #21262d; color: #8b949e; }
body.dark .empty-state { color: #8b949e; }
body.dark .empty-state h3 { color: #c9d1d9; }
body.dark .section-title { color: #e6edf3 !important; }
body.dark .form-actions { border-top-color: #30363d; }
body.dark .login-card { background: #1c2333; }
body.dark .login-wrap { background: #0f1724; }
body.dark .stats-grid .stat-card { background: #1c2333; }
body.dark a { color: #58a6ff; }
body.dark .page-header .btn-secondary { background: #21262d; color: #c9d1d9; border-color: #30363d; }
body.dark .filters .filter-input { background: #0d1117; color: #c9d1d9; border-color: #30363d; }
body.dark .table-wrap { background: #1c2333; }
body.dark .action-row .btn-secondary { background: #21262d; color: #c9d1d9; border-color: #30363d; }
body.dark .bulk-bar { background: #1c2333; border-color: #30363d; color: #c9d1d9; }
body.dark .bulk-bar select { background: #0d1117; color: #c9d1d9; border-color: #30363d; }

/* ── Dark Mode Refinements ────────────────────────────────────────────────── */
body.dark .brand { background: #161b22; border-bottom-color: #30363d; }
body.dark .brand-logo { filter: brightness(1.4) contrast(1.1); }
body.dark .sidebar { background: #161b22; }
body.dark .nav-links li a { color: rgba(255,255,255,0.75); }
body.dark .nav-links li a:hover, body.dark .nav-links li a.active { background: rgba(255,255,255,0.08); color: #fff; }
body.dark .sidebar-footer { border-top-color: #30363d; }
body.dark .sidebar input { background: #0d1117 !important; color: #c9d1d9 !important; border-color: #30363d !important; }
body.dark .sidebar input::placeholder { color: #6e7681 !important; }
body.dark .sidebar button[type=submit] { background: rgba(255,255,255,0.1) !important; }
body.dark .filters { background: transparent; }
body.dark .btn-secondary { background: #21262d !important; color: #c9d1d9 !important; border-color: #30363d !important; }
body.dark .btn-secondary:hover { background: #30363d !important; }
body.dark .page-header .btn-primary { background: #f5a623; color: #000; }
body.dark .badge-green { background: #033a16; color: #3fb950; }
body.dark .badge-blue { background: #031d35; color: #58a6ff; }
body.dark .badge-yellow { background: #341a00; color: #d29922; }
body.dark .badge-red { background: #3d0000; color: #f85149; }
body.dark .badge-gray { background: #21262d; color: #8b949e; }
body.dark .badge-purple { background: #1e1040; color: #bc8cff; }
body.dark .stat-link { color: #58a6ff; }
body.dark .section-title { color: #e6edf3 !important; border-bottom-color: #30363d; }
body.dark .form-actions { border-top-color: #30363d; }
body.dark hr { border-color: #30363d; }
body.dark .progress-bar { background: #21262d; }
body.dark .nav-sep { background: rgba(255,255,255,0.08); }
body.dark .alert-banner { background: #2d1f00 !important; border-color: #d29922 !important; }
