/* PF Trustees management dashboard — light theme.
   White surfaces on a very light grey page, charcoal text, one purple accent.
   (Previous dark theme backed up at backups/pre-dashboard/dashboard-app.dark.css.) */
:root {
  color-scheme: light;
  --bg: #f6f7f9;            /* page */
  --bg-2: #f9fafb;          /* insets, inputs, code */
  --surface: #ffffff;       /* cards, sidebar, modals */
  --surface-2: #f4f5f7;     /* hover */
  --surface-3: #eceef2;     /* pressed, tracks, neutral badges */
  --border: #e6e8ec;
  --border-strong: #d3d7de;
  --text: #1f2329;          /* charcoal */
  --text-2: #424955;
  --muted: #646b78;         /* 5.3:1 on white */
  --faint: #9aa1ad;         /* decorative only */
  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-text: #6d28d9;   /* links / accent text on white, 7:1 */
  --accent-soft: #f3effe;
  --accent-border: #d9cbfb;
  --accent-ring: rgba(124, 58, 237, 0.22);
  --chart: #7c3aed;
  --chart-surface: #ffffff;
  --good: #059669;
  --good-text: #047857;
  --good-soft: #ecfdf5;
  --good-border: #a7f3d0;
  --warn: #d97706;
  --warn-text: #92400e;
  --warn-soft: #fffbeb;
  --warn-border: #fcd98a;
  --bad: #dc2626;
  --bad-text: #b91c1c;
  --bad-soft: #fef2f2;
  --bad-border: #fecaca;
  --info: #2563eb;
  --info-text: #1d4ed8;
  --info-soft: #eff6ff;
  --info-border: #bfdbfe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
  --sidebar: 248px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
/* Default size for inline icons; contextual rules below override it. */
svg[aria-hidden="true"] { width: 16px; height: 16px; flex: none; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 0.6em; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
::selection { background: var(--accent-ring); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }

/* Boot */
.boot { min-height: 100vh; display: grid; place-items: center; }
.logo-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: 0.02em;
}
.boot-mark .logo-mark { width: 52px; height: 52px; font-size: 18px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.94); opacity: 0.7; } }

/* Layout */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; padding: 12px 10px 6px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--text-2);
  font-weight: 550; transition: background 0.15s, color 0.15s;
}
.nav a svg { width: 18px; height: 18px; color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a:hover svg { color: var(--text-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav a.active svg { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 11px; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 7px; font-weight: 600; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 14px 6px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--accent-strong); flex: none; }
.who { min-width: 0; flex: 1; }
.who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 32px;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar .title { display: flex; flex-direction: column; min-width: 0; }
.topbar .title h1 { font-size: 18px; }
.topbar .title span { color: var(--muted); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: none; }
.content { padding: 28px 32px 64px; max-width: 1440px; width: 100%; }
#view:focus { outline: none; }

/* Status pill in topbar */
.site-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.good { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer;
  white-space: nowrap; box-shadow: var(--shadow-sm); transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: #c3c8d1; text-decoration: none; }
.btn:active { background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--surface); border-color: var(--bad-border); color: var(--bad-text); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.good { background: var(--surface); border-color: var(--good-border); color: var(--good-text); }
.btn.good:hover { background: var(--good-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn .spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Cards & grids */
.grid { display: grid; gap: 18px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid.list-detail { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid > *, .stack > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { flex: 1; }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card.flush .card-head { padding: 18px 20px 0; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { flex: 1; }

.kpi { position: relative; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 8px; }
.kpi .label svg { width: 15px; height: 15px; color: var(--accent); }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .value.sm { font-size: 18px; }
.kpi .meta { color: var(--muted); font-size: 12.5px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; border: 1px solid transparent; }
.badge.good { background: var(--good-soft); color: var(--good-text); border-color: var(--good-border); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); border-color: var(--warn-border); }
.badge.bad { background: var(--bad-soft); color: var(--bad-text); border-color: var(--bad-border); }
.badge.info { background: var(--info-soft); color: var(--info-text); border-color: var(--info-border); }
.badge.accent { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-border); }
.badge svg { width: 12px; height: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; background: var(--bg-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-2); }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { color: var(--muted); font-size: 12px; }
.cell-title { font-weight: 600; color: var(--text); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .label-text { font-size: 12.5px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .counter { margin-left: auto; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.field .counter.warn { color: var(--warn-text); }
.input, select.input, textarea.input {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 12px; color: var(--text);
  box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, textarea::placeholder { color: var(--faint); }
.input:hover { border-color: #c3c8d1; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input:disabled { background: var(--bg-2); color: var(--muted); }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 280px; background: var(--bg-2); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 180px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-2); }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Switch */
.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #d3d7de; cursor: pointer; transition: 0.15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.2); transition: 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + span { opacity: 0.45; cursor: not-allowed; }

/* Tabs & chips */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 12.5px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-strong); }
.chip .n { color: var(--muted); font-weight: 500; }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; }
.list-item .s { color: var(--muted); font-size: 12.5px; }
.list-item .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.icon-dot { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; flex: none; color: var(--accent); }
.icon-dot svg { width: 15px; height: 15px; }
.icon-dot.good { background: var(--good-soft); color: var(--good); }
.icon-dot.bad { background: var(--bad-soft); color: var(--bad); }
.icon-dot.warn { background: var(--warn-soft); color: var(--warn); }

.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-list button { min-width: 0; overflow: hidden; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; padding: 10px 12px; cursor: pointer; color: var(--text-2); }
.nav-list button:hover { background: var(--surface-2); }
.nav-list button.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-strong); }
.nav-list .t { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.nav-list .s { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Empty & notices */
.empty { text-align: center; padding: 36px 18px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--faint); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 460px; margin: 0 auto 14px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); margin-bottom: 16px; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice.warn { border-color: var(--warn-border); background: var(--warn-soft); color: var(--warn-text); }
.notice.bad { border-color: var(--bad-border); background: var(--bad-soft); color: var(--bad-text); }
.notice.info { border-color: var(--accent-border); background: var(--accent-soft); color: #4c1d95; }
.notice.good { border-color: var(--good-border); background: var(--good-soft); color: var(--good-text); }
.notice a { color: inherit; text-decoration: underline; }
.muted { color: var(--muted); }
.faint { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { margin-left: auto; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.gap-s { gap: 6px; }
pre.json { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); margin: 0; }
code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: var(--text); }
pre code { background: none; padding: 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-block { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }

/* Score ring */
.score { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font-weight: 700; font-size: 13px; border: 3px solid var(--border-strong); font-variant-numeric: tabular-nums; background: var(--surface); }
.score.good { border-color: var(--good); color: var(--good-text); }
.score.warn { border-color: var(--warn); color: var(--warn-text); }
.score.bad { border-color: var(--bad); color: var(--bad-text); }

/* Progress */
.bar-track { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; width: 0; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); animation: rise 0.2s ease-out; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.good { border-left-color: var(--good); }
.toast.good svg { color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.bad svg { color: var(--bad); }
.toast.info svg { color: var(--accent); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* Modal & drawer */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(17, 24, 39, 0.38); display: grid; place-items: center; padding: 20px; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); animation: rise 0.18s ease-out; }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--bg-2); }
.confirm-summary { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; color: var(--text); margin: 10px 0 4px; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(520px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.22s ease; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { flex: 1; }
.drawer .chat { flex: 1; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }

/* Chat */
.chat-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; height: calc(100vh - 210px); min-height: 520px; }
.chat-history { overflow-y: auto; }
.chat-history .item { display: flex; align-items: center; gap: 6px; }
.chat-history .item button.open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; color: var(--text-2); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-history .item button.open:hover { background: var(--surface-2); }
.chat-history .item.active button.open { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.chat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 0; overflow: hidden; box-shadow: var(--shadow-sm); }
.chat-thread { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; background: var(--surface); }
.msg { display: flex; gap: 10px; max-width: 860px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { padding: 11px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); line-height: 1.6; min-width: 0; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }
.msg.error .bubble { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad-text); }
.msg .bubble p:last-child { margin-bottom: 0; }
.msg .bubble ul, .msg .bubble ol { margin: 0.3em 0 0.6em; padding-left: 1.3em; }
.msg .avatar { width: 30px; height: 30px; font-size: 11px; }
.msg.assistant .avatar { background: var(--accent); color: #fff; }
.tool-event { align-self: flex-start; margin-left: 40px; display: flex; flex-direction: column; gap: 6px; padding: 9px 12px; border-radius: 10px; border: 1px dashed var(--border-strong); background: var(--bg-2); font-size: 12.5px; color: var(--text-2); max-width: 760px; }
.tool-event .line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tool-event svg { width: 14px; height: 14px; }
.tool-event .name { font-family: var(--mono); color: var(--accent-text); }
.tool-event .prev { color: var(--muted); font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }
.tool-event.awaiting { border-style: solid; border-color: var(--warn-border); background: var(--warn-soft); }
.tool-event.awaiting .summary { color: var(--text); font-size: 13.5px; font-weight: 600; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 0.25; } }
.composer { border-top: 1px solid var(--border); padding: 12px; display: flex; gap: 10px; align-items: flex-end; background: var(--surface); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 180px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 11px 14px; line-height: 1.45; }
.composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.composer .btn { height: 44px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chat-empty { margin: auto; text-align: center; max-width: 640px; }
.chat-empty .logo-mark { width: 54px; height: 54px; font-size: 18px; border-radius: 14px; margin-bottom: 14px; }
.chat-empty h2 { font-size: 20px; margin-bottom: 6px; }
.chat-empty p { color: var(--muted); margin-bottom: 18px; }

/* Agents */
.agent-card { display: flex; flex-direction: column; gap: 12px; }
.agent-card .top { display: flex; gap: 12px; align-items: flex-start; }
.agent-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; border: 1px solid var(--accent-border); }
.agent-icon svg { width: 20px; height: 20px; }
.agent-card .desc { color: var(--muted); font-size: 13px; }
.agent-stats { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.agent-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.tool-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-chip { font-family: var(--mono); font-size: 11.5px; padding: 3px 8px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.tool-chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.tool-chip.locked { opacity: 0.5; cursor: not-allowed; }
.tool-chip svg { width: 11px; height: 11px; }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.media-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s; }
.media-card:hover { border-color: var(--accent-border); box-shadow: 0 6px 18px rgba(16, 24, 40, 0.08); }
.media-card .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.media-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-card .info { padding: 10px 12px; font-size: 12.5px; }
.media-card .alt { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.media-preview { width: 100%; max-height: 60vh; object-fit: contain; background: var(--surface-2); border-radius: 10px; display: block; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.picker-grid button { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-2); aspect-ratio: 4 / 3; }
.picker-grid button:hover, .picker-grid button:focus-visible { border-color: var(--accent); }
.picker-grid img { width: 100%; height: 100%; object-fit: cover; }
.featured-thumb { width: 100%; max-height: 180px; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--border); }

/* Website manager */
.heading-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.heading-row:last-child { border-bottom: 0; }
.level { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); border-radius: 5px; padding: 2px 6px; flex: none; margin-top: 2px; }
.heading-row .text { flex: 1; min-width: 0; white-space: pre-line; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.diff > div { padding: 10px 12px; border-radius: 8px; font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; color: var(--text); }
.diff .before { background: var(--bad-soft); border: 1px solid var(--bad-border); }
.diff .after { background: var(--good-soft); border: 1px solid var(--good-border); }
.diff .cap { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; display: block; }
/* Previews keep the public website's own colours. */
.preview-body { background: #e2e0db; color: #2c4938; border-radius: 10px; padding: 24px; line-height: 1.7; max-height: 520px; overflow: auto; border: 1px solid var(--border); }
.preview-body h1, .preview-body h2, .preview-body h3 { color: #4d8c68; margin: 1em 0 0.4em; }
.preview-body a { color: #2c6e4a; }
.article-preview { background: #fff; color: #222; border-radius: 10px; padding: 24px 28px; line-height: 1.75; max-height: 560px; overflow: auto; border: 1px solid var(--border); }
.article-preview h2, .article-preview h3 { color: #2c4938; margin: 1.2em 0 0.4em; }

/* Charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #eceef2; stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#area-grad); }
.chart .bar { fill: var(--chart); }
.chart .bar:hover, .chart .bar.hover { fill: var(--accent-strong); }
.chart .crosshair { stroke: var(--border-strong); stroke-width: 1; }
.chart .marker { fill: var(--chart); stroke: var(--chart-surface); stroke-width: 2; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow); transform: translate(-50%, -110%); z-index: 2; }
.chart-tip b { display: block; font-variant-numeric: tabular-nums; }
.chart-tip span { color: var(--muted); }
.chart-empty { height: 180px; display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--bg-2); }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { position: relative; overflow: hidden; background: var(--bg); border-right: 1px solid var(--border); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 34px; line-height: 1.15; max-width: 480px; margin: 18px 0 12px; }
.login-art p { color: var(--text-2); max-width: 460px; font-size: 15px; }
.login-art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; color: var(--text-2); }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-art li svg { width: 16px; height: 16px; color: var(--accent); }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-box { width: min(380px, 100%); }
.login-box h2 { font-size: 22px; margin-bottom: 6px; }
.login-box .muted { margin-bottom: 22px; }
.login-box .btn { width: 100%; height: 42px; }

/* Responsive */
@media (max-width: 1180px) {
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 70; left: 0; width: 270px; transform: translateX(-100%); transition: transform 0.2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 50px; }
  .grid.two, .grid.three, .grid.list-detail { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 190px); }
  .chat-history { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .site-pill .label { display: none; }
  .diff { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 16px; }
  .kpi .value { font-size: 22px; }
  .modal-foot { flex-wrap: wrap; }
  th, td { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .nav a.active::before, .bar-fill { background: Highlight; }
}
.pad { padding: 4px 20px 20px; }

/* Chat attachments & change previews */
.chat { position: relative; }
.attach-tray { display: flex; gap: 10px; flex-wrap: wrap; padding: 10px 12px 0; border-top: 1px solid var(--border); background: var(--surface); }
.attach-item { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-2); width: 240px; }
.attach-item.error { border-color: var(--bad-border); background: var(--bad-soft); }
.attach-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
.attach-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; font-size: 12px; }
.attach-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.attach-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-strong); }
.drop-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(243, 239, 254, 0.92); border: 2px dashed var(--accent); border-radius: var(--radius); color: var(--accent-strong); font-weight: 600; pointer-events: none; }
.drop-overlay svg { width: 32px; height: 32px; }
.change-preview { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.change-preview .diff img, .diff img { width: 100%; max-height: 160px; object-fit: cover; border-radius: 6px; display: block; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12px; color: var(--muted); background: var(--surface); }
.step.succeeded { border-color: var(--good-border); background: var(--good-soft); color: var(--good-text); }
.step.running { border-color: var(--accent); color: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-ring); }
.step.failed { border-color: var(--bad-border); background: var(--bad-soft); color: var(--bad-text); }
.step.skipped { opacity: 0.6; }
.step svg { width: 13px; height: 13px; }
.check.field { flex-direction: row; align-items: center; }

/* Simple Automations page */
.auto-hero { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding: 0; }
.auto-hero > div { padding: 18px 20px; border-right: 1px solid var(--border); min-width: 0; }
.auto-hero > div:last-child { border-right: 0; }
.auto-hero .label { color: var(--muted); font-size: 12.5px; font-weight: 550; margin-bottom: 6px; }
.auto-hero .value { font-size: 17px; font-weight: 650; }
.auto-hero .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
details.advanced { margin-top: 28px; }
details.advanced > summary { cursor: pointer; color: var(--text-2); font-weight: 600; padding: 10px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; }
details.advanced[open] > summary::before { transform: rotate(90deg); }
@media (max-width: 960px) {
  .auto-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auto-hero > div { border-bottom: 1px solid var(--border); }
  .auto-hero > div:nth-child(even) { border-right: 0; }
  .auto-hero > div:last-child { border-bottom: 0; grid-column: 1 / -1; }
}
.auto-hero .badge { white-space: normal; height: auto; min-height: 22px; padding: 2px 8px; line-height: 1.35; }
@media (max-width: 560px) {
  .auto-hero { grid-template-columns: 1fr; }
  .auto-hero > div { border-right: 0 !important; border-bottom: 1px solid var(--border); }
  .auto-hero > div:last-child { border-bottom: 0; }
}
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
/* OAuth consent page (MCP) */
body.consent .login-panel { min-height: 100vh; }
.consent-card { width: 100%; max-width: 520px; }
