/* Surv-AI Sales – Design für die Django-Verwaltung.
   Farben als Variablen, damit Hell- und Dunkelmodus dieselben Regeln nutzen. */

html[data-theme="light"],
:root {
  --brand: #c9401c;          /* Knöpfe und Links (dunkleres Logo-Orange, gut lesbar) */
  --brand-strong: #a8340f;
  --brand-accent: #ef562f;   /* Logo-Orange für Flächen, Balken, Akzente */
  --brand-soft: #fff1ec;
  --brand-fg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --text: #18181b;
  --text-muted: #6b6b76;
  --line: #e7e7ea;
  --shadow: 0 1px 2px rgba(24, 24, 27, .05), 0 1px 3px rgba(24, 24, 27, .08);
  --ok: #067647;      --ok-soft: #dcfae6;
  --warn: #b54708;    --warn-soft: #fef0c7;
  --bad: #b42318;     --bad-soft: #fee4e2;
  --info: #175cd3;    --info-soft: #d1e9ff;
  --neutral: #475467; --neutral-soft: #eaecf0;
  --draft: #6941c6;   --draft-soft: #f4ebff;

  --primary: var(--brand);
  --secondary: var(--brand);
  --accent: var(--brand);
  --primary-fg: var(--brand-fg);
  --body-fg: var(--text);
  --body-bg: var(--surface-2);
  --body-quiet-color: var(--text-muted);
  --body-medium-color: var(--text);
  --body-loud-color: var(--text);
  --header-color: var(--text);
  --header-branding-color: var(--text);
  --header-bg: var(--surface);
  --header-link-color: var(--text-muted);
  --breadcrumbs-fg: var(--text-muted);
  --breadcrumbs-link-fg: var(--brand);
  --breadcrumbs-bg: transparent;
  --link-fg: var(--brand);
  --link-hover-color: var(--brand-strong);
  --link-selected-fg: var(--brand-strong);
  --hairline-color: var(--line);
  --border-color: var(--line);
  --darkened-bg: var(--surface-2);
  --selected-bg: var(--brand-soft);
  --selected-row: var(--brand-soft);
  --message-success-bg: var(--ok-soft);
  --message-warning-bg: var(--warn-soft);
  --message-error-bg: var(--bad-soft);
  --button-fg: var(--brand-fg);
  --button-bg: var(--brand);
  --button-hover-bg: var(--brand-strong);
  --default-button-bg: var(--brand);
  --default-button-hover-bg: var(--brand-strong);
  --object-tools-fg: var(--brand-fg);
  --object-tools-bg: var(--brand);
  --object-tools-hover-bg: var(--brand-strong);
  --font-family-primary: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #ff7a52;
    --brand-strong: #ff9b7a;
    --brand-accent: #ff7a52;
    --brand-soft: #3a2119;
    --brand-fg: #141416;
    --surface: #1a1a1d;
    --surface-2: #111113;
    --text: #ececef;
    --text-muted: #a1a1aa;
    --line: #2c2c31;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --ok: #75e0a7;      --ok-soft: #10301f;
    --warn: #fdb022;    --warn-soft: #3a2a0c;
    --bad: #fda29b;     --bad-soft: #3b1514;
    --info: #84caff;    --info-soft: #102a4c;
    --neutral: #c0c6d4; --neutral-soft: #262b3a;
    --draft: #d6bbfb;   --draft-soft: #2c1c4d;
  }
}

html[data-theme="dark"] {
  --brand: #ff7a52;
  --brand-strong: #ff9b7a;
  --brand-accent: #ff7a52;
  --brand-soft: #3a2119;
  --brand-fg: #141416;
  --surface: #1a1a1d;
  --surface-2: #111113;
  --text: #ececef;
  --text-muted: #a1a1aa;
  --line: #2c2c31;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --ok: #75e0a7;      --ok-soft: #10301f;
  --warn: #fdb022;    --warn-soft: #3a2a0c;
  --bad: #fda29b;     --bad-soft: #3b1514;
  --info: #84caff;    --info-soft: #102a4c;
  --neutral: #c0c6d4; --neutral-soft: #262b3a;
  --draft: #d6bbfb;   --draft-soft: #2c1c4d;
}

body { background: var(--body-bg); font-size: 14px; }

/* Kopfzeile */
#header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 32px;
  color: var(--text);
}
#branding #site-name { font-size: 18px; font-weight: 700; }
#branding #site-name a { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark { width: 30px; height: 32px; object-fit: contain; }
.brand-name { letter-spacing: -.01em; }
.brand-name em { font-style: normal; color: var(--brand-accent); }
.brand-sub { color: var(--text-muted); font-weight: 500; margin-left: 2px; }
#branding #site-name a.login-brand { display: inline-flex; align-items: flex-end; gap: 10px; margin-top: 4px; }
.login-brand:hover { text-decoration: none; }
.login-logo { display: block; width: 150px; }
.login-sales { color: var(--text-muted); font-size: 34px; font-weight: 500; line-height: 1; padding-bottom: 2px; }
.login-logo.on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-logo.on-light { display: none; }
  :root:not([data-theme="light"]) .login-logo.on-dark { display: block; }
}
html[data-theme="dark"] .login-logo.on-light { display: none; }
html[data-theme="dark"] .login-logo.on-dark { display: block; }
#user-tools { font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--text-muted); }
#user-tools a { border-bottom: none; color: var(--text-muted); }
#user-tools a:hover { color: var(--brand); text-decoration: none; }
#user-tools button { color: var(--text-muted); }

/* Volle Fensterbreite nutzen, damit Tabellen (z. B. Spalte "Quelle") ohne Scrollen sichtbar sind. */
div.breadcrumbs, #content { box-sizing: border-box; max-width: none; width: 100%; margin-left: 0; margin-right: 0; }
#changelist .changelist-form-container { min-width: 0; flex: 1 1 auto; overflow: visible; }
#changelist .results { overflow-x: visible; }
#result_list th, #result_list td { white-space: normal; overflow-wrap: anywhere; }
#result_list td.field-source, #result_list th.column-source { white-space: nowrap; }
div.breadcrumbs { padding: 14px 32px 0; font-size: 13px; }
div.breadcrumbs a { color: var(--brand); }

#content { padding: 16px 32px 40px; }
#content h1 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 18px; }
#content h2 { color: var(--text); }

/* Karten statt flacher Kästen */
.module, #changelist .changelist-form-container, .inline-group, #content-related .module {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.module h2, .module caption, .inline-group h2 {
  background: transparent;
  color: var(--text);
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  text-transform: none;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.module h2 a, .module caption a { color: var(--text); }
fieldset.module { padding: 0; }
fieldset.module h2.fieldset-heading { margin: 0; padding: 14px 16px; font-size: 13px; font-weight: 700; color: var(--text); background: transparent; border-bottom: 1px solid var(--line); }
fieldset .form-row { padding: 12px 16px; border-bottom-color: var(--line); }

/* Tabellen */
#result_list, .module table { width: 100%; }
#changelist table thead th, thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
#changelist table thead th a { color: var(--text-muted); }
td, th { border-bottom-color: var(--line); padding: 10px 12px; vertical-align: middle; }
/* Unsere generische td-Polsterung überschreibt sonst Djangos eigene Reservierung für das
   "Firma ✏ Ändern"-Label über den Inline-Zeilen (Kontakte-Tabelle) – das Label landet dann über dem
   Eingabefeld statt darüber. Mit mehr Spezifität wiederherstellen. */
.inline-group .tabular tr.has_original td { padding-top: 2em !important; position: relative; }
.inline-group .tabular td.original p { position: absolute; top: 0; left: 0; }
tr:nth-child(odd), .row-form-errors { background: var(--surface); }
tr:nth-child(even) { background: var(--surface); }
#result_list tbody tr:hover { background: var(--surface-2); }
#changelist-filter {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
#changelist-filter h2 { background: transparent; color: var(--text); border-bottom: 1px solid var(--line); }
#changelist-filter li.selected a { color: var(--brand); }
#changelist .actions { background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 10px 12px; }
#toolbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px; }
#changelist-search input[type="text"] { border-radius: 8px; padding: 6px 10px; }

/* Knöpfe */
.button, input[type=submit], input[type=button], .submit-row input, a.button, button {
  border-radius: 8px; font-weight: 600; padding: 9px 16px;
}
.submit-row { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.submit-row a.deletelink { border-radius: 8px; }
.object-tools a:link, .object-tools a:visited {
  border-radius: 999px; padding: 7px 14px; font-size: 12px; font-weight: 600;
  text-transform: none; letter-spacing: 0;
}
.object-tools a.addlink, .object-tools a.viewsitelink, .object-tools a.historylink {
  background-image: none; padding-right: 14px;
}
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number],
input[type=search], textarea, select, .vTextField {
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 7px 10px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

/* Meldungen */
ul.messagelist li {
  border-radius: 10px; margin: 0 0 8px; padding: 12px 16px 12px 40px; font-size: 13px; color: var(--text);
  background-position: 14px 13px;
}
ul.messagelist li.success { background-color: var(--ok-soft); }
ul.messagelist li.warning { background-color: var(--warn-soft); }
ul.messagelist li.error { background-color: var(--bad-soft); }
ul.messagelist li.info { background-color: var(--info-soft); }

/* Status-Abzeichen und Passungs-Balken (aus admin.py) */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--neutral-soft); color: var(--neutral); }
.badge-draft { background: var(--draft-soft); color: var(--draft); }
.score { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.score-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.score-bar span { display: block; height: 100%; border-radius: 999px; }
.score-num { font-variant-numeric: tabular-nums; font-weight: 600; width: 24px; text-align: right; }

/* Dashboard */
.dash { display: grid; gap: 20px; margin-bottom: 32px; }
thead th { white-space: nowrap; }
.dash-hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 24px; border-radius: 16px; color: #fff;
  background:
    radial-gradient(circle at 92% 10%, rgba(239, 86, 47, .55), transparent 45%),
    linear-gradient(120deg, #18181b, #26201d);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: var(--shadow);
}
.dash-hero h1 { color: #fff !important; margin: 0 0 4px !important; font-size: 22px; }
.dash-hero p { margin: 0; opacity: .9; }
.send-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #a1a1aa; margin-right: 8px; vertical-align: 1px; }
.send-status.is-on .send-dot { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); }
.send-status.is-wait .send-dot { background: #fbbf24; }

/* Startseite: „Heute zu tun“ als nummerierte Schritte */
.todo h2 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.todo-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.todo-step {
  display: flex; gap: 14px; margin: 0; padding: 18px; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--brand); border-radius: 12px; box-shadow: var(--shadow);
}
.todo-step.is-done { border-left-color: var(--ok); }
.todo-step.is-done .todo-num { background: var(--ok-soft); color: var(--ok); }
.todo-step.is-urgent { border-left-color: var(--bad); }
.todo-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 700;
}
.todo-body { min-width: 0; flex: 1; }
.todo-body h3 { margin: 4px 0 6px; font-size: 15px; font-weight: 700; color: var(--text); }
.todo-body p { margin: 0 0 10px; }
.todo-hint { color: var(--text-muted); font-size: 12px; }
.todo-button {
  display: inline-block; padding: 9px 16px; border-radius: 10px; background: var(--brand); color: var(--brand-fg) !important;
  font-weight: 600; margin-bottom: 10px;
}
.todo-button:hover { background: var(--brand-strong); text-decoration: none; }
.todo-button.is-quiet { background: var(--surface-2); color: var(--text) !important; border: 1px solid var(--line); margin-bottom: 0; }
.todo-button.is-quiet:hover { border-color: var(--brand); background: var(--surface-2); }
.todo-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; font-size: 13px; }
.funnel-stock { margin: 14px 0 0; color: var(--text-muted); font-size: 13px; }
.today-supply { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; padding: 10px 12px;
  border: 1px solid var(--brand); border-radius: 8px; }
.today-supply form { margin: 0; }
.funnel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); }
.funnel h2 { margin: 0 0 14px; font-size: 14px; font-weight: 700; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 48px; align-items: center; gap: 12px; margin: 8px 0; }
.funnel-label { color: var(--text-muted); font-weight: 600; font-size: 13px; }
.funnel-track { height: 10px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.funnel-track span { display: block; height: 100%; border-radius: 999px; background: var(--brand-accent); min-width: 2px; }
.funnel-note { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); }
.funnel-count { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Startseite */
.dashboard #content { width: auto; }
.dashboard #content-main { width: 100%; float: none; }
#recent-actions-module { display: none; }

/* Anmeldeseite */
.login #container {
  border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(16, 24, 40, .12);
  background: var(--surface); overflow: hidden;
}
.login #header { justify-content: center; padding: 22px 20px 16px; }
.login #branding #site-name { width: 100%; text-align: center; }
.login #header { position: relative; }
.login #header .theme-toggle { position: absolute; top: 14px; right: 14px; }
.login #content { padding: 20px 28px 28px; }
.login .submit-row { border: none; background: transparent; padding: 0; }
.login .submit-row input { width: 100%; }

@media (max-width: 767px) {
  #header, div.breadcrumbs, #content { padding-left: 16px; padding-right: 16px; }
  .funnel-row { grid-template-columns: 110px 1fr 40px; }
  .dash .module { overflow-x: auto; }
}

/* Nachrichten-Text (Entwurf/Antwort): groß, luftig, gut lesbar */
textarea.message-text, input.message-text {
  width: 100%; max-width: none; flex: 1 1 auto; min-width: 0; box-sizing: border-box; padding: 16px 18px;
  font-family: inherit; font-size: 1.0625rem; line-height: 1.65; white-space: pre-wrap;
}
input.message-text { padding: 10px 18px; }

/* Kanal-Regel hinzufügen: Länder/Kanäle als Ankreuz-Raster statt einer langen Spalte */
#id_countries, #id_channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; max-width: 1000px; }
#id_countries label, #id_channels label { display: flex; align-items: center; gap: 6px; font-weight: normal; width: auto; padding: 0; }

/* Freigabe-Ansicht „Entwürfe prüfen“: links Firma/Kontakt, rechts der Text */
.sa-review-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sa-review-head h1 { margin: 0; }
.sa-review-title { display: flex; align-items: center; gap: 14px; }
.sa-review-nav { display: flex; gap: 6px; }
.sa-review-nav a.button { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 34px; padding: 0 10px; font-size: 22px; line-height: 1; text-decoration: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.sa-review-nav a.button:hover, .sa-review-nav a.button:focus { border-color: var(--brand); background: var(--surface); color: var(--text); }
.sa-review-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sa-review-filter label { font-weight: 600; color: var(--text-muted); }
.sa-review { display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; gap: 20px; align-items: start; }
.sa-review-side { display: grid; gap: 14px; min-width: 0; }
.sa-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
  box-shadow: var(--shadow); color: var(--text); overflow-wrap: anywhere;
}
.sa-card h2 {
  margin: 0 0 8px; padding: 0; background: none; font-size: 12px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
}
.sa-card h3 { margin: 12px 0 4px; font-size: 13px; font-weight: 700; color: var(--text); }
.sa-card p { margin: 0 0 6px; line-height: 1.5; }
.sa-card-title { font-size: 16px; font-weight: 700; }
.sa-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 0; }
.sa-card dt { color: var(--text-muted); font-weight: 600; }
.sa-card dd { margin: 0; min-width: 0; }
.sa-muted { color: var(--text-muted); font-size: 12px; margin-top: 10px !important; }
.sa-review-switch { display: grid; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.sa-review-switch label { font-weight: 600; }
.sa-review-switch select { width: 100%; max-width: 100%; box-sizing: border-box; }
.sa-review-head select, .sa-review-switch select { height: auto; line-height: 1.4; }
#sa-review-body { min-height: 26em; }
.sa-review-fact {
  margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--info-soft); color: var(--text);
  border-left: 3px solid var(--info); line-height: 1.5;
}
.sa-review-warning {
  margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--bad-soft); color: var(--bad);
  border-left: 3px solid var(--bad); line-height: 1.5;
}
.sa-review-main { min-width: 0; }
.sa-review-step { margin: 0 0 10px; }
.sa-review-step .badge { font-size: 13px; padding: 5px 12px; }
.sa-review-previous {
  margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--neutral-soft); color: var(--text);
}
.sa-review-previous summary { cursor: pointer; font-weight: 600; color: var(--text-muted); }
.sa-review-previous-subject { margin: 10px 0 4px; font-weight: 700; }
.sa-review-previous-body { line-height: 1.5; overflow-wrap: anywhere; }
#sa-review-form { display: grid; gap: 6px; }
#sa-review-form label { font-weight: 600; color: var(--text-muted); margin-top: 6px; }
.sa-review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sa-review-actions button, .sa-review-switch button { border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.sa-review-actions button:hover, .sa-review-switch button:hover { border-color: var(--brand); }
.sa-review-actions button.default { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.sa-review-actions button.default:hover { background: var(--brand-strong); }
.sa-review-actions button.sa-danger { margin-left: auto; color: var(--bad); border-color: var(--bad-soft); }
.sa-review-actions button.sa-danger:hover { background: var(--bad-soft); }
.sa-review-empty {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; text-align: center;
  box-shadow: var(--shadow); color: var(--text);
}
.sa-review-empty-title { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
@media (max-width: 900px) {
  .sa-review { grid-template-columns: 1fr; }
  .sa-review-actions button.sa-danger { margin-left: 0; }
}

/* Freigabe-Ansicht: „Bessere Adresse gefunden?“ */
.sa-review-newaddress { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.sa-review-newaddress summary { font-weight: 600; cursor: pointer; }
.sa-review-newaddress .sa-review-switch { margin-top: 8px; padding-top: 0; border-top: 0; }
.sa-review-newaddress input[type=email], .sa-review-newaddress input[type=text] { width: 100%; max-width: 100%; box-sizing: border-box; }

/* Freigabe-Ansicht: Vorschläge der Ansprechpartner-Suche unter „Anderen Kontakt nehmen“ */
.sa-review-suggestions { margin: 2px 0 4px; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.sa-review-suggestions strong { color: var(--text); }

/* Menüleiste unter dem Logo (templates/admin/_topnav.html): tägliche Arbeit links, Einstellungen/System aufklappbar. */
#header { flex-wrap: wrap; row-gap: 10px; }
.sa-nav { flex-basis: 100%; order: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 14px; }
.sa-nav-group { display: flex; flex-wrap: wrap; gap: 2px; padding-right: 18px; border-right: 1px solid var(--line); }
.sa-nav a, .sa-nav summary {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px;
  color: var(--text); font-weight: 500; text-decoration: none; cursor: pointer;
}
.sa-nav a:hover, .sa-nav summary:hover { background: var(--surface-2); color: var(--brand); text-decoration: none; }
.sa-nav a.is-current, .sa-nav summary.is-current { background: var(--brand-soft); color: var(--brand-strong); }
.sa-nav summary { list-style: none; }
.sa-nav summary::-webkit-details-marker { display: none; }
.sa-nav summary::after { content: "▾"; font-size: 11px; color: var(--text-muted); }
.sa-nav-menu { position: relative; }
.sa-nav-dropdown {
  position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; min-width: 220px; padding: 6px;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(24, 24, 27, .12);
}
.sa-nav-dropdown a { display: block; }
.sa-badge {
  min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--brand); color: var(--brand-fg);
  font-size: 11px; font-weight: 700; line-height: 16px; text-align: center;
}
@media (max-width: 1024px) {
  /* Djangos responsive.css stellt die Kopfzeile hier auf Spalten um: Breite statt flex-basis. */
  .sa-nav { flex-basis: auto; width: 100%; }
}
@media (max-width: 767px) {
  .sa-nav { gap: 2px 8px; }
  .sa-nav-group { border-right: none; padding-right: 0; }
}

/* Zefix-Suche: Kantone als kompakte Häkchen-Reihe */
#id_cantons { display: flex; flex-wrap: wrap; gap: 4px 14px; max-width: 640px; }
#id_cantons > div { margin: 0; }
#id_cantons label { display: inline; width: auto; padding: 0; float: none; font-weight: normal; }

/* Freigabe-Ansicht: Kontakt direkt bearbeiten („✎ Bearbeiten“) */
.sa-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sa-card-head h2 { margin-bottom: 8px; }
.sa-link-button { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--brand); cursor: pointer; }
.sa-link-button:hover { text-decoration: underline; }
.sa-contact-edit { margin-top: 0; padding-top: 0; border-top: 0; }
.sa-contact-edit input[type=email], .sa-contact-edit input[type=text] { width: 100%; max-width: 100%; box-sizing: border-box; }
.sa-contact-edit input[readonly] { opacity: .6; }
.sa-contact-edit-actions { display: flex; gap: 8px; margin-top: 6px; }
.sa-card [hidden] { display: none !important; }
