/* Vitta-Kosh Dashboard Styles — Modern Dark-Gold Theme */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-card-solid: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border: rgba(212, 160, 23, 0.12);
    --border-light: rgba(212, 160, 23, 0.06);
    --gold: #D4A017;
    --gold-light: #F6D365;
    --gold-dim: #8B6914;
    --accent: #D4A017;
    --accent-light: #F6D365;
    --success: #4ADE80;
    --danger: #F87171;
    --warning: #FBBF24;
    --info: #60A5FA;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --glass: backdrop-filter: blur(16px);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-solid: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --border: rgba(212, 160, 23, 0.15);
    --border-light: rgba(212, 160, 23, 0.08);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
}

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

html {
    /* Do NOT set overflow-x here — it breaks position:fixed in Edge */
}

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* Subtle background gradient */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(212, 160, 23, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.app {
    max-width: 1320px;
    margin: 0 auto;
    padding: 1rem 2rem;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
    width: 100%;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    gap: 1rem;
    position: relative;
    z-index: 50;
}

.header-brand   { display: flex; align-items: center; gap: 0.75rem; min-width: 0; flex-shrink: 0; }
.header-status  { flex: 1; display: flex; justify-content: center; }
.header-actions { display: flex; align-items: center; gap: 0.375rem; flex-shrink: 0; }

.logo-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

.logo {
    font-size: 1.375rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

.sync-status {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    padding: 0.25rem 0.625rem;
    background: rgba(212, 160, 23, 0.06);
    border-radius: 100px;
    border: 1px solid var(--border-light);
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
    padding: 0.4375rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card-solid);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn:hover {
    border-color: rgba(212, 160, 23, 0.3);
    background: rgba(212, 160, 23, 0.08);
}

.btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.75rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    color: #0f172a;
    border-color: transparent;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(212, 160, 23, 0.3);
}

/* ── Metric Cards ───────────────────────────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), var(--gold-dim));
    opacity: 0;
    transition: opacity 0.25s;
}

.metric-card:hover::before { opacity: 1; }

.metric-card:hover {
    border-color: rgba(212, 160, 23, 0.25);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.metric-label {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.625rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-sub {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-top: 0.375rem;
}

/* ── Tabs ───────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    padding: 0.375rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.tab {
    padding: 0.5rem 1.125rem;
    border: none;
    background: none;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    white-space: nowrap;
    font-family: var(--font);
}

.tab.active {
    color: #0f172a;
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    font-weight: 600;
}

.tab:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(212, 160, 23, 0.08);
}

/* ── Chips ──────────────────────────────────────────────────────────── */
.chip {
    display: inline-block;
    font-size: 0.625rem;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
    font-weight: 600;
}

.chip-in { background: rgba(74, 222, 128, 0.15); color: #4ADE80; }
.chip-us { background: rgba(96, 165, 250, 0.15); color: #60A5FA; }
.chip-mf { background: rgba(167, 139, 250, 0.15); color: #A78BFA; }

[data-theme="light"] .chip-in { background: #E1F5EE; color: #0F6E56; }
[data-theme="light"] .chip-us { background: #E6F1FB; color: #185FA5; }
[data-theme="light"] .chip-mf { background: #EEEDFE; color: #3C3489; }

/* ── Panels ─────────────────────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

/* ── Charts ─────────────────────────────────────────────────────────── */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    transition: border-color 0.25s;
}

.chart-card:hover { border-color: rgba(212, 160, 23, 0.2); }

.chart-container {
    position: relative;
    height: 260px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Tables ─────────────────────────────────────────────────────────── */
.search-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.search-input, .filter-select {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card-solid);
    color: var(--text-primary);
    outline: none;
    font-family: var(--font);
    transition: border-color 0.2s;
}

.search-input { width: 220px; max-width: 100%; }
.search-input:focus, .filter-select:focus { border-color: var(--gold); }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--gold);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: var(--text-primary);
}

th.sort-active {
    color: var(--text-primary);
}

.sort-icon {
    font-style: normal;
    font-size: 0.625rem;
    margin-left: 2px;
}

td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tr:hover td { background: rgba(212, 160, 23, 0.03); }
tr:last-child td { border-bottom: none; }

.up { color: var(--success); }
.dn { color: var(--danger); }

.placeholder-row td {
    color: var(--text-tertiary);
    font-style: italic;
    text-align: center;
    padding: 2.5rem;
}

/* ── Tax notes ──────────────────────────────────────────────────────── */
.tax-note {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.tax-note p { margin-bottom: 0.375rem; }

.placeholder-text {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    padding: 1rem 0;
}

.placeholder-text code {
    background: rgba(212, 160, 23, 0.1);
    color: var(--gold-light);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8125rem;
}

/* ── Upload Section ─────────────────────────────────────────────────── */
.upload-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    color: var(--text-secondary);
    transition: all 0.25s;
    cursor: pointer;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--gold);
    background: rgba(212, 160, 23, 0.04);
}

.upload-label {
    color: var(--gold-light);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.upload-hint {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-top: 0.625rem;
}

/* ── Footer ─────────────────────────────────────────────────────────── */
.footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.footer-copy { font-weight: 500; }

.sitelock-seal img { height: 40px; width: auto; display: block; }
.footer-version { font-size: 0.6875rem; opacity: 0.5; }

.footer-links a {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--gold-light); }

/* ── Login Overlay ──────────────────────────────────────────────────── */
.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-overlay::before {
    content: '';
    position: absolute;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(212, 160, 23, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    text-align: center;
    padding: 3.5rem 3rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 90%;
    position: relative;
}

.login-logo {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.75rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn-google:hover {
    background: rgba(212, 160, 23, 0.08);
    border-color: rgba(212, 160, 23, 0.3);
    box-shadow: 0 4px 16px rgba(212, 160, 23, 0.1);
}

.btn-google:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

[data-theme="light"] .btn-google {
    background: white;
    color: #3c4043;
    border-color: #dadce0;
}

[data-theme="light"] .btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.login-error {
    color: var(--danger);
    font-size: 0.8125rem;
    margin-top: 1rem;
}

.login-footer {
    color: var(--text-tertiary);
    font-size: 0.6875rem;
    margin-top: 2.5rem;
    line-height: 1.6;
}

/* ── Waitlist Overlay ───────────────────────────────────────────────── */
.waitlist-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.waitlist-card {
    text-align: center;
    padding: 3.5rem 3rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 460px;
    width: 90%;
}

.waitlist-card h2 {
    color: var(--gold-light);
    margin-bottom: 1rem;
    font-weight: 700;
}

.waitlist-card p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.waitlist-sub {
    font-size: 0.8125rem;
    color: var(--text-tertiary) !important;
    margin-bottom: 1.5rem !important;
}

/* ── Nav icon buttons ───────────────────────────────────────────────── */
.nav-icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.nav-icon-btn:hover { background: rgba(212, 160, 23, 0.08); color: var(--text-primary); }

/* ── Avatar button & dropdown ──────────────────────────────────────── */
.avatar-wrap { position: relative; }

.avatar-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.625rem;
    cursor: pointer;
    transition: background 0.15s;
    color: var(--text-primary);
}
.avatar-trigger:hover { background: rgba(212, 160, 23, 0.08); }

.avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4a017, #b8860b);
    color: #0f172a;
    font-size: 0.6875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    user-select: none;
}
.avatar-circle-lg { width: 40px; height: 40px; font-size: 0.875rem; }

.avatar-name {
    font-size: 0.8125rem;
    color: var(--text-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chevron { color: var(--text-secondary); flex-shrink: 0; }

.avatar-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 600;
    min-width: 220px;
    overflow: hidden;
}
.avatar-menu.hidden { display: none; }

.avatar-menu-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
}
.avatar-menu-display {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}
.avatar-menu-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}
.avatar-menu-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }
.avatar-menu-label {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    padding: 0.375rem 1rem 0.125rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.avatar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.avatar-menu-item:hover { background: rgba(212, 160, 23, 0.08); }
.avatar-menu-danger { color: var(--color-loss); }
.avatar-menu-danger:hover { background: rgba(239, 68, 68, 0.08); }

/* ── Toast Notifications ────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 420px;
    width: calc(100% - 2rem);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius);
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 0.8125rem;
    color: var(--text-primary);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-show { opacity: 1; transform: translateX(0); }
.toast-hide { opacity: 0; transform: translateX(100%); }

.toast-icon { font-size: 1.125rem; line-height: 1.2; flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.4; word-break: break-word; }

.toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.toast-close:hover { color: var(--text-primary); }

.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }

.toast-error { border-left: 3px solid var(--danger); }
.toast-error .toast-icon { color: var(--danger); }

.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-info { border-left: 3px solid var(--info); }
.toast-info .toast-icon { color: var(--info); }

/* ── Upload Result ──────────────────────────────────────────────────── */
.upload-result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.upload-result-count {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--success);
}

.upload-result-broker,
.upload-result-type {
    font-size: 0.6875rem;
    padding: 2px 10px;
    border-radius: 4px;
    background: rgba(212, 160, 23, 0.1);
    color: var(--gold-light);
    font-weight: 500;
}

.upload-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

/* ── Speed Dial FAB ─────────────────────────────────────────────────── */
.speed-dial-backdrop {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99;
}
.speed-dial-backdrop.visible { display: block; }

.speed-dial {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.625rem;
    z-index: 100;
}

.speed-dial-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    color: #0f172a;
    border: none;
    box-shadow: 0 4px 20px rgba(212, 160, 23, 0.4);
    cursor: pointer;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s, box-shadow 0.25s;
    order: 2;
}
.speed-dial-main:hover { box-shadow: 0 6px 28px rgba(212, 160, 23, 0.5); }
.speed-dial.open .speed-dial-main { transform: rotate(45deg); }

.speed-dial-options {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    order: 1;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
}
.speed-dial.open .speed-dial-options {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

.speed-dial-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg-card-solid);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    white-space: nowrap;
    box-shadow: var(--shadow);
    transition: background 0.15s, border-color 0.15s;
}
.speed-dial-option:hover {
    background: rgba(212, 160, 23, 0.1);
    border-color: rgba(212, 160, 23, 0.3);
}

/* ── Price Timestamp ────────────────────────────────────────────────── */
.price-timestamp {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-left: 0.5rem;
    font-style: italic;
}

/* ── Edit Button (on row hover) ─────────────────────────────────────── */
.edit-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    opacity: 0;
    font-family: var(--font);
}
tr:hover .edit-btn { opacity: 1; }
.edit-btn:hover {
    color: var(--gold-light);
    border-color: rgba(212, 160, 23, 0.3);
    background: rgba(212, 160, 23, 0.08);
}

/* ── Holding Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gold-light);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.375rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.modal-close-btn:hover { color: var(--text-primary); }

.modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
}
.form-row label {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}
.form-row input,
.form-row select {
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s;
}
.form-row input:focus,
.form-row select:focus { border-color: var(--gold); }
.form-row input:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
}

.btn-danger {
    padding: 0.4375rem 0.875rem;
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-sm);
    background: rgba(248, 113, 113, 0.08);
    color: var(--danger);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.15s;
    margin-right: auto;
}
.btn-danger:hover {
    background: rgba(248, 113, 113, 0.16);
    border-color: rgba(248, 113, 113, 0.5);
}
.btn-danger.hidden { display: none; }

/* ── Export Dropdown ────────────────────────────────────────────────── */
.export-dropdown { position: relative; }

.export-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 600;
    min-width: 160px;
    overflow: hidden;
}
.export-menu.hidden { display: none; }

.export-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: var(--font);
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.export-menu-item:hover { background: rgba(212, 160, 23, 0.1); }
.export-menu-item .export-icon { font-size: 1rem; width: 1.25rem; text-align: center; }

/* ── Print / PDF ────────────────────────────────────────────────────── */
@media print {
    .speed-dial, .speed-dial-backdrop, .modal-overlay,
    .login-overlay, .waitlist-overlay, .toast-container,
    .header-right, .tab-nav, .filter-row, .search-row, .upload-zone,
    .price-timestamp, .edit-btn, #fileInput { display: none !important; }

    /* Show all panels for full-portfolio print */
    .panel { display: block !important; }
    .panel + .panel { page-break-before: always; }

    /* Clean white layout */
    body, .app { background: #fff !important; color: #111 !important; }
    .metric-card {
        background: #f8f8f8 !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    .metric-value { color: #111 !important; }
    .metric-value.up { color: #15803d !important; }
    .metric-value.dn { color: #b91c1c !important; }
    .metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }

    table { border-collapse: collapse; width: 100%; font-size: 11px; }
    th { background: #f0f0f0 !important; color: #111 !important; border: 1px solid #ccc; padding: 4px 6px; }
    td { border: 1px solid #ddd; padding: 3px 6px; }
    tr:nth-child(even) td { background: #fafafa; }

    .app { padding: 0 !important; max-width: 100% !important; }
    .header { padding: 0.5rem 0 !important; border-bottom: 2px solid #ccc !important; }
    .logo { font-size: 1.2rem !important; }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
    .header { flex-wrap: wrap; gap: 0.625rem; }
    .header-brand { flex: 1 1 auto; }
    .header-status { order: 3; flex: 0 0 100%; justify-content: flex-start; }
    .header-actions { flex: 0 0 auto; }
    .app { padding: 0.75rem; }
    .subtitle { display: none; }
    .avatar-name { display: none; }
    .sync-status { display: none; }
    .search-row { flex-wrap: wrap; }
    .search-input { width: 100%; }
    .filter-select { flex: 1; min-width: 0; }

    /* Hide inline upload on mobile; speed dial handles it */
    .upload-section { display: none; }

    /* Prevent table overflow */
    .table-wrap { -webkit-overflow-scrolling: touch; }

    /* Tighter metric cards */
    .metric-card { padding: 0.875rem 1rem; }
    .metric-value { font-size: 1.25rem; }
    .metric-label { font-size: 0.625rem; }
    .metric-sub { font-size: 0.625rem; }
}

@media (max-width: 480px) {
    .app { padding: 0.5rem; }
    .metrics-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .tabs { gap: 0; padding: 0.25rem; }
    .tab { padding: 0.4375rem 0.625rem; font-size: 0.6875rem; }
    .chip { font-size: 0.5625rem; padding: 0 4px; }
    .toast-container { top: 0.5rem; right: 0.5rem; max-width: 100%; width: calc(100% - 1rem); }
    .footer-content { flex-direction: column; gap: 0.375rem; }
    .header { padding: 0.625rem 0.75rem; margin-bottom: 1rem; }
    .header-right { gap: 0.375rem; }
    .logo { font-size: 1.125rem; }
    .chart-card { padding: 1rem; }
    .chart-container { height: 200px; }
    .speed-dial { bottom: 1rem; right: 1rem; }
    .speed-dial-main { width: 50px; height: 50px; font-size: 1.5rem; }
}
