:root {
  color-scheme: dark;
  --bg: #0a0d11;
  --bg-2: #0f1319;
  --panel: rgba(18, 22, 28, 0.9);
  --panel-2: rgba(24, 29, 37, 0.96);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f7fb;
  --muted: #97a1af;
  --blue: #57a8ff;
  --cyan: #66d9ff;
  --green: #4ddf9a;
  --amber: #ffd166;
  --orange: #ff9f5a;
  --red: #ff6b6b;
  --violet: #b48cff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  font-family: "SF Pro Display", "Segoe UI Variable", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(87, 168, 255, 0.15), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(180, 140, 255, 0.16), transparent 24%),
    radial-gradient(circle at bottom right, rgba(77, 223, 154, 0.08), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02)),
    radial-gradient(circle at center, transparent 0 65%, rgba(255, 255, 255, 0.02) 100%);
  opacity: 0.8;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

img,
canvas {
  display: block;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
  overflow-wrap: anywhere;
}

label {
  display: block;
}

.app-shell {
  position: relative;
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -18px -18px 18px;
  padding: calc(16px + env(safe-area-inset-top)) 18px 14px;
  background: rgba(9, 12, 16, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px) saturate(1.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brand-mark,
.avatar,
.editor-avatar {
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 16px 36px rgba(87, 168, 255, 0.28);
}

.brand-mark {
  width: 48px;
  height: 48px;
}

.avatar,
.editor-avatar {
  width: 56px;
  height: 56px;
  font-size: 24px;
}

.editor-avatar {
  background: linear-gradient(135deg, var(--accent, var(--blue)), rgba(24, 29, 37, 0.95));
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

h2 {
  max-width: 780px;
  font-size: clamp(28px, 6.8vw, 58px);
  line-height: 0.96;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h4 {
  font-size: 18px;
  line-height: 1.25;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(33, 39, 49, 0.96), rgba(18, 22, 28, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line-strong);
}

.icon-button:disabled {
  opacity: 0.65;
  cursor: progress;
}

.soft-label,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.02);
}

.status-online {
  border-color: rgba(77, 223, 154, 0.34);
  color: #8df4bd;
}

.status-standby,
.status-setup {
  border-color: rgba(255, 209, 102, 0.34);
  color: #ffd86b;
}

.status-limited,
.status-waiting {
  border-color: rgba(255, 159, 90, 0.34);
  color: #ffb47d;
}

.status-disabled {
  border-color: rgba(255, 255, 255, 0.16);
  color: #c2c9d4;
}

.status-done {
  border-color: rgba(102, 217, 255, 0.34);
  color: #8fe4ff;
}

.status-active {
  border-color: rgba(87, 168, 255, 0.34);
  color: #9cd0ff;
}

.status-alert {
  border-color: rgba(255, 107, 107, 0.34);
  color: #ff9c9c;
}

.hero-panel,
.panel,
.metric-card,
.agent-card,
.channel-item,
.timeline-item,
.mini-stat,
.subscription-item,
.transaction-item,
.editor-row,
.subscription-editor,
.field-group input,
.field-group select {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.hero-panel,
.panel {
  border-radius: 24px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 24px;
  align-items: center;
  min-height: 420px;
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(87, 168, 255, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(16, 20, 26, 0.96), rgba(24, 29, 37, 0.96));
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  gap: 16px;
}

#systemLine {
  max-width: 680px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.hero-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(560px, 100%);
}

.hero-chip {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(12, 16, 21, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.hero-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero-chip strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.hero-visual {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, rgba(12, 16, 21, 0.92), rgba(7, 10, 14, 0.92));
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.3);
}

.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.metrics-grid,
.agent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.skills-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.skill-card {
  display: grid;
  gap: 12px;
  min-height: 180px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(22, 27, 35, 0.98), rgba(16, 20, 26, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.skill-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.skill-card h4 {
  margin-top: 4px;
  font-size: 17px;
}

.skill-description {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.skill-note {
  color: #8db1d9;
  font-size: 12px;
  line-height: 1.45;
}

.skill-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #d9e1ea;
  font-size: 12px;
}

.metric-card {
  padding: 16px;
  min-height: 124px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(21, 26, 33, 0.98), rgba(15, 19, 25, 0.98));
}

.metric-value {
  margin-top: 12px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.metric-bar {
  width: 100%;
  height: 7px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.metric-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 16, 21, 0.84);
  backdrop-filter: blur(18px);
}

.tab {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab.is-active {
  background: linear-gradient(180deg, rgba(33, 39, 49, 0.98), rgba(24, 29, 37, 0.98));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tab-panel {
  display: none;
}

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

.layout-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(0, 1.08fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(18, 22, 28, 0.94), rgba(13, 16, 21, 0.96));
}

.panel-heading,
.section-heading,
.agent-card-top,
.editor-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

.finance-panel {
  display: grid;
  gap: 16px;
  align-content: start;
}

.finance-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mini-stat {
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(27, 33, 42, 0.96), rgba(20, 25, 32, 0.96));
}

.mini-stat span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.mini-stat strong {
  font-size: 20px;
  line-height: 1.1;
}

.finance-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.8fr);
  gap: 12px;
}

.finance-chart-block {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(14, 18, 24, 0.96), rgba(10, 13, 17, 0.96));
}

.finance-chart-block canvas {
  width: 100%;
  height: 210px;
  margin-top: 8px;
  border-radius: 14px;
  background: rgba(8, 11, 15, 0.96);
}

.finance-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.note-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(87, 168, 255, 0.08);
  border: 1px solid rgba(87, 168, 255, 0.25);
  color: #dcecff;
  font-size: 12px;
}

.finance-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.subscription-list,
.transaction-list,
.agent-editor-list,
.subscription-editor-list {
  display: grid;
  gap: 10px;
}

.subscription-item,
.transaction-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(24, 28, 36, 0.98), rgba(18, 22, 29, 0.98));
}

.subscription-item strong,
.transaction-item strong {
  display: block;
}

.subscription-item span,
.transaction-item span,
.editor-row-copy span,
.editor-row-meta,
.field-group span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.subscription-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
  text-align: right;
}

.subscription-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.transaction-amount.positive {
  color: #88f0ba;
}

.transaction-amount.negative {
  color: #ffb47d;
}

.empty-state {
  padding: 12px;
  border-radius: 16px;
  background: rgba(24, 28, 36, 0.98);
  color: var(--muted);
  font-size: 13px;
}

.agent-card {
  min-height: 220px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(22, 27, 35, 0.98), rgba(16, 20, 26, 0.98));
}

.agent-card .avatar {
  width: 58px;
  height: 58px;
}

.agent-role {
  min-height: 48px;
  color: var(--muted);
  line-height: 1.45;
}

.agent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.provider-chip,
.model-chip,
.cost-chip {
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #d9e1ea;
  font-size: 12px;
}

.chart-panel canvas {
  width: 100%;
  height: 260px;
  margin-top: 16px;
  border-radius: 14px;
  background: rgba(8, 11, 15, 0.96);
}

.channel-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.channel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 78px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(24, 28, 36, 0.98), rgba(18, 22, 29, 0.98));
}

.channel-item strong {
  display: block;
  margin-bottom: 4px;
}

.channel-item span:first-child {
  color: var(--muted);
  font-size: 13px;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 29, 37, 0.98), rgba(18, 22, 29, 0.98));
  color: #dfe6ee;
  font-size: 14px;
}

.topic-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(87, 168, 255, 0.14);
  color: #9cd0ff;
  font-size: 12px;
  font-weight: 800;
  flex: none;
}

.timeline {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(24, 28, 36, 0.98), rgba(18, 22, 29, 0.98));
}

.timeline-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.editor-panel {
  margin: 16px 0;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.editor-column {
  min-width: 0;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(14, 18, 24, 0.98), rgba(10, 13, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.field-group {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.field-group span {
  margin-top: 0;
}

.field-group input,
.field-group select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(17, 21, 27, 0.98);
  outline: none;
}

.field-group input::placeholder {
  color: rgba(151, 161, 175, 0.75);
}

.field-group input:focus,
.field-group select:focus {
  border-color: rgba(87, 168, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(87, 168, 255, 0.12);
}

.budget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.editor-row,
.subscription-editor {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(24, 28, 36, 0.98), rgba(18, 22, 29, 0.98));
}

.editor-row-head {
  align-items: center;
  margin-bottom: 10px;
}

.editor-row-copy {
  flex: 1;
}

.editor-row-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.subscription-avatar {
  width: 46px;
  height: 46px;
  font-size: 15px;
  background: linear-gradient(135deg, rgba(87, 168, 255, 0.95), rgba(180, 140, 255, 0.92));
}

.subscription-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

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

.reset-button {
  width: 44px;
  height: 44px;
}

@media (max-width: 980px) {
  .hero-panel,
  .dashboard-grid,
  .layout-two,
  .channel-list,
  .editor-grid,
  .finance-charts,
  .finance-columns {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: auto;
  }

  .metrics-grid,
  .agent-grid,
  .skills-grid,
  .skills-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-inline: 12px;
  }

  .topbar {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .topbar-meta {
    gap: 6px;
  }

  h1 {
    font-size: 19px;
  }

  h2 {
    font-size: 34px;
  }

  .hero-panel,
  .panel {
    padding: 14px;
    border-radius: 20px;
  }

  .metrics-grid,
  .agent-grid,
  .skills-grid,
  .skills-summary,
  .topic-grid,
  .finance-summary-grid,
  .finance-charts,
  .finance-columns,
  .budget-grid,
  .subscription-editor-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-highlights {
    grid-template-columns: 1fr;
  }

  .subscription-item,
  .transaction-item {
    flex-direction: column;
  }

  .subscription-meta {
    justify-items: start;
    text-align: left;
  }

  .timeline-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .timeline-item .status-pill {
    grid-column: 2;
    justify-self: start;
  }

  .editor-row-head,
  .panel-heading,
  .section-heading,
  .agent-card-top,
  .editor-row-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .hero-chip strong {
    font-size: 17px;
  }

  .metric-value {
    font-size: 26px;
  }
}
