/* =====================================================================
   Komponenten: Glas, Buttons, Felder, Select, Toggle, Tabs, Badges,
   Tabellen, Drawer, Toast, Skeleton, User-Chips, Embed-Vorschau, Charts
   ===================================================================== */

/* ---------- Glasflächen & Karten ---------- */
.glass {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
}

.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: .95rem; }
.card-head p { color: var(--text-3); font-size: .82rem; margin-top: 2px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 18px 20px 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main-side { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: .86rem; font-weight: 550;
    white-space: nowrap;
    transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), color var(--dur-1) var(--ease), opacity var(--dur-1);
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-contrast); }
.btn-primary:hover:not(:disabled) { background: #a6dcff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: rgba(247, 139, 139, .25); }
.btn-discord { background: var(--discord); border-color: transparent; color: #fff; }
.btn-discord:hover:not(:disabled) { background: #4c58e0; border-color: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: .8rem; border-radius: var(--r-xs); }
.btn-lg { height: 46px; padding: 0 22px; font-size: .92rem; border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

/* ---------- Felder ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 560; color: var(--text); }
.field-help { font-size: .78rem; color: var(--text-3); line-height: 1.45; }
.field-full { grid-column: 1 / -1; }
.field-optional { font-weight: 450; color: var(--text-3); font-size: .74rem; }

.input, .textarea {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--input);
    color: var(--text);
    font-size: .88rem;
    transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
    -webkit-appearance: none;
    appearance: none;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover:not(:disabled), .textarea:hover:not(:disabled) { border-color: var(--border-strong); }
.input:focus, .textarea:focus { outline: none; border-color: var(--border-focus); background: rgba(143, 211, 255, .035); box-shadow: 0 0 0 3px rgba(143, 211, 255, .1); }
.input:disabled, .textarea:disabled { opacity: .5; cursor: not-allowed; }
.input.mono { font-family: var(--font-mono); font-size: .82rem; }

/* Zahlenfeld mit eigenen Steppern */
.number-field { position: relative; display: flex; align-items: stretch; }
.number-field .input { padding-right: 64px; -moz-appearance: textfield; }
.number-field .input::-webkit-outer-spin-button, .number-field .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.number-field-steps { position: absolute; right: 4px; top: 4px; bottom: 4px; display: flex; gap: 2px; }
.number-field-steps button { width: 28px; border-radius: 7px; color: var(--text-2); display: grid; place-items: center; transition: background var(--dur-1); }
.number-field-steps button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.number-field-steps svg { width: 14px; height: 14px; }
.input-suffix { position: absolute; right: 70px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: .8rem; pointer-events: none; }

/* Suche mit Icon */
.search-field { position: relative; }
.search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search-field .input { padding-left: 36px; }

/* Toggle-Schalter */
.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--input); transition: border-color var(--dur-1), background var(--dur-1); }
.toggle:hover { border-color: var(--border-strong); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { position: relative; flex: 0 0 auto; width: 38px; height: 22px; margin-top: 1px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .12); transition: background var(--dur-2) var(--ease); }
.toggle-track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-2) var(--ease); }
.toggle input:checked + .toggle-track { background: var(--accent-strong); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.toggle input:disabled ~ * { opacity: .5; }
.toggle-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toggle-copy strong { font-size: .84rem; font-weight: 560; }
.toggle-copy span { font-size: .78rem; color: var(--text-3); line-height: 1.45; }

/* Segmented Control */
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-sm); background: var(--input); border: 1px solid var(--border); }
.segmented button { height: 30px; padding: 0 12px; border-radius: 7px; font-size: .8rem; font-weight: 550; color: var(--text-2); transition: background var(--dur-1), color var(--dur-1); white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }

/* Filter-Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--border); background: transparent; color: var(--text-2); font-size: .8rem; font-weight: 520; transition: all var(--dur-1) var(--ease); }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: rgba(143, 211, 255, .3); color: var(--accent); }
.chip .chip-count { font-size: .72rem; color: var(--text-3); }

/* ---------- Custom Select ---------- */
.select { position: relative; min-width: 0; }
.select > select { display: none; }
.select-trigger {
    display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 5px 36px 5px 12px;
    border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--input);
    text-align: left; font-size: .88rem; color: var(--text);
    transition: border-color var(--dur-1), background var(--dur-1), box-shadow var(--dur-1);
}
.select-trigger:hover:not(:disabled) { border-color: var(--border-strong); }
.select.is-open .select-trigger, .select-trigger:focus-visible { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(143, 211, 255, .1); }
.select-trigger:disabled { opacity: .5; }
.select-trigger::after {
    content: ''; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
    border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
    transform: rotate(45deg); transition: transform var(--dur-2) var(--ease);
}
.select.is-open .select-trigger::after { transform: translateY(3px) rotate(-135deg); }
.select-value { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; flex: 1; }
.select-value .placeholder { color: var(--text-3); }
.select-single { display: flex; align-items: center; gap: 8px; min-width: 0; }
.select-single span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-tag { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 4px 0 9px; border-radius: var(--r-xs); background: var(--surface-3); font-size: .8rem; }
.select-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-tag button { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; color: var(--text-3); }
.select-tag button:hover { background: rgba(255, 255, 255, .1); color: var(--text); }
.select-tag button svg { width: 12px; height: 12px; }

.select-panel {
    position: fixed; z-index: 1000; min-width: 220px; max-width: 420px;
    padding: 6px; border-radius: var(--r-md); border: 1px solid var(--border-strong);
    background: var(--surface-popover); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-lg);
    transform-origin: top center;
    animation: pop-in var(--dur-2) var(--ease);
}
.select-panel.is-above { transform-origin: bottom center; }
.select-search { width: 100%; height: 34px; margin-bottom: 4px; padding: 0 10px; border-radius: var(--r-xs); border: 1px solid var(--border); background: rgba(255, 255, 255, .03); font-size: .84rem; }
.select-search:focus { outline: none; border-color: var(--border-focus); }
.select-options { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.select-group-label { padding: 8px 10px 4px; font-size: .68rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.select-option { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 6px 10px; border-radius: var(--r-xs); text-align: left; font-size: .85rem; color: var(--text-2); }
.select-option span.label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-option:hover, .select-option.is-active { background: var(--surface-3); color: var(--text); }
.select-option[aria-selected="true"] { color: var(--text); }
.select-option .check { width: 16px; height: 16px; color: var(--accent); opacity: 0; transition: opacity var(--dur-1); }
.select-option[aria-selected="true"] .check { opacity: 1; }
.select-option.is-missing { color: var(--warning); }
.select-empty { padding: 14px 10px; text-align: center; color: var(--text-3); font-size: .82rem; }
.opt-icon { width: 16px; height: 16px; color: var(--text-3); flex: 0 0 auto; }
.opt-hash { width: 16px; text-align: center; color: var(--text-3); font-weight: 600; flex: 0 0 auto; }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: #99aab5; box-shadow: 0 0 0 2px rgba(0, 0, 0, .25); }

/* ---------- Badges & Status ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font-size: .72rem; font-weight: 600; letter-spacing: .01em; border: 1px solid var(--border); color: var(--text-2); background: var(--surface); white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge-accent { color: var(--accent); background: var(--accent-soft); border-color: rgba(143, 211, 255, .22); }
.badge-success { color: var(--success); background: var(--success-soft); border-color: rgba(94, 224, 160, .22); }
.badge-warning { color: var(--warning); background: var(--warning-soft); border-color: rgba(245, 195, 91, .22); }
.badge-danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(247, 139, 139, .22); }
.badge-vip { color: #f5d38b; background: rgba(245, 211, 139, .1); border-color: rgba(245, 211, 139, .25); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.dot-live { animation: pulse-soft 2s ease-in-out infinite; }

.kbd-copy { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 10px; border-radius: var(--r-xs); border: 1px solid var(--border); background: rgba(0, 0, 0, .25); font-family: var(--font-mono); font-size: .8rem; color: var(--text); transition: border-color var(--dur-1); }
.kbd-copy:hover { border-color: var(--border-strong); }
.kbd-copy .copy-icon { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--text-3); transition: background var(--dur-1), color var(--dur-1); }
.kbd-copy:hover .copy-icon { background: var(--surface-3); color: var(--text); }
.kbd-copy svg { width: 13px; height: 13px; }
.kbd-copy.is-copied .copy-icon { color: var(--success); }

/* ---------- Tabs ---------- */
.tabs { position: relative; display: flex; gap: 2px; padding: 4px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: var(--r-sm); font-size: .84rem; font-weight: 550; color: var(--text-2); white-space: nowrap; transition: color var(--dur-2) var(--ease); }
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tabs-indicator { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: var(--r-sm); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border); transition: transform var(--dur-3) var(--ease), width var(--dur-3) var(--ease); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .85rem; }
.table th { position: sticky; top: 0; padding: 10px 14px; text-align: left; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border); white-space: nowrap; background: transparent; }
.table th.is-sortable { cursor: pointer; user-select: none; }
.table th.is-sortable:hover { color: var(--text-2); }
.table td { padding: 11px 14px; border-bottom: 1px solid rgba(255, 255, 255, .045); vertical-align: middle; color: var(--text-2); }
.table td.strong { color: var(--text); font-weight: 520; }
.table tbody tr { transition: background var(--dur-1); }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--text-3); font-size: .8rem; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .search-field { flex: 1 1 240px; max-width: 360px; }
.toolbar .select { min-width: 170px; }

/* ---------- Leere Zustände, Skeleton, Hinweise ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty svg { width: 36px; height: 36px; color: var(--text-3); opacity: .7; margin-bottom: 4px; }
.empty strong { color: var(--text-2); font-weight: 560; font-size: .92rem; }
.empty p { font-size: .82rem; max-width: 380px; }

.skeleton { position: relative; overflow: hidden; border-radius: var(--r-xs); background: linear-gradient(90deg, rgba(255, 255, 255, .04) 0%, rgba(255, 255, 255, .08) 50%, rgba(255, 255, 255, .04) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-line { height: 12px; margin: 8px 0; }
.skeleton-block { height: 120px; border-radius: var(--r-md); }

.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); font-size: .84rem; color: var(--text-2); }
.notice svg { width: 18px; height: 18px; margin-top: 1px; color: var(--text-3); }
.notice strong { display: block; color: var(--text); font-weight: 580; margin-bottom: 2px; }
.notice-warning { border-color: rgba(245, 195, 91, .22); background: rgba(245, 195, 91, .06); }
.notice-warning svg { color: var(--warning); }
.notice-danger { border-color: rgba(247, 139, 139, .22); background: rgba(247, 139, 139, .06); }
.notice-danger svg { color: var(--danger); }
.notice-accent { border-color: rgba(143, 211, 255, .2); background: var(--accent-softer); }
.notice-accent svg { color: var(--accent); }

/* Info-Icon mit Tooltip */
.info { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--text-3); cursor: help; }
.info svg { width: 14px; height: 14px; }
.info:hover, .info:focus-visible { color: var(--accent); }
.tooltip { position: fixed; z-index: 1200; max-width: 280px; padding: 8px 10px; border-radius: var(--r-xs); background: var(--surface-popover); border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); font-size: .78rem; color: var(--text); line-height: 1.45; pointer-events: none; animation: fade-in var(--dur-1) var(--ease); }

/* ---------- Avatare & User-Chips ---------- */
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--surface-3); }
.avatar-sm { width: 22px; height: 22px; }
.avatar-lg { width: 40px; height: 40px; }
.avatar-xl { width: 56px; height: 56px; }
.avatar-fallback { display: grid; place-items: center; font-size: .72rem; font-weight: 650; color: var(--text); background: linear-gradient(135deg, rgba(143, 211, 255, .25), rgba(99, 120, 255, .2)); }

.user-chip { display: inline-flex; align-items: center; gap: 9px; min-width: 0; max-width: 100%; vertical-align: middle; }
.user-chip .avatar { width: 26px; height: 26px; }
.user-chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-chip-name { color: var(--text); font-weight: 540; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-sub { color: var(--text-3); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip.is-loading .user-chip-name { width: 90px; height: 11px; border-radius: 4px; background: rgba(255, 255, 255, .07); color: transparent; }
.user-chip.is-unknown .user-chip-name { color: var(--text-2); }
.user-chip-sm .avatar { width: 20px; height: 20px; }
.user-chip-sm .user-chip-name { font-size: .82rem; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { width: 26px; height: 26px; border: 2px solid var(--bg-elevated); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.role-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border); font-size: .76rem; color: var(--text-2); white-space: nowrap; }
.channel-pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--r-xs); background: var(--surface-2); font-size: .78rem; color: var(--text-2); white-space: nowrap; }
.channel-pill b { color: var(--text-3); font-weight: 600; }

/* ---------- Drawer & Modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 900; background: rgba(3, 4, 6, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade-in var(--dur-2) var(--ease); }
.overlay.is-closing { animation: fade-in var(--dur-2) var(--ease) reverse forwards; }
.drawer { position: fixed; z-index: 950; top: 12px; right: 12px; bottom: 12px; width: min(560px, calc(100vw - 24px)); display: flex; flex-direction: column; border-radius: var(--r-xl); border: 1px solid var(--border-strong); background: rgba(13, 15, 20, .94); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow-lg); transform: translateX(0); animation: drawer-in var(--dur-3) var(--ease); }
.drawer.is-closing { animation: drawer-out var(--dur-2) var(--ease-in-out) forwards; }
@keyframes drawer-in { from { transform: translateX(calc(100% + 24px)); } to { transform: none; } }
@keyframes drawer-out { to { transform: translateX(calc(100% + 24px)); } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 1.05rem; }
.drawer-head p { color: var(--text-3); font-size: .8rem; margin-top: 3px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 24px; }
.drawer-section + .drawer-section { margin-top: 22px; }
.drawer-section h4 { font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); font-weight: 620; margin-bottom: 10px; }

.dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; font-size: .85rem; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }

.modal { position: fixed; z-index: 950; left: 50%; top: 50%; width: min(460px, calc(100vw - 32px)); transform: translate(-50%, -50%); padding: 22px; border-radius: var(--r-xl); border: 1px solid var(--border-strong); background: rgba(13, 15, 20, .96); box-shadow: var(--shadow-lg); animation: pop-in var(--dur-2) var(--ease); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 1300; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--surface-popover); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow-md); font-size: .85rem; pointer-events: auto; animation: rise-in var(--dur-2) var(--ease); }
.toast svg { width: 18px; height: 18px; flex: 0 0 auto; }
.toast-success svg { color: var(--success); }
.toast-error svg { color: var(--danger); }
.toast.is-leaving { animation: fade-in var(--dur-2) var(--ease) reverse forwards; }

/* ---------- Speicherleiste ---------- */
.savebar { position: fixed; z-index: 800; left: 50%; bottom: 20px; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: var(--r-lg); border: 1px solid var(--border-strong); background: rgba(17, 19, 25, .92); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow-lg); transform: translate(-50%, 140%); opacity: 0; transition: transform var(--dur-3) var(--ease), opacity var(--dur-2) var(--ease); }
.savebar.is-visible { transform: translate(-50%, 0); opacity: 1; }
.savebar-text { font-size: .86rem; color: var(--text-2); white-space: nowrap; }
.savebar-text strong { color: var(--text); font-weight: 560; }
.savebar.is-shaking { animation: shake .4s var(--ease); }
@keyframes shake { 0%, 100% { transform: translate(-50%, 0); } 25% { transform: translate(calc(-50% - 6px), 0); } 75% { transform: translate(calc(-50% + 6px), 0); } }

/* ---------- KPI-Kacheln ---------- */
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); min-width: 0; }
.kpi-label { display: flex; align-items: center; gap: 7px; font-size: .78rem; color: var(--text-3); font-weight: 520; }
.kpi-label svg { width: 15px; height: 15px; }
.kpi-value { font-size: 1.75rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.15; }
.kpi-meta { font-size: .78rem; color: var(--text-3); }
.kpi-meta .up { color: var(--success); }
.kpi-meta .down { color: var(--danger); }

/* ---------- Fortschritt & Balken ---------- */
.progress { height: 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .07); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; animation: grow-x .8s var(--ease) both; }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 52px; align-items: center; gap: 12px; font-size: .84rem; }
.bar-row .bar-label { color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { position: relative; height: 10px; border-radius: 4px; }
.bar-row .bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--accent); transform-origin: left; animation: grow-x .7s var(--ease) both; }
.bar-row .bar-value { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 540; }
.bar-row:hover .bar-fill { filter: brightness(1.15); }

.stacked { display: flex; height: 10px; gap: 2px; border-radius: 4px; overflow: hidden; }
.stacked > span { height: 100%; transform-origin: left; animation: grow-x .7s var(--ease) both; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .78rem; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Linien-/Flächendiagramm ---------- */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: rgba(255, 255, 255, .06); stroke-width: 1; }
.chart .axis-label { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-area { opacity: .16; }
.chart .crosshair { stroke: rgba(255, 255, 255, .22); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hover-dot { stroke: var(--bg-elevated); stroke-width: 2; }
.chart .col { transition: opacity var(--dur-1); }
.chart .col:hover { opacity: .8; }
.chart-tooltip { position: absolute; z-index: 5; min-width: 120px; padding: 8px 10px; border-radius: var(--r-xs); background: var(--surface-popover); border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); font-size: .78rem; pointer-events: none; transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; }
.chart-tooltip strong { display: block; color: var(--text); margin-bottom: 4px; font-weight: 580; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.chart-tooltip .tt-row b { margin-left: auto; padding-left: 12px; color: var(--text); font-weight: 560; font-variant-numeric: tabular-nums; }
.chart-draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Discord-Nachrichtenvorschau ---------- */
.dc-preview { padding: 16px; border-radius: var(--r-lg); background: #313338; border: 1px solid rgba(0, 0, 0, .25); font-family: 'gg sans', 'Noto Sans', var(--font); color: #dbdee1; font-size: .9rem; line-height: 1.375; }
.dc-preview-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: .74rem; font-weight: 620; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.dc-message { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 0 14px; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; background: #5865f2; display: grid; place-items: center; overflow: hidden; }
.dc-avatar { position: relative; background: #fff; }
.dc-avatar img { position: absolute; left: -75%; top: -22.5%; width: 250%; height: 250%; max-width: none; }
.dc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.dc-name { color: #f2f3f5; font-weight: 600; }
.dc-bot { display: inline-flex; align-items: center; height: 15px; padding: 0 4px; border-radius: 3px; background: #5865f2; color: #fff; font-size: .62rem; font-weight: 600; }
.dc-time { color: #949ba4; font-size: .74rem; }
.dc-content { white-space: pre-wrap; overflow-wrap: anywhere; }
.dc-embed { display: grid; max-width: 520px; margin-top: 6px; border-radius: 4px; background: #2b2d31; border-left: 4px solid #1e1f22; padding: 10px 16px 14px 12px; gap: 6px; }
.dc-embed-title { color: #f2f3f5; font-weight: 600; font-size: .95rem; overflow-wrap: anywhere; }
.dc-embed-desc { font-size: .86rem; white-space: pre-wrap; overflow-wrap: anywhere; color: #dbdee1; }
.dc-embed-fields { display: grid; gap: 8px; margin-top: 2px; }
.dc-embed-field strong { display: block; color: #f2f3f5; font-size: .82rem; }
.dc-embed-field span { font-size: .84rem; }
.dc-embed-image { margin-top: 8px; border-radius: 4px; overflow: hidden; max-height: 260px; }
.dc-embed-image img { width: 100%; height: auto; object-fit: cover; }
.dc-embed-footer { display: flex; align-items: center; gap: 8px; margin-top: 4px; color: #949ba4; font-size: .74rem; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 3px; background: #4e5058; color: #fff; font-size: .82rem; font-weight: 500; }
.dc-button.primary { background: #5865f2; }
.dc-button.success { background: #248046; }
.dc-button.danger { background: #da373c; }
.dc-select { margin-top: 8px; max-width: 420px; height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-radius: 4px; background: #1e1f22; color: #949ba4; font-size: .86rem; }
.dc-reactions { display: flex; gap: 4px; margin-top: 6px; }
.dc-reaction { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 6px; border-radius: 8px; background: #2b2d31; border: 1px solid transparent; font-size: .8rem; color: #b5bac1; }
.dc-mention { padding: 0 2px; border-radius: 3px; background: rgba(88, 101, 242, .3); color: #c9cdfb; font-weight: 500; }
.dc-preview code { background: #1e1f22; padding: 1px 4px; border-radius: 4px; font-size: .82em; }
.dc-preview .dc-small { color: #949ba4; font-size: .8em; }
.dc-quote { display: block; padding-left: 10px; border-left: 4px solid #4e5058; }
.dc-h1 { font-size: 1.3em; font-weight: 700; display: block; margin: 4px 0; }
.dc-h2 { font-size: 1.15em; font-weight: 700; display: block; margin: 4px 0; }
.dc-h3 { font-size: 1em; font-weight: 700; display: block; margin: 2px 0; }

/* ---------- Listen-Editor ---------- */
.list-editor { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; align-items: center; gap: 8px; animation: rise-in var(--dur-2) var(--ease); }
.list-row .input { flex: 1; }
.list-row-index { width: 22px; flex: 0 0 auto; text-align: center; font-size: .78rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.object-card { padding: 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: rgba(255, 255, 255, .02); animation: rise-in var(--dur-2) var(--ease); }
.object-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: .8rem; color: var(--text-3); font-weight: 560; }
.object-card .form-grid { gap: 12px; }
.emoji-palette { display: flex; flex-wrap: wrap; gap: 4px; }
.emoji-palette button { width: 34px; height: 34px; border-radius: var(--r-xs); font-size: 1.05rem; transition: background var(--dur-1), transform var(--dur-1); }
.emoji-palette button:hover { background: var(--surface-3); transform: scale(1.08); }
.token-list { display: flex; flex-wrap: wrap; gap: 6px; }
.token { height: 26px; padding: 0 9px; border-radius: var(--r-xs); border: 1px dashed var(--border-strong); font-family: var(--font-mono); font-size: .76rem; color: var(--text-2); transition: all var(--dur-1); }
.token:hover { color: var(--accent); border-color: rgba(143, 211, 255, .4); background: var(--accent-softer); }

/* Farbe */
.color-field { display: flex; align-items: center; gap: 8px; }
.color-swatch { position: relative; width: 40px; height: 40px; flex: 0 0 auto; border-radius: var(--r-sm); border: 1px solid var(--border-strong); overflow: hidden; }
.color-swatch input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); border: 0; padding: 0; cursor: pointer; background: none; }

/* ---------- Zeitraum-Auswahl ---------- */
.range-picker { position: relative; display: inline-block; max-width: 100%; }
.range-picker .segmented button svg { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; }
.range-popover { position: absolute; z-index: 120; top: calc(100% + 8px); left: 0; width: min(360px, calc(100vw - 32px)); padding: 16px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--surface-popover); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow-lg); animation: pop-in var(--dur-2) var(--ease); }
.input[type="date"] { color-scheme: dark; }
.input[type="date"]::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; }
