/* Automatify Statistik-Dashboard – Brand-Look (Navy + Lila, Manrope) */

@font-face { font-family: "Manrope"; src: url("/fonts/Manrope-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/Manrope-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/Manrope-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/Manrope-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --navy: #001726;
  --navy-soft: #042235;
  --ink: #16171c;
  --muted: #52525b;
  --purple: #9333ea;
  --purple-light: #c084fc;
  --amber: #d97706;
  --lavender: #f5f1fb;
  --border: #eee9f5;
  --surface: #fcfcfb;
  --grid: #efeaf7;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.5;
}
h1, h2 { letter-spacing: -0.01em; }
button { font: inherit; cursor: pointer; }

/* ---------- Topbar ---------- */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner {
  max-width: 1200px; margin-inline: auto; padding: 0.8rem 1.5rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.topbar-logo { height: 34px; width: auto; }
.topbar-title { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 0.55rem; }
.domain-chip {
  font-size: 0.72rem; font-weight: 700; color: var(--purple-light);
  border: 1px solid rgba(192, 132, 252, 0.4); border-radius: 999px; padding: 0.1rem 0.55rem;
}
.spacer { flex: 1; }

.live-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.8rem; font-weight: 700; color: #d7f5e2;
  background: rgba(34, 197, 94, 0.14); border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 999px; padding: 0.25rem 0.75rem;
}
.live-dot { width: 8px; height: 8px; border-radius: 999px; background: #22c55e; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.range { display: inline-flex; background: rgba(255,255,255,0.08); border-radius: 10px; padding: 3px; }
.range button {
  border: 0; background: transparent; color: rgba(255,255,255,0.75);
  font-weight: 700; font-size: 0.83rem; padding: 0.4rem 0.85rem; border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.range button:hover { color: #fff; }
.range button.is-active { background: var(--purple); color: #fff; }

.logout {
  border: 1px solid rgba(255,255,255,0.25); background: transparent; color: rgba(255,255,255,0.85);
  font-weight: 700; font-size: 0.83rem; padding: 0.42rem 0.9rem; border-radius: 8px;
}
.logout:hover { border-color: rgba(255,255,255,0.6); color: #fff; }

.account-chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  border: 1px solid rgba(192, 132, 252, 0.45); border-radius: 8px;
  color: var(--purple-light); font-weight: 700; font-size: 0.83rem;
  padding: 0.42rem 0.9rem; text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.account-chip svg { width: 15px; height: 15px; }
.account-chip:hover { border-color: var(--purple-light); color: #fff; }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin-inline: auto; padding: 1.6rem 1.5rem 3rem; }
.section-title { margin: 2.2rem 0 1rem; font-size: 1.35rem; font-weight: 800; }
.h-sub { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-left: 0.4rem; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; margin-bottom: 0.9rem; }
.kpi {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: 0.15rem;
  box-shadow: 0 10px 30px -24px rgba(40, 10, 80, 0.35);
}
.kpi-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: 1.9rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 0.75rem; color: var(--muted); }
.kpi--accent { border-color: rgba(147, 51, 234, 0.35); background: linear-gradient(180deg, #faf8ff 0%, #f3ecfb 100%); }
.kpi--accent .kpi-value { color: var(--purple); }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
  padding: 1.1rem 1.25rem 1.25rem; margin-bottom: 0.9rem;
  box-shadow: 0 10px 30px -24px rgba(40, 10, 80, 0.35);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.7rem; }
.card-head h2 { font-size: 1rem; font-weight: 800; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; margin-bottom: 0.9rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.9rem; margin-bottom: 0.9rem; }
.grid-3 .card, .grid-2 .card { margin-bottom: 0; }

.chart { position: relative; height: 240px; }
.chart--tall { height: 300px; }

/* ---------- Tabellen ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left; font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border);
}
.table td { padding: 0.5rem; border-bottom: 1px solid #f4f1fa; word-break: break-all; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.num { font-weight: 700; }
.table .empty td { color: var(--muted); font-style: italic; }

/* ---------- Banner ---------- */
.banner-error {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: 12px; padding: 0.8rem 1rem; font-size: 0.9rem; margin-bottom: 0.9rem;
}
.banner-info {
  background: var(--lavender); border: 1px solid var(--border); color: var(--ink);
  border-radius: 12px; padding: 0.8rem 1rem; font-size: 0.9rem; margin-bottom: 0.9rem;
}

.foot { margin-top: 1.6rem; font-size: 0.78rem; color: var(--muted); text-align: center; }

/* ---------- Account-Seite ---------- */
.container--narrow { max-width: 640px; }

.profile { display: flex; flex-direction: column; }
.profile-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 0; border-bottom: 1px solid #f4f1fa;
}
.profile-row:last-child { border-bottom: 0; }
.profile-row dt { color: var(--muted); font-size: 0.88rem; }
.profile-row dd { font-weight: 700; font-size: 0.92rem; word-break: break-all; text-align: right; }

.field { margin-bottom: 0.9rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 0.35rem; }
.field .hint { font-weight: 500; color: var(--muted); }
.field input {
  width: 100%; border: 1px solid rgba(22, 23, 28, 0.15); border-radius: 10px;
  padding: 0.7rem 0.9rem; font: inherit;
}
.field input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.18); }

.btn-inline { width: auto; padding-inline: 1.6rem; }
.form-msg { margin-top: 0.8rem; font-size: 0.88rem; font-weight: 700; color: #b91c1c; }
.form-msg.is-ok { color: #15803d; }
.note { margin-top: 1.1rem; font-size: 0.8rem; color: var(--muted); }

body.loading #main { opacity: 0.45; pointer-events: none; transition: opacity 0.15s ease; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--navy); overflow: hidden; position: relative; padding: 1.5rem;
}
.login-glow { position: absolute; border-radius: 999px; filter: blur(120px); pointer-events: none; }
.login-glow--1 { width: 760px; height: 480px; background: rgba(147, 51, 234, 0.28); top: -18%; left: 50%; transform: translateX(-50%); }
.login-glow--2 { width: 620px; height: 400px; background: rgba(124, 58, 237, 0.16); bottom: -22%; left: -8%; }
.login-card {
  position: relative; width: 100%; max-width: 380px; background: #fff; border-radius: 20px;
  padding: 2.2rem 2rem; text-align: center; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.55);
}
.login-logo { height: 42px; width: auto; margin-bottom: 1.1rem; }
.login-card h1 { font-size: 1.45rem; font-weight: 800; }
.login-sub { color: var(--muted); font-size: 0.9rem; margin: 0.35rem 0 1.4rem; }
.login-card input {
  width: 100%; border: 1px solid rgba(22, 23, 28, 0.15); border-radius: 10px;
  padding: 0.75rem 0.9rem; font: inherit; margin-bottom: 0.9rem;
}
.login-card input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.18); }
.btn-primary {
  width: 100%; border: 0; border-radius: 10px; padding: 0.8rem 1rem; color: #fff; font-weight: 800;
  background-image: linear-gradient(270deg, #9333ea 0%, #c084fc 54%, #9333ea 100%);
  background-size: 200% 100%; background-position: 0% 50%;
  transition: background-position 0.4s ease, transform 0.15s ease;
  box-shadow: 0 12px 28px -10px rgba(147, 51, 234, 0.65);
}
.btn-primary:hover { background-position: 100% 50%; transform: translateY(-1px); }
#login-error { color: #b91c1c; font-size: 0.85rem; margin-top: 0.7rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-inner { gap: 0.6rem; }
  .topbar-title { display: none; }
}
