/* ═══════════════════════════════════════════════════
   CORTEX · Zentrales Design-System
   Bauereiß GmbH · Ambiente-Manufaktur
   Ablöst design-system.css — Manrope, Dark, Red Accent
═══════════════════════════════════════════════════ */

/* ── FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

/* ── TOKENS ── */
:root {
  --bg:             #0a0a0b;
  --surface:        #17171a;
  --surface-2:      #101013;
  --surface-hover:  #1c1c20;
  --border:         rgba(255,255,255,0.14);
  --border-input:   rgba(255,255,255,0.2);
  --accent:         #E82127;
  --accent-bg:      rgba(232,33,39,0.14);
  --accent-border:  rgba(232,33,39,0.4);
  --text:           #f5f5f7;
  --text-secondary: #c7c7cc;
  --text-muted:     #86868b;
  --text-dim:       #5b5b60;
  --green:          #30d158;
  --blue:           #5e9eff;
  --amber:          #f0b429;
  --teal:           #2dd4bf;
  --radius-card:    16px;
  --radius-btn:     12px;
  --radius-sm:      8px;
}

/* ── Compat aliases — migrated from design-system.css ── */
/* These aliases let tools that still use old token names render correctly
   while their CSS is migrated to the new CORTEX names over time. */
:root {
  --text-primary:   var(--text);
  --text-tertiary:  var(--text-dim);
  --font:           'Manrope', system-ui, sans-serif;
  --surface2:       var(--surface-hover);
  --surface3:       #2c2c30;
  --border-soft:    rgba(255,255,255,0.05);
  --shadow-sm:      0 2px 10px rgba(0,0,0,.4);
  --shadow:         0 8px 30px rgba(0,0,0,.5);
  --shadow-lg:      0 20px 60px rgba(0,0,0,.6);
  --radius:         22px;
  --radius-lg:      28px;
  --blue-bg:        rgba(94,158,255,0.14);
  --blue-line:      rgba(94,158,255,0.35);
  --green-bg:       rgba(48,209,88,0.14);
  --green-line:     rgba(48,209,88,0.35);
  --amber-bg:       rgba(240,180,41,0.14);
  --amber-line:     rgba(240,180,41,0.35);
  --rose:           #ff6b6b;
  --rose-bg:        rgba(255,69,58,0.14);
  --rose-line:      rgba(255,69,58,0.35);
  --violet:         #b37bff;
  --violet-bg:      rgba(179,123,255,0.16);
  --violet-line:    rgba(179,123,255,0.4);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  min-height: 100vh;
}
input, textarea, button, select { font-family: inherit; }
a { color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a2e; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── TOPBAR ── */
.topbar {
  height: 64px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-logo { height: 32px; display: block; }
.topbar-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.topbar-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.topbar-brandwrap { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-spacer { flex: 1; }
.topbar-user { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.back-link {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 600;
  background: var(--surface); padding: 8px 16px 8px 12px; border-radius: 999px;
}
.back-link:hover { color: var(--text); }

/* ── LAYOUT ── */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}
.page-h1 {
  font-size: 28px; font-weight: 800;
  margin: 0 0 4px; letter-spacing: -0.6px;
}
.page-sub { margin: 0 0 22px; color: var(--text-muted); font-size: 14px; }
.loading, .empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-dim); font-size: 14px;
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 14px; font-weight: 800; margin-bottom: 12px;
}

/* ── KPI ── */
.kpi-row { display: flex; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.kpi-card {
  flex: 1; min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 22px;
}
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.kpi-value { font-size: 34px; font-weight: 800; margin-top: 4px; letter-spacing: -1px; }

/* ── BUTTONS ── */
.btn {
  border: none;
  font-size: 14.5px; font-weight: 800;
  height: 52px; border-radius: var(--radius-btn);
  cursor: pointer; padding: 0 22px;
}
.btn-primary { background: var(--green); color: #04210d; }
.btn-primary:disabled { background: var(--surface); color: var(--text-dim); cursor: default; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:disabled { background: var(--surface); color: var(--text-dim); cursor: default; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-input);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--surface-hover); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── BADGE ── */
.badge {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}

/* ── CHIPS ── */
.chip-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.chip {
  height: 38px; padding: 0 18px; border-radius: 12px;
  font-size: 13.5px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border-input);
  background: var(--surface); color: var(--text-secondary);
}
.chip.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: #ff5b5f;
}
.chip--coming-soon {
  font-size: 9px; font-weight: 800;
  padding: 2px 7px; border-radius: 6px;
  background: var(--surface-hover);
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.4px;
}

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 1000;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: 18px; padding: 26px 28px;
  max-width: 460px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 18px; }
.modal-field { margin-bottom: 16px; }
.modal-label { font-size: 12px; color: var(--text-muted); font-weight: 700; margin-bottom: 7px; display: block; }
.modal-input {
  width: 100%;
  background: #0f0f11;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; height: 44px;
  padding: 0 14px; color: var(--text); font-size: 14px; outline: none;
}
.modal-input:focus { border-color: var(--accent-border); }
textarea.modal-input { height: auto; padding: 10px 14px; resize: vertical; min-height: 60px; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ── LEGACY HEADER (Tools mit altem Header-Markup) ── */
header {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface-2);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid var(--border);
  padding: 0 22px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 10px; height: 64px; width: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.header-left, .brand { display: flex; align-items: center; gap: 16px; }
.header-title, .header-center {
  font-size: 18px; font-weight: 800; letter-spacing: -.3px;
  display: flex; align-items: center; gap: 12px; color: var(--text);
}
.header-title h1 { font-size: inherit; font-weight: inherit; margin: 0; }
.header-right { display: flex; align-items: center; gap: 10px; }
.header-back {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 600;
  background: var(--surface-hover); padding: 8px 16px 8px 12px; border-radius: 999px;
  transition: color 0.15s;
}
.header-back:hover { color: var(--text); }
.brand-logo {
  width: 32px; height: 32px;
  background: var(--accent-bg); border: 1px solid var(--accent-border);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px; color: var(--accent);
}

/* ── LEGACY LAYOUT (Kategorie-Seiten) ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  padding: 24px 0 0; font-size: 13px; color: var(--text-muted);
}
.breadcrumb a { color: var(--text-secondary); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { color: var(--text); }
.page-head { padding: 16px 0 32px; display: flex; align-items: center; gap: 16px; }
.page-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: var(--surface); border: 1px solid var(--border);
}
.page-title { font-size: 28px; font-weight: 900; letter-spacing: -1px; margin: 0; }
.page-desc { font-size: 13.5px; color: var(--text-muted); margin-top: 4px; }
.section { padding: 40px 0; }
.g3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media (max-width: 900px) { .g3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px) { .g3 { grid-template-columns: 1fr; } }

/* ── INFO-BOX ── */
.info-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 14px 18px;
  margin-bottom: 22px; font-size: 13px; line-height: 1.6;
}
.info-blue  { border-color: var(--blue-line);  background: var(--blue-bg); }
.info-amber { border-color: var(--amber-line); background: var(--amber-bg); }
.info-green { border-color: var(--green-line); background: var(--green-bg); }

/* ── STARTSEITE: SEKTIONEN + KACHELN ── */
.cortex-section { margin-bottom: 48px; }
.cortex-section-title {
  font-size: 12px; font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 16px;
}
.cortex-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.cortex-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 10px;
  transition: background 0.15s, border-color 0.15s;
  min-height: 130px;
}
.cortex-card:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.14); }
.cortex-card--disabled {
  opacity: 0.38;
  pointer-events: none;
  cursor: default;
}
.cortex-card-icon { font-size: 24px; line-height: 1; }
.cortex-card-name { font-size: 15px; font-weight: 800; letter-spacing: -0.2px; }
.cortex-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; flex: 1; }
.cortex-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto;
}
.cortex-card--flagship {
  border-color: var(--accent-border);
  background: rgba(232,33,39,0.05);
}
.cortex-card--flagship:hover { background: rgba(232,33,39,0.1); }

/* ── BTN-SECONDARY (alias für ghost-ähnlichen Stil) ── */
.btn-secondary {
  background: var(--surface-hover);
  border: 1px solid var(--border-input);
  color: var(--text-secondary);
}
.btn-secondary:hover { background: var(--surface); }

/* ── TABS (Tab-Navigation + Panels) ── */
.tab-nav {
  display: flex;
  align-items: stretch;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  position: sticky; top: 64px; z-index: 90;
}
.tab-nav-label {
  display: flex; align-items: center; gap: 6px;
  padding: 0 18px;
  font-size: 11px; font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.tab-nav-label-icon { font-size: 11px; }
.tab-btn {
  padding: 0 18px; height: 48px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border: none; background: transparent;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── PASSWORD MODAL ── */
.pw-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 2000;
  align-items: center; justify-content: center;
}
.pw-overlay.open, .pw-overlay.show { display: flex; }
.pw-box {
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: 18px; padding: 36px 40px;
  max-width: 380px; width: 90%;
  text-align: center;
}
.pw-box h2 { font-size: 20px; font-weight: 800; margin: 0 0 8px; }
.pw-box p { font-size: 13px; color: var(--text-muted); margin: 0 0 20px; line-height: 1.6; }
.pw-icon { font-size: 40px; margin-bottom: 16px; display: block; }
.pw-input {
  width: 100%; background: var(--surface-2);
  border: 1px solid var(--border-input);
  border-radius: 10px; height: 46px;
  padding: 0 16px; color: var(--text); font-size: 15px; outline: none;
  margin-bottom: 8px;
}
.pw-input:focus { border-color: var(--accent-border); }
.pw-error { color: var(--accent); font-size: 12px; min-height: 18px; margin-bottom: 12px; }
.pw-btn {
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-btn);
  height: 46px; padding: 0 28px;
  font-size: 14px; font-weight: 800; cursor: pointer;
  width: 100%; margin-bottom: 10px;
}
.pw-cancel {
  background: transparent; border: none;
  color: var(--text-muted); font-size: 13px; cursor: pointer;
  font-weight: 600;
}
.pw-cancel:hover { color: var(--text); }

/* ── KPI EXTRAS ── */
.kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.c-blue { color: var(--blue); }
.c-green { color: var(--green); }

/* ── CHARTS ── */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px; margin-bottom: 20px;
}
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 20px 24px;
  margin-bottom: 20px;
}
.chart-card h3 { font-size: 14px; font-weight: 800; margin: 0 0 8px; }
.chart-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.6; }
.chart-container { height: 260px; position: relative; }

/* ── SLIDERS / SENSITIVITY ── */
.slider-row {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
}
.slider-label { font-size: 12px; color: var(--text-muted); width: 220px; flex-shrink: 0; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--accent); cursor: pointer; }
.slider-val { font-size: 13px; font-weight: 700; color: var(--accent); width: 60px; text-align: right; }
.sens-result {
  background: var(--surface-hover); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: 13px; color: var(--text-muted); margin-top: 14px;
  min-height: 40px;
}

/* ── TABLE CARD ── */
.table-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 20px 24px;
  margin-bottom: 20px; overflow: hidden;
}
.table-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.table-head h3 { font-size: 14px; font-weight: 800; margin: 0 0 4px; }
.table-desc { font-size: 12px; color: var(--text-muted); }
.table-wrap { overflow-x: auto; }

/* ── FORM PARAMS ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px; margin-bottom: 20px;
}
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.form-group {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 20px;
}
.form-group h4 { font-size: 12px; font-weight: 800; margin: 0 0 16px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.form-row:last-child { margin-bottom: 0; }
.form-label { font-size: 12px; color: var(--text-secondary); flex: 1; }
.form-input {
  width: 120px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border-input);
  border-radius: var(--radius-sm); height: 36px;
  padding: 0 10px; color: var(--text); font-size: 13px; font-weight: 600;
  text-align: right; outline: none;
}
.form-input:focus { border-color: var(--accent-border); }
.form-input:disabled { color: var(--text-dim); cursor: default; }
.calc-display {
  font-size: 14px; font-weight: 800; color: var(--blue);
}

/* ── PRICE LIST TABLE ── */
.pl-table { width: 100%; border-collapse: collapse; }
.pl-table th {
  background: var(--surface-hover);
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 9px 14px; text-align: right; border-bottom: 1px solid var(--border);
}
.pl-table th:first-child { text-align: left; }
.pl-table td { padding: 9px 14px; text-align: right; border-bottom: 1px solid var(--border); font-size: 12px; }
.pl-table td:first-child { text-align: left; font-weight: 600; color: var(--text); }
.pl-table tr:last-child td { border-bottom: none; }
.pl-table tr:hover td { background: var(--surface-hover); }

/* ── FOOTER ── */
.cortex-footer {
  text-align: center; padding: 24px;
  font-size: 11px; color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .cortex-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .content { padding: 20px 16px 60px; }
  .cortex-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .cortex-grid { grid-template-columns: 1fr; }
}
