/* ============================================================
   design2.css — Runde B ("Leitstand") als Override-Schicht.
   Wird in workspace2.html NACH dem seiteneigenen <style>-Block
   geladen und überschreibt Variablen + Kernbausteine.
   Das Markup bleibt unangetastet — dadurch kann workspace2.html
   parallel zum unveränderten workspace.html laufen.
   ============================================================ */

/* ---- Palette: die Seite hängt an diesen Variablen ---------- */
:root {
  --bg:        #F5F4F2;
  --surface:   #FFFFFF;
  --border:    rgba(16,32,27,.10);
  --border-md: rgba(16,32,27,.22);
  --text:      #1C1B18;
  --muted:     #56655F;
  --hint:      #8A968F;
  --accent:    #33302A;              /* Stein: Anthrazit */

  --green:     #33302A;  --green-bg:  #EAE7E1;  --green-bdr: #6FC2AE;  --green-text: #211F1B;
  --blue:      #1C5FA8;  --blue-bg:   #E2EDF9;  --blue-bdr:  #8AB2DE;  --blue-text:  #17497F;
  --red:       #B23524;  --red-bg:    #FBE9E5;
  --orange:    #A85E00;  --orange-bg: #FBEFDC;  --orange-text:#7E4700;

  --r-sm: 7px;  --r-md: 12px;  --r-lg: 12px;
  --radius: 12px; --radius-sm: 7px; --radius-md: 7px; --radius-lg: 12px;

  --nacht:       #F1EFEB;   /* Stein: helle warme Fläche (Bühnen/Topbar) */
  --nacht-hoch:  #E9E6E1;
  --nacht-linie: rgba(28,27,24,.14);
  --nacht-text:  #1C1B18;
  --nacht-matt:  #726E66;
  --leucht:      #33302A;   /* Stein: Anthrazit-Akzent */

  --fm-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --fm2-inhaltsbreite: min(1560px, calc(100vw - 48px));
}

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  background: var(--bg);
}

/* ---- Dunkler Kopf (app-header.js liefert das Markup) ------- */
.apphdr-topbar {
  background:
    radial-gradient(900px 300px at 12% -80%, rgba(28,27,24,.05), transparent 60%),
    var(--nacht) !important;
  border-bottom: 1px solid var(--nacht-linie) !important;
}
.apphdr-topbar-title { color: var(--nacht-text) !important; }
.apphdr-topbar-left img { filter: brightness(0) invert(1); opacity: .92; }

/* Navigation im Kopf */
.apphdr-topbar .apphdr-btn,
.apphdr-topbar a {
  color: var(--nacht-matt) !important;
  border-color: transparent !important;
  background: transparent !important;
}
.apphdr-topbar .apphdr-btn:hover,
.apphdr-topbar a:hover { color: var(--nacht-text) !important; background: var(--nacht-hoch) !important; }

/* Suchfeld dunkel */
.apphdr-suche-feld {
  background: var(--nacht-hoch) !important;
  border-color: var(--nacht-linie) !important;
}
.apphdr-suche-feld:focus-within { border-color: var(--leucht) !important; background: var(--nacht-hoch) !important; }
.apphdr-suche-feld svg { color: var(--nacht-matt) !important; }
.apphdr-suche-input { color: var(--nacht-text) !important; }
.apphdr-suche-input::placeholder { color: var(--nacht-matt) !important; }
.apphdr-suche-kbd {
  color: var(--nacht-matt) !important;
  border-color: var(--nacht-linie) !important;
  background: transparent !important;
}
.apphdr-suche-reset {
  background: var(--nacht-hoch) !important;
  border-color: var(--nacht-linie) !important;
  color: var(--nacht-text) !important;
}
/* Antwort-Panel bleibt hell — dort wird gelesen */
.apphdr-suche-panel { border-radius: 12px !important; }

/* Avatar/Glocke im Kopf */
.apphdr-topbar-right svg { color: var(--nacht-matt) !important; }
.apphdr-topbar-right .apphdr-btn:hover svg { color: var(--nacht-text) !important; }

/* ---- Tab-Leiste --------------------------------------------- */
.tabs { border-bottom-color: var(--border) !important; }
.tab-btn {
  font-weight: 500 !important;
  color: var(--muted) !important;
}
.tab-btn.active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
}

/* ---- Karten ------------------------------------------------- */
.card {
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 2px rgba(16,32,27,.05) !important;
}
.card-title { letter-spacing: -.01em; }

/* ---- Schaltflächen ------------------------------------------ */
.btn {
  border-radius: 7px !important;
  font-weight: 500 !important;
  transition: background .13s, border-color .13s !important;
}
.btn-primary, .btn.btn-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.btn-primary:hover { background: #211F1B !important; border-color: #211F1B !important; }

/* ---- Eingaben ----------------------------------------------- */
input[type="text"], input[type="search"], input[type="email"], input[type="date"],
input[type="number"], input[type="password"], select, textarea {
  border-radius: 7px !important;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px #EAE7E1 !important;
  outline: none !important;
}

/* ---- HAIDs und Zahlen: Mono, gleich breite Ziffern ---------- */
#resHaid, .haid-mono,
td[data-haid], .obj-haid {
  font-family: var(--fm-mono) !important;
  font-variant-numeric: tabular-nums;
  font-weight: 500 !important;
  letter-spacing: -.01em;
}
#resHaid {
  background: #33302A; color: #F4F2EE;
  padding: 2px 10px;
  border-radius: 6px;
  display: inline-block;
  font-size: 14px !important;
}

/* ---- Tabellen ----------------------------------------------- */
table thead th {
  font-size: 10.5px !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
  font-weight: 600 !important;
  color: var(--hint) !important;
  background: #E6EAE8 !important;
}
table tbody tr { border-left: 3px solid transparent; }
table tbody tr:hover {
  background: #EAE7E1 !important;
  border-left-color: var(--accent);
}

/* ---- Status-Chips: Punkt vorweg ----------------------------- */
.status-badge, .chip, [class*="statusChip"] {
  border-radius: 5px !important;
  font-weight: 500 !important;
}

/* ---- Modale ------------------------------------------------- */
.modal-content, .lifecycle-modal-box, [class*="modal-box"] {
  border-radius: 12px !important;
  box-shadow: 0 20px 50px rgba(14,21,18,.25) !important;
}

/* ---- Kleinigkeiten ------------------------------------------ */
::selection { background: #B7E6DA; }
a { color: var(--accent); }
.field-label {
  font-size: 10.5px !important;
  letter-spacing: .07em !important;
  text-transform: uppercase !important;
  font-weight: 600 !important;
  color: var(--hint) !important;
}

/* ============================================================
   Ausbaustufe 2: Bühne, Prozessleisten, Chips in B-Palette
   ============================================================ */

/* ---- Dunkle Bühne unter dem Kopf ---------------------------- */
.fm2-buehne {
  background:
    radial-gradient(900px 300px at 12% -80%, rgba(28,27,24,.05), transparent 60%),
    var(--nacht);
  color: var(--nacht-text);
  padding: 24px 0 64px;
  margin-bottom: -44px;          /* der Inhalt schiebt sich hinein */
}
.fm2-buehne-innen { max-width: var(--fm2-inhaltsbreite); margin: 0 auto; padding: 0 24px; }
.fm2-buehne h1 {
  margin: 0; font-size: 25px; font-weight: 600; letter-spacing: -.025em;
}
.fm2-unter { color: var(--nacht-matt); font-size: 13px; margin-top: 5px; }
.fm2-unter b { color: var(--leucht); font-weight: 500; font-family: var(--fm-mono); }

/* Erste Karte bekommt Schatten, damit der Übergang trägt */
.page > #mainPanel > .card:first-of-type,
.page > .card:first-of-type {
  box-shadow: 0 8px 28px rgba(14,21,18,.14) !important;
}

/* ---- Prozessleiste in den Status-Chips ---------------------- */
.fm2-lauf { display: inline-flex; gap: 2.5px; margin-right: 9px; vertical-align: middle; }
.fm2-lauf i {
  width: 14px; height: 4px; border-radius: 2px;
  background: rgba(16,32,27,.14); display: inline-block;
}
.fm2-lauf i.ok  { background: var(--green); }
.fm2-lauf i.akt { background: var(--blue); box-shadow: 0 0 0 2px var(--blue-bg); }
.fm2-lauf i.err { background: var(--red); }

/* ---- Status-Chips: B-Palette statt Alt-Farben --------------- */
.status-chip {
  border-radius: 6px !important;
  font-weight: 500 !important;
  border-width: 1px !important;
}
.status-chip.tone-grey  { background: #E6EAE8 !important; color: #56655F !important; border-color: rgba(16,32,27,.14) !important; }
.status-chip.tone-teal  { background: var(--blue-bg) !important; color: var(--blue-text) !important; border-color: var(--blue-bdr) !important; }
.status-chip.tone-green { background: var(--green-bg) !important; color: var(--green-text) !important; border-color: var(--green-bdr) !important; }
.status-chip.tone-coral { background: var(--red-bg) !important; color: var(--red) !important; border-color: #E0A79E !important; }

/* ---- Einheitliche Inhaltsbreite über alle Tabs --------------
   Das Original schaltet je Tab zwischen 900px und voller Breite
   (page-fullwidth bei Übersicht/Mehrfach/Prio). Mit der Bühne
   erzeugt der Wechsel sichtbare Sprünge — hier fluchtet alles
   auf der Bühnenlinie von 1120px. ---------------------------- */
.page,
.page.page-fullwidth {
  max-width: var(--fm2-inhaltsbreite) !important;
  padding: 0 24px !important;
  box-sizing: border-box;
}

/* ============================================================
   Objektansicht: Drei-Zonen-Layout
   ============================================================ */
/* War die Ursache des Abschneidens beim ersten Versuch: */
#result { overflow: visible !important; }

/* ---- ① Kopf: Hero + GP-Banner + Chips + Stammdaten --------- */
.fm2-kopf { padding: 0 !important; overflow: visible; }
.fm2-hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 18px 22px 4px;
}
.fm2-hero-haid {
  font-family: var(--fm-mono); font-size: 17px; font-weight: 500;
  background: #33302A; color: #F4F2EE;
  padding: 4px 12px; border-radius: 7px; letter-spacing: -.01em;
}
.fm2-hero-adr b { font-size: 16px; font-weight: 600; display: block; }
.fm2-hero-adr span { color: var(--hint); font-size: 12.5px; }

/* GP-Banner in den Kopf integrieren: Karte-im-Karte-Optik weg */
.fm2-kopf #gpBanner {
  margin: 10px 22px 0 !important;
  background: var(--feld, #F2F4F3) !important;
  border-left-width: 3px !important;
  padding: 10px 14px !important;
}
/* Chips + Stammdaten-Karte einbetten */
.fm2-kopf .status-chips { padding: 12px 22px 0; margin: 0 !important; }
.fm2-kopf .card {
  border: 0 !important; box-shadow: none !important;
  border-top: 1px solid var(--linie, rgba(16,32,27,.10)) !important;
  border-radius: 0 !important; margin: 14px 0 0 !important;
}

/* ---- ② Aktionszeile: AKP + Gesamtdoku groß ------------------ */
.doku-grid {
  display: grid !important; grid-template-columns: 1fr 1fr;
  gap: 14px; margin: 14px 0 !important;
}
@media (max-width: 900px) { .doku-grid { grid-template-columns: 1fr; } }
.doku-box {
  background: var(--surface) !important;
  border: 1px solid var(--linie, rgba(16,32,27,.10)) !important;
  border-left: 3px solid var(--accent) !important;
  border-radius: 12px !important;
  padding: 18px 20px !important;
  box-shadow: 0 1px 2px rgba(16,32,27,.05);
}
.doku-box-title { font-size: 15px !important; font-weight: 600 !important; margin-bottom: 6px; }
.doku-status { font-size: 13px !important; margin-bottom: 10px; }
.doku-box .upload-area { padding: 20px 14px !important; border-radius: 9px !important; }
.doku-actions .btn { width: 100%; justify-content: center; padding: 10px 14px !important; }

/* ---- ③ Arbeitsbereich: zwei Spalten ------------------------- */
.fm2-spalten {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  gap: 0 14px; align-items: start;
}
.fm2-links, .fm2-rechts { min-width: 0; }
.fm2-rechts .card { padding: 14px 16px; }
.fm2-rechts .card-title, .fm2-rechts .card .card-title { font-size: 13.5px; }
@media (max-width: 1150px) {
  .fm2-spalten { display: flex; flex-direction: column; }
  .fm2-rechts { order: 2; } .fm2-links { order: 1; }
}

/* ---- Klappbares Aufmaß -------------------------------------- */
.fm2-klappbar .card-title { margin-bottom: 0 !important; cursor: default; }
.fm2-klappbar:not(.fm2-zu) .card-title { margin-bottom: .75rem !important; }
.fm2-klappbar.fm2-zu > *:not(.card-title) { display: none !important; }

/* ---- Kopf unten: Stammdaten + Ansprechpartner nebeneinander - */
.fm2-kopf-unten {
  display: grid; grid-template-columns: minmax(0, 1fr) 430px;
  gap: 0 8px; align-items: start;
  border-top: 1px solid var(--linie, rgba(16,32,27,.10));
  margin-top: 14px;
}
.fm2-kopf-unten .card { border-top: 0 !important; margin-top: 0 !important; }
.fm2-kopf-unten .card:last-child {
  border-left: 1px solid var(--linie, rgba(16,32,27,.10)) !important;
}
.fm2-kopf-unten .card:last-child table { font-size: 12.5px; }
@media (max-width: 1150px) {
  .fm2-kopf-unten { display: block; }
  .fm2-kopf-unten .card:last-child {
    border-left: 0 !important;
    border-top: 1px solid var(--linie, rgba(16,32,27,.10)) !important;
  }
}

/* ---- Notizfeld: Arbeitsgröße statt Briefmarke --------------- */
#notizText {
  min-height: 160px !important;
  width: 100% !important;
  box-sizing: border-box;
  font-size: 13.5px !important;
  line-height: 1.55 !important;
  resize: vertical;
  padding: 10px 12px !important;
}
/* Notiz-Karte leicht abgesetzt — im Feld ist sie Gold wert */
.fm2-rechts .card:has(#notizText) {
  background: #FFFBEB !important;
  border-color: #E8DFC0 !important;
}

/* ---- Kopf-Feinschliff --------------------------------------- */
.fm2-hero-akt { margin-left: auto; display: flex; gap: 8px; position: relative; align-items: center; }
.fm2-kopf > #mfObjektHinweis { margin: 12px 22px 0 !important; }

/* ═══════════════════════════════════════════════════════════════════
   MOBIL (iPhone & iPad hochkant) — geteilte Regeln für alle B-Seiten
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 740px) {
  .page, .page.page-fullwidth { padding-left: 14px; padding-right: 14px; }
  .fm2-buehne-innen { padding: 0 14px; }
  .fm2-buehne h1 { font-size: 20px; }
  .fm2-kopf .status-chips { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* iOS zoomt bei Fokus in Felder mit Schrift < 16px hinein — im Feld extrem nervig */
  input, select, textarea { font-size: 16px !important; }
  .btn, button { min-height: 38px; }
}

/* ═══ Spotlight-Suche in der Topbar: helle Schrift auf dunkler Suchpille ═══ */
.apphdr-suche-input { color: #1C1B18 !important; caret-color: #33302A !important; background: transparent !important; }
.apphdr-suche-input::placeholder { color: #726E66 !important; opacity: 1 !important; }
.apphdr-suche-kbd { color: #726E66 !important; }
.apphdr-suche-reset { color: #1C1B18 !important; }
/* generischer heller Fokus-Ring (input:focus) darf die dunkle Suchpille nicht treffen */
.apphdr-suche-input:focus { box-shadow: none !important; border-color: transparent !important; }
.apphdr-suche-feld:focus-within { box-shadow: none !important; }
