:root {
  color-scheme: light;
  --bg: #f7f8fc;
  --surface: #fff;
  --ink: #23243c;
  --muted: #626a80;
  --quiet: #788198;
  --line: #e7e9f2;
  --accent: #6941d5;
  --accent-strong: #5830c1;
  --accent-bg: #f0eafe;
  --positive: #137b5b;
  --positive-bg: #e8f7ef;
  --warning: #925414;
  --warning-bg: #fff2dc;
  --danger: #a1264d;
  --danger-bg: #fdf0f4;
  --radius: 16px;
  --shadow: 0 1px 2px #34335705;
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--font);
  font-optical-sizing: auto;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #8c69e9;
  outline-offset: 3px;
}
button:disabled { cursor: progress; opacity: .65; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 22px; }
.sr-only, .icon-library {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.skip-link {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  color: white;
  background: var(--accent-strong);
  border-radius: 8px;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.app-layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 29px 16px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding-inline: 7px;
  width: fit-content;
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(155deg, #8d66f1, #6539d1);
  box-shadow: 0 3px 7px #7750df29;
  border-radius: 12px;
  color: #fff;
  flex: none;
}
.brand-icon .icon { width: 23px; height: 23px; stroke-width: 1.9; }
.brand-wordmark { font-weight: 800; font-size: 20px; line-height: 1.18; letter-spacing: -.8px; white-space: nowrap; }
.brand-wordmark small { display: block; font-weight: 600; font-size: 10px; line-height: 1.4; letter-spacing: 0; color: var(--quiet); margin-top: 3px; }
.marketplace {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 32px 0 18px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 750;
}
.marketplace-mark {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  background: #f6e9fb;
  color: #9829a3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.side-nav { display: grid; gap: 4px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: #606780;
  transition: background .16s, color .16s;
}
.side-nav a:hover { background: #f5f3fb; color: var(--accent-strong); }
.side-nav a[aria-current] { background: var(--accent-bg); color: var(--accent-strong); font-weight: 800; }
.side-nav .icon { width: 18px; height: 18px; }
.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding: 14px 3px 0;
  font-size: 11px;
}
.sidebar-footer-icon {
  color: var(--accent);
  background: var(--accent-bg);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
}
.sidebar-footer-icon .icon { width: 17px; height: 17px; }
.sidebar-footer strong { font-weight: 800; display: block; }
.sidebar-footer small { font-size: 10px; color: var(--quiet); display: block; margin-top: 2px; }

.main { min-width: 0; }
.content { width: min(100%, 1448px); margin-inline: auto; padding: 35px clamp(22px, 3.1vw, 54px) 54px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-header h1 { font-size: clamp(25px, 3vw, 36px); line-height: 1.16; letter-spacing: -.045em; font-weight: 800; }
.page-header p { color: var(--muted); margin-top: 7px; font-size: 13px; }
.source-status, .product-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 8px;
  padding: 9px 12px;
  min-height: 39px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-weight: 750;
  font-size: 12px;
  white-space: nowrap;
  transition: background .16s, border-color .16s;
}
.source-status:hover, .product-link:hover { border-color: #d6c9f8; background: #faf8ff; }
.source-status .icon, .product-link .icon { width: 15px; height: 15px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: #a088d6; box-shadow: 0 0 0 3px #f0eafe; }
.source-status[data-connected="true"] .status-dot, .status-dot.connected { background: #38a781; box-shadow: 0 0 0 3px var(--positive-bg); }

.search-card, .product-card, .metric, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.search-card { padding: 15px 17px 12px; }
.search-form { display: flex; align-items: stretch; gap: 10px; }
.cabinet-picker {
  display: grid;
  grid-template-rows: auto 1fr;
  flex: 0 0 148px;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #e3d9fb;
  border-radius: 9px;
  background: #f9f6ff;
}
.cabinet-picker-label {
  padding: 3px 10px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.25;
}
.cabinet-picker select {
  width: 100%;
  min-width: 0;
  padding: 0 8px 3px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cabinet-picker select:focus-visible { outline-offset: -2px; }
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  min-width: 0;
  width: 100%;
  min-height: 44px;
  border: 1px solid #dfe1ed;
  background: #fafafe;
  border-radius: 9px;
  color: #777e96;
}
.search-field:focus-within { border-color: #9b7ae9; box-shadow: 0 0 0 3px #eee8fc; }
.search-field .icon { width: 18px; height: 18px; }
.search-field input { border: 0; outline: 0; width: 100%; min-width: 0; background: transparent; color: var(--ink); font-size: 13px; padding: 10px 0; }
.search-field input::placeholder { color: #71798f; }
.article-picker { min-width: 0; margin-top: 10px; }
.article-picker label { display: block; margin-bottom: 4px; color: var(--ink); font-size: 12px; font-weight: 800; }
.article-picker select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 5px 9px;
  border: 1px solid #dfe1ed;
  border-radius: 9px;
  background: #fafafe;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  cursor: pointer;
}
.article-picker select:disabled { background: var(--bg); color: var(--muted); cursor: default; }
.article-list-feedback { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; color: var(--muted); font-size: 11px; }
.article-list-feedback > :not(:empty):not([hidden]) { margin-top: 4px; }
#article-list-status[data-kind="error"] { color: var(--danger); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  min-height: 41px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.button-primary { flex: none; color: white; background: var(--accent); box-shadow: 0 2px 4px #4e1fad1f; }
.button-primary:hover { background: var(--accent-strong); }
.button-secondary { color: var(--accent-strong); background: var(--accent-bg); border-color: #e9e1fc; }
.button-secondary:hover { background: #e8ddfc; }
.search-hint { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.text-button { border: 0; padding: 1px 7px; border-radius: 4px; color: var(--accent-strong); background: var(--accent-bg); font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.text-button:hover { background: #e6dafa; text-decoration: underline; }
.notice, .demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid #e5dbfc;
  border-radius: 10px;
  background: #f3effe;
  color: #5b4193;
  font-size: 12px;
}
.notice { margin-top: 13px; }
.notice:empty { display: none; }
.notice.error, .notice[data-kind="error"] { border-color: #f1d5de; background: var(--danger-bg); color: var(--danger); }
.demo-banner { margin-bottom: 13px; }
.demo-banner strong { font-size: 12px; font-weight: 800; }
.demo-banner p, .demo-banner small { font-size: 11px; color: #655488; }
.demo-banner-icon { display: grid; place-items: center; width: 24px; height: 24px; background: #e9dffd; border-radius: 7px; flex: none; }
.demo-banner-icon .icon { width: 15px; height: 15px; }
.report:not(:empty) { margin-top: 14px; }
.report > * + * { margin-top: 14px; }
.product-card { display: flex; align-items: center; gap: 14px; min-height: 95px; padding: 12px 15px; }
.product-image {
  width: 65px;
  height: 65px;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  background: #f0edf6;
  border-radius: 11px;
  color: #9b85c4;
}
.product-image img, img.product-image { width: 65px; height: 65px; object-fit: cover; object-position: center; }
.product-image .icon { width: 27px; height: 27px; }
.product-info { min-width: 0; flex: 1; }
.eyebrow { color: var(--accent); font-weight: 800; font-size: 10px; letter-spacing: .045em; text-transform: uppercase; }
.product-info h2 { font-size: clamp(18px, 2vw, 23px); line-height: 1.2; letter-spacing: -.034em; font-weight: 800; overflow-wrap: anywhere; margin-bottom: 4px; }
.product-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 13px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.product-meta > * { min-width: 0; }
.product-meta strong { font-weight: 800; color: #45465b; }
.product-link { color: #5c3ab2; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 13px; }
.metric { display: flex; flex-direction: column; gap: 2px; padding: 14px 15px 13px; min-width: 0; min-height: 121px; }
.metric-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.metric-icon { display: grid; place-items: center; width: 31px; height: 31px; flex: none; color: var(--accent); background: var(--accent-bg); border-radius: 8px; }
.metric-icon .icon { height: 17px; width: 17px; }
.metric:nth-child(2) .metric-icon { color: #a0611c; background: #fff3e3; }
.metric:nth-child(3) .metric-icon { color: #26785e; background: #e8f7ef; }
.metric:nth-child(4) .metric-icon { color: #4761af; background: #ecf0ff; }
.metric-value { font-size: clamp(25px, 3vw, 34px); line-height: 1.11; color: var(--ink); font-weight: 800; letter-spacing: -.05em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-detail { display: flex; flex-wrap: wrap; gap: 3px 6px; align-items: center; font-size: 10px; color: var(--muted); margin-top: auto; padding-top: 4px; }
.metric-detail .trend { white-space: nowrap; }
.trend, .badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 99px; padding: 3px 7px; font-size: 10px; line-height: 1.3; font-weight: 800; background: #f1f0f7; color: #636380; }
.trend, .trend-positive, .badge-success, .badge.good, .badge.positive { color: var(--positive); background: var(--positive-bg); }
.trend-negative, .badge-danger, .badge.negative { color: var(--danger); background: var(--danger-bg); }
.badge-warning, .badge.warning { color: var(--warning); background: var(--warning-bg); }
.badge-neutral { color: #5b5879; background: #efedf6; }

.report-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr); gap: 13px; margin-top: 13px; }
.panel { min-width: 0; padding: 16px; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.panel-header h2, .panel-header h3 { font-weight: 800; line-height: 1.26; letter-spacing: -.029em; font-size: 17px; }
.panel-header p { margin-top: 4px; }
.panel p, .section-header p { color: var(--muted); font-size: 12px; }
.period-switch {
  display: flex;
  gap: 2px;
  border: 1px solid var(--line);
  background: #f7f7fb;
  padding: 3px;
  border-radius: 8px;
}
.period-switch button, .period-switch a {
  white-space: nowrap;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  font-size: 10px;
  font-weight: 750;
  padding: 4px 7px;
}
.period-switch button:hover, .period-switch a:hover { color: var(--accent-strong); }
.period-switch [aria-pressed="true"], .period-switch [aria-current], .period-switch .active {
  color: var(--accent-strong);
  border-color: #e9e3f4;
  background: #fff;
  box-shadow: 0 1px 2px #2821420d;
}
.chart-wrap { min-width: 0; color: var(--accent); margin-top: 10px; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-wrap svg text { font-family: var(--font); }
.action-list, .audit-list, .review-list { list-style: none; padding: 0; margin: 0; }
.action { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.action strong { font-size: 12px; font-weight: 800; display: block; }
.action p { font-size: 11px; line-height: 1.43; margin-top: 3px; overflow-wrap: anywhere; }
.action-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  color: var(--accent);
  background: var(--accent-bg);
  border-radius: 8px;
  flex: none;
}
.action-icon .icon { width: 15px; height: 15px; }
.action:nth-child(1) .action-icon, .action-icon.warning { background: var(--warning-bg); color: var(--warning); }
.action:nth-child(2) .action-icon { background: #eaf3ff; color: #426299; }
.action:nth-child(3) .action-icon { background: var(--accent-bg); color: var(--accent); }

.report-section { margin-top: 23px; }
.report-section:first-child { margin-top: 0; }
.section-header { margin-bottom: 9px; }
.section-header h2 { font-weight: 800; font-size: 20px; letter-spacing: -.03em; }
.section-header p { margin-top: 3px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.table-wrap { overflow: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { background: #f8f8fc; font-size: 11px; color: var(--muted); font-weight: 800; }
th:first-child { border-start-start-radius: 7px; }
th:last-child { border-start-end-radius: 7px; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.review, .audit-item, .source-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.review { display: block; }
.review p, .audit-item p, .source-item p { margin-top: 4px; overflow-wrap: anywhere; }
.review strong, .audit-item strong, .source-item strong { font-size: 12px; font-weight: 800; }
.review time { font-size: 11px; color: var(--muted); }
.empty-state, .section-error {
  padding: 17px;
  border-radius: 11px;
  color: var(--muted);
  background: #f8f8fc;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.section-error { background: #fff5ec; color: #845119; }
.empty-state p + p, .section-error p + p { margin-top: 5px; }
.report-rate-limit { margin-top: 13px; }
.sources-dialog { width: min(530px, calc(100vw - 32px)); max-height: 80vh; margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: 0 16px 64px #26194142; }
.sources-dialog::backdrop { background: #1c193d64; }
.dialog-header { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 12px; }
.dialog-header h2 { font-size: 19px; letter-spacing: -.02em; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fafafe; }
.icon-button:hover { color: var(--accent); background: var(--accent-bg); }
.icon-button .icon { width: 17px; height: 17px; }
#sources-content { font-size: 13px; color: var(--muted); }
#sources-content p + p { margin-top: 8px; }
#sources-content code { overflow-wrap: anywhere; color: #4c3a72; }

@media (max-width: 1080px) {
  .app-layout { grid-template-columns: 192px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .content { padding-inline: 24px; }
  .metric, .panel { padding-inline: 12px; }
}
@media (max-width: 850px) {
  .app-layout { grid-template-columns: 68px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; align-items: center; }
  .brand { padding: 0; }
  .brand-wordmark, .marketplace span:last-child, .side-nav a span, .sidebar-footer > div { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
  .marketplace { margin: 22px 0 16px; padding: 5px; }
  .side-nav a { justify-content: center; width: 42px; min-height: 42px; padding: 0; }
}
@media (max-width: 680px) {
  .app-layout { display: block; }
  .sidebar { position: static; height: auto; padding: 11px 14px; display: flex; flex-direction: row; justify-content: space-between; gap: 9px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-icon { width: 32px; height: 32px; border-radius: 9px; }
  .brand-icon .icon { width: 19px; height: 19px; }
  .marketplace, .sidebar-footer { display: none; }
  .side-nav { grid-template-columns: repeat(5, minmax(31px, 1fr)); gap: 3px; }
  .side-nav a { width: 37px; min-height: 35px; }
  .side-nav .icon { width: 16px; height: 16px; }
  .content { padding: 19px 14px 32px; }
  .page-header { align-items: flex-start; flex-wrap: wrap; gap: 9px; margin-bottom: 14px; }
  .page-header p { font-size: 12px; margin-top: 4px; }
  .source-status { min-height: 33px; padding: 5px 8px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 101px; }
  .report-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .search-card { padding: 10px; }
  .search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .cabinet-picker { grid-column: 1 / -1; width: min(100%, 148px); }
  .search-field { gap: 5px; min-height: 39px; padding: 0 6px; }
  .search-field input, .article-picker select, .button { font-size: 12px; }
  .button { padding-inline: 9px; }
  .product-card { position: relative; flex-wrap: wrap; gap: 9px; padding: 10px; }
  .product-image, .product-image img, img.product-image { width: 58px; height: 58px; }
  .product-link { min-height: 32px; padding: 4px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.table-note { margin-top: 10px; }
.size-table { margin-top: 14px; }
.source-form { margin-top: 8px; display: grid; gap: 8px; }
.source-cabinet-fields {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.source-cabinet-fields legend { padding: 0 4px; color: var(--ink); font-weight: 800; }
.source-cabinet-label { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.source-form label { display: grid; gap: 4px; color: var(--ink); font-weight: 800; }
.source-form input { width: 100%; padding: 10px 11px; color: var(--ink); background: #fbfaff; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: 500; }
.source-form input:focus { outline: 2px solid #b895fc; outline-offset: 1px; }
.source-form .source-remove {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.source-form .source-remove input { width: auto; margin: 0; padding: 0; accent-color: var(--accent); }
.source-save-status:empty { display: none; }
.source-save-status[data-kind="error"] { color: var(--danger); }
.source-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.team-management { display: grid; gap: 4px; margin: 4px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.team-management h3 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 800; }
.team-link-copy { font-size: 11px; overflow-wrap: anywhere; user-select: all; }
.search-hint[hidden] { display: none; }
.action a:hover { color: var(--accent-strong); text-decoration: underline; }
.button:disabled { cursor: progress; opacity: .65; }
.panel > .section-error + *, .section-error + .panel, .section-error + .detail-grid { margin-top: 9px; }
details summary { cursor: pointer; color: var(--accent-strong); font-size: 13px; font-weight: 750; }

.report-period { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 13px; color: var(--muted); font-size: 11px; }
.report-period strong { color: var(--ink); margin-inline-start: 4px; font-weight: 750; }
