/* Limestra Labs — Gratis-Rechner v1 (erweitert ../assets/site.css) */
:root {
  --warn: #F4C430;
  --ink-soft: #26293d;
}
[hidden] { display: none !important; }

/* Sticky mini-readout so the buffer stays visible while scrolling inputs on mobile */
.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--surface);
  color: var(--fg);
  border-bottom: 2px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
}
.sticky-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  flex-wrap: wrap;
}
.sticky-metrics {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.sticky-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.sticky-item span {
  opacity: .78;
  text-transform: uppercase;
  font-size: 11px;
}
.sticky-item strong {
  font-size: 15px;
  color: var(--lime);
}
.sticky-item.is-warn strong { color: var(--warn); }
.sticky-item.is-danger strong { color: var(--coral); }
.sticky-tag {
  background: var(--lime);
  color: var(--ink);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.sticky-tag.is-warn { background: var(--warn); }
.sticky-tag.is-danger { background: var(--coral); }

/* Hero / Top Instrument Band */
.calc-hero {
  background: var(--bg);
  color: var(--fg);
  padding: clamp(24px, 3.5vw, 44px) 0 clamp(28px, 4vw, 48px);
  border-bottom: 2px solid var(--border);
}
.calc-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.calc-head-row h1 {
  font-size: clamp(32px, 5vw, 56px);
  line-height: .98;
  letter-spacing: -.04em;
  font-weight: 710;
  margin-top: 8px;
}
.back-link {
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1.5px solid var(--lime);
  padding-bottom: 2px;
  color: var(--lime);
}
.back-link:hover { color: var(--fg); border-color: var(--fg); }
html[data-theme="light"] .back-link {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
html[data-theme="light"] .sticky-item strong {
  color: var(--ink);
}
html[data-theme="light"] .sticky-item.is-danger strong {
  color: var(--danger-text);
}
html[data-theme="light"] .result-panel {
  border-color: var(--ink);
}

/* Main Result Instrument (Limestra signature lime/warn/coral block) */
.result-panel {
  background: var(--lime);
  color: var(--ink);
  border: 2px solid var(--lime);
  padding: clamp(18px, 2.5vw, 32px);
}
.result-panel.status-warn {
  background: var(--warn);
  border-color: var(--warn);
}
.result-panel.status-danger {
  background: var(--coral);
  border-color: var(--coral);
}
.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.binding-pill {
  background: var(--ink);
  color: var(--lime);
  padding: 4px 10px;
  font-weight: 700;
  font-size: 12px;
}
.result-panel.status-warn .binding-pill { color: var(--warn); }
.result-panel.status-danger .binding-pill { color: var(--coral); }

.result-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 24px;
  padding: 20px 0 18px;
  align-items: end;
}
.primary-metric-label {
  font-size: 15px;
  font-weight: 650;
}
.primary-metric-value {
  display: block;
  font: 500 clamp(44px, 7.5vw, 84px)/1.02 var(--mono);
  letter-spacing: -.07em;
  margin: 4px 0 6px;
}
.metric-sub {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
}
.secondary-metric {
  border-left: 2px solid var(--ink);
  padding-left: 20px;
}
.secondary-metric-value {
  display: block;
  font: 500 clamp(28px, 4vw, 44px)/1.08 var(--mono);
  letter-spacing: -.06em;
  margin: 4px 0;
}

/* Gauge bar */
.gauge-wrap {
  margin: 4px 0 18px;
}
.gauge-bar {
  height: 22px;
  border: 2px solid var(--ink);
  background: var(--paper);
  position: relative;
  overflow: hidden;
}
.gauge-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--ink);
  transition: width .25s ease-out;
}
.gauge-fill.is-warn { background: var(--ink); }
.gauge-fill.is-danger {
  background: var(--ink) url("../assets/hatch.svg") repeat-x 0 0 / 12px 100%;
}
.gauge-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
  margin-top: 6px;
}

/* After-Reset row */
.reset-strip {
  border-top: 2px solid var(--ink);
  padding-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 20px;
  align-items: center;
}
.reset-value {
  font: 500 clamp(22px, 3vw, 32px)/1.1 var(--mono);
  letter-spacing: -.05em;
}
.reset-countdown {
  font-family: var(--mono);
  text-align: right;
}
.reset-countdown strong {
  display: block;
  font-size: clamp(19px, 2.5vw, 26px);
  letter-spacing: -.03em;
}
.reset-countdown small {
  display: block;
  font-size: 11px;
  line-height: 1.4;
}

/* Main Workspace Sections */
.calc-sections {
  padding: 28px 0 56px;
}
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
.calc-section {
  border-top: 2px solid var(--ink);
  padding-top: 16px;
  margin-bottom: 32px;
}
.calc-section.full-span {
  grid-column: 1 / -1;
}
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.sec-head h2 {
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -.03em;
  line-height: 1.08;
  font-weight: 690;
}
.sec-num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

/* Form controls — thumb-friendly, sharp brutalist lines */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field.span-2 { grid-column: 1 / -1; }
.field label {
  font-size: 14px;
  font-weight: 620;
  line-height: 1.25;
}
.field-hint {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  opacity: .8;
}
.input, .select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  background: #FFFFFF;
  color: var(--ink);
  border-radius: 0;
  font-family: var(--mono);
  font-size: 16px;
  appearance: none;
}
.select {
  font-family: var(--body);
  font-weight: 560;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
.input:focus, .select:focus {
  outline: 3px solid var(--lime);
  outline-offset: 0;
}
.input[disabled] {
  background: #E8E8DF;
  color: #555866;
}

/* Segmented pills / quick buttons */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.chip {
  min-height: 38px;
  padding: 6px 11px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}
.chip[aria-pressed="true"], .chip.active {
  background: var(--ink);
  color: var(--lime);
}
.chip:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Rule summary box */
.rule-box {
  margin-top: 16px;
  border: 1.5px solid var(--ink);
  background: #FFFFFF;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}
.rule-box-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
.rule-kv strong { display: block; font-size: 11px; text-transform: uppercase; opacity: .72; }
.unknown-tag {
  background: var(--coral);
  color: var(--ink);
  padding: 1px 5px;
  font-weight: 700;
}

/* Lot result output box */
.lot-output {
  margin-top: 16px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.lot-output-num {
  font: 500 clamp(36px, 6vw, 52px)/1 var(--mono);
  color: var(--lime);
  letter-spacing: -.05em;
}
.lot-copy-btn {
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--lime);
  background: var(--lime);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}
.lot-copy-btn:hover { background: var(--paper); border-color: var(--paper); }

.alert-box {
  margin-top: 12px;
  border: 2px solid var(--ink);
  background: var(--coral);
  color: var(--ink);
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 620;
}
.alert-box.is-hidden { display: none; }

/* Details toggle for broker contract specs */
.spec-details {
  margin-top: 14px;
  border: 1.5px solid var(--ink);
  background: #FFFFFF;
}
.spec-details summary {
  cursor: pointer;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.spec-details summary::after { content: '+'; font-size: 16px; }
.spec-details[open] summary::after { content: '−'; }
.spec-body {
  padding: 12px;
  border-top: 1.5px solid var(--ink);
}

/* All Stops Stress Section */
.trade-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.trade-row {
  border: 1.5px solid var(--ink);
  background: #FFFFFF;
  padding: 12px;
  display: grid;
  grid-template-columns: 120px 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.trade-row.mode-direct {
  grid-template-columns: 120px 1fr auto auto;
}
.trade-risk-badge {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 10px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  min-height: 48px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.icon-btn {
  min-width: 44px;
  min-height: 48px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
}
.icon-btn:hover { background: var(--coral); }
.add-trade-btn {
  min-height: 46px;
  padding: 8px 16px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}
.add-trade-btn:hover { background: var(--lime); }

.stress-verdict {
  margin-top: 16px;
  border: 2px solid var(--ink);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.stress-verdict.survives {
  background: var(--lime);
  color: var(--ink);
}
.stress-verdict.bursts {
  background: var(--coral);
  color: var(--ink);
}
.stress-verdict-title {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 760;
  letter-spacing: -.03em;
  line-height: 1;
}
.stress-verdict-nums {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}

/* Reserved Waitlist Slot */
.waitlist-slot {
  border: 2px dashed var(--ink);
  background: #FFFFFF;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.waitlist-slot p { max-width: 52ch; font-size: 15px; }

/* Disclaimer & Source */
.disclaimer-bar {
  margin-top: 24px;
  border-top: 2px solid var(--ink);
  padding-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}

/* Mobile-first responsive tightening (390px target) */
.result-panel, .result-grid > div, .calc-section, .reset-strip > div { min-width: 0; }
.result-top, .metric-sub, .field-hint { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .calc-layout { grid-template-columns: 1fr; gap: 8px; }
  .result-grid { grid-template-columns: 1fr; gap: 16px; }
  .secondary-metric { border-left: 0; border-top: 2px solid var(--ink); padding-left: 0; padding-top: 14px; }
  .reset-strip { grid-template-columns: 1fr; }
  .reset-countdown { text-align: left; }
}
@media (max-width: 640px) {
  .field-grid, .field-grid.cols-3, .rule-box-grid { grid-template-columns: 1fr; }
  .trade-row, .trade-row.mode-direct {
    grid-template-columns: 1fr 1fr;
  }
  .trade-row .icon-btn { grid-column: 2; justify-self: end; width: 48px; }
  .sticky-inner { gap: 6px; }
  .sticky-metrics { gap: 10px; }
}
@media (max-width: 420px) {
  .result-panel { padding: 14px; }
  .primary-metric-value { font-size: 46px; }
  .secondary-metric-value { font-size: 30px; }
  .sticky-item strong { font-size: 13px; }
  .sticky-tag { font-size: 10px; padding: 2px 5px; }
}

/* Unified Dark Mode (Ink #161825 default) for Rechner & Simulator workspace */
html:not([data-theme="light"]) .sticky-bar,
html:not([data-theme="light"]) .calc-hero {
  border-bottom-color: var(--border);
}
html:not([data-theme="light"]) .calc-section,
html:not([data-theme="light"]) .disclaimer-bar {
  border-top-color: var(--border);
}
html:not([data-theme="light"]) .input,
html:not([data-theme="light"]) .select {
  background-color: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
html:not([data-theme="light"]) .select {
  background-image: linear-gradient(45deg, transparent 50%, var(--fg) 50%), linear-gradient(135deg, var(--fg) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
html:not([data-theme="light"]) .input[disabled] {
  background: var(--surface-alt);
  color: var(--fg-muted);
}
html:not([data-theme="light"]) .chip {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
html:not([data-theme="light"]) .chip[aria-pressed="true"],
html:not([data-theme="light"]) .chip.active {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
  font-weight: 700;
}
html:not([data-theme="light"]) .rule-box,
html:not([data-theme="light"]) .spec-details,
html:not([data-theme="light"]) .trade-row,
html:not([data-theme="light"]) .waitlist-slot {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
html:not([data-theme="light"]) .spec-body {
  border-top-color: var(--border);
}
html:not([data-theme="light"]) .trade-risk-badge,
html:not([data-theme="light"]) .icon-btn,
html:not([data-theme="light"]) .add-trade-btn {
  background: var(--surface-alt);
  color: var(--fg);
  border-color: var(--border);
}
html:not([data-theme="light"]) .add-trade-btn:hover {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
}
html:not([data-theme="light"]) .icon-btn:hover {
  background: var(--coral);
  color: var(--ink);
  border-color: var(--coral);
}
html:not([data-theme="light"]) .lot-output {
  background: var(--surface);
  border-color: var(--lime);
}
