/* BMS — Beschaffungsmanagement-System */
/* Farben: Österreichisches Rotes Kreuz */

:root {
  --rk-red:       #b70e0c;
  --rk-red-dark:  #8a0a09;
  --rk-red-light: #f5e6e6;
  --rk-orange:    #da532c;
  --rk-bg:        #f6f7f9;
  --rk-surface:   #ffffff;
  --rk-border:    #e0e2e7;
  --rk-text:      #1a1a1a;
  --rk-muted:     #6b7280;
  --rk-success:   #166534;
  --rk-success-bg:#dcfce7;
  --rk-warning:   #854d0e;
  --rk-warning-bg:#fef9c3;
  --rk-danger:    #991b1b;
  --rk-danger-bg: #fee2e2;
  --rk-info:      #1e40af;
  --rk-info-bg:   #dbeafe;
  --sidebar-w:    240px;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--rk-text);
  background: var(--rk-bg);
}

a { color: var(--rk-red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #1a1a1a;
  color: #e5e5e5;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .logo-cross {
  width: 32px; height: 32px;
  background: var(--rk-red);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-cross::before {
  content: '+';
  color: white;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.sidebar-logo .logo-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.sidebar-logo .logo-text {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.sidebar-logo .logo-subtext {
  font-size: 9.5px;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  padding: 16px 18px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #d1d5db;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(183,14,12,0.25); color: #fff; border-left-color: var(--rk-red); }
.nav-item i { font-size: 17px; opacity: 0.8; }

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  color: #9ca3af;
}
.sidebar-footer strong { display: block; color: #e5e5e5; margin-bottom: 2px; }

.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--rk-surface);
  border-bottom: 1px solid var(--rk-border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--rk-text); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 28px; flex: 1; max-width: 1200px; }

/* ── Typografie ── */
h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
h2 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.page-subtitle { color: var(--rk-muted); font-size: 14px; margin-bottom: 24px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--rk-red);   color: #fff; }
.btn-primary:hover { background: var(--rk-red-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--rk-border); color: var(--rk-text); }
.btn-secondary:hover { background: #d0d3da; text-decoration: none; }
.btn-danger    { background: var(--rk-danger-bg); color: var(--rk-danger); }
.btn-danger:hover { background: #fca5a5; text-decoration: none; }
.btn-success   { background: var(--rk-success-bg); color: var(--rk-success); }
.btn-ghost     { background: transparent; color: var(--rk-muted); }
.btn-ghost:hover { background: var(--rk-border); text-decoration: none; }
.btn-sm { padding: 5px 11px; font-size: 13px; }

/* ── Cards ── */
.card {
  background: var(--rk-surface);
  border: 1px solid var(--rk-border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rk-border);
}
.card-title { font-size: 15px; font-weight: 600; }

/* ── Stats-Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--rk-surface);
  border: 1px solid var(--rk-border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-card .stat-label { font-size: 12px; color: var(--rk-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--rk-red); line-height: 1.2; }
.stat-card .stat-sub   { font-size: 12px; color: var(--rk-muted); }

/* ── Tabellen ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--rk-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--rk-border);
  white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--rk-border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

/* ── Badges / Status ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-entwurf    { background: #f3f4f6; color: #374151; }
.badge-beantragt  { background: var(--rk-warning-bg); color: var(--rk-warning); }
.badge-freigegeben{ background: var(--rk-info-bg); color: var(--rk-info); }
.badge-abgelehnt  { background: var(--rk-danger-bg); color: var(--rk-danger); }
.badge-beauftragt { background: #ede9fe; color: #5b21b6; }
.badge-geliefert  { background: var(--rk-success-bg); color: var(--rk-success); }
.badge-abgeschlossen { background: #f0fdf4; color: #14532d; }
.badge-planung    { background: #f3f4f6; color: #374151; }
.badge-erstellt   { background: #f3f4f6; color: #374151; }
.badge-bestaetigt { background: var(--rk-info-bg); color: var(--rk-info); }
.badge-baubeginn  { background: #fff7ed; color: #9a3412; }
.badge-produktion { background: var(--rk-warning-bg); color: var(--rk-warning); }
.badge-qualitaetspruefung { background: #fef9c3; color: #854d0e; }
.badge-versandbereit { background: #dbeafe; color: #1e40af; }
.badge-ausgeliefert  { background: var(--rk-success-bg); color: var(--rk-success); }
.badge-abnahme    { background: #ede9fe; color: #5b21b6; }
.badge-aktiv      { background: var(--rk-success-bg); color: var(--rk-success); }
.badge-archiviert { background: #f3f4f6; color: #6b7280; }
.badge-role-admin { background: var(--rk-red-light); color: var(--rk-red-dark); }
.badge-role-lrk   { background: #fff0f0; color: #7f1d1d; }
.badge-role-kommandant { background: #fff7ed; color: #9a3412; }
.badge-role-projektleiter { background: var(--rk-info-bg); color: var(--rk-info); }
.badge-role-mitarbeiter { background: #f3f4f6; color: #374151; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-section-label { font-size: 12px; font-weight: 500; color: var(--rk-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 14px; }
.form-section-label:not(:first-child) { margin-top: 8px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--rk-text); }
.form-input, .form-select, .form-textarea {
  padding: 9px 12px;
  border: 1px solid var(--rk-border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--rk-text);
  background: var(--rk-surface);
  transition: border-color 0.15s;
  font-family: inherit;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--rk-red);
  box-shadow: 0 0 0 3px rgba(183,14,12,0.1);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--rk-muted); }

/* ── Flash messages ── */
.flash {
  padding: 12px 16px;
  border-radius: 7px;
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flash-success { background: var(--rk-success-bg); color: var(--rk-success); }
.flash-error   { background: var(--rk-danger-bg);  color: var(--rk-danger); }
.flash-info    { background: var(--rk-info-bg);    color: var(--rk-info); }
.flash-warning { background: var(--rk-warning-bg); color: var(--rk-warning); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--rk-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; display: block; opacity: 0.4; }
.empty-state p { font-size: 15px; }

/* ── Auth Layout ── */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rk-bg);
}
.auth-card {
  background: var(--rk-surface);
  border: 1px solid var(--rk-border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-cross {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  background: var(--rk-red);
  border-radius: 10px;
  font-size: 32px;
  color: white;
  font-weight: 700;
  margin-bottom: 12px;
}
.auth-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth-sub   { font-size: 13px; color: var(--rk-muted); text-align: center; margin-bottom: 24px; }

/* ── Bestellpositionen ── */
.items-table input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--rk-border);
  border-radius: 4px;
  font-size: 13px;
}
.items-table input:focus {
  outline: none;
  border-color: var(--rk-red);
}

/* ── Lieferant Magic-Link ── */
.supplier-portal {
  min-height: 100vh;
  background: var(--rk-bg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}
.supplier-card {
  background: var(--rk-surface);
  border: 1px solid var(--rk-border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 680px;
}
.supplier-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rk-border);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; height: auto; }
  .main-area { margin-left: 0; }
  .app-layout { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* Neue Projekt-Status Badges */
.badge-pruefung    { background: #fef9c3; color: #854d0e; }
.badge-genehmigt   { background: #dbeafe; color: #1e40af; }
.badge-umsetzung   { background: #ede9fe; color: #5b21b6; }
