:root {
  --red: #CC1414;
  --red-dark: #a00e0e;
  --red-light: #e82020;
  --red-faint: #fff0f0;
  --dark: #111111;
  --dark-2: #1e1e1e;
  --dark-3: #2a2a2a;
  --gray: #4a4a4a;
  --gray-2: #6b6b6b;
  --gray-3: #9a9a9a;
  --border: #e0e0e0;
  --bg: #f5f4f4;
  --white: #ffffff;
  --sidebar-w: 220px;
  --font-main: 'Barlow', sans-serif;
  --font-condensed: 'Barlow Condensed', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 6px;
  --transition: 0.15s ease;
}

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

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--dark);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark-2);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px;
  background: var(--red);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-condensed);
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
  border-bottom: 3px solid var(--red-dark);
}
.brand-icon { font-size: 22px; }

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

.nav-section {
  font-family: var(--font-condensed);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--gray-2);
  padding: 14px 16px 4px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: #bbb;
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active {
  background: rgba(204,20,20,0.18);
  color: #ff6666;
  border-left-color: var(--red);
}
.nav-icon { font-size: 14px; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-user { color: #888; font-size: 12px; font-weight: 600; }
.logout-btn {
  color: var(--red);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border: 1px solid var(--red);
  border-radius: 3px;
  transition: var(--transition);
}
.logout-btn:hover { background: var(--red); color: white; }

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.page-title {
  font-family: var(--font-condensed);
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: 0.3px;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.badge-admin { background: var(--red); color: white; }
.badge-user { background: var(--dark-3); color: #ccc; }

.content-wrapper { padding: 24px 28px; flex: 1; }

/* ALERTS */
.alert {
  padding: 12px 18px;
  margin: 0 28px;
  margin-top: 12px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13.5px;
}
.alert-success { background: #e8f5e9; color: #1b5e20; border-left: 4px solid #4caf50; }
.alert-error { background: #ffebee; color: #b71c1c; border-left: 4px solid var(--red); }
.alert-warning { background: #fff8e1; color: #e65100; border-left: 4px solid #ff9800; }

/* CARDS */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-family: var(--font-condensed);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.card-body { padding: 20px; }

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--red);
  box-shadow: var(--shadow);
}
.stat-value {
  font-family: var(--font-condensed);
  font-size: 36px;
  font-weight: 800;
  color: var(--red);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-2);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* TABLES */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  background: var(--bg);
  font-family: var(--font-condensed);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-2);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--red-faint); }

/* BADGES */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-warning { background: #fff8e1; color: #e65100; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-neutral { background: #f0f0f0; color: #555; }
.badge-red { background: var(--red); color: white; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--red); color: white; }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { background: var(--dark-3); color: white; }
.btn-secondary:hover { background: var(--dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--red); color: var(--red); }
.btn-outline:hover { background: var(--red); color: white; }
.btn-ghost { background: transparent; color: var(--gray); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #c62828; color: white; }
.btn-danger:hover { background: #8b0000; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 7px; font-size: 11px; }

/* FORMS */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.required::after { content: ' *'; color: var(--red); }
.form-control {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-main);
  font-size: 14px;
  background: white;
  color: var(--dark);
  transition: var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(204,20,20,0.08);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
}
.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--red);
  cursor: pointer;
}
.form-hint { font-size: 11.5px; color: var(--gray-3); }
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* SECTION TITLE */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-condensed);
  font-size: 18px;
  font-weight: 700;
}
.section-divider {
  font-family: var(--font-condensed);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--red);
  border-bottom: 2px solid var(--red);
  padding-bottom: 6px;
  margin: 24px 0 16px;
}

/* FILTER BAR */
.filter-bar {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 11px; font-weight: 700; color: var(--gray-2); text-transform: uppercase; }

/* STATUS COLORS */
.status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
}

/* PAGINATION */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}
.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  border: 1.5px solid var(--border);
  color: var(--dark);
}
.pagination a:hover { border-color: var(--red); color: var(--red); }
.pagination .current { background: var(--red); color: white; border-color: var(--red); }

/* DETAIL GRID */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.detail-item { }
.detail-key {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.detail-value {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--dark);
  margin-top: 2px;
}

/* UNASSIGNED WARNING */
.warning-box {
  background: #fff8e1;
  border: 1.5px solid #ffb300;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.warning-box strong { color: #e65100; }

/* TRACKING NUMBER */
.tracking-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--dark);
}

/* TABS */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-item {
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  text-decoration: none;
  color: var(--gray);
  transition: var(--transition);
}
.tab-item:hover { color: var(--red); }
.tab-item.active { color: var(--red); border-bottom-color: var(--red); }

/* ABARBEITUNGSBOX */
.pickup-box {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.pickup-box-title {
  font-family: var(--font-condensed);
  font-size: 15px;
  font-weight: 700;
  color: #856404;
  margin-bottom: 10px;
}

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

/* LOGIN PAGE */
.login-page {
  min-height: 100vh;
  background: var(--dark-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
}
.login-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}
.login-title {
  font-family: var(--font-condensed);
  font-size: 26px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: 0.5px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--gray-2);
  margin-top: 4px;
}

/* PARTNER PORTAL */
body.partner-body {
  background: #1a1a2e;
}
.partner-sidebar {
  background: #16213e;
}
.partner-brand {
  background: var(--red);
}
