/* SEO Agent — panel (kierunek Apple: jasno, spokojnie, wniosek → liczby) */

:root {
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --ink: #1D1D1F;
  --ink-2: #424245;
  --ink-3: #6E6E73;
  --ink-4: #8E8E93;
  --line: rgba(0, 0, 0, 0.06);
  --line-2: rgba(0, 0, 0, 0.10);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: #F2F2F7;
  --blue: #0071E3;
  --blue-link: #0066CC;
  --blue-ink: #0058B0;
  --blue-bg: #EAF3FE;
  --green: #34C759;
  --green-ink: #1E7B34;
  --green-bg: #E8F7EC;
  --orange: #FF9500;
  --orange-ink: #8A4B00;
  --orange-bg: #FFF4E5;
  --red: #FF3B30;
  --red-ink: #C1271D;
  --red-bg: #FDECEB;
  --grey-dot: #AEAEB2;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 28px rgba(0, 0, 0, 0.04);
  --radius: 24px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue-link); }
a:hover { color: #004C99; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid rgba(0, 113, 227, 0.45); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
.side {
  flex: 0 1 264px; padding: 24px 16px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.main { flex: 999 1 560px; min-width: 0; padding: clamp(28px, 5vw, 64px) clamp(16px, 5vw, 72px) 120px; }
.main-inner { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 56px; }

.site-btn {
  position: relative; width: 100%; min-height: 56px; padding: 8px 10px; border: none; border-radius: 14px;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 0 0 1px var(--line);
  display: flex; align-items: center; gap: 12px; cursor: pointer; font: inherit; color: var(--ink); text-align: left;
}
.site-mark {
  flex: none; width: 36px; height: 36px; border-radius: 10px; color: #fff; font-size: 15px; font-weight: 700;
  background: linear-gradient(180deg, #2B8BF2 0%, var(--blue) 100%); display: flex; align-items: center; justify-content: center;
}
.site-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-sub { font-size: 12px; color: var(--ink-3); }
.site-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 40; padding: 6px; border-radius: 16px;
  background: rgba(255,255,255,0.96); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
  box-shadow: 0 0 0 1px var(--line), 0 12px 40px rgba(0,0,0,0.14); display: flex; flex-direction: column; gap: 2px;
}
.site-menu a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 14px; }
.site-menu a:hover, .site-menu a[aria-current="true"] { background: rgba(0,0,0,0.05); }
.site-menu .menu-label { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--ink-4); }

.search-btn {
  margin-top: -10px; min-height: 40px; padding: 0 12px; border: none; border-radius: 10px; background: rgba(118,118,128,0.10);
  display: flex; align-items: center; gap: 10px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink-3);
}
.kbd { font-size: 12px; padding: 2px 6px; border-radius: 6px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); color: var(--ink-3); }

.nav { display: flex; flex-direction: column; gap: 22px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 12px 6px; font-size: 12px; font-weight: 600; color: var(--ink-4); }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-size: 14px; transition: background-color 150ms ease;
}
.nav a[aria-current="page"] { background: rgba(0,0,0,0.06); font-weight: 600; }
.nav svg { flex: none; width: 18px; height: 18px; stroke: var(--blue); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--orange);
  color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.nav-badge.is-red { background: var(--red); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.next-review { padding: 14px; border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); display: flex; flex-direction: column; gap: 4px; }

@media (hover: hover) and (pointer: fine) {
  .nav a:hover { background: rgba(0,0,0,0.04); }
  .row-link:hover { background: #FAFAFC; }
  .btn:hover { filter: brightness(0.98); }
}

/* ---------- Type ---------- */
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.01em; color: var(--ink-3); }
.h1 { font-size: clamp(34px, 5vw, 48px); line-height: 1.06; font-weight: 700; letter-spacing: -0.03em; }
.h2 { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.h3 { font-size: 19px; line-height: 1.3; font-weight: 600; letter-spacing: -0.015em; }
.lead { font-size: 19px; line-height: 1.55; color: var(--ink-2); max-width: 760px; }
.body { font-size: 15px; line-height: 1.6; color: var(--ink-2); max-width: 720px; }
.cap { font-size: 13px; line-height: 1.45; color: var(--ink-3); }
.num { font-size: 34px; font-weight: 600; letter-spacing: -0.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.num-m { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; }
.tnum { font-variant-numeric: tabular-nums; }
.c-red { color: var(--red-ink); } .c-green { color: var(--green-ink); } .c-muted { color: var(--ink-3); } .c-blue { color: var(--blue-ink); } .c-orange { color: var(--orange-ink); }

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.stack-m { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.row-between { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.overview-heading { align-items: flex-start; }
.overview-download { gap: 6px; }
@media (min-width: 800px) {
  .overview-heading > .eyebrow { padding-top: 13px; }
  .overview-download { text-align: right; }
}
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; align-items: start; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Surfaces ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card-pad { padding: clamp(24px, 4vw, 40px); }
.card-pad-s { padding: 24px 28px; }
.card-list { overflow: hidden; }
.card-list > .li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 20px clamp(20px, 3vw, 28px); border-top: 1px solid var(--line); }
.card-list > .li:first-child { border-top: none; }
.li-main { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.li-title { font-size: 16px; font-weight: 600; }
.tile { background: var(--bg); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.tile-blue { background: var(--blue-bg); border-radius: 24px; padding: clamp(24px, 4vw, 36px); display: flex; flex-direction: column; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); padding: 8px 0; }
.kpi { padding: 24px clamp(20px, 3vw, 32px); display: flex; flex-direction: column; gap: 10px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: none; }
.kpi-name { font-size: 15px; font-weight: 600; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 13px; font-weight: 600; line-height: 1;
  padding: 6px 11px; border-radius: 999px; white-space: nowrap; background: var(--fill-2); color: var(--ink-2);
}
.pill .dot, .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--grey-dot); }
.pill.red { background: var(--red-bg); color: var(--red-ink); } .pill.red .dot { background: var(--red); }
.pill.green { background: var(--green-bg); color: var(--green-ink); } .pill.green .dot { background: var(--green); }
.pill.orange { background: var(--orange-bg); color: var(--orange-ink); } .pill.orange .dot { background: var(--orange); }
.pill.blue { background: var(--blue-bg); color: var(--blue-ink); } .pill.blue .dot { background: var(--blue); }
.dot.green { background: var(--green); } .dot.blue { background: var(--blue); } .dot.orange { background: var(--orange); } .dot.red { background: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-size: 14px; font-weight: 500; min-height: 44px; padding: 0 18px; border-radius: 999px; border: none;
  background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line-2); display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 160ms var(--ease-out); -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.btn:active, .press:active { transform: scale(0.97); }
.btn.primary { background: var(--blue); color: #fff; box-shadow: none; font-weight: 600; }
.btn.primary:hover { color: #fff; }
.btn.grey { background: #E8E8ED; box-shadow: none; }
.btn.danger { background: var(--red); color: #fff; box-shadow: none; font-weight: 600; }
.btn.danger-soft { background: var(--red-bg); color: var(--red-ink); box-shadow: none; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--blue-link); padding: 0 6px; }
.btn.ghost-red { background: transparent; box-shadow: none; color: var(--red-ink); padding: 0 8px; }
.btn.small { min-height: 36px; font-size: 13px; padding: 0 14px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.6; cursor: default; }
.btn .hint { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.btn.primary .hint { color: rgba(255,255,255,0.8); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: ui-spin 700ms linear infinite; }
@keyframes ui-spin { to { transform: rotate(360deg); } }
.link-more { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: 15px; font-weight: 500; color: var(--blue-link); text-decoration: none; }

/* ---------- Segmented ---------- */
.seg { align-self: flex-start; max-width: 100%; overflow-x: auto; display: inline-flex; padding: 3px; border-radius: 10px; background: var(--fill); scrollbar-width: none; }
.seg > a, .seg > button {
  font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap; min-height: 36px; padding: 0 16px; border: none; border-radius: 8px;
  background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.seg > [aria-selected="true"], .seg > [aria-current="page"], .seg > [aria-pressed="true"] { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.seg .count { color: var(--ink-4); font-variant-numeric: tabular-nums; }
.chip-btn { font: inherit; font-size: 13px; font-weight: 500; min-height: 34px; padding: 0 14px; border: none; border-radius: 999px; background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.chip-btn[aria-pressed="true"], .chip-btn[aria-current="page"] { background: var(--ink); color: #fff; box-shadow: none; }

/* ---------- Bars / charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; }
.bars > span { flex: 1; min-width: 0; border-radius: 3px 3px 1px 1px; background: #DCE6F2; }
.bars > span.hi { background: var(--blue); }
.bars > span.peak { background: #B9D4F5; }
.bars.green > span { background: var(--green); border-radius: 2px; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-4); }
.decision-tile { color: inherit; text-decoration: none; }
.decision-tile:hover { box-shadow: inset 0 0 0 1px var(--blue); }
.decision-tile .link-more { align-self: flex-start; margin-top: auto; padding-top: 4px; }
.profile-suggestion, #focus, #os-h { scroll-margin-top: 24px; }
.profile-suggestion-values { margin: 0; padding-inline-start: 22px; overflow-wrap: anywhere; }
.timeline-description { font-size: 15px; line-height: 1.55; color: var(--ink-2); max-width: 680px; white-space: pre-line; overflow-wrap: anywhere; }
.chart-event-axis { position: relative; height: calc(var(--event-lanes) * 26px); border-top: 1px solid var(--line); margin-top: 4px; }
.chart-event { position: absolute; left: var(--event-date); top: calc(var(--event-lane) * 26px); transform: translateX(-50%); }
.chart-event-dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--blue-ink); text-decoration: none; }
a.chart-event-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }
summary.chart-event-dot { cursor: pointer; list-style: none; background: var(--blue-bg); font-size: 12px; font-weight: 600; }
summary.chart-event-dot::-webkit-details-marker { display: none; }
.chart-event-dot:hover, .chart-event-dot:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.chart-event:has(details[open]) { z-index: 2; }
.chart-event-group .chart-event-list { position: absolute; inset-inline-start: 0; width: min(240px, 45vw); padding: 12px 14px 12px 30px; border-radius: 12px; background: var(--card); box-shadow: 0 4px 20px #0002; }
.chart-event-end .chart-event-list { inset-inline: auto 0; }
.chart-event-list { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.chart-event-recent summary { cursor: pointer; }
.progress { height: 6px; border-radius: 999px; background: #E8E8ED; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--blue); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--ink-3); font-size: 13px; font-weight: 500; padding: 18px 12px 14px; }
.tbl td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl th:first-child, .tbl td:first-child { padding-left: clamp(20px, 3vw, 32px); }
.tbl th:last-child, .tbl td:last-child { padding-right: clamp(20px, 3vw, 32px); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .url { font-family: var(--mono); font-size: 13px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span:first-child { font-size: 14px; font-weight: 600; }
.input, .textarea, .select {
  font: inherit; font-size: 16px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: none; background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); width: 100%;
}
.textarea { padding: 12px 14px; line-height: 1.5; resize: vertical; min-height: 88px; }
.textarea.draft { background: #fff; box-shadow: inset 0 0 0 1.5px var(--blue); line-height: 1.55; }
.switch { flex: none; width: 51px; height: 31px; border-radius: 999px; border: none; padding: 2px; background: #E5E5EA; cursor: pointer; display: flex; justify-content: flex-start; transition: background-color 200ms ease; }
.switch[aria-checked="true"] { background: var(--green); justify-content: flex-end; }
.switch > span { width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--bg); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--blue); }

/* ---------- Notice / banners ---------- */
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 16px 20px; border-radius: 18px; }
.banner.orange { background: var(--orange-bg); color: var(--orange-ink); }
.banner.white { background: #fff; box-shadow: 0 0 0 1px var(--line); }
.banner.blue { background: var(--blue-bg); }
.banner.red { background: var(--red-bg); color: var(--red-ink); }
.empty { padding: 44px 32px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }

/* ---------- Timeline ---------- */
.tl { display: flex; gap: 20px; }
.tl-rail { flex: none; width: 14px; display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; box-shadow: 0 0 0 4px #fff; background: var(--grey-dot); }
.tl-line { flex: 1; width: 2px; background: #E5E5EA; }
.tl:last-child .tl-line { background: transparent; }
.tl-body { flex: 1; min-width: 0; padding-bottom: 32px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Dialogs ---------- */
dialog.modal {
  width: min(540px, calc(100% - 32px)); max-height: calc(100vh - 32px); border: none; border-radius: 24px; padding: 28px;
  background: #fff; color: var(--ink); box-shadow: 0 24px 64px rgba(0,0,0,0.22);
}
dialog.modal::backdrop { background: rgba(0,0,0,0.28); }
dialog.modal[open] { animation: ui-modal-in 200ms var(--ease-out); }
@keyframes ui-modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal-body { display: flex; flex-direction: column; gap: 18px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.decisions-list { gap: 24px; }
dialog.decision-report-dialog { width: min(820px, calc(100% - 32px)); padding: clamp(16px, 4vw, 28px); }
.decision-report-text { font-family: var(--mono); font-size: 13px; min-height: 28vh; max-height: 54vh; }

dialog.palette {
  width: min(640px, calc(100% - 32px)); margin-top: 12vh; padding: 0; border: none; border-radius: 20px; overflow: hidden;
  background: rgba(250,250,252,0.96); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 0 0 1px var(--line), 0 24px 64px rgba(0,0,0,0.22);
}
dialog.palette::backdrop { background: rgba(0,0,0,0.22); }
dialog.palette[open] { animation: ui-pal-in 150ms var(--ease-out); }
@keyframes ui-pal-in { from { opacity: 0; transform: scale(0.97); } }
.pal-head { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.pal-head input { flex: 1; min-width: 0; font: inherit; font-size: 18px; min-height: 60px; border: none; background: transparent; color: var(--ink); outline: none; }
.pal-list { max-height: 60vh; overflow-y: auto; padding: 8px; }
.pal-group { padding: 10px 12px 4px; font-size: 12px; font-weight: 600; color: var(--ink-4); }
.pal-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.pal-item[aria-selected="true"] { background: rgba(0,113,227,0.10); }
.pal-badge { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--fill-2); color: var(--ink-2); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pal-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-4); }

/* ---------- Agent dock ---------- */
.agent-dock { position: fixed; right: 24px; bottom: 24px; z-index: 30; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; pointer-events: none; }
.agent-fab {
  pointer-events: auto; font: inherit; font-size: 15px; font-weight: 600; min-height: 52px; padding: 0 22px 0 16px; border-radius: 999px; border: none;
  background: var(--blue); color: #fff; box-shadow: 0 8px 24px rgba(0,113,227,0.32), 0 1px 3px rgba(0,0,0,0.12);
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer; transition: transform 160ms var(--ease-out);
}
.agent-fab:active { transform: scale(0.97); }
.agent-panel {
  pointer-events: auto; width: min(400px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column;
  border-radius: 24px; background: rgba(246,246,248,0.94); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 0 0 1px var(--line), 0 16px 48px rgba(0,0,0,0.16); overflow: hidden; transform-origin: bottom right;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
@starting-style { .agent-panel { opacity: 0; transform: translateY(8px) scale(0.96); } }
.agent-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 18px; border-bottom: 1px solid var(--line); }
.agent-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(180deg, #2B8BF2 0%, var(--blue) 100%); display: flex; align-items: center; justify-content: center; }
.agent-msgs { flex: 1; min-height: 120px; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--blue); color: #fff; }
.bubble.bot { align-self: flex-start; background: #fff; color: var(--ink); box-shadow: 0 1px 1px rgba(0,0,0,0.04); }
.bubble.typing { color: var(--ink-3); }
.rule-card { align-self: stretch; padding: 14px 16px; border-radius: 16px; background: var(--blue-bg); display: flex; flex-direction: column; gap: 10px; }
.agent-sugg { display: flex; gap: 8px; padding: 0 16px 12px; overflow-x: auto; scrollbar-width: none; }
.agent-sugg button { flex: none; font: inherit; font-size: 13px; font-weight: 500; min-height: 36px; padding: 0 14px; border-radius: 999px; border: none; background: #fff; color: var(--blue-link); box-shadow: 0 0 0 1px rgba(0,0,0,0.08); cursor: pointer; white-space: nowrap; }
.agent-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.agent-form textarea { flex: 1; min-width: 0; font: inherit; font-size: 16px; line-height: 22px; min-height: 44px; max-height: 140px; padding: 11px 16px; border-radius: 22px; border: none; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); resize: none; color: var(--ink); }
.round-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--fill); color: var(--ink-2); display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 80; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 14px; background: rgba(29,29,31,0.92); color: #fff; font-size: 14px; max-width: min(520px, calc(100vw - 32px));
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.is-error { background: var(--red-ink); }

/* ---------- Markdown (reports) ---------- */
.md h2 { font-size: 19px; margin: 18px 0 8px; } .md h3 { font-size: 16px; margin: 16px 0 6px; }
.md p, .md li { font-size: 15px; line-height: 1.6; color: var(--ink-2); } .md ul { padding-left: 20px; margin: 6px 0; }
.md code { font-family: var(--mono); font-size: 13px; background: var(--fill-2); padding: 1px 5px; border-radius: 5px; }

/* ---------- Motion & a11y preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn, .agent-fab, .press { transition: none; }
  .btn:active, .agent-fab:active, .press:active { transform: none; }
  dialog.modal[open], dialog.palette[open] { animation: none; }
  .agent-panel { transition: opacity 150ms ease; }
  @starting-style { .agent-panel { transform: none; } }
  .spinner { animation-duration: 2.4s; }
}
@media (prefers-reduced-transparency: reduce) {
  .side, .agent-panel, dialog.palette, .site-menu { background: #fff !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .side { flex-basis: 100%; width: 100%; min-width: 0; max-width: 100%; height: auto; position: sticky; top: 0; z-index: 20; gap: 12px; padding: 12px 16px 8px; border-right: none; border-bottom: 1px solid rgba(0,0,0,0.08); overflow: visible; }
  .side .nav { flex-direction: row; gap: 4px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; min-width: 0; }
  .side .nav-group { flex-direction: row; }
  .side .nav a { white-space: nowrap; }
  .hide-m { display: none !important; }
  .hide-s { display: none !important; }
  .main { padding-bottom: 140px; }
  .agent-dock { right: 12px; bottom: 12px; }
  .agent-dock.is-open { inset: 0; padding: 12px; background: rgba(0,0,0,0.28); justify-content: flex-end; align-items: stretch; pointer-events: auto; }
  .agent-dock.is-open .agent-fab { display: none; }
  .agent-dock.is-open .agent-panel { width: 100%; max-height: calc(100vh - 48px); background: #F6F6F8; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .kpi { border-left: none; border-top: 1px solid var(--line); }
  .kpi:first-child { border-top: none; }
}

/* ---------- Chart tooltips ---------- */
.bars > span[data-tip] { cursor: default; transition: filter 120ms ease; }
.bars > span[data-tip]:hover, .bars > span[data-tip].is-active { filter: brightness(0.82); }
.tip {
  position: fixed; z-index: 70; pointer-events: none; padding: 8px 12px; border-radius: 10px;
  background: rgba(29,29,31,0.94); color: #fff; font-size: 13px; line-height: 1.35; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18); transform: translate(-50%, calc(-100% - 10px));
}
