:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8eef7;
  --muted: #9aa8bc;
  --accent: #3d8bfd;
  --accent2: #6c5ce7;
  --danger: #ff6b6b;
  --ok: #2ed573;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  /* Keine externen Webfonts — nur System- und Fallback-Schriften */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(61, 139, 253, 0.18), transparent),
    radial-gradient(900px 500px at 100% 0%, rgba(108, 92, 231, 0.15), transparent), var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(26, 35, 50, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.15rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.nav a,
.nav button {
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}

.btn:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  border-color: rgba(255, 107, 107, 0.35);
  color: #ffc9c9;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 1.25rem;
}

h1 {
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.flash.ok {
  background: rgba(46, 213, 115, 0.12);
  color: #c8ffd4;
}

.flash.err {
  background: rgba(255, 107, 107, 0.12);
  color: #ffd6d6;
}

label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #121a26;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.75rem;
}

table.kb {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 640px;
}

table.kb th,
table.kb td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.45rem;
  text-align: left;
  vertical-align: top;
}

table.kb th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-income {
  color: #b8f5c6;
}

.row-expense {
  color: #ffc9c9;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.pill strong {
  display: block;
  font-size: 1.05rem;
}

.login-page {
  display: flex;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: min(420px, 100%);
}

.login-legal {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: left;
  font-size: 0.875rem;
}

.login-legal a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-legal-sep {
  margin: 0 0.5rem;
  color: var(--muted);
  user-select: none;
}

details.audit {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.15);
}

details.audit + details.audit {
  margin-top: 0.5rem;
}

details.audit summary {
  cursor: pointer;
  font-weight: 600;
}

.small {
  font-size: 0.8rem;
}

/* Grafischer Buchungskalender */
.kb-cal-wrap {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.kb-cal {
  max-width: 100%;
  width: min(360px, 100%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem 0.85rem;
}

.kb-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.kb-cal-title {
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  flex: 1;
}

.kb-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
  font-size: 0.78rem;
}

.kb-cal-dow {
  color: var(--muted);
  font-weight: 600;
  padding: 0.2rem 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kb-cal-cell {
  aspect-ratio: 1;
  max-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: default;
  font-variant-numeric: tabular-nums;
}

.kb-cal button.kb-cal-cell {
  font: inherit;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}

.kb-cal-cell.out {
  opacity: 0.28;
}

.kb-cal-cell.has-booking {
  font-weight: 700;
  color: var(--text);
  border-color: rgba(61, 139, 253, 0.35);
  background: rgba(61, 139, 253, 0.12);
}

.kb-cal-cell.selected {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}

.kb-cal-cell.pickable {
  cursor: pointer;
}

.kb-cal-cell.pickable:hover:not(.selected) {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.2);
}

@media print {
  body {
    background: #fff;
    color: #111;
  }
  .no-print,
  .topbar .nav,
  .btn,
  form.inline {
    display: none !important;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  a {
    color: #000;
    text-decoration: none;
  }
}
