/* D-DIN — nur wenn Dateien unter fonts/ liegen (Koordinator liefert nach) */
@font-face {
  font-family: "D-DIN";
  src: url("../fonts/D-DIN.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "D-DIN";
  src: url("../fonts/D-DIN-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #22242f;
  --panel: #2a2c3a;
  --panel2: #32344a;
  --accent: #dc7d46;
  --text: #dadada;
  --muted: #b2b2b2;
  --dim: #706f6f;
  --ok: #3dcf8e;
  --err: #e85d5d;
  --emerge: #5b9fd4;
  --font: "D-DIN", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  height: 100%; margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 13px; overflow: hidden;
}
body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
}
body > * { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--panel); border-bottom: 1px solid #3a3c4c; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  height: 40px; width: auto; max-width: 140px; object-fit: contain; display: block;
}
.logo-fallback {
  width: 36px; height: 36px; border-radius: 8px; background: var(--accent);
  color: #1a120c; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.logo-fallback[hidden] { display: none !important; }
.title { font-size: 18px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.subtitle { font-size: 11px; color: var(--muted); }
.badge-sim {
  background: #5c3d1e; color: var(--accent); font-weight: 700; padding: 4px 10px;
  border-radius: 6px; letter-spacing: 0.04em; white-space: nowrap;
}
.badge-live { background: var(--err); color: #1a0a0a; }
.select, input, button, summary { font: inherit; color: var(--text); }
.select, input {
  background: var(--panel2); border: 1px solid #44465a; border-radius: 6px; padding: 4px 8px;
}
.spacer { flex: 1; min-width: 8px; }

.layout-picker { display: inline-flex; gap: 2px; background: var(--panel2); border-radius: 8px; padding: 2px; }
.layout-picker button {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  width: 32px; height: 28px; padding: 4px; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.layout-picker button svg { width: 16px; height: 12px; fill: currentColor; opacity: 0.85; }
.layout-picker button:hover { color: var(--text); border-color: #55576a; }
.layout-picker button.active { color: var(--accent); border-color: var(--accent); background: #3a2a22; }

.btn-ghost {
  background: var(--panel2); border: 1px solid #44465a; color: var(--muted);
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
.btn-ghost.active { color: var(--accent); border-color: var(--accent); }
.btn-ghost[hidden] { display: none !important; }
.health { color: var(--muted); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.layout {
  display: grid; grid-template-columns: 240px 1fr minmax(260px, 300px);
  height: 100%; min-height: 0; gap: 8px; padding: 8px;
}
.layout.focus-mode .watchlist { display: none; }
.layout.focus-mode .dashboard { display: none; }
.layout.focus-mode { grid-template-columns: 1fr; }

.watchlist, .dashboard {
  background: var(--panel); border-radius: 8px; padding: 10px; overflow: auto;
}
.charts { overflow: hidden; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.focus-banner {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 8px; margin-bottom: 6px; background: var(--panel); border-radius: 6px;
  color: var(--accent); font-weight: 700;
}
.focus-banner[hidden] { display: none !important; }

h2 { margin: 0 0 8px; font-size: 14px; }
h3 { margin: 12px 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hint { color: var(--dim); font-weight: 400; font-size: 11px; }

.watch-row {
  background: var(--panel2); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
  cursor: pointer; border: 1px solid transparent;
}
.watch-row.active { border-color: var(--accent); }
.watch-row .sym { font-weight: 700; }
.watch-row .typ { color: var(--muted); font-size: 11px; }
.watch-row .st { font-weight: 700; float: right; }

.chart-grid { display: grid; gap: 6px; flex: 1; min-height: 0; height: 100%; }
.chart-grid.layout-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.chart-grid.layout-2h { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.chart-grid.layout-2v { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.chart-grid.layout-3 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr; }
.chart-grid.layout-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.chart-grid.layout-6 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }

.chart-cell {
  background: var(--panel); border-radius: 8px; border: 1px solid transparent;
  display: flex; flex-direction: column; min-height: 140px; min-width: 120px;
  position: relative; overflow: hidden;
}
.chart-cell.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.chart-cell .head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 8px; font-size: 12px; color: var(--muted); flex: 0 0 auto; gap: 6px;
}
.chart-cell .head .focus-btn {
  background: transparent; border: 1px solid #44465a; color: var(--muted);
  border-radius: 4px; padding: 1px 6px; cursor: pointer; font-size: 11px;
}
.chart-cell .canvas {
  flex: 1 1 auto; min-height: 120px; width: 100%; position: relative;
  /* WebKitGTK / WebView2: explizite Größe verhindert leeren Canvas */
}
.chart-cell .canvas canvas {
  display: block !important;
  /* WebKitGTK: Layer erzwingen — sonst oft leerer Canvas bei Flex-Layout */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.dash-meta { margin-bottom: 8px; }
.state-pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-weight: 700; background: var(--panel2);
}
.dir, .typ { color: var(--muted); margin-top: 4px; }
.score-row {
  display: flex; justify-content: space-between; gap: 8px; padding: 4px 0;
  border-bottom: 1px solid #32344a; color: var(--muted);
}
.score-row strong { color: var(--text); font-weight: 600; }
.cond-list { list-style: none; padding: 0; margin: 0; }
.cond-list li {
  padding: 6px 8px; margin-bottom: 4px; background: var(--panel2); border-radius: 6px;
  cursor: pointer; border-left: 3px solid var(--dim);
}
.cond-list li.met { border-left-color: var(--ok); }
.cond-list li.miss { border-left-color: var(--err); }
.cond-list li.hl { outline: 1px solid var(--accent); }
.reason {
  white-space: pre-wrap; background: var(--panel2); padding: 8px; border-radius: 6px; font-size: 11px;
  max-height: 80px; overflow: auto;
}
.btn {
  background: var(--accent); color: #1a120c; border: none; border-radius: 6px; padding: 6px 12px;
  font-weight: 700; cursor: pointer; margin-top: 6px;
}
.btn.secondary { background: var(--panel2); color: var(--text); border: 1px solid #44465a; }
.rule-form { display: grid; gap: 4px; margin-top: 6px; }
.rule-form label, .rule-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted);
}
.rule-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.journal { font-size: 11px; color: var(--muted); max-height: 120px; overflow: auto; }
.foot {
  height: 32px; display: flex; align-items: center; gap: 16px; padding: 0 14px;
  background: var(--panel); color: var(--dim); border-top: 1px solid #3a3c4c;
}
.footer-note { color: var(--dim); font-size: 11px; margin-top: 16px; }
.markets-panel { margin-top: 12px; color: var(--muted); }
.markets-panel label { display: block; margin: 4px 0; }
.status { margin-top: 6px; font-size: 11px; color: var(--muted); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 200px 1fr 240px; }
  .chart-grid.layout-6 { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; height: auto; min-height: calc(100% - 88px); overflow: auto; }
  .charts { min-height: 360px; }
  .chart-cell { min-height: 180px; }
}

/* APP-004: Bereiche, Setups, Meldungen, Platzhalter-Charts */
.product { font-size: 18px; font-weight: 700; color: var(--accent); }
.title-row { line-height: 1.1; }
.area-nav { display: inline-flex; gap: 2px; background: var(--panel2); border-radius: 8px; padding: 2px; }
.area-btn {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--muted); padding: 5px 14px; cursor: pointer; font-weight: 700;
}
.area-btn.active { color: var(--accent); border-color: var(--accent); background: #3a2a22; }
.area-panel { height: 100%; min-height: 0; }
.area-panel[hidden] { display: none !important; }
.area-panel.active { display: grid; }

.assess-head { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.assess-reason { color: var(--muted); margin: 8px 0; line-height: 1.35; }
.dash-actions { margin-top: 12px; display: grid; gap: 6px; }
.tech-details { margin-top: 12px; color: var(--dim); font-size: 11px; }
.badge-disconnected { background: #4a3030; color: #e8a0a0; }
.badge-delayed { background: #4a4030; color: #e8c070; }

.chart-cell.placeholder {
  align-items: center; justify-content: center; border: 1px dashed #44465a;
}
.chart-cell .placeholder-body {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; color: var(--dim); gap: 8px; padding: 16px; text-align: center;
}
.chart-cell .placeholder-body select {
  max-width: 160px; background: var(--panel2); border: 1px solid #44465a;
  color: var(--text); border-radius: 6px; padding: 6px 8px;
}

.setups-area {
  grid-template-columns: 1fr; gap: 8px; padding: 8px;
}
.setups-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setups-catalog, .setups-editor {
  background: var(--panel); border-radius: 8px; padding: 12px; overflow: auto;
}
.setups-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.setups-head h2 { margin: 0; flex: 1; }
.setup-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.setup-card {
  background: var(--panel2); border-radius: 8px; padding: 12px; border: 1px solid transparent;
}
.setup-card.active { border-color: var(--accent); }
.setup-card h4 { margin: 0 0 4px; color: var(--accent); }
.setup-card p { margin: 0 0 8px; color: var(--muted); font-size: 12px; min-height: 36px; }
.setup-card .meta { font-size: 11px; color: var(--dim); margin-bottom: 8px; }
.setup-card .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.editor-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.ed-tab {
  background: var(--panel2); border: 1px solid #44465a; color: var(--muted);
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
.ed-tab.active { color: var(--accent); border-color: var(--accent); }
.ed-panel { display: block; }
.ed-panel[hidden] { display: none !important; }
.blocks-list { display: grid; gap: 6px; margin-bottom: 8px; }
.block-row {
  display: flex; gap: 8px; align-items: center; background: var(--panel2);
  padding: 8px; border-radius: 6px; flex-wrap: wrap;
}
.block-row .bid { font-family: monospace; color: var(--accent); font-size: 11px; }
.block-add { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
.editor-actions { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-status {
  padding: 8px 10px; border-radius: 6px; background: #3a3030; color: #e8a0a0;
  margin-bottom: 8px; font-size: 12px;
}
.ai-status.ok { background: #2a3a30; color: #9de0b8; }
.ai-preview {
  margin-top: 10px; background: var(--panel2); border-radius: 8px; padding: 10px;
}
.ai-preview pre { white-space: pre-wrap; font-size: 11px; max-height: 180px; overflow: auto; }
fieldset {
  border: 1px solid #44465a; border-radius: 6px; margin: 8px 0; padding: 8px;
  color: var(--muted);
}
textarea {
  width: 100%; background: var(--panel2); border: 1px solid #44465a; border-radius: 6px;
  color: var(--text); padding: 6px 8px; font: inherit; resize: vertical;
}

.meldungen-area { padding: 8px; display: grid !important; grid-template-columns: 1fr; }
.meldungen-area[hidden] { display: none !important; }
.meldungen-panel {
  background: var(--panel); border-radius: 8px; padding: 12px; overflow: auto;
  display: grid; grid-template-columns: 1fr minmax(240px, 320px); gap: 12px;
  height: 100%;
}
.meldungen-panel h2 { grid-column: 1 / -1; }
.meld-filters { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.meld-list { overflow: auto; max-height: calc(100vh - 200px); }
.meld-item {
  padding: 10px 12px; border-bottom: 1px solid #32344a; cursor: pointer;
  border-left: 3px solid transparent;
}
.meld-item:hover, .meld-item.active { background: var(--panel2); border-left-color: var(--accent); }
.meld-item .when { color: var(--dim); font-size: 11px; margin-right: 8px; }
.meld-detail {
  background: var(--panel2); border-radius: 8px; padding: 12px; overflow: auto;
}
.meld-detail[hidden] { display: none !important; }
.meld-detail pre { font-size: 11px; white-space: pre-wrap; }

@media (max-width: 1000px) {
  .setups-area { grid-template-columns: 1fr; }
  .meldungen-panel { grid-template-columns: 1fr; }
}


/* Dummy-KI Kennzeichnung */
.ai-status.dummy {
  border-left: 3px solid var(--orange, #dc7d46);
  padding-left: 0.6rem;
  color: #dadada;
  background: rgba(220, 125, 70, 0.12);
  margin-bottom: 0.5rem;
}
.ai-preview h3 {
  color: var(--orange, #dc7d46);
  font-size: 0.95rem;
}
.badge-disconnected {
  background: #5a3030 !important;
  color: #ffb4b4 !important;
}


/* APP-005 KI + Feed */
.ed-tab-ki {
  border: 1px solid var(--accent, #dc7d46) !important;
  color: var(--accent, #dc7d46) !important;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(220, 125, 70, 0.25);
}
.ai-panel {
  border: 1px solid rgba(220, 125, 70, 0.45);
  border-radius: 8px;
  padding: 12px;
  background: rgba(220, 125, 70, 0.06);
}
.ai-status.openai {
  border-left: 3px solid #4caf88;
  padding-left: 0.6rem;
  background: rgba(76, 175, 136, 0.12);
  margin-bottom: 0.5rem;
}
.ai-status.error {
  border-left: 3px solid #e57373;
  padding-left: 0.6rem;
  background: rgba(229, 115, 115, 0.12);
  margin-bottom: 0.5rem;
}
.ai-costs { margin-bottom: 8px; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.btn-ai {
  background: var(--accent, #dc7d46) !important;
  color: #1a1b22 !important;
  font-weight: 700;
}
.ai-err { color: #ffb4b4; }
.feed-meta {
  font-size: 11px;
  color: var(--dim, #b2b2b2);
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-to-sim {
  display: inline-flex; align-items: center;
  background: var(--accent, #dc7d46); color: #1a1210;
  border: none; border-radius: 6px; padding: 4px 10px;
  font-size: 11px; font-weight: 700; cursor: pointer;
  white-space: nowrap;
}
.feed-to-sim[hidden] { display: none !important; }
.badge-delayed { background: #5a4a20 !important; color: #ffe082 !important; }
.badge-live { background: #1e4a35 !important; color: #a8e6c5 !important; }


/* APP-005 UX polish */
.tb-label {
  display: inline-flex; flex-direction: column; gap: 2px;
  font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.03em;
}
.tb-label .select { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--text); }
.select, .input {
  background: var(--panel2); border: 1px solid #44465a; border-radius: 6px;
  padding: 4px 8px; color: var(--text); font: inherit;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.layout {
  grid-template-columns: 200px 1fr minmax(280px, 320px);
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: 180px 1fr minmax(240px, 280px); }
}

.badge-data-missing { background: #5a3030 !important; color: #ffb4b4 !important; }
.badge-sim-mode { background: #5c3d1e; color: var(--accent); }

.block-row .bstep {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: #3a2a22;
  color: var(--accent); font-weight: 700; font-size: 11px; flex: 0 0 auto;
}
.block-row .bmeta { color: var(--text); font-size: 12px; }
.block-row .blabel { flex: 1; color: var(--muted); font-size: 12px; min-width: 80px; }
.block-row .bops { display: inline-flex; gap: 4px; align-items: center; }
.block-row .btn-ghost[disabled] { opacity: 0.35; cursor: default; }
.block-row .bid { display: none; } /* keine manuellen Schritt-IDs im Hauptbild */


.ai-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.ai-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--panel2); color: var(--muted); border: 1px solid #44465a;
}
.ai-badge.on { background: rgba(76,175,136,0.2); color: #9de0b8; border-color: #4caf88; }
.ai-costs {
  display: block; padding: 8px 10px; border-radius: 6px; margin-bottom: 8px;
  background: rgba(220,125,70,0.12); border: 1px solid rgba(220,125,70,0.35);
  color: var(--text); font-size: 12px; font-weight: 600;
}
.ai-costs[hidden] { display: none !important; }

.assess-head { font-size: 15px; }
.state-pill { font-size: 14px; margin-bottom: 4px; }
.assess-reason { font-size: 13px; }

.ai-plausibility { margin: 0.75rem 0; padding: 0.75rem; background: #2a2c38; border-radius: 6px; border-left: 3px solid #dc7d46; }
.ai-plausibility ul { margin: 0.25rem 0 0.5rem 1.2rem; color: #dadada; }
.ai-err { color: #e88; }
#ai-accept-wrap { display: none !important; }
#btn-ai-apply-answers, #btn-ai-to-builder { display: none !important; }

/* === Dominik-Feedback 0.5.1: Brand, Tabs, KI, Charts === */
.logo {
  height: 56px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}
.brand-meta { display: flex; flex-direction: column; justify-content: flex-end; }
.brand .subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.product { display: none; } /* kein schiefes separates „Radar“-Wort */

.area-nav {
  display: inline-flex; gap: 4px; background: var(--panel2);
  border-radius: 12px; padding: 4px; margin-left: 8px;
}
.area-btn {
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  color: var(--muted); padding: 10px 22px; cursor: pointer;
  font-weight: 700; font-size: 15px; letter-spacing: 0.02em;
}
.area-btn.active {
  color: #1a120c; background: var(--accent); border-color: var(--accent);
}

.btn-lg { padding: 10px 18px !important; font-size: 14px !important; min-height: 42px; }
.ed-tab {
  padding: 8px 14px !important; font-size: 13px; font-weight: 600;
}
.ed-tab-ki {
  border: 1px solid var(--accent) !important;
  color: var(--accent) !important;
  font-weight: 700;
}

.ai-panel {
  border: 1px solid rgba(220,125,70,0.35);
  border-radius: 10px;
  padding: 14px;
  background: rgba(220,125,70,0.05);
}
.ai-input-label { display: grid; gap: 6px; color: var(--muted); font-weight: 600; }
.ai-status[hidden], .ai-costs[hidden] { display: none !important; }
.ai-summary {
  background: var(--panel); border-radius: 8px; padding: 12px 14px;
  margin: 8px 0; line-height: 1.45; color: var(--text); font-size: 13px;
}
.ai-summary .ai-name { font-size: 16px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.ai-checklist {
  list-style: none; padding: 0; margin: 8px 0 12px;
  display: grid; gap: 6px;
}
.ai-checklist li {
  background: var(--panel); border-radius: 6px; padding: 8px 10px;
  border-left: 3px solid var(--accent); color: var(--text);
}
.ai-questions { display: grid; gap: 10px; margin: 10px 0; }
.ai-q {
  background: var(--panel); border-radius: 8px; padding: 10px 12px;
  border: 1px solid #44465a;
}
.ai-q label { display: grid; gap: 4px; color: var(--muted); font-weight: 600; }
.ai-q input, .ai-q select { width: 100%; }
#ai-preview-body { display: none !important; } /* kein JSON in der UI */
.ai-plausibility { font-size: 12px; color: var(--muted); white-space: pre-wrap; max-height: 160px; overflow: auto; }

.chart-tf {
  display: inline-flex; gap: 2px; margin-left: auto; margin-right: 6px;
  background: var(--panel2); border-radius: 6px; padding: 2px;
}
.chart-tf button {
  background: transparent; border: 1px solid transparent; border-radius: 4px;
  color: var(--muted); padding: 2px 6px; font-size: 11px; font-weight: 700;
  cursor: pointer;
}
.chart-tf button.active {
  color: var(--accent); border-color: var(--accent); background: #3a2a22;
}
.chart-cell .head { gap: 4px; flex-wrap: wrap; }

.badge-quota {
  background: #5a3a20 !important; color: #ffd080 !important;
}
.feed-hint-sim {
  color: var(--accent); font-weight: 600;
}

.editor-actions .btn, .block-add .btn, .setups-head .btn {
  padding: 8px 14px; font-size: 13px;
}

/* unified dropdowns (Nachtauftrag) */
.select {
  background: var(--panel2);
  border: 1px solid #44465a;
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  min-height: 32px;
}
.tb-label .select, .chart-cell .placeholder-body select, .block-add .select, .meld-filters .select {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--panel2);
  border: 1px solid #44465a;
  color: var(--text);
}

.quota-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #5a3a20; color: #ffd080; padding: 8px 14px;
  border-bottom: 1px solid #7a5030; font-weight: 600; font-size: 13px;
}
.quota-banner[hidden] { display: none !important; }
.btn-quota {
  background: var(--accent); color: #1a1210; border: none;
  padding: 6px 14px; border-radius: 6px; font-weight: 700; cursor: pointer;
}
.badge-sim-due { background: #3a4a20 !important; color: #c8e090 !important; }
.ai-assumptions {
  margin: 8px 0; padding: 10px 12px; border-radius: 8px;
  background: #2a2c3a; border: 1px solid #55576a; font-size: 12px;
}
.ai-assumptions .ass-title { font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.ai-assumptions .ass-item { color: var(--muted); margin: 2px 0; }
.ai-assumptions .ass-item.marked { color: #ffd080; }
.ai-blocked {
  margin: 10px 0; padding: 12px 14px; border: 1px solid #b85d49;
  border-radius: 8px; background: rgba(184, 93, 73, 0.12); color: var(--text);
}
.ai-blocked strong { display: block; color: #ffb39f; margin-bottom: 5px; }
.ai-blocked div + div { margin-top: 4px; }
.ai-blocked .ai-next-step {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 179, 159, 0.28);
}
.ai-blocked .ai-next-step strong { color: var(--accent); margin-bottom: 4px; }
.ai-confirm-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.ai-save-status { min-height: 20px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.ai-save-status.error { color: #ffb39f; }
.ai-save-status.success { color: #7ee2b8; }
.ai-recovery {
  margin-top: 12px; padding: 14px 16px; border: 1px solid var(--accent);
  border-radius: 10px; background: var(--panel2); line-height: 1.5;
}
.ai-recovery h3 { margin: 0 0 8px; font-size: 16px; color: var(--text); }
.ai-recovery p { margin: 0 0 8px; color: var(--muted); }
.ai-recovery ul { margin: 8px 0 12px; padding-left: 20px; }
.ai-recovery li + li { margin-top: 5px; }
.ai-recovery .ai-actions { margin-bottom: 0; }
.block-editor { padding: 14px; margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; }
.block-editor h4 { margin: 0 0 12px; }
.block-editor .block-add { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.block-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.block-field .input, .block-field .select { width: 100%; min-width: 0; box-sizing: border-box; }
.block-field-wide { grid-column: 1 / -1; }
.block-field[hidden] { display: none; }
.block-editor-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.block-paths-hint { white-space: pre-line; font-size: 13px; line-height: 1.6; }
.block-row { flex-wrap: wrap; }
.block-row .bops { margin-left: auto; flex-wrap: wrap; }
.ai-dialog-lead { margin: 14px 0; font-weight: bold; }
.ai-blocked ul { margin: 8px 0 0; padding-left: 20px; }
.ai-save-status { overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  .block-editor .block-add { grid-template-columns: 1fr; }
}
.editor-actions[hidden], .ai-confirm-row .btn[hidden] { display: none !important; }
.btn:disabled, .btn-ghost:disabled {
  opacity: 0.42; cursor: not-allowed; filter: saturate(0.35);
}

/* === 0.5.6 Visual slim: weniger Chrome, klarere Hierarchie === */
.topbar {
  gap: 12px;
  padding: 10px 16px;
  flex-wrap: nowrap;
  min-height: 64px;
  border-bottom: 1px solid #343648;
}
.logo {
  height: 64px;
  max-width: 260px;
  width: auto;
  object-fit: contain;
}
.brand { gap: 12px; flex: 0 0 auto; }
.brand .subtitle { font-size: 11px; color: var(--dim); margin-top: 0; letter-spacing: 0.04em; }
.topbar-feed {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}
.topbar-feed .select { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.feed-meta {
  max-width: 220px;
  font-size: 11px;
  color: var(--dim);
}
.badge-sim {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}
.area-nav { margin-left: 4px; }
.area-btn {
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 10px;
}
.layout-picker { padding: 3px; }
.layout-picker button { width: 34px; height: 32px; }
.btn-ghost {
  padding: 8px 14px;
  min-height: 36px;
  border-radius: 8px;
  font-weight: 600;
}

.layout, .area-panel {
  height: 100%;
  min-height: 0;
}
.layout {
  gap: 12px;
  padding: 12px;
  grid-template-columns: 200px 1fr minmax(300px, 340px);
}
.watchlist, .dashboard {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #32344a;
}
.watchlist h2, .dashboard h2 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.watchlist .hint { margin: 0 0 12px; }
.watch-row {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
}
.watch-row .typ { font-size: 11px; color: var(--dim); opacity: 0.85; }

.dashboard .assess-head {
  font-size: 16px;
  margin-bottom: 10px;
  line-height: 1.3;
}
.dashboard .state-pill {
  font-size: 15px;
  padding: 6px 14px;
  margin-bottom: 8px;
}
.dashboard .assess-reason {
  margin: 10px 0 14px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  min-height: 1.4em;
}
.dashboard .score-row {
  padding: 8px 0;
  border-bottom: 1px solid #2e3040;
}
.dashboard h3 {
  margin: 18px 0 10px;
  font-size: 11px;
}
.cond-list li {
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  font-size: 13px;
}
.dash-actions {
  margin-top: 18px;
  gap: 10px;
}
.dash-actions .btn {
  width: 100%;
  min-height: 44px;
  font-size: 14px;
  border-radius: 10px;
  margin-top: 0;
}
.dash-actions .select {
  width: 100%;
  min-height: 40px;
  font-size: 13px;
}
.dash-actions .rule-row {
  display: grid;
  gap: 6px;
  justify-content: stretch;
}
.footer-note {
  margin-top: 20px;
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.tech-details { margin-top: 16px; }
.tech-details summary { cursor: pointer; color: var(--dim); }

.chart-grid { gap: 10px; }
.chart-cell {
  border-radius: 12px;
  border: 1px solid #32344a;
}
.chart-cell .head {
  padding: 6px 10px;
  gap: 8px;
  background: rgba(0,0,0,0.12);
}
.chart-tf {
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: var(--panel2);
}
.chart-tf button {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  min-width: 36px;
}
.chart-tf button.active {
  background: var(--accent);
  color: #1a120c;
  border-color: var(--accent);
}
.chart-cell .focus-btn {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.setups-area, .meldungen-area { gap: 12px; padding: 12px; }
.setups-catalog, .setups-editor, .meldungen-panel {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #32344a;
}
.setups-head .btn, .editor-actions .btn {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
}
.setup-card {
  padding: 14px;
  border-radius: 10px;
}
.setup-card p {
  min-height: 28px;
  font-size: 12px;
  line-height: 1.35;
}
.ed-tab {
  padding: 10px 16px !important;
  border-radius: 8px;
  font-size: 14px !important;
}
.ai-panel {
  padding: 16px;
  border-radius: 12px;
  border-width: 1px;
}
.ai-input-label { font-size: 13px; gap: 8px; }
#ai-input { min-height: 96px; font-size: 14px; line-height: 1.4; padding: 10px 12px; }
.ai-actions .btn { min-height: 46px; border-radius: 10px; }
.ai-summary { padding: 14px 16px; margin: 12px 0; border-radius: 10px; }
.ai-summary .ai-name { font-size: 17px; margin-bottom: 8px; }
.ai-summary p { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.ai-checklist { gap: 8px; margin: 12px 0; }
.ai-checklist li { padding: 10px 12px; border-radius: 8px; }
.ai-questions { gap: 12px; margin: 12px 0; }
.btn-lg { min-height: 46px !important; padding: 12px 20px !important; font-size: 15px !important; border-radius: 10px; }
.block-add .btn { min-height: 40px; }

.quota-banner {
  padding: 10px 16px;
  gap: 14px;
  font-size: 14px;
}
.btn-quota {
  min-height: 40px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 14px;
}

.foot {
  height: 28px;
  padding: 0 16px;
  gap: 12px;
  font-size: 11px;
  color: var(--dim);
}
.foot .health {
  margin-left: auto;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dim);
  font-size: 11px;
}

.feed-to-sim {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
}

@media (max-width: 1200px) {
  .topbar { flex-wrap: wrap; min-height: 0; }
  .feed-meta { max-width: 160px; }
  .logo { height: 52px; max-width: 200px; }
}


/* 0.5.6 Chrome-Slice: Topbar ohne tb-label, ruhiger Footer */
.topbar-feed .badge-sim { flex: 0 0 auto; }
.topbar .select { cursor: pointer; }
.topbar .btn-ghost:hover { color: var(--text); border-color: #55576a; }
.quota-banner .btn-quota { flex: 0 0 auto; }
.foot #scan-n { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.foot #notices { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }

/* 0.5.7 Charts: Platzhalter-Leere + Head/Canvas Whitespace */
.chart-grid {
  align-content: stretch;
}
.chart-grid > .chart-cell {
  min-height: 0; /* Grid-Zeilen füllen, Platzhalter stabil */
}

.chart-cell.placeholder {
  background: #262834;
  border: 1px dashed #3e4054;
  align-items: stretch;
  justify-content: stretch;
}
.chart-cell.placeholder .head {
  background: transparent;
  padding: 4px 8px;
  color: var(--dim);
  flex: 0 0 auto;
  border-bottom: none;
}
.chart-cell.placeholder .head .st { display: none; }

.chart-cell .placeholder-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  gap: 10px;
  padding: 12px 16px;
  text-align: center;
  color: var(--muted);
  background:
    radial-gradient(ellipse at center, rgba(50, 52, 74, 0.55) 0%, transparent 68%);
}
.chart-cell .placeholder-body .placeholder-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.chart-cell .placeholder-body select,
.chart-cell .placeholder-body .select {
  min-width: 168px;
  max-width: 240px;
  width: min(82%, 240px);
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  background: var(--panel2);
  border: 1px solid #55576a;
  color: var(--text);
}
.chart-cell .placeholder-body select:hover,
.chart-cell .placeholder-body .select:hover {
  border-color: var(--accent);
}

/* Daten-Zellen: kompakter Head, Canvas füllt Rest */
.chart-cell:not(.placeholder) .head {
  padding: 4px 8px;
  gap: 6px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  min-height: 28px;
  background: rgba(0, 0, 0, 0.14);
}
.chart-cell:not(.placeholder) .head > span:first-child {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.chart-cell .chart-tf {
  flex: 0 0 auto;
  margin-left: 0;
  margin-right: 4px;
}
.chart-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 8px 5px; flex: 0 0 auto; }
.chart-price { font-variant-numeric: tabular-nums; color: var(--text); margin-right: auto; font-size: 12px; }
.chart-feed { color: var(--muted); font-size: 10px; white-space: nowrap; }
.chart-feed.streaming { color: #3dcf8e; }
.chart-cell .head .st { font-size: 10px; white-space: nowrap; }
.chart-cell .focus-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.chart-cell .canvas {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  width: 100%;
}

/* === Dominik-Feedback 0.5.9: Editor-Flow, Follow, Fenix AI Premium === */
.setups-editor-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.setups-editor-head h2 { margin: 0; }
.editor-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-setup-flow {
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid #32344a; border-radius: 12px; padding: 12px;
  background: rgba(0,0,0,0.12);
}
.ed-params-inline, .ed-baukasten-inline {
  border: none; padding: 0; background: transparent; margin: 0;
}
.ed-section-title {
  margin: 0 0 8px; font-size: 13px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent, #dc7d46);
}
.editor-flow-hint { margin: 0 0 4px; }
.setups-editor.editor-flash {
  outline: 2px solid var(--accent, #dc7d46);
  box-shadow: 0 0 0 6px rgba(220, 125, 70, 0.22);
  transition: box-shadow 0.35s ease, outline-color 0.35s ease;
}
/* Fenix AI PRO: graphite, copper and a quiet machined edge. No animation. */
.pro-badge {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; padding: 4px 8px 3px; border-radius: 4px;
  font-size: 10px; line-height: 1; font-weight: 700; letter-spacing: .13em;
  color: #f4bd98; background: linear-gradient(135deg, #49352d, #2b292e);
  border: 1px solid #a66a46;
  box-shadow: inset 0 1px 0 rgba(255, 220, 196, .14);
  vertical-align: middle; white-space: nowrap;
}
.ed-tab-ki {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: #252631 !important;
  border: 1px solid #625049 !important;
  color: var(--text) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.ed-tab-ki:hover:not(:disabled) { border-color: var(--accent) !important; }
.ed-tab-ki.active {
  background: linear-gradient(115deg, #3d302b, #272833 75%) !important;
  border-color: var(--accent) !important;
  color: #f2ece7 !important;
  box-shadow: inset 0 -2px 0 var(--accent), inset 0 1px 0 rgba(255,255,255,.05);
}
.ed-tab-ki:focus-visible, #btn-revise-ai:focus-visible {
  outline: 2px solid #f4bd98; outline-offset: 3px;
}
.ai-wordmark { white-space: nowrap; font-weight: 700; letter-spacing: .01em; }
.ai-wordmark-accent { color: #eaa171; }
.ai-brand { display: flex; align-items: center; gap: 12px; }
.ai-brand::before {
  content: ""; width: 3px; height: 23px; flex: 0 0 auto; border-radius: 2px;
  background: linear-gradient(180deg, #f4bd98, var(--accent));
}
.ai-brand-title { font-size: 20px; font-weight: 700; letter-spacing: .01em; color: #f2ece7; }
#btn-revise-ai .pro-badge { margin-left: 8px; }
.ai-panel {
  background: linear-gradient(125deg, rgba(220,125,70,.055), transparent 45%), #272935;
  border-color: #665047;
}
.ai-card-head { flex-wrap: wrap; gap: 12px; }
#btn-autofollow.active {
  background: rgba(61, 207, 142, 0.18);
  border-color: #3dcf8e; color: #9de0b8;
}

/* Creation and editing are explicit, isolated modal sessions. */
.setup-dialog {
  padding: 0; width: min(1000px, calc(100vw - 32px)); max-width: none;
  max-height: calc(100dvh - 32px); border: 1px solid #55586e; border-radius: 14px;
  color: var(--text); background: var(--panel); overflow: auto;
}
.setup-dialog::backdrop { background: rgba(10, 12, 19, 0.72); }
.setup-dialog .setups-editor { border: 0; overflow: visible; }
.setup-dialog .setups-editor-head { position: sticky; top: -16px; z-index: 3; background: var(--panel); padding: 12px 0; }
.setup-dialog .setups-editor-head h2 { overflow-wrap: anywhere; }
.setup-dialog .rule-form > label:first-child { grid-template-columns: 110px 1fr; }
.setup-dialog #rule-name { width: 100%; box-sizing: border-box; }
.editor-context, .catalog-intro { color: var(--muted); line-height: 1.45; }
.catalog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.setups-catalog .setup-cards { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.setups-catalog > h3 { margin-top: 24px; }
.setup-prompt-source { background: var(--panel2); border: 1px solid #484b61; border-radius: 10px; padding: 14px; margin: 12px 0 18px; }
.setup-prompt-source summary { cursor: pointer; font-weight: 600; }
.setup-prompt-source button { margin-top: 12px; }
.prompt-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.5; max-height: 250px; overflow: auto; }
#btn-back-to-rule { margin-bottom: 16px; }
.ai-input-heading { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 8px; }
.info-button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--accent); background: var(--panel2); color: var(--text); font-weight: bold; cursor: pointer; }
.info-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ai-help-host { position: relative; }
.ai-prompt-help { position: absolute; top: 100%; right: 0; z-index: 4; width: min(590px, calc(100vw - 110px)); max-height: 55dvh; overflow: auto; padding: 16px; box-sizing: border-box; background: #272a39; border: 1px solid var(--accent); border-radius: 10px; box-shadow: 0 8px 26px #111a; font-size: 14px; line-height: 1.5; }
.ai-prompt-help ul { padding-left: 20px; }
.ai-prompt-help li { margin-bottom: 8px; }
.ai-input-counter { text-align: right; color: var(--muted); font-size: 13px; margin: 6px 0 12px; }
.ai-input-counter.error { color: #ffab99; }
.dash-setup-top { margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid #44465a; }
.condition-value { display: block; margin-top: 6px; color: var(--text); opacity: .85; }
.event-context { padding: 10px; border-left: 2px solid var(--accent); line-height: 1.45; }
.event-filter-label { margin: 10px 0 4px; }
.ai-checklist .event-filters { list-style: disc; padding-left: 22px; }
.ai-checklist .event-filters li { border-left: none; padding: 4px; margin: 0; background: transparent; }
[hidden] { display: none !important; }
.broker-dialog { width: min(620px, calc(100vw - 32px)); padding: 24px; box-sizing: border-box; }
.broker-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.broker-header h2 { margin: 0; }
.broker-dialog p { line-height: 1.5; }
.broker-dialog label { display: grid; gap: 8px; margin: 16px 0; }
.broker-dialog input, .broker-dialog select { width: 100%; box-sizing: border-box; padding: 10px; color: var(--text); background: var(--panel2); border: 1px solid #55586e; border-radius: 7px; }
#broker-status { padding: 12px; border-left: 3px solid var(--accent); background: var(--panel2); }
.broker-actions { display: flex; gap: 12px; margin-top: 18px; }
/* Size the app from the viewport, not from a transient font/canvas min-content
   width. A nowrap toolbar used to widen the whole grid beyond the WebView. */
.topbar { flex-wrap: wrap; }
.topbar-feed { flex-wrap: wrap; max-width: 100%; }
.topbar-feed .select { min-width: 0; max-width: 100%; }
.topbar > .spacer { min-width: 0; }
.layout { grid-template-columns: 200px minmax(0, 1fr) minmax(300px, 340px); }
.layout.focus-mode { grid-template-columns: minmax(0, 1fr); }
.area-panel, .watchlist, .dashboard, .setups-catalog, .meldungen-panel,
.chart-grid, .chart-cell, .chart-tools { min-width: 0; }
.chart-grid.layout-1, .chart-grid.layout-2v { grid-template-columns: minmax(0, 1fr); }
.chart-grid.layout-2h, .chart-grid.layout-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-grid.layout-3, .chart-grid.layout-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chart-cell:not(.placeholder) .head { flex-wrap: wrap; }
.chart-tools { flex-wrap: wrap; }
.chart-cell .chart-tf { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.chart-cell .placeholder-body select { min-width: 0; max-width: 100%; }
.dashboard .select { min-width: 0; max-width: 100%; }
.watch-row > div:first-child { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; }
.watch-row .st { float: none; }
.foot > * { min-width: 0; }
.foot #notices { flex: 1; }
.foot #display-timezone { max-width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1200px) {
  .layout { grid-template-columns: 180px minmax(0, 1fr) minmax(240px, 280px); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(420px, 1fr) auto; overflow: auto; }
  .layout.focus-mode { grid-template-rows: minmax(420px, 1fr); }
  .watchlist { max-height: 200px; }
  .chart-grid.layout-3, .chart-grid.layout-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .setup-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  .setup-dialog .setups-editor { padding: 12px; }
  .setup-dialog .setups-editor-head { top: -12px; }
  .catalog-actions { width: 100%; }
}

/* App shell: stable left navigation, central charts, independent right panels. */
body { grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; }
.topbar { grid-column: 1 / -1; grid-row: 1; padding: 10px 18px; gap: 14px; background: #262834; }
.topbar .brand { gap: 12px; }
.topbar .logo { height: 44px; max-width: 168px; }
.topbar .brand-meta { align-self: flex-end; padding-bottom: 5px; }
.topbar-feed { flex: 1 1 380px; gap: 7px; }
.topbar-feed .select { max-width: 160px; padding: 6px 8px; }
.topbar-feed #btn-broker { padding: 6px 10px; }
.topbar .spacer { display: none; }
.feed-meta { max-width: 190px; line-height: 1.3; color: var(--muted); }
.account-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.ui-icon { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { width: 36px; height: 36px; padding: 7px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; }
.icon-btn:hover { background: #353847; color: var(--text); }
.icon-btn.active { color: var(--accent); background: rgba(220, 125, 70, .1); border-color: rgba(220, 125, 70, .35); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.profile-button { display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px; min-height: 38px; max-width: 250px; color: var(--text); background: #333644; border: 1px solid #4a4c5c; border-radius: 9px; cursor: pointer; }
.profile-button:hover { border-color: var(--accent); }
#profile-button-label { max-width: 140px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.local-tag { font-size: 9px; letter-spacing: .06em; color: var(--accent); }
.main-nav { grid-column: 1; grid-row: 2 / 4; display: flex; flex-direction: column; gap: 8px; margin: 0; border-radius: 0; padding: 18px 8px 12px; border-right: 1px solid #373947; background: #262834; min-height: 0; overflow: auto; }
.main-nav .area-btn { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 66px; padding: 10px 3px; font-size: 12px; font-weight: 400; border-radius: 9px; }
.main-nav .area-btn .ui-icon { width: 23px; height: 23px; }
.main-nav .area-btn.active { color: #efac82; background: rgba(220, 125, 70, .1); border-color: rgba(220, 125, 70, .3); }
.main-nav .area-btn:hover { background: #343644; }
.nav-footnote { margin-top: auto; padding: 22px 0 6px; text-align: center; font-size: 10px; line-height: 1.5; letter-spacing: .05em; color: #999ca9; }
.workspace-controls { grid-column: 2; grid-row: 2; min-width: 0; border-bottom: 1px solid #363847; }
.chart-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; min-width: 0; }
.workspace-title { display: flex; align-items: center; gap: 8px; padding-right: 12px; font-weight: 700; font-size: 15px; }
.workspace-subtitle { color: #9396a4; font-size: 12px; font-weight: 400; }
.workspace-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chart-toolbar .btn-ghost { padding: 6px 10px; font-size: 12px; min-height: 32px; background: #2b2e3c; }
.chart-toolbar .layout-picker { background: #2b2e3c; }
.panel-toggles { display: flex; align-items: center; gap: 5px; margin-left: auto; padding-left: 10px; border-left: 1px solid #414352; }
body > .area-panel { grid-column: 2; grid-row: 3; }
body > .layout { grid-template-columns: minmax(0, 1fr) 314px; grid-template-rows: minmax(0, 1fr); gap: 12px; padding: 12px; min-height: 0; height: 100%; overflow: hidden; position: relative; }
body > .layout.panels-hidden, body > .layout.focus-mode { grid-template-columns: minmax(0, 1fr); }
.layout.focus-mode .radar-sidebars { display: none; }
.radar-sidebars { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #525568 transparent; }
.radar-sidebars .watchlist, .radar-sidebars .dashboard { border: 1px solid #3a3d4d; border-radius: 10px; background: #292c39; padding: 15px; flex: 0 0 auto; overflow: visible; max-height: none; }
.dock-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dock-heading h2 { margin: 0; font-size: 14px; font-weight: 700; }
.dock-heading #watch-limit { margin: 0; color: #9b9eab; }
.dock-kicker { font-size: 9px; letter-spacing: .12em; color: #9b9eab; }
.radar-sidebars .watch-row { padding: 9px 10px; border-radius: 7px; background: #313442; }
.radar-sidebars .watch-row.active { background: #3b3332; }
.radar-sidebars .watch-row .typ { color: #a6a9b7; }
.radar-sidebars .markets-panel { font-size: 12px; }
.radar-sidebars .dash-setup-top { margin-bottom: 12px; padding-bottom: 12px; }
.radar-sidebars .dash-setup-top .rule-row { flex-direction: column; align-items: stretch; gap: 7px; }
.radar-sidebars .assess-head { line-height: 1.4; font-size: 15px; overflow-wrap: anywhere; }
.radar-sidebars .assess-reason { font-size: 13px; line-height: 1.5; }
.radar-sidebars .score-row { font-size: 12px; gap: 12px; }
.radar-sidebars .score-row strong { text-align: right; overflow-wrap: anywhere; }
.radar-sidebars .cond-list li { font-size: 12px; line-height: 1.4; }
body > .layout .charts { min-height: 0; }
body > .layout .chart-cell { min-height: 110px; }
.foot { grid-column: 1 / -1; grid-row: 4; color: #a0a3b0; }
.foot .health, .topbar .brand .subtitle { color: #a0a3b0; }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.shell-dialog { width: min(490px, calc(100vw - 28px)); max-width: none; max-height: calc(100dvh - 28px); padding: 25px; overflow: auto; background: #292c39; color: var(--text); border: 1px solid #55596d; border-radius: 15px; box-shadow: 0 22px 90px #08091280; }
.shell-dialog::backdrop { background: rgba(10, 12, 19, .76); }
.shell-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.shell-dialog h2 { font-size: 23px; margin: 7px 0 0; }
.dialog-eyebrow { font-size: 10px; color: var(--accent); letter-spacing: .13em; }
.shell-intro { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 20px 0; }
.shell-status { background: #323646; border-left: 2px solid var(--accent); padding: 11px 13px; line-height: 1.5; overflow-wrap: anywhere; }
.shell-status.error { border-left-color: #ed9481; color: #ffc0b4; }
.shell-dialog form label { display: flex; flex-direction: column; gap: 7px; margin-top: 16px; }
.shell-dialog form input { width: 100%; min-width: 0; padding: 10px 12px; background: #232633; }
.shell-dialog form .btn { width: 100%; min-height: 40px; margin-top: 20px; }
.field-hint { color: #abaebb; font-size: 12px; line-height: 1.5; }
.local-mode-note { padding-top: 18px; margin-top: 22px; border-top: 1px solid #444758; }
.local-mode-note strong { font-size: 12px; color: #d0d2dc; }
.local-mode-note p { color: #a6a9b7; font-size: 12px; line-height: 1.6; margin-bottom: 0; }
.display-preferences { padding: 4px 14px; border-color: #444758; }
.display-preferences legend { font-size: 12px; padding: 0 6px; }
.display-preferences label { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 14px 0; }
.display-preferences label + label { border-top: 1px solid #444758; }
.display-preferences strong { display: block; color: var(--text); font-weight: 400; }
.display-preferences small { display: block; margin-top: 5px; font-size: 12px; color: #a6a9b7; }
.display-preferences input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
@media (max-width: 1200px) {
  .topbar-feed { flex-basis: 340px; }
  .feed-meta { display: none; }
  .workspace-subtitle { display: none; }
  body > .layout { grid-template-columns: minmax(0, 1fr) 286px; gap: 9px; padding: 9px; }
}
@media (max-width: 960px) {
  body { grid-template-columns: 76px minmax(0, 1fr); }
  .topbar { padding: 9px 12px; gap: 8px 12px; }
  .topbar .logo { height: 38px; max-width: 142px; }
  .topbar-feed { flex: 1 0 100%; order: 3; }
  .topbar-feed .feed-meta { display: block; max-width: 220px; margin-left: auto; }
  .account-tools { margin-left: auto; }
  .chart-toolbar { gap: 6px; padding: 8px 9px; }
  .workspace-title { font-size: 13px; padding-right: 3px; }
  .chart-toolbar .layout-picker button { width: 28px; }
  .chart-toolbar .btn-ghost { padding: 6px 7px; font-size: 11px; }
  body > .layout { grid-template-columns: minmax(0, 1fr) 258px; }
  .radar-sidebars .watchlist, .radar-sidebars .dashboard { padding: 12px; }
  .chart-grid.layout-3, .chart-grid.layout-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  body { grid-template-columns: 61px minmax(0, 1fr); }
  .main-nav { padding: 10px 4px; gap: 5px; }
  .main-nav .area-btn { font-size: 10px; min-height: 61px; }
  .topbar .brand-meta, .local-tag, .workspace-title { display: none; }
  .topbar .logo { max-width: 120px; height: 32px; }
  .topbar-feed { gap: 5px; }
  .topbar-feed .feed-meta { display: none; }
  .topbar-feed .badge-sim { padding: 6px; font-size: 10px; }
  .topbar-feed .select { width: 133px; font-size: 11px; }
  .topbar-feed #btn-broker { font-size: 11px; padding: 6px; }
  .profile-button { padding: 7px; gap: 6px; }
  #profile-button-label { max-width: 106px; font-size: 11px; }
  .account-tools { gap: 1px; }
  .account-tools .icon-btn { width: 30px; }
  .panel-toggles { padding-left: 5px; }
  body > .layout { grid-template-columns: minmax(0, 1fr); padding: 7px; }
  .radar-sidebars { position: absolute; z-index: 20; right: 7px; top: 7px; bottom: 7px; width: min(278px, calc(100% - 14px)); background: #22242f; border-radius: 10px; box-shadow: -10px 0 28px #090b1466; }
  .chart-grid.layout-3, .chart-grid.layout-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell-dialog { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { .main-nav *, .shell-dialog * { scroll-behavior: auto; } }
/* Role-based event plans share the existing editor's spacing and theme. */
.event-plan-card { padding: 18px; margin: 14px 0; border: 1px solid #4b4c63; border-radius: 12px; }
.event-plan-card > label { display: flex; align-items: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.event-predicate { margin: 10px 0; padding: 12px; background: #292b3b; border-radius: 8px; }
.event-predicate summary { cursor: pointer; }
.event-fields { display: flex; flex-wrap: wrap; align-items: start; gap: 12px; padding-top: 14px; }
.event-fields fieldset { flex: 1 1 180px; min-width: 0; border: 1px solid #4b4c63; }
.event-fields label { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
#ai-dialogue { padding: 16px 0; border-top: 1px solid #4b4c63; margin-top: 16px; }
#ai-dialogue textarea { width: 100%; box-sizing: border-box; margin: 8px 0; }
#ai-dialogue-history p { white-space: pre-wrap; border-left: 2px solid #dc813e; padding-left: 12px; }

/* Progressive AI flow: one task and one primary action, not stacked forms. */
.setup-dialog.ai-mode { width: min(920px, calc(100vw - 32px)); }
.ai-mode #editor-context { display: none; }
.ai-mode:has(#creation-tabs:not([hidden])) .ai-card-head { display: none; }
.ai-mode .ai-panel { padding: 4px 0 0; border: 0; background: transparent; }
.ai-step { color: var(--accent); font-size: 13px; letter-spacing: .04em; margin: 18px 0; }
.ai-description > summary, #ai-dialogue > summary { cursor: pointer; color: var(--text); padding: 10px 0; font-size: 14px; }
.ai-description > summary span { color: var(--muted); font-size: 12px; margin-left: 10px; }
.ai-panel[data-phase="describe"] .ai-description > summary { display: none; }
.ai-description[open] > summary { border-bottom: 1px solid #404353; }
.ai-mode #ai-input { font-weight: 400; line-height: 1.6; min-height: 150px; }
.ai-mode .ai-preview { background: transparent; border: 0; padding: 0; margin-top: 18px; }
.ai-mode #ai-preview-title { display: none; }
.ai-mode .ai-summary { background: transparent; padding: 10px 0; margin: 0; }
.ai-mode .ai-summary .ai-name { color: var(--text); font-size: 19px; }
.ai-mode .ai-checklist > li { background: #292c39; border: 1px solid #424553; padding: 16px; border-radius: 10px; }
.ai-mode .ai-checklist li li { background: transparent; border-left: 1px solid #555664; border-radius: 0; }
.ai-mode .ai-checklist .hint { color: #b3b6c5; font-size: 13px; line-height: 1.5; }
.ai-mode .ai-q { background: transparent; border: 0; padding: 8px 0; }
.ai-mode .ai-q label { color: var(--text); font-weight: 400; gap: 14px; line-height: 1.5; }
.ai-mode .ai-dialog-lead { font-weight: 400; color: var(--muted); }
.ai-mode #ai-dialogue { padding: 4px 0; margin-top: 20px; }
.ai-mode #ai-dialogue[open] { padding-bottom: 12px; }
.ai-mode #ai-dialogue label { display: block; margin-top: 16px; }
.ai-mode .ai-confirm-row { border-top: 1px solid #404353; padding-top: 18px; margin-top: 18px; }
.ai-mode summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 680px) {
  .setup-dialog.ai-mode { width: calc(100vw - 16px); padding: 16px; }
  .ai-description > summary span { display: none; }
  .ai-mode .ai-checklist > li { padding: 10px; }
}
/* A definition is a focused sub-dialog; the setup question stays preserved. */
#ed-ki.concept-focus #ai-preview { display: none; }
#concept-learning { margin: 18px 0; }
#concept-learning > label:not([hidden]) { display: block; margin: 16px 0 8px; }
#concept-name { display: block; width: min(100%, 420px); box-sizing: border-box; }
#concept-learning .hint { color: #b8bac5; line-height: 1.5; }
#concept-result { margin: 20px 0; line-height: 1.6; }
#concept-result:not(:empty) { border-left: 2px solid #d98243; padding-left: 18px; }
#concept-status { line-height: 1.5; }
#concept-library > details { margin: 12px 0; }
