* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-pattern, var(--bg));
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  filter: contrast(var(--contrast-filter, 1));
}

a {
  color: inherit;
}

.muted {
  color: var(--muted);
}

.mini {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 18px 80px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  margin-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: conic-gradient(from 45deg, var(--primary), var(--accent), var(--teal), var(--primary));
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}

.nav-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-strong);
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.contrast-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
}

.contrast-control input[type='range'] {
  accent-color: var(--primary);
  width: 120px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--border);
}

[data-theme='dark'] .pill {
  background: rgba(255, 255, 255, 0.06);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), #ff7f5c);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(226, 59, 59, 0.28), var(--glow-primary);
}

.btn.secondary {
  background: linear-gradient(135deg, var(--secondary), var(--teal));
  color: #062814;
  border-color: transparent;
}

.btn.ghost {
  background: transparent;
}

.btn.chip {
  background: var(--surface-strong);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(91, 124, 250, 0.2);
}

.btn:active {
  transform: translateY(0);
  opacity: 0.92;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.6;
}

.hero::before {
  width: 240px;
  height: 240px;
  right: -80px;
  top: -40px;
  background: radial-gradient(circle, rgba(226, 59, 59, 0.28), transparent 60%);
}

.hero::after {
  width: 260px;
  height: 260px;
  left: -60px;
  bottom: -120px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.18), transparent 60%);
}

.hero h1 {
  margin: 6px 0;
  font-family: var(--font-heading);
  font-size: 30px;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 18px 0 10px;
  flex-wrap: wrap;
}

.section-head h2,
.section-head h3 {
  margin: 4px 0;
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
}

.upgrade {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(226, 59, 59, 0.08), rgba(20, 184, 166, 0.1));
  box-shadow: var(--shadow);
}

.upgrade-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.5));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}

[data-theme='dark'] .card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.card h3 {
  margin: 4px 0;
  font-family: var(--font-heading);
}

.card.highlight {
  border-color: rgba(226, 59, 59, 0.25);
  background: linear-gradient(135deg, rgba(226, 59, 59, 0.12), rgba(20, 184, 166, 0.08));
}

.control {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
}

.toggle input {
  accent-color: var(--primary);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.control-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.7), rgba(91, 124, 250, 0.08));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}

[data-collapsible='true'] .control-card-head {
  cursor: pointer;
}

[data-collapsed='true'] {
  max-height: 54px;
  overflow: hidden;
}

[data-theme='dark'] .control-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(20, 184, 166, 0.1));
}

.control-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.control-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
}

.label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.control-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.control-card input:focus-visible,
.share-fields input:focus-visible,
.share-actions input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 124, 250, 0.2);
}

.split {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.status-dot::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.status-dot.ready::before {
  background: var(--success);
}

.status-dot.warn::before {
  background: var(--warning);
}

.status-dot.error::before {
  background: var(--error);
}

.live {
  margin: 18px 0 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(91, 124, 250, 0.08), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}

.live-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.live-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.live-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  align-items: flex-start;
  margin-top: 12px;
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.live-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

[data-theme='dark'] .live-card {
  background: rgba(255, 255, 255, 0.02);
}

.live-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 700;
}

.live-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.live-metric:first-of-type {
  border-top: none;
}

.live-metric strong {
  font-size: 18px;
  font-family: var(--font-heading);
}

.strategy {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--surface);
}

[data-theme='dark'] .strategy {
  background: rgba(255, 255, 255, 0.03);
}

.strategy h3 {
  margin: 4px 0;
  font-family: var(--font-heading);
}

.strategy ul {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.6;
  color: var(--text);
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-top: 12px;
}

[data-theme='dark'] .chart-card {
  background: rgba(255, 255, 255, 0.03);
}

.chart-bars {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  height: 180px;
  margin-top: 10px;
  position: relative;
}

.chart-bar {
  flex: 1;
  position: relative;
  border-radius: 12px 12px 6px 6px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  overflow: hidden;
}

.chart-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(135deg, var(--bar-1), var(--accent));
  height: 20%;
  transition: height 0.2s ease, opacity 0.2s ease;
  opacity: 0.9;
}

.chart-bar[data-kind='corporate'] .chart-bar-fill {
  background: linear-gradient(135deg, var(--bar-2), var(--primary));
}

.chart-bar[data-kind='financial'] .chart-bar-fill {
  background: linear-gradient(135deg, var(--bar-3), var(--secondary));
}

.chart-bar label {
  position: absolute;
  bottom: 6px;
  left: 8px;
  font-size: 12px;
  color: var(--text);
}

.chart-tooltip {
  position: absolute;
  padding: 8px 10px;
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 50;
}

.summary-sidebar {
  position: sticky;
  top: 76px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  transition: max-height 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  max-height: 720px;
}

.summary-sidebar.collapsed {
  max-height: 64px;
  overflow: hidden;
  opacity: 0.92;
  transform: translateY(2px);
}

.summary-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.summary-toggle {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--muted);
}

.summary-metric {
  padding: 10px 0;
  border-top: 1px dashed var(--border);
}

.summary-metric:first-of-type {
  border-top: none;
}

.summary-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-value {
  font-family: var(--font-heading);
  font-size: 18px;
  margin: 6px 0 2px;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
}

.legend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}

.quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.note {
  margin-top: 8px;
  margin-bottom: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: var(--surface-soft);
  color: var(--muted);
}

.tabs {
  margin-top: 18px;
}

.tab-bar {
  display: inline-flex;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(226, 59, 59, 0.15), rgba(91, 124, 250, 0.15));
  color: var(--text);
  box-shadow: var(--glow-primary);
}

.accordion-bar {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.accordion-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin: 6px 0;
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
}

.frame-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface);
}

iframe {
  width: 100%;
  height: 1100px;
  border: none;
  background: #0b1224;
}

.community {
  margin: 24px 0;
}

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.ad-card .ad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.ad-item {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(47, 179, 106, 0.12);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.ad-item:hover {
  border-color: var(--secondary);
}

.board-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.6;
  color: var(--text);
}

.list.small {
  padding-left: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.share-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.share-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}

.share-fields input,
.share-actions input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  width: 100%;
}

.share-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.share-actions input {
  flex: 1;
  min-width: 200px;
}

.deploy {
  margin-top: 28px;
  background: linear-gradient(135deg, rgba(226, 59, 59, 0.12), rgba(91, 124, 250, 0.12));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.deploy h2 {
  margin: 6px 0;
}

.deploy ol {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text);
}

.deploy code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

[data-theme='dark'] .deploy code {
  background: rgba(255, 255, 255, 0.08);
}

.flow {
  margin: 22px 0;
}

.flow-chart {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

[data-theme='dark'] .flow-chart {
  background: rgba(255, 255, 255, 0.03);
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.flow-step {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface-soft);
  opacity: 0.8;
}

.flow-step .flow-pill {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 10px;
  font-size: 12px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.flow-step.active {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
  background: linear-gradient(135deg, rgba(226, 59, 59, 0.14), rgba(91, 124, 250, 0.12));
  opacity: 1;
}

.flow-step.complete {
  border-color: var(--secondary);
  background: linear-gradient(135deg, rgba(47, 179, 106, 0.12), rgba(20, 184, 166, 0.1));
  opacity: 1;
}

.flow-step .mini {
  display: block;
  margin-top: 4px;
}

.bar-legend {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.bar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 13px;
}

.bar1 {
  background: linear-gradient(90deg, var(--bar-1), rgba(34, 211, 238, 0.3));
}

.bar2 {
  background: linear-gradient(90deg, var(--bar-2), rgba(124, 58, 237, 0.2));
}

.bar3 {
  background: linear-gradient(90deg, var(--bar-3), rgba(244, 211, 94, 0.2));
}

.tooltip {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-strong);
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  white-space: nowrap;
  min-width: 180px;
  max-width: 240px;
  text-align: center;
  z-index: 40;
}

.tooltip:focus-visible::after,
.tooltip:hover::after {
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 18px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  width: min(720px, 96vw);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal h3 {
  margin: 0;
  font-family: var(--font-heading);
}

.close-modal {
  border: none;
  background: var(--surface-soft);
  border-radius: 10px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 960px) {
  iframe {
    height: 900px;
  }
}
