/* frontend/css/style.css — Light Theme */

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

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
    overflow-x: hidden;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.logo h1 {
    font-size: 20px;
    background: linear-gradient(90deg, #d97706, #b45309);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.logo p {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
}

.controls {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.control-group label {
    font-size: 9px;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Shared input / select style */
.asset-select,
.model-select,
.risk-input,
.timeframe-select {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    border-radius: 8px;
    color: #0f172a;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    min-height: 38px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.asset-select:hover,
.model-select:hover,
.risk-input:hover,
.timeframe-select:hover {
    border-color: #f59e0b;
}

.risk-notice {
    font-size: 11px;
    font-weight: 600;
    color: #f59e0b;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 7px 12px;
    min-height: 38px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.risk-input {
    background-image: none;
    padding-right: 12px;
    width: 80px;
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: #f0fdf4;
    border: 1px solid #16a34a;
    padding: 8px 20px;
    border-radius: 8px;
    color: #16a34a;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.25s;
    min-height: 38px;
    white-space: nowrap;
}

.refresh-btn:hover {
    background: #16a34a;
    color: #ffffff;
}

/* Small, non-blocking "refreshing" state — spins just the icon so a manual
   refresh never has to cover/blank the analysis that's already on screen. */
.refresh-btn .refresh-icon {
    display: inline-block;
    line-height: 1;
}

.refresh-btn.is-loading {
    opacity: 0.72;
    cursor: wait;
}

.refresh-btn.is-loading .refresh-icon {
    animation: spin 0.85s linear infinite;
}

/* (AI badge removed) */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

/* ── Loading Overlay ──────────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(241, 245, 249, 0.88);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 44px 52px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    min-width: 260px;
    text-align: center;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid #e2e8f0;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
    will-change: transform;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-title {
    font-size: 15px;
    font-weight: 700;
    color: #92400e;
    letter-spacing: 2.5px;
    text-transform: uppercase;
}

.loading-sub {
    font-size: 12px;
    color: #94a3b8;
    min-height: 18px;
    transition: color 0.3s;
}

.loading-sub.error {
    color: #dc2626;
}

.loading-attempt {
    font-size: 11px;
    color: #cbd5e1;
}

.retry-btn {
    background: #f0fdf4;
    border: 1px solid #16a34a;
    padding: 10px 30px;
    border-radius: 8px;
    color: #16a34a;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.22s;
    margin-top: 4px;
}

.retry-btn:hover {
    background: #16a34a;
    color: #ffffff;
}

/* ── Chart colour legend ──────────────────────────────────────────────────── */
.chart-color-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 7px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 11px;
    font-family: 'Segoe UI', monospace;
    color: #64748b;
}

.chart-color-legend .cl-item {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.chart-color-legend .cl-swatch {
    display: inline-block;
    width: 22px;
    height: 2px;
    border-radius: 1px;
    flex-shrink: 0;
}

.chart-color-legend .cl-fill {
    display: inline-block;
    width: 14px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Chart area ───────────────────────────────────────────────────────────── */
.chart-container {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

#priceChart {
    width: 100%;
    display: block;
}

/* OHLC hover legend inside chart box */
.chart-ohlc-legend {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 6px 12px 2px;
    min-height: 28px;
    font-size: 12px;
    font-family: 'Segoe UI', monospace;
    background: #ffffff;
}

.leg-item {
    color: #64748b;
    font-size: 12px;
}

.leg-item b {
    font-weight: 600;
}

/* Chart toolbar (type + timeframe) */
.chart-type-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 8px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.toggle-label {
    font-size: 10px;
    color: #92400e;
    letter-spacing: 1px;
    white-space: nowrap;
}

.toggle-buttons {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}

.chart-type-btn {
    background: transparent;
    border: none;
    padding: 5px 14px;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.25s;
    min-height: 32px;
}

.chart-type-btn.active {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: #ffffff;
}

.chart-type-btn:hover:not(.active) {
    background: #fef3c7;
    color: #92400e;
}

.chart-timeframe-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ── Signal Card ──────────────────────────────────────────────────────────── */
.signal-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 22px;
    margin-bottom: 16px;
    text-align: center;
    border: 2px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.signal-status {
    font-size: 10px;
    color: #92400e;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.signal-action {
    font-size: 44px;
    font-weight: bold;
    margin: 12px 0;
    line-height: 1;
}

.signal-action.VALID   { color: #16a34a; }
.signal-action.INVALID { color: #dc2626; }
.signal-action.WAITING { color: #d97706; }

.signal-score {
    font-size: 14px;
    margin: 8px 0;
    color: #475569;
}

.score-high   { color: #16a34a; }
.score-medium { color: #d97706; }
.score-low    { color: #dc2626; }

.signal-warning {
    color: #d97706;
    font-size: 11px;
    margin-top: 8px;
}

/* ── Entry Card ───────────────────────────────────────────────────────────── */
.entry-card {
    background: #f0fdf4;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
    border: 2px solid #bbf7d0;
}

.entry-card.hidden { display: none; }

.entry-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dcfce7;
    flex-wrap: wrap;
}

.entry-icon  { font-size: 18px; }
.entry-title { font-size: 13px; color: #166534; flex: 1; font-weight: bold; }

.scenario-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 10px;
}

.entry-levels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.entry-level {
    text-align: center;
    background: #ffffff;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1px solid #dcfce7;
}

.entry-level-label {
    font-size: 9px;
    color: #64748b;
    margin-bottom: 4px;
}

.entry-level-value {
    font-size: 15px;
    font-weight: bold;
    color: #16a34a;
}

.entry-position {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    padding: 10px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #dcfce7;
}

.position-item  { text-align: center; }
.position-label { font-size: 9px; color: #64748b; display: block; }
.position-value { font-size: 13px; font-weight: bold; color: #92400e; }

.entry-poi {
    background: #fffbeb;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 11px;
    text-align: center;
    color: #92400e;
    border: 1px solid #fde68a;
}

.entry-reasoning {
    background: #ffffff;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 11px;
    line-height: 1.5;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.manual-warning {
    text-align: center;
    font-size: 10px;
    color: #d97706;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #dcfce7;
}

/* ── Multi-Entry List ─────────────────────────────────────────────────────── */
.all-entries-list {
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
}
.all-entries-list.hidden { display: none; }
.all-entries-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #dcfce7;
    border-bottom: 1px solid #bbf7d0;
    font-size: 11px;
}
.ae-icon  { font-size: 13px; }
.ae-title { font-weight: 700; color: #166534; letter-spacing: 0.05em; flex: 1; }
.ae-count { color: #64748b; font-size: 10px; }

.entry-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.15s;
}
.entry-row:last-child { border-bottom: none; }
.entry-row--active    { background: #f0fdf4; }

.entry-row-label {
    display: flex;
    align-items: center;
    gap: 6px;
}
.entry-ordinal {
    font-size: 11px;
    font-weight: 700;
    color: #1e293b;
    min-width: 60px;
}
.entry-type-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid currentColor;
}
.entry-active-badge   { font-size: 10px; font-weight: 700; color: #d97706; margin-left: auto; }
.entry-confirmed-badge { font-size: 10px; font-weight: 700; color: #16a34a; margin-left: auto; }
.entry-missed-badge   { font-size: 10px; font-weight: 700; color: #dc2626; margin-left: auto; }
.entry-class-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}
.entry-class-primary {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}
.entry-class-fair {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}
.er-age { text-align: right; }

.entry-row-levels {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.er-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 48px;
}
.er-key {
    font-size: 9px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.er-val   { font-size: 11px; color: #1e293b; font-weight: 600; }
.er-sl    { color: #dc2626; }
.er-tp    { color: #16a34a; }
.er-dist  { margin-left: auto; text-align: right; }

/* ── Entry Card enhancements ──────────────────────────────────────────────── */
.entry-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.entry-group-name {
    font-size: 11px;
    font-weight: 700;
    color: #1e293b;
}
.source-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-left: auto;
}
.source-badge--mech {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}
.source-badge--ai {
    background: #ede9fe;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

/* ── Grouped Entry Opportunities ──────────────────────────────────────────── */
.entry-groups-container {
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

.eg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 11px;
}
.eg-header-icon  { font-size: 14px; }
.eg-header-title { font-weight: 700; color: #92400e; letter-spacing: 0.08em; flex: 1; }
.eg-header-meta  { color: #94a3b8; font-size: 10px; }

.entry-group {
    border-left: 3px solid var(--eg-color, #16a34a);
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.entry-group:last-child { border-bottom: none; }
.entry-group--active    { background: #fafafa; }

.entry-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px 4px;
    flex-wrap: wrap;
}
.eg-color-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.eg-label {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    flex: 1;
}
.eg-class-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.eg-class-choch {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}
.eg-class-bos {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}
.eg-at-zone-badge {
    font-size: 10px;
    font-weight: 700;
    color: #d97706;
    animation: pulse 1.5s infinite;
}
.eg-rr { font-size: 11px; color: #64748b; }
.eg-sl { font-size: 11px; color: #64748b; }

.eg-tp-row {
    display: flex;
    gap: 16px;
    padding: 2px 14px 7px 30px;
    font-size: 10px;
    color: #94a3b8;
}
.eg-tp-item strong { font-size: 11px; }

.eg-validity-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 14px 5px 30px;
    font-size: 10px;
}
.eg-validity-ref  { color: #64748b; font-weight: 600; }
.eg-validity-tag  { color: #94a3b8; }
.eg-validity-buf  { font-weight: 700; font-size: 10px; }

.entry-group--expired {
    opacity: 0.45;
    border-left-color: #cbd5e1;
    pointer-events: none;
}
.eg-label--faded   { color: #94a3b8; font-weight: 600; }
.eg-expired-badge  {
    font-size: 9px;
    font-weight: 700;
    color: #dc2626;
    letter-spacing: 0.05em;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    padding: 1px 6px;
    border-radius: 4px;
}
.eg-expired-reason { font-size: 10px; color: #94a3b8; font-style: italic; }

.eg-pois { padding: 0 14px 8px 30px; display: flex; flex-direction: column; gap: 4px; }

.eg-poi-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px;
    border-radius: 6px;
    background: #f8fafc;
    font-size: 11px;
    transition: background 0.15s;
}
.eg-poi-row:hover { background: #f1f5f9; }
.eg-poi--active   { background: #fffbeb !important; }

.eg-poi-type {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid;
    min-width: 34px;
    text-align: center;
    flex-shrink: 0;
}
.eg-poi-entry  { font-weight: 700; color: #1e293b; min-width: 72px; }
.eg-poi-rr     { color: #64748b; min-width: 36px; font-size: 10px; }
.eg-poi-range  { font-size: 10px; flex: 1; }
.eg-poi-dist   { font-size: 10px; text-align: right; min-width: 70px; }

/* ── Zone Proximity Bar ───────────────────────────────────────────────────── */
.zone-proximity-bar {
    margin: 8px 0 4px;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.zpb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.zpb-icon  { font-size: 13px; flex-shrink: 0; }
.zpb-label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; min-width: 72px; color: #475569; }
.zpb-track {
    flex: 1;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}
.zpb-fill  { height: 100%; border-radius: 3px; transition: width 0.4s; }
.zpb-dist  { font-size: 10px; color: #94a3b8; text-align: right; min-width: 140px; }

/* ── Setup Timing Row ─────────────────────────────────────────────────────── */
.eg-timing-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    font-size: 10px;
    flex-wrap: wrap;
}
.eg-timing-found          { color: #64748b; }
.eg-timing-sep            { color: #cbd5e1; }
.eg-timing-status         { color: #16a34a; font-weight: 700; font-size: 10px; }
.eg-timing-cond           { color: #94a3b8; }
.eg-timing-buffer         { font-weight: 700; font-size: 10px; }
.eg-timing-reason         { color: #64748b; font-style: italic; }
.eg-timing--expired       { background: #fff1f2; }
.eg-timing-expired-icon   { color: #dc2626; font-weight: 700; }
.zpb-remain--expiring { color: #d97706 !important; font-weight: 700; }
.zpb-remain--expired  { color: #dc2626 !important; font-weight: 700; }

/* ── Previous Setups History ──────────────────────────────────────────────── */
.eg-history {
    border-top: 1px solid #f1f5f9;
    padding: 8px 0 4px;
}
.eg-history-header {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #94a3b8;
    padding: 0 14px 6px;
    text-transform: uppercase;
}
.eg-hist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    font-size: 10px;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.eg-hist-row:hover { opacity: 0.85; }
.eg-hist-dot    { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.eg-hist-bias   { font-weight: 700; min-width: 52px; color: #1e293b; }
.eg-hist-detail { color: #94a3b8; flex: 1; }
.eg-hist-reason { color: #cbd5e1; font-size: 9px; }
.eg-hist-count  { color: #cbd5e1; font-size: 9px; margin-left: auto; }

/* ── Action Suggestion ────────────────────────────────────────────────────── */
.action-suggestion-card {
    background: #fffbeb;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid #fde68a;
    text-align: center;
}

.action-suggestion { font-size: 13px; font-weight: bold; color: #92400e; }

/* ── Market Analysis Card ─────────────────────────────────────────────────── */
.market-analysis-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.ma-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.ma-icon  { font-size: 22px; }
.ma-title { font-size: 13px; color: #92400e; flex: 1; font-weight: 800; letter-spacing: 0.06em; }

.ma-status {
    font-size: 11px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.ma-score-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ma-score-box {
    flex: 1;
    min-width: 100px;
    text-align: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.ma-score-label {
    display: block;
    font-size: 9px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.ma-score-value { font-size: 26px; font-weight: 800; color: #1e293b; }
.ma-confidence  { font-size: 14px; font-weight: 700; color: #64748b; }

.ma-missing {
    display: none;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #92400e;
}

.ma-missing-icon { margin-right: 4px; }

.ma-summary { margin-bottom: 14px; }

.ma-summary-header {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.ma-summary-body {
    font-size: 14px;
    color: #334155;
    line-height: 1.7;
    padding: 2px 0 2px 16px;
    border-left: 2px solid #3d7bff;
}

.ma-summary-body p { margin: 0; }
.ma-summary-body p + p { margin-top: 12px; }

.ma-reasoning {
    background: #f8fafc;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 12px;
    color: #475569;
    margin-bottom: 14px;
    line-height: 1.55;
    border: 1px solid #e2e8f0;
}

.ma-flags {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ma-red-flags, .ma-green-flags {
    flex: 1;
    min-width: 140px;
    padding: 12px;
    border-radius: 10px;
    font-size: 12px;
    color: #1e293b;
}

.ma-red-flags   { background: #fff1f2; border: 1px solid #fecdd3; }
.ma-green-flags { background: #f0fdf4; border: 1px solid #bbf7d0; }

.ma-flags-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.ma-flags-title--red   { color: #dc2626; }
.ma-flags-title--green { color: #16a34a; }

.ma-flag-item { margin: 5px 0; line-height: 1.4; }
.ma-flag-item--red   { color: #9f1239; }
.ma-flag-item--green { color: #166534; }

.ma-hidden { display: none; }

/* ── Steps Grid ───────────────────────────────────────────────────────────── */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.step-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    transition: all 0.25s;
    border: 1px solid #e2e8f0;
}

.step-card.passed  { background: #f0fdf4; border: 1px solid #bbf7d0; }
.step-card.warning { background: #fffbeb; border: 1px solid #fde68a; }
.step-card.failed  { background: #fff1f2; border: 1px solid #fecdd3; }

.step-number { font-size: 9px; color: #94a3b8; letter-spacing: 1px; }
.step-status { font-size: 22px; margin: 4px 0; }
.step-status.passed  { color: #16a34a; }
.step-status.failed  { color: #dc2626; }
.step-status.waiting { color: #d97706; }
.step-name   { font-size: 10px; font-weight: bold; margin-bottom: 3px; color: #1e293b; }
.step-detail { font-size: 9px; color: #64748b; }

/* ── Stats Grid ───────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.stat-label { font-size: 9px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 13px; font-weight: bold; margin-top: 4px; color: #1e293b; }
.stat-value.positive { color: #16a34a; }
.stat-value.negative { color: #dc2626; }
.stat-value.neutral  { color: #d97706; }

/* ── Timeframes Info ──────────────────────────────────────────────────────── */
.timeframes-info {
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    gap: 24px;
    font-size: 11px;
    color: #64748b;
    flex-wrap: wrap;
    border: 1px solid #e2e8f0;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer { text-align: center; margin-top: 16px; }
.last-updated { font-size: 9px; color: #94a3b8; margin-bottom: 4px; }
.footer-text  { font-size: 9px; color: #cbd5e1; }

/* ── Dead CSS kept to avoid JS errors ────────────────────────────────────── */
.mode-buttons { display: none; }
.ai-toggle-buttons { display: none; }

/* ── Upgrade / Lock Toast ─────────────────────────────────────────────────── */
.upgrade-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 22px;
    font-size: 13px;
    color: #1e293b;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 9999;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

.upgrade-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-tier {
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.toast-tier.premium {
    background: #fff1f2;
    color: #dc2626;
    border: 1px solid #fecdd3;
}

.toast-tier.key {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    .entry-levels { grid-template-columns: repeat(2, 1fr); }
    .steps-grid   { grid-template-columns: repeat(3, 1fr); }
    .stats-grid   { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
    .app-container { padding: 10px 8px; }

    .header {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
        gap: 12px;
    }

    .logo { text-align: center; }
    .logo h1 { font-size: 17px; }

    .controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .control-group {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .control-group label {
        white-space: nowrap;
        min-width: 100px;
    }

    .asset-select,
    .model-select,
    .risk-input,
    .timeframe-select {
        flex: 1;
        min-height: 42px;
        font-size: 14px;
    }

    .refresh-btn {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }

    .chart-type-toggle {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 10px;
    }

    .chart-timeframe-group { margin-left: 0; }
    .chart-type-btn { min-height: 38px; padding: 5px 12px; }
    .chart-ohlc-legend { gap: 10px; font-size: 11px; }
    .signal-action { font-size: 34px; }
    .signal-card   { padding: 16px; }

    .entry-levels {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .entry-level-value { font-size: 13px; }

    .steps-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .ma-flags   { flex-direction: column; }
    .timeframes-info { gap: 12px; font-size: 10px; }
}

@media (max-width: 360px) {
    .logo h1 { font-size: 14px; }
    .signal-action { font-size: 28px; }
    .steps-grid  { grid-template-columns: 1fr 1fr; }
    .stats-grid  { grid-template-columns: 1fr 1fr; }
    .entry-levels { grid-template-columns: 1fr 1fr; }
}


/* ── Plan badge & upgrade button ─────────────────────────────────────────── */
.plan-badge-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.plan-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.plan-badge--free {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.upgrade-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(245,158,11,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(245,158,11,0.45);
}

/* ── Premium inline section ───────────────────────────────────────────────── */
.premium-section {
    background: #ffffff;
    border-radius: 20px;
    padding: 36px 32px 32px;
    margin-top: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

.premium-section-header {
    text-align: center;
    margin-bottom: 28px;
}

.premium-crown {
    font-size: 40px;
    margin-bottom: 8px;
}

.premium-section-title {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #d97706, #b45309);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.premium-section-sub {
    font-size: 14px;
    color: #64748b;
}

/* ── Tier columns ─────────────────────────────────────────────────────────── */
.premium-tiers {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 20px;
    align-items: start;
}

.premium-tier {
    border-radius: 16px;
    padding: 24px;
    position: relative;
}

.premium-tier--free {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.premium-tier--premium {
    background: linear-gradient(145deg, #fffbeb, #fef3c7);
    border: 2px solid #f59e0b;
}

.tier-badge-top {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    padding: 4px 14px;
    border-radius: 20px;
    white-space: nowrap;
}

.tier-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #94a3b8;
    margin-bottom: 6px;
}

.premium-tier--premium .tier-label { color: #b45309; }

.tier-price {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 20px;
    line-height: 1;
}

.tier-price span {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    margin-left: 2px;
}

.tier-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.feat {
    font-size: 13px;
    line-height: 1.45;
    color: #374151;
}

.feat--no { color: #94a3b8; }

/* ── CTA button ───────────────────────────────────────────────────────────── */
.premium-cta {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(245,158,11,0.40);
    transition: transform 0.15s, box-shadow 0.15s;
    margin-bottom: 10px;
}

.premium-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(245,158,11,0.50);
}

.premium-cta-note {
    font-size: 11px;
    color: #92400e;
    text-align: center;
}

/* ── Responsive premium section ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .premium-tiers { grid-template-columns: 1fr; }
    .premium-section { padding: 24px 18px 24px; }
    .premium-section-title { font-size: 20px; }
    .plan-badge-wrap { gap: 6px; }
    .upgrade-btn { font-size: 11px; padding: 7px 12px; }
}
