:root {
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #1a1d29;
    --text-secondary: #64748b;
    --accent: #3b82f6;
    --border: #e2e8f0;
    --call-color: #10b981;
    --put-color: #ef4444;
    --strike-bg: #f1f5f9;

    /* Aliases for compatibility */
    --bg-card: var(--card-bg);
    --border-color: var(--border);
    --accent-color: var(--accent);
    --up-color: var(--call-color);
    --down-color: var(--put-color);
    --bg-primary: var(--bg-color);
    --bg-secondary: #f8fafc;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin-bottom: 20px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

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

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

select,
button {
    background: var(--bg-color);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: inherit;
    min-width: 150px;
}

button {
    background: var(--accent);
    border-color: var(--accent);
    cursor: pointer;
    font-weight: 500;
    color: white;
    /* Ensure button text is white on accent background */
}

button:hover {
    opacity: 0.9;
}

#chain-container {
    max-height: 75vh;
    overflow-y: auto;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

th,
td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

th {
    background: #f1f5f9;
    /* Light grey header */
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--border);
}

/* Ensure the second header row is also sticky */
thead tr:nth-child(2) th {
    top: 41px;
}

.ce-header {
    color: var(--call-color);
}

.pe-header {
    color: var(--put-color);
}

.strike-header {
    background: var(--strike-bg);
    color: var(--text-primary);
}

td.strike-cell {
    background: var(--strike-bg);
    font-weight: 600;
    color: var(--text-primary);
}

.positive {
    color: var(--call-color);
}

.negative {
    color: var(--put-color);
}

tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
    /* Slight darken on hover for light theme */
}

/* Moneyness Colors */
.itm {
    background-color: #fff9c4;
    /* Cream color for ITM */
}

.atm {
    background-color: rgba(59, 130, 246, 0.1);
}

.atm-strike {
    background-color: #e2e8f0 !important;
    border: 1px solid var(--accent);
    color: var(--accent);
}

/* Tooltips for Info Icons */
.info-icon {
    color: var(--accent);
    margin-left: 5px;
    cursor: pointer;
    position: relative;
    font-size: 0.85rem;
}

.info-icon:hover::after,
.info-icon:focus::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: normal;
    width: max-content;
    max-width: 200px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    line-height: 1.4;
    text-align: center;
}

.info-icon:hover::before,
.info-icon:focus::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
    z-index: 1000;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-card);
    margin: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 400px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #5bc0de;
    color: white;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.close {
    color: white;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #f1f1f1;
    text-decoration: none;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

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

.tsl-btn {
    background: #5bc0de;
    border-color: #5bc0de;
    cursor: pointer;
    font-weight: 500;
    color: white;
}

.tsl-btn:hover {
    opacity: 0.9;
}

/* ═══════════════════════════════════════════════
   AUTH UI — shared across all pages
═══════════════════════════════════════════════ */

/* Overlay backdrop */
.oc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ocFadeIn .15s ease;
}
@keyframes ocFadeIn { from { opacity:0; } to { opacity:1; } }

/* Modal card */
.oc-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    overflow: hidden;
    animation: ocSlideIn .2s ease;
    max-height: 90vh;
    overflow-y: auto;
}
@keyframes ocSlideIn { from { transform: translateY(-16px); opacity:0; } to { transform:none; opacity:1; } }

.oc-modal-header {
    background: #3b82f6;
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: .95rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.oc-modal-body {
    padding: 24px;
}

.oc-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: auto;
    line-height: 1;
}
.oc-close:hover { background: rgba(255,255,255,.2); }

/* Tabs */
.oc-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 0;
    font-size: .9rem;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
    min-width: auto;
    border-radius: 0;
    font-weight: 500;
    transition: color .15s, border-color .15s;
}
.oc-tab-active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

/* Form field */
.oc-field {
    margin-bottom: 16px;
}
.oc-field label {
    display: block;
    font-size: .83rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 6px;
}
.oc-field input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-family: inherit;
    font-size: .9rem;
    box-sizing: border-box;
    transition: border-color .15s;
    background: #fff;
    color: #1e293b;
}
.oc-field input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

.oc-error {
    color: #ef4444;
    font-size: .83rem;
    margin: 6px 0 0;
}

/* Primary button (reusable) */
.oc-btn-primary {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 9px 20px;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    min-width: auto;
}
.oc-btn-primary:hover { background: #2563eb; }
.oc-btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.oc-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 8px 18px;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    min-width: auto;
    transition: background .15s;
}
.oc-btn-secondary:hover { background: #e2e8f0; }

/* Google SSO button */
.oc-google-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: .85rem;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    transition: background .15s;
}
.oc-google-btn:hover { background: #f8fafc; }

/* Tier badge in nav */
.oc-tier-badge {
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    letter-spacing: .03em;
    text-transform: uppercase;
}

/* User menu */
.oc-user-menu {
    position: relative;
}

.oc-user-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 5px 10px 5px 5px;
    cursor: pointer;
    font-family: inherit;
    min-width: auto;
    color: #1e293b;
    transition: background .15s;
}
.oc-user-btn:hover { background: #e2e8f0; }

.oc-avatar {
    width: 26px;
    height: 26px;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Dropdown */
.oc-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    min-width: 220px;
    z-index: 8000;
    overflow: hidden;
    animation: ocSlideIn .15s ease;
}

.oc-drop-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 10px 14px;
    font-family: inherit;
    font-size: .88rem;
    color: #374151;
    cursor: pointer;
    transition: background .1s;
    min-width: auto;
    border-radius: 0;
}
.oc-drop-item:hover { background: #f8fafc; }

/* Admin table buttons */
.oc-admin-btn {
    border: none;
    border-radius: 5px;
    padding: 4px 9px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    min-width: auto;
    transition: opacity .15s;
}
.oc-admin-btn:hover { opacity: .8; }