/* MeerSYS CCP – Designsystem
   Hell: weiße Flächen, schwarzer Text, blaue Akzente. Grundschrift 12px, alle Maße darauf abgestimmt.
   Geringe Rundungen, klare Linien, dezente Bewegung. */

:root {
  --blue-900: #0b1f3a;
  --blue-700: #134a9c;
  --blue-600: #1a5fd0;
  --blue-500: #2470e8;
  --blue-100: #e6effd;
  --blue-50: #f3f7fe;
  --black: #000000;
  --white: #ffffff;

  --radius: 2px;
  --radius-lg: 3px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --sidebar-w: 210px;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --text: #000000;
  --text-muted: #4a5466;
  --line: #dfe4eb;
  --accent: var(--blue-600);
  --accent-hover: var(--blue-700);
  --accent-soft: var(--blue-100);
  --sidebar-bg: #ffffff;
  --sidebar-text: #1c2433;
  --sidebar-active: var(--blue-600);
  --ok: #1d7a43;      --ok-soft: #e4f3ea;
  --warn: #9a5c00;    --warn-soft: #fbf1de;
  --fail: #b8322a;    --fail-soft: #fbe6e4;
  --info: var(--blue-700); --info-soft: var(--blue-50);
  --shadow: 0 1px 2px rgba(11, 31, 58, .05);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 12px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; }
code { font-family: var(--mono); font-size: 11px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 6px 10px; }

/* Typo */
.h1 { font-size: 18px; line-height: 1.25; margin: 2px 0 10px; letter-spacing: -.01em; font-weight: 700; }
.h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px; color: var(--text); font-weight: 700; }
.eyebrow { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.muted { color: var(--text-muted); }
.tiny { font-size: 11px; }
.code { font: 11px/1.5 var(--mono); background: var(--surface-2); padding: 10px; border-radius: var(--radius); overflow-x: auto; white-space: pre-wrap; }

/* Anwendungsrahmen */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 20;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; border-right: 1px solid var(--line);
  transition: transform .25s var(--ease);
}
.sidebar__brand { display: flex; align-items: center; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.sidebar__brand .logo { height: 22px; width: auto; }
.sidebar__tag { font-size: 9px; font-weight: 700; letter-spacing: .12em; color: var(--white); background: var(--accent); padding: 2px 5px; border-radius: var(--radius); }
.nav { padding: 8px 8px; display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav__section { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); padding: 12px 10px 3px; }
.nav__section:first-child { padding-top: 4px; }
.nav__item {
  position: relative; display: flex; align-items: center; gap: 9px; padding: 6px 10px;
  color: var(--sidebar-text); border-radius: var(--radius); font-size: 12px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav__item:hover { background: var(--surface-2); color: var(--black); text-decoration: none; }
.nav__item.is-active { color: var(--sidebar-active); background: var(--accent-soft); font-weight: 600; }
.nav__item.is-active::before { content: ""; position: absolute; left: -8px; top: 5px; bottom: 5px; width: 3px; background: var(--accent); }
.sidebar__foot { padding: 10px 16px; font-size: 10px; color: var(--text-muted); border-top: 1px solid var(--line); }

.shell { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: 46px; display: flex; align-items: center; gap: 10px;
  padding: 0 20px; background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: 13px; font-weight: 700; margin: 0; flex: 1; }
.topbar__menu { display: none; }
.topbar__actions { display: flex; align-items: center; gap: 6px; }
.topbar__user { display: inline-flex; align-items: center; gap: 6px; color: var(--text); padding: 0 4px; }
.topbar__user:hover { text-decoration: none; color: var(--accent); }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: var(--radius); background: var(--accent); color: var(--white); font-weight: 700; font-size: 11px; }
.main { padding: 20px; max-width: 1400px; width: 100%; }
.inline { display: inline; margin: 0; }

.icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); border-radius: var(--radius); cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Bausteine */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; box-shadow: var(--shadow); transition: border-color .2s var(--ease);
}
.card:hover { border-color: color-mix(in srgb, var(--line) 65%, var(--accent)); }
.card--narrow { max-width: 420px; margin: 0 auto; }
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stack { display: grid; gap: 14px; }
.split { display: grid; gap: 14px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.page-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.page-head .h1 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 8px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--line);
  border-radius: var(--radius-lg); padding: 12px 14px; display: flex; flex-direction: column;
}
.stat__value { font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__label { color: var(--text-muted); font-size: 11px; }
.stat--ok { border-top-color: var(--ok); } .stat--warn { border-top-color: var(--warn); } .stat--fail { border-top-color: var(--fail); }

.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table td, .table th { padding: 6px 7px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child { white-space: nowrap; font-weight: 500; }
.table--data td:first-child { white-space: normal; }
.table--data thead th { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; }
.table--data tbody tr:hover td { background: var(--blue-50); }
.table-wrap { overflow-x: auto; }
.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix input { accent-color: var(--accent); width: 14px; height: 14px; }

.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: var(--radius); white-space: nowrap; }
.badge--ok { color: var(--ok); background: var(--ok-soft); }
.badge--warn { color: var(--warn); background: var(--warn-soft); }
.badge--fail { color: var(--fail); background: var(--fail-soft); }
.badge--muted { color: var(--text-muted); background: var(--surface-2); }
.badge--info { color: var(--info); background: var(--accent-soft); }

.notice { border-left: 3px solid var(--accent); background: var(--info-soft); padding: 8px 12px; border-radius: var(--radius); }
.notice--info { border-color: var(--accent); background: var(--accent-soft); }
.alert { padding: 8px 12px; margin-bottom: 12px; border-left: 3px solid var(--accent); background: var(--info-soft); border-radius: var(--radius); }
.alert--success { border-color: var(--ok); background: var(--ok-soft); }
.alert--error { border-color: var(--fail); background: var(--fail-soft); }
.alert--warn { border-color: var(--warn); background: var(--warn-soft); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; font: inherit; font-weight: 600; font-size: 12px;
  border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--white); cursor: pointer;
  transition: background .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--white); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: var(--blue-50); color: var(--accent); border-color: var(--accent); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { height: 24px; padding: 0 8px; font-size: 11px; }
.btn--danger { background: var(--fail); border-color: var(--fail); }
.btn--danger:hover { background: color-mix(in srgb, var(--fail) 85%, black); border-color: color-mix(in srgb, var(--fail) 85%, black); }
.btn--ghost.btn--danger { background: var(--surface); color: var(--fail); border-color: var(--line); }
.btn--ghost.btn--danger:hover { border-color: var(--fail); background: var(--fail-soft); color: var(--fail); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Formulare */
.form { display: grid; gap: 10px; }
.form--row { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.field { display: grid; gap: 3px; }
.field > span, .label { font-size: 11px; font-weight: 600; }
.input, .select, .textarea {
  width: 100%; height: 30px; padding: 0 9px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { height: auto; min-height: 70px; padding: 7px 9px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--fail); }
.field__error { color: var(--fail); font-size: 11px; }
.field__hint { color: var(--text-muted); font-size: 11px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; }
.check input { margin-top: 2px; accent-color: var(--accent); width: 14px; height: 14px; }

/* Listen, Kennzahlen, Sonstiges */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.kv dt { color: var(--text-muted); font-size: 11px; }
.kv dd { margin: 0; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; font: 12px/1.6 var(--mono); padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }
.secret { font: 12px/1.6 var(--mono); letter-spacing: .08em; word-break: break-all; background: var(--surface-2); padding: 6px 10px; border-radius: var(--radius); }
.empty { text-align: center; padding: 20px 8px; color: var(--text-muted); }
.pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.filters .input, .filters .select { width: auto; min-width: 150px; }
.widgets { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.widget__value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.widget-list { list-style: none; margin: 0; padding: 0; }
.widget-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.widget-list li:last-child { border-bottom: 0; }
details.card > summary, details > summary { cursor: pointer; font-weight: 600; }
.price { font-size: 16px; font-weight: 700; }
.products { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* Einfache Seiten (Anmeldung, Fehler) */
.plain { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg) 55%, var(--blue-100) 100%); }
.plain__main { width: 100%; max-width: 440px; }
.plain__brand { text-align: center; margin-bottom: 16px; }
.plain__brand .logo { height: 26px; width: auto; }
.plain__foot { text-align: center; color: var(--text-muted); font-size: 10px; margin-top: 14px; }

/* Responsive */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(11, 31, 58, .35); }
  .shell { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar__menu { display: inline-grid; }
  .topbar__name { display: none; }
  .main { padding: 14px 16px; }
  .grid--2, .split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats { gap: 8px; }
  .stat { padding: 10px; }
  .stat__value { font-size: 18px; }
  .card { padding: 12px; }
  .kv, .codes { grid-template-columns: 1fr; }
  .table--data thead { display: none; }
  .table tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 0; white-space: normal; }
  .table td:last-child { grid-column: 1 / -1; }
  .matrix tr { display: table-row; }
  .matrix td, .matrix th { display: table-cell; padding: 5px; border-bottom: 1px solid var(--line); }
  .filters .input, .filters .select { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Hilfsklassen statt style-Attributen: die CSP (style-src 'self') blockiert Inline-Styles. */
.u-as-center { align-self:center !important; }
.u-fs-14 { font-size:14px !important; }
.u-gap-10 { gap:10px !important; }
.u-gap-12 { gap:12px !important; }
.u-gap-8 { gap:8px !important; }
.u-h-32 { height:32px !important; }
.u-jc-between { justify-content:space-between !important; }
.u-jc-end { justify-content:end !important; }
.u-js-start { justify-self:start !important; }
.u-m-0 { margin:0 !important; }
.u-m-10-0-0 { margin:10px 0 0 !important; }
.u-m-2-0-0 { margin:2px 0 0 !important; }
.u-m-4-0 { margin:4px 0 !important; }
.u-m-4-0-0 { margin:4px 0 0 !important; }
.u-maxw-380 { max-width:380px !important; }
.u-maxw-520 { max-width:520px !important; }
.u-maxw-620 { max-width:620px !important; }
.u-maxw-720 { max-width:720px !important; }
.u-maxw-900 { max-width:900px !important; }
.u-mb-16 { margin-bottom:16px !important; }
.u-mt-0 { margin-top:0 !important; }
.u-mt-10 { margin-top:10px !important; }
.u-mt-12 { margin-top:12px !important; }
.u-mt-14 { margin-top:14px !important; }
.u-mt-16 { margin-top:16px !important; }
.u-mt-18 { margin-top:18px !important; }
.u-mt-6 { margin-top:6px !important; }
.u-p-12-16 { padding:12px 16px !important; }
.u-p-8-0 { padding:8px 0 !important; }
.u-rule-b { border-bottom:1px solid var(--line) !important; }
.u-w-80 { width:80px !important; }
.u-wb-break-word { word-break:break-word !important; }
.u-ws-pre-line { white-space:pre-line !important; }
.u-ws-pre-wrap { white-space:pre-wrap !important; }

/* Marke */
.brand { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); line-height: 1; }
.brand__mark { width: 24px; height: 24px; flex: none; }
.brand__word { font-size: 16px; font-weight: 700; color: var(--black); letter-spacing: -.01em; }
.brand__word b { color: var(--accent); font-weight: 700; }
.brand--lg .brand__mark { width: 32px; height: 32px; }
.brand--lg .brand__word { font-size: 21px; }
a.sidebar__brand, a.sidebar__brand:hover { text-decoration: none; color: inherit; }

/* Kontomenü am Nutzericon */
.icon--sm { width: 12px; height: 12px; }
.usermenu { position: relative; }
.usermenu > summary { list-style: none; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu__trigger { display: inline-flex; align-items: center; gap: 7px; padding: 3px 6px 3px 3px; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; user-select: none;
  transition: border-color .15s var(--ease), background .15s var(--ease); font-weight: 600; }
.usermenu__trigger:hover, .usermenu[open] .usermenu__trigger, .usermenu__trigger.is-active { border-color: var(--line); background: var(--surface-2); }
.usermenu[open] .usermenu__trigger .icon--sm { transform: rotate(180deg); }
.usermenu__panel { position: absolute; right: 0; top: calc(100% + 6px); width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(11, 31, 58, .12); padding: 6px; z-index: 30; animation: menu-in .14s var(--ease); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.usermenu__head { display: flex; gap: 9px; align-items: center; padding: 8px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }
.usermenu__item { display: flex; width: 100%; align-items: center; gap: 9px; padding: 6px 8px; color: var(--text); border-radius: var(--radius); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.usermenu__item:hover { background: var(--blue-50); color: var(--accent); text-decoration: none; }
.usermenu__item.is-active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.usermenu__logout { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.avatar--img { object-fit: cover; padding: 0; background: var(--surface-2); }
.avatar--md { width: 34px; height: 34px; font-size: 14px; }
.avatar--lg { width: 88px; height: 88px; font-size: 32px; }
.avatar-edit { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.input--file { height: auto; padding: 5px; }

/* Adressen (je Art eine) */
.addr-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.addr { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 12px; }
.addr--empty { border-style: dashed; }
.addr__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.addr__text { white-space: pre-line; margin: 0 0 6px; }

/* Messbalken, Status, Codezeilen */
/* Balken über <progress> – keine Inline-Styles nötig (CSP) */
progress.meter { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 80px; height: 6px; border: 0; border-radius: var(--radius); background: var(--surface-2); color: var(--accent); overflow: hidden; }
progress.meter::-webkit-progress-bar { background: var(--surface-2); }
progress.meter::-webkit-progress-value { background: var(--accent); }
progress.meter::-moz-progress-bar { background: var(--accent); }
progress.meter--warn::-webkit-progress-value { background: var(--warn); } progress.meter--warn::-moz-progress-bar { background: var(--warn); }
progress.meter--fail::-webkit-progress-value { background: var(--fail); } progress.meter--fail::-moz-progress-bar { background: var(--fail); }
.meter-row { display: grid; grid-template-columns: 90px 1fr 70px; gap: 8px; align-items: center; font-size: 11px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-right: 5px; vertical-align: 0; }
.dot--ok { background: var(--ok); } .dot--warn { background: var(--warn); } .dot--fail { background: var(--fail); } .dot--info { background: var(--accent); }
.mono { font-family: var(--mono); font-size: 11px; word-break: break-all; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 7px 12px; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a:hover { color: var(--accent); text-decoration: none; }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.type-picker { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.type-picker a { display: block; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; color: var(--text); background: var(--surface); transition: border-color .15s var(--ease), transform .15s var(--ease); }
.type-picker a:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.type-picker strong { display: block; color: var(--accent); margin-bottom: 2px; }
[hidden] { display: none !important; }
.u-w-60 { width: 60px !important; }
.u-w-120 { width: 120px !important; }
.u-minw-0 { min-width: 0 !important; }
.spark { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; margin-top: 6px; }
.spark__svg { width: 100%; height: 40px; background: var(--surface-2); border-radius: var(--radius); }
.spark__line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark__limit { stroke: var(--fail); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; vector-effect: non-scaling-stroke; }
select[multiple].select { height: auto; padding: 4px; }
