/* BuchÜbung – Eigenes Design, angelehnt an professionelle Buchhaltungs-UIs */
/* Farben, Namen und Code sind vollständig eigenentwickelt */

:root {
  --primary:       #1a5fad;
  --primary-dark:  #134a87;
  --primary-light: #e8f0fb;
  --accent:        #e07b00;
  --bg:            #f5f6f8;
  --surface:       #ffffff;
  --border:        #d8dde6;
  --text:          #1c2333;
  --text-muted:    #6b7590;
  --sidebar-bg:    #1c2741;
  --sidebar-text:  #b8c3d9;
  --sidebar-hover: #253354;
  --sidebar-active:#2e4070;
  --sidebar-accent:#4a9eff;
  --success:       #1e8a47;
  --warning:       #c17a00;
  --danger:        #c0392b;
  --topbar-h:      48px;
  --sidebar-w:     220px;
  --radius:        6px;
  --shadow:        0 1px 4px rgba(0,0,0,0.10);
}

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}

.sidebar-logo-text span {
  color: var(--sidebar-accent);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 16px 4px;
}

.sidebar-nav {
  list-style: none;
  padding: 4px 0;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0;
  font-size: 13px;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav li a.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--sidebar-accent);
}

.sidebar-nav li a .nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav li a .nav-badge {
  margin-left: auto;
  font-size: 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-footer strong {
  display: block;
  color: var(--sidebar-text);
  font-size: 12px;
  margin-bottom: 2px;
}

/* ── Hauptbereich ─────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Topbar ───────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

#topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

#topbar-title .breadcrumb {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 13px;
}

#topbar-title .breadcrumb::after {
  content: ' / ';
  padding: 0 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-mandant {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-mandant strong {
  color: var(--text);
}

/* ── Content ──────────────────────────────────────────── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Karten / Panels ──────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.card-header h2 {
  font-size: 13.5px;
  font-weight: 600;
  flex: 1;
}

.card-body {
  padding: 16px;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Tabellen ─────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eef0f4;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: var(--primary-light); }

.data-table .tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.tag-vst  { background: #e3f4ea; color: #1e8a47; }
.tag-ust  { background: #fff0e0; color: #c17a00; }
.tag-netto{ background: #e8f0fb; color: #1a5fad; }

/* ── Formulare ────────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.12s;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,95,173,0.12);
}

.form-control.w-60  { width: 60px; }
.form-control.w-80  { width: 80px; }
.form-control.w-120 { width: 120px; }
.form-control.w-160 { width: 160px; }
.form-control.w-200 { width: 200px; }
.form-control.w-full { width: 100%; }

/* ── Dashboard-Kacheln ────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-card .stat-value.positive { color: var(--success); }
.stat-card .stat-value.negative { color: var(--danger); }

.stat-card .stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Leerseite ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  max-width: 320px;
  margin: 0 auto 16px;
}

/* ── Toast-Nachrichten ────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  animation: slideIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}

.toast.success { background: var(--success); }
.toast.warning { background: var(--warning); }
.toast.danger  { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Hilfselemente ────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.font-mono   { font-family: 'JetBrains Mono', 'Fira Mono', monospace; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.fw-600 { font-weight: 600; }

/* ── Scrollbalken ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #b0b8c9; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  #sidebar { display: none; }
  #content { padding: 12px; }
}

/* ── Zusätzliche Styles v2 ─────────────────────────────────────────────────── */

/* Rechnungs-Druckansicht */
.rechnung-print {
  max-width: 794px;
  margin: 0 auto;
  background: #fff;
  padding: 40px;
  font-size: 13px;
}

.rechnung-print .rech-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.rechnung-print .rech-absender {
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.rechnung-print .rech-pos-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13px;
}

.rechnung-print .rech-pos-table th {
  background: var(--bg);
  padding: 7px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.rechnung-print .rech-pos-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef0f4;
  vertical-align: top;
}

.rechnung-print .rech-summen {
  width: 280px;
  margin-left: auto;
  margin-top: 16px;
}

.rechnung-print .rech-summen table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rechnung-print .rech-summen td {
  padding: 5px 8px;
}

.rechnung-print .rech-summen .gesamt {
  font-weight: 700;
  font-size: 14px;
  border-top: 2px solid var(--primary);
  color: var(--primary);
}

/* Status-Badges */
.status-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.status-offen    { background: #fff0e0; color: #c17a00; }
.status-bezahlt  { background: #e3f4ea; color: #1e8a47; }
.status-ueberfaellig { background: #fde8e8; color: #c0392b; }
.status-entwurf  { background: #f5f6f8; color: #6b7590; }
.status-storno   { background: #f0e8ff; color: #7b2d8b; }
.status-mahnung  { background: #fde8e8; color: #c0392b; }

/* Kassenbuch */
.kb-saldo-positiv { color: var(--success); font-weight: 700; }
.kb-saldo-negativ { color: var(--danger);  font-weight: 700; }

/* Anlagenspiegel */
.anlage-row-summe {
  background: var(--bg);
  font-weight: 700;
  border-top: 2px solid var(--border);
}

/* BWA */
.bwa-gruppe {
  background: var(--primary-light);
  font-weight: 700;
  font-size: 12.5px;
}

.bwa-summe {
  background: var(--bg);
  font-weight: 700;
  border-top: 2px solid var(--primary);
}

/* Mandanten-Switcher */
.mandant-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  border: none;
  transition: background 0.12s;
}

.mandant-chip:hover { background: var(--primary-dark); }

/* Wiederkehrende Buchungen */
.wbuchung-inaktiv { opacity: 0.5; }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

@media print {
  #sidebar, #topbar, .no-print, .btn, .tab-bar { display: none !important; }
  #main { overflow: visible !important; }
  #content { overflow: visible !important; padding: 0 !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}
