/* Factor-O-Mat Admin Panel v0.1.0 */

:root {
  --bg: #F7F8FA;
  --bg-card: #FFFFFF;
  --bg-nav: #1A2B33;
  --primary: #2F5D8A;
  --primary-light: #EBF1F7;
  --accent: #C1A039;
  --accent-light: #FBF6E8;
  --text: #1A2B33;
  --text-light: #4A5568;
  --text-muted: #8896A6;
  --border: #E2E8F0;
  --border-light: #F0F3F6;
  --gruen: #27AE60;
  --gruen-bg: #E8F8EF;
  --gelb: #D4A017;
  --gelb-bg: #FDF6E3;
  --rot: #C0392B;
  --rot-bg: #FDEDED;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 150ms ease;
}

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

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

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

/* ===== NAV ===== */
.nav {
  background: var(--bg-nav);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo {
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  letter-spacing: -0.5px;
}
.nav-logo-accent { color: var(--accent); }
.nav-label {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-link.is-active { color: #fff; background: rgba(255,255,255,0.12); }
.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-username { color: rgba(255,255,255,0.5); font-size: 13px; }
.nav-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  transition: var(--transition);
}
.nav-logout:hover { color: #fff; border-color: rgba(255,255,255,0.3); }

/* ===== MAIN ===== */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.main--login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px);
  padding: 0;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}

/* ===== LOGIN ===== */
.login-wrap { width: 100%; max-width: 380px; padding: 24px; }
.login-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 32px;
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { font-weight: 800; font-size: 32px; color: var(--text); display: block; }
.login-logo-accent { color: var(--accent); }
.login-header h1 { font-size: 16px; font-weight: 500; color: var(--text-muted); margin-top: 8px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ===== FORMS ===== */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--text-light); }
.form-input, .form-select, .form-textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  transition: var(--transition);
  background: #fff;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-textarea { resize: vertical; min-height: 72px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: #24486B; text-decoration: none; color: #fff; }
.btn--secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn--secondary:hover { background: var(--border-light); text-decoration: none; }
.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn--full { width: 100%; }

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.alert--error { background: var(--rot-bg); color: var(--rot); border: 1px solid #F5C6CB; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.back-link {
  font-size: 13px;
  color: var(--text-muted);
  display: inline-block;
  margin-bottom: 8px;
}
.back-link:hover { color: var(--primary); }

/* ===== KPI CARDS ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  border: 1px solid var(--border-light);
}
.kpi-card--highlight { border-left: 3px solid var(--primary); }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text); }
.kpi-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  border: 1px solid var(--border-light);
}
.card h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

/* ===== STAT BARS ===== */
.stat-bars { display: flex; flex-direction: column; gap: 10px; }
.stat-bar { display: flex; justify-content: space-between; align-items: center; }
.stat-bar-label { font-size: 13px; color: var(--text-light); display: flex; align-items: center; gap: 8px; }
.stat-bar-value { font-size: 16px; font-weight: 700; }

/* ===== DOTS ===== */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot--gruen { background: var(--gruen); }
.dot--gelb { background: var(--gelb); }
.dot--rot { background: var(--rot); }

/* ===== TABLE ===== */
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  vertical-align: middle;
}
.table--compact th, .table--compact td { padding: 8px 12px; font-size: 12px; }
.table-row--clickable { cursor: pointer; transition: var(--transition); }
.table-row--clickable:hover { background: var(--primary-light); }
.td-mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 12px; color: var(--text-muted); }
.td-date { white-space: nowrap; font-size: 12px; color: var(--text-muted); }
.td-center { text-align: center; }
.td-hint { font-size: 11px; color: var(--text-muted); max-width: 300px; }
.tr--ko { background: var(--rot-bg); }
.tr--warn { background: var(--gelb-bg); }
.th-sort { color: var(--text-muted); text-decoration: none; }
.th-sort:hover { color: var(--primary); text-decoration: none; }

/* ===== FILTER ===== */
.filter-card { margin-bottom: 16px; }
.filter-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: end;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.filter-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}
.pagination-link { font-size: 13px; font-weight: 600; }
.pagination-info { font-size: 13px; color: var(--text-muted); }

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}
.status-badge--lg { font-size: 14px; padding: 6px 16px; }
.status-badge--neu { background: var(--primary-light); color: var(--primary); }
.status-badge--in_bearbeitung { background: var(--gelb-bg); color: var(--gelb); }
.status-badge--angebot_versendet { background: var(--accent-light); color: #8B7221; }
.status-badge--abgeschlossen { background: var(--gruen-bg); color: var(--gruen); }
.status-badge--archiviert { background: var(--bg); color: var(--text-muted); }

/* ===== DETAIL ===== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
.detail-main { display: flex; flex-direction: column; gap: 16px; }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }
.detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-field { display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.detail-value { font-size: 14px; }

/* ===== AMPEL BANNER ===== */
.ampel-banner {
  padding: 16px 24px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.ampel-banner--gruen { background: var(--gruen-bg); color: var(--gruen); border: 1px solid #A3D9B1; }
.ampel-banner--gelb { background: var(--gelb-bg); color: var(--gelb); border: 1px solid #E8D48A; }
.ampel-banner--rot { background: var(--rot-bg); color: var(--rot); border: 1px solid #F5A3A3; }
.ampel-score { font-size: 13px; font-weight: 500; opacity: 0.7; }
.ampel-ko { font-size: 13px; font-weight: 600; background: rgba(0,0,0,0.08); padding: 2px 10px; border-radius: 12px; }

/* ===== NOTES ===== */
.note-form { border-bottom: 1px solid var(--border-light); padding-bottom: 16px; }
.notes-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.note-item { padding: 12px; background: var(--bg); border-radius: var(--radius-sm); }
.note-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.note-text { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }

/* ===== STATUS FORM ===== */
.status-current { margin-bottom: 16px; }
.status-form { border-top: 1px solid var(--border-light); padding-top: 16px; }

/* ===== ERROR PAGE ===== */
.error-page { text-align: center; padding: 80px 24px; }
.error-code { font-size: 64px; font-weight: 800; color: var(--border); }
.error-page h1 { font-size: 20px; margin: 8px 0; }
.error-page p { color: var(--text-muted); margin-bottom: 24px; }

/* ===== UTILITIES ===== */
.text-muted { color: var(--text-muted); font-size: 13px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
  .filter-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .nav-inner { padding: 0 16px; }
  .main { padding: 20px 16px 48px; }
  .filter-row { grid-template-columns: 1fr; }
  .detail-fields { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
