/* ── L-A-R-A Rohstoffanalyse – Design System (Tagmodus) ─────────────────── */
/* Basis: Kelmaplast-Light-Style, erweitert für Analyse-Dashboard           */

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

body {
  background: #f4f4f4;
  color: #222;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: #007AFF; text-decoration: none; }
a:hover { color: #0062cc; }

/* ── Header ─────────────────────────────────────────────────────────────── */
header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0 28px;
  display: flex;
  align-items: center;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 2px 10px rgba(0,0,0,0.05);
  gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.logo { color: #FF2200; font-size: 17px; font-weight: 900; letter-spacing: 5px; flex-shrink: 0; }
.header-title { color: #666; font-size: 14px; white-space: nowrap; }
.header-title span { color: #007AFF; }

/* ── Navigation ─────────────────────────────────────────────────────────── */
nav { display: flex; align-items: center; gap: 2px; }
nav a {
  color: #666; padding: 7px 12px; border-radius: 7px;
  font-size: 13px; transition: all 0.15s; white-space: nowrap;
  min-height: 34px; display: inline-flex; align-items: center;
}
nav a:hover { color: #222; background: #f0f0f0; }
nav a.active { color: #007AFF; background: #e8f4ff; }

.nav-group { position: relative; display: inline-flex; align-items: center; }
.nav-group-label {
  color: #666; padding: 7px 12px; border-radius: 7px; font-size: 13px;
  cursor: default; transition: all 0.15s; white-space: nowrap;
  min-height: 34px; display: inline-flex; align-items: center;
}
.nav-group-label::after { content: ' ▾'; font-size: 9px; opacity: 0.5; }
.nav-group:hover .nav-group-label { color: #222; background: #f0f0f0; }

.nav-dropdown {
  visibility: hidden; opacity: 0; pointer-events: none;
  position: absolute; top: calc(100% + 4px); left: 0;
  background: #fff; border: 1px solid #d8d8d8; border-radius: 8px;
  min-width: 170px; z-index: 999; padding: 4px 0;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  transition: opacity 0.12s, visibility 0s 0.4s;
}
.nav-group:hover .nav-dropdown { visibility: visible; opacity: 1; pointer-events: auto; transition: opacity 0.12s; }
.nav-dropdown a { display: block; padding: 8px 16px; color: #444; font-size: 13px; white-space: nowrap; border-radius: 0; background: none; margin: 0; min-height: 0; }
.nav-dropdown a:hover { background: #f0f0f0; color: #111; }
.nav-dropdown a.active { background: #e0efff; color: #0066cc; border-left: 3px solid #0066cc; padding-left: 13px; font-weight: 600; }

.nav-right { display: flex; align-items: center; gap: 6px; margin-left: auto; padding-left: 12px; border-left: 1px solid #eee; }
.nav-user { font-size: 12px; color: #888; white-space: nowrap; }
.nav-icon-btn { color: #aaa; padding: 5px 8px; font-size: 13px; border-radius: 4px; transition: color 0.15s; }
.nav-icon-btn:hover { color: #333; }

/* ── Flash ───────────────────────────────────────────────────────────────── */
.flash-container { padding: 0 28px; padding-top: 12px; }
.flash { padding: 10px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 6px; }
.flash-success { background: #eeffee; border: 1px solid #00aa55; color: #006622; }
.flash-error   { background: #fff0ee; border: 1px solid #FF2200; color: #cc2200; }
.flash-info    { background: #e8f4ff; border: 1px solid #007AFF; color: #0055aa; }
.flash-warning { background: #fff8e1; border: 1px solid #ffc107; color: #664d03; }

/* ── Main ────────────────────────────────────────────────────────────────── */
main { padding: 20px 28px; max-width: 1700px; margin: 0 auto; }

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.page-header h1 { font-size: 20px; color: #111; font-weight: 700; }
.page-sub { color: #999; font-size: 12px; margin-top: 3px; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
.card h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 2px;
  color: #007AFF; margin-bottom: 14px; display: flex; align-items: baseline; gap: 8px;
}
.card h2 .sub { color: #aaa; font-weight: normal; text-transform: none; letter-spacing: 0; font-size: 12px; }

/* ── Inner Cards ─────────────────────────────────────────────────────────── */
.inner-card { background: #f8f8f8; border: 1px solid #ebebeb; border-radius: 6px; padding: 10px 12px; }
.inner-card-red { border-left: 3px solid #FF2200; }
.inner-card-yellow { border-left: 3px solid #ffcc44; }
.inner-title { font-size: 13px; font-weight: 700; color: #333; margin-top: 2px; }
.inner-label { font-size: 10px; color: #aaa; text-transform: uppercase; letter-spacing: 1px; }
.inner-sub { font-size: 11px; color: #999; }
.inner-val { font-size: 22px; font-weight: 700; color: #333; }
.inner-empty { font-size: 12px; color: #bbb; font-style: italic; padding: 8px 0; }

/* ── KPI Grid ────────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; gap: 12px; margin-bottom: 16px; align-items: center; }
.kpi-card { background: #fff; border: 1px solid #e4e4e4; border-radius: 10px; padding: 18px; text-align: center; box-shadow: 0 1px 8px rgba(0,0,0,0.05); }
.kpi-zahl { font-size: 38px; font-weight: 700; color: #222; line-height: 1; }
.kpi-label { color: #999; font-size: 11px; margin-top: 5px; text-transform: uppercase; letter-spacing: 1px; }
.kpi-rot   { border-top: 3px solid #FF2200; } .kpi-rot .kpi-zahl   { color: #FF2200; }
.kpi-blau  { border-top: 3px solid #007AFF; } .kpi-blau .kpi-zahl  { color: #007AFF; }
.kpi-gruen { border-top: 3px solid #00994d; } .kpi-gruen .kpi-zahl { color: #00994d; }
.kpi-divider { text-align: center; }
.kpi-divider-line { width: 1px; height: 40px; background: #e0e0e0; margin: 0 auto 8px; }
.kpi-divider-label { font-size: 10px; color: #aaa; text-transform: uppercase; letter-spacing: 1px; }
.kpi-divider-zahl { font-size: 24px; font-weight: 700; color: #444; margin-top: 4px; }

/* ── Ampel-Status ────────────────────────────────────────────────────────── */
.status-bar { display: flex; gap: 24px; flex-wrap: wrap; background: #fff; border: 1px solid #e4e4e4; border-radius: 8px; padding: 12px 20px; box-shadow: 0 1px 6px rgba(0,0,0,0.04); }
.status-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.status-label { color: #999; }
.status-val { color: #444; font-weight: 600; }
.status-ampel { display: flex; align-items: center; gap: 4px; }
.ampel-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ampel-gruen { background: #00994d; box-shadow: 0 0 4px #00994d66; }
.ampel-gelb  { background: #ffaa00; box-shadow: 0 0 4px #ffaa0066; }
.ampel-rot   { background: #FF2200; box-shadow: 0 0 4px #FF220066; }
.ampel-grau  { background: #ccc; }

/* ── Dashboard Grid ──────────────────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Tabellen ────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: #aaa; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; padding: 8px 12px; border-bottom: 1px solid #ebebeb; font-weight: 600; }
td { padding: 10px 12px; border-bottom: 1px solid #f4f4f4; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
td small { color: #aaa; font-size: 11px; }
.mini-table td { padding: 7px 10px; font-size: 13px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.prio-badge-a { background: #fff0ee; color: #cc2200; border: 1px solid #FF220055; }
.prio-badge-b { background: #fffbea; color: #cc8800; border: 1px solid #ffaa0055; }
.prio-badge-c { background: #eeffee; color: #007733; border: 1px solid #00aa5555; }
.hf-badge     { background: #e8f4ff; color: #007AFF; border: 1px solid #007AFF44; }

.tab-nav { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid #e8e8e8; }
.tab-link { padding: 8px 20px; font-size: 13px; font-weight: 600; text-decoration: none; color: #aaa; }
.tab-link.active-red  { color: #FF2200; border-bottom: 2px solid #FF2200; margin-bottom: -2px; }
.tab-link.active-blue { color: #007AFF; border-bottom: 2px solid #007AFF; margin-bottom: -2px; }

.status-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.status-badge.status-offen        { background: #f5f5f5; color: #888; border: 1px solid #ddd; }
.status-badge.status-in-bearbeitung { background: #e8f4ff; color: #007AFF; border: 1px solid #007AFF55; }
.status-badge.status-erledigt     { background: #eeffee; color: #007733; border: 1px solid #00aa5555; }
.status-badge.status-ausgewertet  { background: #e8f4ff; color: #007AFF; border: 1px solid #007AFF55; }
.status-badge.status-zugeordnet   { background: #eeffee; color: #007733; border: 1px solid #00aa5555; }
.status-badge.status-unklar       { background: #fff0ee; color: #cc2200; border: 1px solid #FF220055; }

.c-nr { font-family: 'SF Mono', Consolas, monospace; font-size: 12px; color: #555; background: #f4f4f4; padding: 2px 6px; border-radius: 4px; }
.c-nr.large { font-size: 15px; margin-right: 8px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background: #FF2200; color: #fff; border: none; cursor: pointer;
  font-weight: 700; letter-spacing: 0.5px; padding: 8px 16px;
  border-radius: 8px; font-size: 13px; transition: background 0.15s;
  display: inline-block; text-decoration: none; line-height: 1.4;
}
.btn-primary:hover { background: #cc1a00; color: #fff; }

.btn-secondary {
  background: transparent; color: #007AFF; border: 1px solid #007AFF;
  cursor: pointer; padding: 7px 14px; border-radius: 8px;
  font-size: 13px; transition: all 0.15s; display: inline-block;
  text-decoration: none; line-height: 1.4;
}
.btn-secondary:hover { background: #e8f4ff; }

.btn-delete-sm {
  background: transparent; border: 1px solid #ddd; color: #999; cursor: pointer;
  padding: 6px 12px; border-radius: 6px; font-size: 12px; transition: all 0.15s;
}
.btn-delete-sm:hover { border-color: #FF2200; color: #FF2200; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 11px; color: #888; margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%; background: #f8f8f8; border: 1px solid #ddd; color: #222;
  padding: 8px 10px; border-radius: 6px; font-size: 13px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: #007AFF; outline: none; background: #fff; }
textarea { resize: vertical; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #f0f0f0; }

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 12px; width: 100%; max-width: 480px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2); max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #ebebeb; font-weight: 700; font-size: 15px;
}
.modal-close {
  background: none; border: none; color: #aaa; cursor: pointer;
  font-size: 16px; padding: 4px 8px; border-radius: 4px; line-height: 1;
}
.modal-close:hover { color: #333; background: #f0f0f0; }
.modal-box form { padding: 20px; }

/* ── Progress / Bars ─────────────────────────────────────────────────────── */
.hf-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hf-name { font-size: 13px; color: #444; flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.hf-balken-wrap { flex: 1; background: #eeeeee; border-radius: 3px; height: 7px; overflow: hidden; }
.hf-balken { height: 100%; background: #007AFF; border-radius: 3px; transition: width 0.3s; min-width: 2px; }
.hf-zahlen { color: #999; font-size: 12px; width: 52px; text-align: right; flex-shrink: 0; }

/* ── Firma-Dot ───────────────────────────────────────────────────────────── */
.firma-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex-shrink: 0; vertical-align: middle; margin-right: 2px; }

/* ── E-Mail-Detail ───────────────────────────────────────────────────────── */
.email-meta { border: 1px solid #ebebeb; border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.email-meta-row { display: flex; align-items: flex-start; gap: 16px; padding: 8px 12px; border-bottom: 1px solid #f4f4f4; font-size: 13px; }
.email-meta-row:last-child { border-bottom: none; }
.email-meta-row .inner-label { width: 80px; flex-shrink: 0; margin-top: 1px; }
.email-body { font-size: 13px; color: #444; white-space: pre-wrap; background: #fafafa; border: 1px solid #ebebeb; border-radius: 6px; padding: 14px; line-height: 1.7; max-height: 320px; overflow-y: auto; }

/* ── Responsiv ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-divider { display: none; }
  main { padding: 14px 16px; }
  header { padding: 0 16px; }
  nav { display: none; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .header-actions { width: 100%; }
}

/* ── Nachtmodus-Vorbereitung (CSS-Variablen, noch nicht aktiv) ────────────
   Für spätere Aktivierung: body.dark { --bg: #0a0a0a; --card: #111; … }
   ─────────────────────────────────────────────────────────────────────── */
