/* ==========================================================================
   Hallonova – Kundenbereich (Demo)
   Baut auf ../assets/css/styles.css auf (Farben, Schrift, Buttons, Tags).
   Hier steht nur, was das App-Layout der Demo zusätzlich braucht.
   ========================================================================== */

:root {
  --sb-w: 256px;
  --sb-bg: #0A0A0B;
  --sb-line: rgba(255, 255, 255, 0.08);
  --sb-text: rgba(255, 255, 255, 0.68);
  --sb-text-2: rgba(255, 255, 255, 0.44);
  --surface-hover: #F9FAFB;
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-sheet: cubic-bezier(.32, .72, 0, 1);
}

body.demo {
  background: var(--sb-bg);
  color: var(--c-text);
}

/* --------------------------------------------------------------------------
   Demo-Hinweis oben
   -------------------------------------------------------------------------- */

.demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 16px;
  background: var(--sb-bg);
  border-bottom: 1px solid var(--sb-line);
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.8125rem;
  line-height: 1.4;
}
.demo-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--c-high-soft);
  color: var(--c-high);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.demo-banner-text { flex: 1; min-width: 0; }
.demo-banner-link {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-weight: 500;
}
.demo-banner-link::after { content: "→"; transition: transform .15s ease; }
.demo-banner-link:hover { color: #fff; }
.demo-banner-link:hover::after { transform: translateX(3px); }

.demo-banner :focus-visible,
.sidebar :focus-visible { outline-color: #fff; }

/* --------------------------------------------------------------------------
   App-Rahmen
   -------------------------------------------------------------------------- */

.app { position: relative; }

.main {
  background: #fff;
  color: var(--c-text);
  outline: none;
}
.view {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 16px 72px;
}

@media (min-width: 900px) {
  body.demo {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .demo-banner { padding: 6px 20px; }
  .app {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--sb-w) minmax(0, 1fr);
  }
  .sidebar { min-height: 0; overflow-y: auto; }
  .main {
    min-height: 0;
    margin: 8px 8px 8px 0;
    border-radius: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .view { padding: 36px 40px 88px; }
}

/* --------------------------------------------------------------------------
   Seitenleiste (auf dem Handy: Leiste oben mit Menü)
   -------------------------------------------------------------------------- */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--sb-bg);
  color: var(--sb-text);
}
.sb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding: 0 16px 0 18px;
  flex: none;
}
.sidebar .logo { font-size: 1.125rem; }
.sidebar .logo svg { width: 24px; height: 24px; }

.sb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}
.sb-toggle svg { width: 18px; height: 18px; }
.sb-toggle:hover { background: rgba(255, 255, 255, 0.06); }

.sb-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 6px 10px 14px;
}
.sb-section { padding: 0 6px; }
.sb-label {
  display: block;
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sb-text-2);
}
.sb-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--sb-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
}
.sb-switch button {
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--sb-text);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.sb-switch button:hover { color: #fff; }
.sb-switch button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.sb-company {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--sb-line);
  border-radius: 10px;
}
.sb-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--c-accent-hover);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.sb-company-text { min-width: 0; }
.sb-company strong {
  display: block;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
}
.sb-company small {
  display: block;
  margin-top: 1px;
  color: var(--sb-text-2);
  font-size: 0.75rem;
  line-height: 1.3;
}

.sb-nav { display: grid; gap: 2px; }
.sb-nav a,
.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--sb-text);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.sb-nav a svg,
.sb-link svg { width: 16px; height: 16px; flex: none; }
.sb-nav a:hover,
.sb-link:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.sb-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.09); color: #fff; }
.sb-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--sb-text-2);
}
.sb-plus {
  margin-left: auto;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sb-text-2);
  line-height: 1.3;
}
.sb-foot {
  margin-top: auto;
  display: grid;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--sb-line);
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  font-size: 0.8125rem;
  color: var(--sb-text);
}
.sb-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
}

@media (min-width: 900px) {
  .sb-toggle { display: none; }
  .sb-bar { height: 64px; padding: 4px 20px 0 22px; }
}

@media (max-width: 899.98px) {
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--sb-line);
  }
  .sb-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 56px);
    max-height: calc(100dvh - 56px);
    overflow-y: auto;
    padding: 12px 16px 20px;
    background: var(--sb-bg);
    border-bottom: 1px solid var(--sb-line);
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.55);
  }
  .sb-panel.is-open { display: flex; }
  .sb-nav a, .sb-link { min-height: 42px; }
  .main { min-height: calc(100vh - 92px); }
}

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

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 24px;
}
.page-head h1 {
  font-size: 1.5rem;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.page-head h1:focus { outline: none; }
.page-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  margin-top: 6px;
  color: var(--c-text-2);
  font-size: 0.9375rem;
}
.page-sub .sep { color: var(--c-border-strong); }

.tag svg { width: 12px; height: 12px; flex: none; }
.tag-icon { width: 22px; padding: 0; justify-content: center; }
.c-status .cell-tags { flex-wrap: nowrap; }
.tag-open { background: #fff; color: var(--c-text-2); border: 1px solid var(--c-border-strong); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.plus-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border: 1px solid rgba(15, 37, 55, 0.14);
  border-radius: 4px;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}
.btn-primary .plus-badge {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

/* --------------------------------------------------------------------------
   Kennzahlen
   -------------------------------------------------------------------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 1180px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 16px 18px 14px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: #fff;
}
.kpi-label { font-size: 0.8125rem; line-height: 1.35; color: var(--c-text-2); }
.kpi-value {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 1.875rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
}
.kpi-meta { font-size: 0.75rem; line-height: 1.4; color: var(--c-text-3); }
.kpi.is-bump .kpi-value { animation: kpi-bump .5s var(--ease-out); }
@keyframes kpi-bump {
  0% { transform: translateY(-4px); opacity: .3; }
  100% { transform: none; opacity: 1; }
}
.kpi-note { margin-top: 10px; font-size: 0.75rem; color: var(--c-text-3); }

@media (max-width: 420px) {
  .kpi { padding: 14px 14px 12px; }
  .kpi-value { font-size: 1.625rem; }
}

/* --------------------------------------------------------------------------
   Werkzeugleiste: Filter und Suche
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 36px 0 12px;
}
.seg {
  display: inline-flex;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: 9px;
  background: var(--c-bg-subtle);
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg-btn,
.radio-seg span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--c-text-2);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.seg-btn:hover,
.radio-seg label:hover span { color: var(--c-text); }
.seg-btn[aria-pressed="true"],
.radio-seg input:checked + span {
  background: #fff;
  color: var(--c-text);
  box-shadow: 0 1px 2px rgba(10, 10, 11, 0.06), 0 0 0 1px var(--c-border);
}
.seg-btn:focus-visible { outline-offset: 0; }
.seg-btn .count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--c-text-3);
}
.seg-btn[aria-pressed="true"] .count { color: var(--c-text-2); }

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  max-width: 280px;
}
.search svg {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--c-text-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: #fff;
  color: var(--c-text);
  font: inherit;
  font-size: 0.875rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search input::placeholder { color: var(--c-text-3); }
@media (max-width: 640px) {
  .search { flex-basis: 100%; max-width: none; }
  .search input { font-size: 1rem; }
}

/* --------------------------------------------------------------------------
   Formularfelder
   -------------------------------------------------------------------------- */

.field-input,
.field-textarea,
.field-select,
.search input {
  -webkit-appearance: none;
  appearance: none;
}
.field-input,
.field-textarea,
.field-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--c-text);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.45;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field-input { height: 38px; }
.field-textarea { min-height: 88px; resize: vertical; }
.field-textarea--sm { min-height: 64px; }
.field-select {
  height: 38px;
  padding-right: 34px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%236B7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 10px center / 14px no-repeat;
  cursor: pointer;
}
.field-select--inline {
  display: inline-block;
  width: auto;
  height: 28px;
  padding: 0 28px 0 8px;
  margin: 0 2px;
  background-position: right 7px center;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  vertical-align: middle;
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus,
.search input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.field-input:disabled {
  background: var(--c-bg-subtle);
  color: var(--c-text-3);
  border-color: var(--c-border);
}
.field-select--time {
  width: 96px;
  height: 34px;
  padding: 0 28px 0 10px;
  background-position: right 8px center;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}
.field-select:disabled {
  background-color: var(--c-bg-subtle);
  color: var(--c-text-3);
  border-color: var(--c-border);
  cursor: not-allowed;
}
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-text);
}
.field-hint { margin-top: 6px; font-size: 0.8125rem; color: var(--c-text-3); }
.field-hint.is-warn { color: var(--c-urgent); }
.field-group { display: grid; gap: 8px; }

@media (max-width: 640px) {
  .field-input, .field-textarea, .field-select { font-size: 1rem; }
}

/* Schalter */
.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  margin: 0;
  border-radius: 999px;
  background: var(--c-border-strong);
  cursor: pointer;
  transition: background-color .18s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 10, 11, 0.25);
  transition: transform .18s var(--ease-out);
}
.switch:checked { background: var(--c-accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: 999px; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--c-text-2);
  cursor: pointer;
}
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--c-accent); }

/* --------------------------------------------------------------------------
   Tabellen (werden in schmalen Containern zu Karten)
   -------------------------------------------------------------------------- */

.table-card,
.panel-card {
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.table-wrap { container-type: inline-size; overflow-x: auto; }
.dt { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.dt th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg-subtle);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  color: var(--c-text-3);
}
.dt td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.dt tbody tr:last-child td { border-bottom: 0; }
.dt .row { cursor: pointer; transition: background-color .12s ease; }
.dt .row:hover { background: var(--surface-hover); }
.dt .row:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
  border-radius: 0;
  background: var(--surface-hover);
}
.dt .row.is-urgent td:first-child { box-shadow: inset 2px 0 0 var(--c-urgent); }

.cell-main { display: block; font-weight: 500; line-height: 1.35; color: var(--c-text); }
.cell-sub { display: block; margin-top: 2px; font-size: 0.8125rem; line-height: 1.35; color: var(--c-text-3); }
.cell-sub.mono { font-family: var(--font-mono); font-size: 0.75rem; }
.cell-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.m-label { display: none; }

.c-time {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--c-text-2);
}
.c-time .time-wrap { display: inline-flex; align-items: center; gap: 6px; }
.after { display: inline-flex; color: var(--c-text-3); }
.after svg { width: 13px; height: 13px; }

.plate {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--c-border-strong);
  border-radius: 4px;
  background: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--c-text);
}
.c-vehicle .cell-sub { margin-top: 4px; }

.empty {
  padding: 40px 16px !important;
  text-align: center;
  font-size: 0.875rem;
  color: var(--c-text-3);
}
.table-foot { margin-top: 10px; font-size: 0.75rem; color: var(--c-text-3); }

/* Anrufe als Karten */
@container (max-width: 680px) {
  .dt-calls thead { display: none; }
  .dt-calls, .dt-calls tbody { display: block; }
  .dt-calls .row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "time urg"
      "concern concern"
      "vehicle vehicle"
      "caller status";
    gap: 8px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--c-border);
  }
  .dt-calls tbody tr:last-child { border-bottom: 0; }
  .dt-calls .row td { display: block; padding: 0; border: 0; }
  .dt-calls .row.is-urgent { box-shadow: inset 2px 0 0 var(--c-urgent); }
  .dt-calls .row.is-urgent td:first-child { box-shadow: none; }
  .dt-calls .c-time { grid-area: time; align-self: center; }
  .dt-calls .c-urg { grid-area: urg; justify-self: end; }
  .dt-calls .c-concern { grid-area: concern; }
  .dt-calls .c-concern .cell-main { font-size: 0.9375rem; }
  .dt-calls .row td.c-vehicle { grid-area: vehicle; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
  .dt-calls .c-vehicle .cell-sub { margin: 0; }
  .dt-calls .c-caller { grid-area: caller; align-self: end; }
  .dt-calls .c-status { grid-area: status; justify-self: end; align-self: end; }
  .dt-calls .c-status .cell-tags { justify-content: flex-end; }
}

.cell-sub.mono, .dt .tag, .c-name { white-space: nowrap; }
.dt .act-cell .btn-row { flex-wrap: nowrap; gap: 6px; justify-content: flex-end; }
.dt .act-cell { text-align: right; }

.j-tag { display: block; }
.last-msg {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--c-text-3);
}
.last-msg svg { width: 12px; height: 12px; flex: none; }
.last-msg.has-msg { color: var(--c-accent); }
.last-msg .mono { font-size: 0.75rem; }

/* Aufträge (SHK) haben viele Spalten: schon früher als Karten */
@container (max-width: 940px) {
  .dt-jobs .j-time { grid-row: 1; grid-column: 1; align-self: center; }
  .dt-jobs .j-status { display: contents; }
  .dt-jobs .j-tag { grid-row: 1; grid-column: 2; justify-self: end; }
  .dt-jobs .last-msg { grid-column: 1 / -1; margin-top: 2px; white-space: normal; }
  .dt-jobs thead { display: none; }
  .dt-jobs, .dt-jobs tbody { display: block; }
  .dt-jobs tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--c-border);
  }
  .dt-jobs tbody tr:last-child { border-bottom: 0; }
  .dt-jobs td { display: block; padding: 0; border: 0; min-width: 0; }
  .dt-jobs .span-2 { grid-column: 1 / -1; }
  .dt-jobs .to-end { justify-self: end; }
  .dt-jobs .m-label { display: inline; margin-right: 6px; font-size: 0.75rem; color: var(--c-text-3); }
  .dt-jobs .act-cell { margin-top: 6px; text-align: left; }
  .dt-jobs .act-cell .btn-row { flex-wrap: wrap; justify-content: flex-start; }
}

/* Weitere Tabellen als Karten */
@container (max-width: 680px) {
  .dt-stack thead { display: none; }
  .dt-stack, .dt-stack tbody { display: block; }
  .dt-stack tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--c-border);
  }
  .dt-stack tbody tr:last-child { border-bottom: 0; }
  .dt-stack td { display: block; padding: 0; border: 0; min-width: 0; }
  .dt-stack .span-2 { grid-column: 1 / -1; }
  .dt-stack .to-end { justify-self: end; }
  .dt-stack .m-label {
    display: inline;
    margin-right: 6px;
    font-size: 0.75rem;
    color: var(--c-text-3);
  }
  .dt-stack .act-cell { margin-top: 6px; text-align: left; }
  .dt-stack .act-cell .btn-row { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .dt-stack .act-cell .btn { flex: 1 1 auto; }
}

/* --------------------------------------------------------------------------
   Karten in den Ansichten
   -------------------------------------------------------------------------- */

.stack { display: grid; gap: 20px; }
.panel-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-border);
}
.panel-card-head h2 { font-size: 0.9375rem; letter-spacing: -0.01em; line-height: 1.35; }
.panel-card-head p { margin-top: 2px; font-size: 0.8125rem; color: var(--c-text-3); }
.panel-card-body { padding: 18px; }

.plus-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
  padding: 16px 18px;
  border: 1px dashed var(--c-border-strong);
  border-radius: 10px;
  background: var(--c-bg-subtle);
}
.plus-banner .plus-badge { margin-top: 2px; flex: none; }
.plus-banner strong { display: block; font-size: 0.9375rem; font-weight: 600; }
.plus-banner p { margin-top: 2px; font-size: 0.875rem; color: var(--c-text-2); }

.note-box,
.service-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.5;
}
.note-box { background: var(--c-accent-soft); color: var(--c-accent); }
.note-box p, .service-note p { color: inherit; }
.note-box svg, .service-note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.service-note {
  margin-bottom: 8px;
  border: 1px solid var(--c-border);
  background: var(--c-bg-subtle);
  color: var(--c-text-2);
}
.service-note strong { color: var(--c-text); }

.flow { display: grid; gap: 12px; }
@media (min-width: 1100px) { .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.flow-step {
  padding: 18px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: #fff;
}
.flow-step .step-num { margin-bottom: 12px; }
.flow-step h3 { font-size: 0.9375rem; margin-bottom: 4px; }
.flow-step p { font-size: 0.875rem; color: var(--c-text-2); }

.two-col { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1180px) { .two-col { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); } }

/* Vorlagen-Editor */
.tpl { display: grid; gap: 20px; }
@media (min-width: 1100px) { .tpl--split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.tpl + .tpl { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--c-border); }
.ph-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--c-text-3);
}
.ph {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: #fff;
  color: var(--c-text-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.ph:hover { border-color: var(--c-text); color: var(--c-text); }
.tpl-note { margin-top: 10px; font-size: 0.75rem; color: var(--c-text-3); }

/* SMS-Vorschau */
.sms-preview {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 12px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-bg-subtle);
}
.sms-to {
  align-self: stretch;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--c-text-3);
}
.sms-bubble {
  max-width: 92%;
  padding: 10px 13px;
  border-radius: 14px 14px 4px 14px;
  background: var(--c-accent);
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sms-meta {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--c-text-3);
}

/* --------------------------------------------------------------------------
   Seitenpanel (Anruf-Details)
   -------------------------------------------------------------------------- */

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 10, 11, 0.32);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.sheet-overlay.is-open { opacity: 1; visibility: visible; transition: opacity .25s ease; }

.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  border-left: 1px solid var(--c-border);
  background: #fff;
  box-shadow: var(--shadow-lg);
  outline: none;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .32s var(--ease-sheet), visibility 0s linear .32s;
}
.sheet.is-open { transform: none; visibility: visible; transition: transform .32s var(--ease-sheet); }
.sheet-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
body.has-sheet { overflow: hidden; }

.sheet-head {
  position: relative;
  flex: none;
  padding: 18px 60px 16px 24px;
  border-bottom: 1px solid var(--c-border);
}
.sheet-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--c-text-3); }
.sheet-head h2 {
  margin-top: 6px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.sheet-head h2:focus { outline: none; }
.sheet-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.icon-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--c-text-2);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--c-bg-subtle); border-color: var(--c-border); color: var(--c-text); }
.icon-btn svg { width: 18px; height: 18px; }

.icon-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--c-text-3);
  cursor: pointer;
}
.icon-btn-sm:hover { background: var(--c-bg-subtle); color: var(--c-text); }
.icon-btn-sm svg { width: 14px; height: 14px; }

.sheet-body {
  flex: 1;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 26px;
  padding: 20px 24px 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet-foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--c-border);
  background: #fff;
}
@media (max-width: 520px) {
  .sheet-head { padding-left: 16px; }
  .sheet-body { padding: 16px 16px 28px; }
  .sheet-foot { padding-left: 16px; padding-right: 16px; }
  .sheet-foot .btn { flex: 1 1 auto; }
}

.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 10px;
}
.sec-head .sec-label { margin-bottom: 0; }
.sec-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-text-3);
}
.sec-label svg { width: 14px; height: 14px; }
.sec-note { font-size: 0.75rem; color: var(--c-text-3); }
.sec-text { font-size: 0.8125rem; color: var(--c-text-2); }

.ai-box {
  padding: 14px 16px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-bg-subtle);
}
.ai-box .sec-label { margin-bottom: 8px; color: var(--c-accent); }
.ai-box p { font-size: 0.9375rem; line-height: 1.55; color: var(--c-text); }

.details {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  margin: 0;
  border-top: 1px solid var(--c-border);
}
.details dt,
.details dd {
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.875rem;
}
.details dt { color: var(--c-text-3); }
.details dd { min-width: 0; overflow-wrap: anywhere; color: var(--c-text); }
.details .mono { font-size: 0.8125rem; }
@media (max-width: 380px) { .details { grid-template-columns: 112px minmax(0, 1fr); } }

.sms-box {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
}
.sms-box .sec-head { margin-bottom: 0; }
.sms-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.sms-actions .link-arrow { font-size: 0.8125rem; }
.sms-box.is-sent { background: #fff; }

.chat { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg--caller { margin-left: auto; align-items: flex-end; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 0.75rem; }
.msg-head .who { font-weight: 600; color: var(--c-text-3); }
.msg--ki .who { color: var(--c-accent); }
.msg-head .ts { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--c-text-3); }
.msg .bubble {
  padding: 9px 13px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: #fff;
  font-size: 0.875rem;
  line-height: 1.5;
}
.msg--ki .bubble { border-top-left-radius: 4px; background: var(--c-bg-subtle); }
.msg--caller .bubble { border-top-right-radius: 4px; }

.notes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.note {
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  font-size: 0.875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.note-meta {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  white-space: normal;
  color: var(--c-text-3);
}
.note-editor { display: grid; gap: 8px; margin-top: 8px; }
.note-editor-actions { display: flex; gap: 8px; }

/* --------------------------------------------------------------------------
   KI-Einstellungen
   -------------------------------------------------------------------------- */

.settings { border-top: 1px solid var(--c-border); }
.set-row {
  display: grid;
  gap: 16px;
  padding: 28px 0;
  border-bottom: 1px solid var(--c-border);
}
@media (min-width: 1100px) {
  .set-row { grid-template-columns: 260px minmax(0, 1fr); gap: 48px; }
}
.set-row h2 { font-size: 1rem; letter-spacing: -0.01em; line-height: 1.35; }
.set-desc { margin-top: 6px; font-size: 0.875rem; color: var(--c-text-2); max-width: 420px; }
.set-body { display: grid; gap: 18px; min-width: 0; max-width: 660px; }

.toggle-list { border: 1px solid var(--c-border); border-radius: 10px; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--c-border);
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-text { min-width: 0; }
.toggle-title { display: block; font-size: 0.9375rem; font-weight: 500; color: var(--c-text); cursor: pointer; }
.toggle-desc { display: block; margin-top: 2px; font-size: 0.8125rem; color: var(--c-text-3); }
.toggle-desc .mono { font-size: 0.75rem; }

.hours { border: 1px solid var(--c-border); border-radius: 10px; }
.hours-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--c-border);
}
.hours-row:last-child { border-bottom: 0; }
.hours-day { width: 84px; font-size: 0.875rem; font-weight: 500; }
.hours-times { display: inline-flex; align-items: center; gap: 8px; }
.hours-times .dash { color: var(--c-text-3); }
.hours-row .check { margin-left: auto; }
@media (max-width: 480px) {
  .hours-day { width: 100%; }
  .hours-row .check { margin-left: 0; }
}

.kw-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.kw {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 0 4px 0 11px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-bg-subtle);
  font-size: 0.8125rem;
}
.kw button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--c-text-3);
  cursor: pointer;
}
.kw button:hover { background: var(--c-border); color: var(--c-text); }
.kw button svg { width: 12px; height: 12px; }
.kw-add { display: flex; gap: 8px; }
.kw-add .field-input { flex: 1; min-width: 0; }
.kw-add .btn { height: 38px; }

.rules { display: grid; gap: 10px; }
.rule-fixed {
  padding: 14px 16px;
  border: 1px solid rgba(154, 52, 18, 0.22);
  border-radius: 10px;
  background: var(--c-urgent-soft);
}
.rule-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 6px;
  color: var(--c-urgent);
}
.rule-head svg { width: 16px; height: 16px; flex: none; }
.rule-head strong { font-size: 0.9375rem; font-weight: 600; }
.rule-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-urgent);
  opacity: .85;
}
.rule-lock svg { width: 12px; height: 12px; }
.rule-fixed p { font-size: 0.875rem; line-height: 1.55; color: var(--c-text); }

.faq-list { display: grid; gap: 12px; }
.faq-item {
  display: grid;
  gap: 8px;
  padding: 12px 14px 14px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
}
.faq-item-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -6px -2px 0; }
.faq-num { font-family: var(--font-mono); font-size: 0.75rem; color: var(--c-text-3); }
.faq-item .field-input { font-weight: 500; }
.set-body > .btn { justify-self: start; }

.radio-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.radio-group legend { padding: 0; }
.radio-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--c-border);
  border-radius: 9px;
  background: var(--c-bg-subtle);
}
.radio-seg label { position: relative; display: inline-flex; }
.radio-seg input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.radio-seg span { font-family: var(--font-mono); padding: 0 14px; }
.radio-seg input:focus-visible + span { outline: 2px solid var(--c-accent); outline-offset: 0; }

.savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--c-border);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
}
.savebar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--c-text-3);
}
.savebar-status.is-dirty { color: var(--c-high); }
.savebar-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.savebar-actions { display: flex; gap: 8px; }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: calc(100% - 32px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--c-text);
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  cursor: default;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .22s var(--ease-out);
}
.toast.is-in { opacity: 1; transform: none; }
.toast-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--c-success);
  color: #fff;
}
.toast-icon svg { width: 11px; height: 11px; }
.toast--warn .toast-icon { background: var(--c-urgent); }
@media (max-width: 640px) {
  .toasts { left: 16px; right: 16px; bottom: 16px; align-items: center; max-width: none; }
  .toast { width: 100%; }
}
/* Bei offenem Seitenpanel: Toast neben das Panel bzw. über die Fußleiste */
@media (min-width: 1000px) {
  body.has-sheet .toasts { right: 500px; }
}
@media (max-width: 999.98px) {
  body.has-sheet .toasts { bottom: 76px; }
}

.noscript {
  margin: 40px 16px;
  padding: 16px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  color: var(--c-text-2);
}
