* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Vazirmatn', sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
    direction: rtl;
    color: #0f172a;
}
a { text-decoration: none; color: inherit; }
.topbar {
    background: #fff;
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9edf4;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 12px;
}
.logo-area { display: flex; align-items: center; gap: 12px; }
.logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px;
}
.logo-text { font-size: 20px; font-weight: 800; }
.logo-text span { color: #3b82f6; }
.beta-badge {
    background: #eef2ff; padding: 2px 12px; border-radius: 30px;
    font-size: 10px; font-weight: 700; color: #4338ca;
}
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.search-wrap {
    background: #f8fafc; border-radius: 30px; padding: 7px 16px;
    display: flex; align-items: center; gap: 10px; border: 1px solid #e2e8f0;
}
.search-wrap input {
    border: none; background: transparent; outline: none;
    font-size: 13px; width: 160px; font-family: inherit;
}
.data-date { font-size: 12px; color: #64748b; }
.app-layout { display: flex; min-height: calc(100vh - 72px); }
.sidebar {
    width: 220px; background: #fff; border-left: 1px solid #e9edf4;
    padding: 20px 16px; flex-shrink: 0;
    display: flex; flex-direction: column;
}
.sidebar-menu { list-style: none; }
.sidebar-brand {
    margin-top: auto; padding-top: 16px; border-top: 1px solid #e9edf4;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.sidebar-brand span { font-size: 10px; color: #94a3b8; }
.sidebar-brand .sdata-logo { height: 22px; width: auto; opacity: .9; }
.sidebar-menu li { margin-bottom: 4px; }
.sidebar-menu li a, .sidebar-menu li span.disclaimer {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: 12px;
    color: #64748b; font-size: 14px; font-weight: 500;
}
.sidebar-menu li a:hover { background: #f1f5f9; color: #0f172a; }
.sidebar-menu li a.active { background: #f1f5f9; color: #0f172a; font-weight: 600; }
.sidebar-menu li a.active i { color: #3b82f6; }
.sidebar-divider { height: 1px; background: #e9edf4; margin: 16px 0; }
.sidebar-label {
    font-size: 11px; font-weight: 600; color: #94a3b8;
    padding: 0 14px; margin-bottom: 8px;
}
.main-content { flex: 1; padding: 24px 32px 32px; background: #f8fafc; overflow-x: auto; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { color: #64748b; font-size: 14px; margin-top: 4px; }
.card {
    background: white; border-radius: 16px; border: 1px solid #e9edf4;
    padding: 20px 24px; margin-bottom: 16px;
}
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px;
}
.stat-card {
    background: white; border-radius: 16px; border: 1px solid #e9edf4;
    padding: 20px; text-align: center;
}
.stat-card .value { font-size: 24px; font-weight: 700; color: #0f172a; }
.stat-card .label { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.engine-layout { display: grid; grid-template-columns: 380px 1fr; gap: 24px; }
.input-panel {
    background: white; border-radius: 16px; border: 1px solid #e9edf4;
    padding: 24px; position: sticky; top: 24px; align-self: start;
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.form-group .hint { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.form-control {
    width: 100%; padding: 10px 14px; border-radius: 12px;
    border: 1px solid #e2e8f0; background: #f8fafc; font-size: 14px;
    font-family: inherit;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-primary, .btn-generate {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border: none; border-radius: 14px; color: white;
    font-size: 16px; font-weight: 600; cursor: pointer;
    font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-primary:hover, .btn-generate:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(59,130,246,.3); }
.result-card { background: white; border-radius: 16px; border: 1px solid #e9edf4; padding: 20px 24px; margin-bottom: 16px; }
.result-card:hover { border-color: #cbd5e1; box-shadow: 0 4px 12px rgba(0,0,0,.04); }
.result-card-top { border-color: #93c5fd; box-shadow: 0 8px 24px rgba(59,130,246,.12); }
.rank-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 28px; height: 28px; padding: 0 8px; margin-left: 8px;
    border-radius: 999px; background: #0f172a; color: #fff;
    font-size: 12px; font-weight: 700; vertical-align: middle;
}
.result-card-top .rank-pill { background: linear-gradient(135deg, #2563eb, #4f46e5); }
.result-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.result-name { font-size: 18px; font-weight: 700; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 12px; border-radius: 20px; margin-right: 8px; }
.badge-neutral { background: #fef9e7; color: #b45309; }
.badge-bullish { background: #dcfce7; color: #15803d; }
.badge-bearish { background: #fee2e2; color: #b91c1c; }
.score-badge { background: #dbeafe; color: #1d4ed8; border-radius: 30px; padding: 4px 16px; font-size: 14px; font-weight: 700; }
.legs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.leg { background: #f8fafc; padding: 6px 14px; border-radius: 20px; font-size: 13px; border: 1px solid #e2e8f0; }
.leg .call { color: #059669; font-weight: 600; }
.leg .put { color: #dc2626; font-weight: 600; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin: 14px 0; padding: 14px 0; border-top: 1px solid #eef2f6; border-bottom: 1px solid #eef2f6; }
.metrics .m { text-align: center; }
.metrics .value { font-size: 16px; font-weight: 700; }
.metrics .label { font-size: 11px; color: #94a3b8; }
.metrics .positive { color: #059669; }
.metrics .negative { color: #dc2626; }
.reason { margin-top: 12px; padding: 12px 16px; background: #f8fafc; border-radius: 12px; font-size: 13px; color: #475569; border-right: 3px solid #3b82f6; }
.score-breakdown { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.score-chip { background: #f1f5f9; padding: 4px 10px; border-radius: 8px; font-size: 11px; color: #475569; }
.sizing-box { margin-top: 12px; padding: 12px 14px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 12px; }
.sizing-title { font-size: 13px; font-weight: 700; color: #0369a1; margin-bottom: 10px; }
.sizing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sizing-cell { background: #fff; border: 1px solid #e0f2fe; border-radius: 10px; padding: 10px 12px; }
.sizing-label { font-size: 11px; color: #64748b; margin-bottom: 4px; }
.sizing-value { font-size: 18px; font-weight: 800; color: #0f172a; }
.sizing-sub { font-size: 11px; color: #64748b; margin-top: 3px; }
@media (max-width: 560px) { .sizing-grid { grid-template-columns: 1fr; } }
.pos-expired { opacity: 0.7; }
.btn-danger { background: #fee2e2 !important; color: #b91c1c !important; border-color: #fecaca !important; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.actions button, .actions .btn-sm {
    padding: 6px 16px; border-radius: 30px; border: 1px solid #e2e8f0;
    background: white; font-size: 13px; cursor: pointer; font-family: inherit; color: #475569;
}
.actions .btn-dark { background: #1e293b; color: white; border-color: #1e293b; }
.empty-state { text-align: center; padding: 48px 20px; color: #94a3b8; }
.empty-state i { font-size: 48px; color: #d1d5db; margin-bottom: 16px; }
.warning-box { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: #92400e; }
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td { padding: 10px 12px; border-bottom: 1px solid #eef2f6; text-align: center; }
table.data-table th { background: #f8fafc; color: #64748b; font-weight: 600; }
.simulator-panel { background: white; border-radius: 16px; border: 1px solid #e9edf4; padding: 24px; margin-bottom: 24px; }
.slider-group { margin-bottom: 16px; }
.slider-group label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.slider-group input[type=range] { width: 100%; }
.explanation-list { list-style: none; }
.explanation-list li { padding: 8px 0; border-bottom: 1px solid #eef2f6; font-size: 14px; }
.chart-box { height: 280px; margin-top: 16px; }
@media (max-width: 1024px) {
    .engine-layout { grid-template-columns: 1fr; }
    .input-panel { position: static; }
    .sidebar { display: none; }
}

/* --- Header user area --- */
.user-area { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 13px; color: #334155; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.user-name i { color: #3b82f6; font-size: 16px; }
.btn-logout {
    background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
    padding: 6px 14px; border-radius: 30px; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
}
.btn-logout:hover { background: #fee2e2; }

/* --- Login page --- */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #1d4ed8 140%);
}
.auth-card {
    background: #fff; width: 100%; max-width: 400px;
    border-radius: 20px; padding: 36px 32px;
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.35);
    text-align: center;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 22px; }
.auth-brand-text { font-size: 26px; font-weight: 800; color: #0f172a; }
.auth-title { font-size: 20px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.auth-subtitle { font-size: 13px; color: #64748b; margin-bottom: 24px; }
.auth-form { text-align: right; }
.auth-form label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.auth-input {
    display: flex; align-items: center; gap: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 10px 14px; margin-bottom: 16px;
}
.auth-input i { color: #94a3b8; }
.auth-input input {
    border: none; background: transparent; outline: none;
    font-size: 14px; width: 100%; font-family: inherit; color: #0f172a;
}
.auth-submit {
    width: 100%; padding: 12px; border: none; border-radius: 12px;
    background: linear-gradient(135deg, #1e293b, #1d4ed8); color: #fff;
    font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px;
}
.auth-submit:hover { opacity: 0.94; }
.auth-error {
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
    padding: 10px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 18px;
    display: flex; align-items: center; gap: 8px;
}
.auth-foot { margin-top: 22px; font-size: 11px; color: #94a3b8; }
.auth-powered {
    margin-top: 18px; padding-top: 16px; border-top: 1px solid #eef2f7;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.auth-powered span { font-size: 10px; color: #94a3b8; }
.auth-powered .sdata-logo { height: 26px; width: auto; opacity: .9; }
