/* Automathur Cockpit-Theme (Redesign vom 2026-11-02): gemeinsame Farben, Seitenleiste und
   Grundbausteine fuer alle Seiten. Hell/Dunkel ueber data-theme auf <html> (gesetzt vom
   Inline-Script im <head> jeder Seite, siehe shell.js) - "auto" folgt dem Betriebssystem.
   Die Seitenleiste bleibt in BEIDEN Modi dunkel: das Automathur-Logo ist ein weisses
   3D-Schriftbild und waere auf hellem Grund unsichtbar. */

:root, :root[data-theme="light"] {
  --bg: #eeeef0;
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --surface-3: #ececee;
  --line: #dedee2;
  --line-strong: #c9c9cf;
  --text: #1f1f22;
  --text-2: #4b4b52;
  --text-3: #5c5c63;    /* >= 4,5:1 auch auf dem dunkleren Seitenverlauf (Kontrast-Check 2026-11-02) */
  --input-bg: #ffffff;

  --green: #5f9a86;
  --green-strong: #7cb09e;
  --green-dark: #47786a;
  --green-light: #bedad0;
  --green-tint: #e2efea;
  --on-green: #0b241b;
  --gold: #c4a348;
  --gold-dark: #8a6d1e;
  --gold-tint: #f4ecd2;
  --on-gold: #241a08;
  --red: #be7e7d;
  --red-dark: #8d4f4e;
  --red-tint: #f6e4e4;
  --on-red: #2a0806;
  --orange: #b09e7c;
  --orange-dark: #7c6a49;
  --teal: #6fbabf;
  --teal-dark: #529296;
  --progress: var(--green-strong);

  --track: #e4e4e7;
  --shadow-card: 0 1px 2px rgba(20,20,30,.06), 0 2px 8px rgba(20,20,30,.04);
  --shadow-pop: 0 10px 30px rgba(20,20,30,.16), 0 2px 6px rgba(20,20,30,.08);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #232325;
  --surface: #2c2c30;
  --surface-2: #323236;
  --surface-3: #3a3a3f;
  --line: #38383d;
  --line-strong: #4a4a50;
  --text: #ececec;
  --text-2: #b9b9bf;
  --text-3: #a3a3a9;    /* >= 4,5:1 auf Karten und Flaechen (Kontrast-Check 2026-11-02) */
  --input-bg: #252528;

  --green: #7cb09e;
  --green-strong: #7cb09e;
  --green-dark: #a3cfc0;
  --green-tint: #2f3a36;
  --on-green: #0b241b;
  --gold-dark: #d9bd6a;
  --gold-tint: #3a3424;
  --red-dark: #e0a3a2;
  --red-tint: #3d2c2c;
  --orange-dark: #cbb994;

  --track: #3d3d42;
  --shadow-card: none;
  --shadow-pop: 0 12px 34px rgba(0,0,0,.5);
  color-scheme: dark;
}

:root {
  --nav-bg: #1b1b1d;
  --nav-line: #333336;
  --nav-text: #c9c9ce;
  --nav-dim: #8e8e94;
  --nav-active: #2f3a36;

  --radius: 10px;
  --radius-card: 16px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --spring-btn: cubic-bezier(.34, 1.9, .64, 1);
  --ease-smooth: cubic-bezier(.25, .8, .25, 1);

  /* Tastenkappen-Optik (IBM-Model-M-Stil, Arthurs Vorgabe vom 2026-08-18) bleibt erhalten -
     das Redesign macht die Flaechen ruhiger, die gedrueckten Knoepfe bleiben haptisch. */
  --shadow-key: inset 0 1.5px 0 rgba(255,255,255,.45), inset 0 -3px 1.5px rgba(0,0,0,.28), 0 4px 1.5px rgba(0,0,0,.12), 0 7px 9px rgba(0,0,0,.18);
  --shadow-key-active: inset 0 1px 0 rgba(255,255,255,.25), inset 0 -1px 1px rgba(0,0,0,.25), 0 1px 1px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.16);
  --border-gradient: linear-gradient(to bottom, rgba(0,0,0,.15), rgba(0,0,0,.35)) border-box;
}

* { box-sizing: border-box; }
html { background: var(--bg); scrollbar-gutter: stable; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: "Manrope", "Segoe UI", system-ui, sans-serif; font-size: 14px; }
a { color: var(--green-dark); }

/* Feste 1em-Box: solange die Icon-Schrift noch laedt, nimmt der (unsichtbare) Icon-Name wie
   "space_dashboard" sonst seine volle Textbreite ein und die Beschriftung daneben springt. */
.material-symbols-outlined { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: inherit; line-height: 1; vertical-align: middle; user-select: none; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20; display: inline-block; width: 1em; height: 1em; overflow: hidden; white-space: nowrap; flex-shrink: 0; }
.material-symbols-outlined.filled { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20; }

/* ── App-Rahmen: Seitenleiste + Inhalt ─────────────────────────── */
.app { display: flex; min-height: 100vh; }
.side { flex: 0 0 248px; position: sticky; top: 0; height: 100vh; background: var(--nav-bg); border-right: 1px solid var(--nav-line); color: var(--nav-text); display: flex; flex-direction: column; padding: 22px 14px 16px; overflow-y: auto; overflow-x: hidden; z-index: 30; }
.side-logo { padding: 8px 10px 24px; }
.side-logo .header-logo-wrap { position: relative; display: inline-block; }
.side-logo .header-logo { height: 20px; width: auto; aspect-ratio: 788 / 81; display: block; -webkit-user-drag: none; user-select: none; }
.side-logo #titleClick { position: absolute; cursor: default; user-select: none; -webkit-user-drag: none; }
.side-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--nav-dim); padding: 14px 12px 6px; }
.side-link { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--radius); color: var(--nav-text); text-decoration: none; font-weight: 600; font-size: 14px; transition: background .15s ease, color .15s ease; }
.side-link .material-symbols-outlined { font-size: 20px; }
.side-link:hover { background: #26262a; color: #fff; }
.side-link.active { background: var(--nav-active); color: #e6f2ee; font-weight: 700; }
.side-link.active .material-symbols-outlined { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20; color: #7cb09e; }
.side-count { margin-left: auto; font-size: 12px; font-weight: 700; background: #34343a; color: #e6e6ea; border-radius: 999px; padding: 2px 8px; min-width: 24px; text-align: center; }
.side-count:empty { display: none; }
.side-foot { margin-top: auto; padding: 14px 4px 0; border-top: 1px solid var(--nav-line); display: flex; flex-direction: column; gap: 10px; }
.side-status { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--nav-dim); padding: 0 8px; }
.side-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #6b6b70; flex-shrink: 0; }
.side-status.ok .dot { background: #7cb09e; box-shadow: 0 0 0 3px rgba(124,176,158,.18); }
.side-status.off .dot { background: #be7e7d; }
.theme-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; background: #26262a; border-radius: var(--radius); padding: 3px; }
.theme-switch button { height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--nav-dim); font: inherit; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.theme-switch button .material-symbols-outlined { font-size: 16px; }
.theme-switch button[aria-pressed="true"] { background: #3a3a40; color: #fff; }
.theme-switch button:hover:not([aria-pressed="true"]) { color: #fff; }

.side-toggle { display: none; }

.main { flex: 1; min-width: 0; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 36px 64px; }

/* Seitenwechsel (Arthurs Vorgabe vom 2026-11-02): die neue Ansicht ist sofort da, nur die alte
   blendet schnell aus (siehe .app-frame.leaving / html.main-leaving unten). Kein Einblenden.
   @view-transition sorgt bei einem klassischen Seitenwechsel in Chrome/Edge dafuer, dass ohne
   leeres Zwischenbild umgeschaltet wird. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }

/* Karten (auch die Zeilen-Karten in Listen) gleiten beim Erscheinen kurz von unten an ihren
   Platz und blenden dabei ein, leicht nacheinander. Die ersetzte Ansicht blendet dagegen nur
   schnell aus (siehe .app-frame.leaving / html.main-leaving). */
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.wrap > *, .wrap .grid > .card, .wrap .row { animation: cardIn .34s cubic-bezier(.22, .9, .3, 1) both; }
.wrap > :nth-child(2), .wrap .grid > .card:nth-child(2), .wrap .row:nth-child(2) { animation-delay: .04s; }
.wrap > :nth-child(3), .wrap .grid > .card:nth-child(3), .wrap .row:nth-child(3) { animation-delay: .08s; }
.wrap > :nth-child(4), .wrap .grid > .card:nth-child(4), .wrap .row:nth-child(4) { animation-delay: .12s; }
.wrap > :nth-child(5), .wrap .row:nth-child(5) { animation-delay: .16s; }
.wrap > :nth-child(n+6), .wrap .row:nth-child(n+6) { animation-delay: .2s; }
.wrap > .grid { animation: none; }
/* Eingebettete Seite: Karten starten erst, wenn der Rahmen sie sichtbar macht */
html.vt-pending .wrap > *, html.vt-pending .wrap .grid > .card, html.vt-pending .wrap .row { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .wrap > *, .wrap .grid > .card, .wrap .row { animation: none; }
}

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side { position: sticky; top: 0; height: auto; flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; gap: 6px; }
  .side-logo { padding: 4px 6px; margin-right: auto; }
  .side-toggle { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid var(--nav-line); background: transparent; color: #fff; font-size: 22px; cursor: pointer; }
  .side-body { display: none; width: 100%; flex-direction: column; gap: 2px; padding: 8px 0 4px; }
  .side.open .side-body { display: flex; }
  .side-foot { margin-top: 8px; }
  .wrap { padding: 20px 16px 48px; }
}
@media (min-width: 901px) { .side-body { display: contents; } }

/* ── Grundbausteine ─────────────────────────────────────────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 20px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.page-head .sub { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.page-head .head-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.card { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px 22px; box-shadow: var(--shadow-card); }
.card-title { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: .06em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; }
.card-title .material-symbols-outlined { font-size: 17px; }
/* Markenlogos: eigene helle Variante fuer den dunklen Modus (*-dark.webp) statt Farbfilter - ein
   invert()-Filter machte den gelben ArtMind-Punkt dunkel-orangebraun. */
:root[data-theme="dark"] .logo-light, :root:not([data-theme="dark"]) .logo-dark { display: none; }

button { font-family: inherit; cursor: pointer; transition: transform .35s var(--ease-smooth), box-shadow .5s ease-out, filter .6s ease-out, background .6s ease-out, color .6s ease-out, border-color .6s ease-out; }
button:hover:not(:disabled) { transition: transform .16s var(--spring-btn), box-shadow .16s var(--spring-btn), filter .12s ease, background .15s ease, color .15s ease, border-color .15s ease; }
button:active:not(:disabled) { transform: translateY(3px) scale(.98); filter: brightness(.92); transition: transform .04s ease, filter .04s ease; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
button:disabled { opacity: .4; cursor: not-allowed; }

.btn-outline { background: transparent; border: 1.5px solid var(--line-strong); color: var(--text); border-radius: 999px; min-height: 36px; padding: 0 16px; font-size: 13px; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); }

.badge { padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 12px; background: var(--surface-3); color: var(--text-2); }
.badge.ok { background: var(--green-tint); color: var(--green-dark); }
.badge.off { background: var(--red-tint); color: var(--red-dark); }

select, input, textarea { font-family: inherit; }
.input, select { background: var(--input-bg); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(14,12,16,.6); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal-box { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 360px; width: calc(100% - 40px); box-shadow: var(--shadow-pop); animation: modalPop .28s var(--spring); }
@keyframes modalPop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.modal-text { font-size: 13px; color: var(--text-2); line-height: 1.55; margin-bottom: 18px; }
.modal-btn-row { display: flex; gap: 10px; }
.modal-btn-row .btn-outline { min-height: 40px; }
.modal-btn-ok { flex: 1; border-radius: 999px; height: 40px; font-size: 13px; font-weight: 700; border: 1px solid rgba(0,0,0,.22); background: var(--orange); color: #241a08; box-shadow: var(--shadow-key); }
.modal-btn-ok:hover { filter: brightness(1.06); }
.modal-btn-ok:active:not(:disabled) { box-shadow: var(--shadow-key-active); }

/* Untere Aktionsleiste der Unterseiten beginnt rechts neben der Seitenleiste */
@media (min-width: 901px) { .sticky-bar { left: 248px !important; } }
.sticky-bar { background: color-mix(in srgb, var(--bg) 80%, transparent) !important; border-top: 1px solid var(--line) !important; }

/* ── Seitenwechsel ohne Neuladen (siehe shell.js) ─────────────── */
/* Rahmen: weitere Seiten liegen als iframe ueber dem Inhaltsbereich, die Seitenleiste bleibt */
.frame-host { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 248px; z-index: 5; background: transparent; }
.frame-host.active { display: block; }
.app-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); color-scheme: normal; z-index: 1; }
.app-frame.loading { visibility: hidden; }
/* Alte Ansicht liegt beim Wechsel obenauf und blendet schnell aus, die neue steht schon darunter */
.app-frame.leaving { z-index: 2; opacity: 0; transition: opacity .15s ease-out; pointer-events: none; }
html.main-leaving .main .wrap { opacity: 0; transition: opacity .12s ease-out; }
html.frame-mode .main { display: none; }
/* Rahmenseite selbst scrollt dann nicht mehr (das macht die Seite im iframe) - kein leerer Scrollbalken-Streifen */
html.frame-mode { overflow: hidden; scrollbar-gutter: auto; }
@media (max-width: 900px) { .frame-host { left: 0; top: var(--side-h, 64px); } }
/* Eingebettete Seite: eigene Seitenleiste weg, Aktionsleiste ueber die volle Breite */
html.embedded .side { display: none; }
html.embedded .sticky-bar { left: 0 !important; }

/* Deaktivierte Knoepfe: lesbar grau statt 40 % durchsichtig. Dunkle Schrift auf blass
   durchscheinendem Gruen war vor allem im dunklen Modus kaum lesbar (Kontrast-Check 2026-11-02).
   !important, weil die Seiten eigene :disabled-Regeln mit opacity mitbringen. */
html button:disabled:not(.trash-btn):not(.save-btn):not(.priority-btn):not(.tab):not(.tab-btn) {
  background: var(--surface-3) !important; color: var(--text-3) !important; border-color: var(--line) !important;
  box-shadow: none !important; opacity: 1 !important; filter: none !important; text-shadow: none !important; cursor: not-allowed;
}

/* Angemeldetes Konto unten in der Seitenleiste (Mitarbeiterverwaltung, 2026-11-16) */
.side-user { display: flex; align-items: center; gap: 8px; padding: 8px 6px 10px; margin-bottom: 8px; border-bottom: 1px solid var(--nav-line); color: var(--nav-text); }
.side-user[hidden] { display: none; }
.side-user > .material-symbols-outlined { font-size: 22px; opacity: .85; }
.side-user-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.side-user-name b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-name small { font-size: 11px; opacity: .7; }
.side-user button { background: transparent; border: none; color: inherit; opacity: .75; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.side-user button:hover { opacity: 1; background: rgba(255,255,255,.08); }
.side-user button .material-symbols-outlined { font-size: 18px; }
.side-links { display: contents; }
