*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: #f4f6f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    -webkit-tap-highlight-color: transparent;
}

body {
    color: #212529;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* ── Bootstrap fallbacks ── */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -0.125em;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

.mt-2 {
    margin-top: .5rem;
}

.m-3 {
    margin: 1rem;
}

.alert {
    position: relative;
    padding: .9rem 1rem;
    border: 1px solid transparent;
    border-radius: .5rem;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* ── Shell ── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1a237e;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.app-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: .3px;
}

.app-nav {
    display: flex;
    gap: 8px;
}

.app-nav-link {
    color: #fff;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,.3);
    opacity: .9;
}

.app-nav-link.active {
    background: #fff;
    color: #1a237e;
    border-color: #fff;
    opacity: 1;
}

.app-content {
    flex: 1;
    padding: 0 0 24px;
}

/* ── Meta bar ── */
.meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    font-size: .78rem;
    color: #666;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

/* ── Category header ── */
.category-header {
    background: #e8eaf6;
    color: #1a237e;
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 6px 14px;
    margin-top: 8px;
    border-left: 4px solid #1a237e;
}

/* ── Position card ── */
.pos-card {
    background: #fff;
    margin: 6px 10px;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    border-left: 4px solid transparent;
}

.pos-card.pos {
    border-left-color: #2e7d32;
}

.pos-card.neg {
    border-left-color: #c62828;
}

.pos-top {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 4px;
}

.pos-symbol {
    font-weight: 700;
    font-size: 1rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-waarde {
    font-weight: 700;
    font-size: .95rem;
    white-space: nowrap;
}

.pos-mid, .pos-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 3px;
}

.position-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.position-metrics-compact {
    margin-top: 6px;
}

.metric-chip {
    font-size: .74rem;
    color: #4f5b66;
    background: #eef2f7;
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
}

.metric-positive {
    color: #1b5e20;
    background: #e8f5e9;
}

.metric-negative {
    color: #b71c1c;
    background: #ffebee;
}

.pos-detail {
    font-size: .78rem;
    color: #555;
    background: #f0f0f0;
    border-radius: 4px;
    padding: 1px 6px;
}

/* ── Badges ── */
.badge {
    font-size: .7rem;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    color: #fff;
    display: inline-block;
    margin-right: 4px;
}

.badge-call {
    background: #1565c0;
}

.badge-put {
    background: #b71c1c;
}

.badge-short {
    background: #c62828;
    font-size: .6rem;
    padding: 2px 5px;
}

.badge-long {
    background: #2e7d32;
    font-size: .6rem;
    padding: 2px 5px;
}

/* ── Loading ── */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 80px;
    color: #666;
}

.combo-empty {
    margin: 16px 10px;
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    color: #666;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.combo-card {
    background: #fff;
    margin: 8px 10px;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    border-left: 4px solid #1a237e;
}

.combo-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.combo-symbol {
    font-size: 1rem;
    font-weight: 700;
    flex: 1;
}

.combo-pattern {
    background: #e8eaf6;
    color: #1a237e;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: .72rem;
    font-weight: 700;
}

.combo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.combo-detail {
    font-size: .76rem;
    color: #555;
    background: #f0f0f0;
    border-radius: 4px;
    padding: 1px 6px;
}

.combo-detail-side {
    font-size: .76rem;
    color: #555;
    background: #f0f0f0;
    border-radius: 4px;
    padding: 1px 6px;
    flex: 1;
}

.combo-detail-value {
    font-size: .78rem;
    font-weight: 700;
}

.combo-leg {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: #f8f9fb;
    border-radius: 8px;
    padding: 6px 8px;
    margin-top: 6px;
}

.combo-leg-main {
    min-width: 90px;
    font-weight: 700;
    font-size: .84rem;
}

.combo-leg-side {
    font-size: .78rem;
    color: #555;
    flex: 1;
}

.combo-leg-value {
    font-size: .78rem;
    font-weight: 700;
}

.leg-short {
    border-left: 3px solid #c62828;
}

.leg-long {
    border-left: 3px solid #2e7d32;
}

/* ── Utility ── */
.text-success { color: #2e7d32 !important; }
.text-danger  { color: #c62828 !important; }
.text-muted   { color: #999 !important; }

/* ── Stock row (compact 1-line display) ── */
.stock-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    margin: 4px 4px 0;
    font-size: .68rem;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.stock-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    margin: 4px 4px;
    padding: 8px 4px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    font-size: .72rem;
}

.stock-name {
    font-weight: 700;
    font-size: .88rem;
    flex: 1;
    min-width: 60px;
}

.stock-col {
    text-align: right;
    min-width: 48px;
    color: #333;
}

.stock-header .stock-name {
    font-size: .68rem;
}

/* ── Clickable rows ── */
.clickable-row {
    cursor: pointer;
    transition: all 0.15s ease;
}

.clickable-row:hover {
    background: #f5f7fa !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.12) !important;
    transform: translateY(-1px);
}

.clickable-row:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,.08) !important;
}

/* ── Combo row (2-line name, values centered) ── */
.combo-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    margin: 4px 4px;
    padding: 8px 4px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    font-size: .72rem;
}

.combo-name-col {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.combo-name-line1 {
    font-weight: 700;
    font-size: .88rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.combo-pattern-badge {
    background: #e8eaf6;
    color: #1a237e;
    border-radius: 999px;
    padding: 1px 6px;
    font-size: .6rem;
    font-weight: 700;
    white-space: nowrap;
}

.combo-name-line2 {
    font-size: .68rem;
    color: #666;
    font-weight: 400;
}

.stock-header .combo-name-col {
    font-size: .68rem;
}

/* ── Option name column ── */
.option-name-col {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stock-header .option-name-col {
    font-size: .68rem;
}

/* ── Cash section ── */
.cash-section {
    background: #fff;
    margin: 4px 4px 12px;
    padding: 8px 4px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.cash-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    font-size: .82rem;
}

.cash-label {
    font-weight: 600;
    color: #333;
}

.cash-value {
    font-weight: 700;
    color: #1a237e;
    text-align: right;
}

/* ── Option Details Page ── */
.detail-header {
    background: #fff;
    padding: 12px 14px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.back-button {
    background: #e8eaf6;
    color: #1a237e;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: #c5cae9;
}

.back-button:active {
    transform: scale(0.98);
}

.detail-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a237e;
    margin: 0;
    flex: 1;
}

.detail-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    font-size: .78rem;
    color: #666;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.detail-meta {
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.detail-section {
    background: #fff;
    margin: 4px 4px 12px;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: .7rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}

.detail-value {
    font-size: .88rem;
    color: #333;
    font-weight: 600;
}

.detail-value-large {
    font-size: 1.05rem;
    font-weight: 700;
}

.detail-leg-card {
    background: #fff;
    margin: 4px 4px 8px;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    border-left: 4px solid #666;
}

.detail-leg-card.leg-short {
    border-left-color: #c62828;
}

.detail-leg-card.leg-long {
    border-left-color: #2e7d32;
}

.leg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.leg-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.leg-type-badge {
    font-size: .75rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.leg-strike {
    font-size: .95rem;
    font-weight: 700;
    color: #333;
}

.leg-position-badge {
    font-size: .7rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    color: #fff;
}

.badge-short {
    background: #c62828;
}

.badge-long {
    background: #2e7d32;
}

.text-warning {
    color: #f57c00 !important;
}

@media (max-width: 600px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-header {
        position: relative;
    }
}

