/* ==========================================================================
   1. DESIGN TOKENS & SYSTEM VARIABLES
   ========================================================================== */
:root {
	/* text */
	--text-inverse: rgba(255, 255, 255, 1);

	/* Accent & Semantics */
	--accent-soft: rgba(55, 138, 221, 0.2);
	--positive: rgba(59, 109, 17, 1);
	--negative: rgba(163, 45, 45, 1);
	--warning: rgba(255, 159, 67, 1);

	/* Für volatile_down Trend */
	--neutral: rgba(136, 135, 128, 0.75);

	/* Universal Layout Specs */
	--radius-sm: 4px;
	--radius-md: 6px;
	--gap-xs: 2px;
	--gap-sm: 5px;
	--gap-md: 8px;
	--gap-lg: 10px;
	--fs-sm: 10px;
	--fs-lg: 12px;
	--fs-xl: 16px;
}

/* ==========================================================================
   2. GLOBAL RESET & BASE STYLES
   ========================================================================== */
* {
	box-sizing: border-box;
	margin: 0;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: var(--fs-lg);
	line-height: 1.4;
	padding: var(--gap-lg);
	height: 100vh;
	display: flex;
	flex-direction: column;
	gap: var(--gap-sm);
	overflow: hidden;
}

::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}

::-webkit-scrollbar-track {
	background: transparent;
}

::-webkit-scrollbar-thumb {
	background: var(--text3);
	border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--text2);
}

/* ==========================================================================
   3. UNIVERSELLE LAYOUT-BAUSTEINE
   ========================================================================== */

.panel {
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: var(--gap-md) var(--gap-lg);
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
}

.panel.interactive {
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s;
}
/*
.panel.interactive:hover,
.panel.interactive.active {
	border-color: var(--accent);
}

.panel.interactive.active {
	background: var(--accent-soft);
}

*/

.panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: 600;
	margin-bottom: var(--gap-md);
	color: var(--text);
	flex-shrink: 0;
}

.flex-col {
	display: flex;
	flex-direction: column;
	gap: var(--gap-sm);
	min-height: 0;
	min-width: 400;
	flex: 1;
}

/* ==========================================================================
   4. LAYOUT FORM FIELDS & CONTROLS
   ========================================================================== */

.selector-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-sm) var(--gap-sm);
    align-items: flex-end;
    background: var(--bg2);
    padding: var(--gap-md) var(--gap-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.parameter-block {
	display: flex;
	flex-direction: column;
	gap: var(--gap-xs);
	flex: 1;
	min-width: 100px;
	position: relative; /* CHANGED: Added relative context for internal line markers */
}

input,
select {
	background: var(--bg);
	border: 1px solid var(--border);
	color: var(--text);
	padding: var(--gap-sm) var(--gap-md);
	border-radius: var(--radius-sm);
	font-size: var(--fs-lg);
	outline: none;
	height: 28px;
	width: 100%;
}

input:focus,
select:focus {
	border-color: var(--accent);
}

/* --- ADD THIS BLOCK HERE --- */
input[type="range"] {
	padding: 0;
	cursor: pointer;
	background: transparent;
}
/* --------------------------- */

/* Checkboxes/radios must not inherit the block-level input sizing above */
input[type="checkbox"],
input[type="radio"] {
	width: 14px;
	height: 14px;
	padding: 0;
	flex-shrink: 0;
	accent-color: var(--accent);
	cursor: pointer;
}

.btn {
	height: 28px;
	padding: 0 var(--gap-lg);
	border-radius: var(--radius-sm);
	border: none;
	font-size: var(--fs-lg);
	font-weight: 600;
	cursor: pointer;
	color: var(--text-inverse);
	white-space: nowrap;
}

.btn-primary {
	background: var(--accent);
}

.btn-success {
	background: var(--positive);
}

/* ==========================================================================
   5. COMPONENT-SPECIFIC FINE TUNING
   ========================================================================== */

/* App Header */
.app-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--gap-sm) var(--gap-sm);
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	flex-shrink: 0;
}

.app-header-title {
	font-size: var(--fs-xl);
	font-weight: bold;
}

.theme-btn,
.app-header-btn {
	background: transparent;
	border: none;
	font-size: var(--fs-xl);
	cursor: pointer;
	padding: var(--gap-xs);
	border-radius: var(--radius-sm);
}

.theme-btn:hover,
.app-header-btn:hover {
	background: var(--border);
}

/* Asset Search Dropdown */
.asset-search-wrap {
	position: relative;
	width: 100%;
}

.asset-counter-text {
	color: var(--text2);
	font-weight: normal;
	font-size: var(--fs-sm);
}

.asset-filter-toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--gap-xs);
	margin-left: var(--gap-md);
	font-size: var(--fs-sm);
	font-weight: normal;
	color: var(--text2);
	cursor: pointer;
}

.asset-item-blacklist-label {
	font-size: var(--fs-sm);
	display: flex;
	align-items: center;
	gap: var(--gap-xs);
	cursor: pointer;
}

.asset-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	width: 100%;
	background: var(--bg2);
	border: 1px solid var(--accent);
	border-radius: var(--radius-sm);
	z-index: 100;
	max-height: 200px;
	overflow-y: auto;
	margin-top: var(--gap-xs);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.asset-item {
	padding: var(--gap-sm) var(--gap-md);
	cursor: pointer;
}

.asset-item:hover,
.asset-item.active {
	background: var(--accent);
	color: var(--text-inverse);
}

/* ==========================================================================
   6. STRATEGY EDITOR OVERLAY
   ========================================================================== */

/* Fullscreen overlay — hidden by default, toggled via .open */
.strategy-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: var(--bg);
	flex-direction: column;
	gap: var(--gap-md);
	padding: var(--gap-lg);
}

.strategy-overlay.open {
	display: flex;
}

/* Header bar */
.strategy-overlay-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--gap-sm) var(--gap-sm);
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	flex-shrink: 0;
}

.strategy-overlay-title {
	font-size: var(--fs-xl);
	font-weight: bold;
	color: var(--text);
}

.strategy-overlay-close {
	height: 28px;
	padding: 0 var(--gap-lg);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	background: transparent;
	color: var(--text);
	font-size: var(--fs-lg);
	font-weight: 600;
	cursor: pointer;
}

.strategy-overlay-close:hover {
	background: var(--negative);
	color: var(--text-inverse);
	border-color: var(--negative);
}

/* Body: two-column split */
.strategy-overlay-body {
	display: flex;
	flex-direction: row;
	gap: var(--gap-md);
	flex: 1;
	min-height: 0;
}

/* Controls column (flex 3) */
.strategy-controls-section {
	flex: 3;
	display: flex;
	flex-direction: column;
	gap: var(--gap-md);
	min-height: 0;
	overflow-y: auto;
	padding-right: var(--gap-xs);
}

/* Preview column (flex 1) */
.strategy-preview-section {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	min-width: 180px;
	border-left: 1px solid var(--border);
	padding-left: var(--gap-md);
}

/* Indicator cards grid */
.strategy-indicators-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: var(--gap-md);
	flex-shrink: 0;
}

.indicator-card {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: var(--gap-md);
	display: flex;
	flex-direction: column;
	gap: var(--gap-sm);
}

.indicator-card-header {
	display: flex;
	justify-content: space-between;
	font-weight: bold;
	font-size: var(--fs-sm);
	text-transform: uppercase;
	color: var(--accent);
}

/* Rules engine */
.strategy-rules-section {
	display: flex;
	flex-direction: column;
	gap: var(--gap-sm);
	border-top: 1px solid var(--border);
	padding-top: var(--gap-md);
	flex-shrink: 0;
}

.rule-row {
	display: flex;
	align-items: center;
	gap: var(--gap-sm);
	background: var(--bg);
	padding: var(--gap-xs) var(--gap-sm);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
}

.rule-keyword {
	font-weight: bold;
	color: var(--accent);
	width: 25px;
	font-size: var(--fs-sm);
}

.rule-operator {
	font-weight: bold;
	color: var(--warning);
	width: 50px;
	text-align: center;
}

.btn-remove {
	background: transparent;
	border: none;
	color: var(--negative);
	font-size: var(--fs-xl);
	cursor: pointer;
	font-weight: bold;
}

/* Payload preview — fills the preview column */
.payload-content {
	flex: 1;
	background: var(--bg);
	padding: var(--gap-md);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	overflow-y: auto;
	font-family: monospace;
	font-size: var(--fs-sm);
	color: #a5d6a7;
	margin: 0;
}

/* ==========================================================================
   7. PERIOD CARDS
   ========================================================================== */

.period-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: var(--gap-sm);
	flex-shrink: 0;
	width: 100%;
}

.period-card-title {
	font-size: 10px;
	font-weight: 600;
	margin-bottom: var(--gap-xs);
	color: var(--text);
}

.period-card-metrics {
	display: flex;
	flex-direction: column;
	gap: var(--gap-xs);
	margin-top: var(--gap-sm);
}

.period-card-metric {
	display: flex;
	justify-content: space-between;
	font-size: var(--fs-sm);
}

.period-card-metric-label {
	color: var(--text2);
}

.period-card-metric-value {
	font-weight: 600;
}

.text-positive {
	color: var(--positive);
}

.text-negative {
	color: var(--negative);
}

.period-card-trend {
	font-size: var(--fs-sm);
	text-transform: uppercase;
	color: var(--text2);
	font-weight: 500;
}

.period-card-trend.trend-uptrend {
	color: var(--positive);
	font-weight: 700;
}

.period-card-trend.trend-downtrend {
	color: var(--negative);
	font-weight: 700;
}

.period-card-trend.trend-accumulation {
	color: var(--accent);
	font-weight: 600;
}

.period-card-trend.trend-volatile_down {
	color: var(--warning);
	font-weight: 600;
}

.period-card-trend.trend-sideways {
	color: var(--neutral);
}

/* ==========================================================================
   8. DASHBOARD GRID & CHARTS
   ========================================================================== */

.dashboard-grid {
	display: flex;
	gap: var(--gap-sm);
	flex: 1;
	min-height: 0;
	width: 100%;
}

.dashboard-grid > .flex-col:first-child {
	flex: 3;
}

.dashboard-grid > .flex-col:nth-child(2) {
	flex: 1;
	min-width: 340px;
}
.chart-box {
	flex: 1;
	min-height: 0;
	position: relative;
}

.chart-box canvas {
	width: 100% !important;
	height: 100% !important;
}

/* ==========================================================================
   9. TRADE LOG
   ========================================================================== */

#trade-log {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.tlog {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: var(--fs-lg);
}

.tlog th {
    position: sticky;
    top: 0;
    background: var(--bg2);
    color: var(--text2);
    font-weight: normal;
    font-size: var(--fs-sm);
    padding: var(--gap-sm) var(--gap-md);
    border-bottom: 1px solid var(--border);
    z-index: 2;
}

.tlog td {
    padding: var(--gap-sm) var(--gap-md);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.tlog tbody tr.selectable-row {
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.tlog tbody tr.selectable-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.tlog tbody tr.selectable-row.selected {
    background: var(--accent-soft) !important;
    box-shadow: inset 3px 0 0 0 var(--accent);
}

.badge {
    display: inline-block;
    padding: var(--gap-xs) var(--gap-sm);
    font-size: var(--fs-sm);
    font-weight: bold;
    border-radius: var(--radius-sm);
    color: var(--text-inverse);
    text-transform: uppercase;
    text-align: center;
    min-width: 42px;
}

.badge-positive {
    background: var(--positive);
}

.badge-negative {
    background: var(--negative);
}

/* ==========================================================================
   10. STRATEGY RULE BLOCKS
   ========================================================================== */

.rule-block {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--gap-md);
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}

.rule-block-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--gap-sm);
    min-width: 0;
}

.rule-action {
    width: 68px;
    flex-shrink: 0;
}

.rule-conditions {
    display: flex;
    flex-direction: column;
    gap: var(--gap-xs);
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.rule-block-footer {
    display: flex;
    gap: var(--gap-sm);
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: var(--gap-sm);
}

.strategy-rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.strategy-rules-container {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}

.rule-row {
    flex-wrap: nowrap;
    overflow: hidden;
}

.rule-row select,
.rule-row input[type="number"] {
    width: auto;
    flex: 1 1 0;
    min-width: 60px;
}

.rule-row .rule-keyword {
    flex: 0 0 auto;
}

.rule-row .rule-operator {
    flex: 0 0 58px;
    width: 58px;
}

.rule-row .btn-remove {
    flex-shrink: 0;
}

/* ==========================================================================
   TRADE LOG CONFIGURATIONS (No Inline Styles)
   ========================================================================== */

.tlog-controls {
    margin-bottom: var(--gap-md);
    display: flex;
    gap: var(--gap-md);
    align-items: center;
}

.tlog-controls label {
    font-size: var(--fs-lg);
    color: var(--text2);
}

.tlog-date {
    color: var(--text2);
    font-size: var(--fs-sm);
}

/* ==========================================================================
   11. NEW: DYNAMIC BEST RESULT SLIDER MARKERS
   ========================================================================== */
.slider-marker {
    position: absolute;
    bottom: 0;
    height: 28px;               /* Matches height token of input fields exactly */
    width: 2px;                 /* Clean visual line width */
    background-color: var(--warning); /* Highlights line using your warning theme design token */
    pointer-events: none;       /* Allows standard input mouse click-throughs to slider thumb underneath */
    display: none;              /* Stays hidden until active polling populates positions */
    z-index: 10;                /* Places overlay directly over your slider tracks */
    box-shadow: 0 0 4px var(--warning);
}

/* ── Loading / error states ───────────────────────────────────────────── */
.perf-loading {
    color: var(--text2);
    font-size: var(--fs-lg);
    padding: var(--gap-lg);
    text-align: center;
}

.perf-error {
    color: var(--negative);
    font-size: var(--fs-lg);
    padding: var(--gap-lg);
    text-align: center;
    background: rgba(163, 45, 45, 0.08);
    border-radius: var(--radius-md);
    border: 1px solid rgba(163, 45, 45, 0.3);
}

/* ── Candidate cards grid ─────────────────────────────────────────────── */
.perf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--gap-md);
    overflow-y: auto;
}

/* ── Individual candidate card ────────────────────────────────────────── */
.perf-card {
    gap: var(--gap-sm);
    flex-shrink: 0;
}

.perf-card--negative {
    opacity: 0.7;
}

.perf-card--negative:hover {
    opacity: 1;
}

.perf-card-key {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.perf-card-description {
    font-size: var(--fs-sm);
    color: var(--text2);
    line-height: 1.5;
    flex-shrink: 0;
    border-left: 2px solid var(--border);
    padding-left: var(--gap-sm);
}

.perf-card-metrics {
    display: flex;
    flex-direction: column;
    gap: var(--gap-xs);
    margin-top: var(--gap-sm);
}

.perf-card-metric {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-sm);
}

.perf-card-apply-btn {
    font-size: var(--fs-sm);
    padding: 2px 8px;
    flex-shrink: 0;
}


/* ==========================================================================
   12. TASK UPDATES COMPONENT STYLING
   ========================================================================== */
.task-badge-active {
    background: var(--accent);
    color: var(--text-inverse);
}

.task-badge-inactive {
    background: var(--text3);
    color: var(--bg);
}

/* Styled native progress bars matching custom theme design tokens */
progress.task-progress-bar {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

progress.task-progress-bar::-webkit-progress-bar {
    background: var(--bg);
}

progress.task-progress-bar::-webkit-progress-value {
    background: var(--accent);
}

progress.task-progress-bar::-moz-progress-bar {
    background: var(--accent);
}

/* ==========================================================================
   13. TOGGLE SWITCH COMPONENT
   ========================================================================== */
.switch-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    flex-shrink: 0;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg3);
    transition: background-color 0.25s ease, border-color 0.25s ease;
    border-radius: 22px;
    border: 1px solid var(--border);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
}

.switch-container input:checked + .switch-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

.switch-container input:checked + .switch-slider:before {
    transform: translateX(22px);
    background-color: var(--text-inverse);
}

/* ==========================================================================
   14. SPLIT PANE LAYOUT & RESIZER CLASSES
   ========================================================================== */
.main-split-container {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 60px); /* Adjusts perfectly below the header */
    width: 100%;
    min-height: 0;
    flex: 1;
}

.left-column {

    display: flex;
    flex-direction: column;
    flex: 3;
    min-width: 0;
    height: 100%;
    gap: var(--gap-sm);
}

.right-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}

.right-column.hidden,
.resizer.hidden {
    display: none !important;
}

.resizer {
    gap: var(--gap-sm) var(--gap-sm);
    width: 6px;
    background: var(--bg3);
    cursor: col-resize;
    transition: background 0.2s ease;
    flex-shrink: 0;
    height: 100%;
}

.resizer:hover,
.resizer.dragging {
    background: var(--accent);
}

.flex-1 {
    flex: 1;
}

/* ==========================================================================
   15. STRATEGY EDITOR MODERNIZED CLASSES
   ========================================================================== */
.strategy-sidebar-panel {
    overflow-y: auto;
    min-width: 285;
    height: 100%;
}

.strategy-module {
    background: var(--bg3);
    gap: var(--gap-sm) var(--gap-sm);
    padding: var(--gap-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-height: 0;
}



.strategy-module-header {
    font-weight: 600;
    font-size: var(--fs-lg);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--gap-xs);
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}



.strategy-header-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-sm);
    align-items: center;
    justify-content: space-between;
}

.strategy-header-title {
    font-weight: 600;
    font-size: var(--fs-lg);
}

.strategy-actions-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
    align-items: center;
}

.btn-sm-action {
    padding: 0 8px;
    font-size: 11px;
    height: 24px;
    line-height: 24px;
    display: inline-flex;
    align-items: center;
}

.btn-danger {
    background: var(--negative);
    color: var(--text-inverse);
}

.btn-danger:hover {
    filter: brightness(1.15);
}

.strategy-inputs-row {
    display: flex;
    gap: var(--gap-sm);
    width: 100%;
}

.parameter-label-row {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-sm);
}

.strategy-construction-split {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    flex: 1;
    min-height: 0;
}


.strategy-select-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
}

.select-sm {
    width: auto;
    height: 24px;
    font-size: 11px;
    padding: 2px;
}

.strategy-indicators-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap-sm);
    overflow-y: auto;
    margin-top: var(--gap-xs);
}

.strategy-rules-container {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    overflow-y: auto;
    margin-top: var(--gap-xs);
}

.serialization-output {
    font-size: 10px;
    overflow-y: auto;
    background: var(--bg);
}


/* Add this to style.css */
.modal-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
}

/* Ensure the overlay background is dimmed */
.strategy-overlay {
    background: rgba(0, 0, 0, 0.8) !important; /* Dim the background */
}


/* ==========================================================================
   Global overlay classes
   ========================================================================== */


#Overlay {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    gap:  var(--gap-sm) var(--gap-sm);
    padding: var(--gap-sm) var(--gap-sm);
    display: none;
    /* Ensure it doesn't get squashed */
    flex-shrink: 0;
}


/* ==========================================================================
   15. PERFORMANCE EDITOR CLASSES
   ========================================================================== */

#performance-log {
    display: flex;
    flex-direction: column;
    /* Ensure the table doesn't force a hidden overflow */
    width: 100%;
}

/* Fix for table to be scrollable within the flex container */
.tlog {
    width: 100%;
    border-collapse: collapse;
}



/* Carousel Viewport Container */
.period-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    border-radius: var(--radius-md);
}

#period-grid {
    display: flex;
    transition: transform 0.3s ease;
    width: 100%;
    /* Verhindert das Verwischen bei GPU-Transformationen */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.period-carousel-card {
    min-width: 100% !important;
    width: 100% !important;
    flex: 0 0 100% !important;
    box-sizing: border-box !important;
    overflow: hidden;
    background: var(--bg2);

    /* Erzwingt klares Font-Rendering auf allen Systemen */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.period-carousel-card.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    background: var(--bg2); /* Setzt den Hintergrund auf das normale Panel-Dunkelgrau zurück */
}}

/* ==========================================================================
   CHART RESIZER FIX
   ========================================================================== */
#charts-container {
    gap: 0; /* Entfernt den doppelten Flexbox-Abstand um den Balken */
}

.chart-panel {
    min-height: 100px;
}


/* ==========================================================================
   CACHE TIMER
   ========================================================================== */
@property --radar-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes radarSpin {
    0% {
        --radar-angle: 0deg;
    }
    100% {
        --radar-angle: 360deg;
    }
}

.cache-timer-radar {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 6px;
    vertical-align: middle;
    border-radius: 50%;
    background: conic-gradient(#0ecb81 var(--radar-angle), rgba(255, 255, 255, 0.1) var(--radar-angle));
    animation: radarSpin 60s linear infinite;
}

/* ==========================================================================
   14. LOG PANEL (bottom dock, collapses vertically)
   ========================================================================== */

/* Level badges next to the existing .badge-positive / .badge-negative */
.badge-warning {
    background: var(--warning);
}

.badge-neutral {
    background: var(--neutral);
}

.log-panel {
    --log-h: min(40vh, 320px);  /* default height of the expanded content; log_panel.js overrides it inline */
    position: relative;         /* anchor of the resize handle */
    flex: 0 0 auto;             /* .panel has flex: 1, the dock must not grow */
}

/* Resize handle on the top edge: straddles the border and the gap to the panel above. */
.log-panel__resizer {
    position: absolute;
    top: calc(-1 * var(--gap-sm) - 2px);
    left: 0;
    right: 0;
    height: 10px;
    z-index: 5;
    cursor: ns-resize;
    touch-action: none;         /* pointer events must not be swallowed by touch scrolling */
}

.log-panel__resizer::after {    /* visible grip */
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 3px;
    border-radius: 2px;
    background: var(--bg3);
    transform: translate(-50%, -50%);
    transition: background 0.2s ease, width 0.2s ease;
}

.log-panel__resizer:hover::after,
.log-panel__resizer:focus-visible::after,
.log-panel[data-resizing="true"] .log-panel__resizer::after {
    width: 80px;
    background: var(--accent);
}

.log-panel__resizer:focus-visible {
    outline: none;
}

/* Collapsed dock: nothing to resize. */
.log-panel[data-collapsed="true"] .log-panel__resizer {
    display: none;
}

/* While dragging: fixed cursor everywhere, no text selection. */
body.is-resizing-log {
    cursor: ns-resize;
    user-select: none;
}

.log-panel .panel-header {
    margin-bottom: 0;
}

.log-panel__toggle {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text);
}

.log-panel__chevron {
    display: inline-block;
    font-size: var(--fs-sm);
    transition: transform 0.25s ease;
}

.log-panel[data-collapsed="true"] .log-panel__chevron {
    transform: rotate(180deg);
}

/* Animating grid-template-rows (1fr <-> 0fr) gives a smooth height transition without a fixed max-height. */
.log-panel__content {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.25s ease;
}

.log-panel[data-collapsed="true"] .log-panel__content {
    grid-template-rows: 0fr;
}

.log-panel__inner {
    overflow: hidden;
    min-height: 0;
}

.log-panel__layout {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    height: var(--log-h);
    padding-top: var(--gap-md);
}

.log-panel .tlog td {
    white-space: nowrap;
    vertical-align: top;
}

.log-panel .tlog td[data-col="message"] {
    width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, monospace;
}

/* ==========================================================================
   15. CONDITION TABLE (shared by log panel and performance overview)
   ========================================================================== */
.ctable {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    height: 100%;
    min-height: 0;
}

.ctable .tlog-controls {
    margin-bottom: 0;
}

.ctable__scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* Click-to-sort headers; JS sets the "asc" / "desc" class on the active column. */
.sortable-header {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable-header.asc::after {
    content: " \25B2";
    font-size: var(--fs-sm);
}

.sortable-header.desc::after {
    content: " \25BC";
    font-size: var(--fs-sm);
}

@media (prefers-reduced-motion: reduce) {
    .log-panel__content,
    .log-panel__chevron {
        transition: none;
    }
}