/* ============================================================
   Wohnraum Warenwirtschaft — Design „Apple × Wohnraum"
   Apple-Klarheit (Pill-Navigation, weiche Karten, System-Schrift)
   mit warmem Weiß, Marken-Orange #ff7212 und Serifen-Wortmarke.
   ============================================================ */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/source-serif-4-var.woff2") format("woff2");
}

:root {
  --bg: #f7f5f2;
  --card: #ffffff;
  --ink: #1d1a17;
  --ink-2: #77706a;
  --hair: rgba(60, 45, 30, 0.1);
  --hair-strong: rgba(60, 45, 30, 0.16);
  --orange: #ff7212;
  --orange-deep: #e05e04;
  --orange-wash: #fdf1e7;
  --green: #257a48;
  --green-wash: rgba(37, 122, 72, 0.1);
  --red: #c73a2b;
  --red-wash: rgba(199, 58, 43, 0.09);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 45, 30, 0.05), 0 10px 28px rgba(60, 45, 30, 0.06);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--orange); color: #fff; }

h1, h2, h3, h4 { color: var(--ink); }
h2 { font-family: var(--serif); font-size: 32px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; margin: 0 0 8px; }
h3 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 0 0 6px; }
h2 + p, h3 + p { margin-top: 0; color: var(--ink-2); }

a { color: var(--ink); text-decoration-color: var(--hair-strong); text-underline-offset: 3px; }
a:hover { color: var(--orange-deep); text-decoration-color: var(--orange); }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: #f1ede7;
  padding: 2px 8px;
  border-radius: 7px;
  white-space: nowrap;
}

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 28px;
  background: rgba(247, 245, 242, 0.8);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo-link { display: block; line-height: 0; }
.brand .logo { height: 16px; width: auto; display: block; }
.sub { margin: 0; font-size: 13px; color: var(--ink-2); font-weight: 500; padding-left: 14px; border-left: 1px solid var(--hair-strong); }

.userbox { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-2); }
.userbox strong { font-weight: 600; color: var(--ink); }
.userbox span { display: none; }
.userbox a { color: var(--ink-2); text-decoration: none; }
.userbox a:hover { color: var(--orange-deep); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #ff7212, #ffa25e);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; letter-spacing: 0.02em;
}

/* ---------- Layout & Navigation ---------- */

.layout { display: flex; max-width: 1460px; margin: 0 auto; gap: 8px; padding: 20px 16px 80px; }

.sidebar { width: 228px; flex-shrink: 0; padding: 8px; display: flex; flex-direction: column; gap: 2px; align-self: flex-start; position: sticky; top: 76px; }
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 11px; text-decoration: none;
  color: var(--ink); font-size: 14px; font-weight: 500;
  transition: background 0.15s;
}
.sidebar a .dot {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: #ece8e2; color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.sidebar a.active { background: var(--ink); color: #fff; }
.sidebar a.active .dot { background: var(--orange); color: #fff; }
.sidebar a:not(.active):hover { background: rgba(60, 45, 30, 0.05); }

.content { flex: 1; min-width: 0; padding: 8px 8px 0 20px; }

/* ---------- Karten & Panels ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card, .panel, .label-card, .login-card, .kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card, .kpi-card { padding: 20px 22px; }
.card span, .kpi-card span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.card strong, .kpi-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 29px; font-weight: 600; letter-spacing: -0.01em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.compact-cards .card strong { font-size: 24px; }
.card small, .kpi-card small { display: inline-block; color: var(--ink-2); font-size: 12.5px; margin-top: 8px; }
.executive-cards .card small { background: rgba(60, 45, 30, 0.05); border-radius: 980px; padding: 2px 10px; font-weight: 600; }

.panel { padding: 24px; margin-bottom: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }

/* ---------- Tabellen ---------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 8px 10px; border-bottom: 1px solid var(--hair); white-space: nowrap;
  background: transparent;
}
td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--hair); vertical-align: top; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td, table tr:not(:first-child):hover td { background: #faf8f5; }

/* ---------- Meldungen ---------- */

.alert { padding: 14px 18px; border-radius: 13px; margin-bottom: 18px; font-size: 14px; font-weight: 500; }
.alert.error { background: var(--red-wash); color: var(--red); }
.alert.success { background: var(--green-wash); color: var(--green); }

/* ---------- Formulare ---------- */

label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-panel label { display: block; margin-bottom: 6px; }
input, select, textarea {
  font-family: var(--font); font-size: 14.5px; color: var(--ink);
  background: var(--card);
  border: 1px solid var(--hair-strong);
  border-radius: 11px;
  padding: 10px 14px;
}
select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2377706a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.form-panel input, .form-panel select, .login-card input,
.form-grid input, .form-grid select { width: 100%; margin-bottom: 14px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(255, 114, 18, 0.35); outline-offset: 0; border-color: var(--orange); }
button:focus-visible { outline: 3px solid rgba(255, 114, 18, 0.35); outline-offset: 2px; }
input::placeholder { color: #b1a99f; }

button, .button, .button-link {
  font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--ink); color: #fff;
  border: none; border-radius: 980px;
  padding: 10px 20px;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
button:hover, .button:hover, .button-link:hover { background: var(--orange-deep); color: #fff; }
.secondary, .secondary-link, .button.secondary {
  background: var(--card); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-strong);
}
.secondary:hover, .secondary-link:hover, .button.secondary:hover {
  background: var(--card); color: var(--orange-deep);
  box-shadow: inset 0 0 0 1px var(--orange);
}
.link-button {
  background: none; border: none; padding: 0; border-radius: 0;
  color: var(--red); font-size: 13.5px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link-button:hover { background: none; color: var(--orange-deep); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 4px 18px; align-items: end; }
.form-grid label { display: block; }
.form-grid input, .form-grid select { margin-top: 6px; }
.form-grid button { margin-bottom: 14px; }
.full { grid-column: 1 / -1; }
.toolbar-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stats-filter-grid { align-items: end; }

/* ---------- Seitenkopf ---------- */

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin: 14px 0 24px; }
.page-head h2 { font-size: 34px; }
.page-head p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.warning-box { background: var(--orange-wash); box-shadow: none; }
.warning-box h3 { font-size: 16px; font-family: var(--font); font-weight: 600; }
.warning-box p { margin-bottom: 0; color: var(--ink-2); font-size: 13.5px; }

/* ---------- Login ---------- */

.login-body {
  display: flex; min-height: 100vh; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg);
}
.login-card { width: 384px; max-width: 100%; padding: 40px 36px 32px; }
.login-logo { height: 22px; width: auto; display: block; margin-bottom: 10px; }
.login-sub { font-size: 13.5px; color: var(--ink-2); margin: 0 0 28px; }
.login-card label { display: block; margin-bottom: 6px; }
.login-card button { width: 100%; margin-top: 6px; }
.hint { color: var(--ink-2); font-size: 13px; margin-top: 16px; }

/* ---------- Dashboard ---------- */

.dashboard-hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin: 14px 0 26px; flex-wrap: wrap; }
.dashboard-hero h2 { font-size: 38px; margin: 0 0 6px; }
.dashboard-hero .muted { max-width: 62ch; font-size: 15.5px; }
.eyebrow { margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.14em; font-size: 11.5px; font-weight: 700; color: var(--orange-deep); }
.dashboard-filter { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.dashboard-filter label { display: flex; flex-direction: column; gap: 6px; }
.dashboard-filter select { min-width: 140px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dashboard-grid .panel { margin-bottom: 0; }
.span-2 { grid-column: span 2; }

.panel-headline { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.panel-headline p { margin: 0; }

.action-list { display: flex; flex-direction: column; gap: 10px; }
.action-card { border-radius: 13px; padding: 14px 16px; display: grid; grid-template-columns: 30px 1fr; gap: 2px 12px; align-items: start; }
.action-card::before {
  content: "!";
  grid-row: 1 / span 2;
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 15px;
}
.action-card strong { grid-column: 2; font-size: 14px; }
.action-card p { grid-column: 2; margin: 0; color: var(--ink-2); font-size: 13px; }
.action-card.kritisch { background: var(--red-wash); }
.action-card.kritisch::before { background: var(--red); }
.action-card.warnung { background: var(--orange-wash); }
.action-card.warnung::before { background: var(--orange); }
.action-card.ok { background: var(--green-wash); }
.action-card.ok::before { content: "✓"; background: var(--green); }

.mini-metric { padding: 14px 16px; border-radius: 13px; background: #faf8f5; margin-bottom: 10px; }
.mini-metric span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.mini-metric em { display: block; font-style: normal; font-size: 13px; font-weight: 600; color: var(--green); }
.mini-metric strong { display: block; margin: 3px 0; font-family: var(--serif); font-size: 21px; }

.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.status-pill { background: #faf8f5; border-radius: 13px; padding: 12px 14px; }
.status-pill span { display: block; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.status-pill strong { font-family: var(--serif); font-size: 23px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.positive { color: var(--green); font-weight: 600; }
.negative { color: var(--red); font-weight: 600; }
.muted { color: var(--ink-2); }

/* ---------- Trend-Balken ---------- */

.trend-list { display: flex; flex-direction: column; gap: 4px; }
.trend-row {
  display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center;
  padding: 8px 12px; border-radius: 11px;
}
.trend-row.selected { background: var(--orange-wash); }
.trend-label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.trend-row.selected .trend-label { color: var(--orange-deep); }
.trend-bars { display: grid; grid-template-columns: minmax(160px, 1fr) auto; gap: 6px 14px; align-items: center; }
.bar-wrap { width: 100%; background: #efebe5; border-radius: 980px; overflow: hidden; height: 8px; }
.bar { height: 100%; border-radius: 980px; }
.bar.revenue { background: var(--orange); }
.bar.profit { background: var(--green); }
.bar.profit.loss { background: var(--red); }
.bar-text { font-size: 13px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Badges & Chips ---------- */

.mobile-panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.mobile-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  background: rgba(60, 45, 30, 0.05); color: var(--ink-2);
  padding: 4px 12px; border-radius: 980px;
  font-size: 12px; font-weight: 600;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--card); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-strong);
  padding: 7px 15px; border-radius: 980px; font-size: 12.5px;
}
.chip:hover { background: var(--card); color: var(--orange-deep); box-shadow: inset 0 0 0 1px var(--orange); }

/* ---------- Scanner ---------- */

.scanner-shell {
  position: relative; background: var(--ink); border-radius: var(--radius);
  overflow: hidden; min-height: 260px; margin: 16px 0;
  display: flex; align-items: center; justify-content: center;
}
.camera-preview { width: 100%; max-height: 420px; object-fit: cover; display: none; }
.camera-placeholder { color: #b8b1a8; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 4px; }
.camera-placeholder strong { color: #f7f5f2; font-size: 16px; }
.scan-frame {
  position: absolute; width: 210px; height: 210px;
  border: 2px solid var(--orange); border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(29, 26, 23, 0.45);
  pointer-events: none;
}
.scanner-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- QR-Etiketten ---------- */

.label-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.label-card { padding: 20px 16px; text-align: center; font-size: 13px; color: var(--ink-2); }
.label-card img { width: 160px; height: 160px; object-fit: contain; margin-bottom: 8px; }
.label-card strong { display: block; font-family: var(--serif); font-size: 15.5px; color: var(--ink); }

/* ---------- Offline ---------- */

.offline-page .content { max-width: 640px; margin: 8vh auto 0; }

/* ---------- Druck ---------- */

@media print {
  .topbar, .sidebar { display: none; }
  .layout, .content { padding: 0; display: block; }
  body { background: #fff; }
  .panel, .label-card { box-shadow: none; border: 1px solid #ccc; }
}

/* ---------- Responsiv ---------- */

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

@media (max-width: 860px) {
  .layout { display: block; padding: 12px 12px 60px; }
  .sidebar {
    position: static; width: auto; flex-direction: row; overflow-x: auto;
    gap: 6px; padding: 4px 2px 10px;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar a { white-space: nowrap; background: var(--card); box-shadow: var(--shadow); padding: 7px 14px 7px 9px; }
  .sidebar a.active { background: var(--ink); }
  .content { padding: 8px 4px 0; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 17px; }
  .sub { display: none; }
  .dashboard-hero { flex-direction: column; align-items: flex-start; gap: 14px; }
  .dashboard-hero h2 { font-size: 29px; }
  .dashboard-filter { width: 100%; }
  .dashboard-filter label { flex: 1; min-width: 120px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head h2 { font-size: 28px; }
  h2 { font-size: 26px; }
  .scan-frame { width: 170px; height: 170px; }
  table { font-size: 13.5px; display: block; overflow-x: auto; }
  .trend-row { grid-template-columns: 1fr; gap: 6px; }
  .trend-bars { grid-template-columns: 1fr; }
  .bar-text { white-space: normal; }
}
