@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

/* =====================================================================
   BALUNA Buchhaltung – Farbsystem
   Sand/Espresso als warme Basis (passend zum BALUNA-Logo), Moosgrün als
   Marken-Akzent statt generischem SaaS-Blau, warmes Terrakotta statt
   hartem Rot für Verluste/Fehler.
   ===================================================================== */
:root {
  --sand-50: #F8F4EA;
  --sand-100: #F1EADA;
  --sand-200: #EDE3D0;
  --sand-300: #DFD1B4;
  --espresso-900: #2E2517;
  --espresso-700: #4A3F2C;
  --espresso-500: #6B5D48;
  --espresso-300: #9C8B6B;
  --emerald-700: #0A8F63;
  --emerald-600: #0FC488;
  --emerald-100: #E3F5EC;
  --rust-600: #D6412B;
  --rust-500: #FF5C3E;
  --rust-100: #F3E4DE;
  --amber-700: #B5790A;
  --amber-100: #FBF1DC;
  --white: #FFFFFF;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: "Montserrat", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--espresso-900);
  background: var(--sand-50);
  overflow: hidden;
}
#app { display: flex; height: 100vh; height: 100dvh; width: 100vw; }

.display-num {
  font-family: "Montserrat", sans-serif; font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-optical-sizing: auto;
}

/* ---------- Login ---------- */
.login-screen {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--sand-50);
}
.login-card {
  background: var(--white); border: 1px solid var(--sand-300); border-radius: 14px;
  width: 460px; padding: 36px 32px; text-align: center;
  box-shadow: 0 10px 30px rgba(46,37,23,0.07);
}
.login-card img.logo { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 12px; }
.login-card h1 { font-family: "Montserrat", sans-serif; font-weight: 700; font-weight: 600; font-size: 22px; margin: 0 0 6px; }
.login-card p { color: var(--espresso-500); font-size: 13px; line-height: 1.5; margin: 0 0 22px; }
.btn {
  border: none; border-radius: 8px; padding: 11px 20px; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--espresso-900); color: var(--white); }
.btn-primary:hover { background: #1C1610; }
.btn-secondary { background: var(--white); color: var(--espresso-900); border: 1px solid var(--sand-300); }
.btn-secondary:hover { background: var(--sand-50); }
.btn-danger-outline { background: var(--white); color: var(--rust-600); border: 1px solid var(--sand-300); }
.btn:disabled { opacity: 0.6; cursor: default; }
.login-step2 { margin-top: 18px; }
.login-step2 input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--sand-300); border-radius: 8px;
  font-size: 13px; margin-bottom: 12px; font-family: inherit;
}
.login-error { color: var(--rust-600); font-size: 12px; margin-top: 14px; min-height: 16px; }

/* ---------- Web-Login/Registrierung ---------- */
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; justify-content: center; }
.auth-tab {
  padding: 6px 16px; border-radius: 7px; font-size: 12px; font-weight: 700;
  cursor: pointer; color: var(--espresso-300); background: transparent;
}
.auth-tab.active { background: var(--sand-100); color: #1C1610; }
.auth-field { width: 100%; text-align: left; margin-bottom: 12px; }
.auth-field label { display: block; font-size: 11px; font-weight: 700; color: var(--espresso-500); margin-bottom: 4px; }
.auth-field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--sand-300); border-radius: 8px;
  font-size: 13px; font-family: inherit;
}
.auth-success { color: var(--emerald-600); font-size: 12px; margin-top: 14px; }
.loading-spinner {
  display: inline-block; width: 16px; height: 16px; border: 2px solid var(--sand-300);
  border-top-color: var(--espresso-900); border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.full-loading { display: flex; align-items: center; justify-content: center; height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 230px; background: var(--espresso-900); color: #C9BDA4; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 20px 0;
  border-right: none;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.sidebar.collapsed { width: 72px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 24px; overflow: hidden; }
.sidebar.collapsed .brand { padding: 0 0 24px; justify-content: center; }
.brand img { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
.brand-title { font-family: "Montserrat", sans-serif; font-weight: 700; color: #fff; font-size: 14px; line-height: 1.3; white-space: nowrap; }
.brand-sub { color: #A0916F; font-size: 10px; white-space: nowrap; }
.sidebar.collapsed .brand-title, .sidebar.collapsed .brand-sub { display: none; }
.nav-section { color: #A0916F; font-size: 10px; font-weight: 700; padding: 14px 18px 6px; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; }
.sidebar.collapsed .nav-section { text-align: center; padding: 14px 4px 6px; visibility: hidden; height: 8px; overflow: hidden; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 18px; cursor: pointer;
  font-size: 13px; color: #C9BDA4; user-select: none; white-space: nowrap; overflow: hidden;
  margin: 1px 8px; border-radius: 9px; font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar.collapsed .nav-item { margin: 1px auto; width: 44px; justify-content: center; padding: 10px 0; }
.nav-item:hover { background: rgba(255,255,255,0.08); }
.nav-item.active { background: var(--emerald-600); color: #08301F; font-weight: 700; }
.nav-icon { flex-shrink: 0; width: 16px; text-align: center; }
.sidebar.collapsed .nav-label { display: none; }
.nav-item-landing {
  display: flex; align-items: center; gap: 12px; padding: 11px 18px; cursor: pointer;
  font-size: 12px; color: #A0916F; user-select: none; white-space: nowrap; overflow: hidden;
  margin: 2px 10px 10px; border-radius: 10px;
}
.nav-item-landing:hover { background: #2E2517; color: var(--white); }
.sidebar-spacer { flex: 1; }
.sidebar-toggle {
  position: absolute; top: 20px; right: -12px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--espresso-700); border: 1px solid #493C27; color: #C9BDA4;
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 11px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3); z-index: 5; transition: transform 0.22s ease;
}
.sidebar-toggle:hover { background: #3A2F1D; }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }

/* ---------- Main area ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px; background: var(--white); border-bottom: 1px solid var(--sand-300);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0;
}
.topbar h1 { font-family: "Montserrat", sans-serif; font-weight: 700; font-weight: 600; font-size: 19px; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.status-text { color: var(--espresso-300); font-size: 11px; margin-right: 6px; }
.content { flex: 1; overflow-y: auto; padding: 24px; }
.content-fade-out { opacity: 0; transition: opacity 0.12s ease; }
.content-fade-in { animation: contentFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes contentFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .content-fade-out, .content-fade-in { animation: none; transition: none; opacity: 1; }
}

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-card { border: 1px solid var(--sand-300); border-radius: 10px; padding: 14px 16px; }
.kpi-card .label { font-size: 11px; font-weight: 700; color: var(--espresso-500); margin-bottom: 8px; }
.kpi-card .value { font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 25px; font-weight: 600; }
.kpi-blue { background: var(--sand-100); }
.kpi-green { background: var(--emerald-100); }
.kpi-green .value { color: var(--emerald-700); }
.kpi-yellow { background: var(--amber-100); }
.kpi-yellow .value { color: var(--amber-700); }
.kpi-red { background: var(--rust-100); }
.kpi-red .value { color: var(--rust-600); }
.hint { color: var(--espresso-300); font-size: 12px; margin-top: 4px; }

/* ---------- Monatsübersicht (Legacy-Tabelle, aktuell ungenutzt) ---------- */
.section-title { font-family: "Montserrat", sans-serif; font-weight: 700; font-weight: 600; font-size: 16px; margin: 30px 0 14px; color: var(--espresso-900); }
.monthly-table {
  width: 100%; border-collapse: collapse; background: var(--white);
  border: 1px solid var(--sand-300); border-radius: 8px; overflow: hidden;
}
.monthly-table th {
  background: var(--espresso-900); color: var(--white); font-size: 11px; font-weight: 700;
  text-align: left; padding: 10px 16px;
}
.monthly-table th.num, .monthly-table td.num { text-align: right; }
.monthly-table td {
  padding: 9px 16px; font-size: 13px; color: var(--espresso-700); border-top: 1px solid var(--sand-300);
}
.monthly-table tr.muted-row td { color: var(--espresso-300); }
.monthly-table td.neg { color: var(--rust-600); }

/* ---------- Grouped list ---------- */
.month-header { color: var(--espresso-300); font-size: 11px; font-weight: 700; margin: 22px 0 8px; letter-spacing: 0.03em; }
.month-header:first-child { margin-top: 0; }
.month-header.collapsible {
  display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  padding: 4px 4px; border-radius: 6px;
}
.month-header.collapsible:hover { background: var(--sand-100); }
.chevron { display: inline-block; transition: transform 0.15s ease; font-size: 10px; }
.chevron.collapsed { transform: rotate(-90deg); }
.row-card {
  background: var(--white); border: 1px solid var(--sand-300); border-radius: 8px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.row-card:hover { border-color: var(--espresso-700); box-shadow: 0 2px 10px rgba(46,37,23,0.05); }
.row-card-stacked { flex-direction: column; align-items: stretch; gap: 8px; }
.row-topline { display: flex; align-items: center; justify-content: space-between; }
.row-statline {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  padding-top: 8px; border-top: 1px solid var(--sand-100);
}
.stat-chip { font-size: 11px; white-space: nowrap; }
.stat-label { color: var(--espresso-300); }
.stat-value { font-weight: 700; color: var(--espresso-700); font-variant-numeric: tabular-nums; }
.stat-chip-highlight .stat-value { font-size: 12px; }
.stat-positive { color: var(--emerald-700); }
.stat-negative { color: var(--rust-600); }
.stat-chip-muted { color: var(--espresso-300); font-size: 11px; font-style: italic; }

/* ---------- Perioden-Karten (Dashboard) ---------- */
.period-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.period-card {
  background: var(--white); border: 1px solid var(--sand-300); border-radius: 12px; padding: 18px;
  transition: box-shadow 0.15s ease;
}
.period-card:hover { box-shadow: 0 4px 18px rgba(46,37,23,0.06); }
.period-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.period-label { font-size: 11px; font-weight: 700; color: var(--espresso-300); letter-spacing: 0.05em; }
.period-range { font-size: 11px; color: var(--espresso-300); }
.period-umsatz { font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 27px; font-weight: 600; color: var(--espresso-900); font-variant-numeric: tabular-nums; }
.period-sub { font-size: 11px; color: var(--espresso-300); margin-bottom: 12px; }
.period-breakdown { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
.period-row { display: flex; justify-content: space-between; font-size: 12px; }
.period-row-label { color: var(--espresso-500); }
.period-row-value { color: var(--espresso-500); font-variant-numeric: tabular-nums; }
.period-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--amber-700); margin-right: 2px; }
.period-divider { border-top: 1px solid var(--sand-100); margin: 6px 0 8px; }
.period-row-bold { font-weight: 700; font-size: 14px; color: var(--espresso-900); margin-bottom: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Trend-Diagramm & Top-Artikel ---------- */
.trend-card {
  background: var(--white); border: 1px solid var(--sand-300); border-radius: 12px;
  padding: 20px; margin-bottom: 18px;
}
.trend-bars { display: flex; align-items: flex-end; gap: 12px; height: 140px; padding-top: 10px; }
.trend-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.trend-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.trend-bar { width: 60%; border-radius: 5px 5px 0 0; min-height: 3px; }
.trend-bar-pos { background: var(--emerald-600); }
.trend-bar-neg { background: var(--rust-500); }
.trend-bar-label { font-size: 11px; color: var(--espresso-300); font-weight: 600; }

.top-artikel-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.top-artikel-title { width: 200px; flex-shrink: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-artikel-bar-track { flex: 1; height: 8px; background: var(--sand-100); border-radius: 4px; overflow: hidden; }
.top-artikel-bar { height: 100%; background: var(--emerald-600); border-radius: 4px; transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }
.top-artikel-value { width: 80px; text-align: right; font-size: 12px; font-weight: 700; flex-shrink: 0; }

.top-artikel-scroll-wrap { position: relative; }
.top-artikel-scroll-wrap::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 4px; width: 48px; pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0), var(--white));
}
.top-artikel-scroll { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.top-artikel-scroll > * { scroll-snap-align: start; }
.top-artikel-tile { flex-shrink: 0; width: 168px; border: 1px solid var(--sand-300); border-radius: 14px; padding: 16px; }
.top-artikel-tile-title { font-size: 12px; font-weight: 700; line-height: 1.35; height: 32px; overflow: hidden; margin: 12px 0 10px; }
.top-artikel-tile-bar-track { height: 6px; background: var(--sand-100); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.top-artikel-tile-bar { height: 100%; border-radius: 4px; transition: width .7s cubic-bezier(.16,1,.3,1); }
.top-artikel-tile-value { font-size: 13px; font-weight: 800; color: var(--emerald-700); }

.category-bar-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.category-bar-label { width: 150px; flex-shrink: 0; font-size: 12px; font-weight: 600; }
.category-bar-track { flex: 1; height: 9px; background: var(--sand-100); border-radius: 5px; overflow: hidden; }
.category-bar-fill { height: 100%; border-radius: 5px; transition: width .7s cubic-bezier(.16,1,.3,1); }
.category-bar-value { width: 80px; text-align: right; font-size: 12px; font-weight: 700; flex-shrink: 0; }

.amazon-summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 18px; }
.amazon-summary-card { border-radius: 14px; padding: 18px; }
.amazon-summary-green { background: var(--emerald-100); }
.amazon-summary-green .amazon-summary-label, .amazon-summary-green .amazon-summary-value { color: var(--emerald-700); }
.amazon-summary-yellow { background: var(--amber-100); }
.amazon-summary-yellow .amazon-summary-label, .amazon-summary-yellow .amazon-summary-value { color: var(--amber-700); }
.amazon-summary-label { font-size: 11px; font-weight: 700; }
.amazon-summary-value { font-weight: 800; font-size: 22px; margin-top: 6px; }

.quick-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.quick-stat-card { background: var(--white); border: 1px solid var(--sand-300); border-radius: 14px; padding: 18px; }
.quick-stat-green { background: var(--emerald-100); border-color: transparent; }
.quick-stat-green .quick-stat-label, .quick-stat-green .quick-stat-value { color: var(--emerald-700); }
.quick-stat-yellow { background: var(--amber-100); border-color: transparent; }
.quick-stat-yellow .quick-stat-label, .quick-stat-yellow .quick-stat-value { color: var(--amber-700); }
.quick-stat-label { font-size: 11px; font-weight: 700; color: var(--espresso-500); }
.quick-stat-value { font-weight: 800; font-size: 26px; margin-top: 6px; }

.settings-card-flex { display: flex; align-items: flex-start; gap: 14px; }
.settings-icon-tile { width: 44px; height: 44px; border-radius: 12px; background: var(--sand-100); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }

/* ---------- Hero-Karte (Dashboard, animiert) ---------- */
.hero-card {
  background: linear-gradient(135deg, #1C1610, var(--espresso-900));
  border-radius: 18px; padding: 28px 32px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  color: var(--white); position: relative; overflow: hidden;
}
.hero-card::before {
  content: ""; position: absolute; inset: -40%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.14), transparent 65%);
  animation: heroGlow 7s ease-in-out infinite;
}
@keyframes heroGlow {
  0%, 100% { transform: translate(-8%, -6%) scale(1); }
  50% { transform: translate(4%, 6%) scale(1.12); }
}
.hero-card-negative { background: linear-gradient(135deg, var(--rust-600), #8A3822); }
.hero-left { position: relative; z-index: 1; }
.hero-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; opacity: 0.85; margin-bottom: 8px; }
.hero-num {
  font-family: "Montserrat", sans-serif; font-weight: 700; font-weight: 600; font-size: 46px;
  line-height: 1; font-variant-numeric: tabular-nums; margin-bottom: 8px;
}
.hero-sub { font-size: 13px; opacity: 0.85; }
.hero-ring-wrap { position: relative; width: 120px; height: 120px; flex-shrink: 0; z-index: 1; }
.hero-ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.hero-ring-bg { fill: none; stroke: rgba(255,255,255,0.22); stroke-width: 10; }
.hero-ring-fg { fill: none; stroke: #fff; stroke-width: 10; stroke-linecap: round; }
.hero-ring-negative { stroke: #FFD9CC; }
.hero-ring-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ---------- Gestaffeltes Einblenden ---------- */
@keyframes staggerFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.stagger-in {
  animation: staggerFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--stagger, 0) * 60ms);
}
@media (prefers-reduced-motion: reduce) {
  .hero-card::before { animation: none; }
  .stagger-in { animation: none; }
}

/* ---------- Glanzpunkte (nur bei positivem Gewinn) ---------- */
.hero-sparkles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.hero-sparkle {
  position: absolute; bottom: 10px; width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,0.8); animation: sparkleFloat 4.5s ease-in infinite;
}
@keyframes sparkleFloat {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  15% { opacity: 0.9; }
  100% { transform: translateY(-110px) scale(1.1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-sparkle { animation: none; display: none; }
}

/* ---------- Einführungs-Rundgang ---------- */
.tour-overlay { position: fixed; inset: 0; z-index: 300; }
.tour-spotlight {
  position: fixed; border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(26,22,16,0.72);
  transition: top 0.35s cubic-bezier(0.16,1,0.3,1), left 0.35s cubic-bezier(0.16,1,0.3,1),
              width 0.35s cubic-bezier(0.16,1,0.3,1), height 0.35s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
}
.tour-tooltip {
  position: fixed; background: var(--white); border-radius: 14px; padding: 22px;
  width: 320px; box-shadow: 0 24px 60px rgba(0,0,0,0.35); z-index: 301;
  transition: top 0.35s cubic-bezier(0.16,1,0.3,1), left 0.35s cubic-bezier(0.16,1,0.3,1);
  animation: tourTooltipIn 0.3s ease;
}
@keyframes tourTooltipIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.tour-step-count { font-size: 11px; font-weight: 700; color: var(--espresso-300); letter-spacing: 0.05em; margin-bottom: 8px; }
.tour-tooltip h3 { font-size: 16px; margin: 0 0 8px; }
.tour-tooltip p { font-size: 13px; color: var(--espresso-500); line-height: 1.5; margin: 0 0 18px; }
.tour-actions { display: flex; gap: 8px; justify-content: flex-end; }
.tour-actions .btn { padding: 8px 16px; font-size: 13px; }
.tour-skip { display: block; text-align: center; font-size: 11px; color: var(--espresso-300); margin-top: 12px; cursor: pointer; }
.tour-skip:hover { color: var(--espresso-500); text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
  .tour-spotlight, .tour-tooltip { transition: none; }
  .tour-tooltip { animation: none; }
}

/* ---------- Checkboxen & Mehrfachauswahl ---------- */
.row-checkbox { width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--espresso-900); cursor: pointer; }
.selection-bar {
  display: flex; align-items: center; gap: 12px; background: var(--espresso-900); color: var(--white);
  padding: 12px 18px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; font-weight: 600;
}
.selection-bar .btn { padding: 7px 14px; font-size: 12px; }
.selection-bar .btn-danger-outline { background: transparent; color: #FFB4A0; border-color: rgba(255,255,255,0.3); }
.selection-bar .btn-danger-outline:hover { background: rgba(255,255,255,0.08); }
.selection-bar .btn-secondary { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.3); }
.selection-bar .btn-secondary:hover { background: rgba(255,255,255,0.08); }

.row-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.row-left input[type=checkbox] { flex-shrink: 0; accent-color: var(--espresso-900); }
.row-text { min-width: 0; }
.row-title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--espresso-900); }
.row-sub { color: var(--espresso-300); font-size: 11px; margin-top: 2px; }
.row-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.amount { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.amount-green { color: var(--emerald-700); }
.amount-red { color: var(--rust-600); }
.badge { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 5px; }
.badge-green { background: var(--emerald-100); color: var(--emerald-700); }
.badge-red { background: var(--rust-100); color: var(--rust-600); }
.badge-yellow { background: var(--amber-100); color: var(--amber-700); }
.menu-dot { color: var(--espresso-300); font-weight: 700; font-size: 16px; padding: 0 6px; }
.empty-state { color: var(--espresso-300); font-size: 13px; padding: 40px 4px; }

/* ---------- Toolbar ---------- */
.toolbar { margin-bottom: 14px; }

/* ---------- Settings ---------- */
.settings-card {
  background: var(--white); border: 1px solid var(--sand-300); border-radius: 10px;
  padding: 20px; max-width: 640px; margin-bottom: 20px;
}
.settings-card h2 { font-family: "Montserrat", sans-serif; font-weight: 700; font-weight: 600; font-size: 16px; margin: 0 0 10px; }
.settings-card p { font-size: 12px; color: var(--espresso-500); margin: 4px 0; }
.status-connected { color: var(--emerald-700); font-weight: 700; font-size: 12px; }

/* ---------- Update banner ---------- */
.update-banner {
  background: var(--amber-100); border-bottom: 1px solid var(--sand-300);
  padding: 10px 24px; display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--amber-700); flex-shrink: 0;
}
.update-banner .btn { padding: 6px 14px; font-size: 12px; }
.update-banner-close { cursor: pointer; color: var(--amber-700); font-weight: 700; padding: 0 8px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(46,37,23,0.35);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--white); border-radius: 12px; width: 380px; padding: 24px;
  box-shadow: 0 20px 50px rgba(46,37,23,0.22);
  max-height: 85vh; overflow-y: auto;
}
.modal h3 { font-family: "Montserrat", sans-serif; font-weight: 700; font-weight: 600; margin: 0 0 16px; font-size: 17px; }
.modal label { display: block; font-size: 11px; font-weight: 700; color: var(--espresso-500); margin: 12px 0 4px; }
.modal input:not([type="checkbox"]), .modal select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--sand-300); border-radius: 7px;
  font-size: 13px; font-family: inherit;
}
.modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Login (zweigeteilt) ---------- */
.auth-split { display: flex; height: 100vh; height: 100dvh; width: 100vw; }
.auth-form-pane { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--sand-50); }
.auth-form-inner { width: 100%; max-width: 360px; }
.auth-logo { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 20px; }
.auth-h1 { font-size: 26px; font-weight: 700; margin: 0 0 6px; color: var(--espresso-900); }
.auth-sub { color: var(--espresso-500); font-size: 13px; margin: 0 0 26px; }
.auth-submit { width: 100%; padding: 13px; font-size: 14px; margin-top: 6px; }

.auth-visual-pane {
  flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--espresso-700), var(--espresso-900) 65%, #120D07);
}
.auth-visual-glow {
  position: absolute; inset: -30%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16), transparent 65%);
  animation: heroGlow 8s ease-in-out infinite;
}
.auth-visual-content { position: relative; z-index: 1; color: #fff; padding: 40px; max-width: 420px; }
.auth-visual-eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; background: rgba(255,255,255,0.16);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 20px;
}
.auth-visual-h2 { font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 32px; line-height: 1.2; margin: 0 0 32px; }
.auth-mock-card {
  background: #fff; color: var(--espresso-900); border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.18); margin-bottom: 16px;
}
.auth-mock-1 { transform: rotate(-1.5deg); animation: authFloat1 5s ease-in-out infinite; }
.auth-mock-2 { transform: rotate(1deg); animation: authFloat2 5.5s ease-in-out infinite 0.3s; }
@keyframes authFloat1 { 0%, 100% { transform: rotate(-1.5deg) translateY(0); } 50% { transform: rotate(-1.5deg) translateY(-8px); } }
@keyframes authFloat2 { 0%, 100% { transform: rotate(1deg) translateY(0); } 50% { transform: rotate(1deg) translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  .auth-mock-1, .auth-mock-2 { animation: none; }
}
.auth-mock-num { font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 26px; margin: 4px 0; }
.auth-mock-sub { font-size: 11px; color: var(--espresso-300); }
.auth-mock-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-top: 6px; }

@media (max-width: 860px) {
  .auth-visual-pane { display: none; }
  .auth-form-pane { padding: 24px; }
}

/* ---------- Amazon-Fund-Überprüfung ---------- */
.review-modal { width: 520px; }
.review-modal-hint { font-size: 12px; color: var(--espresso-500); margin: -8px 0 16px; }
.review-list { display: flex; flex-direction: column; gap: 10px; }
.review-card {
  border: 1px solid var(--sand-300); border-radius: 10px; padding: 12px 14px;
  transition: opacity 0.15s ease;
}
.review-card-excluded { opacity: 0.45; }
.review-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.review-card-top .review-produkt-input {
  flex: 1; width: auto; font-weight: 600; font-size: 13px;
  border: 1px solid transparent; background: var(--sand-50); border-radius: 6px; padding: 7px 9px;
}
.review-card-top .review-produkt-input:focus { border-color: var(--espresso-500); outline: none; background: var(--white); }
.review-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-left: 27px; }
.review-meta { font-size: 11px; color: var(--espresso-300); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-preis-wrap { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.review-preis-prefix { font-size: 12px; color: var(--espresso-300); }
.review-preis-wrap .review-preis-input {
  width: 72px; text-align: right; font-weight: 700; font-size: 13px;
  border: 1px solid var(--sand-300); border-radius: 6px; padding: 5px 8px;
}

/* ---------- Dashboard: zweispaltiges Layout mit Live-Feed (Redesign) ---------- */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.dashboard-col { min-width: 0; }
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }
.kpi-grid-rail { grid-template-columns: repeat(2, 1fr) !important; }

.avatar-tile { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #fff; }
.avatar-tile-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-tile-lg { width: 42px; height: 42px; font-size: 17px; border-radius: 11px; }

.feed-card { background: var(--white); border: 1px solid var(--sand-300); border-radius: 16px; padding: 20px; margin-bottom: 18px; }
.feed-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald-600); animation: pulseDot 1.8s ease-in-out infinite; }
@keyframes pulseDot { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(14,159,110,.5); } 50% { opacity: .6; box-shadow: 0 0 0 5px rgba(14,159,110,0); } }
.feed-list { max-height: 300px; overflow-y: auto; }
.feed-item { display: flex; gap: 11px; padding: 12px 4px; border-bottom: 1px solid var(--sand-300); }
.feed-item:last-child { border-bottom: none; }
.feed-item-title { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item-time { font-size: 11px; color: var(--espresso-300); margin-top: 2px; }
.feed-item-amount { font-size: 12px; font-weight: 800; flex-shrink: 0; }

/* ---------- Login-Tabs: gleitender Indikator ---------- */
.auth-tabs { position: relative; }
.auth-tab-indicator { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 4px); background: #fff; border-radius: 7px; box-shadow: 0 2px 6px rgba(46,37,23,.08); transition: transform .25s cubic-bezier(.16,1,.3,1); z-index: 0; }
.auth-tabs.signup .auth-tab-indicator { transform: translateX(100%); }
.auth-tab { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .feed-dot { animation: none; } .auth-tab-indicator { transition: none; } }

/* =====================================================================
   Mobile-Ansicht (Handy/schmale Bildschirme)
   ===================================================================== */
.mobile-menu-btn { display: none; }
.mobile-backdrop { display: none; }

@media (max-width: 760px) {
  /* Seitenleiste wird zum ausklappbaren Menü statt permanent sichtbar */
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; z-index: 200;
    width: 250px !important; transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 0 0 rgba(0,0,0,0);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sidebar.mobile-open {
    transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,0.35); bottom: 6px; height: auto !important; top: 0;
    background: rgba(27,20,12,0.98); /* leicht durchsichtig statt 100% deckend - laut Apples eigenem Entwickler-Forum noetig, damit Safaris Leiste sich korrekt verhaelt */
  }
  .sidebar .nav-label, .sidebar .brand-title, .sidebar .brand-sub, .sidebar .nav-section {
    display: block !important; visibility: visible !important; height: auto !important; overflow: visible !important; text-align: left !important;
  }
  /* Falls die Seitenleiste vom Desktop aus als "eingeklappt" gespeichert
     wurde (localStorage), sollen auf dem Handy trotzdem IMMER die
     normalen, breiten Menüzeilen gezeigt werden - nicht die schmalen
     Symbol-Kästchen der Desktop-Einklapp-Ansicht. */
  .sidebar .nav-item, .sidebar.collapsed .nav-item,
  .sidebar .nav-item-landing, .sidebar.collapsed .nav-item-landing {
    width: auto !important; margin: 2px 10px !important; justify-content: flex-start !important; padding: 11px 18px !important;
  }
  .sidebar .brand, .sidebar.collapsed .brand { justify-content: flex-start !important; padding: 0 18px 24px !important; }
  .sidebar-toggle { display: none; }

  .mobile-backdrop {
    display: block; position: fixed; inset: 0; background: transparent; z-index: 150;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease, -webkit-backdrop-filter 0.2s ease, backdrop-filter 0.2s ease;
  }
  .mobile-backdrop.show {
    background: transparent; opacity: 1; pointer-events: auto;
    backdrop-filter: brightness(0.45); -webkit-backdrop-filter: brightness(0.45);
  }

  .mobile-menu-btn {
    display: flex; align-items: center; justify-content: center; width: 38px; height: 38px;
    border-radius: 9px; background: var(--sand-100); font-size: 18px; cursor: pointer; margin-right: 12px; flex-shrink: 0;
  }
  .topbar { height: auto; padding: 0 14px; flex-wrap: wrap; gap: 8px; min-height: auto; padding-top: 12px; padding-bottom: 12px; }
  .topbar h1 { font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; width: 100%; justify-content: flex-end; }
  .topbar-actions .status-text { display: none; }
  .topbar-actions .btn { padding: 8px 12px; font-size: 12px; }
  /* Ganze Seite scrollt normal (statt nur ein innerer Bereich) -
     dadurch verhaelt sich Safaris eigene Adressleiste beim Scrollen
     genauso wie auf jeder normalen Webseite (z.B. github.com):
     zieht sich automatisch zusammen und gibt mehr Platz frei. */
  html, body { overflow: auto !important; height: auto !important; }
  #app { height: auto !important; min-height: 100dvh; }
  .main { min-height: 100dvh; }
  .content {
    padding: 14px; padding-top: 96px; overflow-y: visible !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; }

  /* Raster einspaltig stapeln */
  .kpi-grid, .kpi-grid-2col, .period-grid, .period-grid-secondary,
  .amz-summary-grid, .dash-grid { grid-template-columns: 1fr !important; }

  .hero-card { flex-direction: column; align-items: flex-start; gap: 18px; padding: 22px; }
  .hero-num { font-size: clamp(28px, 9vw, 40px); }
  .hero-ring-wrap { align-self: center; }

  /* Zeilen ohne eigene .row-topline (z.B. Amazon-Einkäufe) auf dem
     Handy grundsaetzlich stapeln statt nebeneinander zu zentrieren -
     sonst rutscht der Preis in die Mitte von umgebrochenem Text. */
  .row-card { flex-direction: column; align-items: stretch; gap: 8px; }
  .row-card .row-right { justify-content: flex-end; }
  .amz-summary-value { font-size: 19px; }
  .row-topline { flex-wrap: wrap; gap: 8px; }
  .row-right { flex-wrap: wrap; justify-content: flex-start; width: 100%; }

  .bestseller-tile { width: 150px; }

  .auth-form-inner { max-width: 100%; }

  .l-hero { padding-left: 16px; padding-right: 16px; }
}
