/* ==========================================================================
   NAS100 Swing Trading - Premium Dark Theme Dashboard
   ========================================================================== */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111622;
    --bg-tertiary: #161c2a;
    --bg-hover: #1b2235;
    --bg-elevated: #1e2538;
    --border: #1e2740;
    --border-light: #2a3350;
    --border-gold: rgba(0, 212, 255, 0.25);
    --text-primary: #e8edf5;
    --text-secondary: #8893a7;
    --text-muted: #5a6580;
    --gold: #00d4ff;
    --gold-dim: #00b8e0;
    --gold-glow: rgba(0, 212, 255, 0.15);
    --gold-glow-strong: rgba(0, 212, 255, 0.25);
    --gold-bg: rgba(0, 212, 255, 0.06);
    --green: #34d399;
    --green-bg: rgba(52, 211, 153, 0.12);
    --green-glow: rgba(52, 211, 153, 0.2);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.12);
    --red-glow: rgba(248, 113, 113, 0.2);
    --yellow: #fbbf24;
    --yellow-bg: rgba(251, 191, 36, 0.12);
    --yellow-glow: rgba(251, 191, 36, 0.2);
    --blue: #60a5fa;
    --blue-bg: rgba(96, 165, 250, 0.12);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 24px 56px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3);
    --shadow-gold: 0 4px 20px rgba(0, 212, 255, 0.12);
    --shadow-green: 0 4px 20px rgba(52, 211, 153, 0.15);
    --shadow-red: 0 4px 20px rgba(248, 113, 113, 0.15);
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.25s var(--ease);
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background:
        radial-gradient(ellipse 60% 50% at 50% 45%, rgba(0, 212, 255, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 80% 60% at 50% 50%, rgba(16, 24, 48, 0.8) 0%, transparent 100%),
        var(--bg-primary);
    animation: loginFadeIn 0.8s ease-out;
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card {
    background: linear-gradient(145deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl), var(--shadow-gold);
    position: relative;
}

.login-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: linear-gradient(145deg, rgba(0, 212, 255, 0.2), transparent 60%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.login-header { text-align: center; margin-bottom: 36px; }

.login-header h1 {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold) 0%, #67e8f9 50%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.login-header p { color: var(--text-secondary); font-size: 14px; font-weight: 400; }
.login-form .form-group { margin-bottom: 24px; }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; font-weight: 500; }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.2); }

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

input, select {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2300d4ff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    cursor: pointer;
}

select:hover { border-color: var(--border-light); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input::placeholder { color: var(--text-muted); }

input:focus, select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow), var(--shadow-sm);
    background: var(--bg-tertiary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    border-color: var(--gold);
    color: #0a0e17;
    font-weight: 700;
}

.btn-primary:hover { background: var(--bg-primary); color: var(--gold); border-color: var(--gold); box-shadow: var(--shadow-gold); }

.btn-danger { color: var(--red); border-color: rgba(248, 113, 113, 0.25); }
.btn-danger:hover { background: var(--red-bg); border-color: rgba(248, 113, 113, 0.4); }
.btn-full { width: 100%; padding: 13px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

.dashboard { max-width: 1320px; margin: 0 auto; padding: 72px 20px 16px; }

/* ── Header Fisso ─────────────────────────────────────────── */
.header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 24px;
    background: rgba(17, 22, 34, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 212, 255, 0.1);
}

.header-fixed__left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.header-fixed__logo {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold) 0%, #67e8f9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.header-fixed__price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.header-fixed__value {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.3px;
}

.header-fixed__change {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ── Nav tabs nell'header ─────────────────────────────────── */
.header-fixed__nav {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.tab-btn {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.tab-btn.active {
    color: var(--gold);
    background: var(--bg-tertiary);
    border-color: var(--border-gold);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.08);
}

/* ── Header right controls ────────────────────────────────── */
.header-fixed__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }
.header-fixed__update { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.header-fixed__toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.header-fixed__toggle input { width: 16px; height: 16px; accent-color: var(--gold); }

.tab-content { animation: tabFadeIn 0.3s var(--ease); }
@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading-overlay { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; color: var(--text-secondary); font-size: 14px; gap: 16px; }
.loading-overlay.hidden { display: none; }
.loading-overlay p { animation: pulse 2s ease-in-out infinite; }

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    box-shadow: 0 0 16px var(--gold-glow);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }


.confluence-section { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

.confluence-badge {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 28px; border-radius: var(--radius-lg);
    border: 1px solid var(--border); background: var(--bg-secondary);
    box-shadow: var(--shadow-md); transition: all var(--transition);
}

.confluence-badge.buy { background: linear-gradient(135deg, var(--green-bg) 0%, rgba(52, 211, 153, 0.04) 100%); border-color: rgba(52, 211, 153, 0.35); box-shadow: var(--shadow-md), var(--shadow-green); }
.confluence-badge.sell { background: linear-gradient(135deg, var(--red-bg) 0%, rgba(248, 113, 113, 0.04) 100%); border-color: rgba(248, 113, 113, 0.35); box-shadow: var(--shadow-md), var(--shadow-red); }
.confluence-badge.neutral { background: linear-gradient(135deg, var(--yellow-bg) 0%, rgba(251, 191, 36, 0.04) 100%); border-color: rgba(251, 191, 36, 0.3); }

.confluence-label { font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.confluence-badge.buy .confluence-label { color: var(--green); }
.confluence-badge.sell .confluence-label { color: var(--red); }
.confluence-badge.neutral .confluence-label { color: var(--yellow); }
.confluence-score { font-size: 13px; font-family: var(--font-mono); color: var(--text-secondary); padding: 3px 10px; background: rgba(0, 0, 0, 0.2); border-radius: 6px; }
.confluence-agreement { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.section { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition); }

.section__title {
    font-size: 12px; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 18px;
    padding-bottom: 10px; padding-left: 12px;
    border-bottom: 1px solid var(--border); border-left: 3px solid var(--gold);
    display: flex; align-items: center; gap: 8px;
}

.table-responsive { overflow-x: auto; border-radius: var(--radius); }
.tf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tf-table th { text-align: center; padding: 10px 14px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.6px; border-bottom: 2px solid var(--border); background: var(--bg-tertiary); }
.tf-table th:first-child { text-align: left; border-radius: var(--radius) 0 0 0; }
.tf-table th:last-child { border-radius: 0 var(--radius) 0 0; }
.tf-table td { padding: 9px 14px; text-align: center; font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; border-bottom: 1px solid rgba(30, 39, 64, 0.5); transition: background var(--transition); }
.tf-table td:first-child { text-align: left; font-family: var(--font-sans); font-weight: 600; color: var(--text-secondary); font-size: 12px; }
.tf-table tr:nth-child(even) td { background: rgba(22, 28, 42, 0.4); }
.tf-table tr:hover td { background: var(--bg-hover); }
.tf-table tr:last-child td { border-bottom: none; }
.tf-table .signal-row td { font-weight: 800; font-size: 13px; padding: 12px 14px; font-family: var(--font-sans); border-top: 2px solid var(--border); background: var(--bg-tertiary); letter-spacing: 0.3px; }

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-gold { color: var(--gold); }
.text-blue { color: var(--blue); }
.text-center { text-align: center; }

.signals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.signal-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: all var(--transition); border-top: 3px solid var(--border); }
.signal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-light); }
.signal-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.signal-card__tf { font-size: 15px; font-weight: 800; letter-spacing: 0.3px; }
.signal-card__badge { padding: 4px 12px; border-radius: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.signal-card__badge.buy { background: linear-gradient(135deg, var(--green-bg), rgba(52, 211, 153, 0.2)); color: var(--green); box-shadow: 0 2px 8px rgba(52, 211, 153, 0.1); }
.signal-card__badge.sell { background: linear-gradient(135deg, var(--red-bg), rgba(248, 113, 113, 0.2)); color: var(--red); box-shadow: 0 2px 8px rgba(248, 113, 113, 0.1); }
.signal-card__badge.neutral { background: linear-gradient(135deg, var(--yellow-bg), rgba(251, 191, 36, 0.2)); color: var(--yellow); }
.signal-factor { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 12px; border-bottom: 1px solid rgba(30, 39, 64, 0.4); }
.signal-factor:last-child { border-bottom: none; }
.signal-factor__name { color: var(--text-secondary); }
.signal-factor__value { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }

.levels-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.levels-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: all var(--transition); }
.levels-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.levels-card__title { font-size: 11px; font-weight: 700; color: var(--gold); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.level-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; border-bottom: 1px solid rgba(30, 39, 64, 0.3); transition: background var(--transition); }
.level-row:hover { background: rgba(255, 255, 255, 0.02); }
.level-row:last-child { border-bottom: none; }
.level-row__label { color: var(--text-secondary); font-weight: 500; }
.level-row__value { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.level-row--highlight { background: var(--gold-glow); border-radius: 4px; padding: 5px 4px; }
.level-row--header { border-bottom: 1px solid var(--border-light); margin-bottom: 4px; padding-bottom: 8px; }
.level-row--header .level-row__value { color: var(--text-primary); font-size: 12px; }
.levels-card__subtitle { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; margin: 8px 0 4px; }
.levels-card--fibonacci { border-color: var(--border-gold); }
.sentiment-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.sentiment-badge--bullish { background: var(--green-bg); color: var(--green); }
.sentiment-badge--bearish { background: var(--red-bg); color: var(--red); }
.sentiment-badge--neutral { background: rgba(96, 165, 250, 0.12); color: var(--blue); }

/* Price flash animations */
@keyframes flashUp { 0% { color: var(--green); text-shadow: 0 0 8px rgba(52, 211, 153, 0.6); } 100% { color: inherit; text-shadow: none; } }
@keyframes flashDown { 0% { color: var(--red); text-shadow: 0 0 8px rgba(248, 113, 113, 0.6); } 100% { color: inherit; text-shadow: none; } }
.price-flash-up { animation: flashUp 1s ease-out; }
.price-flash-down { animation: flashDown 1s ease-out; }

/* Market status badge */
.market-status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; margin-left: 8px; vertical-align: middle; }
.market-status--open { background: var(--green-bg); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.3); }
.market-status--pre, .market-status--after { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(251, 191, 36, 0.3); }
.market-status--closed { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.3); }
.market-status--closing { background: rgba(251, 146, 36, 0.12); color: #fb9224; border: 1px solid rgba(251, 146, 36, 0.3); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.market-detail { font-size: 10px; color: var(--text-muted); margin-left: 6px; vertical-align: middle; }

.chart-controls { display: flex; gap: 6px; margin-bottom: 14px; }
.chart-tf-btn.active { background: linear-gradient(135deg, var(--gold-glow) 0%, var(--gold-bg) 100%); border-color: var(--gold); color: var(--gold); font-weight: 700; }
.chart-container { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }

.mm-container { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.mm-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: start; }
.mm-results { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mm-result-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; transition: all var(--transition); }
.mm-result-card:hover { border-color: var(--border-light); background: var(--bg-hover); }
.mm-result-card--highlight { grid-column: 1 / -1; border-color: var(--gold); background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(0, 212, 255, 0.03) 100%); box-shadow: var(--shadow-gold); position: relative; overflow: hidden; }
.mm-result-card--highlight::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.mm-result-label { display: block; font-size: 10px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.mm-result-value { display: block; font-size: 18px; font-weight: 800; font-family: var(--font-mono); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.mm-result-card--highlight .mm-result-value { font-size: 24px; background: linear-gradient(135deg, var(--gold) 0%, #67e8f9 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.settings-group { display: flex; flex-direction: column; gap: 16px; }
.settings-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.settings-row--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.settings-status { font-size: 13px; font-family: var(--font-mono); color: var(--text-muted); padding: 8px 12px; background: var(--bg-tertiary); border-radius: 6px; border: 1px solid var(--border); }
.settings-status.ok { color: var(--green); border-color: rgba(52, 211, 153, 0.25); background: var(--green-bg); }
.settings-status.error { color: var(--red); border-color: rgba(248, 113, 113, 0.25); background: var(--red-bg); }
.settings-hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-top: 4px; padding: 8px 12px; background: var(--bg-tertiary); border-radius: 8px; border-left: 3px solid var(--gold); }
.settings-hint a { color: var(--blue); text-decoration: none; font-weight: 600; }
.settings-hint a:hover { text-decoration: underline; }
.settings-actions { display: flex; align-items: center; gap: 16px; padding: 18px 0; }
.settings-feedback { font-size: 13px; font-weight: 600; transition: opacity 0.3s; }
.settings-feedback.ok { color: var(--green); }
.settings-feedback.error { color: var(--red); }
.checkbox-group { display: flex; gap: 8px; flex-wrap: wrap; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-primary); cursor: pointer; font-weight: 600; padding: 8px 14px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 8px; transition: all var(--transition); }
.checkbox-label:hover { border-color: var(--border-light); background: var(--bg-hover); }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); }

.ai-section { border-color: var(--border-gold); background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(0, 212, 255, 0.03) 100%); }
.ai-container { min-height: 80px; }
.ai-empty { text-align: center; padding: 24px; color: var(--text-secondary); }
.ai-empty p { margin-bottom: 16px; font-size: 14px; }
.ai-loading { display: flex; flex-direction: column; align-items: center; padding: 40px; gap: 14px; color: var(--text-secondary); }
.ai-loading p { animation: pulse 2s ease-in-out infinite; }
.ai-error { text-align: center; padding: 20px; color: var(--red); font-size: 14px; }
.ai-error p { margin-bottom: 12px; }
.hidden { display: none !important; }

.ai-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.ai-badge { font-size: 22px; font-weight: 900; padding: 8px 28px; border-radius: var(--radius); text-transform: uppercase; letter-spacing: 1px; }
.ai-badge--buy { background: linear-gradient(135deg, var(--green-bg) 0%, rgba(52, 211, 153, 0.25) 100%); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.35); box-shadow: var(--shadow-green); }
.ai-badge--sell { background: linear-gradient(135deg, var(--red-bg) 0%, rgba(248, 113, 113, 0.25) 100%); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.35); box-shadow: var(--shadow-red); }
.ai-badge--hold { background: linear-gradient(135deg, var(--yellow-bg) 0%, rgba(251, 191, 36, 0.25) 100%); color: var(--yellow); border: 1px solid rgba(251, 191, 36, 0.3); }
.ai-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.ai-meta-item { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding: 4px 12px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 6px; }
.ai-analysis-text { font-size: 14px; line-height: 1.7; color: var(--text-primary); margin-bottom: 10px; padding: 14px; background: var(--bg-tertiary); border-radius: var(--radius); border-left: 3px solid var(--gold); }
.ai-factor { font-size: 13px; color: var(--text-secondary); font-style: italic; margin-bottom: 16px; padding-left: 16px; }
.ai-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.ai-level-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; transition: all var(--transition); }
.ai-level-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.ai-level-card--sl { border-top: 3px solid var(--red); }
.ai-level-card--tp { border-top: 3px solid var(--green); }
.ai-level-card--tp2 { border-top: 3px solid #22c55e; opacity: 0.85; }

.ai-extra { margin-top: 12px; padding: 10px 12px; background: var(--bg-tertiary); border-radius: 8px; border-left: 3px solid var(--gold); }
.ai-rr { font-weight: 600; font-size: 0.95rem; color: var(--gold); display: block; margin-bottom: 4px; }
.ai-scenario { font-size: 0.85rem; color: var(--text-muted); margin: 0; line-height: 1.4; }

.ai-swing-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.ai-swing-item { text-align: center; padding: 8px; background: rgba(0, 0, 0, 0.15); border-radius: 8px; }
.ai-swing-item__label { display: block; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; font-weight: 600; }
.ai-swing-item__value { font-size: 13px; font-weight: 700; color: var(--text-primary); }

.ai-level-label { display: block; font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.ai-level-value { display: block; font-size: 18px; font-weight: 800; font-family: var(--font-mono); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.ai-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }
.ai-cache-info { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.news-loading { color: var(--text-muted); font-size: 13px; text-align: center; padding: 20px; }
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.news-card { display: block; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; transition: all var(--transition); border-left: 3px solid var(--gold); }
.news-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-light); }
.news-card__title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-card__desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-card__meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.news-card__source { font-weight: 600; color: var(--gold); }
.news-error { color: var(--red); font-size: 13px; text-align: center; padding: 12px; }

.ai-reasoning-toggle { margin-bottom: 14px; }
.ai-reasoning-btn { color: var(--text-secondary); border-color: var(--border); font-size: 12px; }
.ai-reasoning-btn:hover { color: var(--gold); border-color: var(--border-gold); }
.ai-reasoning-content { margin-top: 10px; padding: 16px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; font-family: var(--font-mono); color: var(--text-secondary); line-height: 1.7; white-space: pre-wrap; max-height: 400px; overflow-y: auto; }

.trade-generate__inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.trade-loading { display: flex; flex-direction: column; align-items: center; padding: 40px; gap: 14px; color: var(--text-secondary); }
.trade-loading p { animation: pulse 2s ease-in-out infinite; }
.trade-error { text-align: center; padding: 20px; color: var(--red); font-size: 14px; }
.trade-error p { margin-bottom: 12px; }

.trade-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-top: 16px; transition: all var(--transition); }
.trade-card--suggestion { border-color: var(--border-gold); background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(0, 212, 255, 0.04) 100%); }
.trade-card__header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.trade-badge { font-size: 18px; font-weight: 900; padding: 6px 22px; border-radius: var(--radius); text-transform: uppercase; letter-spacing: 1px; }
.trade-badge--buy { background: linear-gradient(135deg, var(--green-bg) 0%, rgba(52, 211, 153, 0.25) 100%); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.35); box-shadow: var(--shadow-green); }
.trade-badge--sell { background: linear-gradient(135deg, var(--red-bg) 0%, rgba(248, 113, 113, 0.25) 100%); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.35); box-shadow: var(--shadow-red); }
.trade-card__meta { display: flex; gap: 8px; flex-wrap: wrap; }
.trade-meta-item { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding: 4px 10px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px; }
.trade-card__levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.trade-level { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.trade-level--sl { border-top: 3px solid var(--red); }
.trade-level--tp { border-top: 3px solid var(--green); }
.trade-level__label { display: block; font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.trade-level__value { display: block; font-size: 16px; font-weight: 800; font-family: var(--font-mono); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.trade-card__details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.trade-detail { text-align: center; padding: 8px; background: rgba(0, 0, 0, 0.15); border-radius: 8px; }
.trade-detail__label { display: block; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; font-weight: 600; }
.trade-detail__value { font-size: 14px; font-weight: 700; font-family: var(--font-mono); color: var(--text-primary); }
.trade-card__analysis { font-size: 13px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 14px; padding: 12px; background: var(--bg-primary); border-radius: var(--radius); border-left: 3px solid var(--gold); }
.trade-card__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.trade-card__pnl { font-size: 16px; font-weight: 800; font-family: var(--font-mono); padding: 8px 16px; border-radius: 8px; text-align: center; margin-bottom: 10px; }
.trade-card__pnl--positive { color: var(--green); background: var(--green-bg); }
.trade-card__pnl--negative { color: var(--red); background: var(--red-bg); }
.trade-empty-msg { color: var(--text-muted); font-size: 13px; text-align: center; padding: 20px; }

.trade-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.trade-stat-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; transition: all var(--transition); }
.trade-stat-card:hover { border-color: var(--border-light); background: var(--bg-hover); }
.trade-stat-card--green { border-top: 3px solid var(--green); }
.trade-stat-card--red { border-top: 3px solid var(--red); }
.trade-stat__label { display: block; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; font-weight: 600; }
.trade-stat__value { display: block; font-size: 18px; font-weight: 800; font-family: var(--font-mono); color: var(--text-primary); font-variant-numeric: tabular-nums; }

.trade-status-badge { display: inline-block; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.trade-status-badge--win { background: var(--green-bg); color: var(--green); }
.trade-status-badge--loss { background: var(--red-bg); color: var(--red); }
.trade-status-badge--cancelled { background: var(--yellow-bg); color: var(--yellow); }
.trade-status-badge--open { background: var(--blue-bg); color: var(--blue); }

.btn-icon { padding: 4px 8px; font-size: 14px; line-height: 1; border-radius: 6px; background: transparent; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; transition: all var(--transition); }
.btn-icon:hover { color: var(--red); border-color: rgba(248, 113, 113, 0.3); background: var(--red-bg); }

.trade-close-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; backdrop-filter: blur(4px); }
.trade-close-modal__content { background: var(--bg-secondary); border: 1px solid var(--border-gold); border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 400px; box-shadow: var(--shadow-xl); }
.trade-close-modal__content h3 { font-size: 16px; margin-bottom: 16px; color: var(--text-primary); }
.trade-close-modal__actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.btn-green { background: linear-gradient(135deg, var(--green-bg), rgba(52, 211, 153, 0.2)); border-color: rgba(52, 211, 153, 0.35); color: var(--green); font-weight: 700; }
.btn-green:hover { background: var(--green); color: var(--bg-primary); border-color: var(--green); box-shadow: var(--shadow-green); }
.btn-red { background: linear-gradient(135deg, var(--red-bg), rgba(248, 113, 113, 0.2)); border-color: rgba(248, 113, 113, 0.35); color: var(--red); font-weight: 700; }
.btn-red:hover { background: var(--red); color: var(--bg-primary); border-color: var(--red); box-shadow: var(--shadow-red); }

.disclaimer { margin-top: 28px; padding: 18px 20px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; color: var(--text-muted); line-height: 1.8; border-left: 3px solid var(--yellow); }
.disclaimer p { margin-bottom: 8px; }
.disclaimer p:last-child { margin-bottom: 0; }
.disclaimer strong { color: var(--yellow); font-weight: 700; }

/* Trade section labels */
.trade-section-label { font-size: 11px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 12px; margin-top: 16px; display: flex; align-items: center; gap: 8px; }
.trade-section-label:first-child { margin-top: 0; }
.trade-autofill-status { font-size: 11px; font-weight: 500; color: var(--text-secondary); margin-left: 8px; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0; }

/* Trade disclaimer */
.trade-disclaimer { font-size: 12px; color: var(--yellow); line-height: 1.6; margin-bottom: 14px; padding: 10px 14px; background: var(--yellow-bg); border: 1px solid rgba(251, 191, 36, 0.2); border-radius: var(--radius); border-left: 3px solid var(--yellow); }

/* Trade card explain (P&L preview per principianti) */
.trade-card__explain { margin-bottom: 14px; }
.pnl-preview { padding: 12px; background: var(--bg-primary); border-radius: var(--radius); border: 1px solid var(--border); }
.pnl-preview__item { padding: 4px 0; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.pnl-preview__gain { color: var(--green); }
.pnl-preview__loss { color: var(--red); }
.pnl-preview__item strong { font-weight: 800; }

/* AI spiegazione semplice e consiglio (GLM 5 per principianti) */
.ai-spiegazione-semplice { font-size: 14px; line-height: 1.7; color: var(--text-primary); margin-bottom: 12px; padding: 14px; background: linear-gradient(135deg, var(--green-bg) 0%, rgba(52, 211, 153, 0.04) 100%); border-radius: var(--radius); border-left: 3px solid var(--green); }
.ai-consiglio { font-size: 13px; line-height: 1.6; color: var(--gold); margin-bottom: 12px; padding: 12px 14px; background: var(--gold-bg); border-radius: var(--radius); border-left: 3px solid var(--gold); font-style: italic; }

/* Quick actions per trade aperti */
.trade-card__quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* P&L label sotto SL/TP nei trade aperti */
.trade-level__pnl { display: block; font-size: 11px; font-weight: 700; font-family: var(--font-mono); margin-top: 4px; }

@media (max-width: 768px) {
    .dashboard { padding: 110px 12px 10px; }
    .header-fixed { flex-wrap: wrap; padding: 8px 14px; gap: 8px; }
    .header-fixed__left { gap: 10px; }
    .header-fixed__logo { font-size: 17px; }
    .header-fixed__value { font-size: 15px; }
    .header-fixed__change { font-size: 11px; }
    .header-fixed__nav { order: 3; width: 100%; }
    .header-fixed__right { display: none; }
    .tab-btn { padding: 7px 14px; font-size: 11px; flex: 1; text-align: center; }
    .confluence-section { flex-direction: column; }
    .mm-container { grid-template-columns: 1fr; }
    .mm-inputs { grid-template-columns: 1fr; }
    .mm-results { grid-template-columns: 1fr; }
    .signals-grid { grid-template-columns: 1fr; }
    .levels-grid { grid-template-columns: 1fr; }
    .settings-row--grid { grid-template-columns: 1fr; }
    .settings-actions { flex-direction: column; align-items: flex-start; }
    .ai-levels { grid-template-columns: 1fr; }
    .ai-header { flex-direction: column; align-items: flex-start; }
    .ai-swing-info { grid-template-columns: 1fr; }
    .news-grid { grid-template-columns: 1fr; }
    .trade-generate__inputs { grid-template-columns: 1fr; }
    .trade-card__levels { grid-template-columns: 1fr; }
    .trade-card__details { grid-template-columns: 1fr; }
    .trade-stats { grid-template-columns: repeat(2, 1fr); }
    .login-card { padding: 36px 28px; }
}

@media (max-width: 480px) {
    .header-fixed__logo { font-size: 15px; }
    .header-fixed__value { font-size: 14px; }
    .header-fixed__change { font-size: 10px; }
    .confluence-label { font-size: 15px; }
    .confluence-badge { padding: 12px 18px; }
    .tf-table { font-size: 11px; }
    .tf-table th, .tf-table td { padding: 7px 8px; }
    .mm-result-card--highlight .mm-result-value { font-size: 20px; }
    .login-card { padding: 30px 22px; }
    .login-header h1 { font-size: 26px; }
}
