/* Optik angelehnt an das Rechnungsstudio (rechnung.agile-unternehmen.de) */
:root {
  --ink: #121418;
  --muted: #62666f;
  --paper: #ffffff;
  --canvas: #f2f3f5;
  --line: #dedfe4;
  --cyan: #14b9bf;
  --purple: #a317bf;
  --purple-dark: #75128d;
  --success: #127a63;
  --danger: #a3293d;
  --shadow: 0 24px 60px rgba(28, 30, 39, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }

/* ------------------------------------------------------------ Login */
.login-page { min-height: 100vh; background: radial-gradient(circle at 15% 10%, rgba(20, 185, 191, .13), transparent 32%), radial-gradient(circle at 90% 85%, rgba(163, 23, 191, .12), transparent 34%), var(--canvas); }
.login-shell { min-height: 100vh; padding: 32px 18px; display: grid; place-items: center; }
.login-card { width: min(440px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.login-card img { display: block; width: 255px; max-width: 100%; margin: 0 0 36px; }
.login-card h1 { margin: 0 0 14px; font-size: 36px; line-height: 1.05; letter-spacing: -.04em; }
.login-card > p:not(.eyebrow) { margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.login-card .primary-button { width: 100%; }
.alert { margin: 0 0 20px; padding: 12px 14px; border-radius: 10px; background: #fbeef0; color: var(--danger); font-size: 13px; font-weight: 650; }
@media (max-width: 420px) { .login-card { padding: 28px 22px; } }

/* ------------------------------------------------------------ Topbar */
.topbar {
  min-height: 84px;
  padding: 18px clamp(16px, 5vw, 76px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 18px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 750; letter-spacing: .02em; min-width: 0; }
.brand img { width: 215px; max-width: 42vw; height: auto; display: block; }
.brand-divider { width: 1px; height: 30px; background: var(--line); flex: 0 0 auto; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 12px; font-weight: 650; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(18, 122, 99, .1); }
.logout-link { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 750; }
.logout-link:hover { color: var(--purple-dark); }

/* ------------------------------------------------------------ Seite */
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 140px; }
.intro { display: grid; grid-template-columns: 1.2fr .8fr; gap: 64px; align-items: end; margin-bottom: 38px; }
.eyebrow { margin: 0 0 10px; color: var(--purple-dark); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.intro h1 { margin: 0; font-size: clamp(40px, 6vw, 72px); line-height: .98; letter-spacing: -.055em; }
.intro h1 span { color: transparent; background: linear-gradient(90deg, var(--cyan), var(--purple)); background-clip: text; -webkit-background-clip: text; }
.intro-copy { max-width: 460px; margin: 0 0 8px auto; color: var(--muted); font-size: 16px; line-height: 1.65; }

.card { padding: clamp(22px, 3.5vw, 40px); border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); margin-top: 22px; }
.card-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.card-heading .eyebrow { margin-bottom: 6px; }
.card-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.zwei > .card { margin-top: 0; }

.reihe { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 750; letter-spacing: .015em; }
.field > span b { color: var(--purple); font-weight: 750; }
.hinweis { margin: -4px 0 14px; color: #888c94; font-size: 11.5px; line-height: 1.45; }

input, textarea, select {
  width: 100%;
  border: 1px solid #d5d7dc; border-radius: 10px;
  color: var(--ink); background: #fafafa; outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input, select { min-height: 46px; padding: 0 13px; }
select { appearance: none; cursor: pointer; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; min-height: 76px; padding: 12px 13px; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--purple); background-color: #fff; box-shadow: 0 0 0 4px rgba(163, 23, 191, .09); }
input::placeholder, textarea::placeholder { color: #a1a4ab; }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--purple); margin: 0; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); margin-top: 4px; }

details { margin: 4px 0 14px; }
summary { cursor: pointer; color: var(--purple-dark); font-size: 13px; font-weight: 700; }
details[open] summary { margin-bottom: 14px; }

.primary-button, .secondary-button { min-height: 50px; border-radius: 11px; cursor: pointer; font-weight: 750; transition: transform .15s, box-shadow .15s; }
.primary-button { border: 0; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: white; background: linear-gradient(100deg, #12b9bf, #a116bf); box-shadow: 0 12px 28px rgba(115, 21, 154, .2); }
.secondary-button { border: 1px solid #d3d4d9; padding: 0 16px; background: #fff; color: #4e5158; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:hover { box-shadow: 0 16px 34px rgba(115, 21, 154, .27); }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.klein-btn { border: 1px solid #d3d4d9; border-radius: 9px; padding: 7px 12px; background: #fff; color: #4e5158; font-size: 12px; font-weight: 750; cursor: pointer; white-space: nowrap; }
.klein-btn:hover { color: var(--purple-dark); border-color: #d9b6e0; background: #fbf6fc; }

/* ------------------------------------------------------------ Positionen */
.pos { display: grid; grid-template-columns: 30px 2.4fr .8fr 1fr 1.1fr .8fr 1fr 30px; gap: 12px; align-items: start; padding: 16px 0; border-top: 1px solid #ececef; }
.pos:first-child { border-top: 0; padding-top: 0; }
.pos .nr { padding-top: 33px; color: var(--purple-dark); font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.pos .summe { padding-top: 33px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos .weg { margin-top: 28px; background: none; border: 0; color: #a1a4ab; font-size: 22px; cursor: pointer; line-height: 1; }
.pos .weg:hover { color: var(--danger); }
.pos .besch { grid-column: 2 / 8; }
.pos .besch input { min-height: 40px; font-size: 13.5px; }
.summen { margin: 10px 0 0 auto; width: min(360px, 100%); font-variant-numeric: tabular-nums; font-size: 14px; }
.summen div { display: flex; justify-content: space-between; padding: 5px 0; color: var(--muted); }
.summen .gesamt { border-top: 1px solid var(--ink); margin-top: 6px; padding-top: 10px; font-weight: 800; font-size: 20px; color: var(--ink); letter-spacing: -.02em; }

.accent-card { background: linear-gradient(145deg, #15171c, #22122a); color: #e9e9ee; border-color: #22242a; }
.accent-card .eyebrow { color: #54dce0; }
.accent-card h2 { color: #fff; }
.accent-card p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: #c9cad2; }
.accent-card b { color: #fff; }

/* ------------------------------------------------------------ Aktionsleiste */
.leiste { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: rgba(255, 255, 255, .92); backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.leiste-innen { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 14px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.meldung { flex: 1 1 280px; font-size: 13px; font-weight: 650; min-height: 20px; color: var(--muted); }
.meldung.err { color: var(--danger); }
.meldung.ok { color: var(--success); }

@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; gap: 16px; }
  .intro-copy { margin: 0; }
  .zwei { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr 1fr; }
  .pos .nr { grid-column: 1 / 3; padding-top: 0; }
  .pos .bez, .pos .besch { grid-column: 1 / 3; }
  .pos .summe { padding-top: 0; text-align: left; }
  .pos .weg { margin-top: 0; justify-self: end; }
}
@media (max-width: 560px) {
  .brand-divider, .brand-label, .status-pill { display: none; }
  .leiste-innen .primary-button, .leiste-innen .secondary-button { flex: 1 1 auto; }
}

.login-card .field { margin-bottom: 18px; }
.login-card form .field:last-of-type { margin-bottom: 24px; }

.test-schalter { display: inline-flex; align-items: center; gap: 9px; padding: 8px 13px; border: 1px dashed #d9b6e0; border-radius: 999px; background: #fbf6fc; color: var(--purple-dark); font-size: 12px; font-weight: 750; cursor: pointer; white-space: nowrap; }
.test-schalter:has(input:checked) { border-style: solid; border-color: var(--purple); background: #f6ebf8; }

/* ------------------------------------------------------------ Protokoll */
.topbar-nav { display: flex; align-items: center; gap: 2px; }
.topbar-link { padding: 10px 14px; border-radius: 9px; color: var(--muted); font-size: 12px; font-weight: 750; text-decoration: none; transition: color .18s, background .18s; }
.topbar-link:hover, .topbar-link.is-active { color: var(--purple-dark); background: #f6ebf8; }
.intro-copy p { margin: 0 0 8px; }
.intro-copy .vorher { font-size: 13px; color: #888c94; }
.kennzahlen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kennzahl { display: grid; gap: 6px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.kennzahl span { font-size: 12px; font-weight: 750; color: var(--muted); }
.kennzahl b { font-size: 32px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kennzahl.warn { border-color: #e7b8c0; background: #fdf4f5; }
.kennzahl.warn b { color: var(--danger); }
table.mini { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.mini td { padding: 9px 6px; border-top: 1px solid #ececef; }
table.mini tr:first-child td { border-top: 0; }
table.mini a, table.protokoll a, .treffer a { color: var(--purple-dark); text-decoration: none; }
table.mini a:hover, table.protokoll a:hover, .treffer a:hover { text-decoration: underline; }
.leer { color: var(--muted); font-size: 13.5px; }
.filter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto; gap: 12px; align-items: end; }
.filter .klein-btn { min-height: 46px; display: inline-flex; align-items: center; text-decoration: none; }
.treffer { margin: 18px 0 10px; color: var(--muted); font-size: 13px; font-weight: 650; }
.tabelle-wrap { overflow-x: auto; border: 1px solid #e0e1e5; border-radius: 14px; }
table.protokoll { width: 100%; min-width: 960px; border-collapse: collapse; font-size: 13px; }
table.protokoll th { text-align: left; padding: 12px 14px; background: #f7f7f9; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid #e0e1e5; }
table.protokoll td { padding: 11px 14px; border-top: 1px solid #ececef; vertical-align: top; }
table.protokoll tr.warn td { background: #fdf6f7; }
table.protokoll small { color: var(--muted); }
.nowrap { white-space: nowrap; }
.details span { display: block; line-height: 1.5; }
.details i { font-style: normal; color: var(--muted); }
.agent { color: #888c94; font-size: 11.5px; max-width: 220px; }
.badge { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 750; white-space: nowrap; background: #f1f1f3; color: #4e5158; }
.badge.login_ok { background: #e6f4ef; color: var(--success); }
.badge.rechnung { background: #f6ebf8; color: var(--purple-dark); }
.badge.login_fehler, .badge.login_gesperrt, .badge.csrf_fehler, .badge.ohne_login { background: #fbe7ea; color: var(--danger); }
.seiten { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; font-size: 13px; color: var(--muted); }
@media (max-width: 900px) {
  .kennzahlen { grid-template-columns: 1fr 1fr; }
  .filter { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .topbar-nav .topbar-link { padding: 8px 6px; font-size: 11px; }
}
