/* ========================================================================
   BrokerHQ Redesign v2 — Core Stylesheet
   Font: DM Sans + Space Grotesk | Grid: 8pt | No gradients | No emojis
   ======================================================================== */

/* Fonts loaded via <link> in layout.ejs (DM Sans + Space Grotesk) */

/* ── CSS Custom Properties ── */
:root {
  --bg-primary: #0F1117;
  --bg-secondary: #161B22;
  --bg-tertiary: #1C2129;
  --border: #21262D;
  --border-light: #30363D;
  --text-primary: #E6EDF3;
  --text-secondary: #B1BAC4;
  --text-muted: #8B949E;
  --text-faint: #6E7681;
  --accent: #00BCD4;
  --accent-hover: #00ACC1;
  --accent-muted: rgba(0, 188, 212, 0.15);
  --accent-text: #00E5FF;
  --positive: #3FB950;
  --positive-bg: rgba(63, 185, 80, 0.12);
  --negative: #F85149;
  --negative-bg: rgba(248, 81, 73, 0.12);
  --warning: #D29922;
  --warning-bg: rgba(210, 153, 34, 0.12);
  --info: #58A6FF;
  --card-bg: #161B22;
  --card-border: #21262D;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
  --input-bg: #0D1117;
  --input-border: #30363D;
  --table-header-bg: #161B22;
  --table-row-hover: rgba(0, 188, 212, 0.06);
  --table-stripe: rgba(255,255,255,0.02);
  --nav-bg: #0D1117;
  --nav-border: #21262D;
  --nav-hover: #161B22;
  --nav-active: #1C2129;
  --toast-bg: #1C2129;
  --toast-border: #30363D;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Grotesk', 'SF Mono', monospace;
  --transition: 150ms ease;
}

[data-theme="light"] {
  --bg-primary: #FAFBFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F6F8FA;
  --border: #D1D9E0;
  --border-light: #E1E4E8;
  --text-primary: #1F2328;
  --text-secondary: #424A53;
  --text-muted: #656D76;
  --text-faint: #8C959F;
  --accent: #0097A7;
  --accent-hover: #00838F;
  --accent-muted: rgba(0, 151, 167, 0.1);
  --accent-text: #006064;
  --positive: #1A7F37;
  --positive-bg: rgba(26, 127, 55, 0.08);
  --negative: #CF222E;
  --negative-bg: rgba(207, 34, 46, 0.08);
  --warning: #9A6700;
  --warning-bg: rgba(154, 103, 0, 0.08);
  --info: #0969DA;
  --card-bg: #FFFFFF;
  --card-border: #D1D9E0;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
  --input-bg: #FFFFFF;
  --input-border: #D1D9E0;
  --table-header-bg: #F6F8FA;
  --table-row-hover: rgba(0, 151, 167, 0.05);
  --table-stripe: rgba(0,0,0,0.02);
  --nav-bg: #FFFFFF;
  --nav-border: #D1D9E0;
  --nav-hover: #F6F8FA;
  --nav-active: #EFF2F5;
  --toast-bg: #FFFFFF;
  --toast-border: #D1D9E0;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font-sans); font-size: 14px; line-height: 1.5; color: var(--text-primary); background: var(--bg-primary); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ── Typography ── */
.page-title { font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--text-primary); }
.section-header { font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--text-primary); }
.label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.mono { font-family: var(--font-mono); }

/* ── Top Navigation ── */
.topnav { position: fixed; top: 0; left: 0; right: 0; height: 56px; background: var(--nav-bg); border-bottom: 1px solid var(--nav-border); display: flex; align-items: center; padding: 0 24px; z-index: 1000; }
.topnav-brand { font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--accent); margin-right: 32px; white-space: nowrap; letter-spacing: -0.02em; }
.topnav-brand span { color: var(--text-muted); font-weight: 400; }
.topnav-menu { display: flex; align-items: center; flex: 1; list-style: none; }
.topnav-menu > li { position: relative; }
.topnav-menu > li > a { display: flex; align-items: center; gap: 4px; padding: 8px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary); border-radius: var(--radius-sm); transition: all var(--transition); white-space: nowrap; }
.topnav-menu > li > a:hover, .topnav-menu > li > a.active { color: var(--text-primary); background: var(--nav-hover); }
.topnav-menu > li > a.active { color: var(--accent); }
.topnav-menu > li > a .arrow { font-size: 8px; margin-left: 2px; opacity: 0.5; }
.topnav-dropdown { display: none; position: absolute; top: 100%; left: 0; min-width: 180px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,0.25); padding: 6px 0; z-index: 1001; list-style: none; }
.topnav-menu > li:hover > .topnav-dropdown { display: block; }
.topnav-dropdown li a { display: block; padding: 8px 16px; font-size: 13px; color: var(--text-secondary); transition: all var(--transition); }
.topnav-dropdown li a:hover { color: var(--text-primary); background: var(--nav-hover); }
.topnav-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.theme-toggle { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 16px; transition: all var(--transition); }
.theme-toggle:hover { background: var(--nav-hover); color: var(--text-primary); }

/* ── Main Content ── */
.main-content { margin-top: 56px; padding: 24px; max-width: 1600px; margin-left: auto; margin-right: auto; }
.main-content.full-width { max-width: 100%; padding: 16px 20px; }

/* ── Page Header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-header-left { display: flex; align-items: baseline; gap: 12px; }
.page-header .page-title { margin: 0; }
.page-subtitle { font-size: 13px; color: var(--text-muted); }

/* ── Cards ── */
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-md); box-shadow: var(--card-shadow); padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }

/* ── KPI Cards ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-md); box-shadow: var(--card-shadow); padding: 20px; position: relative; }
.kpi-card .label { margin-bottom: 8px; }
.kpi-value { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.kpi-change { font-size: 12px; font-weight: 500; margin-top: 6px; }
.kpi-change.positive { color: var(--positive); }
.kpi-change.negative { color: var(--negative); }
.kpi-change.neutral { color: var(--text-muted); }
.kpi-change.accent-change { color: var(--accent); }

.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1200px) { .kpi-grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .kpi-grid-5 { grid-template-columns: 1fr 1fr; } }

.kpi-clickable { text-decoration: none; color: inherit; cursor: pointer; transition: all var(--transition); overflow: hidden; }
.kpi-clickable:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 188, 212, 0.12); color: inherit; }
.kpi-arrow { position: absolute; top: 12px; right: 12px; font-size: 14px; color: var(--text-faint); transition: all var(--transition); }
.kpi-clickable:hover .kpi-arrow { color: var(--accent); transform: translateX(3px); }
.kpi-profit .kpi-value { color: var(--positive); }

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-sidebar { display: grid; grid-template-columns: 320px 1fr; gap: 24px; }

/* ── Tables ── */
.table-container { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { position: sticky; top: 0; z-index: 10; }
thead th { background: var(--table-header-bg); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; }
thead th:hover { color: var(--text-primary); }
thead th .sort-arrow { margin-left: 4px; font-size: 9px; opacity: 0.3; display: inline-block; transition: opacity 0.15s, transform 0.15s, color 0.15s; }
thead th.asc .sort-arrow, thead th.desc .sort-arrow { opacity: 1; color: var(--accent); }
thead th.asc .sort-arrow { transform: rotate(180deg); }
thead th:hover .sort-arrow { opacity: 0.6; }
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:nth-child(even) { background: var(--table-stripe); }
tbody tr:hover { background: var(--table-row-hover); }
tbody td { padding: 10px 14px; color: var(--text-primary); white-space: nowrap; }
td.num { font-family: var(--font-mono); text-align: right; font-size: 13px; font-weight: 500; }
td.positive { color: var(--positive); }
td.negative { color: var(--negative); }
td.warning { color: var(--warning); }
td.accent { color: var(--accent); }
tr.clickable { cursor: pointer; }

/* ── Tabs ── */
.tabs { display: flex; align-items: center; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; cursor: pointer; transition: all var(--transition); background: none; border-top: none; border-left: none; border-right: none; white-space: nowrap; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 6px; font-size: 11px; font-weight: 600; background: var(--accent-muted); color: var(--accent); border-radius: 10px; margin-left: 6px; }

/* ── Filter Bar ── */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; max-width: 400px; padding: 8px 12px 8px 36px; font-size: 13px; font-family: var(--font-sans); color: var(--text-primary); background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--radius-sm); outline: none; transition: border-color var(--transition); }
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-faint); }
.search-wrapper { position: relative; flex: 1; min-width: 200px; max-width: 400px; }
.search-wrapper .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 14px; pointer-events: none; }

.filter-btn.active-filter { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }

.filter-date-group { display: flex; align-items: center; gap: 6px; }
.form-input-sm { padding: 4px 8px !important; font-size: 12px !important; width: 130px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: 13px; font-weight: 500; font-family: var(--font-sans); border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover { background: var(--nav-hover); color: var(--text-primary); border-color: var(--border-light); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; padding: 6px 10px; }
.btn-ghost:hover { color: var(--text-primary); background: var(--nav-hover); }

/* ── Pills ── */
.pill { display: inline-flex; align-items: center; padding: 3px 10px; font-size: 11px; font-weight: 600; border-radius: 12px; white-space: nowrap; }
.pill-green { background: var(--positive-bg); color: var(--positive); }
.pill-red { background: var(--negative-bg); color: var(--negative); }
.pill-yellow { background: var(--warning-bg); color: var(--warning); }
.pill-gray { background: rgba(139,148,158,0.12); color: var(--text-muted); }
.pill-accent { background: var(--accent-muted); color: var(--accent); }
.tier-confident { background: var(--positive-bg); color: var(--positive); }
.tier-potential { background: var(--warning-bg); color: var(--warning); }
.tier-skip { background: rgba(139,148,158,0.12); color: var(--text-muted); }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 10px 12px; font-size: 14px; font-family: var(--font-sans); color: var(--text-primary); background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--radius-sm); outline: none; transition: border-color var(--transition); }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.option-group { display: flex; gap: 8px; flex-wrap: wrap; }
.option-btn { padding: 8px 16px; font-size: 13px; font-weight: 500; font-family: var(--font-sans); color: var(--text-muted); background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition); }
.option-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.option-btn.selected { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }

/* ── Modal ── */
.modal-backdrop { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 2000; align-items: center; justify-content: center; }
.modal-backdrop.active { display: flex; }
.modal { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 16px 48px rgba(0,0,0,0.4); width: 90%; min-width: 600px; max-width: 900px; max-height: 85vh; overflow-y: auto; padding: 0; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 18px; font-weight: 600; }
.modal-close { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; font-size: 16px; transition: all var(--transition); }
.modal-close:hover { background: var(--nav-hover); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Toast ── */
.toast-container { position: fixed; top: 72px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-top-right { top: 72px; right: 24px; left: auto; bottom: auto; }
.toast { background: var(--toast-bg); border: 1px solid var(--toast-border); border-radius: var(--radius-md); box-shadow: 0 4px 12px rgba(0,0,0,0.3); padding: 12px 16px; font-size: 13px; color: var(--text-primary); display: flex; align-items: center; gap: 8px; pointer-events: auto; animation: toastIn 200ms ease; max-width: 320px; }
.toast.success { border-left: 3px solid var(--positive); }
.toast.error { border-left: 3px solid var(--negative); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.toast.removing { animation: toastOut 200ms ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ── Chat (Broker Brain) ── */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; gap: 0; height: calc(100vh - 56px - 48px); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.chat-sidebar { background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.chat-sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.chat-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-list-item { padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 2px; transition: background var(--transition); }
.chat-list-item:hover { background: var(--nav-hover); }
.chat-list-item.active { background: var(--accent-muted); }
.chat-list-item .chat-title { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.chat-list-item .chat-preview { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-main { display: flex; flex-direction: column; background: var(--bg-primary); }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.chat-message { max-width: 70%; padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; line-height: 1.6; }
.chat-message.user { align-self: flex-end; background: var(--accent); color: #000; }
.chat-message.assistant { align-self: flex-start; background: var(--card-bg); border: 1px solid var(--border); color: var(--text-primary); }
.chat-input-area { padding: 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input { flex: 1; padding: 10px 14px; font-size: 14px; font-family: var(--font-sans); background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--radius-sm); color: var(--text-primary); outline: none; }
.chat-input:focus { border-color: var(--accent); }
.chat-prompts { padding: 16px 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.chat-prompt-chip { padding: 6px 12px; font-size: 12px; font-weight: 500; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; transition: all var(--transition); }
.chat-prompt-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ── Chart ── */
.chart-area { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); height: 200px; display: flex; align-items: flex-end; padding: 16px; gap: 4px; }
.chart-bar { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-width: 20px; transition: height 300ms ease; }
.chart-bar:hover { opacity: 0.8; }

/* ── Metric Cards ── */
.metric-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 16px 0; }
.metric-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.metric-card .label { margin-bottom: 4px; }
.metric-card .value { font-family: var(--font-mono); font-size: 20px; font-weight: 700; }

/* ── Utilities ── */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-positive { color: var(--positive); }
.text-negative { color: var(--negative); }
.text-warning { color: var(--warning); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .topnav { padding: 0 12px; }
  .main-content { padding: 16px 12px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .modal { min-width: auto; width: 95%; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 32px; margin-bottom: 12px; opacity: 0.4; }

/* ── Account Status ── */
.status-making-juice { background: rgba(0, 188, 212, 0.12); color: #00BCD4; }
.status-marinating { background: rgba(210, 153, 34, 0.12); color: #D29922; }
.status-ready-to-test { background: rgba(63, 185, 80, 0.12); color: #3FB950; }
.status-normal-use { background: rgba(139, 148, 158, 0.12); color: #8B949E; }
.status-top-100 { background: rgba(248, 81, 73, 0.12); color: #F85149; }

/* ── Inline check ── */
.inline-check { display: inline-flex; align-items: center; color: var(--positive); font-size: 14px; font-weight: 600; animation: checkPop 300ms ease; }
@keyframes checkPop { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; } }

/* ── Lessons ── */
.lessons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.lesson-card { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.lesson-card .lesson-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.lesson-card .lesson-body { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── Bookkeeping ── */
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.summary-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-md); padding: 24px; text-align: center; }
.summary-card .label { margin-bottom: 8px; }
.summary-card .value { font-family: var(--font-mono); font-size: 32px; font-weight: 700; }

/* ══════════════════════════════════════════════════════════════
   v2 — Events amber columns
   ══════════════════════════════════════════════════════════════ */
.col-amber { color: #F59E0B !important; }

/* ══════════════════════════════════════════════════════════════
   v2 — Artist Performance Card
   ══════════════════════════════════════════════════════════════ */
.artist-perf-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.artist-perf-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════
   v2 — Venues: Missing Capacity & Bulk Search
   ══════════════════════════════════════════════════════════════ */
.row-missing-cap { background: rgba(210, 153, 34, 0.04) !important; }
.capacity-missing { display: inline-flex; align-items: center; gap: 8px; }
.capacity-edit { display: inline-flex; align-items: center; gap: 6px; }
.bulk-progress-bar { width: 100%; height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; }
.bulk-progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 400ms ease; }
#venues-table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   v2 — Mission Control: Team Rocket Theme
   ══════════════════════════════════════════════════════════════ */
.mc-panel {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 24px;
  overflow: hidden;
}

/* Giant "R" watermark */
.mc-watermark {
  position: absolute;
  top: 50%;
  right: 40px;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 300px;
  font-weight: 900;
  line-height: 1;
  color: rgba(248, 81, 73, 0.035);
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.05em;
  z-index: 0;
}
[data-theme="light"] .mc-watermark { color: rgba(248, 81, 73, 0.06); }

/* Header */
.mc-header {
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
}
.mc-title-row { display: flex; align-items: baseline; gap: 12px; }
.mc-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.mc-subtitle { font-size: 12px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.03em; }

/* Sections */
.mc-section { position: relative; z-index: 1; margin-bottom: 20px; }
.mc-section:last-child { margin-bottom: 0; }
.mc-section-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.mc-grunt-count { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-faint); font-size: 10px; }

/* Agent cards */
.mc-agent-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg-tertiary);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  transition: all var(--transition);
}
.mc-agent-card.mc-inactive { opacity: 0.55; }
.mc-agent-card.mc-inactive:hover { opacity: 0.75; }
.mc-agent-card.mc-leader {
  border-color: var(--positive);
  border-left: 3px solid var(--positive);
  background: rgba(63, 185, 80, 0.04);
}
.mc-agent-card.mc-boss { border-left: 3px solid var(--text-muted); }

/* Avatars */
.mc-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.mc-avatar-boss { background: rgba(139,148,158,0.15); color: var(--text-muted); border: 2px solid var(--border-light); }
.mc-avatar-gio { background: rgba(248,81,73,0.15); color: #F85149; border: 2px solid rgba(248,81,73,0.4); }
.mc-avatar-exec { background: rgba(139,148,158,0.1); color: var(--text-faint); border: 2px solid var(--border); }
.mc-avatar-field { background: rgba(139,148,158,0.1); color: var(--text-faint); border: 2px solid var(--border); }

/* Agent info */
.mc-agent-info { flex: 1; min-width: 0; }
.mc-agent-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.mc-nickname { font-weight: 400; color: var(--text-muted); }
.mc-agent-role { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.mc-last-action { font-size: 11px; color: var(--text-faint); margin-top: 3px; font-style: italic; }

/* Status */
.mc-status-area { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mc-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mc-dot-online { background: var(--positive); box-shadow: 0 0 6px rgba(63,185,80,0.5); animation: pulse-green 2s ease-in-out infinite; }
.mc-dot-offline { background: var(--text-faint); }
.mc-dot-inactive { background: var(--text-faint); opacity: 0.5; }
.mc-dot-working { background: #F59E0B; box-shadow: 0 0 6px rgba(245,158,11,0.5); animation: pulse-amber 1.5s ease-in-out infinite; }
.mc-dot-error { background: var(--negative); box-shadow: 0 0 6px rgba(248,81,73,0.5); }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 6px rgba(63,185,80,0.5); }
  50% { box-shadow: 0 0 12px rgba(63,185,80,0.8); }
}
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 6px rgba(245,158,11,0.5); }
  50% { box-shadow: 0 0 12px rgba(245,158,11,0.8); }
}

.mc-status-label { font-size: 11px; font-weight: 600; white-space: nowrap; }
.mc-label-online { color: var(--positive); }
.mc-label-inactive { color: var(--text-faint); }
.mc-label-working { color: #F59E0B; }
.mc-label-error { color: var(--negative); }

/* Connector */
.mc-connector-v { width: 2px; height: 16px; background: var(--border-light); margin: 0 0 0 34px; }

/* Boss row */
.mc-boss-row { display: flex; flex-direction: column; max-width: 520px; }

/* Exec & Field grids */
.mc-exec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mc-field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

/* ── Grunts ── */
.mc-grunts-row { display: flex; gap: 10px; flex-wrap: wrap; }
.mc-grunt-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--bg-tertiary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  min-width: 220px; max-width: 340px;
}
.mc-grunt-card.mc-grunt-complete { opacity: 0.45; }
.mc-grunt-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: rgba(139,148,158,0.1); color: var(--text-faint);
  border: 1.5px solid var(--border); flex-shrink: 0;
}
.mc-grunt-working .mc-grunt-avatar { border-color: rgba(245,158,11,0.4); color: #F59E0B; background: rgba(245,158,11,0.08); }
.mc-grunt-info { min-width: 0; }
.mc-grunt-task { font-size: 12px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-grunt-complete .mc-grunt-task { color: var(--text-muted); }
.mc-grunt-meta { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.mc-grunt-status { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.mc-grunt-working .mc-grunt-status { color: #F59E0B; }
.mc-grunt-complete .mc-grunt-status { color: var(--positive); }
.mc-grunt-elapsed { font-size: 10px; color: var(--text-faint); margin-left: 4px; }
.mc-grunt-check { color: var(--positive); font-size: 12px; font-weight: 700; }
.mc-no-grunts { font-size: 12px; color: var(--text-faint); font-style: italic; padding: 8px 0; }

/* Responsive MC */
@media (max-width: 900px) {
  .mc-exec-grid { grid-template-columns: 1fr; }
  .mc-field-grid { grid-template-columns: 1fr; }
  .mc-watermark { font-size: 160px; right: 20px; }
}

/* ========================================================================
   BrokerHQ Compatibility Layer
   Maps old class names and variables to the redesign design system
   ======================================================================== */

/* ── Variable Aliases (old → new) ── */
:root, [data-theme="dark"] {
  --bg-card: var(--card-bg);
  --bg-elevated: var(--bg-tertiary);
  --bg-hover: var(--nav-hover);
  --bg-input: var(--input-bg);
  --border-primary: var(--border);
  --border-secondary: var(--border-light);
  --border-hover: var(--border-light);
  --border-focus: var(--accent);
  --text-dim: var(--text-faint);
  --green: var(--positive);
  --green-light: #2eeaa0;
  --green-dim: var(--positive-bg);
  --green-glow: rgba(63, 185, 80, 0.15);
  --green-border: rgba(63, 185, 80, 0.25);
  --red: var(--negative);
  --red-dim: var(--negative-bg);
  --yellow: var(--warning);
  --yellow-dim: var(--warning-bg);
  --orange: #FF8C42;
  --orange-dim: rgba(255, 140, 66, 0.10);
  --blue: var(--info);
  --blue-dim: rgba(88, 166, 255, 0.10);
  --cyan: var(--accent);
  --cyan-dim: var(--accent-muted);
  --purple: #A78BFA;
  --purple-dim: rgba(167, 139, 250, 0.10);
  --shadow-card: var(--card-shadow);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
  --radius-xl: var(--radius-lg);
  --sidebar-width: 0px;
  --sidebar-collapsed: 0px;
  --transition-fast: var(--transition);
  --transition-normal: var(--transition);
  --transition-slow: 300ms ease;
  /* font-sans and font-mono inherited from :root — do not re-declare */
}

/* ── App Layout — No Sidebar ── */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Theme Toggle (old floating style) ── */
.theme-toggle-fixed {
  position: fixed;
  top: 10px;
  right: 16px;
  z-index: 1100;
}

/* ── Login Page ── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
}

.login-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.login-box h1 {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.login-box .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.error-message {
  background: var(--negative-bg);
  color: var(--negative);
  border: 1px solid rgba(248,81,73,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Old Form Group Styles ── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group input::placeholder {
  color: var(--text-faint);
}

/* ── Buttons (compatibility) ── */
.btn-success {
  background: var(--positive);
  color: #000;
  border-color: var(--positive);
}

.btn-warning {
  background: var(--warning);
  color: #000;
  border-color: var(--warning);
}

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

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Data Tables (old .data-table class) ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--table-header-bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-family: var(--font-mono);
  position: sticky;
  top: 0;
  z-index: 2;
  cursor: pointer;
  user-select: none;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  white-space: nowrap;
  font-size: 13px;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:nth-child(even) {
  background: var(--table-stripe);
}

.data-table tbody tr:hover {
  background: var(--table-row-hover);
}

/* ── Stat Cards ── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before { display: none; }
.stat-card::after { display: none; }

.stat-card:hover {
  border-color: var(--border-light);
}

.stat-card .label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-card .value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-card.cyan .value { color: var(--accent); }
.stat-card.green .value { color: var(--positive); }
.stat-card.yellow .value { color: var(--warning); }
.stat-card.red .value { color: var(--negative); }
.stat-card.orange .value { color: #FF8C42; }
.stat-card.blue .value { color: var(--info); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.compact-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ── Status Badges ── */
.status-watching {
  background: rgba(88,166,255,0.12);
  color: var(--info);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.status-bought {
  background: var(--positive-bg);
  color: var(--positive);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.status-sold-out {
  background: var(--negative-bg);
  color: var(--negative);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Badge System ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-confident { background: var(--positive-bg); color: var(--positive); border: 1px solid rgba(63,185,80,0.25); }
.badge-potential { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(210,153,34,0.25); }
.badge-skip { background: rgba(139,148,158,0.12); color: var(--text-muted); border: 1px solid var(--border); }
.badge-active { background: var(--positive-bg); color: var(--positive); border: 1px solid rgba(63,185,80,0.25); }
.badge-warning { background: rgba(255,140,66,0.12); color: #FF8C42; border: 1px solid rgba(255,140,66,0.25); }
.badge-danger { background: var(--negative-bg); color: var(--negative); border: 1px solid rgba(248,81,73,0.25); }
.badge-info { background: rgba(88,166,255,0.12); color: var(--info); border: 1px solid rgba(88,166,255,0.25); }
.badge-neutral { background: rgba(139,148,158,0.12); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-purple { background: rgba(167,139,250,0.12); color: #A78BFA; border: 1px solid rgba(167,139,250,0.25); }
.badge-cyan { background: var(--accent-muted); color: var(--accent); border: 1px solid rgba(0,188,212,0.25); }

/* ── Value Colors ── */
.val-positive { color: var(--positive); font-weight: 600; }
.val-negative { color: var(--negative); font-weight: 600; }
.val-warning { color: var(--warning); font-weight: 600; }
.val-neutral { color: var(--text-secondary); }
.val-highlight { color: var(--accent); font-weight: 600; }
.val-accent { color: var(--accent-text); font-weight: 600; }
.val-muted { color: var(--text-muted); font-weight: 400; }
.value-positive { color: var(--positive); }
.value-negative { color: var(--negative); }
.value-warning { color: var(--warning); }
.value-muted { color: var(--text-muted); }

/* ── Trend Indicators ── */
.trend-up { color: var(--positive); }
.trend-up::before { content: '▲ '; font-size: 9px; }
.trend-down { color: var(--negative); }
.trend-down::before { content: '▼ '; font-size: 9px; }
.trend-flat { color: var(--text-muted); }

/* ── Monospace ── */
.mono-sm { font-family: var(--font-mono); font-size: 11px; }
.mono-lg { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.val-currency { font-family: var(--font-mono); font-size: 12px; }
.val-currency::before { content: '$'; opacity: 0.5; }

/* ── Dot Indicators ── */
.dot-indicator { display: inline-flex; align-items: center; gap: 6px; }
.dot-indicator::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-green::before { background: var(--positive); }
.dot-yellow::before { background: var(--warning); }
.dot-red::before { background: var(--negative); }
.dot-blue::before { background: var(--info); }
.dot-gray::before { background: var(--text-muted); }
.dot-orange::before { background: #FF8C42; }

/* ── Table Variants ── */
.table-compact th { padding: 8px 12px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; }
.table-compact td { padding: 7px 12px; font-size: 13px; }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--border); }

.table-wrapper { overflow-x: auto; }
.table-scroll { overflow-x: auto; overflow-y: auto; max-height: 70vh; }
.table-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

/* ── Search Box (old) ── */
.search-box { display: flex; gap: 12px; align-items: center; }
.search-box input {
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  width: 220px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }

/* ── Tab Content ── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Filter Buttons ── */
.filter-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--border-light); color: var(--text-primary); }
.filter-btn.active { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }

/* ── Card Body ── */
.card-body { padding: 20px; }
.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* ── Modal Overlay (old class) ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-overlay .modal { transform: scale(0.95) translateY(10px); }

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 18px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--nav-hover); color: var(--text-primary); }

/* ── Page Header ── */
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

.page-header .subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Chat/Broker Brain ── */
.ai-chat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
}

.ai-chat-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.ai-chat-header h2 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-chat-header h2 svg { width: 22px; height: 22px; color: var(--accent); }
.ai-chat-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.ai-chat-empty .brain-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.ai-chat-empty p { font-size: 14px; }

.chat-message.user .chat-bubble {
  background: var(--accent);
  color: #000;
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.chat-bubble {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-avatar svg { width: 16px; height: 16px; color: var(--text-muted); }
.chat-message.user .chat-avatar { background: var(--accent-muted); }
.chat-message.user .chat-avatar svg { color: var(--accent); }

.ai-chat-input {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.chat-input-wrapper {
  flex: 1;
  position: relative;
}

.chat-input-wrapper input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-sans);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.chat-input-wrapper input:focus { border-color: var(--accent); }
.chat-input-wrapper input::placeholder { color: var(--text-faint); }

.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #000;
  cursor: pointer;
  transition: all var(--transition);
}
.chat-send-btn:hover { background: var(--accent-hover); }
.chat-send-btn svg { width: 18px; height: 18px; }

/* ── Upload Page ── */
.quick-uploads-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.quick-upload-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.quick-upload-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-upload-card h3 svg { width: 18px; height: 18px; color: var(--accent); }
.quick-upload-card p { font-size: 12px; color: var(--text-muted); margin: 0 0 14px; }

.upload-dropzone {
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.upload-dropzone:hover { border-color: var(--accent); background: var(--accent-muted); }
.upload-dropzone svg { width: 28px; height: 28px; color: var(--text-muted); margin-bottom: 8px; }
.upload-dropzone span { display: block; color: var(--text-muted); font-size: 12px; }

.api-sync-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.api-sync-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.status-badge.disconnected { background: var(--negative-bg); color: var(--negative); }
.status-badge.connected { background: var(--positive-bg); color: var(--positive); }
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Slider ── */
.slider-container { margin: 16px 0; }
.slider-container label { display: block; margin-bottom: 10px; color: var(--text-secondary); font-size: 13px; }
.slider-container input[type="range"] { width: 100%; height: 6px; background: var(--border); border-radius: 3px; -webkit-appearance: none; }
.slider-container input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; background: var(--accent); border-radius: 50%; cursor: pointer; }
.slider-value { text-align: center; font-size: 20px; font-weight: 600; color: var(--accent); margin-top: 10px; }

/* ── CVV / Copy ── */
.cvv-hidden { cursor: pointer; color: var(--accent); }
.copy-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 4px 8px; font-size: 11px; }
.copy-btn:hover { color: var(--accent-hover); }

/* ── Action Buttons ── */
.action-buttons { display: flex; gap: 4px; }
.action-btn {
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  transition: all var(--transition);
}
.action-btn:hover { background: var(--nav-hover); color: var(--text-primary); }
.action-btn.primary { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }
.action-btn.primary:hover { background: var(--accent); color: #000; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; border-top: 1px solid var(--border); }
.pagination-btn { padding: 6px 12px; background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 12px; cursor: pointer; }
.pagination-btn:hover:not(:disabled) { background: var(--nav-hover); color: var(--text-primary); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-info { color: var(--text-muted); font-size: 12px; }

/* ── View Toggle (Events) ── */
.view-toggle {
  display: inline-flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 3px;
  gap: 2px;
}
.view-toggle-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.view-toggle-btn:hover { color: var(--text-secondary); }
.view-toggle-btn.active { background: var(--accent); color: #000; }

/* ── Artist Groups ── */
.artist-group-header { cursor: pointer; transition: background var(--transition); }
.artist-group-header:hover { background: var(--table-row-hover) !important; }
.artist-group-header td { padding: 12px 10px !important; border-bottom: 1px solid var(--border); }
.artist-group-header .artist-name { font-weight: 600; font-size: 14px; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.artist-group-header .artist-name .chevron { transition: transform 0.2s; color: var(--accent); font-size: 12px; }
.artist-group-header.expanded .artist-name .chevron { transform: rotate(90deg); }
.artist-group-header .artist-stat { font-size: 12px; color: var(--text-muted); }
.artist-group-header .artist-stat-val { color: var(--text-secondary); font-weight: 500; }
.artist-nested-row { background: var(--table-stripe); }
.artist-nested-row td:first-child { padding-left: 32px !important; }
.artist-group-events { overflow: hidden; transition: max-height 0.3s ease; }
.artist-group-events.collapsed { max-height: 0; }

/* ── Presale Artist Groups ── */
.presale-artist-header {
  background: var(--bg-tertiary) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  cursor: pointer;
}
.presale-artist-header:hover { background: var(--nav-hover) !important; }
.presale-artist-header .presale-artist-name { font-weight: 600; font-size: 14px; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.presale-artist-header .chevron { transition: transform 0.2s; color: var(--accent); font-size: 12px; }
.presale-artist-header.expanded .chevron { transform: rotate(90deg); }
.presale-artist-nested { margin-left: 16px; border-left: 2px solid var(--border); padding-left: 8px; margin-bottom: 8px; }

/* ── Dropdowns & Popovers ── */
.popover-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.popover-trigger:hover { background: var(--nav-hover); }
.popover-trigger.active { border-color: var(--accent); color: var(--accent); }

.popover-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  display: none;
  min-width: 200px;
}
.popover-panel.open { display: block; }
.popover-panel.align-right { left: auto; right: 0; }

.dropdown-menu { padding: 6px; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dropdown-item:hover { background: var(--nav-hover); color: var(--text-primary); }
.dropdown-item.active { background: var(--accent-muted); color: var(--accent); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 6px; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-muted);
  border: 1px solid rgba(0,188,212,0.3);
  border-radius: 20px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}
.filter-chip .chip-clear { cursor: pointer; opacity: 0.6; }
.filter-chip .chip-clear:hover { opacity: 1; }

/* ── Date Range Popover ── */
.date-range-popover { padding: 0; min-width: 680px; }
.drp-layout { display: flex; }
.drp-presets { width: 180px; padding: 12px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.drp-presets .preset-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 8px 6px; }
.drp-preset { padding: 7px 12px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 13px; cursor: pointer; border: none; background: none; text-align: left; }
.drp-preset:hover { background: var(--nav-hover); color: var(--text-primary); }
.drp-preset.active { background: var(--accent-muted); color: var(--accent); font-weight: 600; }
.drp-calendars { flex: 1; padding: 12px 16px; }
.drp-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drp-nav button { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); padding: 4px 10px; cursor: pointer; font-size: 14px; }
.drp-nav button:hover { background: var(--nav-hover); color: var(--text-primary); }
.drp-months { display: flex; gap: 20px; }
.drp-month-block { flex: 1; }
.drp-month-title { font-size: 14px; font-weight: 600; color: var(--text-primary); text-align: center; margin-bottom: 8px; }
.drp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.drp-dow { font-size: 11px; color: var(--text-muted); text-align: center; padding: 4px 0; font-weight: 600; }
.drp-day { text-align: center; padding: 6px 2px; font-size: 13px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); min-width: 32px; }
.drp-day:hover { background: var(--nav-hover); color: var(--text-primary); }
.drp-day.today { color: var(--accent); font-weight: 700; }
.drp-day.selected { background: var(--accent); color: #fff; font-weight: 600; }
.drp-day.in-range { background: var(--accent-muted); color: var(--accent); }
.drp-day.other-month { color: var(--text-faint); }
.drp-footer { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-muted); }

.actions-dropdown { position: relative; display: inline-block; }

/* ── Loading States ── */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.loading-shimmer { background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--nav-hover) 40%, var(--bg-tertiary) 80%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: var(--radius-sm); }
.loading-shimmer-text { height: 14px; width: 80%; border-radius: 4px; }
.loading-shimmer-card { height: 80px; border-radius: var(--radius-md); }
.loading-shimmer-row { height: 40px; border-radius: var(--radius-sm); margin-bottom: 4px; }
.loading-overlay { position: absolute; inset: 0; background: rgba(15,17,23,0.7); display: flex; align-items: center; justify-content: center; z-index: 10; border-radius: inherit; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.25s ease-out forwards; }

/* ── Slide Panel ── */
.slide-panel {
  position: fixed; top: 0; right: 0; width: 480px; max-width: 90vw; height: 100vh;
  background: var(--card-bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  z-index: 10001; transform: translateX(100%); transition: transform 0.3s ease;
  overflow-y: auto; display: flex; flex-direction: column;
}
.slide-panel.open { transform: translateX(0); }
.slide-panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 10000; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.slide-panel-backdrop.open { opacity: 1; pointer-events: auto; }
.slide-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.slide-panel-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.slide-panel-close { width: 32px; height: 32px; border: none; background: var(--nav-hover); color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.slide-panel-close:hover { color: var(--text-primary); }
.slide-panel-body { padding: 24px; flex: 1; overflow-y: auto; }

/* ── Section Headers ── */
.section-header-icon { width: 20px; height: 20px; color: var(--text-muted); }
.section-header-text { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
.data-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }
.data-row:last-child { border-bottom: none; }
.data-label { font-size: 12px; color: var(--text-muted); }
.data-value { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--text-primary); text-align: right; }

/* ── Empty States ── */
.empty-state-icon { width: 48px; height: 48px; color: var(--text-faint); margin-bottom: 16px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-desc { font-size: 13px; max-width: 300px; line-height: 1.5; }

/* ── Utility Helpers ── */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.opacity-50 { opacity: 0.5; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.uppercase { text-transform: uppercase; letter-spacing: 0.6px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }

/* ── AI Score (Events) ── */
.ai-score { font-family: var(--font-mono); font-weight: 600; }
.ai-score-cell { white-space: nowrap; }
.score-high { color: var(--positive); }
.score-medium { color: var(--warning); }
.score-low { color: var(--text-muted); }
.ai-rec { font-size: 11px; color: var(--text-muted); }

/* ── Bookkeeping ── */
.bk-tab-content { display: none; }
.bk-tab-content.active { display: block; }
.bkr-cat, .bkr-rule, .bkr-transfer { margin-bottom: 16px; }

/* ── Account Checkboxes ── */
.account-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

/* ── Align Right ── */
.align-right { text-align: right; }

/* ── Add Daily Button ── */
.add-daily-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-muted);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
}
.add-daily-btn:hover { background: var(--accent); color: #000; }
.add-daily-btn.added { background: var(--positive-bg); border-color: var(--positive); color: var(--positive); cursor: default; }

/* ── Bulk Row ── */
.bulk-show-row, .bulk-event-id { font-size: 12px; }

/* ── Change Indicators ── */
.change-up { color: var(--positive); }
.change-down { color: var(--negative); }

/* ── Theme transition ── */
.theme-transition, .theme-transition *, .theme-transition *::before, .theme-transition *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ── Old Theme Toggle (pill-style for layout.ejs) ── */
.theme-toggle .toggle-icon { display: inline-block; font-size: 14px; }
.theme-toggle .toggle-slider { display: none; }

/* ── Light Mode Overrides ── */
[data-theme="light"] .stat-card { background: var(--card-bg); }
[data-theme="light"] .loading-overlay { background: rgba(250,251,252,0.8); }
[data-theme="light"] .toast { background: var(--card-bg); border-color: var(--border); }
[data-theme="light"] .slide-panel { background: var(--card-bg); }

/* ── Amber Columns (Events) ── */
.col-amber { color: #F59E0B !important; }

/* ── User Menu in nav ── */
.user-menu { display: flex; align-items: center; }
.user-menu-btn { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none; font-size: 13px; transition: all var(--transition); }
.user-menu-btn:hover { background: var(--nav-hover); color: var(--text-primary); }
.user-avatar { width: 28px; height: 28px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #000; font-size: 12px; flex-shrink: 0; }
.user-info .name { font-size: 13px; color: var(--text-primary); }
.user-info .role { font-size: 11px; color: var(--text-muted); }

/* ── Capacity Venue Styles ── */
.capacity-cell { white-space: nowrap; }
.capacity-display { display: inline-flex; align-items: center; gap: 4px; }
.capacity-missing { display: inline-flex; align-items: center; gap: 8px; }
.capacity-edit { display: inline-flex; align-items: center; gap: 6px; }
