* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1E3A5F;
  --primary-light: #2E86AB;
  --accent: #2DC653;
  --urgent: #E63946;
  --warning: #F4A261;
  --bg: #F5F7FA;
  --white: #FFFFFF;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ==============================
   Layout
============================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ==============================
   Sidebar
============================== */
.sidebar {
  width: 260px;
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 3px;
}

.sidebar-logo p {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px 18px;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 6px;
}

.nav-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.72);
  cursor: pointer;
  font: inherit;
  transition: background 0.2s, color 0.2s;
}

.nav-section-toggle:hover,
.nav-group.open > .nav-section-toggle {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-section-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.nav-section-title svg,
.nav-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-chevron {
  transition: transform 0.2s;
  opacity: 0.7;
}

.nav-group.open .nav-chevron {
  transform: rotate(90deg);
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 36px;
  border-radius: 8px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 14px;
  background: none;
  border: none;
  width: 100%;
  padding: 8px 0;
}

.logout-btn:hover { color: white; }

/* ==============================
   Main Content
============================== */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 32px;
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==============================
   Cards
============================== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

/* ==============================
   Stats Grid
============================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

/* ==============================
   Buttons
============================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: #162d4a; }

.btn-success {
  background: #EAF3DE;
  color: #3B6D11;
}

.btn-danger {
  background: #FEE2E2;
  color: #991B1B;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { background: var(--bg); }

.btn-full { width: 100%; justify-content: center; }

.btn-lg { padding: 14px 24px; font-size: 16px; }

/* ==============================
   Forms
============================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ==============================
   Table
============================== */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:hover td { background: #F9FAFB; }

/* ==============================
   Badges
============================== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-pending {
  background: #FEF3C7;
  color: #92400E;
}

.badge-approved {
  background: #DBEAFE;
  color: #1E40AF;
}

.badge-accepted {
  background: #D1FAE5;
  color: #065F46;
}

.badge-completed {
  background: #EDE9FE;
  color: #5B21B6;
}

.badge-urgent {
  background: #FEE2E2;
  color: #991B1B;
}

.badge-normal {
  background: #F3F4F6;
  color: #374151;
}

/* ==============================
   Login Page
============================== */
.login-page {
  min-height: 100vh;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .icon {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.login-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 3px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==============================
   Alerts
============================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.alert-error {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.alert-success {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.alert.show { display: block; }

/* ==============================
   Loading
============================== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.spinner.show { display: inline-block; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==============================
   Notification Badge
============================== */
.notif-badge {
  background: var(--urgent);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

/* ==============================
   Sidebar — Account (oben)
============================== */
.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: white;
  overflow: hidden;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  cursor: pointer;
}

.sidebar-user-logout:hover { color: white; }

.sidebar-footer { display: none; }

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 90;
}

/* ==============================
   Responsive
============================== */
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 64px;
  }
  .form-row { grid-template-columns: 1fr; }
}

/* ==============================
   Toggle Switch
============================== */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #CBD5E1;
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(20px);
}
