/* =========================================================================
   OX ERP – UI-Prototyp · Design-System (Dark)
   Layout/Stil angelehnt an die DOJOBS-Vorlage, umgesetzt in Dark Mode.
   Nur Optik, keine echte Funktion.
   ========================================================================= */

:root {
  /* Flächen */
  --bg:            #0c0e13;   /* Inhaltsfläche */
  --sidebar:       #13161e;
  --surface:       #181c25;   /* Karten */
  --surface-2:     #1f242f;
  --border:        #242a36;
  --border-strong: #313847;

  /* Text */
  --text:          #e8eaf1;
  --muted:         #9097a6;
  --faint:         #5d6473;

  /* Akzent */
  --accent:        #6c6cf5;
  --accent-2:      #8a6cff;
  --accent-soft:   rgba(108, 108, 245, .16);

  /* Status */
  --success:       #38d39f;
  --warning:       #f7b955;
  --danger:        #f46a6a;
  --info:          #45b6f5;

  /* Verlaufs-Kacheln (Status) */
  --grad-blue:   linear-gradient(135deg, #4f8bff 0%, #38c6f4 100%);
  --grad-purple: linear-gradient(135deg, #a45cf6 0%, #7b4cf0 100%);
  --grad-red:    linear-gradient(135deg, #ff7a7a 0%, #ee3e54 100%);
  --grad-orange: linear-gradient(135deg, #ffb14a 0%, #ff6a3d 100%);
  --grad-green:  linear-gradient(135deg, #3fd9a4 0%, #1fa97f 100%);
  --grad-pink:   linear-gradient(135deg, #ff7ac0 0%, #f0468a 100%);

  --radius:   18px;
  --radius-m: 14px;
  --radius-s: 10px;
  --shadow:   0 2px 6px rgba(0,0,0,.35), 0 12px 30px rgba(0,0,0,.28);
  --topbar-bg: rgba(12,14,19,.8);

  --sidebar-w: 248px;
  color-scheme: dark;
}

/* ===== Hell-Modus: weißer Hintergrund, Akzent Blau, schwarze Schrift ===== */
html.light {
  --bg:            #ffffff;
  --sidebar:       #ffffff;
  --surface:       #ffffff;
  --surface-2:     #f2f4f8;
  --border:        #e4e7ee;
  --border-strong: #cdd3df;

  --text:          #0b0d12;
  --muted:         #59616f;
  --faint:         #99a1b0;

  --accent:        #2563eb;   /* Blau */
  --accent-2:      #1e40af;   /* dunkleres Blau */
  --accent-soft:   rgba(37, 99, 235, .12);

  --shadow:    0 1px 2px rgba(16,24,40,.06), 0 10px 28px rgba(16,24,40,.10);
  --topbar-bg: rgba(255,255,255,.85);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---- Grundlayout ----------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ===================== SIDEBAR ======================================== */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 16px; position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 2px 8px 22px; font-weight: 800; font-size: 18px; letter-spacing: .4px;
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 16px rgba(108,108,245,.4);
}
.brand .accent { color: var(--accent); }

/* Profilkarte */
.profile {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px; margin-bottom: 16px;
  border-radius: var(--radius-m);
}
.profile .avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.profile .pname { font-weight: 650; font-size: 14px; }
.profile .pmail { color: var(--faint); font-size: 12px; }
.profile .more { margin-left: auto; color: var(--faint); cursor: pointer; }

.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--success), var(--accent));
  display: grid; place-items: center; color: #06210f; font-weight: 700;
}

/* Navigation */
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 14px; border-radius: var(--radius-m);
  color: var(--muted); font-weight: 550;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a .chev { margin-left: auto; opacity: .6; }
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 8px 20px rgba(108,108,245,.35);
}
.nav a.active:hover { color: #fff; }

/* Aufklappbares Untermenü */
.nav-sub { display: none; flex-direction: column; gap: 2px; margin: 2px 0; }
.nav-group.open .nav-sub { display: flex; }
.nav-sub a { padding: 9px 14px 9px 47px; border-radius: var(--radius-m); color: var(--muted); font-weight: 500; font-size: 13px; }
.nav-sub a:hover { background: var(--surface); color: var(--text); }
.nav-sub a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-parent .chev { transition: transform .15s; }
.nav-group.open .nav-parent .chev { transform: rotate(180deg); }
.nav-parent.parent-active { color: var(--text); }

.sidebar-footer { margin-top: auto; }

/* Color-Scheme-Umschalter */
.scheme { padding: 8px; border-top: 1px solid var(--border); margin-top: 14px; }
.scheme .lbl { color: var(--faint); font-size: 12px; margin: 6px 6px 10px; }
.toggle {
  display: flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px;
}
.toggle button {
  flex: 1; border: none; background: none; color: var(--muted);
  padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.toggle button.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}

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

.topbar {
  display: flex; align-items: center; gap: 16px; padding: 18px 26px;
  position: sticky; top: 0; z-index: 5;
  background: var(--topbar-bg); backdrop-filter: blur(8px);
}
.search {
  display: flex; align-items: center; gap: 10px; flex: 1; max-width: 560px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 11px 18px; color: var(--faint);
}
.search input { background: none; border: none; outline: none; color: var(--text); width: 100%; font-size: 13px; }

/* Topbar: Suche links, Glocke + Kürzel an den rechten Rand */
.topbar .search { flex: 0 1 480px; }

/* Pre-Release-Hinweis neben der Suchleiste (rot) */
.pre-release {
  display: inline-flex; align-items: center; gap: 8px; margin-right: auto;
  background: var(--danger); color: #fff;
  border-radius: 999px; padding: 7px 15px;
  font-size: 12px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
}
.pre-release::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--muted); cursor: pointer; position: relative;
}
.icon-btn:hover { color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 9px; right: 11px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--surface);
}
.topbar .avatar { width: 42px; height: 42px; font-size: 13px; cursor: pointer; }

.content { padding: 8px 26px 44px; }

/* ---- Karten / Raster ------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1.15fr .85fr; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.kebab { color: var(--faint); cursor: pointer; }
.link { color: var(--accent); font-size: 13px; font-weight: 600; }

/* ---- Statistik-Karte mit Ring --------------------------------------- */
.stat { display: flex; flex-direction: column; gap: 14px; }
.stat .stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat .stat-ico {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
}
.stat .stat-row { display: flex; align-items: center; justify-content: space-between; }
.stat .stat-num { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.stat .stat-lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* SVG-Ring */
.ring { width: 68px; height: 68px; }
.ring .ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 3.4; }
.ring .ring-val { fill: none; stroke-width: 3.4; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring text { fill: var(--text); font-size: 9px; font-weight: 700; }

/* ---- Donut (conic-gradient) ----------------------------------------- */
.donut { position: relative; width: 168px; height: 168px; border-radius: 50%; flex: none; }
.donut::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--surface); }
.donut .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; z-index: 1; }
.donut .center .big { font-size: 26px; font-weight: 800; }
.donut .center .sub { color: var(--success); font-size: 12px; font-weight: 600; }

.legend { display: flex; flex-direction: column; gap: 14px; }
.legend .row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.legend .row b { color: var(--text); }
.dot-l { width: 11px; height: 11px; border-radius: 50%; flex: none; }

/* ---- Verlaufs-Kacheln (später: Aufträge nach Status) ---------------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tile {
  position: relative; overflow: hidden; border-radius: var(--radius-m);
  padding: 20px; min-height: 132px; color: #fff;
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
  transition: transform .16s ease, box-shadow .16s ease;
}
.tile::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 42%);
  pointer-events: none;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 18px 36px rgba(0,0,0,.45); }
.tile > * { position: relative; }
.tile.blue   { background: var(--grad-blue); }
.tile.purple { background: var(--grad-purple); }
.tile.red    { background: var(--grad-red); }
.tile.orange { background: var(--grad-orange); }
.tile.green  { background: var(--grad-green); }
.tile.pink   { background: var(--grad-pink); }
.tile .t-num { font-size: 30px; font-weight: 800; }
.tile .t-lbl { font-size: 13px; opacity: .92; }
.tile .wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46px; opacity: .5; }

/* 6 Status-Kacheln in einer Reihe (volle Breite) */
.tiles-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.tiles-row .tile { min-height: 116px; padding: 16px; }
.tiles-row .tile .t-num { font-size: 26px; }
@media (max-width: 1300px) { .tiles-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .tiles-row { grid-template-columns: repeat(2, 1fr); } }

/* ---- Detail-Tabelle -------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 12px; color: var(--faint); font-weight: 600;
  padding: 8px 6px;
}
tbody td { padding: 11px 6px; border-top: 1px solid var(--border); font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-dot { display: inline-flex; align-items: center; gap: 9px; }

/* ---- Tabs ------------------------------------------------------------ */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 0 0 12px; color: var(--muted); font-weight: 600; font-size: 13px; position: relative; }
.tabs a.on { color: var(--accent); }
.tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }

/* ---- Balkendiagramm -------------------------------------------------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 10px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .stack { display: flex; align-items: flex-end; gap: 5px; height: 100%; }
.bars .bar { width: 9px; border-radius: 6px; }
.bars .bar.a { background: var(--accent); }
.bars .bar.b { background: rgba(255,255,255,.12); }
.bars .x { color: var(--faint); font-size: 11px; }

/* ---- Timeline -------------------------------------------------------- */
.timeline { position: relative; padding: 30px 4px; }
.timeline .line { position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--border); }
.timeline .pts { display: flex; justify-content: space-between; position: relative; }
.timeline .pt { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.timeline .node { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.pill { background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; padding: 3px 11px; border-radius: 999px; }

/* ---- Buttons --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  border-radius: var(--radius-s); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; box-shadow: 0 8px 20px rgba(108,108,245,.35); }

.section-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 24px 4px 4px; text-transform: uppercase; letter-spacing: .6px; }

/* ---- Stammdaten-Seite: Kopf, Toolbar, Tabelle ------------------------ */
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 4px 20px; }
.page-head .crumb { color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.page-head h2 { margin: 4px 0 0; font-size: 22px; font-weight: 750; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.toolbar .search { max-width: 340px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}

/* Farb-Swatch in der Tabelle */
.swatch { width: 16px; height: 16px; border-radius: 5px; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.06); }
.swatch-lg { width: 26px; height: 26px; border-radius: 8px; }

.t-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-act { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--border); cursor: pointer; }
.icon-act:hover { color: var(--text); border-color: var(--accent); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok   { background: rgba(56,211,159,.14);  color: var(--success); }
.badge.off  { background: var(--surface-2);       color: var(--muted); }

/* ---- Slide-over (Anlegen-Panel) ------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 440px; max-width: 92vw;
  background: var(--sidebar); border-left: 1px solid var(--border);
  box-shadow: -20px 0 50px rgba(0,0,0,.5); z-index: 41;
  transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.drawer-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 18px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.x-btn { color: var(--faint); cursor: pointer; font-size: 20px; line-height: 1; }
.x-btn:hover { color: var(--text); }

/* ---- Formularfelder -------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.field label .req { color: var(--danger); }
.field input[type=text], .field input[type=email], .field input[type=url] {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 11px 13px; color: var(--text); font-size: 14px; outline: none;
}
.field input:focus { border-color: var(--accent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Farbwähler */
.color-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.color-preview .swatch-lg { box-shadow: 0 0 0 2px rgba(255,255,255,.1); }
.color-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 9px; }
.color-opt { aspect-ratio: 1; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: transform .1s; }
.color-opt:hover { transform: scale(1.12); }
.color-opt.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.color-custom { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.color-custom input[type=color] { width: 38px; height: 38px; border: none; background: none; border-radius: 8px; cursor: pointer; padding: 0; }

/* Schalter */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch.on .track { background: var(--accent); border-color: var(--accent); }
.switch.on .track::after { transform: translateX(18px); background: #fff; }

/* ---- Formular-Seite (Kunde anlegen) --------------------------------- */
.sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.sec-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--accent); }
.sec-head h3 { margin: 0; font-size: 18px; font-weight: 700; }

.form-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 20px 20px; }
.form-grid .field { margin: 0; }
.c1 { grid-column: span 1; } .c2 { grid-column: span 2; } .c3 { grid-column: span 3; }
.c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c10 { grid-column: span 10; }
@media (max-width: 1100px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid > * { grid-column: auto !important; }
}

.field select, .field textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 11px 13px; color: var(--text); font-size: 14px; outline: none;
  font-family: inherit;
}
.field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { min-height: 110px; resize: vertical; }
.sel-wrap { position: relative; }
.sel-wrap select { appearance: none; -webkit-appearance: none; padding-right: 32px; }
.sel-wrap::after { content: "▾"; position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 12px; }

.input-icon { position: relative; }
.input-icon input { padding-right: 42px; }
.input-icon .ic { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }

/* Ansprechpartner-Block */
.ap-row { display: grid; grid-template-columns: repeat(10,1fr); gap: 14px; align-items: end; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-m); margin-bottom: 12px; }
.ap-row .field { margin: 0; }
.ap-del { width: 38px; height: 40px; border-radius: 8px; border: 1px solid var(--border); color: var(--danger); background: none; cursor: pointer; }
.ap-del:hover { border-color: var(--danger); }

/* Dubletten-Warnung */
.dup-warn { display: none; gap: 12px; align-items: flex-start; background: rgba(247,185,85,.1); border: 1px solid rgba(247,185,85,.5); border-radius: var(--radius-m); padding: 14px 16px; margin-bottom: 20px; }
.dup-warn.show { display: flex; }
.dup-warn .w-ic { color: var(--warning); font-size: 18px; line-height: 1.3; }
.dup-warn b { color: var(--text); }
.dup-warn .link { cursor: pointer; }

/* Erfolgs-Dialog (Modal) */
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-46%); width: 440px; max-width: 92vw;
  background: var(--sidebar); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 41; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%,-50%); }
.modal .m-body { padding: 28px 26px; text-align: center; }
.modal .m-ico { width: 56px; height: 56px; border-radius: 50%; background: rgba(56,211,159,.16); color: var(--success); display: grid; place-items: center; margin: 0 auto 16px; font-size: 26px; }
.modal h3 { margin: 0 0 8px; font-size: 19px; }
.modal p { margin: 0; color: var(--muted); font-size: 14px; }
.modal .m-foot { display: flex; gap: 10px; padding: 0 26px 24px; }
.modal .m-foot .btn { flex: 1; justify-content: center; }

/* ---- Listen-/Tabellen-Seite ----------------------------------------- */
tbody tr.clickable { cursor: pointer; }
.cell-name { display: flex; align-items: center; gap: 12px; }
.mini-av { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; }
.cell-name .sub { color: var(--faint); font-size: 12px; }

.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; color: var(--muted); font-size: 13px; padding: 0 4px; }
.pg-btns { display: flex; gap: 6px; }
.pg-btn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); display: grid; place-items: center; cursor: pointer; color: var(--muted); background: none; font-size: 13px; }
.pg-btn:hover { border-color: var(--accent); color: var(--text); }
.pg-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pg-btn[disabled] { opacity: .4; cursor: default; }

.empty-row td { text-align: center; color: var(--faint); padding: 32px; }

/* Icon je Auftragsgrund (Aufträge-Übersicht) */
.grund-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.grund-ic svg { width: 18px; height: 18px; }

/* ---- Eigenes Dropdown (dunkel) -------------------------------------- */
.dd { position: relative; }
.dd-field {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 11px 13px; cursor: pointer; color: var(--text); font-size: 14px;
  transition: border-color .12s, box-shadow .12s; user-select: none;
}
.dd-field:hover { border-color: var(--border-strong); }
.dd-field.open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dd-field.invalid { border-color: var(--danger); }
.dd-val.placeholder { color: var(--faint); }
.dd-arrow { color: var(--muted); font-size: 11px; transition: transform .15s; flex: none; }
.dd-field.open .dd-arrow { transform: rotate(180deg); }

.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 6px;
  max-height: 260px; overflow-y: auto; display: none;
}
.dd-menu.open { display: block; }
.dd-opt { padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px; }
.dd-opt:hover { background: var(--surface-2); }
.dd-opt.sel { color: var(--accent); font-weight: 600; }

/* ---- 8-Spalten-Formular (Vorgang) ----------------------------------- */
.fg8 { display: grid; grid-template-columns: repeat(8, 1fr); gap: 20px; }
.fg8 .field { margin: 0; }
.g1 { grid-column: span 1; } .g2 { grid-column: span 2; } .g4 { grid-column: span 4; }
@media (max-width: 1100px) { .fg8 { grid-template-columns: repeat(2, 1fr); } .fg8 > * { grid-column: auto !important; } }
.field-help { font-size: 11px; color: var(--faint); margin-top: 6px; }

/* Hersteller-Dropdown: Farbpunkt im Eintrag */
.dd-opt .swatch, .dd-val .swatch { display: inline-block; vertical-align: middle; margin-right: 8px; }

/* Kombifeld „Kunde suchen" (Combobox) */
.combo { position: relative; }
.combo-field { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding-right: 6px; transition: border-color .12s, box-shadow .12s; }
.combo-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.combo-field.invalid { border-color: var(--danger); }
.combo-field input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14px; padding: 11px 13px; }
.combo-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: none; }
.combo-ic:hover { color: var(--text); }
.combo-ic.add:hover { color: var(--accent); }
.combo-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 6px; max-height: 280px; overflow-y: auto; display: none; }
.combo-menu.open { display: block; }
.combo-opt { padding: 9px 12px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 11px; }
.combo-opt:hover { background: var(--surface-2); }
.combo-opt .sub { color: var(--faint); font-size: 12px; }
.combo-empty { padding: 12px; color: var(--faint); font-size: 13px; text-align: center; }

/* ---- Stammdaten: 3 Spalten (Hersteller/Produktgruppe/Modell) -------- */
.sd-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .sd-cols { grid-template-columns: 1fr; } }

.sd-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding: 0 2px; }
.sd-col-head h3 { margin: 0; font-size: 18px; font-weight: 700; }

.sd-list { padding: 0; overflow: hidden; }
.sd-listhead { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 600; }
.sd-listhead .kebab { letter-spacing: 2px; }
.sd-rows { min-height: 420px; }
.sd-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.sd-row:last-child { border-bottom: none; }
.sd-row:hover { background: var(--surface-2); }
.sd-row.sel { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sd-row .nm { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sd-row .nm .swatch { flex: none; }
.sd-edit { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); opacity: 0; flex: none; }
.sd-row:hover .sd-edit { opacity: 1; }
.sd-edit:hover { color: var(--accent); }
.sd-empty { padding: 90px 20px; text-align: center; color: var(--faint); font-size: 14px; }

/* ---- Kalender ------------------------------------------------------- */
.cal-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-team { display: flex; align-items: center; gap: 10px; }
.cal-team .lbl { color: var(--muted); font-size: 13px; }
.team-pill { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 9px 14px; min-width: 210px; cursor: pointer; }
.team-pill:hover { border-color: var(--accent); }
.cal-nav { display: flex; align-items: center; gap: 14px; margin: 0 auto; }
.cal-arrow { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--accent); display: grid; place-items: center; cursor: pointer; }
.cal-arrow:hover { border-color: var(--accent); background: var(--surface-2); }
.cal-range { font-weight: 650; font-size: 15px; }
.cal-kw { background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.view-toggle { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.view-toggle button { border: none; background: none; color: var(--muted); padding: 8px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; }
.view-toggle button.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

.cal-filter { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }

/* Wochenansicht: Raster Techniker × Tage */
.cal-week { display: grid; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-corner { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-dayhead { background: var(--surface-2); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); padding: 12px; text-align: center; font-weight: 650; font-size: 14px; }
.cal-dayhead span { display: block; color: var(--faint); font-size: 12px; font-weight: 500; margin-top: 3px; }
.cal-dayhead.today { color: var(--accent); }
.cal-dayhead.today span { color: var(--accent); }
.cal-techcell { padding: 14px 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 9px; justify-content: center; }
.cal-techcell .tname { font-weight: 650; }
.cal-cell { border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 7px; min-height: 96px; }

.tech-stats { display: inline-flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; font-size: 12px; color: var(--muted); width: fit-content; }
.tech-stats b { color: var(--text); }
.tech-stats .ok { color: var(--success); }

/* Termin-Karte */
.appt { border-radius: 8px; padding: 8px 10px; border-left: 4px solid var(--accent); background: var(--surface-2); cursor: pointer; transition: filter .12s; }
.appt:hover { filter: brightness(1.18); }
.appt .a-nr { font-size: 11px; color: var(--faint); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.appt .a-kd { font-weight: 650; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .a-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .a-time { font-size: 11px; color: var(--muted); }

/* Tagesansicht: Zeitachse × Techniker-Spalten */
.cal-day { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-day-head { display: grid; }
.cal-day-head .corner, .cal-day-head .th { background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 12px; }
.cal-day-head .th { border-left: 1px solid var(--border); text-align: center; }
.cal-day-head .th .tname { font-weight: 650; }
.cal-day-body { display: grid; position: relative; }
.time-axis .hr, .tech-col .hr { height: 56px; border-bottom: 1px solid var(--border); }
.time-axis .hr { font-size: 11px; color: var(--faint); padding: 2px 8px 0 0; text-align: right; }
.tech-col { position: relative; border-left: 1px solid var(--border); }
.appt-abs { position: absolute; left: 5px; right: 5px; border-radius: 8px; padding: 6px 9px; border-left: 4px solid var(--accent); background: var(--surface-2); overflow: hidden; cursor: grab; transition: filter .12s; }
.appt-abs:hover { filter: brightness(1.18); }

/* Drag & Drop */
.appt, .appt-abs { cursor: grab; }
.appt:active, .appt-abs:active { cursor: grabbing; }
.appt.dragging, .appt-abs.dragging { opacity: .35; }
.cal-cell.dragover, .tech-col.dragover { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.drag-ghost { position: fixed; right: auto !important; z-index: 200; pointer-events: none; opacity: .92; margin: 0 !important; box-shadow: 0 12px 30px rgba(0,0,0,.5); transform: rotate(1.5deg); }

/* ---- Benutzer-Menü (Popup am Avatar) -------------------------------- */
.user-menu { position: fixed; min-width: 190px; background: var(--sidebar); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 70; display: none; }
.user-menu.open { display: block; }
.user-menu .mi { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px; font-weight: 500; }
.user-menu .mi:hover { background: var(--surface-2); }
.user-menu .mi.danger { color: var(--danger); }
.user-menu .sep { height: 1px; background: var(--border); margin: 4px 2px; }
.clickable-logo { cursor: pointer; }

/* ---- Avatar-Auswahl -------------------------------------------------- */
.av-current { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 30px; margin: 0 auto 18px; background-size: cover; background-position: center; background: linear-gradient(135deg, var(--success), var(--accent)); }
.av-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.av-opt { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; cursor: pointer; border: 2px solid transparent; }
.av-opt.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.av-upload { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; cursor: pointer; border: 2px dashed var(--border-strong); color: var(--muted); font-size: 18px; }
.av-upload:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Logo-Upload ----------------------------------------------------- */
.logo-drop { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-prev { width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); background-size: cover; background-position: center; }

/* ---- Rollen-Chips (Mehrfachauswahl) ---------------------------------- */
.role-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.role-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600; user-select: none; }
.role-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.role-badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Auftrag-Detail: Infozeilen + Status-Historie ------------------- */
.info-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-row .lbl { color: var(--muted); font-size: 13px; white-space: nowrap; }
.info-row .val { font-weight: 600; text-align: right; }

.hist { position: relative; }
.hist-item { display: flex; gap: 16px; position: relative; }
.hist-num { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-strong); display: grid; place-items: center; font-weight: 700; color: var(--muted); flex: none; z-index: 1; }
.hist-item.current .hist-num { background: var(--accent); color: #fff; border-color: var(--accent); }
.hist-item:not(:last-child)::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--border); }
.hist-body { flex: 1; padding-bottom: 24px; min-width: 0; }
.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hist-code { font-size: 17px; font-weight: 700; }
.hist-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.hist-note { margin-top: 8px; font-size: 15px; line-height: 1.4; }
.hist-x { color: var(--faint); cursor: pointer; font-size: 18px; line-height: 1; }
.hist-x:hover { color: var(--danger); }

/* ---- Prototyp-Hinweis & Toast --------------------------------------- */
.proto-flag { display: none; }   /* ersetzt durch .pre-release neben der Suche */
.toast {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  padding: 11px 18px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
