:root {
  --bg: #f3f5f2;
  --panel: #ffffff;
  --panel-2: #f7f8f5;
  --text: #13201d;
  --muted: #687571;
  --line: #dde3df;
  --line-strong: #cbd4cf;
  --sidebar: #0e1b18;
  --sidebar-2: #172621;
  --sidebar-text: #edf5f1;
  --accent: #d9ff43;
  --accent-strong: #bce522;
  --cyan: #78d7de;
  --green: #2fb57c;
  --yellow: #e5b92f;
  --orange: #e97c45;
  --red: #dc5a5a;
  --blue: #4a7df0;
  --purple: #7f6be8;
  --shadow: 0 18px 44px rgba(25, 39, 34, .08);
  --radius: 18px;
}

body.dark {
  --bg: #0c1412;
  --panel: #121f1b;
  --panel-2: #172621;
  --text: #edf5f1;
  --muted: #95a8a1;
  --line: #263932;
  --line-strong: #344a42;
  --shadow: 0 18px 44px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 25px 18px 18px;
  overflow-y: auto;
  color: var(--sidebar-text);
  background:
    radial-gradient(circle at 15% 0%, rgba(217,255,67,.13), transparent 25%),
    linear-gradient(180deg, var(--sidebar), #0b1613);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; color: #102018; background: var(--accent);
  font-weight: 900; font-size: 20px;
}
.brand strong { display: block; letter-spacing: .18em; font-size: 15px; }
.brand span, .user-card span { display: block; color: #91a59e; font-size: 11px; margin-top: 3px; }
.nav { display: grid; gap: 4px; }
.nav-item {
  width: 100%; border: 0; background: transparent; color: #9db0aa;
  display: flex; align-items: center; gap: 11px; min-height: 44px;
  padding: 0 12px; border-radius: 11px; text-align: left; cursor: pointer;
  transition: .2s ease;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.055); transform: translateX(2px); }
.nav-item.active { color: #122019; background: var(--accent); font-weight: 800; }
.nav-icon { width: 24px; font-size: 9px; letter-spacing: .08em; opacity: .72; }
.nav-badge {
  margin-left: auto; min-width: 23px; padding: 3px 6px; border-radius: 99px;
  color: white; background: var(--red); font-size: 10px; text-align: center;
}
.sidebar-card {
  margin-top: auto; padding: 15px; border: 1px solid rgba(255,255,255,.08);
  border-radius: 15px; background: rgba(255,255,255,.04);
}
.eyebrow { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.sidebar-card .eyebrow { color: #8ca099; margin-bottom: 10px; }
.sidebar-card strong { display: block; font-size: 12px; }
.sidebar-card p { margin: 7px 0 12px; color: #8ca099; font-size: 11px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(217,255,67,.1); }
.mini-progress { height: 4px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.09); }
.mini-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.user-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 2px 4px; }
.user-card strong { font-size: 11px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #102018; background: var(--cyan); font-weight: 900; font-size: 11px; }

.workspace { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 72px;
  display: flex; align-items: center; gap: 18px; padding: 12px 28px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}
.global-search {
  min-width: 260px; max-width: 620px; flex: 1;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  min-height: 42px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel);
}
.global-search span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.global-search input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
kbd { color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; background: var(--panel-2); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.month-control {
  display: flex; align-items: center; gap: 7px; min-height: 42px;
  padding: 0 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.month-control span { color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 800; }
.month-control select { border: 0; outline: 0; color: var(--text); background: transparent; font-weight: 700; }
.icon-btn {
  min-height: 42px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel); cursor: pointer;
}
.icon-btn.small { min-height: 30px; border-color: rgba(255,255,255,.08); color: white; background: transparent; }
.alert-button {
  min-height: 42px; display: flex; align-items: center; gap: 9px;
  padding: 0 12px; border: 0; border-radius: 12px;
  color: #281818; background: #ffd3cb; cursor: pointer;
}
.alert-button span { font-size: 11px; font-weight: 800; text-transform: uppercase; }
.alert-button strong { min-width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; color: white; background: var(--red); font-size: 11px; }
.mobile-menu { display: none; }

main { padding: 28px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin: 7px 0 5px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.04em; }
.page-heading p { margin: 0; color: var(--muted); }
.heading-actions { display: flex; gap: 8px; }
.btn {
  min-height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line);
  cursor: pointer; font-weight: 800; transition: transform .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: #102018; border-color: var(--accent); background: var(--accent); }
.btn.secondary { background: var(--panel); }
.btn.danger { color: white; border-color: var(--red); background: var(--red); }
.btn.small { min-height: 34px; padding: 0 11px; font-size: 11px; }

.hero-strip {
  display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(250px, .8fr); gap: 16px;
  margin-bottom: 16px;
}
.hero-card {
  position: relative; min-height: 178px; overflow: hidden; padding: 26px;
  min-width: 0;
  border-radius: var(--radius); color: white;
  background:
    radial-gradient(circle at 80% 20%, rgba(217,255,67,.22), transparent 30%),
    linear-gradient(135deg, #10251f, #183b31);
  box-shadow: var(--shadow);
}
.hero-card::after {
  content: ""; position: absolute; right: -55px; bottom: -80px;
  width: 240px; height: 240px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%;
  box-shadow: 0 0 0 35px rgba(255,255,255,.025), 0 0 0 70px rgba(255,255,255,.018);
}
.hero-card .eyebrow { color: #aac2b9; }
.hero-card h2 { max-width: 650px; margin: 10px 0 12px; font-size: clamp(24px, 3vw, 36px); line-height: 1.06; letter-spacing: -.035em; }
.hero-card p { max-width: 700px; margin: 0; color: #b9ccc5; line-height: 1.6; }
.hero-meta { display: flex; gap: 22px; margin-top: 18px; }
.hero-meta strong { display: block; color: var(--accent); font-size: 18px; }
.hero-meta span { color: #9bb0a8; font-size: 10px; text-transform: uppercase; }
.alert-summary {
  min-width: 0;
  padding: 20px; border-radius: var(--radius); border: 1px solid #f1bdb3;
  background: linear-gradient(145deg, #fff0ed, #ffe1dc); color: #44231e;
}
body.dark .alert-summary { color: #ffd9d3; background: #3b211d; border-color: #63372f; }
.alert-summary .big-number { margin: 13px 0 4px; font-size: 44px; line-height: 1; font-weight: 900; letter-spacing: -.05em; }
.alert-summary p { margin: 0 0 16px; opacity: .75; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-card {
  position: relative; min-height: 136px; padding: 18px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  box-shadow: 0 8px 24px rgba(24, 38, 33, .035);
}
.kpi-card::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: var(--card-accent, var(--cyan)); }
.kpi-top { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.kpi-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--text); background: color-mix(in srgb, var(--card-accent, var(--cyan)) 28%, transparent); }
.kpi-value { margin-top: 16px; font-size: clamp(22px, 2.6vw, 31px); font-weight: 900; letter-spacing: -.04em; }
.kpi-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; color: var(--muted); font-size: 11px; }
.trend-up { color: var(--green); font-weight: 800; }
.trend-warn { color: var(--orange); font-weight: 800; }

.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.panel {
  grid-column: span 6; min-width: 0; padding: 19px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: 0 8px 24px rgba(24, 38, 33, .03);
}
.panel.wide { grid-column: span 8; }
.panel.narrow { grid-column: span 4; }
.panel.full { grid-column: 1 / -1; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.panel-header h3 { margin: 0 0 4px; font-size: 16px; }
.panel-header p { margin: 0; color: var(--muted); font-size: 11px; }
.panel-link { border: 0; padding: 0; color: var(--green); background: transparent; font-weight: 800; cursor: pointer; }

.bar-chart { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(85px, 1fr) minmax(120px, 3fr) auto; align-items: center; gap: 11px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; }
.bar-track { height: 9px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.bar-fill { height: 100%; min-width: 3px; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--blue)); }
.bar-value { min-width: 66px; color: var(--muted); font-size: 10px; text-align: right; }
.donut-wrap { display: grid; grid-template-columns: 148px 1fr; align-items: center; gap: 22px; }
.donut {
  position: relative; width: 148px; aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(var(--green) 0 var(--p1), var(--orange) var(--p1) var(--p2), var(--yellow) var(--p2) var(--p3), var(--line) var(--p3) 100%);
}
.donut::after { content: ""; position: absolute; inset: 27px; border-radius: 50%; background: var(--panel); }
.donut-center { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-size: 26px; letter-spacing: -.04em; }
.donut-center span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.legend { display: grid; gap: 11px; }
.legend-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 11px; }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; }
.legend-row span { color: var(--muted); }
.insight-list { display: grid; gap: 10px; }
.insight {
  display: grid; grid-template-columns: 32px 1fr; gap: 11px; padding: 12px;
  border-radius: 12px; background: var(--panel-2);
}
.insight-index { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: #112019; background: var(--accent); font-size: 10px; font-weight: 900; }
.insight strong { display: block; margin-bottom: 3px; font-size: 12px; }
.insight p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px;
  padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
}
.toolbar input, .toolbar select, .form-grid input, .form-grid select, .form-grid textarea, .settings-field input {
  min-height: 39px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 11px; color: var(--text); background: var(--panel-2); outline: none;
}
.toolbar input { min-width: 220px; flex: 1; }
.toolbar .spacer { flex: 1; }
.result-count { color: var(--muted); font-size: 11px; }
.table-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 12px 13px; color: var(--muted); background: var(--panel-2);
  font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
}
td { padding: 12px 13px; border-top: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.invoice-link { border: 0; padding: 0; color: var(--blue); background: transparent; font-weight: 800; cursor: pointer; }
.subtext { display: block; max-width: 230px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.status-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px;
  border-radius: 99px; font-size: 9px; font-weight: 800; white-space: nowrap;
}
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-delivered { color: #13724c; background: #d9f6e9; }
.status-late { color: #9a4d1f; background: #ffe6d5; }
.status-transit { color: #315ea9; background: #e1eaff; }
.status-pending { color: #967117; background: #fff0bf; }
.status-cancelled { color: #777; background: #ececec; }
body.dark .status-delivered { color: #67d4a5; background: #193a2d; }
body.dark .status-late { color: #ffae76; background: #422a1d; }
body.dark .status-transit { color: #9bbaff; background: #223252; }
body.dark .status-pending { color: #f4d66e; background: #40371d; }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 11px 13px; border-top: 1px solid var(--line); }
.pagination-buttons { display: flex; gap: 6px; }

.metric-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.rank-card { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.rank-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.rank-number { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: #102018; background: var(--accent); font-size: 10px; font-weight: 900; }
.rank-card h3 { min-height: 38px; margin: 12px 0 5px; font-size: 14px; }
.rank-value { font-size: 22px; font-weight: 900; letter-spacing: -.04em; }
.rank-meta { display: flex; justify-content: space-between; margin-top: 10px; color: var(--muted); font-size: 10px; }

.delay-buckets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.delay-bucket { padding: 14px; border-radius: 13px; background: var(--panel-2); }
.delay-bucket strong { display: block; margin: 8px 0 3px; font-size: 24px; }
.delay-bucket span { color: var(--muted); font-size: 10px; }
.danger-row { background: color-mix(in srgb, var(--red) 7%, var(--panel)); }
.danger-text { color: var(--red); font-weight: 900; }

.upload-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 15px; }
.dropzone {
  min-height: 260px; display: grid; place-content: center; padding: 35px; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--panel);
  transition: .2s ease;
}
.dropzone.dragover { border-color: var(--green); background: color-mix(in srgb, var(--green) 7%, var(--panel)); }
.upload-symbol { width: 60px; height: 60px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 18px; color: #13201d; background: var(--accent); font-size: 19px; font-weight: 900; }
.dropzone h3 { margin: 0 0 7px; }
.dropzone p { margin: 0 0 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.dropzone input { display: none; }
.form-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.form-card h3 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.form-grid textarea { min-height: 80px; padding-top: 10px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }

.settings-layout { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.3fr); gap: 15px; }
.settings-field { display: grid; gap: 6px; margin-bottom: 12px; }
.settings-field label { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.source-image { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: white; }
.source-links { display: grid; gap: 10px; margin-top: 15px; }
.source-link { display: flex; justify-content: space-between; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; background: var(--panel-2); }
.source-link span { color: var(--muted); font-size: 10px; }

.empty-state { padding: 48px 20px; color: var(--muted); text-align: center; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(5,12,10,.68); backdrop-filter: blur(6px); }
.modal { position: relative; width: min(760px, 100%); max-height: 88vh; overflow-y: auto; padding: 25px; border-radius: 20px; background: var(--panel); box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.modal-close { position: absolute; top: 14px; right: 14px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: var(--panel-2); cursor: pointer; font-size: 10px; }
.modal h2 { margin: 4px 70px 5px 0; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.detail-item { min-width: 0; padding: 12px; border-radius: 11px; background: var(--panel-2); }
.detail-item span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.detail-item strong { display: block; overflow-wrap: anywhere; font-size: 11px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { min-width: 260px; padding: 13px 15px; border-radius: 12px; color: white; background: #172621; box-shadow: var(--shadow); animation: toast-in .25s ease; }
.toast strong { display: block; margin-bottom: 2px; font-size: 11px; }
.toast span { color: #b7c6c1; font-size: 10px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .panel.wide, .panel.narrow { grid-column: span 6; }
  .metric-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 80; left: 0; width: 248px; transform: translateX(-105%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,.3); }
  .mobile-menu { display: inline-flex; align-items: center; }
  .month-control span, .alert-button span { display: none; }
  .hero-strip, .upload-grid, .settings-layout, .source-grid { grid-template-columns: 1fr; }
  .panel, .panel.wide, .panel.narrow { grid-column: 1 / -1; }
}
@media (max-width: 650px) {
  .topbar { padding: 10px 14px; }
  .global-search { min-width: 0; }
  .global-search span, .global-search kbd, .month-control, #theme-toggle, .top-actions .alert-button { display: none; }
  .top-actions { min-width: 0; }
  main { padding: 20px 14px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; }
  .heading-actions .btn { flex: 1; }
  .kpi-grid, .metric-cards, .delay-buckets { grid-template-columns: 1fr; }
  .hero-strip { grid-template-columns: minmax(0, 1fr); }
  .hero-meta { flex-wrap: wrap; }
  .hero-card h2, .hero-card p, .page-heading p { overflow-wrap: anywhere; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .toolbar > * { width: 100%; }
}

/* ===== Global filter bar additions ===== */
.top-actions { flex-wrap: wrap; }
.top-actions .month-control select { max-width: 140px; }

/* ===== AI Copilot ===== */
.copilot-panel { display: flex; flex-direction: column; gap: 14px; }
.copilot-form { display: flex; gap: 10px; }
.copilot-form input {
  flex: 1; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 13px; outline: none;
}
.copilot-form input:focus { border-color: var(--accent); }
.copilot-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 11px; cursor: pointer; transition: .15s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.copilot-thread {
  display: flex; flex-direction: column; gap: 14px; max-height: 460px; overflow-y: auto;
  padding: 6px 2px;
}
.copilot-message { display: flex; gap: 10px; align-items: flex-start; }
.copilot-message.user { flex-direction: row-reverse; }
.copilot-message.user .copilot-bubble { background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); }
.copilot-avatar {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-size: 10px; font-weight: 900; background: var(--accent); color: #102018;
}
.copilot-message.user .copilot-avatar { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.copilot-bubble {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font-size: 12.5px; line-height: 1.6; max-width: 720px;
}
.copilot-bubble p { margin: 0 0 8px; }
.copilot-bubble p:last-child { margin-bottom: 0; }
.copilot-bubble .table-shell { margin-top: 8px; }
.copilot-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* ===== API key card ===== */
.copilot-key-card { border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.copilot-key-card h3 { display: flex; align-items: center; gap: 10px; }
.copilot-thread { scrollbar-width: thin; }
