/* Flowmatic – base app style on top of Bootstrap 5.3 (cards, tables, forms, pills, tiles).
   Colours and the shell (sidebar, top bar) come from theme-app.css. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../vendor/inter/inter-latin-400-normal.da03732a27e1.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../vendor/inter/inter-latin-500-normal.51205681a1ba.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../vendor/inter/inter-latin-600-normal.2ede57db1a3a.woff2") format("woff2"); }

:root {
  --app-bg: #f6f7f9;
  --app-surface: #ffffff;
  --app-border: #e5e8ed;
  --app-border-strong: #d3d8e0;
  --app-text: #0f172a;
  --app-text-2: #475569;
  --app-text-3: #8a94a6;
  --app-accent: #0b5cff;
  --app-accent-hover: #084ad1;
  --app-accent-soft: #e8f0ff;
  --app-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.04);
  --app-radius: 8px;
  --app-radius-lg: 14px;

  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-font-size: 0.875rem;
  --bs-body-color: var(--app-text);
  --bs-body-bg: var(--app-bg);
  --bs-border-color: var(--app-border);
  --bs-border-radius: var(--app-radius);
  --bs-link-color: var(--app-accent);
  --bs-link-color-rgb: 11, 92, 255;
  --bs-link-hover-color: var(--app-accent-hover);
  --bs-primary: var(--app-accent);
  --bs-primary-rgb: 11, 92, 255;
  --bs-secondary-color: var(--app-text-2);
  --bs-emphasis-color: var(--app-text);
}

body { background: var(--app-bg); -webkit-font-smoothing: antialiased; }
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 { font-weight: 600; letter-spacing: -0.01em; }
.text-secondary-app { color: var(--app-text-2) !important; }
.text-muted { color: var(--app-text-3) !important; }

/* --- Buttons ---------------------------------------------------------------- */
.btn { --bs-btn-font-size: 0.875rem; --bs-btn-padding-y: 0.4rem; --bs-btn-padding-x: 0.9rem;
  --bs-btn-border-radius: 10px; --bs-btn-font-weight: 500; }
.btn-sm { --bs-btn-padding-y: 0.2rem; --bs-btn-padding-x: 0.55rem; --bs-btn-font-size: 0.78rem; }
.btn-primary { --bs-btn-bg: var(--app-accent); --bs-btn-border-color: var(--app-accent);
  --bs-btn-hover-bg: var(--app-accent-hover); --bs-btn-hover-border-color: var(--app-accent-hover);
  --bs-btn-active-bg: var(--app-accent-hover); --bs-btn-active-border-color: var(--app-accent-hover); }
.btn-outline-primary { --bs-btn-color: var(--app-accent); --bs-btn-border-color: var(--app-accent);
  --bs-btn-hover-color: var(--app-on-accent, #fff); --bs-btn-hover-bg: var(--app-accent);
  --bs-btn-hover-border-color: var(--app-accent); --bs-btn-active-color: var(--app-on-accent, #fff);
  --bs-btn-active-bg: var(--app-accent-hover); --bs-btn-active-border-color: var(--app-accent-hover); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--app-accent);
  --bs-nav-pills-link-active-color: var(--app-on-accent, #fff); --bs-nav-link-color: var(--app-accent);
  --bs-nav-link-hover-color: var(--app-accent-hover); }
.btn-outline-secondary, .btn-light-app { --bs-btn-color: var(--app-text); --bs-btn-bg: var(--app-surface);
  --bs-btn-border-color: var(--app-border-strong); --bs-btn-hover-color: var(--app-text);
  --bs-btn-hover-bg: #f3f5f8; --bs-btn-hover-border-color: var(--app-border-strong);
  --bs-btn-active-bg: #eceff3; --bs-btn-active-color: var(--app-text); }
.btn-outline-danger { --bs-btn-bg: var(--app-surface); }
.btn i.bi { margin-right: 0.3rem; }

/* --- Forms ---------------------------------------------------------------------- */
.form-control, .form-select { font-size: 0.875rem; border-color: var(--app-border-strong);
  border-radius: 10px; padding: 0.5rem 0.75rem; background-color: var(--app-surface); }
.form-select { padding-right: 2rem; }
.form-control:focus, .form-select:focus { border-color: var(--app-accent);
  box-shadow: 0 0 0 3px rgba(11, 92, 255, 0.15); }
.form-label { font-weight: 500; font-size: 0.8125rem; margin-bottom: 0.3rem; }
.form-text { color: var(--app-text-3); font-size: 0.78rem; }

/* --- Brand + page head -------------------------------------------------------------- */
.app { min-height: 100vh; }
.brand { text-decoration: none; color: var(--app-text); line-height: 1.25; }
.brand .name { display: block; font-weight: 600; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand .sub { display: block; color: var(--app-text-2); font-size: 0.8rem; }
.brand .logo { display: block; max-height: 52px; max-width: 260px; width: auto; margin-bottom: 0.2rem; }
@media (max-width: 767.98px) { .brand .logo { max-height: 40px; max-width: 180px; } }
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0.5rem 0 1.25rem; }
/* Path and page title in the white top bar: small path, the last crumb (span.title) bold. */
.top-crumbs { display: flex; align-items: baseline; gap: 0.4rem; min-width: 0; flex: 1 1 auto;
  white-space: nowrap; overflow: hidden; color: var(--app-text-2); font-size: 0.9rem; }
.top-crumbs a { color: var(--app-text-2); text-decoration: none; flex-shrink: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; }
.top-crumbs a:hover { color: var(--app-text); }
.top-crumbs .bi-chevron-right { font-size: 0.7rem; color: var(--app-text-3); flex-shrink: 0; }
.top-crumbs .title { font-weight: 700; font-size: 1.2rem; line-height: 1.2; letter-spacing: -0.02em;
  color: var(--app-text); min-width: 0; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
  max-width: 100%; }
@media (max-width: 575.98px) {
  /* phone: only the title, the path would not fit */
  .top-crumbs > :not(.title) { display: none; }
  .top-crumbs .title { font-size: 1.05rem; flex-shrink: 1; }
}
.page-head-text { min-width: 0; flex: 1 1 20rem; }
.page-head:has(> .page-head-text:empty):has(> .actions:empty) { display: none; }
.page-head .page-sub { color: var(--app-text-2); margin: 0; max-width: 60rem; }
.page-head .actions { margin-left: auto; display: flex; gap: 0.5rem; flex-wrap: wrap; }

@media (max-width: 767.98px) {
  :root { --bs-body-font-size: 0.9375rem; }
  .btn { --bs-btn-padding-y: 0.5rem; }
}

/* --- Cards & tables -------------------------------------------------------------- */
.card-app { background: var(--app-surface); border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg); box-shadow: var(--app-shadow); }
.card-app > .card-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.85rem 1rem 0.5rem; flex-wrap: wrap; }
.card-app > .card-head h2 { font-size: 0.95rem; margin: 0; }
.card-app > .card-body-app { padding: 0.5rem 1rem 1rem; }

.table-app { --bs-table-bg: transparent; margin: 0; font-size: 0.8125rem; }
.table-app > thead th { font-weight: 500; color: var(--app-text-3); font-size: 0.75rem;
  border-bottom: 1px solid var(--app-border); padding: 0.45rem 0.6rem; white-space: nowrap; }
.table-app > tbody td { padding: 0.55rem 0.6rem; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.table-app > tbody tr:last-child td { border-bottom: 0; }
.table-app > tbody tr:hover td { background: #f8fafc; }
.table-app > thead th a { color: inherit !important; font-weight: 500; }
.table-app > thead th a:hover { color: var(--app-text) !important; text-decoration: none; }
.table-app a { text-decoration: none; font-weight: 500; }
.table-app a:hover { text-decoration: underline; }
.table-app .row-actions { opacity: 0.55; white-space: nowrap; text-align: right; }
.table-app tr:hover .row-actions { opacity: 1; }

.empty-hint { color: var(--app-text-3); padding: 1.25rem 0.25rem; }

/* --- Pills (filters) ---------------------------------------------------------------- */
.pills { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pill { border: 1px solid var(--app-border); border-radius: 999px; padding: 0.18rem 0.7rem;
  color: var(--app-text-2); text-decoration: none; font-size: 0.78rem; background: var(--app-surface); white-space: nowrap; }
.pill:hover { border-color: var(--app-border-strong); color: var(--app-text); }
.pill.active { border-color: var(--app-text); color: var(--app-text); font-weight: 500; }
.pill .count { color: var(--app-text-3); margin-left: 0.25rem; }

/* --- Status dots -------------------------------------------------------------------------- */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 0.4rem;
  vertical-align: 1px; background: #b4b2a9; }
.dot.crit-low { background: #d3d1c7; }
.dot.crit-medium { background: #888780; }
.dot.crit-high { background: #ef9f27; }
.dot.crit-very_high { background: #e24b4a; }
.dot.restore-success, .dot.status-active { background: #639922; }
.dot.restore-partial { background: #ef9f27; }
.dot.restore-failed { background: #e24b4a; }
.dot.restore-none, .dot.status-inactive { background: #b4b2a9; }
.dot.status-draft { background: #ef9f27; }

/* --- Pastel tiles ------------------------------------------------------------------------- */
.tile { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 0.85rem; flex: 0 0 26px; }
.tile-lg { width: 36px; height: 36px; flex-basis: 36px; border-radius: 9px; font-size: 1.05rem; }
.tile-gray { background: #f1efe8; color: #444441; }
.tile-amber { background: #faeeda; color: #854f0b; }
.tile-purple { background: #eeedfe; color: #3c3489; }
.tile-coral { background: #faece7; color: #712b13; }
.tile-teal { background: #e1f5ee; color: #085041; }
.tile-blue { background: #e6f1fb; color: #0c447c; }
.tile-pink { background: #fbeaf0; color: #72243e; }
.tile-green { background: #eaf3de; color: #27500a; }

/* --- Customer detail: section nav + content ----------------------------------------------- */
.detail { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1199.98px) { .detail { grid-template-columns: 210px minmax(0, 1fr); gap: 1rem; } }
.section-nav a .label { line-height: 1.25; }
.section-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 1rem; }
.section-nav a { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.5rem;
  border-radius: var(--app-radius); color: var(--app-text); text-decoration: none; border: 1px solid transparent; }
.section-nav a:hover { background: rgba(0, 0, 0, 0.035); }
.section-nav a.active { background: var(--app-surface); border-color: var(--app-border); font-weight: 500; }
.section-nav .count { margin-left: auto; color: var(--app-text-3); font-size: 0.78rem; font-weight: 400; }
.section-select { display: none; }
@media (max-width: 991.98px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .section-nav { display: none; }
  .section-select { display: block; margin-bottom: 0.75rem; }
}

/* Overview */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
.stat { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.7rem; border: 1px solid var(--app-border);
  border-radius: var(--app-radius); text-decoration: none; color: var(--app-text); background: var(--app-surface); }
.stat:hover { border-color: var(--app-border-strong); }
.stat .num { font-size: 1.05rem; font-weight: 600; line-height: 1.1; }
.stat .lbl { color: var(--app-text-2); font-size: 0.75rem; }
.facts { display: grid; grid-template-columns: 170px minmax(0, 1fr); row-gap: 0.45rem; column-gap: 1rem; margin: 0; }
.facts dt { color: var(--app-text-2); font-weight: 400; }
.facts dd { margin: 0; }
@media (max-width: 575.98px) { .facts { grid-template-columns: minmax(0, 1fr); row-gap: 0.1rem; } .facts dd { margin-bottom: 0.5rem; } }

/* History */
.diff del { color: #a32d2d; text-decoration: line-through; }
.diff ins { color: #3b6d11; text-decoration: none; }
.badge-soft { font-weight: 500; font-size: 0.72rem; padding: 0.2rem 0.5rem; border-radius: 999px; }
.badge-soft.add { background: #eaf3de; color: #27500a; }
.badge-soft.change { background: #f1efe8; color: #444441; }
.badge-soft.delete { background: #fcebeb; color: #791f1f; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 23rem; }

/* Alerts slightly softer */
.alert { border-radius: var(--app-radius); font-size: 0.875rem; }

/* HTMX: fade while loading */
.htmx-request .htmx-dim, .htmx-request.htmx-dim { opacity: 0.55; transition: opacity 150ms; }

/* Focus visibility for keyboard users */
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; }

/* Section nav groups */
.section-nav .nav-group { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--app-text-3); padding: 0.9rem 0.5rem 0.25rem; font-weight: 500; }
.section-nav .nav-group:empty { padding: 0.4rem 0; border-top: 1px solid var(--app-border); margin: 0.5rem 0.5rem 0; }
.section-nav .nav-empty { color: var(--app-text-3); font-size: 0.78rem; padding: 0.25rem 0.5rem; }
.section-nav a.nav-add { color: var(--app-accent); font-size: 0.8rem; padding-left: 0.6rem; }
.section-nav a.nav-add:hover { background: transparent; text-decoration: underline; }

/* Area/service selection (wizard + structure page) */
.structure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.structure-card .card-head { padding-bottom: 0.6rem; }
.structure-card .form-check { padding-left: 0; }
.structure-card .form-check-input { margin-left: 0; flex: 0 0 auto; margin-top: 0.2rem; }

/* Wizard */
.wizard-steps { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-bottom: 1rem; counter-reset: step; }
.wizard-steps a, .wizard-steps span { display: flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.7rem 0.3rem 0.35rem;
  border-radius: 999px; font-size: 0.8rem; color: var(--app-text-3); text-decoration: none; border: 1px solid transparent; }
.wizard-steps .num { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; background: #ece9e4; color: var(--app-text-2); font-size: 0.72rem; font-weight: 600; }
.wizard-steps .done { color: var(--app-text-2); }
.wizard-steps .done .num { background: #eaf3de; color: #27500a; }
.wizard-steps .current { color: var(--app-text); background: var(--app-surface); border-color: var(--app-border); font-weight: 500; }
.wizard-steps .current .num { background: var(--app-accent); color: #fff; }
.formset-row { border-top: 1px solid var(--app-border); padding-top: 0.75rem; margin-top: 0.75rem; }
.formset-row:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }

/* --- Customer list (prototype layout) ---------------------------------------------------- */
.hero { padding: 1.5rem 1.75rem; }
.hero h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 0.3rem; }
.hero p { color: var(--app-text-2); margin: 0; }
.btn-lg-app { --bs-btn-padding-y: 0.55rem; --bs-btn-padding-x: 1.1rem; --bs-btn-font-size: 0.95rem; font-weight: 600; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
/* Five tiles in one row (e.g. vehicle list): a bit smaller */
.kpi-grid.kpi-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.75rem; }
.kpi-grid.kpi-5 .kpi { padding: 0.9rem 1.1rem 1rem; }
.kpi-grid.kpi-5 .kpi .lbl { font-size: 0.8rem; }
.kpi-grid.kpi-5 .kpi .num { font-size: 1.9rem; }
@media (max-width: 991.98px) { .kpi-grid, .kpi-grid.kpi-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { border-radius: var(--app-radius-lg); padding: 1.1rem 1.4rem 1.2rem; border: 1px solid; box-shadow: var(--app-shadow); }
.kpi .lbl { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.35rem; }
.kpi .num { display: block; font-size: 2.2rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.kpi-blue { background: #eef5ff; border-color: #c7dcff; } .kpi-blue .lbl { color: #2f5eb7; } .kpi-blue .num { color: #1a4fd6; }
.kpi-green { background: #ecfbf3; border-color: #b9ecd0; } .kpi-green .lbl { color: #1f7a4d; } .kpi-green .num { color: #0f6b3e; }
.kpi-amber { background: #fdf9e8; border-color: #f2e2a0; } .kpi-amber .lbl { color: #a45a10; } .kpi-amber .num { color: #b45309; }
.kpi-red { background: #fdf1f1; border-color: #f6caca; } .kpi-red .lbl { color: #b42323; } .kpi-red .num { color: #b91c1c; }

.filter-bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem; flex-wrap: wrap; }
.filter-bar input[type=search] { flex: 1 1 18rem; }
.seg { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.seg-item { padding: 0.45rem 0.9rem; border-radius: 10px; background: #eef1f5; color: var(--app-text);
  font-weight: 500; font-size: 0.875rem; cursor: pointer; white-space: nowrap; }
.seg-item:hover { background: #e4e8ee; }
.seg-item.active { background: var(--app-accent); color: #fff; }
.seg-item:focus-within { outline: 2px solid var(--app-accent); outline-offset: 2px; }

.customer-card { display: flex; align-items: center; gap: 1.5rem; padding: 1.1rem 1.4rem; margin-bottom: 0.9rem; }
.customer-card .info { flex: 1; min-width: 0; }
.customer-card h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.25rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.customer-card h3 a { color: var(--app-text); text-decoration: none; }
.customer-card h3 a:hover { color: var(--app-accent); }
.customer-card p { color: var(--app-text-2); margin: 0; }
.customer-card .open { flex: 0 0 auto; }
.progress-app { width: 15rem; flex: 0 0 15rem; }
.progress-app .pct { display: block; text-align: right; font-weight: 600; font-size: 0.9rem; color: var(--app-text-2); margin-bottom: 0.25rem; }
.progress-app .bar { height: 7px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.progress-app .fill { height: 100%; border-radius: 999px; }
.progress-app .fill.complete { background: #10b981; }
.progress-app .fill.partial { background: #2f6bff; }
.progress-app .fill.low { background: #ef4444; }
@media (max-width: 767.98px) {
  .customer-card { flex-wrap: wrap; gap: 0.75rem; }
  .progress-app { flex: 1 1 100%; width: auto; }
  .customer-card .open { width: 100%; }
}
.badge-soft.draft { background: #fdf3e1; color: #8a4b08; }
.dot.status-draft { background: #ef9f27; }

/* Completeness checklist on the customer overview */
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.35rem 1.25rem; }
.checklist li { display: flex; align-items: flex-start; gap: 0.5rem; }
.checklist li.ok i { color: #10b981; }
.checklist li.missing { color: var(--app-text-2); }
.checklist li.missing i { color: #c0c7d2; }
.review-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.7rem 0.9rem;
  background: #f6f7f9; border-radius: 10px; }
.review-row.due { background: #fdf1f1; color: #8f1d1d; }

/* Footer: product + operator */
.brand { display: inline-flex; flex-direction: column; }
.brand:has(.logo) { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 0.6rem; }
.brand:has(.logo) .sub { flex-basis: 100%; }

/* User management */
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--app-accent-soft); color: var(--app-accent);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 600; flex: 0 0 28px; }
tr.text-muted .avatar { background: #eef1f5; color: var(--app-text-3); }
.role-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.6rem; }
.role-option { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.75rem 0.85rem; border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius); cursor: pointer; background: var(--app-surface); }
.role-option input { margin-top: 0.2rem; accent-color: var(--app-accent); }
.role-option:has(input:checked) { border-color: var(--app-accent); box-shadow: 0 0 0 1px var(--app-accent); }

/* Darstellung: previews */
.brand-preview { background: var(--app-bg); }
.pdf-footer-preview { border-top: 1.5px solid; padding-top: 0.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem; font-size: 0.68rem; line-height: 1.35; color: #222; background: #fff; }

/* Messages: compact alerts (py-2), so centre the close button vertically */
.alert-dismissible { padding-right: 2.75rem; }
.alert-dismissible .btn-close { top: 50%; right: 0.5rem; transform: translateY(-50%); padding: 0.5rem; }

/* Area form: icon / colour picker with preview */
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 0.5rem; }
.icon-option, .tint-option { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.6rem 0.3rem;
  border: 1px solid var(--app-border); border-radius: var(--app-radius); cursor: pointer; text-align: center;
  font-size: 0.72rem; color: var(--app-text-2); background: var(--app-surface); margin: 0; }
.icon-option i { font-size: 1.3rem; color: var(--app-text); }
.icon-option:hover, .tint-option:hover { border-color: var(--app-border-strong); }
.icon-option:has(input:checked), .tint-option:has(input:checked) { border-color: var(--app-accent);
  box-shadow: 0 0 0 1px var(--app-accent); color: var(--app-text); }
.icon-option:has(input:focus-visible), .tint-option:has(input:focus-visible) { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.tint-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.5rem; }
.tint-option .tile i { font-size: 0.7rem; }
.area-preview { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem; border-radius: var(--app-radius);
  background: var(--app-bg); margin-bottom: 0.5rem; font-size: 1rem; }
.area-preview.small { font-size: 0.875rem; padding: 0.45rem 0.6rem; }
@media (min-width: 992px) { .preview-sticky { position: sticky; top: 4.5rem; } }
.move-buttons { display: inline-flex; gap: 0.25rem; }
.move-buttons .btn { --bs-btn-padding-x: 0.4rem; --bs-btn-padding-y: 0.1rem; }
.move-buttons .btn:disabled { opacity: 0.3; }
tr:target td { background: var(--app-accent-soft); transition: background 1.5s; }

/* Instance form: one fieldset per capability */
.form-group-app { border-top: 1px solid var(--app-border); padding-top: 0.9rem; margin-top: 0.4rem; }
.form-group-app:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.form-group-app legend { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--app-text-2); margin-bottom: 0.6rem; float: none; }
.dot.crit-none { background: transparent; box-shadow: inset 0 0 0 1px #b4b2a9; }

/* Base types: capability cards and form preview */
.cap-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.5rem; }
.cap-option { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.7rem 0.8rem; margin: 0;
  border: 1px solid var(--app-border); border-radius: var(--app-radius); cursor: pointer; background: var(--app-surface); }
.cap-option .form-check-input { margin-top: 0.2rem; flex: 0 0 auto; }
.cap-option:has(input:checked) { border-color: var(--app-accent); box-shadow: 0 0 0 1px var(--app-accent); }
.preview-group { margin-bottom: 0.7rem; }
.preview-title { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--app-text-2); margin-bottom: 0.3rem; }
.preview-fields { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.preview-fields span { font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--app-bg); border: 1px solid var(--app-border); }

/* Multiple choice as small check cards (e.g. maintenance services) */
.check-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.4rem; }
.check-card { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.5rem 0.7rem; margin: 0;
  border: 1px solid var(--app-border); border-radius: var(--app-radius); cursor: pointer; background: var(--app-surface); }
.check-card .form-check-input { margin-top: 0.15rem; flex: 0 0 auto; }
.check-card:has(input:checked) { border-color: var(--app-accent); box-shadow: 0 0 0 1px var(--app-accent); }
.method-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.6rem; }
.method-cards .check-card { padding: 0.75rem 0.9rem; gap: 0.7rem; }
.app-footer a { color: inherit; }

/* Emergency plan: scenario lists */
.scenario-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--app-border); }
.scenario-row:last-child { border-bottom: 0; }
.scenario-details { border-bottom: 1px solid var(--app-border); padding: 0.55rem 0; }
.scenario-details:last-child { border-bottom: 0; }
.scenario-details summary { cursor: pointer; }

/* Image gallery */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.9rem; }
.gallery-item { margin: 0; overflow: hidden; display: flex; flex-direction: column; }
.gallery-thumb { border: 0; padding: 0; background: #eef1f5; aspect-ratio: 4 / 3; overflow: hidden; cursor: zoom-in; display: block; width: 100%; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 200ms ease; }
.gallery-thumb:hover img { transform: scale(1.03); }
.gallery-item figcaption { padding: 0.55rem 0.7rem 0.6rem; position: relative; min-width: 0; }
.gallery-actions { position: absolute; top: 0.5rem; right: 0.6rem; display: flex; gap: 0.5rem; }
.gallery-actions a { color: var(--app-text-3); }
.gallery-actions a:hover { color: var(--app-text); }
.gallery-item figcaption .fw-semibold { padding-right: 4.2rem; }
.lightbox-content { background: var(--app-surface); }
.lightbox-img { max-width: 100%; max-height: 78vh; object-fit: contain; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); opacity: 0.85; }
.lightbox-nav.prev { left: 0.75rem; } .lightbox-nav.next { right: 0.75rem; }

/* Network topology in the overview (same SVG as in the PDF) */
.topology-web { overflow-x: auto; margin-bottom: 0.75rem; }
.topology-web svg { width: 100%; min-width: 640px; height: auto; display: block; }
.topology-web .topo-link rect { transition: stroke 120ms ease, stroke-width 120ms ease; }
.topology-web .topo-link:hover rect { stroke: var(--app-accent); stroke-width: 2.4; }

/* Non-production instance (INSTANCE_LABEL in .env) */
.instance-banner { background: #f5a623; color: #1d1d1f; text-align: center; font-size: 0.8rem; font-weight: 600; padding: 0.3rem 1rem; letter-spacing: 0.01em; }
.instance-banner .bi { margin-right: 0.3rem; }

/* Decision aid for the BCMS level (emergency wizard, step 1) */
.bcms-guide summary { cursor: pointer; }
.bcms-card { border: 1px solid rgba(0, 0, 0, 0.08); border-radius: 0.75rem; padding: 0.8rem 0.9rem; background: rgba(0, 0, 0, 0.015); }

/* Global search in the header (2026-11-14) */
.header-search { position: relative; display: flex; align-items: center; margin-right: 0.35rem; }
.header-search .bi { position: absolute; left: 0.65rem; color: var(--app-muted, #6b7280); pointer-events: none; font-size: 0.85rem; }
.header-search input { width: 13rem; padding: 0.35rem 0.75rem 0.35rem 1.9rem; border: 1px solid var(--app-border);
  border-radius: 999px; background: var(--app-surface); font-size: 0.875rem; transition: width 0.15s; }
.header-search input:focus { width: 18rem; outline: none; border-color: var(--app-accent); }
@media (max-width: 767.98px) { .header-search input { width: 8rem; } .header-search input:focus { width: 11rem; } }
.search-group + .search-group { margin-top: 1.25rem; }
.search-hit { display: flex; gap: 0.75rem; align-items: baseline; padding: 0.55rem 0; border-bottom: 1px solid var(--app-border); }
.search-hit:last-child { border-bottom: 0; }
.search-hit .what { flex: 1 1 auto; min-width: 0; }
.search-hit .who { flex: 0 0 auto; text-align: right; max-width: 40%; }
.search-hit mark { padding: 0 0.1em; background: #fff3bf; border-radius: 2px; }

/* Dashboard (2026-11-14) */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); gap: 1rem; align-items: start; }
.dash-list { list-style: none; padding: 0; margin: 0; }
.dash-list li { display: flex; gap: 0.75rem; padding: 0.45rem 0; border-bottom: 1px solid var(--app-border); }
.dash-list li:last-child { border-bottom: 0; }
.dash-list .when { flex: 0 0 5.2rem; font-size: 0.8rem; color: var(--app-muted, #6b7280); padding-top: 0.1rem; }
.dash-list li.overdue .when { color: #b91c1c; font-weight: 600; }
.dash-list .what { min-width: 0; }

/* Number plate look (Garagebook): black on white with a thin border, as in the vehicle lists */
.plate { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; padding: 0.05rem 0.4rem 0.05rem 0.55rem; border: 1px solid #1d1d1f; border-left: 4px solid #2a52be; border-radius: 3px; background: #fff; color: #1d1d1f; white-space: nowrap; }

/* PDF preview in a window (#pdf-modal) with the pdf.js view in a frame */
#pdf-modal .pdf-frame { display: block; width: 100%; height: calc(100vh - 9rem); border: 0;
  background: var(--app-bg, #f5f5f7); border-radius: 0 0 var(--app-radius-lg, 12px) var(--app-radius-lg, 12px); }
@media (max-width: 991.98px) { #pdf-modal .pdf-frame { height: calc(100vh - 3.5rem); } }
.pdf-embedded { min-height: 100vh; }

/* Signature pad (delivery note handover on the tablet) */
.signature-pad { position: relative; height: 200px; border: 2px dashed var(--app-border-strong, #b8c2cc); border-radius: 12px; background: #fff; touch-action: none; }
.signature-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; border-radius: 10px; }
.signature-pad.signed { border-style: solid; }
.signature-pad.is-invalid { border-color: #dc3545; }
.signature-pad.is-invalid ~ .signature-missing { display: block; }
.signature-hint { position: absolute; left: 0; right: 0; top: 42%; text-align: center; color: #8a96a3; pointer-events: none; }
.signature-line { position: absolute; left: 6%; right: 6%; bottom: 44px; border-bottom: 1px solid #d5dbe1; pointer-events: none; }
.signature-clear { position: absolute; right: 10px; top: 10px; }
.signature-img { max-height: 70px; max-width: 100%; }

/* Quantity column: the unit has a fixed width so all quantities line up. */
.qty-unit { display: inline-block; min-width: 4.2rem; text-align: left; }
.qty-num { display: inline-block; min-width: 5rem; text-align: right; }

/* Document pages: Beleg | Status over Kunde | Kalkulation; cards in a row share their height. */
.doc-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 992px) { .doc-grid { grid-template-columns: 1fr 1fr; } }
.doc-grid > .card-app { height: 100%; margin-bottom: 0; }

/* collapsible card (<details class="card-app">): closed, the head has equal space above and below */
details.card-app > summary.card-head { cursor: pointer; }
details.card-app:not([open]) > summary.card-head { padding-bottom: 0.85rem; }

/* Customer window: "Kunde wechseln" switches the view to the customer search. */
form:not(.searching) .search-only { display: none; }
form.searching .edit-only { display: none !important; }
.cust-results { max-height: 22rem; overflow-y: auto; }

/* Belegkette (sales/_chain.html): Spalten nach Entstehung, Linien per SVG */
.chain { position: relative; display: flex; gap: 1.6rem; overflow-x: auto; overflow-y: hidden; padding: .25rem .1rem .5rem; }
.chain-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.chain-lines path { fill: none; stroke: var(--bs-secondary-color, #8a8f98); stroke-width: 1.5; opacity: .55; }
.chain-col { display: flex; flex-direction: column; justify-content: center; gap: .75rem; flex: 0 0 auto; }
.chain-node { position: relative; z-index: 1; display: flex; flex-direction: column; width: 10.75rem;
  padding: .5rem .7rem; border: 1px solid var(--bs-border-color); border-left: 4px solid var(--chain-c, #8a8f98);
  border-radius: .6rem; background: var(--bs-body-bg); color: inherit; text-decoration: none; line-height: 1.3; }
a.chain-node:hover { border-color: var(--chain-c); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.chain-node.current { box-shadow: 0 0 0 2px var(--chain-c); }
.chain-node.muted { opacity: .55; }
.chain-node.muted .chain-num { text-decoration: line-through; }
.chain-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--chain-c); font-weight: 600; }
.chain-kind .bi { margin-right: .3rem; }
.chain-num { font-weight: 600; }
.chain-meta { font-size: .78rem; color: var(--bs-secondary-color); }
.kind-quote { --chain-c: #6f42c1; } .kind-order { --chain-c: #0d6efd; } .kind-purchase { --chain-c: #fd7e14; }
.kind-receipt { --chain-c: #b8860b; } .kind-picking { --chain-c: #20c997; } .kind-delivery { --chain-c: #198754; }
.kind-invoice { --chain-c: #d63384; }
.chain-card > summary { list-style: none; cursor: pointer; }
