.stock-sector-comparison {
  --stock-chart-blue-start: #00d4ff;
  --stock-chart-blue-middle: #0891b2;
  --stock-chart-blue-end: #0e7490;
  --stock-chart-blue-point: #0891b2;
  --stock-chart-blue-glow: rgba(8, 145, 178, 0.3);
  --stock-chart-violet-start: #a78bfa;
  --stock-chart-violet-middle: #7c3aed;
  --stock-chart-violet-end: #6d28d9;
  --stock-chart-violet-point: #7c3aed;
  --stock-chart-violet-glow: rgba(124, 58, 237, 0.28);
  margin: 22px auto;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 24px;
  background: radial-gradient(circle at 8% 0%, rgba(255, 43, 214, 0.07), transparent 27%), radial-gradient(circle at 92% 0%, rgba(0, 230, 118, 0.06), transparent 28%), linear-gradient(180deg, #fff 0%, #f8fbff 100%);
  color: #0f172a;
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.07);
}

.stock-sector-comparison__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 19px 22px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.96), rgba(240, 249, 255, 0.88));
}

.stock-sector-comparison__header h2 { margin: 4px 0 0; font-size: 20px; line-height: 1.2; letter-spacing: -0.02em; }
.stock-sector-comparison__header p { max-width: 820px; margin: 8px 0 0; color: #64748b; font-size: 13px; line-height: 1.55; }
.stock-sector-comparison__kicker { background: linear-gradient(90deg, #ff2bd6, #7c3aed, #0891b2); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.stock-sector-comparison__date-form { display: flex; align-items: flex-end; gap: 9px; flex: 0 0 auto; }
.stock-sector-comparison__date-field label { display: block; margin-bottom: 6px; color: #475569; font-size: 11px; font-weight: 800; }
.stock-sector-comparison__date-field input { min-height: 38px; box-sizing: border-box; padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #0f172a; font: inherit; font-size: 12px; outline: none; }
.stock-sector-comparison__date-field input:focus { border-color: #0891b2; box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12); }
.stock-sector-comparison__date-actions { display: flex; align-items: center; gap: 7px; }
.stock-sector-comparison__button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; box-sizing: border-box; padding: 8px 11px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #334155; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; line-height: 1; text-decoration: none; }
.stock-sector-comparison__button:hover { border-color: #94a3b8; background: #f8fafc; }
.stock-sector-comparison__button--primary { border-color: #0891b2; background: #0891b2; color: #fff; }
.stock-sector-comparison__button--primary:hover { border-color: #0e7490; background: #0e7490; }
.stock-sector-comparison__summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 16px 18px 0; }
.stock-sector-comparison__summary-card { min-width: 0; padding: 13px 14px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; box-shadow: 0 8px 22px rgba(15, 23, 42, 0.035); }
.stock-sector-comparison__summary-card > span, .stock-sector-comparison__summary-card > strong, .stock-sector-comparison__summary-card > small { display: block; }
.stock-sector-comparison__summary-card > span { color: #64748b; font-size: 10px; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; }
.stock-sector-comparison__summary-card > strong { margin-top: 7px; color: #0f172a; font-size: 20px; line-height: 1.1; letter-spacing: -0.02em; }
.stock-sector-comparison__summary-card > small { margin-top: 5px; overflow: hidden; color: #64748b; font-size: 11px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.stock-sector-comparison__summary-card .is-positive { color: #047857; }
.stock-sector-comparison__summary-card .is-negative { color: #b91c1c; }
.stock-sector-comparison__summary-card--benchmark { border-color: #ddd6fe; background: #faf5ff; }
.stock-sector-comparison__summary-card--benchmark > strong { color: #6d28d9; }
.stock-sector-comparison__legend { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 14px 18px 4px; }
.stock-sector-comparison__legend-item, .stock-sector-comparison__legend-metric { min-width: 0; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fbfdff; }
.stock-sector-comparison__legend-item { display: flex; align-items: flex-start; gap: 9px; grid-column: span 2; transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease; }
.stock-sector-comparison__legend-item[role="button"]:hover { border-color: #cbd5e1; background: #fff; box-shadow: 0 7px 18px rgba(15, 23, 42, 0.05); }
.stock-sector-comparison__legend-item[role="button"]:focus-visible { outline: 3px solid rgba(8, 145, 178, 0.16); outline-offset: 2px; }
.stock-sector-comparison__legend-item[aria-pressed="false"] { opacity: 0.42; }
.stock-sector-comparison__legend-item strong, .stock-sector-comparison__legend-item small { display: block; }
.stock-sector-comparison__legend-item strong { font-size: 12px; }
.stock-sector-comparison__legend-item small { margin-top: 3px; color: #64748b; font-size: 11px; line-height: 1.35; }
.stock-sector-comparison__legend-swatch { width: 28px; height: 4px; margin-top: 7px; border-radius: 999px; flex: 0 0 auto; }
.stock-sector-comparison__legend-swatch--symbol { background: linear-gradient(90deg, var(--stock-chart-blue-start), var(--stock-chart-blue-middle), var(--stock-chart-blue-end)); box-shadow: 0 0 8px var(--stock-chart-blue-glow); }
.stock-sector-comparison__legend-swatch--sector { background: linear-gradient(90deg, var(--stock-chart-violet-start), var(--stock-chart-violet-middle), var(--stock-chart-violet-end)); box-shadow: 0 0 8px var(--stock-chart-violet-glow); }
.stock-sector-comparison__legend-metric span, .stock-sector-comparison__legend-metric strong { display: block; }
.stock-sector-comparison__legend-metric span { color: #64748b; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.stock-sector-comparison__legend-metric strong { margin-top: 5px; font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1.35; }
.stock-sector-comparison__chart { min-height: 442px; margin: 14px 18px 8px; padding: 10px; overflow: hidden; border: 1px solid rgba(148, 163, 184, 0.28); border-radius: 20px; background: rgba(255, 255, 255, 0.96); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 12px 32px rgba(15, 23, 42, 0.05); }
.stock-sector-comparison__chart .stock-mila-canvas { width: 100%; min-width: 0; }
.stock-sector-comparison__chart canvas { display: block; max-width: 100%; cursor: crosshair; }
.stock-sector-comparison__chart canvas:focus-visible { outline: 2px solid #0891b2; outline-offset: 3px; }
.stock-sector-comparison__chart-help { margin: 0 20px 18px; color: #64748b; font-size: 10px; line-height: 1.5; }
.stock-sector-comparison__status { display: inline-flex !important; align-items: center; width: fit-content; max-width: 100%; padding: 5px 8px; border: 1px solid #e2e8f0; border-radius: 999px; background: #f8fafc; color: #475569 !important; font-size: 11px !important; font-weight: 900; letter-spacing: 0; line-height: 1; white-space: nowrap; }
.stock-sector-comparison__status--outperforming, .stock-sector-comparison__status--improving { border-color: #bbf7d0; background: #f0fdf4; color: #047857 !important; }
.stock-sector-comparison__status--underperforming, .stock-sector-comparison__status--weakening { border-color: #fecaca; background: #fef2f2; color: #b91c1c !important; }
.stock-sector-comparison__status--performing-in-line, .stock-sector-comparison__status--mixed { border-color: #fde68a; background: #fffbeb; color: #92400e !important; }
.stock-sector-comparison__rankings { margin: 0 18px 18px; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
.stock-sector-comparison__rankings summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; background: #fbfdff; cursor: pointer; font-size: 13px; font-weight: 800; list-style: none; }
.stock-sector-comparison__rankings summary::-webkit-details-marker { display: none; }
.stock-sector-comparison__rankings summary small { color: #64748b; font-size: 11px; font-weight: 500; }
.stock-sector-comparison__table-wrapper { width: 100%; overflow-x: auto; border-top: 1px solid #e2e8f0; }
.stock-sector-comparison__table { width: 100%; min-width: 1080px; border-collapse: collapse; font-size: 12px; }
.stock-sector-comparison__table th, .stock-sector-comparison__table td { padding: 10px 12px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.stock-sector-comparison__table th { background: #fff; color: #64748b; font-size: 10px; font-weight: 900; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.stock-sector-comparison__table tbody tr:last-child td { border-bottom: 0; }
.stock-sector-comparison__table tbody tr:hover { background: #fbfdff; }
.stock-sector-comparison__table tbody tr.is-closest { background: #faf5ff; }
.stock-sector-comparison__table td strong, .stock-sector-comparison__table td small { display: block; }
.stock-sector-comparison__table td small { margin-top: 2px; color: #64748b; font-size: 10px; }
.stock-sector-comparison__table .numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stock-sector-comparison__rank { color: #64748b; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; font-weight: 800; }
.stock-sector-comparison__empty { display: grid; gap: 5px; margin: 18px; padding: 24px; border: 1px dashed #cbd5e1; border-radius: 14px; background: #f8fafc; color: #64748b; text-align: center; }
.stock-sector-comparison__empty strong { color: #0f172a; font-size: 14px; }
.stock-sector-comparison__empty span { font-size: 12px; line-height: 1.45; }
.stock-sector-comparison__empty--error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.stock-sector-comparison__empty--error strong { color: #991b1b; }

@media (max-width: 1180px) {
  .stock-sector-comparison__summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stock-sector-comparison__legend { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .stock-sector-comparison { border-radius: 18px; }
  .stock-sector-comparison__header { display: block; padding: 16px; }
  .stock-sector-comparison__date-form { align-items: stretch; flex-direction: column; margin-top: 14px; }
  .stock-sector-comparison__date-field input, .stock-sector-comparison__button { width: 100%; }
  .stock-sector-comparison__date-actions { align-items: stretch; }
  .stock-sector-comparison__summary, .stock-sector-comparison__legend { grid-template-columns: 1fr; padding-left: 16px; padding-right: 16px; }
  .stock-sector-comparison__legend-item { grid-column: span 1; }
  .stock-sector-comparison__chart, .stock-sector-comparison__rankings { margin-left: 16px; margin-right: 16px; }
  .stock-sector-comparison__rankings summary { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .stock-sector-comparison__legend-item { transition: none; }
}
