/* =========================================================================
   TEKO redak — Designsystem
   Übernommen aus style-teko/style-teko.md + komponenten.md
   Sidebar = Anker (#334255, beide Modi). 3-Stufen-Hintergrund-Hierarchie.
   ========================================================================= */

/* ---- Fonts (Inter / Outfit) ---- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: local('Inter'), local('Inter-Regular');
}

:root {
  /* Corporate */
  --teko-grau:      #55565A;
  --teko-bordeaux:  #96124B;
  --teko-bordeaux-light: #E04D90;
  --teko-petrol:    #0095A9;

  /* Anker / Dunkel */
  --dark-bg:        #334255;  /* Sidebar (beide Modi), Topbar Dark */
  --surface-dark:   #47566A;  /* Cards Dark */
  --main-dark:      #3B4A60;  /* Hauptbereich Dark */
  --border-dark:    #536180;

  /* Akzente (Charts / Stats / Status) */
  --indigo: #6366F1;
  --green:  #10B981;
  --amber:  #F59E0B;
  --purple: #A78BFA;
  --cyan:   #22D3EE;
  --pink:   #EC4899;
  --danger: #E24B4A;

  /* Radius / Layout */
  --r-card: 16px;
  --r-sub: 12px;
  --r-pill: 100px;
  --sidebar-w: 280px;
  --topbar-h: 72px;

  --shadow-float: 0 8px 28px rgba(20,28,42,0.12);
}

/* ---- Light Theme (default) ---- */
:root,
[data-theme='light'] {
  --bg-main:    #E6EAF0;
  --bg-card:    #FFFFFF;
  --bg-topbar:  #FFFFFF;
  --border:     #EBEEF2;
  --border-input: #DDE1E7;

  --text-title: #334255;
  --text-body:  #55565A;
  --text-label: #334255;
  --text-muted: #8A909C;

  --accent-bordeaux: #96124B;   /* lesbar auf hell */
  --accent-petrol:   #0095A9;
}

/* ---- Dark Theme ---- */
[data-theme='dark'] {
  --bg-main:    #3B4A60;
  --bg-card:    #47566A;
  --bg-topbar:  #334255;
  --border:     #536180;
  --border-input: #536180;

  --text-title: #FFFFFF;
  --text-body:  rgba(255,255,255,0.78);
  --text-label: #FFFFFF;
  --text-muted: rgba(255,255,255,0.55);

  /* auf dunklem Grund aufgehellt (Kontrast-Regel §3.13) */
  --accent-bordeaux: #E04D90;
  --accent-petrol:   #29B6CC;
}

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

/* Basisgröße für alle Inline-Icons (spezifischere Regeln überschreiben dies) */
.ico { width: 18px; height: 18px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* =========================================================================
   SHELL
   ========================================================================= */
.shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--dark-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 20px 0;
  padding: 4px 4px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar__brand img { height: 56px; flex: 0 0 auto; }
.sidebar__wordmark {
  font-size: 22px;
  font-weight: 200;
  letter-spacing: 4px;
  line-height: 1;
  color: #fff;
}
.sidebar__wordmark b { font-weight: 200; }
/* Wortmarke „Redaktion" nicht umbrechen – bei Bedarf komplett unter „TEKO" */
.sidebar__wordmark i { font-weight: 200; font-style: italic; white-space: nowrap; }

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 12px;
}
.nav-group__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 16px 14px 8px;
}
.nav-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 16px 14px 6px;
}
.nav-gap { height: 16px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 2px 0;
  border-radius: var(--r-sub);
  color: rgba(255,255,255,0.72);
  font-size: 13.5px;
  font-weight: 400;
  transition: background .12s, color .12s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active {
  background: var(--teko-bordeaux);
  color: #fff;
  font-weight: 600;
}
.nav-item .ico { width: 20px; height: 20px; flex: 0 0 20px; }
.nav-item .badge {
  margin-left: auto;
  background: var(--teko-petrol);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--r-pill);
}
.nav-item.active .badge { background: rgba(255,255,255,0.25); }

/* Akkordeon-Gruppen */
.nav-group { margin-top: 6px; }
.nav-group__head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  border-radius: var(--r-sub);
  color: rgba(255,255,255,0.85);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .2px;
  text-align: left;
  transition: background .12s, color .12s;
}
.nav-group__head:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-group__head .ico { width: 20px; height: 20px; flex: 0 0 20px; }
.nav-group__head span { flex: 1; }
.nav-group__head .badge {
  background: var(--teko-petrol);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--r-pill);
}
.nav-group__head .chev {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  opacity: .55;
  transition: transform .22s ease;
}
.nav-group.open .nav-group__head { color: #fff; }
.nav-group.open .nav-group__head .chev { transform: rotate(180deg); }
.nav-group.open .nav-group__head .badge { display: none; }
/* Auf-/Zuklappen */
.nav-group__items {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.nav-group.open .nav-group__items { max-height: 600px; }
.nav-group__inner .nav-item { padding-left: 26px; font-size: 13px; }

/* ---- Main ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  background: transparent;
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__loc {
  font-size: 14px;
  font-weight: 200;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-title);
}
.topbar__spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-title);
}
.icon-btn:hover { background: var(--bg-main); }
.icon-btn .ico { width: 20px; height: 20px; }
/* ---- Benutzer-Pille (Topbar rechts) ---- */
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-card);
  color: var(--text-title);
  transition: border-color .12s;
}
.user-chip:hover { border-color: var(--accent-petrol); }
.user-chip__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--teko-petrol), var(--dark-bg));
  color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .5px;
  flex: 0 0 auto;
}
.user-chip__meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-chip__name { font-size: 12px; font-weight: 500; color: var(--text-title); }
.user-chip__sub  { font-size: 10px; font-weight: 300; color: var(--text-muted); }
.user-chip .ico  { width: 16px; height: 16px; color: var(--text-muted); }

/* ---- Dropdown-Menü (Benutzer-Pille) ---- */
.menu {
  position: fixed;
  z-index: 200;
  min-width: 230px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sub);
  box-shadow: var(--shadow-float);
  padding: 6px;
}
.menu__head { padding: 8px 10px 6px; }
.menu__name { font-size: 13px; font-weight: 500; color: var(--text-title); }
.menu__sub  { font-size: 11px; font-weight: 300; color: var(--text-muted); }
.menu__sep  { height: 1px; background: var(--border); margin: 6px 0; }
.menu__item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 10px;
  border: none; background: transparent;
  border-radius: 8px;
  color: var(--text-body); font-size: 13px; text-align: left;
}
.menu__item:hover { background: var(--bg-main); }
.menu__item .ico { width: 18px; height: 18px; color: var(--text-muted); }

/* ---- Page container ---- */
.page { padding: 24px 32px 32px; }


/* =========================================================================
   KOMPONENTEN
   ========================================================================= */

/* Stats-Header */
.stats-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}
.stat { display: flex; gap: 12px; align-items: stretch; }
.stat__bar { width: 4px; border-radius: 4px; flex: 0 0 4px; }
.stat__num {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 22px; font-weight: 400; color: var(--text-title);
  line-height: 1.1;
}
.stat__label { font-size: 11px; font-weight: 300; color: var(--text-muted); margin-top: 2px; }

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px 24px;
}
.card--pad0 { padding: 0; overflow: hidden; }
.card__label {
  font-size: 11px; font-weight: 500; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-title);
  margin-bottom: 14px;
}
.section-gap { height: 16px; }
.section-gap--lg { height: 20px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 720px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Search row */
.search-row { display: flex; gap: 12px; align-items: center; }
.search-row__search { flex: 1; position: relative; }
.search-row__search .ico {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted);
}
.input, .search-row__search input, select.select {
  width: 100%;
  height: 46px;
  border-radius: var(--r-sub);
  border: 1px solid var(--border-input);
  background: var(--bg-card);
  color: var(--text-body);
  padding: 0 14px;
  font-size: 13px;
  outline: none;
  transition: border-color .12s;
}
.search-row__search input { padding-left: 40px; }
.input:focus, .search-row__search input:focus, select.select:focus { border-color: var(--teko-petrol); }
.input::placeholder { color: var(--text-muted); }
label.field { display: block; }
label.field > span {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--teko-petrol); margin-bottom: 6px;
}
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
select.select { appearance: none; background-image: none; cursor: pointer; }
/* Native Datei-Auswahl an das Theme anpassen (sonst dunkler UA-Button auf dunklem Grund) */
input[type="file"].input { padding: 8px 12px; color: var(--text-body); font-size: 13px; }
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  font: inherit; cursor: pointer; margin-right: 12px; padding: 7px 12px;
  border-radius: 8px; border: 1px solid var(--border-input);
  background: var(--bg-main); color: var(--text-title);
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent-petrol); }

/* Buttons */
.btn {
  height: 46px;
  border: none;
  border-radius: var(--r-sub);
  padding: 0 18px;
  font-size: 12px; font-weight: 500; letter-spacing: 1.5px;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.btn .ico { width: 18px; height: 18px; }
.btn--petrol  { background: var(--teko-petrol);  color: #fff; }   /* Seitenaktion */
.btn--bordeaux{ background: var(--teko-bordeaux); color: #fff; }   /* Commit (Dialog) */
.btn--danger  { background: var(--danger);       color: #fff; }
.btn--petrol:hover  { filter: brightness(1.07); }
.btn--bordeaux:hover{ filter: brightness(1.12); }
.btn--outline {
  background: transparent;
  color: var(--teko-petrol);
  border: 1px solid color-mix(in srgb, var(--teko-petrol) 50%, transparent);
}
.btn--outline:hover { background: color-mix(in srgb, var(--teko-petrol) 8%, transparent); }
.btn--ghost { background: transparent; color: var(--text-body); border: 1px solid var(--border); }
.btn--sm { height: 38px; padding: 0 14px; }

/* Icon action in tables */
.act-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 8px; border: none; background: transparent;
  color: var(--text-body);
}
.act-btn:hover { background: var(--bg-main); }
.act-btn .ico { width: 18px; height: 18px; }
.act-btn--edit   { color: var(--accent-petrol); }
.act-btn--danger { color: var(--danger); }

/* Table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-main) 40%, var(--bg-card));
}
.tbl tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-body);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg-main); }
.tbl .cell-primary { font-size: 13px; font-weight: 400; color: var(--text-title); }
.tbl .cell-sub { font-size: 12px; font-weight: 300; color: var(--text-muted); }
.tbl .col-actions { text-align: right; white-space: nowrap; }
.tbl .col-actions .row-acts { display: inline-flex; gap: 4px; justify-content: flex-end; }
.tbl tfoot .tbl-total td { border-top: 1px solid var(--border); padding: 8px 12px; color: var(--text-title); background: var(--bg-main); }

/* Blättern (Paginierung) statt Scrollen */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 14px 0 2px; }
.pager [data-info] { min-width: 130px; text-align: center; }

/* Kompaktes Aktionsmenü (Import/Export) – reduziert die Button-Zahl */
/* Toolbar-Aktionsmenü (Import/Export) – eigener Name (nicht .menu, das ist die Benutzer-Pille!) */
.tbmenu { position: relative; display: inline-block; }
.tbmenu > summary { list-style: none; cursor: pointer; }
.tbmenu > summary::-webkit-details-marker { display: none; }
.tbmenu__pop {
  position: absolute; right: 0; z-index: 30; margin-top: 6px; min-width: 220px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.tbmenu__item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px; border: none; background: transparent; color: var(--text-body);
  border-radius: 7px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.tbmenu__item:hover { background: var(--bg-main); }
.tbmenu__item .ico { width: 15px; height: 15px; }
.tbmenu__label { padding: 6px 10px 4px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* Quellen-/Infobereich (Terminologie) */
.src-summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; gap: 10px; color: var(--text-title); }
.src-summary::-webkit-details-marker { display: none; }
.src-summary::after { content: '▾'; margin-left: auto; color: var(--text-muted); transition: transform .15s; }
details[open] .src-summary::after { transform: rotate(180deg); }
.src-body { padding: 0 18px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
.src-group { grid-column: 1 / -1; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-petrol); margin-top: 8px; }
.src-link { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; color: var(--text-body); text-decoration: none; }
.src-link:hover { background: var(--bg-main); }
.src-link .ico { width: 16px; height: 16px; color: var(--accent-petrol); flex: 0 0 16px; margin-top: 2px; }
.src-link .src-url { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
@media (max-width: 820px) { .src-body { grid-template-columns: 1fr; } }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 500;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill[data-c] { color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.pill .dot { background: var(--c); }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 500;
  color: var(--accent-petrol);
  background: color-mix(in srgb, var(--teko-petrol) 12%, transparent);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Übersetzungs-Fortschritt */
.tr-prog { margin-top: 4px; }
.tr-prog__bar { height: 6px; border-radius: 4px; background: var(--bg-main); overflow: hidden; }
.tr-prog__bar > span { display: block; height: 100%; background: var(--accent-petrol); border-radius: 4px; transition: width .3s ease; }
.tr-prog__bar--indet > span { width: 35%; animation: tr-indet 1.1s ease-in-out infinite; }
@keyframes tr-indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.tr-prog__row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--text-body); margin-top: 6px; }
.tr-prog__row .ico { width: 14px; height: 14px; vertical-align: -2px; }

/* ---- Anmeldung (Login / Passwortwechsel) ---- */
.auth-wrap { position: fixed; inset: 0; background: #fff; display: grid; place-items: center; padding: 24px; z-index: 300; overflow: auto; }
.auth-card { width: 340px; max-width: 100%; display: flex; flex-direction: column; text-align: center; }
.auth-logo { height: 92px; object-fit: contain; margin: 0 auto 26px; }
.auth-divider { width: 48px; height: 2px; background: var(--teko-petrol); margin: 0 auto 24px; }
.auth-title { font-size: 22px; font-weight: 200; letter-spacing: 6px; color: #334255; }
.auth-sub { font-size: 11px; font-weight: 400; letter-spacing: 3px; color: var(--teko-petrol); margin: 8px 0 40px; }
.auth-hint { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin: -20px 0 28px; text-align: left; }
.auth-field { display: block; text-align: left; margin-bottom: 18px; }
.auth-field > span { display: block; font-size: 11px; letter-spacing: 2px; color: #8a94a3; margin: 0 0 6px 2px; }
.auth-field .input { width: 100%; }
.auth-pw { position: relative; }
.auth-pw .input { padding-right: 40px; }
.auth-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--teko-petrol); cursor: pointer; padding: 6px; display: inline-grid; place-items: center; }
.auth-eye .ico { width: 18px; height: 18px; }
.auth-btn { width: 100%; margin-top: 14px; justify-content: center; letter-spacing: 1px; }
.auth-err { color: var(--danger); font-size: 12.5px; margin-top: 14px; min-height: 16px; text-align: center; }
[data-theme="dark"] .auth-wrap { background: #334255; }
[data-theme="dark"] .auth-title { color: #fff; }
[data-theme="dark"] .auth-field > span { color: rgba(255,255,255,.55); }
.chip--ok { color: var(--green, #2E7D32); background: color-mix(in srgb, #2E7D32 14%, transparent); }
.chip--ok .ico { width: 13px; height: 13px; }

/* Kopf-Banner (Bordeaux-Streifen) */
.kopf {
  display: flex; align-items: center; gap: 28px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 16px 24px 16px 20px;
  position: relative; overflow: hidden;
}
.kopf::before { content:''; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--teko-bordeaux); }
.kopf__f { display: flex; flex-direction: column; }
.kopf__f .l { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }
.kopf__f .v { font-size: 14px; font-weight: 500; color: var(--text-title); }

/* List / module helpers */
.muted { color: var(--text-muted); }
.title-lg { font-family:'Outfit','Inter',sans-serif; font-size: 24px; font-weight: 400; color: var(--text-title); }
.h-row { display: flex; align-items: center; gap: 12px; }
.flex-spacer { flex: 1; }
.txt-sm { font-size: 12px; }
.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mb12{margin-bottom:12px}

/* progress bar */
.bar-track { height: 8px; border-radius: 8px; background: var(--bg-main); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 8px; }

/* nav-tile (dashboard quick actions) */
.tile {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px; border-radius: var(--r-card);
  background: var(--bg-card); border: 1px solid var(--border);
  text-align: left; width: 100%; transition: transform .1s, box-shadow .12s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-float); }
.tile__ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.tile__ico .ico { width: 22px; height: 22px; color: #fff; }
.tile__t { font-size: 14px; font-weight: 500; color: var(--text-title); }
.tile__d { font-size: 12px; font-weight: 300; color: var(--text-muted); }

/* Chat (RAG) */
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 64px); }
/* Chat-Seite füllt die Höhe: #page wird zur fixen Spalte, nur der Stream scrollt. */
.page--chat { height: calc(100vh - var(--topbar-h)); overflow: hidden; display: flex; flex-direction: column; }
.page--chat .chat { flex: 1; min-height: 0; height: auto; }
.chat__stream { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 4px; }
.chat__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.chat__head .flex-spacer { flex: 1; }
.chat__empty { margin: auto; text-align: center; max-width: 460px; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.chat__empty .chat__empty-ic { width: 46px; height: 46px; opacity: .5; }
.chat__empty h3 { color: var(--text-title); font-weight: 600; font-size: 16px; }
.msg { max-width: 80%; padding: 14px 16px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.msg--user { align-self: flex-end; background: var(--teko-petrol); color: #fff; border-bottom-right-radius: 4px; }
.msg--ai { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-body); border-bottom-left-radius: 4px; }
.msg--ai .src {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--accent-petrol); display:flex; flex-direction:column; gap:4px;
}
.msg--ai .src a { display:flex; gap:6px; align-items:center; }
.msg--ai .src .ico { width:14px; height:14px; }
.chat__input { display: flex; gap: 12px; margin-top: 16px; }

/* Dialog */
.dlg-backdrop {
  position: fixed; inset: 0; background: rgba(20,28,42,0.5);
  display: grid; place-items: center; z-index: 100; padding: 24px;
}
.dlg {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-card); width: 440px; max-width: 100%;
  padding: 24px; box-shadow: var(--shadow-float);
}
.dlg--wide { width: 720px; }
.dlg__grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 640px) { .dlg__grid2 { grid-template-columns: 1fr; } .dlg--wide { width: 440px; } }
.dlg__title { font-size: 20px; font-weight: 300; color: var(--text-title); margin-bottom: 18px; }
.dlg__actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }
.chk { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; color: var(--text-body); cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent-petrol); }
.cover-prev { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; min-height: 36px; }
.cover-prev img { max-height: 90px; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 4px; }

/* Toast */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; display:flex; flex-direction:column; gap:10px; }
.toast {
  max-width: 520px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-float);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--text-body);
  animation: toastin .2s ease;
}
@keyframes toastin { from { opacity:0; transform: translateY(8px);} to {opacity:1;transform:none;} }
.toast .ico { width: 20px; height: 20px; }

/* Alert banner */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-sub);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
}
.alert .ico { width: 20px; height: 20px; color: var(--amber); flex:0 0 20px; }
.alert .a-t { font-size: 13px; font-weight: 500; color: var(--text-title); }
.alert .a-d { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* dropzone */
.dropzone {
  border: 2px dashed var(--border-input); border-radius: var(--r-card);
  padding: 40px; text-align: center; color: var(--text-muted);
  background: var(--bg-card);
}
.dropzone .ico { width: 40px; height: 40px; color: var(--accent-petrol); margin-bottom: 12px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 22px; overflow-x: auto; }
.tab {
  padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--text-muted); white-space: nowrap;
  background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text-title); }
.tab.active { color: var(--accent-petrol); border-bottom-color: var(--accent-petrol); }

/* ---- Piktogramm-Bibliothek ---- */
.pikto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.pikto-cell {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sub);
  padding: 14px 10px 12px;
  text-align: center;
}
.pikto-del {
  position: absolute; top: 6px; right: 34px;
  width: 24px; height: 24px; display: grid; place-items: center;
  border: none; background: transparent; color: var(--text-muted);
  border-radius: 6px; opacity: 0; transition: opacity .12s;
}
.pikto-cell:hover .pikto-del { opacity: 1; }
.pikto-fav {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; display: grid; place-items: center;
  border: none; background: transparent; color: var(--text-muted);
  border-radius: 6px; cursor: pointer; font-size: 15px; line-height: 1;
}
.pikto-fav:hover { background: var(--bg-main); }
.pikto-fav.on { color: var(--amber); }
.pikto-del:hover { background: var(--bg-main); color: var(--danger); }
.pikto-del .ico { width: 15px; height: 15px; }
.pikto-tag {
  position: absolute; top: 6px; left: 6px;
  font-size: 9px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  padding: 1px 6px; border-radius: var(--r-pill);
}
.pikto-tag--frei  { background: color-mix(in srgb, var(--teko-grau) 16%, transparent); color: var(--text-muted); }
.pikto-tag--eigen { background: color-mix(in srgb, var(--teko-petrol) 16%, transparent); color: var(--accent-petrol); }
.pikto-art { height: 56px; display: grid; place-items: center; }
.pikto-art svg { display: block; }
.pikto-img { display: inline-grid; place-items: center; }
.pikto-img svg { width: 100%; height: 100%; }
.pikto-name { font-size: 12px; color: var(--text-title); margin-top: 8px; line-height: 1.25; }
.pikto-code { font-size: 10px; color: var(--text-muted); margin-top: 3px; }
.pikto-signal {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 92px; height: 32px; padding: 0 14px;
  border-radius: 6px; font-weight: 700; letter-spacing: 1px; font-size: 13px;
}
.pikto-swatch { display: inline-block; border-radius: 6px; flex: 0 0 auto; }

/* ---- Editor (Anleitung zusammenstellen) ---- */
.editor-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.editor-palette { position: sticky; top: 8px; max-height: calc(100vh - 200px); overflow: auto; }
.editor-pal-list { display: flex; flex-direction: column; gap: 6px; }
.editor-pal-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-main); color: var(--text-title); }
.editor-pal-item:hover { border-color: var(--accent-petrol); }
.editor-pal-name { flex: 1; font-size: 12.5px; }
.editor-pal-add { color: var(--accent-petrol); display: inline-grid; }
.editor-pal-add .ico { width: 16px; height: 16px; }
@media (max-width: 980px) { .editor-grid { grid-template-columns: 1fr; } }

/* Editor: Segment-Umschalter */
.seg { display: inline-flex; background: var(--bg-main); border: 1px solid var(--border); border-radius: var(--r-sub); padding: 3px; gap: 3px; }
.seg__btn { border: none; background: transparent; padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.seg__btn.active { background: var(--bg-card); color: var(--text-title); box-shadow: var(--shadow-float); }
.editor-pal-pikto { width: 26px; height: 26px; display: inline-grid; place-items: center; flex: 0 0 26px; }
.editor-pal-pikto svg { width: 26px; height: 26px; }

/* Editor: WYSIWYG-A4-Blatt (Bearbeiten = Vorschau) */
.editor-canvas { justify-content: center; padding: 8px 0 40px; align-items: flex-start; }
.editor-sheet { position: relative; cursor: default; }
.editor-chapter { position: relative; background: transparent; border: none; border-radius: 6px; padding: 0 8px; margin: 0 -8px; cursor: text; }
.editor-chapter.active { background: color-mix(in srgb, var(--teko-petrol) 4%, transparent); box-shadow: inset 3px 0 0 var(--accent-petrol); }
.editor-ch-head { display: flex; align-items: center; gap: 8px; margin: 26px 0 6px; border-bottom: 1px solid #e3e6ec; }
.editor-ch-nr { font-size: 18px; font-weight: 700; color: #1c2433; flex: 0 0 auto; }
.editor-ch-title { flex: 1; border: none; background: transparent; font-size: 18px; font-weight: 600; color: #1c2433; padding: 0 0 5px; }
.editor-ch-title:focus { outline: none; }
.editor-ch-head .grip { opacity: 0; }
.editor-ch-head:hover .grip { opacity: 1; }
.editor-block { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 3px 8px; margin: 3px -8px; border: 1px solid transparent; border-radius: 6px; }
.editor-block:hover { background: #f6f8fa; }
.editor-block-bullet { color: #55565a; font-size: 15px; line-height: 1.5; flex: 0 0 auto; }
.editor-block-name { font-size: 14px; color: #2a3342; line-height: 1.5; flex: 1; }
.editor-block-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.editor-block-h { font-weight: 600; color: #1c2433; font-size: 14px; }
.editor-block-text { border: 1px solid transparent; background: transparent; font-size: 14px; color: #2a3342; line-height: 1.5; padding: 2px 4px; border-radius: 4px; width: 100%; font-family: inherit; }
.editor-block-text::placeholder { color: #b3bcc8; }
.editor-block-text:hover { border-color: #e3e6ec; }
.editor-block-text:focus { outline: none; border-color: var(--accent-petrol); background: #fff; }
.editor-block--text .editor-block-text { resize: vertical; overflow: auto; }
.editor-block--pikto { border: 1px solid #e3e6ec; border-left: 4px solid #55565a; border-radius: 8px; padding: 10px 12px; margin: 12px -6px; background: #fff; align-items: center; }
.editor-block--pikto:hover { background: #fafbfc; }
.editor-block-pikto { width: 44px; height: 44px; display: inline-grid; place-items: center; flex: 0 0 44px; }
.editor-block-pikto svg { width: 44px; height: 44px; }
.chip--sm { font-size: 10px; padding: 1px 7px; margin-right: 7px; }
.editor-empty { padding: 12px 2px; color: #8a94a3; }
.editor-addch { margin-top: 24px; }
.editor-mv { font-size: 14px; font-weight: 700; }
/* Werkzeuge nur bei Hover einblenden */
.editor-block-tools { display: flex; align-items: center; gap: 1px; margin-left: auto; opacity: 0; transition: opacity .12s; flex: 0 0 auto; }
.editor-block:hover .editor-block-tools, .editor-block--pikto:hover .editor-block-tools { opacity: 1; }
.editor-ch-head .editor-block-tools { opacity: 0; }
.editor-ch-head:hover .editor-block-tools { opacity: 1; }
.grip { cursor: grab; color: #9aa4b2; font-size: 15px; line-height: 1; padding: 0 2px; user-select: none; flex: 0 0 auto; align-self: center; }
.grip:active { cursor: grabbing; }
.editor-block.drop-into, .editor-chapter.drop-into { outline: 2px dashed var(--accent-petrol); outline-offset: -2px; }
.editor-ai { color: var(--accent-petrol); }
.act-btn:disabled, .editor-ai.busy { opacity: .45; pointer-events: none; }
@keyframes ai-pulse { 0%,100% { opacity: .35; } 50% { opacity: .9; } }
.editor-ai.busy { animation: ai-pulse .9s ease-in-out infinite; }

/* Editor: A4-Seitenvorschau */
.page-preview { display: flex; justify-content: center; padding: 8px 0 32px; }
.page-sheet { background: #fff; color: #1c2433; width: 100%; max-width: 760px; min-height: 900px; padding: 56px 60px; border-radius: 4px; box-shadow: 0 10px 40px rgba(20,28,42,.18); }
.pv-title { font-size: 26px; font-weight: 600; color: #1c2433; }
.pv-meta { color: #888; font-size: 13px; margin: 4px 0 24px; }
.pv-h2 { font-size: 18px; font-weight: 600; color: #1c2433; margin: 26px 0 8px; border-bottom: 1px solid #e3e6ec; padding-bottom: 5px; }
.pv-p { font-size: 14px; line-height: 1.5; margin: 8px 0; color: #2a3342; }
.pv-inhalt { color: #55565a; }
.pv-notice { display: flex; gap: 14px; align-items: flex-start; border: 1px solid #e3e6ec; border-left: 4px solid #55565a; border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.pv-notice-ico { flex: 0 0 44px; }
.pv-notice-ico svg { width: 44px; height: 44px; }
.pv-notice-h { font-weight: 600; color: #1c2433; }
.pv-notice-t { font-size: 14px; color: #2a3342; }

/* donut legend */
.legend { display: flex; flex-direction: column; gap: 8px; }
.legend .li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-body); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* mobile sidebar */
.sidebar__burger { display: none; }
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .sidebar__burger { display: grid; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  .page { padding: 16px; }
  .topbar { padding: 0 16px; }
}
