:root {
    --bg-main: #090d16;
    --bg-card: #111827;
    --bg-card-hover: #1a2234;
    --border: #1f2937;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --green: #10b981;
    --green-bg: rgba(16, 185, 129, 0.12);
    --red: #f43f5e;
    --red-bg: rgba(244, 63, 94, 0.12);
    --amber: #f59e0b;
    --accent: #3b82f6;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1240px; margin: 0 auto; padding: 32px 16px 64px; }

/* Header */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}
.brand h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.brand p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.kpi-card {
    background: linear-gradient(180deg, #131b2e 0%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}
.kpi-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 1.75rem; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* Cards & Chart */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 28px;
    overflow: hidden;
}
.panel-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-header h2 { font-size: 1.05rem; font-weight: 600; }
#equity-chart { width: 100%; height: 270px; }

/* Table */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 10px 10px;
    font-size: 0.84rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.8rem; }
.text-right { text-align: right; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--text-muted); }

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-long { background: var(--green-bg); color: var(--green); }
.badge-short { background: var(--red-bg); color: var(--red); }
.badge-broker { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); margin-right: 4px; }

.thumb-btn {
    background: none;
    border: 1px solid #374151;
    border-radius: 5px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    display: inline-flex;
    transition: border-color 0.15s, transform 0.15s;
}
.thumb-btn:hover { border-color: var(--green); transform: scale(1.04); }
.thumb-img { width: 48px; height: 28px; object-fit: cover; display: block; }

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.88);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-box {
    background: var(--bg-card);
    border: 1px solid #374151;
    border-radius: 16px;
    max-width: 960px;
    width: 100%;
    padding: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}
.modal-box img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: #000; }
.modal-notes { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.9rem; color: var(--text-muted); }
.modal-notes strong { color: var(--text-main); }

.footer { margin-top: 32px; text-align: center; font-size: 0.78rem; color: var(--text-muted); }
.footer a { color: var(--text-muted); text-decoration: none; }
.footer a:hover { color: var(--text-main); }

/* Language Switcher */
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lang-switch {
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}
.lang-switch a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.lang-switch a:hover { color: var(--text-main); }
.lang-switch a.active { background: var(--accent); color: #ffffff; }
/* Company Logo & Ticker Badge */
.ticker-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}
.ticker-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    background: #1f2937;
    border: 1px solid #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ticker-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ticker-fallback {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-main);
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}