/* PSX Stock Tracker — Dark Terminal / Bloomberg-inspired aesthetic */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary:   #090e17;
    --bg-secondary: #0d1520;
    --bg-card:      #111c2c;
    --bg-glass:     rgba(17,28,44,0.85);
    --border:       rgba(0,212,255,0.12);
    --border-glow:  rgba(0,212,255,0.35);
    --accent:       #00d4ff;
    --accent2:      #00ff9d;
    --accent3:      #ff6b35;
    --gold:         #ffd60a;
    --danger:       #ff4560;
    --success:      #00e676;
    --warning:      #ffab40;
    --text-primary: #e8f4f8;
    --text-secondary:#8ba3bd;
    --text-dim:     #4a6178;
    --mono:         'JetBrains Mono', monospace;
    --sans:         'Space Grotesk', sans-serif;
    --glow-sm:      0 0 8px rgba(0,212,255,0.4);
    --glow-md:      0 0 20px rgba(0,212,255,0.3);
    --radius:       8px;
    --radius-lg:    14px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,212,255,0.06) 0%, transparent 60%),
        repeating-linear-gradient(0deg, transparent, transparent 49px, rgba(0,212,255,0.03) 50px),
        repeating-linear-gradient(90deg, transparent, transparent 49px, rgba(0,212,255,0.03) 50px);
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── HEADER ─── */
.header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(9,14,23,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    height: 62px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.4);
}

.logo {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--mono);
    font-size: 1.1rem; font-weight: 700;
    color: var(--accent);
    text-shadow: var(--glow-sm);
    letter-spacing: 0.05em;
}
.logo-badge {
    background: var(--accent);
    color: var(--bg-primary);
    font-size: 0.6rem; font-weight: 700;
    padding: 2px 6px; border-radius: 4px;
    letter-spacing: 0.1em;
}
.logo-icon {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    box-shadow: var(--glow-sm);
}

.nav-tabs {
    display: flex; gap: 4px;
}
.nav-tab {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--sans);
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}
.nav-tab:hover {
    color: var(--accent);
    border-color: var(--border);
    background: rgba(0,212,255,0.05);
}
.nav-tab.active {
    color: var(--accent);
    border-color: var(--border-glow);
    background: rgba(0,212,255,0.08);
    box-shadow: var(--glow-sm);
}

.header-actions {
    display: flex; align-items: center; gap: 10px;
}

/* ─── TICKER TAPE ─── */
.ticker-tape {
    background: rgba(0,212,255,0.04);
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    overflow: hidden;
    position: relative;
}
.ticker-tape::before, .ticker-tape::after {
    content: '';
    position: absolute; top: 0; width: 80px; height: 100%;
    z-index: 2;
}
.ticker-tape::before { left: 0; background: linear-gradient(to right, var(--bg-primary), transparent); }
.ticker-tape::after  { right: 0; background: linear-gradient(to left, var(--bg-primary), transparent); }

.ticker-inner {
    display: flex; gap: 40px;
    animation: ticker-scroll 560s linear infinite;
    width: max-content;
}
.ticker-inner:hover { animation-play-state: paused; }

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    font-family: var(--mono);
    font-size: 0.75rem;
    white-space: nowrap;
    display: flex; align-items: center; gap: 8px;
}
.ticker-sym  { color: var(--accent); font-weight: 700; }
.ticker-price { color: var(--text-primary); }
.ticker-chg.up   { color: var(--success); }
.ticker-chg.down { color: var(--danger); }

/* ─── MAIN LAYOUT ─── */
.main { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ─── PAGE SECTIONS ─── */
.page-section { display: none; }
.page-section.active { display: block; }

/* ─── CARDS ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}
.card:hover {
    border-color: var(--border-glow);
    box-shadow: 0 0 30px rgba(0,212,255,0.08);
}

/* ─── SEARCH BAR ─── */
.search-bar {
    display: flex; gap: 10px; margin-bottom: 24px;
    flex-wrap: wrap;
}
.search-input-wrap {
    flex: 1; min-width: 220px;
    position: relative;
}
.search-input-wrap .icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-dim); font-size: 0.9rem;
}
.search-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px 10px 36px;
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.search-input:focus {
    border-color: var(--accent);
    box-shadow: var(--glow-sm);
}
.search-input::placeholder { text-transform: none; letter-spacing: 0; color: var(--text-dim); }

/* ─── BUTTONS ─── */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none; cursor: pointer;
    font-family: var(--sans); font-size: 0.85rem; font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.2s;
    display: inline-flex; align-items: center; gap: 6px;
    white-space: nowrap;
    text-decoration: none;
}
.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    box-shadow: 0 0 15px rgba(0,212,255,0.3);
}
.btn-primary:hover {
    box-shadow: 0 0 25px rgba(0,212,255,0.5);
    transform: translateY(-1px);
}
.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border-glow);
}
.btn-secondary:hover {
    background: rgba(0,212,255,0.08);
    box-shadow: var(--glow-sm);
}
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(255,69,96,0.3);
}
.btn-danger:hover {
    background: rgba(255,69,96,0.1);
    box-shadow: 0 0 12px rgba(255,69,96,0.3);
}
.btn-success {
    background: var(--success);
    color: var(--bg-primary);
}
.btn-sm { padding: 5px 8px; font-size: 0.78rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-loading {
    position: relative;
    pointer-events: none;
}
.btn-loading::after {
    content: '';
    width: 12px; height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── METRIC GRID ─── */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}
.metric-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.metric-card::after {
    content: '';
    position: absolute; bottom: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}
.metric-card:hover::after { opacity: 0.6; }

.metric-label {
    font-size: 0.7rem; font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.metric-value {
    font-family: var(--mono);
    font-size: 1.3rem; font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.metric-value.large { font-size: 1.6rem; }
.metric-value.accent { color: var(--accent); text-shadow: var(--glow-sm); }
.metric-sub {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 4px;
    font-family: var(--mono);
}
.metric-badge {
    display: inline-block;
    padding: 2px 6px; border-radius: 4px;
    font-size: 0.68rem; font-weight: 700;
    font-family: var(--mono);
    margin-top: 4px;
}
.badge-up   { background: rgba(0,230,118,0.12); color: var(--success); }
.badge-down { background: rgba(255,69,96,0.12);  color: var(--danger); }
.badge-neutral { background: rgba(255,171,64,0.12); color: var(--warning); }

/* ─── STOCK DETAIL HEADER ─── */
.stock-hero {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.stock-hero::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent));
}
.stock-hero-inner {
    display: flex; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; gap: 20px;
}
.stock-name-block .stock-sym {
    font-family: var(--mono);
    font-size: 2rem; font-weight: 700;
    color: var(--accent);
    text-shadow: var(--glow-md);
    line-height: 1;
}
.stock-name-block .stock-company {
    font-size: 0.95rem; color: var(--text-secondary);
    margin-top: 4px;
}
.stock-name-block .stock-exchange {
    font-size: 0.72rem; color: var(--text-dim);
    font-family: var(--mono);
    margin-top: 2px;
    letter-spacing: 0.06em;
}

.price-block { text-align: right; }
.price-main {
    font-family: var(--mono);
    font-size: 2.8rem; font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.price-main .currency {
    font-size: 1.2rem; color: var(--text-dim); margin-right: 4px;
}
.price-change {
    font-family: var(--mono);
    font-size: 1rem; font-weight: 600;
    margin-top: 6px;
}
.price-change.up   { color: var(--success); }
.price-change.down { color: var(--danger); }
.price-time {
    font-size: 0.7rem; color: var(--text-dim);
    margin-top: 4px;
}

/* ─── TABLE ─── */
.data-table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--mono);
    font-size: 0.82rem;
}
.data-table th {
    background: rgba(0,212,255,0.06);
    color: var(--accent);
    font-weight: 600;
    padding: 8px 8px;
    text-align: left;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 8px 8px;
    border-bottom: 1px solid rgba(0,212,255,0.06);
    color: var(--text-primary);
    white-space: nowrap;
}
.data-table tr:hover td { background: rgba(0,212,255,0.03); }
.data-table tr:last-child td { border-bottom: none; }

td.positive { color: var(--success); font-weight: 600; }
td.negative { color: var(--danger);  font-weight: 600; }
td.accent   { color: var(--accent); }
td.muted    { color: var(--text-dim); }

/* ─── SECTION TITLES ─── */
.section-title {
    font-size: 0.72rem; font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.section-title::after {
    content: '';
    flex: 1; height: 1px;
    background: linear-gradient(to right, var(--border), transparent);
}

/* ─── CHART PLACEHOLDER ─── */
.chart-container {
    width: 100%; height: 200px;
    position: relative;
}
canvas { width: 100% !important; }

/* ─── STATUS BADGES ─── */
.status-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-dot.success { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.error   { background: var(--danger);  box-shadow: 0 0 6px var(--danger); }
.status-dot.partial { background: var(--warning); }
.status-dot.live    {
    background: var(--success);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%,100% { box-shadow: 0 0 4px var(--success); }
    50%      { box-shadow: 0 0 12px var(--success); }
}

/* ─── WATCHLIST ─── */
.watchlist-grid {
    display: block;
}
.watchlist-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; justify-content: space-between; align-items: center;
}
.watchlist-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0,212,255,0.1);
}
.wl-left .wl-sym {
    font-family: var(--mono); font-weight: 700; font-size: 1rem;
    color: var(--accent);
}
.wl-left .wl-name { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }
.wl-right { text-align: right; }
.wl-price { font-family: var(--mono); font-size: 1.1rem; font-weight: 600; }
.wl-change { font-size: 0.75rem; font-family: var(--mono); }

/* ─── MODAL ─── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(9,14,23,0.85);
    backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 90%; max-width: 480px;
    box-shadow: 0 0 60px rgba(0,0,0,0.6), 0 0 40px rgba(0,212,255,0.1);
    animation: modal-in 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modal-in {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}
.modal h3 {
    font-size: 1rem; font-weight: 700; color: var(--accent);
    letter-spacing: 0.04em; margin-bottom: 18px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.modal label {
    display: block; font-size: 0.75rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.06em;
}
.modal input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--mono); font-size: 0.9rem;
    outline: none; margin-bottom: 16px;
}
.modal input:focus { border-color: var(--accent); box-shadow: var(--glow-sm); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* ─── TOAST ─── */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 300; display: flex; flex-direction: column; gap: 10px;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 18px;
    font-size: 0.85rem;
    display: flex; align-items: center; gap: 10px;
    animation: toast-in 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    max-width: 360px;
}
@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
.toast.success { border-color: rgba(0,230,118,0.4); }
.toast.error   { border-color: rgba(255,69,96,0.4); }

/* ─── GRID HELPERS ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media(max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stock-hero-inner { flex-direction: column; }
    .price-block { text-align: left; }
    .price-main { font-size: 2rem; }
    .nav-tabs { display: none; }
    .main { padding: 12px; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── LOADING OVERLAY ─── */
.loading-overlay {
    display: none;
    position: absolute; inset: 0;
    background: rgba(9,14,23,0.7);
    border-radius: inherit;
    align-items: center; justify-content: center;
    z-index: 10;
    backdrop-filter: blur(4px);
}
.loading-overlay.show { display: flex; }
.loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ─── RANGE BAR ─── */
.range-bar-wrap { margin: 6px 0; }
.range-bar-track {
    height: 4px; background: var(--border);
    border-radius: 2px; position: relative; margin: 4px 0;
}
.range-bar-fill {
    position: absolute; height: 100%;
    background: linear-gradient(to right, var(--accent2), var(--accent));
    border-radius: 2px;
}
.range-labels {
    display: flex; justify-content: space-between;
    font-family: var(--mono); font-size: 0.65rem; color: var(--text-dim);
}

/* ─── PULSE ANIMATION ─── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.4s ease forwards; }

/* ─── AUTH SCREEN ─── */
.auth-bg {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(ellipse 60% 50% at 50% 0%, rgba(0,212,255,0.08) 0%, transparent 60%),
        radial-gradient(ellipse 40% 40% at 80% 80%, rgba(0,255,157,0.05) 0%, transparent 50%),
        var(--bg-primary);
    padding: 20px;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%; max-width: 420px;
    box-shadow: 0 0 60px rgba(0,0,0,0.6), 0 0 40px rgba(0,212,255,0.07);
    animation: modal-in 0.4s cubic-bezier(0.34,1.3,0.64,1);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo h1 { font-size: 1.8rem; font-weight: 800; color: var(--text-primary); letter-spacing: 0.02em; }
.auth-logo p  { font-size: 0.75rem; color: var(--text-dim); margin-top: 4px; letter-spacing: 0.08em; }
.auth-toggle {
    display: flex; gap: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px; padding: 3px;
    margin-bottom: 24px;
}
.auth-tab {
    flex: 1; padding: 8px; border-radius: 6px;
    border: none; background: transparent;
    color: var(--text-dim); font-family: var(--sans);
    font-size: 0.85rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s; letter-spacing: 0.03em;
}
.auth-tab.active { background: var(--bg-card); color: var(--accent); box-shadow: 0 0 10px rgba(0,212,255,0.2); }
.auth-error {
    background: rgba(255,69,96,0.1);
    border: 1px solid rgba(255,69,96,0.3);
    color: var(--danger); font-size: 0.82rem;
    padding: 10px 14px; border-radius: 6px; margin-bottom: 12px;
}

/* ─── FORM GROUPS ─── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 0.7rem; font-weight: 700;
    color: var(--text-dim); letter-spacing: 0.1em;
    text-transform: uppercase; margin-bottom: 6px;
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--mono); font-size: 0.88rem;
    outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--accent); box-shadow: var(--glow-sm);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-select {
    appearance: none;
    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 1l5 5 5-5' stroke='%234a6178' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

/* ─── USER MENU ─── */
.user-menu-wrap { position: relative; }
.user-btn {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 12px;
    color: var(--text-primary); cursor: pointer;
    font-family: var(--sans); font-size: 0.82rem;
    transition: all 0.2s;
}
.user-btn:hover { border-color: var(--border-glow); background: rgba(0,212,255,0.06); }
.user-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 800; color: var(--bg-primary);
    flex-shrink: 0;
}
.user-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 20px rgba(0,212,255,0.08);
    min-width: 220px; z-index: 200;
    animation: modal-in 0.15s ease;
}
.user-info-block { padding: 14px 16px; }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-item {
    display: block; width: 100%; text-align: left;
    padding: 10px 16px;
    background: transparent; border: none; cursor: pointer;
    color: var(--text-secondary); font-family: var(--sans);
    font-size: 0.83rem; transition: all 0.15s;
}
.dropdown-item:hover { background: rgba(0,212,255,0.06); color: var(--accent); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: rgba(255,69,96,0.08); }
.role-badge {
    background: rgba(255,214,10,0.12); color: var(--gold);
    font-size: 0.65rem; font-weight: 700; padding: 2px 8px;
    border-radius: 4px; letter-spacing: 0.08em;
}

/* ─── TOGGLE SWITCH ─── */
.toggle-wrap { display: inline-flex; align-items: center; cursor: pointer; }
.toggle-wrap input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
    width: 38px; height: 20px; border-radius: 10px;
    background: var(--text-dim);
    position: relative; transition: background 0.25s;
    flex-shrink: 0;
}
.toggle-wrap input:checked + .toggle-track { background: var(--accent); }
.toggle-track::after {
    content: '';
    position: absolute; top: 3px; left: 3px;
    width: 14px; height: 14px; border-radius: 50%;
    background: white; transition: transform 0.25s;
}
.toggle-wrap input:checked + .toggle-track::after { transform: translateX(18px); }

/* ─── WATCHLIST CARDS ─── */
.wl-table-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}
.wl-table-card:hover { border-color: rgba(0,212,255,0.25); }
.wl-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; flex-wrap: wrap; gap: 10px;
}
.wl-sym-block .sym { font-family: var(--mono); font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.wl-sym-block .cname { font-size: 0.75rem; color: var(--text-secondary); margin-top: 1px; }
.wl-price-block { text-align: right; }
.wl-price-block .price { font-family: var(--mono); font-size: 1.2rem; font-weight: 700; }
.wl-price-block .sector { font-size: 0.68rem; color: var(--text-dim); margin-top: 2px; }
.wl-card-body {
    padding: 10px 18px 14px;
    border-top: 1px solid rgba(0,212,255,0.06);
    display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start;
}
.wl-meta { flex: 1; min-width: 200px; }
.wl-meta .notes-text {
    font-size: 0.8rem; color: var(--text-secondary);
    margin-bottom: 10px; font-style: italic; line-height: 1.5;
}
.wl-alerts { display: flex; gap: 10px; flex-wrap: wrap; }
.alert-pill {
    padding: 4px 10px; border-radius: 20px;
    font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
    display: inline-flex; align-items: center; gap: 5px;
}
.alert-pill.above { background: rgba(0,230,118,0.1); border: 1px solid rgba(0,230,118,0.3); color: var(--success); }
.alert-pill.below { background: rgba(255,69,96,0.1);  border: 1px solid rgba(255,69,96,0.3);  color: var(--danger); }
.alert-pill.off   { background: rgba(74,97,120,0.15); border: 1px solid var(--border); color: var(--text-dim); }
.wl-actions { display: flex; gap: 6px; align-items: flex-start; }

/* ─── MANAGE TAB ─── */
.manage-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
    margin-bottom: 14px;
}
.manage-toolbar-left  { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.manage-toolbar-right { display: flex; gap: 10px; align-items: center; }

.manage-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 28px 8px 12px;
    color: var(--text-primary);
    font-family: var(--sans); font-size: 0.82rem;
    outline: none; cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234a6178' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    transition: border-color 0.2s;
    min-width: 160px;
}
.manage-select:focus { border-color: var(--accent); }

/* ─── MANAGE FILTERS ROW ─── */
.manage-filters {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 8px 12px; margin-bottom: 10px;
    background: rgba(0,212,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.filter-group {
    display: flex; align-items: center; gap: 6px;
}
.filter-label {
    font-size: 0.7rem; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.05em;
    white-space: nowrap;
}
.filter-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 24px 4px 8px;
    color: var(--text-primary);
    font-family: var(--mono); font-size: 0.74rem;
    outline: none; cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234a6178' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 6px center;
}
.filter-select:focus { border-color: var(--accent); }

.rank-filter-chips {
    display: flex; gap: 4px;
}
.rank-chip {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 4px;
    font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
    cursor: pointer; user-select: none;
    border: 1px solid transparent;
    transition: opacity 0.15s;
}
.rank-chip input[type=checkbox] {
    width: 12px; height: 12px; margin: 0; cursor: pointer;
    accent-color: var(--accent);
}
.rank-chip:has(input:not(:checked)) {
    opacity: 0.35;
}

.color-filter-chips {
    display: flex; gap: 4px; align-items: center;
}
.color-chip {
    display: inline-flex; align-items: center; gap: 2px;
    cursor: pointer; user-select: none;
    padding: 2px; border-radius: 4px;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}
.color-chip:has(input:checked) {
    border-color: var(--accent);
}
.color-chip input[type=checkbox] {
    display: none;
}
.color-dot {
    width: 18px; height: 18px; border-radius: 50%;
    display: inline-block;
    transition: transform 0.15s;
}
.color-chip:hover .color-dot {
    transform: scale(1.2);
}

/* ─── IMAGE GALLERY ─── */
.img-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.img-card {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.img-card:hover { border-color: var(--accent); }
.img-thumb {
    width: 100%; height: 110px;
    overflow: hidden; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.2);
}
.img-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}
.img-card:hover .img-thumb img { transform: scale(1.05); }
.img-info {
    padding: 6px 8px;
    display: flex; flex-direction: column; gap: 2px;
}
.img-name {
    font-size: 0.68rem; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-family: var(--mono);
}
.img-meta {
    font-size: 0.6rem; color: var(--text-dim);
}
.img-del-btn {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(0,0,0,0.6); border: none;
    color: #ff4560; font-size: 0.7rem;
    cursor: pointer; opacity: 0;
    transition: opacity 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.img-card:hover .img-del-btn { opacity: 1; }
.img-del-btn:hover { background: rgba(255,69,96,0.3); }

/* Fair value legend */
.fv-legend {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(0,212,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.75rem;
}
.fv-badge {
    padding: 3px 10px; border-radius: 20px;
    font-weight: 600; font-size: 0.7rem; letter-spacing: 0.04em;
}
.fv-badge.conservative { background: rgba(255,171,64,0.12); color: var(--warning); border: 1px solid rgba(255,171,64,0.3); }
.fv-badge.normal       { background: rgba(0,212,255,0.10);  color: var(--accent);  border: 1px solid rgba(0,212,255,0.25); }
.fv-badge.bullish      { background: rgba(0,230,118,0.10);  color: var(--success); border: 1px solid rgba(0,230,118,0.25); }

/* Sortable table headers */
.sortable-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s;
}
.sortable-table th.sortable:hover { color: var(--accent); }
.sort-icon { font-size: 0.65rem; color: var(--accent); margin-left: 2px; }

/* Fair value cell */
.fv-cell {
    font-family: var(--mono); font-size: 0.78rem;
    white-space: nowrap;
    padding: 10px 8px !important;
}
.fv-tag { font-weight: 600; }
.fv-sep { color: var(--border-glow); margin: 0 3px; }

/* Sector tag pill */
.sector-tag {
    display: inline-block;
    padding: 2px 6px; border-radius: 4px;
    background: rgba(0,212,255,0.07);
    border: 1px solid rgba(0,212,255,0.15);
    font-size: 0.62rem; color: var(--text-secondary);
    white-space: normal; word-break: break-word;
    max-width: 100px; line-height: 1.3;
}

/* Rank badge */
.rank-badge {
    display: inline-block; min-width: 28px; text-align: center;
    padding: 2px 6px; border-radius: 4px;
    font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
    line-height: 1.4;
}
.rank-A  { background: rgba(0,230,118,0.18); color: #00e676; border: 1px solid rgba(0,230,118,0.35); }
.rank-B  { background: rgba(0,212,255,0.12); color: var(--accent); border: 1px solid rgba(0,212,255,0.3); }
.rank-C  { background: rgba(255,214,10,0.12); color: #ffd60a; border: 1px solid rgba(255,214,10,0.3); }
.rank-D  { background: rgba(255,152,0,0.12); color: #ff9800; border: 1px solid rgba(255,152,0,0.3); }
.rank-F  { background: rgba(255,69,96,0.10); color: var(--danger); border: 1px solid rgba(255,69,96,0.25); }

/* Clickable symbol */
.sym-link {
    color: var(--accent); font-family: var(--mono); font-weight: 700;
    cursor: pointer; text-decoration: none;
    transition: text-shadow 0.15s;
}
.sym-link:hover { text-shadow: var(--glow-sm); }

/* Compact action buttons in manage table */
.sortable-table td:last-child { padding: 6px 10px !important; }

/* ─── NOTIFICATION BELL ─── */
.notify-bell-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    position: relative;
    transition: all 0.2s;
    line-height: 1;
}
.notify-bell-btn:hover { border-color: var(--border-glow); background: rgba(0,212,255,0.06); }
.notify-bell-btn.bell-active {
    border-color: var(--gold);
    animation: bell-ring 0.6s ease 3;
}
@keyframes bell-ring {
    0%,100% { transform: rotate(0deg); }
    20%      { transform: rotate(-15deg); }
    40%      { transform: rotate(15deg); }
    60%      { transform: rotate(-10deg); }
    80%      { transform: rotate(10deg); }
}
.notify-badge {
    position: absolute;
    top: -6px; right: -6px;
    background: var(--danger);
    color: white;
    font-size: 0.6rem; font-weight: 800;
    min-width: 16px; height: 16px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-primary);
    font-family: var(--mono);
}

/* ─── NOTIFICATION PANELS (slide in from bottom-right) ─── */
.notify-container {
    position: fixed;
    bottom: 80px; right: 24px;
    z-index: 500;
    display: flex; flex-direction: column; gap: 12px;
    pointer-events: none;
    max-width: 360px; width: 100%;
}
.notify-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 20px rgba(0,212,255,0.1);
    overflow: hidden;
    pointer-events: all;
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34,1.4,0.64,1), opacity 0.3s ease;
}
.notify-panel.notify-visible {
    transform: translateX(0);
    opacity: 1;
}
.notify-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--border);
}
.notify-arrow { font-size: 1.1rem; flex-shrink: 0; }
.notify-title { flex: 1; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.notify-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-dim); font-size: 0.8rem; padding: 2px 6px;
    border-radius: 4px; transition: all 0.15s;
}
.notify-close:hover { background: rgba(255,69,96,0.1); color: var(--danger); }
.notify-body { padding: 14px 16px; }
.notify-msg { font-size: 0.83rem; color: var(--text-secondary); margin-bottom: 12px; }
.notify-prices {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 14px;
    margin-bottom: 12px;
}
.notify-price-block { flex: 1; text-align: center; }
.notify-price-label { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; }
.notify-price-val   { font-family: var(--mono); font-size: 1rem; font-weight: 700; }
.notify-sep { color: var(--border-glow); font-size: 1.2rem; }
.notify-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ─── SOURCE BADGE in stock data ─── */
.source-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.68rem; color: var(--text-dim);
    border: 1px solid var(--border); border-radius: 4px;
    padding: 2px 7px; font-family: var(--mono);
}
.source-badge.psx { color: var(--accent2); border-color: rgba(0,255,157,0.2); }

/* ─── WATCHLIST TABLE ─── */
.wl-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
}
.wl-toolbar-left  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wl-toolbar-right { display: flex; gap: 8px; }

.wl-table-wrap { overflow-x: auto; }

.wl-main-table {
    width: 100%; border-collapse: collapse;
    font-family: var(--mono); font-size: 0.82rem;
}
.wl-main-table th {
    background: rgba(0,212,255,0.07);
    color: var(--accent); font-weight: 700;
    padding: 10px 12px; text-align: left;
    letter-spacing: 0.05em; font-size: 0.72rem; text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap; cursor: pointer;
    user-select: none; transition: color 0.15s;
}
.wl-main-table th:hover { color: var(--accent2); }
.wl-main-table th.th-sno,
.wl-main-table td.td-sno { width: 42px; text-align: center; color: var(--text-dim); }
.wl-main-table th.th-actions { cursor: default; }
.wl-main-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,212,255,0.05);
    vertical-align: middle; color: var(--text-primary);
}
.wl-main-table tr.wl-row:hover td { background: rgba(0,212,255,0.03); }
.wl-main-table td.td-name {
    max-width: 180px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
    font-family: var(--sans); font-size: 0.82rem; color: var(--text-secondary);
}
.wl-main-table td.td-actions {
    white-space: nowrap;
    display: flex; gap: 5px; align-items: center;
    padding: 8px 10px;
}

/* Alert tags inside table cells */
.wl-alert-tag {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-weight: 700; font-size: 0.73rem; white-space: nowrap;
}
.wl-alert-tag.above { background: rgba(0,230,118,0.1); color: var(--success); border: 1px solid rgba(0,230,118,0.25); }
.wl-alert-tag.below { background: rgba(255,69,96,0.1);  color: var(--danger);  border: 1px solid rgba(255,69,96,0.25); }
.wl-no-alert  { color: var(--text-dim); font-size: 0.85rem; }
.wl-off-tag {
    display: inline-block; font-size: 0.65rem; font-weight: 700;
    padding: 1px 5px; border-radius: 3px;
    background: rgba(74,97,120,0.2); color: var(--text-dim);
    margin-left: 4px; vertical-align: middle;
}
.wl-note {
    font-size: 0.68rem; color: var(--text-dim);
    margin-top: 2px; font-family: var(--sans);
    font-style: italic; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}

/* Responsive: stack on small screens */
@media (max-width: 768px) {
    .wl-main-table { font-size: 0.75rem; }
    .wl-main-table th, .wl-main-table td { padding: 8px 8px; }
    .wl-main-table td.td-name { max-width: 100px; }
    .wl-main-table td.td-actions { flex-wrap: wrap; }
}

/* ─── FAIR VALUE COLUMNS ─── */
.fv-col { font-family: var(--mono); font-size: 0.82rem; white-space: nowrap; }
.fv-col-header { font-size: 0.68rem !important; }

/* ─── LABEL COLOR PICKER ─── */
.label-color-grid {
    display: flex; flex-wrap: wrap; gap: 10px;
    padding: 10px 0;
}

/* ─── SECTOR PE INPUT ─── */
.sector-pe-input:focus {
    border-color: var(--accent) !important;
    box-shadow: var(--glow-sm);
    outline: none;
}

/* ─── SELECT ALL CHECKBOX HEADER ─── */
#manageDataTable th:first-child { cursor: default; }

/* ─── FROZEN / STICKY TABLE HEADERS ─── */
.frozen-table-wrap {
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    position: relative;
}
.frozen-table-wrap .data-table thead th,
.frozen-table-wrap .wl-main-table thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #0c1524;  /* slightly darker than card bg so it looks distinct */
    box-shadow: 0 1px 0 var(--border);
}
/* Make sure sort icon stays above content */
.frozen-table-wrap .sort-icon { position: relative; z-index: 1; }

/* ─── NAV DROPDOWN ─── */
.nav-dropdown-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.nav-dropdown-btn {
    display: flex; align-items: center; gap: 4px;
    padding-right: 12px;
}
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    min-width: 180px;
    z-index: 300;
    overflow: hidden;
    animation: modal-in 0.15s ease;
}
.nav-dropdown-item {
    display: block; width: 100%; text-align: left;
    padding: 10px 16px;
    background: transparent; border: none;
    color: var(--text-secondary); cursor: pointer;
    font-family: var(--sans); font-size: 0.83rem;
    transition: all 0.15s;
}
.nav-dropdown-item:hover {
    background: rgba(0,212,255,0.07);
    color: var(--accent);
}
.nav-dropdown-item + .nav-dropdown-item {
    border-top: 1px solid var(--border);
}

/* ─── FROZEN TABLE HEADERS ─── */
.frozen-table-wrap {
    overflow: auto;
    max-height: 70vh;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    position: relative;
}
.frozen-header thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
    box-shadow: 0 2px 0 var(--border);
}
/* Keep checkbox col sticky horizontally too on wide tables */
.frozen-header thead th:first-child,
.frozen-header tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--bg-card);
}
.frozen-header thead th:first-child { z-index: 11; }
.frozen-header tbody tr:hover td:first-child { background: rgba(0,212,255,0.05); }

/* ─── NAV DROPDOWN (Logs) ─── */
.nav-dropdown-wrap {
    position: relative;
    display: inline-flex;
}
.nav-dropdown-btn {
    display: flex; align-items: center; gap: 4px;
}
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 20px rgba(0,212,255,0.08);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
    animation: modal-in 0.15s ease;
}
.nav-dropdown-item {
    display: block; width: 100%; text-align: left;
    padding: 10px 16px;
    background: transparent; border: none; cursor: pointer;
    color: var(--text-secondary); font-family: var(--sans);
    font-size: 0.83rem; transition: all 0.15s;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.nav-dropdown-item:last-child { border-bottom: none; }
.nav-dropdown-item:hover { background: rgba(0,212,255,0.06); color: var(--accent); }

/* ─── WL TABLE FROZEN SCROLLABLE ─── */
.wl-table-wrap { overflow-x: auto; }
/* Override old wl-table-wrap since we're replacing it with frozen-table-wrap */
.frozen-table-wrap .wl-main-table,
.frozen-table-wrap #manageDataTable {
    border: none; /* border on the wrap itself */
}

/* ─── WATCHLIST ROW HIGHLIGHTS ─── */

/* Price already breached alert low */
.wl-row-breached td {
    background: rgba(255,69,96,0.10) !important;
}
.wl-row-breached:hover td {
    background: rgba(255,69,96,0.16) !important;
}
.wl-row-breached {
    border-left-color: var(--danger) !important;
}

/* Within 0–2% of alert low — imminent */
.wl-row-imminent td {
    background: rgba(255,107,53,0.09) !important;
}
.wl-row-imminent:hover td {
    background: rgba(255,107,53,0.14) !important;
}
.wl-row-imminent {
    border-left-color: #ff6b35 !important;
    border-left-width: 3px;
}

/* Within 2–5% of alert low — caution */
.wl-row-warning td {
    background: rgba(255,171,64,0.07) !important;
}
.wl-row-warning:hover td {
    background: rgba(255,171,64,0.12) !important;
}
.wl-row-warning {
    border-left-color: var(--warning) !important;
    border-left-width: 3px;
}

/* ─── vs Low % DIFF BADGE ─── */
.wl-diff-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.66rem;
    font-weight: 700;
    font-family: var(--mono);
    vertical-align: middle;
    white-space: nowrap;
    letter-spacing: 0.03em;
}

/* ─── NOTES CELL ─── */
.td-notes {
    max-width: 220px;
}
.wl-notes-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: var(--sans);
    font-style: italic;
    line-height: 1.4;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    cursor: help;
}

/* ─── WATCHLIST MODAL — RADIO BUTTONS ─── */
.wl-radio-group {
    display: flex;
    gap: 8px;
    align-items: center;
}
.wl-radio-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.wl-radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}
.wl-radio-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border: 1px solid var(--border);
    color: var(--text-dim);
    background: transparent;
    cursor: pointer;
    transition: all 0.18s;
    font-family: var(--mono);
}
.wl-radio-label input[type="radio"]:checked + .wl-radio-pill.weekly {
    background: rgba(0,212,255,0.15);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 8px rgba(0,212,255,0.2);
}
.wl-radio-label input[type="radio"]:checked + .wl-radio-pill.monthly {
    background: rgba(124,77,255,0.15);
    border-color: #7c4dff;
    color: #b39ddb;
    box-shadow: 0 0 8px rgba(124,77,255,0.2);
}
.wl-radio-pill:hover { opacity: 0.85; }

/* ─── LEVEL TYPE BADGES (Wk / Mo) in table cells ─── */
.wl-level-type {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.62rem;
    font-weight: 800;
    font-family: var(--mono);
    vertical-align: middle;
    letter-spacing: 0.04em;
}
.wl-level-type.weekly {
    background: rgba(0,212,255,0.1);
    color: var(--accent);
    border: 1px solid rgba(0,212,255,0.25);
}
.wl-level-type.monthly {
    background: rgba(124,77,255,0.12);
    color: #b39ddb;
    border: 1px solid rgba(124,77,255,0.3);
}

/* ─── COMPACT WATCHLIST TABLE COLUMNS ─── */
.wl-main-table td,
.wl-main-table th {
    padding: 8px 10px;
}
.wl-main-table .td-notes {
    /* Give Notes column room to breathe */
    width: auto;
    min-width: 160px;
}
.wl-main-table .td-actions {
    white-space: nowrap;
    width: 100px;
}

/* ─── INLINE EDIT — SP LVL / R LEVEL ─── */
.wl-inline-cell { display: inline-flex; align-items: center; }
.wl-inline-display {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 4px;
    padding: 2px 4px;
    transition: background 0.15s;
    width: 100%;
}
.wl-inline-display:hover {
    background: rgba(0,212,255,0.07);
    outline: 1px dashed rgba(0,212,255,0.3);
}
.wl-inline-empty .wl-inline-add {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-family: var(--mono);
}
.wl-inline-empty:hover .wl-inline-add {
    color: var(--accent);
}
.wl-inline-form {
    display: inline-flex;
    align-items: center;
    width: 100%;
}
.wl-inline-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 3px 6px;
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 0.82rem;
    outline: none;
    box-shadow: 0 0 6px rgba(0,212,255,0.25);
}
/* Remove number spinner arrows for compact look */
.wl-inline-input::-webkit-outer-spin-button,
.wl-inline-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.wl-inline-input[type=number] { -moz-appearance: textfield; }


.wl-main-table td:nth-child(6),
.wl-main-table td:nth-child(7) {
    width: 118px;
    min-width: 118px;
    max-width: 118px;
}

.wl-main-table td.td-notes,
.wl-main-table th:nth-child(8) {
    max-width: 140px;
    width: 140px;
    overflow: hidden;
}

/* ─── WATCHLIST AUTO-LAYOUT TABLE ─────────────────────────────────────────── */

/* table-layout:auto lets the browser size every column to its widest content.
   The Notes column gets width:100% so it absorbs ALL remaining space.
   No other column gets a pixel width — they all shrink to fit their content. */

.wl-auto-table {
    table-layout: auto !important;
    width: 100%;
}

/* Every non-Notes cell: nowrap so column = widest cell value */
.wl-td-fixed,
.wl-auto-table thead .wl-col-fixed {
    white-space: nowrap;
    width: 1%;        /* shrink-to-content trick alongside table-layout:auto */
}

/* Notes column: takes all leftover space, wraps text */
.wl-col-notes,
.wl-td-notes {
    width: 100% !important;
    white-space: normal;
    word-break: break-word;
    min-width: 120px;
}

/* Override old .td-notes max-width that was killing available space */
.wl-auto-table .td-notes,
.wl-auto-table .wl-td-notes {
    max-width: none !important;
}

/* Notes text: no truncation, wraps naturally */
.wl-auto-table .wl-notes-text {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: none;
    display: inline;
}

/* Inline edit: sized to content, not a fixed width */
.wl-inline-cell {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.wl-inline-display {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 4px;
    padding: 2px 4px;
    transition: background 0.15s;
}
.wl-inline-display:hover {
    background: rgba(0,212,255,0.07);
    outline: 1px dashed rgba(0,212,255,0.3);
}
.wl-inline-form { display: inline-flex; align-items: center; }
.wl-inline-input {
    width: 80px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 3px 6px;
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 0.82rem;
    outline: none;
    box-shadow: 0 0 6px rgba(0,212,255,0.25);
}
.wl-inline-input::-webkit-outer-spin-button,
.wl-inline-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.wl-inline-input[type=number] { -moz-appearance: textfield; }

/* Add prompt */
.wl-inline-empty .wl-inline-add {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-family: var(--mono);
}
.wl-inline-empty:hover .wl-inline-add { color: var(--accent); }

/* Compact table padding for watchlist */
.wl-auto-table td,
.wl-auto-table th {
    padding: 8px 10px;
}
.wl-auto-table .td-sno  { padding: 8px 6px; text-align: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   WATCHLIST OVERRIDES — spacing, SP/R uniform width, highlights, notes cap
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── More column spacing ── */
.wl-auto-table td,
.wl-auto-table th {
    padding: 9px 14px !important;
}
.wl-auto-table .td-sno { padding: 9px 8px !important; text-align: center; }

/* ── SP LVL / R Level cells: fixed inner layout so price + badge align ── */
/* The cell itself auto-sizes; inside we use a fixed-width monospace price
   block so all rows align regardless of price value */
.wl-level-cell {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.wl-level-price {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 700;
    /* ch unit = width of '0' in the current font — gives "9999.99" width */
    min-width: 7ch;
    text-align: right;
}

/* ── Notes: cap at 200px, ellipsis, no scroll ── */
.wl-col-notes,
.wl-td-notes {
    max-width: 200px !important;
    width: 200px !important;
    overflow: hidden !important;
}
.wl-auto-table .wl-notes-text {
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 180px !important;
}

/* ── Row highlights: much more prominent on dark background ── */
/* Breached — solid red tint, bright left border */
.wl-row-breached td {
    background: rgba(255, 30, 70, 0.28) !important;
    border-top:    1px solid rgba(255,69,96,0.25);
    border-bottom: 1px solid rgba(255,69,96,0.25);
}
.wl-row-breached:hover td {
    background: rgba(255, 30, 70, 0.38) !important;
}
.wl-row-breached td:first-child {
    border-left: 4px solid #ff1e46 !important;
    box-shadow: inset 3px 0 12px rgba(255,30,70,0.4);
}

/* Imminent (0–2%) — vivid orange */
.wl-row-imminent td {
    background: rgba(255, 100, 30, 0.22) !important;
    border-top:    1px solid rgba(255,107,53,0.2);
    border-bottom: 1px solid rgba(255,107,53,0.2);
}
.wl-row-imminent:hover td {
    background: rgba(255, 100, 30, 0.32) !important;
}
.wl-row-imminent td:first-child {
    border-left: 4px solid #ff6b35 !important;
    box-shadow: inset 3px 0 12px rgba(255,107,53,0.35);
}

/* Warning (2–5%) — amber/yellow */
.wl-row-warning td {
    background: rgba(255, 180, 0, 0.14) !important;
    border-top:    1px solid rgba(255,171,64,0.15);
    border-bottom: 1px solid rgba(255,171,64,0.15);
}
.wl-row-warning:hover td {
    background: rgba(255, 180, 0, 0.22) !important;
}
.wl-row-warning td:first-child {
    border-left: 4px solid #ffab40 !important;
    box-shadow: inset 3px 0 12px rgba(255,171,64,0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   WATCHLIST — FINAL LAYOUT OVERRIDE (replaces all previous wl-* rules)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Container: no overflow, let the table be max available width */
.wl-auto-table {
    table-layout: auto !important;
    width: 100% !important;
    border-collapse: collapse;
}

/* ALL cells: nowrap, shrink to content */
.wl-td-fixed,
.wl-auto-table thead .wl-col-fixed {
    white-space: nowrap !important;
    width: 1% !important;          /* shrink-to-content */
    overflow: hidden;
}

/* Notes: absorbs remaining space, capped so no scroll */
.wl-col-notes,
.wl-td-notes {
    width: auto !important;
    max-width: 160px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
.wl-auto-table .wl-notes-text {
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 150px !important;
}

/* Comfortable column padding */
.wl-auto-table th,
.wl-auto-table td {
    padding: 9px 16px !important;
}
.wl-auto-table .td-sno { padding: 9px 8px !important; text-align:center; }

/* ── SP Level / R Level cells ── */
.wl-level-td {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.wl-level-td:hover {
    background: rgba(0,212,255,0.06) !important;
    outline: 1px dashed rgba(0,212,255,0.3);
    outline-offset: -1px;
}
.wl-level-empty:hover { background: rgba(0,212,255,0.04) !important; }

/* Price + badge layout inside level cell */
.wl-level-arrow {
    font-size: 0.75rem;
    margin-right: 1px;
}
.wl-level-val {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 700;
    /* fixed width = arrow (1ch) + space (1ch) + 4 digits + dot + 2 digits = 8ch */
    min-width: 6.5ch;
    display: inline-block;
}
.wl-level-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.60rem;
    font-weight: 800;
    font-family: var(--mono);
    letter-spacing: 0.04em;
    vertical-align: middle;
}
.wl-level-badge.weekly  { background:rgba(0,212,255,0.12); color:var(--accent);  border:1px solid rgba(0,212,255,0.25); }
.wl-level-badge.monthly { background:rgba(124,77,255,0.15); color:#b39ddb; border:1px solid rgba(124,77,255,0.3); }

/* ── Row highlights — vivid on dark bg, original opacity restored ── */
.wl-row-breached td {
    background: rgba(255,30,70,0.18) !important;
    border-top: 1px solid rgba(255,69,96,0.18) !important;
    border-bottom: 1px solid rgba(255,69,96,0.18) !important;
}
.wl-row-breached:hover td { background: rgba(255,30,70,0.26) !important; }
.wl-row-breached td:first-child { border-left: 4px solid #ff1e46 !important; }

.wl-row-imminent td {
    background: rgba(255,100,30,0.16) !important;
    border-top: 1px solid rgba(255,107,53,0.16) !important;
    border-bottom: 1px solid rgba(255,107,53,0.16) !important;
}
.wl-row-imminent:hover td { background: rgba(255,100,30,0.24) !important; }
.wl-row-imminent td:first-child { border-left: 4px solid #ff6b35 !important; }

.wl-row-warning td {
    background: rgba(255,180,0,0.12) !important;
    border-top: 1px solid rgba(255,171,64,0.12) !important;
    border-bottom: 1px solid rgba(255,171,64,0.12) !important;
}
.wl-row-warning:hover td { background: rgba(255,180,0,0.18) !important; }
.wl-row-warning td:first-child { border-left: 4px solid #ffab40 !important; }

/* Frozen header needs max-height on the wrap, not the table */
.wl-auto-table.frozen-header thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
    box-shadow: 0 2px 0 var(--border);
}

/* ─── WATCHLIST ICON ACTION BUTTONS ─── */
.wl-td-actions {
    white-space: nowrap;
    width: 1% !important;
    padding: 6px 10px !important;
}
.wl-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1;
    transition: all 0.15s;
    margin-right: 3px;
    color: var(--text-secondary);
}
.wl-icon-btn:last-child { margin-right: 0; }
.wl-icon-btn:hover { background: rgba(0,212,255,0.08); border-color: var(--border-glow); color: var(--accent); }
.wl-icon-del       { color: var(--danger); border-color: rgba(255,69,96,0.2); }
.wl-icon-del:hover { background: rgba(255,69,96,0.1); border-color: rgba(255,69,96,0.4); color: var(--danger); }

/* ─── WATCHLIST NOTES COLUMN — inline editable ─── */
.wl-td-notes {
    max-width: 160px !important;
    width: 160px !important;
    cursor: pointer;
    transition: background 0.15s;
}
.wl-td-notes:hover {
    background: rgba(0,212,255,0.05) !important;
    outline: 1px dashed rgba(0,212,255,0.25);
    outline-offset: -1px;
}
.wl-auto-table .wl-notes-text {
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 150px !important;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ─── PORTFOLIO ─── */
.port-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 4px;
}
.port-sum-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: border-color 0.2s;
}
.port-sum-card:hover { border-color: var(--border-glow); }
.port-sum-label {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
    color: var(--text-dim); text-transform: uppercase; margin-bottom: 6px;
}
.port-sum-val {
    font-family: var(--mono); font-size: 1.05rem; font-weight: 700;
    color: var(--text-primary);
}
.port-sum-sub { font-size: 0.72rem; color: var(--text-dim); margin-top: 3px; }

/* ─── DASHBOARD HOLDINGS TABLE ─── */
#dashHoldingsTable td, #dashHoldingsTable th {
    font-size: 0.78rem;
    padding: 8px 10px;
    font-family: var(--mono);
}
#dashHoldingsTable th {
    font-family: var(--body);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-dim);
}
#dashHoldingsTable tbody tr:hover { background: var(--bg-card); }
#dashHoldingsTable tfoot td {
    font-size: 0.82rem;
    padding-top: 12px;
}

/* ─── WATCHLIST STAR RATING ─── */
.wl-stars {
    font-size: 0.85rem;
    letter-spacing: 1px;
    line-height: 1;
    cursor: help;
}
/* Star colors by rating */
.wl-stars-5 { color: #00e676; }   /* vivid green  — Excellent */
.wl-stars-4 { color: #69f0ae; }   /* light green  — Good      */
.wl-stars-3 { color: #ffd740; }   /* amber        — Hold      */
.wl-stars-2 { color: #ff9100; }   /* orange       — Weak      */
.wl-stars-1 { color: #ff1744; }   /* red          — Avoid     */

/* Recommendation pill */
.wl-rec {
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    margin-top: 2px;
    display: inline-block;
    white-space: nowrap;
}
.rec-strong-buy { background: rgba(0,230,118,0.15);  color: #00e676; border: 1px solid rgba(0,230,118,0.3);  }
.rec-buy        { background: rgba(105,240,174,0.12); color: #69f0ae; border: 1px solid rgba(105,240,174,0.25); }
.rec-hold       { background: rgba(255,215,64,0.12);  color: #ffd740; border: 1px solid rgba(255,215,64,0.25); }
.rec-weak       { background: rgba(255,145,0,0.12);   color: #ff9100; border: 1px solid rgba(255,145,0,0.25);  }
.rec-avoid      { background: rgba(255,23,68,0.12);   color: #ff1744; border: 1px solid rgba(255,23,68,0.25);  }

/* ─── DIVIDEND BADGE ─── */
.div-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 4px;
    font-size: 0.58rem;
    font-weight: 800;
    font-family: var(--mono);
    letter-spacing: 0.04em;
    color: #ffd740;
    background: rgba(255,215,64,0.12);
    border: 1px solid rgba(255,215,64,0.3);
    border-radius: 3px;
    vertical-align: middle;
    cursor: help;
}

/* ─── BTC MODULE ─── */
.btc-header-widget {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 12px; border-radius: 20px;
    background: rgba(247,147,26,0.08);
    border: 1px solid rgba(247,147,26,0.25);
    cursor: pointer; transition: all 0.2s;
    white-space: nowrap;
}
.btc-header-widget:hover {
    background: rgba(247,147,26,0.15);
    border-color: rgba(247,147,26,0.5);
}
.btc-logo { font-size: 1rem; color: #f7931a; }

.btc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 4px;
}
.btc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: border-color 0.2s;
}
.btc-card:hover { border-color: rgba(247,147,26,0.35); }
.btc-price-card { border-color: rgba(247,147,26,0.25); }

.btc-label {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em;
    color: var(--text-dim); text-transform: uppercase; margin-bottom: 7px;
}
.btc-val {
    font-family: var(--mono); font-size: 1.1rem;
    font-weight: 700; color: var(--text-primary);
}
.btc-price { font-size: 1.4rem; color: #f7931a; }
.btc-change {
    font-family: var(--mono); font-size: 0.82rem;
    font-weight: 700; margin-top: 4px;
}

/* ─── NAV DROPDOWN WRAP POSITIONING ─── */
.nav-dropdown-wrap { position: relative; display: inline-flex; }
.nav-dropdown-btn.active, .nav-dropdown-btn:focus { color: var(--accent); }
.nav-dropdown-menu {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 180px; z-index: 300;
    background: var(--bg-card); border: 1px solid var(--border-glow);
    border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    overflow: hidden; animation: modal-in 0.15s ease;
}
.nav-dropdown-item {
    display: block; width: 100%; text-align: left; padding: 10px 16px;
    background: transparent; border: none; border-bottom: 1px solid var(--border);
    color: var(--text-secondary); font-family: var(--sans); font-size: 0.83rem;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.nav-dropdown-item:last-child { border-bottom: none; }
.nav-dropdown-item:hover { background: rgba(0,212,255,0.06); color: var(--accent); }

/* ─── NAV DROPDOWN FIX — allow overflow from sticky header ─── */
.header { overflow: visible !important; }
.nav-tabs { overflow: visible; }
.nav-dropdown-wrap { position: relative; display: inline-flex; align-items: center; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 190px;
    z-index: 9999;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(0,212,255,0.1);
    overflow: visible;
}
.nav-dropdown-menu.open,
.nav-dropdown-wrap.open .nav-dropdown-menu { display: block; }
.nav-dropdown-btn.active,
.nav-dropdown-wrap.open .nav-dropdown-btn { color: var(--accent); }
.nav-dropdown-item {
    display: block; width: 100%; text-align: left;
    padding: 11px 18px;
    background: transparent; border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary); font-family: var(--sans); font-size: 0.84rem;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.nav-dropdown-item:last-child { border-bottom: none; }
.nav-dropdown-item:hover { background: rgba(0,212,255,0.08); color: var(--accent); padding-left: 22px; }

/* ─── NAV DETAILS/SUMMARY DROPDOWN (replaces JS-based dropdown) ─── */
.nav-details {
    position: relative;
    display: inline-block;
}
.nav-details[open] > .nav-details-menu { display: block; }

.nav-summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.nav-summary::-webkit-details-marker { display: none; }
.nav-summary::marker { display: none; }

.nav-details-menu {
    display: none;
    position: fixed;       /* fixed — escapes ALL parent overflow/clip contexts */
    z-index: 99999;
    min-width: 190px;
    background: #111c2c;
    border: 1px solid rgba(0,212,255,0.3);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    overflow: visible;
}

.nav-dropdown-item {
    display: block; width: 100%; text-align: left;
    padding: 11px 18px;
    background: transparent; border: none;
    border-bottom: 1px solid rgba(0,212,255,0.08);
    color: #8ba3bd;
    font-family: var(--sans); font-size: 0.84rem;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.nav-dropdown-item:last-child { border-bottom: none; }
.nav-dropdown-item:hover {
    background: rgba(0,212,255,0.08);
    color: #00d4ff;
    padding-left: 22px;
}

/* ─── STOCK NOTES ─── */
.note-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
}
.note-item:last-child { margin-bottom: 0; }
.note-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 0.74rem;
}
.note-author { color: var(--accent); font-weight: 600; }
.note-time   { color: var(--text-dim); font-family: var(--mono); }
.note-body   {
    font-size: 0.83rem;
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}


/* ── Search exchange select (moved out of inline style) ── */
.search-exchange-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 10px;
    color: var(--text-secondary);
    font-family: var(--sans);
    font-size: 0.82rem;
    cursor: pointer;
    min-width: 80px;
}

/* ── Nav backdrop ── */
.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 198;
    backdrop-filter: blur(2px);
}
.nav-backdrop.show { display: block; }

/* ── Hamburger (desktop: hidden) ── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    transition: border-color 0.2s;
}
.hamburger:hover { border-color: var(--accent); }
.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
    transform-origin: center;
}
.hamburger.open { border-color: var(--accent); }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: var(--accent); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: var(--accent); }

/* ════════════════════════════════════════════════════════

/* ═══════════════════════════════════════════════════════
   MOBILE NAV & LAYOUT  — does NOT touch desktop styles
   ═══════════════════════════════════════════════════════ */

/* Hamburger — hidden on desktop */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px; height: 38px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
}
.hamburger span {
    display: block; width: 100%; height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Backdrop */
.nav-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 198;
}
.nav-backdrop.show { display: block; }

/* Flat items — hidden on desktop, shown only on mobile */
.nav-flat-item { display: none; }
.nav-group-label-mobile { display: none; }

/* ── MOBILE ≤768px ── */
@media (max-width: 768px) {

    /* Header */
    .header { padding: 0 14px; height: 54px; position: sticky; top: 0; z-index: 200; }
    .logo { font-size: 0.92rem; }
    .logo-badge { display: none; }
    .hamburger { display: flex; }

    /* Slide-in drawer */
    .nav-tabs {
        display: flex !important;
        flex-direction: column !important;
        position: fixed !important;
        top: 54px; left: 0; bottom: 0;
        width: 270px;
        background: #080f1c;
        border-right: 1px solid var(--border);
        overflow-y: auto;
        padding: 6px 0 80px;
        z-index: 199;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
        gap: 0;
    }
    .nav-tabs.mobile-open {
        transform: translateX(0);
        box-shadow: 6px 0 32px rgba(0,0,0,0.5);
    }

    /* Nav buttons in drawer */
    .nav-tab {
        width: 100% !important;
        text-align: left !important;
        padding: 13px 18px !important;
        border-radius: 0 !important;
        font-size: 0.88rem !important;
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        justify-content: flex-start !important;
    }
    .nav-tab.active {
        border-left: 3px solid var(--accent) !important;
        padding-left: 15px !important;
    }

    /* Hide desktop dropdowns entirely on mobile */
    .nav-dropdown-wrap { display: none !important; }

    /* Show flat nav items */
    .nav-flat-item {
        display: flex !important;
        align-items: center;
        padding-left: 34px !important;
        color: var(--text-dim) !important;
        font-size: 0.85rem !important;
    }
    .nav-flat-item:hover { color: var(--text-primary) !important; }
    .nav-flat-item.active {
        color: var(--accent) !important;
        background: rgba(0,212,255,0.08) !important;
        border-left: 3px solid var(--accent) !important;
        padding-left: 31px !important;
    }

    /* Section labels */
    .nav-group-label-mobile {
        display: block;
        padding: 10px 18px 4px;
        font-size: 0.66rem;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--text-dim);
        border-top: 1px solid rgba(255,255,255,0.07);
        margin-top: 2px;
        pointer-events: none;
    }

    /* Main & search */
    .main { padding: 10px 12px 32px; }
    .search-bar { flex-wrap: wrap; gap: 8px; }
    .search-exchange-select { min-width: 80px; flex-shrink: 0; }
    .search-input-wrap { flex: 1; min-width: 140px; }
    #searchBtn { flex: 1; min-width: 80px; }

    /* Tables — horizontal scroll */
    .data-table-wrap, .wl-table-wrap, .frozen-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Grids */
    .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
    #dashGrid { grid-template-columns: 1fr !important; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
    .port-summary-grid { grid-template-columns: repeat(2, 1fr) !important; }

    /* Stock hero */
    .stock-hero-inner { flex-direction: column; }
    .price-main { font-size: 1.8rem !important; }

    /* Toolbars stack */
    .wl-toolbar, .manage-toolbar { flex-direction: column; gap: 8px; }
    .wl-toolbar-left, .wl-toolbar-right,
    .manage-toolbar-left, .manage-toolbar-right { width: 100%; flex-wrap: wrap; }
    .manage-filters { gap: 8px; padding: 6px 8px; }
    .filter-group { flex-wrap: wrap; }

    /* Modals slide up from bottom */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal {
        width: 100% !important; max-width: 100% !important;
        border-radius: 18px 18px 0 0 !important;
        max-height: 92vh; overflow-y: auto;
        margin: 0 !important; padding: 20px 16px 32px !important;
    }

    /* Page section header buttons */
    .page-section > div:first-child { flex-wrap: wrap; gap: 8px; }

    /* iOS safe area */
    .main { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}

/* ── TABLET 769–1100px ── */
@media (min-width: 769px) and (max-width: 1100px) {
    .nav-tab { padding: 6px 10px; font-size: 0.79rem; }
    .metrics-grid { grid-template-columns: repeat(3, 1fr) !important; }
    #dashGrid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── Watchlist view tabs (Own / Shared) ── */
.wl-view-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.wl-view-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 8px 18px;
    font-size: 0.85rem;
    color: var(--text-dim);
    cursor: pointer;
    font-family: var(--sans);
    transition: color 0.2s, border-color 0.2s;
    border-radius: 6px 6px 0 0;
}
.wl-view-tab:hover { color: var(--text-primary); }
.wl-view-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(0,212,255,0.05);
}
.wl-tab-count {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-left: 5px;
    font-family: var(--mono);
}
.wl-view-tab.active .wl-tab-count { color: var(--accent); }

/* ── Mobile watchlist: hide non-essential columns ── */
@media (max-width: 768px) {
    /* Show only: checkbox, symbol, price, support level, actions */
    .wl-main-table th:not(.wl-col-keep),
    .wl-main-table td:not(.wl-col-keep) {
        display: none;
    }
    /* Actions td always shows */
    .wl-col-fixed.wl-td-actions,
    .wl-td-actions { display: table-cell !important; }
    /* Hide checkbox col on mobile */
    .wl-main-table th.wl-col-keep:first-child,
    .wl-main-table td.wl-col-keep:first-child { display: none !important; }
    /* In actions cell: hide all buttons except scrape (↻) */
    .wl-td-actions .wl-icon-btn:not(.wl-mobile-scrape) { display: none; }
    .wl-td-actions .wl-mobile-scrape { display: inline-flex; }
}