:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e3e8ef;
  --text: #1f2733;
  --dim: #6b7480;
  --brand: #0b5fff;
  --brand-dark: #0846c4;
  --good: #059669;
  --warn: #d97706;
  --bad: #e11d48;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
.nav {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0 1.25rem; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand small { color: var(--dim); font-weight: 600; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  background: var(--brand); color: #fff; border-radius: 7px; font-weight: 800;
}
.nav-links { display: flex; gap: .25rem; flex: 1; }
.nav-links a {
  padding: .45rem .7rem; border-radius: 8px; color: var(--dim); font-weight: 600; font-size: .92rem;
}
.nav-links a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-links a.active { background: rgba(11,95,255,.10); color: var(--brand); }
.nav-right { display: flex; align-items: center; gap: .75rem; }
.nav-icon { font-size: 1.1rem; }
.nav-logout { color: var(--dim); font-size: .88rem; }

/* Layout */
.container { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
h1 { font-size: 1.6rem; margin: .2rem 0 .4rem; }
h2 { font-size: 1.25rem; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--brand); }
.dim { color: var(--dim); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow);
}
.note { color: var(--dim); margin-top: 1rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  padding: .55rem .95rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: .92rem;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

/* Tabellen */
.table { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .92rem; }
.table th { background: var(--bg); color: var(--dim); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.right { text-align: right; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .75rem; }
input, select { width: 100%; padding: .55rem .7rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: .95rem; margin-top: .3rem; background: #fff; }

/* Alerts */
.alert { padding: .7rem .9rem; border-radius: 8px; font-size: .9rem; margin-bottom: 1rem; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: 1rem 0; }
.tab { padding: .5rem .9rem; color: var(--dim); font-weight: 600; font-size: .92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Filterbar */
.filterbar { display: flex; gap: .6rem; margin: 1rem 0; align-items: center; flex-wrap: wrap; }
.filterbar input[type=search] { flex: 1; min-width: 200px; margin: 0; }
.filterbar select { width: auto; margin: 0; }

/* Baum (Sortiment) */
.tree .col-exp { width: 34px; }
.expander { border: 0; background: none; cursor: pointer; font-size: 1rem; color: var(--dim); padding: 0 .2rem; }
.expander:hover { color: var(--brand); }
.kinder-cell { background: var(--bg); padding: 0 0 .25rem .25rem; }
.table.sub { box-shadow: none; border: 0; margin: .35rem 0; background: transparent; }
.table.sub th { background: transparent; font-size: .78rem; }
.table.sub td, .table.sub th { padding: .4rem .6rem; }

.pill { display: inline-block; font-size: .68rem; font-weight: 700; padding: .08rem .4rem; border-radius: 999px; background: rgba(11,95,255,.12); color: var(--brand); vertical-align: middle; }
.pill.warn { background: #fef3c7; color: #92400e; }
.badge { display: inline-block; font-size: .76rem; font-weight: 700; padding: .08rem .45rem; border-radius: 6px; background: var(--bg); }
.badge.good { background: #d1fae5; color: #065f46; }
.empty-state { text-align: center; color: var(--dim); padding: 1.5rem; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1.25rem 0; }

/* Login */
/* Funnel (Übersicht) */
.funnel { display: flex; align-items: stretch; gap: .5rem; margin: 1.25rem 0; flex-wrap: wrap; }
.fstage { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; }
.fstage:hover { text-decoration: none; border-color: var(--brand); }
.fstage.good { border-left: 3px solid var(--good); } .fstage.warn { border-left: 3px solid var(--warn); } .fstage.muted { border-left: 3px solid var(--dim); }
.flabel { font-size: .8rem; color: var(--dim); font-weight: 600; }
.fval { font-size: 1.7rem; line-height: 1.1; }
.fsub { font-size: .74rem; color: var(--dim); }
.farrow { align-self: center; color: var(--dim); font-size: 1.2rem; }

/* Ausschluss-Chips */
.breakdown-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0 0; }
.chip { display: inline-block; padding: .3rem .6rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .82rem; color: inherit; }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip strong { color: var(--text); }
.chip-soon { opacity: .6; }

/* Chart */
.chart-card { margin: 1.5rem 0; }
.chart-wrap { position: relative; height: 320px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .75rem; }

/* To-do-Zahl in Arbeitsabläufe-Karten */
.wf-num { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.wf-soon { opacity: .55; }
.stat-soon { opacity: .6; }

/* Kennzahlen */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1.5rem 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); color: inherit; }
.stat:hover { text-decoration: none; border-color: var(--brand); }
.stat-num { font-size: 1.5rem; font-weight: 700; }
.stat-lbl { font-size: .82rem; color: var(--dim); }

/* Workflow-Karten */
.workflow-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; margin-bottom: 2rem; }
.wf { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); color: inherit; display: flex; flex-direction: column; gap: .25rem; }
.wf:hover { text-decoration: none; border-color: var(--brand); }
.wf-step { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .82rem; }
.wf strong { font-size: .98rem; } .wf span { font-size: .8rem; color: var(--dim); }

/* Artikel-Detail (Fast-Lane) */
.detail-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 1rem; margin-top: 1rem; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.kv tr:last-child td { border-bottom: 0; }
.kv td:first-child { color: var(--dim); width: 45%; }
.vk-input { display: flex; gap: .4rem; align-items: center; margin-top: .3rem; }
.vk-input input { margin: 0; }
.vk-input.is-manual input { background: #fffbeb; border-color: var(--warn); }

/* Export */
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin: 1rem 0; }

.up-inline { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.up-inline input[type=file] { font-size: .78rem; max-width: 180px; }

/* Upload */
.upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .75rem; margin: 1rem 0; }
.upload-card { display: flex; flex-direction: column; gap: .5rem; }
.upload-card input[type=file] { font-size: .82rem; }
.up-result { font-size: .82rem; min-height: 1.1em; }
code { background: var(--bg); padding: .05rem .3rem; border-radius: 4px; font-size: .85em; }
details summary { cursor: pointer; }

label.inline { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
label.inline input { margin: 0; }

/* Regel-Formular (Ausschluesse) */
.rule-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.rule-form label { margin: 0; }
.rule-form .check { display: flex; align-items: center; gap: .4rem; font-weight: 500; }
.rule-form .check input { width: auto; margin: 0; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: 320px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.75rem; box-shadow: var(--shadow); }
.brand-lg { font-size: 1.2rem; justify-content: center; margin-bottom: 1.25rem; }
.login-card .btn { width: 100%; justify-content: center; margin-top: .25rem; }
