/* Marketing Lama Kundenportal
   Farbrollen als Variablen, damit heller und dunkler Modus in einer
   Stelle umgeschaltet werden. Die Diagrammfarben stammen aus einer
   auf Farbfehlsichtigkeit geprueften Palette. */

:root {
  color-scheme: light;

  --surface-0:      #f4f3f0;   /* Seitenhintergrund */
  --surface-1:      #fcfcfb;   /* Karten, Diagrammflaeche */
  --surface-2:      #eeede9;   /* Tabellenkopf, ruhige Flaechen */
  --border:         #dcdbd5;
  --border-strong:  #c3c2b7;

  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #78776f;

  --series-1:       #2a78d6;   /* blau  – Umsatz */
  --series-2:       #eb6834;   /* orange – Bestellungen */
  --good:           #008300;
  --bad:            #e34948;

  --radius:         10px;
  --shadow:         0 1px 2px rgba(11, 11, 11, .06), 0 4px 16px rgba(11, 11, 11, .04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --surface-0:      #121211;
    --surface-1:      #1a1a19;
    --surface-2:      #232322;
    --border:         #333331;
    --border-strong:  #4a4a46;

    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #97968c;

    --series-1:       #3987e5;
    --series-2:       #d95926;
    --good:           #4caf50;
    --bad:            #e66767;

    --shadow:         0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0:      #121211;
  --surface-1:      #1a1a19;
  --surface-2:      #232322;
  --border:         #333331;
  --border-strong:  #4a4a46;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #97968c;
  --series-1:       #3987e5;
  --series-2:       #d95926;
  --good:           #4caf50;
  --bad:            #e66767;
  --shadow:         0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }

a { color: var(--series-1); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 2px;
}

/* ---------- Kopfzeile ---------- */

.topbar {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 62px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text-primary); font-weight: 650; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--text-primary); color: var(--surface-1);
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.brand-text { font-size: .98rem; }

.mainnav { display: flex; gap: 1.1rem; margin-left: auto; }
.mainnav a {
  text-decoration: none; color: var(--text-secondary);
  font-size: .92rem; padding: .35rem 0;
  border-bottom: 2px solid transparent;
}
.mainnav a:hover { color: var(--text-primary); }
.mainnav a.is-active { color: var(--text-primary); border-bottom-color: var(--series-1); }

.userbox { display: flex; align-items: center; gap: .9rem; font-size: .88rem; }
.user-name { color: var(--text-secondary); }
.logout { color: var(--text-muted); text-decoration: none; }
.logout:hover { color: var(--text-primary); text-decoration: underline; }

/* ---------- Seitenkopf ---------- */

.pagehead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  margin: 2.2rem 0 1.4rem;
}
.pagehead h1 { margin: 0; font-size: 1.55rem; letter-spacing: -.01em; }
.pagehead .sub { margin: .25rem 0 0; color: var(--text-secondary); font-size: .92rem; }

/* ---------- Filterzeile ---------- */

.filters {
  display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-bottom: 1.4rem;
}
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-size: .76rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select {
  font: inherit; font-size: .9rem;
  padding: .45rem .6rem;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-1);
  color: var(--text-primary);
  min-height: 38px;
}
.btn {
  font: inherit; font-size: .9rem; font-weight: 550;
  padding: .5rem 1rem; min-height: 38px;
  border-radius: 7px; border: 1px solid transparent;
  background: var(--series-1); color: #fff;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: .4rem;
}
.btn:hover { filter: brightness(1.07); }
.btn-quiet {
  background: var(--surface-1); color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-quiet:hover { background: var(--surface-2); filter: none; }
.quick { display: flex; gap: .4rem; flex-wrap: wrap; margin-left: auto; }
.quick a {
  font-size: .82rem; text-decoration: none;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px; padding: .3rem .7rem;
}
.quick a:hover, .quick a.is-active {
  color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-2);
}

/* ---------- Kennzahlen ---------- */

.stats {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 1.6rem;
}
.stat {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.stat-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value {
  font-size: 1.72rem; font-weight: 640; letter-spacing: -.02em;
  margin-top: .2rem; font-variant-numeric: tabular-nums;
}
.stat-change { font-size: .8rem; margin-top: .25rem; color: var(--text-muted); }
.stat-change.is-up   { color: var(--good); }
.stat-change.is-down { color: var(--bad); }

/* ---------- Diagramme ---------- */

.charts { display: grid; gap: 1.2rem; grid-template-columns: 1fr; margin-bottom: 1.8rem; }
@media (min-width: 900px) { .charts { grid-template-columns: 1fr 1fr; } }

.chart {
  margin: 0;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1rem;
  box-shadow: var(--shadow);
}
.chart-title { font-size: .82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .7rem; }
/* height:auto haelt das Seitenverhaeltnis der viewBox, sonst wird
   die Achsenschrift mitgestreckt. */
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-empty { color: var(--text-muted); font-size: .9rem; padding: 2rem 0; text-align: center; }

.chart-grid     { stroke: var(--border); stroke-width: 1; }
.chart-baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart-axis     { fill: var(--text-muted); font-size: 11px; font-family: inherit; }
.chart-peak     { fill: var(--text-secondary); font-size: 11px; font-weight: 600; font-family: inherit; }

.chart-primary   .chart-bar { fill: var(--series-1); }
.chart-secondary .chart-bar { fill: var(--series-2); }
.chart-bar { transition: opacity .12s ease; }
.chart-svg:hover .chart-bar { opacity: .55; }
.chart-svg .chart-bar:hover { opacity: 1; }

.chart-tip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: .4rem .6rem; font-size: .84rem; box-shadow: var(--shadow);
  white-space: nowrap;
}
.chart-tip b { font-variant-numeric: tabular-nums; }
.chart-tip .tip-label { color: var(--text-muted); display: block; font-size: .76rem; }

/* ---------- Tabelle ---------- */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.8rem;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.2rem; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; font-size: 1rem; }
.card-actions { display: flex; gap: .5rem; }

.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .89rem; }
table.data th, table.data td { padding: .62rem .8rem; text-align: left; white-space: nowrap; }
table.data thead th {
  background: var(--surface-2); color: var(--text-secondary);
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
table.data tbody tr { border-bottom: 1px solid var(--border); }
table.data tbody tr:last-child { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th.num { text-align: right; }
table.data td.title { white-space: normal; min-width: 220px; }
table.data a { text-decoration: none; font-weight: 550; }
table.data a:hover { text-decoration: underline; }

.empty { padding: 2.5rem 1.2rem; text-align: center; color: var(--text-muted); }

/* ---------- Anmeldung ---------- */

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem;
}
.login-card {
  width: min(410px, 100%);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 1.9rem;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 .25rem; font-size: 1.3rem; }
.login-card .sub { margin: 0 0 1.5rem; color: var(--text-secondary); font-size: .9rem; }
.login-card .field { margin-bottom: 1rem; }
.login-card .field input { width: 100%; }
.login-card .btn { width: 100%; justify-content: center; margin-top: .4rem; }
.login-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.4rem; }

.alert {
  border-radius: 8px; padding: .65rem .85rem; font-size: .88rem; margin-bottom: 1.1rem;
  border: 1px solid;
}
.alert-error   { background: rgba(227, 73, 72, .1);  border-color: var(--bad);  color: var(--text-primary); }
.alert-info    { background: rgba(42, 120, 214, .1); border-color: var(--series-1); color: var(--text-primary); }
.alert-success { background: rgba(0, 131, 0, .1);    border-color: var(--good); color: var(--text-primary); }

/* ---------- Detailseite ---------- */

.detail-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1.6rem; }
.back-link { display: inline-block; margin: 1.6rem 0 .4rem; font-size: .88rem; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* ---------- Fusszeile ---------- */

.pagefoot {
  border-top: 1px solid var(--border);
  margin-top: 3rem; padding: 1.4rem 0 2.4rem;
  font-size: .82rem; color: var(--text-secondary);
}
.pagefoot p { margin: .15rem 0; }
.muted { color: var(--text-muted); }

/* ---------- Druck / PDF ---------- */

@media print {
  :root { --surface-0: #fff; --surface-1: #fff; --surface-2: #f4f4f4; --border: #ccc; --text-primary: #000; }
  .topbar, .pagefoot, .filters, .card-actions, .back-link, .no-print { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .wrap { width: 100%; }
  .card, .stat, .chart { break-inside: avoid; box-shadow: none; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  table.data { font-size: 9pt; }
  a { color: #000; text-decoration: none; }
}
