/* ═══════════════════════════════════════════════════════════════
   STRUCTON CRM — Hauptstylesheet
   Swiss International: eckige Container, runde Mono-Badges,
   farblich differenzierte Sidebar-Bereiche
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
@import url('./tokens.css');

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

html, body {
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-ink);
  background: var(--c-soft);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: var(--f-body); cursor: pointer; }

/* ── App-Layout ─────────────────────────────────────────────── */

.app { display: none; min-height: 100vh; }
.app.is-active { display: grid; grid-template-columns: var(--sidebar-width) 1fr; grid-template-rows: var(--topbar-height) 1fr; }

/* ── Topbar ─────────────────────────────────────────────────── */

.topbar {
  grid-column: 1 / -1;
  background: var(--c-ink);
  color: var(--c-surface);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--s-6);
  border-bottom: 1px solid var(--c-ink-soft);
}

.topbar .brand { display: flex; align-items: center; gap: var(--s-3); }
.topbar .brand img { height: 32px; width: auto; filter: brightness(0) invert(1); }
.topbar .brand .name {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.topbar .brand .sub {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-mid-soft);
  margin-left: var(--s-2);
}

.topbar .topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-4); }
.topbar .user {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-mid-soft);
}
.topbar .user strong { color: var(--c-surface); margin-left: var(--s-2); }
.topbar .role-badge {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  background: var(--c-accent);
  color: var(--c-surface);
  border-radius: var(--radius-pill);
  margin-left: var(--s-2);
}
.topbar .role-badge.external { background: var(--c-tools); }
.topbar .role-badge.agent { background: var(--c-kunden); }
.topbar .logout-btn {
  background: transparent;
  border: 1px solid var(--c-mid);
  color: var(--c-surface);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 0;
}
.topbar .logout-btn:hover { background: var(--c-mid); }

/* ── Sidebar ────────────────────────────────────────────────── */

.sidebar {
  background: var(--c-surface);
  border-right: 1px solid var(--c-line);
  padding: var(--s-4) 0;
  overflow-y: auto;
}

.sidebar .nav-section { margin-bottom: var(--s-6); }
.sidebar .nav-section-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-5);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-mid);
}
.sidebar .nav-section-title .dot {
  width: 8px;
  height: 8px;
  display: inline-block;
}

.sidebar .nav-section[data-cat="sales"] .nav-section-title .dot { background: var(--c-sales); }
.sidebar .nav-section[data-cat="kunden"] .nav-section-title .dot { background: var(--c-kunden); }
.sidebar .nav-section[data-cat="tools"] .nav-section-title .dot { background: var(--c-tools); }
.sidebar .nav-section[data-cat="communication"] .nav-section-title .dot { background: var(--c-comm); }
.sidebar .nav-section[data-cat="admin"] .nav-section-title .dot { background: var(--c-admin); }

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 9px var(--s-5);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink-soft);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.sidebar .nav-link:hover {
  background: var(--c-soft);
  color: var(--c-ink);
}
.sidebar .nav-link.is-active {
  background: var(--c-soft);
  font-weight: 700;
  color: var(--c-ink);
}
.sidebar .nav-section[data-cat="sales"] .nav-link.is-active { border-left-color: var(--c-sales); }
.sidebar .nav-section[data-cat="kunden"] .nav-link.is-active { border-left-color: var(--c-kunden); }
.sidebar .nav-section[data-cat="tools"] .nav-link.is-active { border-left-color: var(--c-tools); }
.sidebar .nav-section[data-cat="communication"] .nav-link.is-active { border-left-color: var(--c-comm); }
.sidebar .nav-section[data-cat="admin"] .nav-link.is-active { border-left-color: var(--c-admin); }

.sidebar .nav-link .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar .nav-link .baustelle {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 6px;
  background: var(--c-warning);
  color: var(--c-ink);
  border-radius: var(--radius-pill);
}

/* ── Main ───────────────────────────────────────────────────── */

.main {
  padding: var(--s-8);
  overflow-y: auto;
  background: var(--c-soft);
}

.section-header {
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-line);
}

.section-header h1 {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.03em;
  color: var(--c-ink);
  line-height: 1.1;
}

.section-header .subtitle {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-mid);
  margin-top: var(--s-2);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* ── Cards ─────────────────────────────────────────────────── */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line-soft);
  padding: var(--s-6);
  margin-bottom: var(--s-4);
  border-radius: 0;
  transition: border-color 0.12s;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-line-soft);
}
.card-header h3 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--c-ink);
  margin: 0;
}
.card-header .btn.small {
  flex-shrink: 0;
}

/* ── KPI-Stat-Cards ─────────────────────────────────────────── */

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.stat {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  padding: var(--s-5);
  border-left: 4px solid var(--c-accent);
  border-radius: 0;
}
.stat .stat-label {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-mid);
  margin-bottom: var(--s-2);
}
.stat .stat-value {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.03em;
  color: var(--c-ink);
}
.stat .stat-sub { font-size: 12px; color: var(--c-mid); margin-top: var(--s-1); }
.stat.sales { border-left-color: var(--c-sales); }
.stat.kunden { border-left-color: var(--c-kunden); }
.stat.tools { border-left-color: var(--c-tools); }
.stat.comm { border-left-color: var(--c-comm); }

/* ── Tabellen ───────────────────────────────────────────────── */

.table-wrap { background: var(--c-surface); border: 1px solid var(--c-line); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: var(--s-3) var(--s-4); text-align: left; font-size: 13px; }
th {
  background: var(--c-ink);
  color: var(--c-surface);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
tbody tr { border-bottom: 1px solid var(--c-line-soft); }
tbody tr:hover { background: var(--c-soft); }
tbody tr:last-child { border-bottom: none; }

/* ── Mono-Badges (Pille) ────────────────────────────────────── */

.badge {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--c-ink);
  color: var(--c-surface);
}
.badge.outline { background: transparent; color: var(--c-ink); border: 1px solid var(--c-ink); }
.badge.sales { background: var(--c-sales); }
.badge.kunden { background: var(--c-kunden); }
.badge.tools { background: var(--c-tools); }
.badge.comm { background: var(--c-comm); }
.badge.admin { background: var(--c-admin); }
.badge.priority-critical { background: var(--c-danger); }
.badge.priority-high { background: var(--c-accent); }
.badge.priority-medium { background: var(--c-warning); color: var(--c-ink); }
.badge.priority-normal { background: var(--c-mid); }

/* ── Buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border: 1px solid var(--c-ink);
  background: var(--c-ink);
  color: var(--c-surface);
  border-radius: 0;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}
.btn:hover {
  background: #000;
  box-shadow: 0 2px 6px rgba(10, 10, 10, 0.15);
}
.btn:active { box-shadow: none; transform: translateY(1px); }

.btn.secondary {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.btn.secondary:hover {
  background: #D52F3D;
  border-color: #D52F3D;
  box-shadow: 0 2px 6px rgba(230, 57, 70, 0.25);
}

.btn.ghost {
  background: var(--c-surface);
  color: var(--c-ink);
  border-color: var(--c-line);
}
.btn.ghost:hover {
  background: var(--c-soft);
  border-color: var(--c-ink);
  box-shadow: none;
}

.btn.small { padding: 7px 12px; font-size: 11px; }

/* Button-Gruppen mit klarer Hierarchie */
.btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* ── Login ──────────────────────────────────────────────────── */

.login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--c-soft);
}
.login.is-hidden { display: none; }
.login .login-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-top: 4px solid var(--c-ink);
  padding: var(--s-10);
  width: 380px;
}
.login .brand {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: var(--s-8);
}
.login .brand img { height: 48px; margin-bottom: var(--s-3); }
.login .brand .name {
  font-family: var(--f-display); font-weight: 800; font-size: 22px;
  letter-spacing: -0.03em;
}
.login .brand .sub {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--c-mid); margin-top: var(--s-1);
}
.login h2 {
  font-family: var(--f-display); font-weight: 700; font-size: 16px;
  margin-bottom: var(--s-4);
}
.field { margin-bottom: var(--s-4); }
.field label {
  display: block;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-mid);
  margin-bottom: var(--s-2);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--c-line);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.4;
  border-radius: 0;
  background: var(--c-surface);
  color: var(--c-ink);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--c-mid-soft); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--c-mid); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--c-ink);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--c-soft);
  color: var(--c-mid);
  cursor: not-allowed;
}
.field input[required]:invalid:not(:placeholder-shown):not(:focus) {
  border-color: var(--c-accent);
}
.field label {
  margin-bottom: 6px;
}
.login .btn { width: 100%; }
.error-msg {
  background: var(--c-accent-soft);
  border-left: 3px solid var(--c-accent);
  padding: var(--s-3);
  font-size: 13px;
  color: var(--c-danger);
  margin-bottom: var(--s-3);
}

/* ── Baustellen-Hinweis ─────────────────────────────────────── */

.baustelle-banner {
  background: repeating-linear-gradient(
    45deg,
    var(--c-warning),
    var(--c-warning) 8px,
    var(--c-ink) 8px,
    var(--c-ink) 16px
  );
  height: 8px;
  margin-bottom: var(--s-4);
}
.baustelle-content {
  background: var(--c-surface);
  border: 2px dashed var(--c-warning);
  padding: var(--s-8);
  text-align: center;
}
.baustelle-content .icon { font-size: 48px; display: block; margin-bottom: var(--s-3); }
.baustelle-content h2 {
  font-family: var(--f-display); font-weight: 800; font-size: 22px;
  margin-bottom: var(--s-2); color: var(--c-ink);
}
.baustelle-content p {
  font-size: 14px; color: var(--c-mid); max-width: 480px;
  margin: 0 auto var(--s-4);
}
.baustelle-content .phase {
  display: inline-block;
  font-family: var(--f-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  padding: 4px 10px;
  background: var(--c-ink); color: var(--c-warning);
  border-radius: var(--radius-pill);
}

/* ── Tools-Grid ─────────────────────────────────────────────── */

.tools-cat-header {
  display: flex; align-items: center; gap: var(--s-3);
  margin: var(--s-8) 0 var(--s-4);
  padding-bottom: var(--s-2);
  border-bottom: 2px solid var(--c-line);
}
.tools-cat-header:first-child { margin-top: 0; }
.tools-cat-header .dot { width: 12px; height: 12px; }
.tools-cat-header h2 {
  font-family: var(--f-display); font-weight: 800; font-size: 16px;
  letter-spacing: -0.01em;
}
.tools-cat-header[data-cat="sales"] .dot { background: var(--c-sales); }
.tools-cat-header[data-cat="build"] .dot { background: var(--c-tools); }
.tools-cat-header[data-cat="communication"] .dot { background: var(--c-comm); }
.tools-cat-header[data-cat="admin"] .dot { background: var(--c-admin); }

.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-4);
}
.tool-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  padding: var(--s-5);
  border-left: 4px solid var(--c-mid);
  cursor: pointer;
  position: relative;
}
.tool-card[data-cat="sales"] { border-left-color: var(--c-sales); }
.tool-card[data-cat="build"] { border-left-color: var(--c-tools); }
.tool-card[data-cat="communication"] { border-left-color: var(--c-comm); }
.tool-card[data-cat="admin"] { border-left-color: var(--c-admin); }
.tool-card:hover { background: var(--c-soft); }
.tool-card .tool-icon { font-size: 24px; margin-bottom: var(--s-2); }
.tool-card .tool-name {
  font-family: var(--f-display); font-weight: 700; font-size: 14px;
  margin-bottom: var(--s-1); color: var(--c-ink);
}
.tool-card .tool-desc {
  font-size: 12px; color: var(--c-mid); line-height: 1.4;
}
.tool-card .tool-status {
  position: absolute; top: var(--s-3); right: var(--s-3);
  font-family: var(--f-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--radius-pill);
}
.tool-card .tool-status.active { background: var(--c-success); color: var(--c-surface); }
.tool-card .tool-status.planned { background: var(--c-warning); color: var(--c-ink); }
.tool-card .tool-status.in_development { background: var(--c-info); color: var(--c-surface); }

/* ── Utilities ──────────────────────────────────────────────── */

.text-mono { font-family: var(--f-mono); }
.text-mid { color: var(--c-mid); }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.mt-2 { margin-top: var(--s-2); }
.mt-4 { margin-top: var(--s-4); }
.mb-4 { margin-bottom: var(--s-4); }

.loading {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--c-mid); padding: var(--s-8);
  text-align: center;
}

.empty {
  padding: var(--s-12); text-align: center; color: var(--c-mid);
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: 0.15em; text-transform: uppercase;
}
.empty-small {
  padding: var(--s-4); text-align: center; color: var(--c-mid);
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Section-Header mit Actions ─────────────────────────────── */

.section-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s-4);
}
.section-header .header-actions { display: flex; gap: var(--s-2); flex-shrink: 0; }
.section-header .breadcrumb {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--c-mid); margin-bottom: var(--s-2);
}
.section-header .breadcrumb a { color: var(--c-mid); }
.section-header .breadcrumb a:hover { color: var(--c-ink); }
.section-header .breadcrumb .bc-sep { margin: 0 var(--s-2); }

/* ── Clickable Tables ───────────────────────────────────────── */

table.clickable tbody tr { cursor: pointer; transition: background 0.1s; }
table.clickable tbody tr:hover { background: var(--c-soft); }
table.clickable tbody tr:hover td:first-child { border-left: 3px solid var(--c-accent); padding-left: calc(var(--s-4) - 3px); }

/* ── Detail-Views (Lead / Customer / Ticket) ────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--s-5);
}
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.detail-main, .detail-aside { display: flex; flex-direction: column; gap: var(--s-4); }

.detail-rows { display: flex; flex-direction: column; gap: 0; }
.detail-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-line-soft);
  align-items: center;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .detail-label {
  font-family: var(--f-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-mid);
}
.detail-row .detail-value { font-size: 14px; color: var(--c-ink); line-height: 1.4; }
.detail-row .detail-value code {
  font-family: var(--f-mono); font-size: 13px;
  background: var(--c-soft); padding: 2px 6px;
}
.detail-row .detail-value a { color: var(--c-accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.1s; }
.detail-row .detail-value a:hover { border-bottom-color: var(--c-accent); }

.inline-select {
  font-family: var(--f-body);
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  border-radius: 0;
  cursor: pointer;
}
.inline-select:focus { outline: none; border-color: var(--c-ink); }

.prose { line-height: 1.6; color: var(--c-ink); font-size: 14px; }

.package-list { list-style: none; padding: 0; }
.package-list li {
  padding: var(--s-3); border-bottom: 1px solid var(--c-line-soft);
  font-size: 13px;
}
.package-list li:last-child { border-bottom: none; }
.package-list li .badge { margin-left: var(--s-2); }

.contact-card {
  padding: var(--s-3) var(--s-4);
  background: var(--c-soft);
  border-left: 3px solid var(--c-kunden);
  margin-bottom: var(--s-3);
  font-size: 13px;
}
.contact-card:last-child { margin-bottom: 0; }
.contact-card-head {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
  margin-bottom: 4px;
}
.contact-card-head strong { color: var(--c-ink); }
.contact-position {
  font-size: 12px; color: var(--c-mid);
  margin-bottom: var(--s-2);
}
.contact-card .contact-meta {
  font-size: 12px;
  color: var(--c-mid);
  display: flex; flex-direction: column; gap: 2px;
}
.contact-card .contact-meta a { color: var(--c-accent); }

.mini-row {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3); border-bottom: 1px solid var(--c-line-soft);
  font-size: 13px; cursor: pointer;
}
.mini-row:hover { background: var(--c-soft); }
.mini-row:last-child { border-bottom: none; }

/* ── Timeline (Activities) ──────────────────────────────────── */

.timeline { position: relative; padding-left: 0; }
.timeline-item {
  position: relative;
  padding-left: var(--s-5);
  padding-bottom: var(--s-4);
  border-left: 2px solid var(--c-line);
  margin-left: 8px;
}
.timeline-item:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline-marker {
  position: absolute;
  left: -7px; top: 4px;
  width: 12px; height: 12px;
  background: var(--c-accent);
  border: 2px solid var(--c-surface);
  border-radius: 50%;
}
.timeline-content { padding-bottom: var(--s-2); }
.timeline-meta { margin-bottom: var(--s-1); display: flex; gap: var(--s-2); align-items: center; }
.timeline-body { font-size: 13px; line-height: 1.5; color: var(--c-ink); margin-bottom: var(--s-1); }
.timeline-foot { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }

/* ── Workflow-Stepper (Ticket-Detail) ───────────────────────── */

.workflow { display: flex; flex-direction: column; gap: var(--s-2); }
.workflow-step {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  font-size: 13px;
  color: var(--c-mid);
  border-left: 3px solid var(--c-line);
}
.workflow-step .step-dot {
  width: 12px; height: 12px;
  background: var(--c-line);
  border-radius: 50%;
  flex-shrink: 0;
}
.workflow-step.is-done { color: var(--c-ink); border-left-color: var(--c-kunden); }
.workflow-step.is-done .step-dot { background: var(--c-kunden); }
.workflow-step.is-current {
  color: var(--c-ink); font-weight: 700;
  background: var(--c-soft); border-left-color: var(--c-accent);
}
.workflow-step.is-current .step-dot { background: var(--c-accent); }

/* ── Kanban-Board ───────────────────────────────────────────── */

.kanban-board {
  display: grid;
  grid-auto-columns: 260px;
  grid-auto-flow: column;
  gap: var(--s-3);
  overflow-x: auto;
  padding-bottom: var(--s-4);
}
.kanban-col {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  display: flex; flex-direction: column;
  min-height: 400px;
}
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3); border-bottom: 1px solid var(--c-line);
  background: var(--c-soft);
}
.kanban-count {
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  color: var(--c-mid);
}
.kanban-cards {
  flex: 1;
  padding: var(--s-2);
  display: flex; flex-direction: column; gap: var(--s-2);
  min-height: 200px;
}
.kanban-cards.is-drop-target { background: var(--c-soft); outline: 2px dashed var(--c-accent); outline-offset: -2px; }
.kanban-empty { text-align: center; color: var(--c-line); font-size: 24px; padding: var(--s-4); }
.kanban-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-sales);
  padding: var(--s-3);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); transform: translateY(-1px); }
.kanban-card.is-dragging { opacity: 0.5; }
.kanban-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-2); }
.kanban-card-name { font-size: 13px; margin-bottom: 2px; }
.kanban-card-company { font-size: 12px; margin-bottom: var(--s-2); }
.kanban-card-foot {
  display: flex; justify-content: space-between;
  padding-top: var(--s-2); border-top: 1px solid var(--c-line-soft);
  font-size: 11px;
}

/* ── Modal-System ───────────────────────────────────────────── */

.modal { display: none; }
.modal.is-open { display: block; }
.modal .modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
}
.modal .modal-dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-top: 3px solid var(--c-accent);
  width: 90vw; max-width: 680px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  z-index: 1001;
  box-shadow: 0 24px 60px rgba(10, 10, 10, 0.18), 0 4px 12px rgba(10, 10, 10, 0.08);
}
.modal .modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--c-line-soft);
  flex-shrink: 0;
}
.modal .modal-head h3 {
  font-family: var(--f-display); font-weight: 700; font-size: 17px;
  letter-spacing: -0.01em; color: var(--c-ink);
}
.modal .modal-close {
  background: none; border: none; font-size: 24px;
  color: var(--c-mid); cursor: pointer; line-height: 1;
  padding: 4px 8px;
  transition: color 0.1s;
}
.modal .modal-close:hover { color: var(--c-ink); }
.modal .modal-body {
  padding: var(--s-6);
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column;
  gap: var(--s-5);
}
.modal .modal-foot {
  display: flex; justify-content: flex-end; gap: var(--s-3);
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--c-line-soft);
  background: var(--c-soft);
  flex-shrink: 0;
}

/* Form-Sections im Modal */
.form-section {
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-line-soft);
}
.form-section:last-child { padding-bottom: 0; border-bottom: none; }
.form-section-title {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-mid);
  margin: 0 0 var(--s-4) 0;
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-line);
  position: relative;
}
.form-section-title::before {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 24px; height: 1px;
  background: var(--c-accent);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4) var(--s-4);
}
.form-grid .field { margin-bottom: 0; }
.form-grid .field.span-2 { grid-column: 1 / -1; }
.form-grid .field textarea { resize: vertical; min-height: 80px; }

/* ── Projekte ───────────────────────────────────────────────── */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}

.project-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-top: 4px solid var(--area-color, var(--c-kunden));
  padding: var(--s-4);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex; flex-direction: column; gap: var(--s-2);
}
.project-card-phase {
  font-size: 12px;
  color: var(--c-mid);
  background: var(--c-soft);
  padding: 4px 8px;
  border-left: 2px solid var(--area-color, var(--c-accent));
}
.project-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }

.project-card-head { display: flex; justify-content: space-between; gap: var(--s-2); }
.project-card-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--c-ink);
  margin: 0;
}
.project-card-customer {
  font-size: 12px; color: var(--c-mid);
  font-family: var(--f-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.project-card-foot {
  display: flex; justify-content: space-between;
  padding-top: var(--s-2);
  border-top: 1px solid var(--c-line-soft);
  font-size: 12px;
}

/* ── Progress-Bar ───────────────────────────────────────────── */

.progress-bar {
  height: 6px;
  background: var(--c-line);
  border-radius: 0;
  overflow: hidden;
  margin: var(--s-1) 0;
}
.progress-bar-large { height: 12px; margin: var(--s-2) 0 var(--s-3); }
.progress-fill {
  height: 100%;
  background: var(--c-kunden);
  transition: width 0.3s ease;
}
.progress-meta {
  display: flex; justify-content: space-between;
  font-size: 11px;
}
.progress-meta-large {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--c-ink);
  padding-bottom: var(--s-2);
}

.deadline-overdue {
  color: var(--c-danger);
  font-weight: 700;
  font-family: var(--f-mono);
}
.deadline-today {
  color: var(--c-warning);
  font-weight: 700;
  font-family: var(--f-mono);
  background: var(--c-ink);
  padding: 2px 6px;
}

/* ── Task-Item (Projekt-Subtasks) ───────────────────────────── */

.task-item {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3);
  border-bottom: 1px solid var(--c-line-soft);
  transition: opacity 0.15s;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--c-soft); }
.task-item.is-done { opacity: 0.55; }
.task-item.is-done .task-title { text-decoration: line-through; color: var(--c-mid); }

.task-checkbox {
  position: relative;
  display: inline-block;
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}
.task-checkbox input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  cursor: pointer;
  margin: 0;
}
.task-checkbox span {
  position: absolute; inset: 0;
  border: 2px solid var(--c-ink);
  background: var(--c-surface);
  transition: background 0.1s;
}
.task-checkbox input:checked + span {
  background: var(--c-kunden);
  border-color: var(--c-kunden);
}
.task-checkbox input:checked + span::after {
  content: '';
  position: absolute;
  left: 4px; top: 0px;
  width: 6px; height: 11px;
  border: solid var(--c-surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; color: var(--c-ink); margin-bottom: 2px; }
.task-meta {
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--c-mid);
}

/* ── User-Management ────────────────────────────────────────── */
tr.is-inactive td { opacity: 0.55; }
tr.is-inactive td:first-child { border-left: 3px solid var(--c-mid); padding-left: calc(var(--s-4) - 3px); }

/* ── Dashboard-Cockpit ──────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4);
}
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.dash-tasks, .dash-projects { display: flex; flex-direction: column; }
.dash-row {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--c-line-soft);
  cursor: pointer;
}
.dash-row:last-child { border-bottom: none; }
.dash-row:hover { background: var(--c-soft); }
.dash-row-icon {
  width: 28px; height: 28px;
  background: var(--c-line);
  color: var(--c-ink);
  font-family: var(--f-mono);
  font-weight: 700; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-row-icon.is-overdue { background: var(--c-danger); color: #fff; }
.dash-row-icon.project { color: #fff; font-size: 10px; }
.dash-row-body { flex: 1; min-width: 0; }
.dash-row-body strong { display: block; font-size: 13px; }

/* ── Workflow-Board ─────────────────────────────────────────── */

.workflow-cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
}
@media (max-width: 1024px) {
  .workflow-cols { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .workflow-cols { grid-template-columns: 1fr; }
}
.workflow-col {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  min-height: 200px;
  display: flex; flex-direction: column;
}
.workflow-col-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--s-3);
  border-top: 4px solid var(--c-ink);
  border-bottom: 1px solid var(--c-line);
  background: var(--c-soft);
  font-size: 13px;
}
.workflow-cards {
  flex: 1;
  padding: var(--s-2);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.workflow-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--area-color, var(--c-mid));
  padding: var(--s-3);
  cursor: pointer;
  transition: box-shadow 0.1s, transform 0.1s;
  display: flex; flex-direction: column; gap: 4px;
}
.workflow-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); transform: translateY(-1px); }
.workflow-card-head { display: flex; justify-content: space-between; align-items: center; }
.workflow-card strong { font-size: 13px; }

/* ── Phasen-Stepper im Projekt-Detail ───────────────────────── */

.phase-stepper {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: var(--s-1);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
  overflow-x: auto;
}
@media (max-width: 768px) {
  .phase-stepper { grid-auto-flow: row; grid-auto-columns: unset; }
}
.phase-step {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2);
  border-left: 3px solid var(--c-line);
  background: var(--c-soft);
  cursor: pointer;
  transition: background 0.1s;
  min-width: 0;
}
.phase-step:hover { background: var(--c-surface); }
.phase-step.is-done { border-left-color: var(--c-kunden); }
.phase-step.is-current { border-left-color: var(--c-accent); background: var(--c-surface); font-weight: 700; }
.phase-step.is-skipped { opacity: 0.4; }

.phase-step-num {
  width: 28px; height: 28px;
  background: var(--c-line);
  color: var(--c-ink);
  font-family: var(--f-mono);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.phase-step.is-done .phase-step-num { background: var(--c-kunden); color: #fff; }
.phase-step.is-current .phase-step-num { background: var(--c-accent); color: #fff; }
.phase-step-info { min-width: 0; flex: 1; }
.phase-step-info strong {
  display: block; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Phase-Card im Detail */
.phase-card { position: relative; }
.phase-card.phase-done { opacity: 0.7; }
.phase-card.phase-in_progress { border-left: 4px solid var(--c-accent); padding-left: calc(var(--s-5) - 4px); }
.phase-card.phase-pending .phase-tasks { opacity: 0.6; }
.phase-tasks { display: flex; flex-direction: column; margin-bottom: var(--s-3); }

/* ── Service-Katalog ────────────────────────────────────────── */

.service-areas { display: flex; flex-direction: column; gap: var(--s-5); }

.service-area {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-top: 4px solid var(--area-color, var(--c-ink));
}
.service-area-header {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  align-items: center;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-soft);
}
.service-area-code {
  font-family: var(--f-mono);
  font-size: 28px;
  font-weight: 800;
  color: var(--area-color, var(--c-ink));
  letter-spacing: -0.03em;
}
.service-area-name {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  margin: 0;
}
.service-area-desc { font-size: 13px; color: var(--c-mid); margin-top: 2px; }
.service-area-count {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-mid);
}

.service-list { display: flex; flex-direction: column; }
.service-item {
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--c-line-soft);
  cursor: pointer;
  transition: background 0.1s;
}
.service-item:last-child { border-bottom: none; }
.service-item:hover { background: var(--c-soft); }
.service-item-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: 2px; flex-wrap: wrap; }
.service-item-code {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--area-color, var(--c-ink));
  background: var(--c-soft);
  padding: 2px 6px;
  min-width: 30px;
  text-align: center;
}
.service-item-name { font-size: 14px; color: var(--c-ink); }
.service-item-meta { font-size: 11px; color: var(--c-mid); padding-left: 38px; }

/* Phasen-Template-Anzeige */
.phase-template { display: flex; flex-direction: column; }
.phase-template-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-line-soft);
  align-items: center;
}
.phase-template-row:last-child { border-bottom: none; }
.phase-num {
  font-family: var(--f-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-accent);
  background: var(--c-soft);
  padding: 4px 0;
  text-align: center;
}
.phase-info strong { font-size: 14px; }
.phase-days {
  font-size: 12px;
  color: var(--c-mid);
  background: var(--c-soft);
  padding: 2px 8px;
}

/* Was-wir-liefern Liste */
.deliverables-list {
  list-style: none;
  padding: 0;
}
.deliverables-list li {
  padding: var(--s-2) 0;
  padding-left: var(--s-4);
  border-bottom: 1px solid var(--c-line-soft);
  position: relative;
  font-size: 13px;
}
.deliverables-list li:last-child { border-bottom: none; }
.deliverables-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--c-accent);
  font-weight: 700;
}

/* ── Settings ───────────────────────────────────────────────── */
.settings-list { display: flex; flex-direction: column; gap: 0; }
.setting-row {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-line-soft);
  align-items: center;
}
.setting-row:last-child { border-bottom: none; }
.setting-key {
  display: flex; align-items: center; gap: var(--s-2);
  margin-bottom: 2px;
}
.setting-key code {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-ink);
  background: var(--c-soft);
  padding: 2px 6px;
}
.setting-desc { font-size: 13px; color: var(--c-mid); margin-bottom: 2px; }
.setting-updated { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.setting-value {
  display: flex; gap: var(--s-2); align-items: center;
}
.setting-value input[type="text"], .setting-value select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--c-line);
  font-family: var(--f-mono);
  font-size: 13px;
  background: var(--c-surface);
  border-radius: 0;
}
.setting-value input[type="text"]:focus { outline: none; border-color: var(--c-ink); }

@media (max-width: 768px) {
  .setting-row { grid-template-columns: 1fr; gap: var(--s-2); }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE / RESPONSIVE  —  Mobile-first additive Overrides
   Bestehende Desktop-Styles werden NICHT verändert.
   ═══════════════════════════════════════════════════════════════ */

/* ── Sidebar-Toggle (Hamburger) — default versteckt ─────────── */

.sidebar-toggle {
  display: none;
  width: 36px; height: 36px;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--c-mid);
  color: var(--c-surface);
  padding: 0;
  margin-right: var(--s-3);
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: var(--c-surface);
  transition: transform 0.2s, opacity 0.2s;
}
body.sidebar-open .sidebar-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.sidebar-open .sidebar-toggle span:nth-child(2) { opacity: 0; }
body.sidebar-open .sidebar-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Backdrop — default unsichtbar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--topbar-height) 0 0 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 80;
}

/* ── TABLET ≤ 1024px ─────────────────────────────────────────── */

@media (max-width: 1024px) {
  .main { padding: var(--s-5); }
  .section-header h1 { font-size: 24px; }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-3);
  }
  .stat { padding: var(--s-4); }
  .stat .stat-value { font-size: 24px; }

  .project-grid { gap: var(--s-3); }
}

/* ── PHONE ≤ 768px ───────────────────────────────────────────── */

@media (max-width: 768px) {

  /* Body-Padding zur Topbar */
  html, body { font-size: 14px; }

  /* App-Layout: keine Spalten mehr, Sidebar wird Overlay */
  .app.is-active {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
  }

  /* Topbar — kompakter */
  .topbar { padding: 0 var(--s-3); gap: var(--s-2); position: sticky; top: 0; z-index: 90; }
  .sidebar-toggle { display: inline-flex; }

  .topbar .brand img { height: 24px; }
  .topbar .brand .name { font-size: 14px; }
  .topbar .brand .sub { display: none; }

  .topbar .user { display: none; }                /* "Eingeloggt als …" weg */
  .topbar .role-badge { margin-left: 0; font-size: 9px; padding: 2px 6px; }
  .topbar .logout-btn { padding: 4px 8px; font-size: 10px; }

  /* Sidebar — als Drawer (off-screen) */
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: 80vw;
    max-width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }

  /* Main — kompakter */
  .main { padding: var(--s-4); grid-column: 1 / -1; }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-3);
  }
  .section-header h1 { font-size: 20px; letter-spacing: -0.02em; }
  .section-header .subtitle { font-size: 10px; }
  .section-header .header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
  }
  .section-header .header-actions .btn { flex: 1; min-width: 0; }

  /* Stats: 1-2 Spalten je nach Breite */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
  .stat { padding: var(--s-3); border-left-width: 3px; }
  .stat .stat-value { font-size: 22px; }
  .stat .stat-label { font-size: 9px; }

  /* Cards */
  .card { padding: var(--s-4); }
  .card-header h3 { font-size: 13px; }

  /* Detail-Grid stapelt schon ab 1100px */
  .detail-row { grid-template-columns: 110px 1fr; gap: var(--s-2); }
  .detail-row .detail-label { font-size: 9px; }
  .detail-row .detail-value { font-size: 13px; }

  /* Form-Grid: 1 Spalte */
  .form-grid {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }
  .form-grid .field.span-2 { grid-column: 1; }

  /* Modal — fast Vollbild */
  .modal .modal-dialog {
    width: 96vw;
    max-width: 96vw;
    max-height: 92vh;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  .modal .modal-head { padding: var(--s-3) var(--s-4); }
  .modal .modal-head h3 { font-size: 14px; }
  .modal .modal-body { padding: var(--s-4); }
  .modal .modal-foot { padding: var(--s-3) var(--s-4); }

  /* Tabellen: scrollbar + kompakter */
  th, td { padding: var(--s-2) var(--s-3); font-size: 12px; }
  table.clickable tbody tr:hover td:first-child { padding-left: calc(var(--s-3) - 3px); }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .badge { font-size: 9px; padding: 2px 6px; }

  /* Project-Grid: 1 Spalte */
  .project-grid { grid-template-columns: 1fr; }

  /* Kanban: Spalten schmaler, behält horizontal scroll */
  .kanban-board { grid-auto-columns: 240px; }
  .kanban-col { min-height: 300px; }

  /* Login — etwas kleiner */
  .login .login-card {
    width: 92vw;
    max-width: 380px;
    padding: var(--s-6);
  }

  /* Tool-Cards */
  .tools-grid { grid-template-columns: 1fr; }

  /* Workflow-Stepper: kompakter */
  .workflow-step { padding: var(--s-1) var(--s-2); font-size: 12px; }
  .workflow-step .step-dot { width: 10px; height: 10px; }

  /* Baustellen-Banner */
  .baustelle-content { padding: var(--s-5); }
  .baustelle-content .icon { font-size: 32px; }
  .baustelle-content h2 { font-size: 18px; }
}

/* ═══════════════════════════════════════════════════════════════
   PRINT-STYLES — saubere Druck-Ausgabe für Briefings + Checklisten
   ═══════════════════════════════════════════════════════════════ */

@media print {
  /* App-Layout aufbrechen, nur Hauptinhalt */
  .topbar, .sidebar, .sidebar-toggle, .sidebar-backdrop,
  .header-actions, .modal, .baustelle-banner,
  .nav-link, .nav-section { display: none !important; }

  .app.is-active {
    display: block !important;
    grid-template-columns: 1fr !important;
  }
  .main {
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }
  body { background: #fff !important; }

  /* Print-Header (wir injizieren ihn via CSS direkt vor Section-Header) */
  .section-header::before {
    content: 'STRUCTON · Digital Solutions · Briefing';
    display: block;
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #000;
  }

  .section-header {
    page-break-after: avoid;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .section-header h1 {
    font-size: 24px !important;
    color: #000 !important;
  }
  .section-header .subtitle {
    font-size: 11px !important;
  }

  .breadcrumb { display: none !important; }

  /* Inhalte fließend, Hintergründe weg */
  .card, .detail-grid {
    background: #fff !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    box-shadow: none !important;
  }
  .detail-grid { display: block !important; }
  .detail-main, .detail-aside { display: block !important; }
  .detail-aside { margin-top: var(--s-4); }

  .card { margin-bottom: 12px; padding: 12px !important; }
  .card-header { margin-bottom: 8px; padding-bottom: 6px; }
  .card-header h3 { font-size: 13px; color: #000; }

  /* Tabellen */
  table, .table-wrap { background: #fff !important; }
  th { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  td { color: #000 !important; }
  table.clickable tbody tr { cursor: default !important; }

  /* Badges */
  .badge {
    background: #f0f0f0 !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Phasen-Stepper als Tabelle drucken */
  .phase-stepper {
    grid-auto-flow: row !important;
    grid-template-columns: 1fr !important;
    border: 1px solid #000 !important;
    padding: 8px !important;
  }
  .phase-step {
    border-left: 3px solid #000 !important;
    background: #f9f9f9 !important;
    page-break-inside: avoid;
  }
  .phase-step.is-current { background: #ffeee8 !important; }
  .phase-step.is-done .phase-step-num { background: #000 !important; }

  /* Phase-Card mit Aufgaben — am wichtigsten für Druck */
  .phase-card { page-break-inside: avoid; }
  .task-item {
    page-break-inside: avoid;
    border-bottom: 1px dashed #999 !important;
  }
  .task-checkbox span {
    border: 2px solid #000 !important;
    background: #fff !important;
  }
  .task-checkbox input:checked + span {
    background: #000 !important;
  }

  /* Deliverables-Liste */
  .deliverables-list li::before {
    color: #000 !important;
  }

  /* Druckbarer Footer pro Seite */
  @page {
    size: A4;
    margin: 15mm 12mm;
  }

  /* Links nicht unterstreichen (im Print stören sie) */
  a { color: #000 !important; text-decoration: none !important; }

  /* Hide-Print-Helper */
  .no-print { display: none !important; }

  /* Login-View nicht drucken */
  .login { display: none !important; }
}

/* ── SMALL PHONE ≤ 380px (extra eng) ───────────────────────── */

@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
  .section-header h1 { font-size: 18px; }
  .topbar .brand .name { font-size: 12px; }
  .topbar .role-badge { display: none; }   /* role-Badge weg, Logout muss bleiben */
}
