/* Options Logic v2 — Base Styles */

:root, [data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2a3a;
    --bg-input: #0f1923;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --accent: #4fc3f7;
    --accent-hover: #29b6f6;
    --green: #4caf50;
    --red: #f44336;
    --orange: #ff9800;
    --border: #2a3a4a;
    --sidebar-width: 240px;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f5f5f5;
    --text-primary: #1a1a2e;
    --text-secondary: #555;
    --text-muted: #888;
    --accent: #1976d2;
    --accent-hover: #1565c0;
    --green: #2e7d32;
    --red: #c62828;
    --orange: #e65100;
    --border: #ddd;
    color-scheme: light;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---------------------------------------------------------------------------
   Layout
--------------------------------------------------------------------------- */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.sidebar-brand a {
    display: block;
}

.sidebar-logo {
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.15s;
}
.sidebar-nav .nav-icon {
    flex-shrink: 0;
    opacity: 0.7;
}
.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
    opacity: 1;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(79, 195, 247, 0.1);
    color: var(--accent);
    border-right: 3px solid var(--accent);
}

/* Collapsible submenu */
.has-submenu .submenu-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.has-submenu .submenu-toggle .submenu-chevron {
    margin-left: auto;
}
.submenu-chevron {
    transition: transform 0.2s;
}
.has-submenu.open .submenu-chevron {
    transform: rotate(180deg);
}
.submenu {
    list-style: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.has-submenu.open .submenu {
    max-height: 800px;
}
.submenu a {
    padding-left: 2.5rem !important;
    font-size: 0.85rem !important;
}
/* Nested submenu (e.g. Strategies inside Options) */
.has-nested .nested-toggle {
    display: flex;
    align-items: center;
    padding-left: 2.5rem !important;
    font-size: 0.85rem !important;
    cursor: pointer;
}
.has-nested .nested-toggle .submenu-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}
.has-nested.open .nested-toggle .submenu-chevron {
    transform: rotate(180deg);
}
.nested-submenu {
    list-style: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.has-nested.open .nested-submenu {
    max-height: 500px;
}
.nested-submenu a {
    padding-left: 3.5rem !important;
    font-size: 0.8rem !important;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}
.sidebar-footer-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 5px;
    cursor: pointer;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    transition: color 0.15s, border-color 0.15s;
}
.theme-toggle-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    padding-top: 0;
    min-height: 100vh;
}

/* ---------------------------------------------------------------------------
   Topbar
--------------------------------------------------------------------------- */

.topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.6rem 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 50;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.topbar-clock {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Notification bell */
.topbar-notifications {
    position: relative;
}
.topbar-bell-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.3rem;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.topbar-bell-btn:hover { color: var(--accent); }
.topbar-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #ef5350;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}
.topbar-notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 200;
    overflow: hidden;
}
.topbar-notif-dropdown.open { display: flex; flex-direction: column; }
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.notif-mark-all {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--accent);
    padding: 0;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list {
    flex: 1;
    overflow-y: auto;
    max-height: 320px;
}
.notif-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.notif-item {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
    cursor: default;
}
.notif-item:hover { background: rgba(79, 195, 247, 0.04); }
.notif-item.unread { background: rgba(79, 195, 247, 0.06); }
.notif-item.unread .notif-ticker { color: var(--accent); }
.notif-ticker {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}
.notif-message {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}
.notif-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.notif-view-all {
    display: block;
    text-align: center;
    padding: 0.55rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.notif-view-all:hover { background: rgba(79, 195, 247, 0.06); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    position: relative;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: background 0.15s;
}

.topbar-user:hover {
    background: rgba(79, 195, 247, 0.08);
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.topbar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.topbar-initials {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.topbar-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.topbar-plan-badge {
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    padding: 2px 6px;
    border-radius: 10px;
    line-height: 1.2;
    border: 1px solid transparent;
}

.topbar-plan-free {
    color: var(--text-secondary);
    border-color: var(--border);
}

.topbar-plan-member {
    color: #4fc3f7;
    border-color: rgba(79, 195, 247, 0.3);
    background: rgba(79, 195, 247, 0.08);
}

.topbar-plan-admin {
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.3);
    background: rgba(167, 139, 250, 0.06);
}

/* Dropdown plan section */
.topbar-dropdown-plan {
    padding: 0.6rem 0.8rem;
}

.topbar-dropdown-plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-dropdown-plan-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.topbar-dropdown-upgrade {
    font-size: 0.7rem;
    font-weight: 500;
    color: #f59e0b;
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    transition: background 0.15s, border-color 0.15s;
}

.topbar-dropdown-upgrade:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.5);
}

.topbar-chevron {
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.topbar-user:hover .topbar-chevron {
    color: var(--text-primary);
}

/* Dropdown menu */
.topbar-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 180px;
    padding: 0.4rem 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 200;
}

.topbar-dropdown.open {
    display: block;
}

.topbar-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.1s;
}

.topbar-dropdown a:hover {
    background: rgba(79, 195, 247, 0.1);
    color: var(--accent);
}

.topbar-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.3rem 0;
}

/* ---------------------------------------------------------------------------
   Cards
--------------------------------------------------------------------------- */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

/* Summary cards row */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
}

.summary-card .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.summary-card .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.summary-card .value.positive { color: var(--green); }
.summary-card .value.negative { color: var(--red); }
.summary-card .desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
    opacity: 0.7;
    line-height: 1.3;
}

/* Expand button */
.expand-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}
.expand-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); }

/* Capital detail table */
.capital-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.capital-detail-table th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.capital-detail-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* Capital controls */
.capital-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.capital-controls input,
.capital-controls select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
}
.capital-controls input { flex: 1; }
.capital-controls select { min-width: 140px; }
.capital-controls input::placeholder { color: var(--text-secondary); opacity: 0.6; }
.capital-filtered-total {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-align: right;
}

/* Hidden utility */
.hidden { display: none; }

/* Standalone color utilities */
.positive { color: var(--green); }
.negative { color: var(--red); }

/* ---------------------------------------------------------------------------
   Tables
--------------------------------------------------------------------------- */

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

.data-table th {
    text-align: left;
    padding: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tr:hover {
    background: rgba(79, 195, 247, 0.05);
}

/* Analysis tables — lightweight, evenly spaced columns */
.analysis-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.analysis-table th {
    text-align: left;
    padding: 0.4rem 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.analysis-table td {
    padding: 0.3rem 1rem;
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Badges
--------------------------------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-open { background: rgba(76, 175, 80, 0.2); color: var(--green); }
.badge-closed { background: rgba(244, 67, 54, 0.2); color: var(--red); }
.badge-rolled { background: rgba(255, 152, 0, 0.2); color: var(--orange); }

/* ---------------------------------------------------------------------------
   Forms & Buttons
--------------------------------------------------------------------------- */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

select.form-control,
input.form-control[list] {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238899aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: var(--red);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
}

/* ---------------------------------------------------------------------------
   Filters bar
--------------------------------------------------------------------------- */

.filters-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filters-bar .form-control {
    width: auto;
    min-width: 140px;
}

/* ---------------------------------------------------------------------------
   Modal
--------------------------------------------------------------------------- */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* ---------------------------------------------------------------------------
   Login page — split-screen layout
--------------------------------------------------------------------------- */

.login-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.login-split {
    display: flex;
    min-height: 100vh;
}

/* Left brand panel */
.login-brand {
    flex: 1;
    background: linear-gradient(135deg, #06112a 0%, #0d2240 40%, #142d54 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

/* Subtle radial glow behind badge */
.login-brand::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(79, 195, 247, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.login-brand-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.login-logo {
    display: block;
    margin: 0 auto 2rem;
    width: 300px;
    height: 300px;
}

.login-brand-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #e8eaed;
    letter-spacing: 3px;
    margin: 0 0 0.5rem;
}

.login-brand-title .accent {
    color: #4fc3f7;
}

.login-brand-tagline {
    color: #8899aa;
    font-size: 1rem;
    letter-spacing: 2px;
    margin: 0 0 1.5rem;
    text-transform: uppercase;
}

.login-brand-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #29b6f6, #4fc3f7);
    margin: 0 auto 1.5rem;
    border-radius: 1px;
}

.login-brand-sub {
    color: #6b7d8e;
    font-size: 0.9rem;
    font-style: italic;
    margin: 0;
}

/* Right form panel */
.login-form-panel {
    flex: 0 0 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--bg-main);
    border-left: 1px solid var(--border);
}

.login-box {
    width: 100%;
    max-width: 360px;
}

.login-box h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.login-box .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 2rem;
}

.login-box .btn-primary {
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.flash-error {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: var(--red);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.flash-success {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: var(--green);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.login-signup-link {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Mobile: stack vertically */
@media (max-width: 768px) {
    .login-split {
        flex-direction: column;
    }
    .login-brand {
        padding: 2rem 1.5rem;
    }
    .login-logo {
        width: 180px;
        height: 180px;
        margin-bottom: 1rem;
    }
    .login-brand-title {
        font-size: 1.4rem;
    }
    .login-brand-tagline {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }
    .login-brand-divider { display: none; }
    .login-brand-sub { display: none; }
    .login-form-panel {
        flex: 1;
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 2rem 1.5rem;
    }
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.optional {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ---------------------------------------------------------------------------
   Analytics sections
--------------------------------------------------------------------------- */

.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row .stat-label {
    color: var(--text-secondary);
}

.stat-row .stat-value {
    font-weight: 600;
}

.stat-row .stat-value.positive { color: var(--green); }
.stat-row .stat-value.negative { color: var(--red); }
.stat-row .stat-value.warning { color: var(--orange); }

.expiring-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--orange);
    margin-bottom: 1rem;
}

/* ---------------------------------------------------------------------------
   Dashboard Charts
--------------------------------------------------------------------------- */

.charts-row {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.charts-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

.charts-row-2 {
    grid-template-columns: repeat(2, 1fr);
}

.chart-subtitle {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: -0.25rem;
    padding-bottom: 0.5rem;
}

/* Period filter bar */
.period-filter {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.period-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.period-btn {
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    background: transparent;
    text-decoration: none;
    transition: all 0.15s;
}

.period-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.period-btn.active {
    background: rgba(79, 195, 247, 0.15);
    color: var(--accent);
    border-color: var(--accent);
}

/* Win/Loss clickable links */
.wl-link {
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
    transition: opacity 0.15s;
}

.wl-link:hover {
    opacity: 0.8;
}

/* ---------------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
   Tabs
--------------------------------------------------------------------------- */

.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
    overflow-x: auto;
    gap: 0;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

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

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-btn .tab-count {
    display: inline-block;
    background: rgba(79, 195, 247, 0.15);
    color: var(--accent);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 0.3rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .charts-row-3,
    .charts-row-2 { grid-template-columns: 1fr; }
    .analytics-grid { grid-template-columns: 1fr; }
}

/* Global "Set Default" button for account dropdowns */
.ol-set-default-btn { background:transparent; border:1px solid var(--border); border-radius:6px; color:var(--text-muted); padding:0.4rem 0.8rem; font-size:0.8rem; font-family:inherit; cursor:pointer; transition:all 0.2s; white-space:nowrap; }
.ol-set-default-btn:hover { border-color:var(--accent); color:var(--accent); }
.ol-set-default-btn.saved { border-color:var(--green); color:var(--green); }
