/* Performance sparkline */
.perf-spark {
  width: 100%;
  height: 80px; /* higher chart */
  display: block;
  background: var(--panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin: 6px 0 12px 0; /* ~3mm gap below chart */
  cursor: crosshair;
}

/* Disabled state for non-active rows' buttons */
.btn-result[disabled],
.btn-result.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(20%);
}

/* Session Stats styling */
.session-stats-card {
  margin-top: 12px; /* ~3mm Abstand */
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--panel);
}
.session-stats-title {
  font-weight: 700;
  color: var(--accent); /* gleiche Farbe wie Überschriften */
  margin-bottom: 6px;
  text-align: center;
}
.session-stats-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}
.stat-label {
  color: var(--text);
}
.stat-value {
  min-width: 48px;
  text-align: right;
  font-weight: 700;
}
.stat-value.gain { color: #10b981; }
.stat-value.loss { color: #ef4444; }

/* Badges (wins/losses) */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}
.badge.win {
  color: #0f5132;
  background: rgba(16,185,129,0.2);
  border: 1px solid #10b981;
}
.badge.loss {
  color: #842029;
  background: rgba(239,68,68,0.2);
  border: 1px solid #ef4444;
}

/* Performance tooltip */
.perf-tooltip {
  position: fixed; /* use viewport coords for reliable placement */
  transform: translate(-50%, -120%);
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  pointer-events: none;
  z-index: 999;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.perf-tooltip.hidden { display: none; }

/* Center section titles inside their boxes */
.performance-title,
.goals-title,
.calc-title,
.session-title {
  text-align: center;
  width: 100%;
}

/* Center Session-Stats title with badges nicely */
.session-stats-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

/* Sessions header: place Auto Config switch under the title and centered */
.session-panel .session-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.session-panel .auto-config.below-title {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.session-panel .auto-config.below-title .ac-label {
  font-weight: 600;
}
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start; /* do not stretch rows by tallest item */
}

/* Place the UI language switch at the top-left */
.ui-lang-switch {
    position: absolute;
    top: 16px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1200; /* above top-controls so it's clickable */
}

/* Timer panel */
.timer-panel {
    background: var(--panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    height: fit-content;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.timer-title {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.timer-content { display: flex; flex-direction: column; gap: 10px; }
.timer-display {
    font-size: 24px;
    font-weight: 900;
    text-align: center;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 60%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.timer-wage { display: flex; justify-content: space-between; font-size: 14px; }
.tw-label { color: var(--muted); }
.tw-value { font-weight: 800; }
.timer-controls { display: flex; gap: 8px; justify-content: center; }

/* Embedded timer frame inside Performance */
.timer-embed {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.timer-embed .timer-title { margin-bottom: 6px; }
.timer-embed .timer-controls { margin-top: 8px; }

/* Separate timer card under Performance */
.timer-card {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.timer-card .timer-title { margin-bottom: 6px; }
.timer-card .timer-display { margin-top: 4px; }
.timer-card .timer-wage { margin-top: 8px; }
.timer-card .timer-controls { margin-top: 16px; padding-top: 4px; }

/* New horizontal panels row under the title */
.panels-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-areas: "session calc goals perf";
    gap: 16px;
    align-items: stretch; /* make all cards equal height by tallest */
    margin-bottom: 20px;
}
.panels-row .session-panel { grid-area: session; }
.panels-row .calc-panel { grid-area: calc; }
.panels-row .goals-panel { grid-area: goals; }
.panels-row .performance-panel { grid-area: perf; }
.panels-row > aside {
    /* Ensure cards stretch and internal content flows vertically */
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Top-right Info button */
.btn-info {
    /* match language dropdown styling */
    background: #0d1016;
    color: var(--text);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 6px 14px rgba(0,0,0,0.35);
}
.btn-info:hover {
    transform: translateY(-1px);
    background: #0f131a;
}
.btn-info:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}
.btn-info:focus { outline: 2px solid rgba(96,165,250,0.6); outline-offset: 2px; }

/* Gear button subtle circle */
.btn-gear {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border-radius: 999px;
  padding: 0;
}

/* push action buttons to the right side */
.top-controls .btn-info:first-of-type { margin-left: auto; }

/* Top-right controls wrapper (language switch + info) */
.top-controls {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    z-index: 900; /* keep buttons clickable above language switch */
}

/* old inline language switch style not used anymore */
.ui-lang-switch { margin-left: 0; }

/* Language buttons */
.btn-lang {
    background: rgba(255,255,255,0.06);
    color: #e5e7eb;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.08s ease;
}
.btn-lang:hover { background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.btn-lang:active { transform: translateY(0); }
.btn-lang:focus { outline: 2px solid rgba(96,165,250,0.6); outline-offset: 2px; }
.btn-lang.active {
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    color: #0b1020;
    border-color: transparent;
}

/* Overlay (modal) */
.overlay.hidden { display: none; }
.overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
}
body.modal-open { overflow: hidden; }
.overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}
.overlay-modal {
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(760px, 92vw);
    max-height: 80vh;
    background: var(--panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
}
.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.lang-switch { display: flex; gap: 8px; margin-left: auto; margin-right: 8px; }
.btn-lang {
    background: #0d1016;
    color: var(--text);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    font-weight: 700;
    cursor: pointer;
}
.btn-lang:hover { background: #0f131a; }
.btn-lang.active {
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    color: #0b0d12;
    border-color: transparent;
}
.overlay-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.overlay-close {
    background: #0d1016;
    color: var(--text);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}
.overlay-close:hover { background: #0f131a; }

.overlay-content {
    padding: 20px;
    overflow: auto;
}
.overlay-content h3 { margin: 14px 0 6px 0; }
.overlay-content h4 { margin: 10px 0 6px 0; color: var(--muted); }
.overlay-content p { margin-bottom: 8px; }
.overlay-content ul { margin: 6px 0 10px 18px; }
.overlay-content code { background: #0d1016; padding: 1px 4px; border-radius: 4px; border: 1px solid var(--border-color); }

/* Settings layout */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.settings-item select {
  background: #0d1016;
  color: var(--text);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 8px;
  font-weight: 700;
}

/* Settings card for Strategien */
.settings-card {
  background: var(--panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.settings-card-title {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.strategies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 8px;
}
.strategies-grid > div label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.strategies-grid > div input[type="text"] {
  width: 100%;
  background: #0b0d12; /* tiefes Schwarz */
  color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
}

/* Tooltip panels for mode buttons */
.tooltip-wrap { position: relative; display: inline-block; }
.tooltip-panel {
    position: absolute;
    left: 50%; top: calc(100% + 8px);
    transform: translateX(-50%) translateY(6px);
    width: max(260px, 28ch);
    max-width: 360px;
    background: var(--panel);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 20;
}
.tooltip-wrap:hover .tooltip-panel,
.tooltip-wrap:focus-within .tooltip-panel {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}
.tooltip-panel::before {
    content: "";
    position: absolute;
    top: -6px; left: 50%; transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent var(--border-color) transparent;
}
.tooltip-panel::after {
    content: "";
    position: absolute;
    top: -5px; left: 50%; transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent var(--panel) transparent;
}
.tp-title {
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 6px;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.tp-body { font-size: 13px; color: var(--text); line-height: 1.35; }

/* Gradient text utility (matches headings) */
.grad-text {
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Old right-column placement no longer used (panels now in .panels-row) */
/* .main-content .calc-panel, .main-content .goals-panel { grid-column: 2; } */
/* .main-content .goals-panel { margin-top: 16px; } */

.table-area {
    min-width: 0; /* allow grid to shrink table area */
    grid-column: 1;
}

/* Removed .sidebar: panels are in .panels-row now */
/* .sidebar { ... } */

.goals-panel {
    background: var(--panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    height: fit-content;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}

/* Calculations panel styles (stacked above goals) */
.session-panel {
    background: var(--panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    height: fit-content;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.session-title {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auto-config { display: flex; align-items: center; gap: 8px; }
.ac-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }

/* Input with toggle styling for stop loss */
.input-with-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stop-loss-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Goal mode ($ / %) toggle styled like other switches */
.goal-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* UI language (DE/EN) toggle */
.ui-lang-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sl-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #3a4250;
    transition: .2s;
    border-radius: 999px;
    border: 1px solid var(--border-color);
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; top: 50%; transform: translateY(-50%);
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    border-radius: 50%;
    transition: .2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
input:checked + .slider {
    background: linear-gradient(90deg, #34d399, #10b981);
}
input:checked + .slider:before {
    transform: translate(20px, -50%);
}
.calc-panel {
    background: var(--panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px; /* revert: do not increase card height */
    height: fit-content;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
    display: flex;            /* allow internal layout to stretch */
    flex-direction: column;
}
.calc-title {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.calc-fields { 
    display: flex; 
    flex-direction: column; 
    gap: 6px;                     /* slightly tighter gap */
    justify-content: flex-start;  /* don't over-stretch rows */
    flex: 1;                       /* take remaining height inside panel */
}
.calc-fields .input-group { min-width: 0; flex: 0 0 auto; }
.calc-fields .input-group.small { flex: 0 0 auto; }
.calc-fields input[type="number"] { width: 100%; }

/* Comfortable spacing using internal distribution, not extra margins */
.calc-panel .calc-fields { gap: 6px; }
.calc-panel .input-group + .input-group { margin-top: 6px; }
.calc-panel label { margin-bottom: 5px; line-height: 1.2; }
.calc-panel input[type="number"] { padding: 8px 10px; margin: 0; }
/* Make initial bet field a bit narrower to fit toggle and label */
.calc-panel #initialBet { max-width: 120px; }

/* Inline input with a small toggle to the right */
.input-with-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}
.goal-prio-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}
.input-with-toggle .auto-config.field-auto {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.input-with-toggle .auto-config.field-auto .ac-label {
    font-size: 11px;
}

.goals-title {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.goal-group {
    margin-bottom: 10px;
    display: flex;             /* place label and buttons on one line */
    align-items: center;
    gap: 6px;                  /* slightly tighter */
    flex-wrap: wrap;           /* wrap on small widths */
}
.goal-group > label {
    white-space: nowrap;       /* keep 'Auto Mode:' in one piece */
}

/* Compact row under the input: switch on the left, hint on the right */
.goal-subrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
}
.goal-subrow .goal-hint {
    margin: 0; /* override default */
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
    font-size: 16px; /* larger hint text */
    font-weight: 700;
}

/* Segmented control for $ / % goal mode */
.segmented {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 6px 14px rgba(0,0,0,0.35);
}
.btn-seg {
    appearance: none;
    -webkit-appearance: none;
    background: var(--panel);
    color: var(--text);
    border: none;
    padding: 6px 10px;
    font-weight: 700;
    cursor: pointer;
    font-size: 12px;
    transition: transform 0.08s ease, background 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; /* equal width for $ and % */
    height: 32px; /* equal height for both */
}
.btn-seg + .btn-seg { border-left: 1px solid var(--border-color); }
.btn-seg:hover { transform: translateY(-1px); }
.btn-seg:active { transform: translateY(0); }
.btn-seg.active {
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    color: #0b0d12;
}

/* Hidden utility */
.hidden { display: none !important; }

/* Percent target hint text */
.goal-hint {
    margin: 4px 0 8px 0;
    font-size: 12px;
    color: var(--muted);
}

/* Larger, stronger hint under the dropdown */
.goals-panel #percentTargetHint {
    font-size: 16px;
    font-weight: 700;
    margin-left: 8px; /* nudge to the right */
    margin-top: 10px; /* extra space from the dropdown */
}

/* Auto Mode toggle */
.mode-toggle {
    display: inline-flex; /* inline with label */
    align-items: center;
    gap: 6px;                  /* slightly tighter */
}
.btn-mode {
    appearance: none;
    -webkit-appearance: none;
    padding: 4px 8px;          /* a bit smaller */
    font-size: 12px;           /* a bit smaller */
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border-color);
    border-radius: 8px;        /* slightly smaller radius */
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 6px 14px rgba(0,0,0,0.35);
}
.btn-mode:hover { transform: translateY(-1px); }
.btn-mode:active { transform: translateY(0); box-shadow: inset 0 2px 6px rgba(0,0,0,0.4); }
.btn-mode:focus { outline: 2px solid rgba(96,165,250,0.6); outline-offset: 2px; }

.btn-mode.active {
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    color: #0b0d12;
    border-color: transparent;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.06), 0 8px 18px rgba(0,0,0,0.45);
}

.sessions-required { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 24px; }
.sr-box {
    min-width: 160px;
    padding: 10px 16px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: inset 0 2px 6px rgba(255,255,255,0.05), 0 10px 24px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sr-count {
    font-size: 36px;
    font-weight: 900;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 60%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sr-label {
    font-weight: 700;
    letter-spacing: 0.6px;
    font-size: 13px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 60%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Performance panel */
.performance-panel {
    background: var(--panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    height: fit-content;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.performance-title {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.performance-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.perf-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}
.perf-label { color: var(--muted); }
.perf-value { font-weight: 700; }
.perf-value.gain { color: var(--success-color); }
.perf-value.loss { color: var(--danger-color); }
.perf-bar {
    height: 10px;
    background: #0d1016;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    overflow: hidden;
}
.perf-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #34d399, #10b981); /* green default */
    transition: width 0.25s ease, background 0.25s ease;
}
.perf-fill.loss {
    background: linear-gradient(90deg, #f87171, #ef4444);
}
:root {
    /* Dark theme palette */
    --bg: #0f1115;
    --panel: #161a22;
    --text: #e5e7eb;
    --muted: #9aa3b2;
    --primary-color: #7aa2f7; /* Indigo-ish */
    --primary-hover: #5c86e5;
    --secondary-color: #768199;
    --border-color: #272c36;
    --row-alt: #12161f;
    --success-color: #3ad29f;
    --danger-color: #ff6b6b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    padding: 20px;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    background: var(--panel);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    position: relative; /* anchor info button */
}

.app-title {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 800;
    letter-spacing: 0.5px;
    font-size: 36px;
    position: relative;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(3px 3px 0px #000000) drop-shadow(4px 4px 0px #000000) drop-shadow(5px 5px 0px #000000);
}

.version-badge {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 12px; /* smaller */
    font-weight: 600;
    padding: 3px 6px; /* smaller */
    background: rgba(236, 72, 153, 0.2);
    border: 1px solid rgba(236, 72, 153, 0.4);
    border-radius: 6px;
    color: #ec4899;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Language dropdown styling */
#uiLangSelect {
    background: #0d1016;
    color: var(--text);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 8px;
    font-weight: 700;
}

/* Goal mode dropdown matches language dropdown */
#goalModeSelect {
    background: #0d1016;
    color: var(--text);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 8px;
    font-weight: 700;
}

.app-title .byline {
    font-size: 11px; /* smaller */
    font-weight: 600;
    font-style: italic;
    margin-left: 12px;
    padding: 6px 12px; /* scale down padding */
    background: #1a1a1a;
    border-radius: 16px;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35); /* thinner border */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    display: inline-block;
    filter: none;
    -webkit-text-fill-color: #ffffff;
}

.session-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.session-box {
    min-width: 160px;
    padding: 12px 20px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow:
        inset 0 2px 6px rgba(255,255,255,0.05),
        0 10px 24px rgba(0,0,0,0.35);
}

.session-count {
    display: block;
    text-align: center;
    font-size: 44px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 60%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 14px rgba(168, 85, 247, 0.22);
}

.session-label {
    font-weight: 700;
    letter-spacing: 0.6px;
    font-size: 14px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 60%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Session stats */
.session-stats { margin-top: 10px; }
.ss-row { display: flex; justify-content: space-between; font-size: 14px; }
.ss-label { color: var(--muted); }
.ss-value { font-weight: 700; }
.ss-value.gain { color: var(--success-color); }
.ss-value.loss { color: var(--danger-color); }

/* Loss streak display */
.loss-streak {
    margin-top: 16px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.ls-label { color: var(--muted); font-weight: 700; letter-spacing: 0.4px; }
.ls-value { font-weight: 900; color: #ef4444; }

.input-section {
    display: flex;
    flex-wrap: nowrap; /* keep in one line */
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 30px;
    overflow-x: auto; /* allow scroll if viewport is too small */
}

.input-group { flex: 0 0 200px; min-width: 200px; }

.input-group.small { flex: 0 0 120px; min-width: 110px; max-width: 140px; }
.input-group.small input[type="number"] { padding: 8px 10px; font-size: 14px; }
.input-group.small label { font-size: 13px; }

.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: 16px;
}

/* Make initialBet+payout block take two columns on the main grid */
.two-col { grid-column: span 2; }

.two-col .sub-group label { margin-bottom: 6px; }

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--muted);
}

input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #0d1016;
    color: var(--text);
    font-size: 16px;
}
input[type="number"][disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Ensure spin buttons are always visible (WebKit/Blink) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    opacity: 1;
    display: block;
    background: transparent;
    /* visually brighten steppers on dark bg */
    filter: invert(1) brightness(1.4);
}

/* Keep default number appearance in Firefox (shows spinners on some platforms) */
input[type="number"] {
    appearance: auto;
    -moz-appearance: number-input;
}

.trades-container {
    margin-bottom: 30px;
    overflow-x: auto;
}

/* Footer under trades table for next stake display */
.next-stake-footer {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between; /* reset left, info + copy right */
}
.next-stake-footer .ns-right { display: flex; align-items: center; gap: 12px; }
.next-stake-footer .ns-label { color: var(--muted); font-weight: 700; }
.next-stake-footer .ns-value {
    font-weight: 900;
    font-size: 18px;
    margin-left: 12px;    /* bring value closer to label */
    margin-right: 22px;   /* add more space before copy button */
}
.next-stake-footer .ns-value::after {
    content: ' $';
    color: var(--muted);
    font-weight: 700;
    margin-left: 4px;
}
.btn-copy-large {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 800;
    border-radius: 10px;
    background: linear-gradient(90deg, #ec4899 0%, #a855f7 50%, #60a5fa 100%);
    color: #0b0d12;
    border: none;
    box-shadow: 0 8px 18px rgba(0,0,0,0.45);
    transition: transform 0.08s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-copy-large:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-copy-large:active { transform: translateY(0); box-shadow: inset 0 2px 6px rgba(0,0,0,0.4); }

.trades-header, .trade-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 1fr 1fr 220px;
    align-items: center;
    color: var(--text);
    padding: 10px 15px;
    font-weight: 500;
    border-radius: 4px 4px 0 0;
    border: 1px solid var(--border-color);
}

/* Header alignment: keep first two left, last (Result) right over buttons; no wrap */
.trades-header > div { white-space: nowrap; text-align: left; }
.trades-header > div:last-child { text-align: right; }
/* Ensure row cells follow same alignment */
.trade-row > div { text-align: left; }
.trade-row > div:last-child { text-align: right; }

.trade-row {
    padding: 10px 10px; /* slightly reduced row height */
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

/* Stop loss reached styling */
.trade-row.stop-loss-reached {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.trade-row.stop-loss-reached::before {
    content: "STOP LOSS";
    position: absolute;
    top: -8px;
    right: 8px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 10;
}

/* Profit target reached styling */
.trade-row.profit-target-reached {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.trade-row.profit-target-reached::before {
    content: "TAGS ZIEL ERREICHT";
    position: absolute;
    top: -8px;
    right: 8px;
    background: #10b981;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 10;
}

/* Result buttons */
.result-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-result {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    cursor: pointer;
    padding: 10px 14px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
    color: #0b1220;
    background: var(--panel);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 6px 14px rgba(0,0,0,0.35);
    transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-result:focus { outline: 2px solid rgba(96,165,250,0.6); outline-offset: 2px; }

.btn-win {
    background: linear-gradient(180deg, #34d399, #10b981);
    color: #062a1e;
}

.btn-loss {
    background: linear-gradient(180deg, #f87171, #ef4444);
    color: #2b0b0b;
}

.btn-result:hover { transform: translateY(-1px); }
.btn-result:active { transform: translateY(0); box-shadow: inset 0 2px 6px rgba(0,0,0,0.4); }

.btn-result.active {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.06), 0 8px 18px rgba(0,0,0,0.45);
}

.trade-row:nth-child(even) { background-color: var(--row-alt); }

.result-selector {
    padding: 0 5px;
}

.result-select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: #0d1016;
    color: var(--text);
    cursor: pointer;
}

.result-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(122, 162, 247, 0.25);
}

.result-buttons {
    display: flex;
    gap: 5px;
}

.win-btn, .loss-btn {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.win-btn {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.loss-btn {
    background-color: #ffebee;
    color: #c62828;
}

.win-btn:hover, .loss-btn:hover {
    opacity: 0.9;
}

.win-btn.active {
    background-color: #4caf50;
    color: white;
    border-color: #2e7d32;
}

.loss-btn.active {
    background-color: #f44336;
    color: white;
    border-color: #c62828;
}

button {
    padding: 10px 20px;
    margin-right: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s;
    background: #0d1016;
    color: var(--text);
}

#calculate {
    background-color: var(--primary-color);
    color: #0b0d12;
    border-color: transparent;
}

#calculate:hover {
    background-color: var(--primary-hover);
}

#addTrade {
    background-color: #0d1016;
    color: var(--text);
    margin-bottom: 15px;
}

#addTrade:hover {
    background-color: #0f131a;
}

#reset {
    background-color: #0d1016;
    border: 1px solid var(--border-color);
    color: var(--muted);
}

#reset:hover {
    background-color: #0f131a;
}

/* Add spacing between the last trade row and the reset button */
.trades-container #reset {
    margin-top: 10px;
}

.profit {
    color: var(--success-color);
    font-weight: 500;
}

.loss {
    color: var(--danger-color);
    font-weight: 500;
}

/* History table enhancements */
.history-table thead th {
    position: sticky;
    top: 0;
    z-index: 5; /* stay above rows while scrolling */
    background: var(--panel);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(255,255,255,0.04);
}
.history-table tbody tr:nth-child(odd) {
    background: rgba(255,255,255,0.02);
}

/* Profit Calculator specific styles */
#profitCalcOverlay .overlay-modal { width: min(760px, 92vw); }
#profitCalcOverlay .overlay-content { padding: 20px; }

/* Inputs row */
#profitCalcOverlay .pc-inputs > div label { font-weight: 600; font-size: 13px; }
#profitCalcOverlay .pc-inputs input[type="number"] {
    padding: 8px 10px;
    border-radius: 10px;
}
#profitCalcOverlay #pcCompute.btn-mode {
    padding: 8px 12px;
    font-weight: 700;
}

/* Summary pill */
#pcSummary {
    margin-top: 8px;
    margin-bottom: 12px !important;
    padding: 10px 12px !important;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    font-size: 13.5px;
}

/* Table wrap */
#pcTableWrap {
    padding: 8px;
    border-radius: 12px !important;
    max-height: 55vh !important;
    background: rgba(255,255,255,0.02);
}

/* Table */
#pcTable {
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: 14px;
}
#pcTable thead th {
    position: sticky;
    top: 0;
    background: var(--panel);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 12px !important;
}
#pcTable tbody td { padding: 10px 12px !important; }
#pcTable tbody tr:nth-child(odd) { background: rgba(255,255,255,0.02); }
#pcTable tbody tr:hover { background: rgba(122,162,247,0.06); }

/* Column alignment: center Days, right Capital with tabular numbers */
#pcTable th:first-child, #pcTable td:first-child { text-align: center !important; width: 110px; }
#pcTable th:last-child, #pcTable td:last-child {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}
.history-table-wrap { position: relative; }
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.4;
}
.badge.win {
    background: rgba(16,185,129,0.15);
    color: #10b981;
    border: 1px solid rgba(16,185,129,0.4);
}
.badge.loss {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.4);
}

/* Ensure equal heights for all four cards inside the panels row */
.panels-row > .session-panel,
.panels-row > .calc-panel,
.panels-row > .goals-panel,
.panels-row > .performance-panel {
    height: auto !important; /* override any height: fit-content on panel classes */
    align-self: stretch;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    /* Panels wrap for small screens */
    .panels-row {
        grid-template-columns: 1fr; /* stack */
        grid-template-areas:
            "session"
            "calc"
            "goals"
            "perf";
        gap: 12px;
    }
    
    .input-section {
        flex-direction: column;
        gap: 15px;
    }
    
    .trades-header, .trade-row {
        grid-template-columns: 40px 1fr 1fr 1fr 90px;
        font-size: 14px;
    }
    
    button {
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
    }
}
