/* ═══════════════════════════════════════════════════════════════════════════
   Design-System – Sign / Frische Brise
   Primär-/Sekundärfarbe werden per /tenant-theme.css pro Mandant überschrieben.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Tenant-anpassbar (Defaults) */
  --primary:        #000000;
  --primary-text:   #ffffff;
  --secondary:      #0071e3;

  /* Layout-Farben */
  --bg:             #f5f5f7;
  --card:           #ffffff;
  --border:         #e5e5e7;
  --input-bg:       #f5f5f7;
  --text:           #1d1d1f;
  --muted:          #6e6e73;

  /* Status-Farben */
  --red:            #ff3b30;
  --green:          #34c759;
  --blue:           #0071e3;
  --orange:         #ff9500;

  /* Sidebar */
  --sidebar-w:      240px;
  --sidebar-bg:     #ffffff;
  --nav-active-bg:  #f0f0f2;
  --nav-hover-bg:   #f7f7f8;

  /* Typografie */
  --font:           -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  --radius:         10px;
  --radius-lg:      16px;
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.10);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── App-Shell ──────────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }
.sidebar-logo-text { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
  margin-bottom: 1px;
}
.nav-item:hover  { background: var(--nav-hover-bg); }
.nav-item.active { background: var(--nav-active-bg); font-weight: 600; }
.nav-item.disabled { color: var(--muted); cursor: default; }
.nav-icon { width: 16px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: var(--red);
  color: #fff;
  padding: 1px 5px;
  border-radius: 20px;
}
.nav-soon {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  background: var(--border);
  padding: 1px 6px;
  border-radius: 20px;
}

.sidebar-divider { height: 1px; background: var(--border); margin: 8px; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.sidebar-user:hover { background: var(--nav-hover-bg); }
.sidebar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--muted); }

/* ── Hauptbereich ───────────────────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }

.topbar {
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.content { padding: 28px 24px; max-width: 1200px; }

/* ── Toast / Flash ──────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 360px;
  animation: slideIn .2s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Karten ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-sm { padding: 16px; border-radius: var(--radius); }
.card-flush { padding: 0; overflow: hidden; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.2px; }
.card-subtitle { font-size: 13px; color: var(--muted); margin-top: -12px; margin-bottom: 16px; }

/* ── Statistik-Karten ───────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat-card.accent { background: var(--primary); border-color: var(--primary); }
.stat-card.accent .stat-value,
.stat-card.accent .stat-label { color: var(--primary-text); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity .12s, transform .1s; white-space: nowrap;
}
.btn:active { transform: scale(.98); opacity: .85; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 8px; border-radius: 8px; background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-icon:hover { background: var(--nav-hover-bg); color: var(--text); }

/* ── Formulare ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted);
}
.form-control {
  width: 100%; padding: 11px 14px;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 15px; color: var(--text);
  outline: none; transition: border-color .15s;
}
.form-control:focus { border-color: #aaa; background: #fff; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Tabellen ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  padding: 10px 16px; text-align: left;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted); white-space: nowrap;
}
td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--nav-hover-bg); }
.td-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Badges / Status ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 9px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-green  { background: rgba(52,199,89,.12);  color: #1a7a35; }
.badge-blue   { background: rgba(0,113,227,.12);  color: #0056b3; }
.badge-red    { background: rgba(255,59,48,.12);  color: #cc2200; }
.badge-orange { background: rgba(255,149,0,.12);  color: #c47700; }
.badge-muted  { background: rgba(110,110,115,.1); color: var(--muted); }

/* ── Suchleiste ─────────────────────────────────────────────────────────────── */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.search-input {
  flex: 1; max-width: 320px;
  padding: 9px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; outline: none;
}
.search-input:focus { border-color: #aaa; }

/* ── Leerer Zustand ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state-text { font-size: 15px; font-weight: 500; }
.empty-state-sub  { font-size: 13px; margin-top: 4px; }

/* ── Farb-Picker (Einstellungen) ────────────────────────────────────────────── */
.color-preview { display: flex; align-items: center; gap: 10px; }
.color-swatch  { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); flex-shrink: 0; }
input[type=color] { width: 36px; height: 36px; border: none; padding: 0; cursor: pointer; border-radius: 6px; background: none; }

/* ── Rechnung-Ansicht ───────────────────────────────────────────────────────── */
.invoice-paper {
  background: #fff; max-width: 800px;
  margin: 0 auto; padding: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ── Auth-Seiten ────────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 400px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-text { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.3px; }
.auth-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.auth-footer { text-align: center; font-size: 14px; color: var(--muted); margin-top: 20px; }
.auth-footer a { color: var(--secondary); font-weight: 500; }

/* ── Utility ────────────────────────────────────────────────────────────────── */
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--muted); } .text-sm { font-size: 13px; } .text-xs { font-size: 11px; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.w-full { width: 100%; } .text-right { text-align: right; }
.color-green { color: var(--green); } .color-red { color: var(--red); }
.color-blue  { color: var(--blue);  } .color-orange { color: var(--orange); }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
