/* ═══════════════════════════════════════════════════════════════
   AixConcept OVS – Design System (Basis: AixOne Nexus)
   Quelle der Werte: docs/design/OVSDesignUI-UX.pen
   ═══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Inter";
  src: url("./fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Material Symbols Rounded";
  src: url("./fonts/material-symbols-rounded.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: block;
}

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --primary: #C2185B;
  --primary-hover: #A5144D;
  --primary-foreground: #FFFFFF;
  --primary-on-dark: #E84686;
  --foreground: #1B1B1F;
  --muted-foreground: #4B5563;
  --background: #FFFFFF;
  --workspace: #F8F9FB;
  --card: #FFFFFF;
  --secondary: #F3F4F6;
  --border: #E5E7EB;
  --sidebar: #FAFAFA;
  --header-bg: #1B1B2F;
  --header-fg: #FFFFFF;
  --accent-subtle: #FCE7F0;
  --nav-active-fg: #C2185B;
  --color-success: #16A34A;
  --color-warning: #F59E0B;
  --color-info: #2563EB;
  --color-error: #DC2626;
  --destructive: #DC2626;
  --color-error-bg: #FEE2E2;
  --scrim: #E5E7EBD9;
  --shadow-lg: 0 16px 48px rgba(15, 17, 21, .20);
  --shadow-md: 0 8px 24px rgba(15, 17, 21, .12);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --foreground: #F3F4F6;
  --muted-foreground: #9CA3AF;
  --background: #0F1115;
  --workspace: #0A0C10;
  --card: #1A1D24;
  --secondary: #1F2229;
  --border: #2A2E37;
  --sidebar: #13151A;
  --header-bg: #0D0D1A;
  --header-fg: #E5E7EB;
  --accent-subtle: #1F0E14;
  --nav-active-fg: #E84686;
  --color-success: #22C55E;
  --color-warning: #FBBF24;
  --color-info: #3B82F6;
  --color-error: #EF4848;
  --destructive: #EF4848;
  --color-error-bg: #1A0D0D;
  --scrim: #05060ACC;
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .40);
}

/* ── Basis ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--foreground);
  background: var(--workspace);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.muted { color: var(--muted-foreground); }

.ms {
  font-family: "Material Symbols Rounded";
  font-weight: 400;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
  user-select: none;
  flex-shrink: 0;
}
.ms-14 { font-size: 14px; } .ms-16 { font-size: 16px; } .ms-18 { font-size: 18px; }
.ms-20 { font-size: 20px; } .ms-22 { font-size: 22px; } .ms-fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn, .primary-button, .secondary-button, .small-button, .compact-button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid transparent; background: transparent;
  font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn .ms { font-size: 18px; }
.btn-primary, .primary-button, .small-button { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover:not(:disabled), .primary-button:hover:not(:disabled), .small-button:hover:not(:disabled) { background: var(--primary-hover); text-decoration: none; }
.btn-secondary, .secondary-button, .compact-button { background: var(--secondary); border-color: var(--border); color: var(--foreground); font-weight: 400; }
.btn-secondary .ms, .secondary-button .ms { color: var(--muted-foreground); }
.btn-secondary:hover:not(:disabled), .secondary-button:hover:not(:disabled) { border-color: var(--muted-foreground); }
.btn-outline { background: var(--card); border-color: var(--border); color: var(--foreground); }
.btn-outline:hover:not(:disabled) { background: var(--secondary); }
.btn-ghost { color: var(--foreground); }
.btn-ghost:hover:not(:disabled) { background: var(--secondary); }
.btn-danger { background: var(--destructive); color: #fff; }
.btn-danger-text, .btn-danger-text .ms { color: var(--destructive) !important; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-icon, .icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; background: transparent; color: var(--muted-foreground); border-radius: var(--radius); flex-shrink: 0; }
.btn-icon:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--secondary); color: var(--foreground); }

/* ── Formular ───────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--foreground); }
.field.required > span::after { content: " *"; color: var(--primary); font-weight: 600; }
.field input, .field select, .field textarea, .input {
  height: 40px; width: 100%; padding: 0 12px;
  background: var(--card); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: 14px; outline: none;
}
.field textarea, textarea.input { height: auto; min-height: 64px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.field input::placeholder, .input::placeholder, textarea::placeholder { color: var(--muted-foreground); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.field input:disabled, .field textarea:disabled, .input:disabled { background: var(--secondary); color: var(--muted-foreground); }
.field select, select.input {
  appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted-foreground) 50%), linear-gradient(135deg, var(--muted-foreground) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.field.compact input, .field.compact select { height: 34px; font-size: 13px; }
.field.compact > span { font-size: 11px; color: var(--muted-foreground); }
.input-icon { position: relative; }
.input-icon > .ms { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); font-size: 18px; pointer-events: none; }
.input-icon > .input { padding-left: 38px; }

.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Karten, Seitenkopf ─────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card-flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.card-flush > .card-head { padding: 16px 20px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--foreground); }
.card-title .ms { color: var(--muted-foreground); font-size: 18px; }
.card-sub { font-size: 13px; color: var(--muted-foreground); }
.card-link { font-size: 13px; color: var(--primary); background: none; border: 0; padding: 0; }
.card-link:hover { text-decoration: underline; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.eyebrow { font-size: 11px; font-weight: 500; color: var(--nav-active-fg); }
.page-title { font-size: 20px; font-weight: 600; color: var(--foreground); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-sub { font-size: 13px; color: var(--muted-foreground); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted-foreground); }
.breadcrumb .ms { font-size: 12px; }
.breadcrumb strong { color: var(--nav-active-fg); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 480px; }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Badges, Pillen, Chips, Hinweise ────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 13px; white-space: nowrap; background: var(--accent-subtle); color: var(--primary); }
.badge-primary { background: var(--accent-subtle); color: var(--primary); }
.badge-neutral { background: var(--secondary); color: var(--muted-foreground); }
.badge-info { background: color-mix(in srgb, var(--color-info) 15%, transparent); color: var(--color-info); }
.badge-success { background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); }
.badge-warning { background: color-mix(in srgb, var(--color-warning) 15%, transparent); color: color-mix(in srgb, var(--color-warning) 75%, var(--foreground)); }
.badge-error { background: color-mix(in srgb, var(--color-error) 15%, transparent); color: var(--color-error); }

.status-pill { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); font-size: 12px; font-weight: 500; color: var(--foreground); }
.status-pill.is-ready { border-color: color-mix(in srgb, var(--color-success) 40%, transparent); color: var(--color-success); }
.status-pill.is-error { border-color: color-mix(in srgb, var(--color-error) 40%, transparent); color: var(--color-error); }
.status-pill.is-editing { background: color-mix(in srgb, var(--color-warning) 15%, transparent); border-color: color-mix(in srgb, var(--color-warning) 40%, transparent); }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 8px; border-radius: var(--radius-sm); background: var(--accent-subtle); color: var(--nav-active-fg); font-size: 11px; font-weight: 500; border: 0; }
.chip .ms { font-size: 12px; }

.hint { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: var(--radius); border: 1px solid; font-size: 12px; color: var(--foreground); line-height: 1.4; }
.hint > .ms { font-size: 16px; }
.hint > div, .hint > p { flex: 1; min-width: 0; }
.hint-warning { background: color-mix(in srgb, var(--color-warning) 8%, transparent); border-color: color-mix(in srgb, var(--color-warning) 40%, transparent); }
.hint-warning > .ms { color: var(--color-warning); }
.hint-info { background: color-mix(in srgb, var(--color-info) 8%, transparent); border-color: color-mix(in srgb, var(--color-info) 30%, transparent); }
.hint-info > .ms { color: var(--color-info); }
.hint-success { background: color-mix(in srgb, var(--color-success) 8%, transparent); border-color: color-mix(in srgb, var(--color-success) 30%, transparent); }
.hint-success > .ms { color: var(--color-success); }
.hint-error { background: color-mix(in srgb, var(--color-error) 8%, transparent); border-color: color-mix(in srgb, var(--color-error) 35%, transparent); }
.hint-error > .ms { color: var(--color-error); }
.hint .hint-link { margin-left: auto; color: var(--primary); font-weight: 500; background: none; border: 0; padding: 0; font-size: 12px; white-space: nowrap; }

.empty-state { padding: 24px; text-align: center; color: var(--muted-foreground); font-size: 13px; }

.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--secondary); color: var(--foreground); font-size: 11px; font-weight: 600; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 13px; }
.avatar-accent { background: var(--accent-subtle); color: var(--nav-active-fg); }

/* ── Tabellen ───────────────────────────────────────────────── */
.tbl-wrap { overflow: auto; min-width: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted-foreground); background: var(--secondary); padding: 10px 16px; white-space: nowrap; }
.tbl td { padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted-foreground); vertical-align: middle; }
.tbl td.strong, .tbl td strong { color: var(--foreground); font-weight: 500; }
.tbl .num { text-align: right; }
.tbl tr.is-clickable { cursor: pointer; }
.tbl tr.is-clickable:hover td { background: color-mix(in srgb, var(--secondary) 60%, transparent); }
.tbl tr.is-selected td { background: var(--accent-subtle); color: var(--nav-active-fg); }
.tbl tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.tbl tr.group-row td { background: var(--workspace); color: var(--foreground); font-weight: 600; font-size: 12px; padding: 8px 16px; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable .ms { font-size: 14px; vertical-align: -2px; opacity: .5; }
.tbl th.sortable.is-sorted .ms { opacity: 1; color: var(--primary); }
.card .tbl-wrap { border-radius: var(--radius) var(--radius) 0 0; }
.card:not(.card-flush) .tbl th:first-child { border-top-left-radius: var(--radius); }
.card:not(.card-flush) .tbl th:last-child { border-top-right-radius: var(--radius); }
.contract-end small { margin-left: 4px; font-size: 11px; font-weight: 500; }
.contract-end.end-expired { color: var(--color-error); }
.contract-end.end-soon { color: color-mix(in srgb, var(--color-warning) 75%, var(--foreground)); }
.date-expired { color: var(--color-error); font-weight: 600; }
.date-soon { color: color-mix(in srgb, var(--color-warning) 75%, var(--foreground)); font-weight: 600; }

/* Raten als Pillen */
.rate-pills { display: inline-flex; gap: 4px; }
.rate-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--secondary); color: var(--muted-foreground); }
.rate-pill .ms { font-size: 12px; }
.rate-pill.is-paid { background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); }
.rate-pill.is-current { box-shadow: inset 0 0 0 1px var(--primary); }

/* ── Reiter & Segment ───────────────────────────────────────── */
.tabs-line { display: flex; flex-shrink: 0; box-shadow: inset 0 -1px 0 var(--border); gap: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab-btn { height: 40px; padding: 0 16px; border: 0; background: none; color: var(--muted-foreground); font-size: 13px; white-space: nowrap; }
.tab-btn:hover { color: var(--foreground); }
.tab-btn.active { color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); font-weight: 500; }
.segment { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius); background: var(--secondary); }
.segment-btn { padding: 5px 10px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted-foreground); font-size: 12px; font-weight: 500; }
.segment-btn.active { background: var(--card); color: var(--foreground); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ── KPI ────────────────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 12px; text-align: left; color: inherit; min-width: 0; }
button.kpi:hover { border-color: var(--muted-foreground); }
.kpi-head { display: flex; justify-content: space-between; align-items: center; }
.kpi-head small { font-size: 13px; color: var(--muted-foreground); }
.kpi-head .ms { font-size: 18px; color: var(--border); }
.kpi-value { font-size: 28px; font-weight: 600; color: var(--foreground); line-height: 34px; }
.kpi-foot { font-size: 12px; color: var(--muted-foreground); }
.kpi.is-warning .kpi-value, .kpi.is-warning .kpi-head .ms { color: var(--color-warning); }

/* ── Shell: Header ──────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; }
.app-header { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--header-bg); color: var(--header-fg); position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; }
.brand-mark .ms { font-size: 24px; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .5px; color: var(--header-fg); white-space: nowrap; }
.brand-name b { font-weight: 400; color: var(--primary-on-dark); letter-spacing: 0; margin-left: 2px; }
.header-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.header-search { display: flex; align-items: center; gap: 8px; width: min(480px, 100%); height: 38px; padding: 0 12px; border-radius: var(--radius-md); border: 0; background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); text-align: left; }
.header-search:hover { background: rgba(255,255,255,.12); }
.header-search .ms { font-size: 18px; }
.header-search-text { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd { font-family: inherit; font-size: 12px; padding: 2px 6px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.2); color: #fff; }
.icon-btn-dark { width: 48px; height: 40px; border-radius: var(--radius-md); border: 0; background: transparent; color: rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center; }
.icon-btn-dark:hover { background: rgba(255,255,255,.08); }
.avatar-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--secondary); color: var(--foreground); font-size: 12px; font-weight: 600; }
:root[data-theme="dark"] .avatar-btn { background: #1F2229; color: #F3F4F6; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 260px; background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 8px; z-index: 50; }
.menu-head { display: flex; gap: 12px; align-items: center; padding: 8px; }
.menu-name { font-size: 14px; font-weight: 600; }
.menu-sub { font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius); background: none; font-size: 13px; color: var(--foreground); text-align: left; }
.menu-item .ms { font-size: 18px; color: var(--muted-foreground); }
.menu-item:hover { background: var(--secondary); }
.menu-item.is-danger, .menu-item.is-danger .ms { color: var(--destructive); }

/* ── Shell: Rail + Workspace ────────────────────────────────── */
.app-body { flex: 1; display: flex; min-height: 0; }
.rail { width: 64px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--border); padding: 20px 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rail-item { width: 48px; height: 52px; border-radius: var(--radius-md); border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted-foreground); }
.rail-item .ms { font-size: 22px; }
.rail-item span:last-child { font-size: 9px; font-weight: 500; line-height: 10px; }
.rail-item:hover:not(:disabled) { background: var(--secondary); color: var(--foreground); }
.rail-item.active { background: var(--accent-subtle); color: var(--nav-active-fg); }
.rail-item.active span:last-child { font-weight: 600; }
.rail-sep { width: 32px; height: 1px; background: var(--border); margin: 2px 0; }
.rail-flex { flex: 1; }
.workspace { flex: 1; min-width: 0; overflow: auto; }
.tab-panel { display: none; }
.tab-panel.active { display: flex; flex-direction: column; gap: 20px; padding: 32px; min-height: 100%; }
.tab-panel.flush.active { padding: 0; gap: 0; }

/* ── Start ──────────────────────────────────────────────────── */
.action-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.action-card { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--radius-lg); border: 1px solid; text-align: left; background: none; color: inherit; --tone: var(--color-info); background: color-mix(in srgb, var(--tone) 8%, transparent); border-color: color-mix(in srgb, var(--tone) 40%, transparent); }
.action-card.tone-error { --tone: var(--color-error); }
.action-card.tone-warning { --tone: var(--color-warning); }
.action-card.tone-info { --tone: var(--color-info); }
.action-card.tone-success { --tone: var(--color-success); }
.action-card .icon-box { width: 44px; height: 44px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--tone) 15%, transparent); color: var(--tone); display: flex; align-items: center; justify-content: center; }
.action-card .icon-box .ms { font-size: 22px; }
.action-card { flex-wrap: wrap; }
.action-card .ac-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.action-card .ac-num { font-size: 24px; font-weight: 600; color: var(--foreground); line-height: 1.2; }
.action-card .ac-label { font-size: 13px; font-weight: 500; color: var(--foreground); }
.action-card .ac-hint { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--tone); white-space: nowrap; }
.action-card .ac-hint .ms { font-size: 14px; }
.section-title { font-size: 16px; font-weight: 600; color: var(--foreground); }
.hub-cols { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 20px; align-items: start; }
.activity { display: flex; flex-direction: column; gap: 14px; }
.activity-item { display: flex; gap: 12px; align-items: center; background: none; border: 0; padding: 0; text-align: left; width: 100%; color: inherit; }
button.activity-item:hover .activity-text { color: var(--primary); }
.activity-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.activity-text { font-size: 13px; color: var(--foreground); overflow-wrap: anywhere; }
.activity-time { font-size: 12px; color: var(--muted-foreground); }
.activity-item > .ms { color: var(--muted-foreground); font-size: 18px; }

/* ── Aktive Verträge ────────────────────────────────────────── */
.vertraege-layout { display: flex; min-height: 100%; }
/* Trefferliste und Vertragsansicht scrollen getrennt, Suchfelder bleiben stehen */
#detailsTab.active { height: 100%; }
#detailsTab .vertraege-layout { height: 100%; }
#detailsTab .search-panel { overflow: hidden; }
#detailsTab .results { flex: 1; }
#detailsTab .detail-area { overflow-y: auto; }
.search-panel { width: 340px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.search-panel-head { display: flex; justify-content: space-between; align-items: center; }
.search-panel-head h2 { font-size: 16px; font-weight: 600; }
.link-toggle { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; color: var(--primary); font-size: 13px; font-weight: 500; align-self: flex-start; }
.link-toggle .ms { font-size: 16px; transition: transform .15s; }
.link-toggle[aria-expanded="true"] .ms { transform: rotate(180deg); }
.filter-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius-md); background: var(--workspace); border: 1px solid var(--border); }
.filter-box.collapsed { display: none; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); }
.result-head { display: flex; justify-content: space-between; align-items: center; }
.result-head h2 { font-size: 13px; font-weight: 600; }
.results { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; min-height: 0; }
.result-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: var(--radius); border: 0; background: transparent; text-align: left; color: inherit; box-shadow: inset 0 0 0 0 var(--primary); }
.result-item:hover { background: var(--secondary); }
.result-item.active { background: var(--accent-subtle); box-shadow: inset 3px 0 0 0 var(--primary); }
.result-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.result-title { font-size: 13px; font-weight: 500; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-item.active .result-title { color: var(--nav-active-fg); font-weight: 600; }
.result-sub { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-area { flex: 1; min-width: 0; padding: 32px; display: flex; flex-direction: column; gap: 20px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.master-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.master-cell { padding: 10px 12px; border-radius: var(--radius); background: var(--workspace); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.master-cell small { font-size: 11px; color: var(--muted-foreground); }
.master-cell .mc-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.master-cell strong { flex: 1; font-size: 13px; font-weight: 500; color: var(--foreground); overflow-wrap: anywhere; min-width: 0; }
.copy-btn { border: 0; background: none; padding: 2px; color: var(--muted-foreground); border-radius: 4px; display: inline-flex; }
.copy-btn .ms { font-size: 14px; }
.copy-btn:hover { color: var(--primary); background: var(--secondary); }
.copy-btn.copied { color: var(--color-success); }
.field-status { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-yes { background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); }
.status-no { background: var(--secondary); color: var(--muted-foreground); }
.status-warn { background: color-mix(in srgb, var(--color-warning) 15%, transparent); color: color-mix(in srgb, var(--color-warning) 75%, var(--foreground)); }
.person { display: flex; align-items: center; gap: 12px; }
.comment { display: flex; gap: 10px; }
.comment-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.comment-meta { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted-foreground); }
.comment-meta strong { color: var(--foreground); font-weight: 600; }
.comment-text { font-size: 13px; color: var(--foreground); white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-input { display: flex; gap: 8px; align-items: flex-end; }
.comment-input textarea { flex: 1; }
.send-btn { width: 40px; height: 40px; border-radius: var(--radius-md); border: 0; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); align-items: center; }
.timeline-item:first-child { border-top: 0; }
.timeline-item .tl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }

/* ── Eingabe ────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-4 { grid-column: 1 / -1; }
.article-editor { display: flex; flex-direction: column; gap: 12px; }
.article-row {
  display: grid; gap: 12px 12px; align-items: end; padding: 16px;
  border-radius: var(--radius-md); background: var(--workspace); border: 1px solid var(--border);
  grid-template-columns: 28px 140px minmax(200px, 1fr) 90px 90px 90px 140px 40px;
  grid-template-areas:
    "no art prod anz erw abw lz rm"
    ".  vb  akt  dur dur rat rat rat";
}
.article-row > :nth-child(1)  { grid-area: no; }
.article-row > :nth-child(2)  { grid-area: art; }
.article-row > :nth-child(3)  { grid-area: prod; }
.article-row > :nth-child(4)  { grid-area: anz; }
.article-row > :nth-child(5)  { grid-area: erw; }
.article-row > :nth-child(6)  { grid-area: abw; }
.article-row > :nth-child(7)  { grid-area: vb; }
.article-row > :nth-child(8)  { grid-area: lz; }
.article-row > :nth-child(9)  { grid-area: akt; }
.article-row > :nth-child(10) { grid-area: dur; }
.article-row > :nth-child(11) { grid-area: rat; }
.article-row > :nth-child(12) { grid-area: rm; }
.article-row .rates > div { white-space: nowrap; }
.rate-toggle { white-space: nowrap; }
.article-row .row-no { height: 40px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--muted-foreground); }
.rates { display: flex; flex-direction: column; gap: 6px; }
.rates > span { font-size: 12px; font-weight: 500; }
.rates > div { display: flex; gap: 6px; }
.rate-toggle { height: 40px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); color: var(--foreground); }
.rate-toggle > span { font-size: 13px; font-weight: 600; }
.rate-toggle > small { font-size: 11px; color: var(--muted-foreground); }
.rate-toggle.selected { background: color-mix(in srgb, var(--color-success) 12%, transparent); border-color: color-mix(in srgb, var(--color-success) 40%, transparent); }
.rate-toggle.selected > span, .rate-toggle.selected > small { color: var(--color-success); }
.action-bar { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Fälligkeiten ───────────────────────────────────────────── */
.dist-bars { display: flex; flex-direction: column; gap: 10px; }
.dist-bar { display: grid; grid-template-columns: 80px 1fr 28px; align-items: center; gap: 10px; font-size: 12px; }
.dist-bar .track { height: 8px; border-radius: 4px; background: var(--secondary); overflow: hidden; }
.dist-bar .fill { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.dist-bar .track { display: block; }
.dist-bar b { text-align: right; font-weight: 600; color: var(--foreground); }
.month-select { position: relative; }
.month-dropdown { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 240px; max-height: 340px; overflow: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 6px; }
.dash-month-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; }
.dash-month-item:hover { background: var(--secondary); }
.dash-month-item input { accent-color: var(--primary); }

/* ── Archiv ─────────────────────────────────────────────────── */
.archive-layout { display: grid; grid-template-columns: minmax(0, 1fr) 520px; gap: 20px; align-items: start; }
.kv { display: flex; flex-direction: column; }
.kv-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv-row > span { color: var(--muted-foreground); }
.kv-row > strong { font-weight: 500; color: var(--foreground); overflow-wrap: anywhere; }

/* ── Admin ──────────────────────────────────────────────────── */
.admin-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.dropzone { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius-md); border: 1px dashed var(--border); background: var(--workspace); }
.dropzone .dz-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inline-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tbl .input { height: 34px; font-size: 13px; }
.row-menu { position: relative; }
.row-menu .menu { min-width: 200px; }

/* ── Login ──────────────────────────────────────────────────── */
.login-page { position: fixed; inset: 0; display: flex; background: var(--workspace); z-index: 100; }
.login-brand { width: 560px; flex-shrink: 0; background: #1B1B2F; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 40px 60px; }
.login-brand-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center; }
.login-logo { width: 64px; height: 64px; border-radius: 16px; background: var(--primary); display: flex; align-items: center; justify-content: center; }
.login-logo .ms { font-size: 40px; color: #fff; }
.login-title { font-size: 28px; font-weight: 700; letter-spacing: .5px; }
.login-title b { font-weight: 400; color: #E84686; }
.login-claim { font-size: 14px; color: #9CA3AF; max-width: 360px; }
.login-footer { display: flex; gap: 8px; font-size: 13px; color: #9CA3AF; }
.login-footer a { color: #9CA3AF; }
.login-content { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 400px; max-width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 20px; box-shadow: var(--shadow-md); }
.login-card h2 { font-size: 22px; font-weight: 600; }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 40px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); color: var(--foreground); font-size: 14px; font-weight: 600; }
.ms-btn:hover { background: var(--secondary); text-decoration: none; }
.or-divider { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted-foreground); }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .btn { height: 40px; }
.form-error { color: var(--color-error); font-size: 13px; min-height: 18px; }

/* ── Dialog ─────────────────────────────────────────────────── */
.dialog-layer, .palette-layer { position: fixed; inset: 0; z-index: 200; background: var(--scrim); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.dialog { width: 480px; max-width: 100%; max-height: calc(100vh - 48px); overflow: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 24px; display: flex; flex-direction: column; gap: 20px; box-shadow: var(--shadow-lg); }
.dialog.is-wide { width: 600px; }
.dialog-head { display: flex; gap: 14px; }
.dialog-icon { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; --tone: var(--primary); background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); }
.dialog-icon .ms { font-size: 20px; }
.dialog.tone-danger .dialog-icon { --tone: var(--destructive); }
.dialog.tone-info .dialog-icon { --tone: var(--color-info); }
.dialog.tone-warning .dialog-icon { --tone: var(--color-warning); }
.dialog-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.dialog-title { font-size: 16px; font-weight: 600; }
.dialog-message { font-size: 14px; color: var(--muted-foreground); line-height: 1.45; overflow-wrap: anywhere; }
.dialog-body { display: flex; flex-direction: column; gap: 12px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.field-error { font-size: 12px; color: var(--color-error); }

/* ── Toast ──────────────────────────────────────────────────── */
.toast-stack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--radius-md); background: var(--header-bg); color: #fff; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-md); }
.toast .ms { font-size: 18px; }
.toast.tone-success > .ms:first-child { color: #22C55E; }
.toast.tone-error > .ms:first-child { color: #F26666; }
.toast.tone-info > .ms:first-child { color: #5995F7; }
.toast-text { flex: 1; overflow-wrap: anywhere; }
.toast-close { border: 0; background: none; color: rgba(255,255,255,.6); padding: 0; display: inline-flex; }

/* ── Befehlspalette ─────────────────────────────────────────── */
.palette-layer { align-items: flex-start; padding-top: 12vh; }
.palette { width: 560px; max-width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-input .ms { color: var(--muted-foreground); }
.palette-input input { flex: 1; height: 52px; border: 0; outline: none; background: transparent; font-size: 15px; }
.palette-list { overflow-y: auto; padding: 8px; }
.palette-group { font-size: 11px; font-weight: 600; color: var(--muted-foreground); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .4px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: var(--radius); border: 0; background: none; text-align: left; color: inherit; }
.palette-item .ms { color: var(--muted-foreground); font-size: 18px; }
.palette-item.is-active { background: var(--accent-subtle); }
.palette-item.is-active .ms, .palette-item.is-active .pi-title { color: var(--nav-active-fg); }
.pi-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pi-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-sub { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted-foreground); }
.palette-foot kbd { color: var(--muted-foreground); border-color: var(--border); padding: 0 4px; font-size: 11px; }

/* ── Responsiv (Mindestmaß) ─────────────────────────────────── */
@media (max-width: 1280px) {
  .hub-cols, .detail-grid, .archive-layout { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .master-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .header-search-text, .header-search kbd { display: none; }
  .header-search { width: 44px; }
  .vertraege-layout { flex-direction: column; }
  .search-panel { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); }
  #detailsTab.active, #detailsTab .vertraege-layout { height: auto; }
  #detailsTab .search-panel { overflow: visible; }
  #detailsTab .results { max-height: 360px; }
  #detailsTab .detail-area { overflow-y: visible; }
  .login-brand { display: none; }
  .admin-cols { grid-template-columns: minmax(0, 1fr); }
}

/* Positionsnummern in der Eingabe */
.article-editor { counter-reset: pos; }
.article-row { counter-increment: pos; }
.article-row .row-no::before { content: counter(pos); }

/* Artikelliste: Hinweis unter „Artikel“, wenn die Nummer nicht in der Liste steht */
.article-hint { display: block; margin-top: 4px; font-size: 11px; line-height: 1.3; color: color-mix(in srgb, var(--color-warning) 75%, var(--foreground)); }
