/* ========================================
   BuchÜbung – Hauptstylesheet
   Angelehnt an Lexware Office (grün/weiß)
   ======================================== */

:root {
  --green-primary: #00a896;
  --green-dark: #007a6e;
  --green-light: #e6f7f5;
  --green-hover: #009688;
  --red-accent: #e8445a;
  --text-primary: #2c2c2c;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --bg-page: #f5f6f8;
  --bg-card: #ffffff;
  --bg-sidebar: #1f2937;
  --sidebar-text: #d1d5db;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: #374151;
  --sidebar-active: #00a896;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.10);
  --radius: 6px;
  --radius-lg: 10px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --sidebar-width: 240px;
  --header-height: 56px;
}

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

body {
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
  display: flex;
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.sidebar-logo-text {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
}

.sidebar-logo-sub {
  color: var(--green-primary);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-section {
  padding: 20px 0 8px;
}

.sidebar-section-label {
  padding: 0 16px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #6b7280;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
  position: relative;
}

.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.sidebar-item.active {
  background: rgba(0, 168, 150, 0.15);
  color: var(--sidebar-text-active);
  font-weight: 500;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--green-primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-item svg {
  width: 16px; height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}

.sidebar-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-company-badge {
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-company-badge:hover { background: rgba(255,255,255,0.10); }

.sidebar-company-name {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-company-hint {
  color: #6b7280;
  font-size: 11px;
  margin-top: 2px;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.content {
  padding: 28px;
  flex: 1;
}

/* ========================================
   CARDS
   ======================================== */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body { padding: 22px; }

/* ========================================
   FORMULARE
   ======================================== */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.form-label .required { color: var(--red-accent); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: var(--font-main);
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--green-primary);
  box-shadow: 0 0 0 3px rgba(0, 168, 150, 0.12);
}

.form-input:disabled, .form-select:disabled {
  background: #f9f9f9;
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-main);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

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

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

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

.btn-secondary:hover {
  background: var(--bg-page);
  border-color: #c0c0c0;
}

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

.btn-danger:hover {
  background: #fff5f5;
}

.btn svg { width: 14px; height: 14px; }

/* ========================================
   TOAST / BENACHRICHTIGUNGEN
   ======================================== */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-sidebar);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.25s ease;
  max-width: 340px;
}

.toast.success { border-left: 3px solid var(--green-primary); }
.toast.error { border-left: 3px solid var(--red-accent); }
.toast.info { border-left: 3px solid #6b9fff; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   BADGES / PILLS
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-red { background: #fff0f2; color: var(--red-accent); }
.badge-gray { background: #f0f0f0; color: var(--text-secondary); }
.badge-orange { background: #fff7e6; color: #b45309; }
.badge-blue { background: #eff6ff; color: #2563eb; }

/* ========================================
   DIVIDER
   ======================================== */

.divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 20px 0;
}

/* ========================================
   LEERE ZUSTÄNDE
   ======================================== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px; height: 48px;
  opacity: 0.3;
  margin-bottom: 12px;
}

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

.empty-state-text { font-size: 13px; }

/* ========================================
   SEITEN-SPEZIFISCH
   ======================================== */

.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ========================================
   SECTION GRUPPEN (innerhalb Card)
   ======================================== */

.form-section {
  margin-bottom: 28px;
}

.form-section:last-child { margin-bottom: 0; }

.form-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* ========================================
   STEUER-KONFIGURATION – Satz-Karten
   ======================================== */

.tax-rate-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}

.tax-rate-card.active-rate {
  border-color: var(--green-primary);
  background: var(--green-light);
}

.tax-rate-label {
  font-size: 13px;
  font-weight: 500;
}

.tax-rate-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--green-dark);
  font-family: var(--font-mono);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 900px) {
  :root { --sidebar-width: 200px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
