/* Trading mit KI – ein Stylesheet, keine Inline-Styles (strikte CSP). */

:root {
  --paper: #eff2ee;
  --paper-deep: #e2e7e1;
  --ink: #16282d;
  --ink-soft: #55676c;
  --line: #c3cdc9;
  --up: #0f766e;
  --down: #c0392b;
  --sma-20: #1f5f8b;
  --sma-50: #a8701a;
  --warn: #a8701a;
  --warn-bg: #f6ecd8;
  --error-bg: #f3dcda;
  --info-bg: #dde7e3;
  --focus: #1f5f8b;
  --font: "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Kopfzeile */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 2px solid var(--ink);
  max-width: 1040px;
  margin: 0 auto;
}

.wordmark {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nav { display: flex; flex-wrap: wrap; gap: 1rem; margin-left: auto; }
.nav a, .nav .linklike { font-size: 1rem; }

.inline-form { display: inline; margin: 0; }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

/* Seite */
.page { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.foot {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  border-top: 1px solid var(--line);
}

h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 0 0 0.75rem; }

.hero { padding: 2.5rem 0 1.5rem; max-width: 36rem; }
.hero-small { padding-top: 1rem; }

.motto {
  font-size: clamp(2.25rem, 7vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0 0 1.25rem;
}

.lead { font-size: 1.125rem; color: var(--ink-soft); margin: 0; }

.block { padding: 1.5rem 0; border-top: 1px solid var(--line); }
.block:first-of-type { border-top: 0; padding-top: 0.5rem; }

.empty { color: var(--ink-soft); }

/* Formulare */
.form { display: grid; gap: 0.5rem; }
/* else the form's column keeps the min-content width of a three-column .form-grid (672 px page at 390 px) */
.form > * { min-width: 0; }
.form-narrow { max-width: 24rem; }
.form label { font-weight: 600; }

input[type="email"], input[type="text"], input[type="number"], input[type="time"], textarea, select {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--ink-soft);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}

.button {
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  margin-top: 0.5rem;
  justify-self: start;
}
.button:hover { background: #22383f; }
.button-quiet { background: transparent; color: var(--ink); }
.button-quiet:hover { background: var(--paper-deep); }

.form-note { margin: 0.5rem 0 0; color: var(--ink-soft); font-size: 0.9375rem; }

/* Meldungen */
.flash { padding: 0.75rem 1rem; border-left: 4px solid var(--ink); background: var(--info-bg); margin: 0 0 1.5rem; }
.flash-error { border-left-color: var(--down); background: var(--error-bg); }
.flash-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.flash-success { border-left-color: var(--up); }

/* Tabellen */
.data { width: 100%; border-collapse: collapse; font-size: 1rem; }
.data th, .data td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data th { font-weight: 600; color: var(--ink-soft); border-bottom: 2px solid var(--ink); }
.data .num { text-align: right; white-space: nowrap; }
.up { color: var(--up); }
.down { color: var(--down); }

.list { padding-left: 1.2rem; margin: 0; }
.list li { margin: 0.25rem 0; }

/* Instrument-Seite */
.head .meta { color: var(--ink-soft); margin: -0.5rem 0 0.75rem; }
.muted { color: var(--ink-soft); font-size: 0.9375rem; }
.summary { max-width: 42rem; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.button-small { padding: 0.35rem 0.7rem; margin: 0; font-size: 0.9375rem; }
.form-row { grid-template-columns: 1fr auto; align-items: end; max-width: 32rem; }
.form-row label { grid-column: 1 / -1; }
.nav-search { display: flex; gap: 0.4rem; align-items: center; }
.nav-search input { width: 11rem; padding: 0.3rem 0.5rem; font-size: 0.9375rem; }

.kv { border-collapse: collapse; width: 100%; max-width: 42rem; }
.kv th, .kv td { padding: 0.4rem 0.6rem 0.4rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv th { text-align: left; font-weight: 500; color: var(--ink-soft); width: 45%; }

.edit-row { padding: 1rem 0; border-bottom: 1px solid var(--line); display: grid; gap: 0.75rem; }
.edit-row h3 { margin: 0; font-size: 1.0625rem; }
.data .muted { font-size: 0.8125rem; }

/* Checks und Snapshots */
.note { padding: 0.5rem 0.75rem; border-left: 4px solid var(--ink); background: var(--info-bg); max-width: 42rem; }
.checks { list-style: none; padding: 0; margin: 0; max-width: 46rem; }
.checks li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); align-items: start; }
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: #d8e9e2; color: var(--up); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-na { background: var(--paper-deep); color: var(--ink-soft); }
.rule-id { margin-left: 0.4rem; color: var(--ink-soft); font-size: 0.8125rem; border-bottom: 1px dotted var(--ink-soft); cursor: help; }
h3 { font-size: 1.0625rem; margin: 1rem 0 0.5rem; }

/* Startseite: Kacheln der Routinen */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; margin: 0 0 1.5rem; }
.tile { padding: 0.75rem 1rem; border-left: 4px solid var(--ink); background: #fff; min-width: 0; }
.tile > * { margin: 0; }
.tile > * + * { margin-top: 0.25rem; }
.tile-label { color: var(--ink-soft); font-size: 0.9375rem; }
.tile-value { font-size: 1.125rem; font-weight: 600; line-height: 1.35; overflow-wrap: break-word; hyphens: auto; }
.tile-note { color: var(--ink-soft); font-size: 0.875rem; }

/* Einstellungen: Zustand des Mailversands (Serverkonfiguration) */
.mail-state { list-style: none; margin: 0 0 1rem; padding: 0; }
.mail-state li { margin: 0.25rem 0; }

/* Konten */
.table-scroll { overflow-x: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.75rem 1rem; max-width: 46rem; }
.field { display: grid; gap: 0.25rem; align-content: start; }
.form .field-check { display: flex; gap: 0.5rem; align-items: baseline; font-weight: 400; }
.price-source { display: block; color: var(--ink-soft); font-size: 0.8125rem; white-space: normal; }
.data .row-note td { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.note-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.notes { list-style: none; margin: 0 0 1.5rem; padding: 0.75rem 1rem; border-left: 4px solid var(--warn); background: var(--warn-bg); }
.notes li { margin: 0.25rem 0; }
.badge-plan { background: var(--info-bg); color: var(--ink); }
.button-danger { background: var(--down); border-color: var(--down); }
.button-danger:hover { background: #a2301f; }

/* Trade-Assistent und Orders */
a.button { display: inline-block; text-decoration: none; }
/* «Order aufgeben» bleibt klickbar; der Server prüft die Checkliste erneut */
.button-disabled, .button-disabled:hover { background: var(--paper-deep); border-color: var(--line); color: var(--ink-soft); }
.badge-block { background: var(--error-bg); color: var(--down); }
.badge-info { background: var(--info-bg); color: var(--ink); }
.steps { list-style: none; margin: 0; padding: 0; }
.step { padding: 1.5rem 0; border-top: 1px solid var(--line); }
.step > * + * { margin-top: 0.75rem; }
.step-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0; }
.step-number { display: inline-grid; place-items: center; min-width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 0.9375rem; }
/* sonst rechnet das Raster mit der Mindestbreite seiner Formularraster und läuft auf dem Handy über */
.assistant > * { min-width: 0; }
.field-note { color: var(--ink-soft); font-size: 0.9375rem; }
.answer { border: 0; margin: 0; padding: 0; }
.answer legend { font-weight: 600; padding: 0; margin-bottom: 0.25rem; }
.form .answer label { display: inline-flex; gap: 0.35rem; align-items: baseline; margin-right: 1.25rem; font-weight: 400; }

/* Chart (SVG, Farben nur hier) */
.chart { width: 100%; height: auto; display: block; max-width: 1000px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid-x { stroke-dasharray: 2 4; }
.chart .axis-label { fill: var(--ink-soft); font-size: 12px; font-family: var(--font); }
.chart .legend { fill: var(--ink-soft); font-size: 12px; font-family: var(--font); }
.chart .chart-note { fill: var(--ink-soft); font-size: 16px; text-anchor: middle; font-family: var(--font); }
.chart .wick { stroke-width: 1; }
.chart .wick.up { stroke: var(--up); }
.chart .wick.down { stroke: var(--down); }
.chart .candle.up { fill: var(--paper); stroke: var(--up); stroke-width: 1.5; }
.chart .candle.down { fill: var(--down); stroke: var(--down); stroke-width: 1; }
.chart .sma { fill: none; stroke-width: 2; stroke-linejoin: round; }
.chart .sma-20 { stroke: var(--sma-20); }
.chart .sma-50 { stroke: var(--sma-50); }

/* Berater und Chat */
textarea { resize: vertical; }
.note-error { border-left-color: var(--down); background: var(--error-bg); }
.cell-line { display: block; }
.risk-level { font-size: 1.125rem; font-weight: 600; margin: 1rem 0 0.5rem; }
.chat { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 1rem; max-width: 46rem; }
.post { padding: 0.75rem 1rem; border-left: 4px solid var(--up); background: #fff; min-width: 0; }
.post > * { margin: 0; }
.post > * + * { margin-top: 0.75rem; }
.post-user { border-left-color: var(--ink-soft); background: var(--paper-deep); }
.post-who { font-weight: 600; font-size: 0.9375rem; color: var(--ink-soft); }
.post-text, .chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.sources { overflow-wrap: anywhere; }
.chat-live { margin-top: 1rem; padding: 0.75rem 1rem; border-left: 4px solid var(--focus); background: #fff; max-width: 46rem; }
.chat-question { margin: 0 0 0.5rem; font-weight: 600; white-space: pre-wrap; }
.chat-tool { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.9375rem; }
.chat-error { max-width: 46rem; }

/* KI-Einschätzung und Risikostufe */
.ai-section > h3 { margin: 0.75rem 0 0.25rem; }
/* the label «KI-Einschätzung» in each buy order's block of a journal entry */
article h4 { font-size: 1rem; margin: 0.75rem 0 0.25rem; }
.ai-text { margin: 0; max-width: 46rem; white-space: pre-line; overflow-wrap: anywhere; }
.risk-1 { background: #d8e9e2; color: var(--up); }
.risk-2 { background: var(--info-bg); color: var(--up); }
.risk-3 { background: var(--paper-deep); color: var(--ink); }
.risk-4 { background: var(--warn-bg); color: var(--warn); }
.risk-5 { background: var(--error-bg); color: var(--down); }
details > summary { cursor: pointer; font-weight: 600; margin: 0.5rem 0; }

/* Glocke und Benachrichtigungen */
.bell { display: inline-flex; align-items: center; gap: 0.25rem; text-decoration: none; }
.bell-icon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bell-count { min-width: 1.25rem; padding: 0 0.35rem; border-radius: 999px; background: var(--down); color: #fff; font-size: 0.8125rem; font-weight: 700; line-height: 1.25rem; text-align: center; }
.notification-actions { margin: 0 0 1rem; }
.notification-list { list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.notification { padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; min-width: 0; }
.notification > * { margin: 0; }
.notification > * + * { margin-top: 0.25rem; }
.notification-unread { border-left-color: var(--focus); background: #fff; }
.notification-meta { color: var(--ink-soft); font-size: 0.9375rem; }
.notification-title { font-weight: 600; }
.notification-text { white-space: pre-line; overflow-wrap: anywhere; }

/* Berichte: Morning Brief und Wochenbericht */
.report-ai .ai-text { margin-bottom: 0.75rem; }
.report-ai .note { margin: 0; }
.report-flows { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 2rem; }
.report-flows h3 { margin-top: 0; }
.leaders { list-style: none; margin: 0; padding: 0; columns: 18rem 3; column-gap: 2rem; }
.leaders li { break-inside: avoid; margin: 0 0 0.6rem; }
.leaders strong { display: block; font-weight: 600; font-size: 0.9375rem; color: var(--ink-soft); }

/* Jobs */
.job-state { list-style: none; margin: 0 0 1.5rem; padding: 0; color: var(--ink-soft); }
.job-state li { margin: 0.25rem 0; }
.jobs .schedule { font-size: 0.8125rem; }
.jobs .job-message { max-width: 28rem; font-size: 0.9375rem; white-space: pre-line; overflow-wrap: break-word; }
.jobs .inline-form .button { white-space: nowrap; }

/* Wissen: Regeln, Vorschläge und Destillation */
.filter { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: end; margin: 0 0 0.5rem; }
.filter .field { min-width: 12rem; }
.filter .button { margin-top: 0; }
.rules { list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.rule { padding: 0.9rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.rule > * { margin: 0; }
.rule > * + * { margin-top: 0.4rem; }
.rule-head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: baseline; }
.rule-text { overflow-wrap: break-word; }
.rule details .form { margin-top: 0.5rem; }
.rule .actions .button, .rule .inline-form .button { margin-top: 0; }
.quote { margin: 0.25rem 0; padding-left: 0.75rem; border-left: 3px solid var(--line); color: var(--ink-soft); overflow-wrap: break-word; }
input[type="file"] { font: inherit; max-width: 100%; }

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .kv th { width: 50%; }
  .nav-search input { width: 8rem; }
  .data { font-size: 0.9375rem; }
  .data th, .data td { padding: 0.45rem 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
