:root {
  --bg: #0b1020;
  --surface: #11182b;
  --surface-2: #172036;
  --line: #27324a;
  --text: #f7f9fc;
  --muted: #9aa7bd;
  --accent: #6ea8fe;
  --accent-2: #8b5cf6;
  --success: #35d07f;
  --danger: #ff7c88;
  --warning: #f7bf59;
  --shadow: 0 22px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(110, 168, 254, .12), transparent 34%),
    linear-gradient(180deg, #090e1b, var(--bg));
  color: var(--text);
  font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
}

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

a { color: var(--accent); }

.shell {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 70px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 24px;
}

.kicker,
.step {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: 0;
}

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

.status-pill,
.mini-status {
  border: 1px solid var(--line);
  background: rgba(17, 24, 43, .85);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.status-pill.ok {
  color: var(--success);
  border-color: rgba(53, 208, 127, .35);
}

.status-pill.warn {
  color: var(--warning);
  border-color: rgba(247, 191, 89, .4);
}

.status-dashboard {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.status-metric {
  min-height: 132px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17, 24, 43, .92);
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.status-metric.active,
.status-metric:hover {
  border-color: var(--accent);
}

.status-metric-label,
.status-metric small {
  display: block;
  color: var(--muted);
}

.status-metric-label {
  font-size: 12px;
  font-weight: 800;
}

.status-metric-value {
  display: block;
  margin-top: 12px;
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0;
}

.status-metric small {
  margin-top: 10px;
  font-size: 11px;
}

.grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  background: rgba(17, 24, 43, .92);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

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

.analytics-actions,
.actions,
.toolbar-controls,
.meta-row,
.card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.performance-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.performance-card {
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.performance-card.highlight {
  border-color: rgba(53, 208, 127, .42);
  background: linear-gradient(180deg, rgba(53, 208, 127, .12), var(--surface-2));
}

.performance-card span,
.performance-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.performance-card strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
  line-height: 1;
}

.performance-card small { margin-top: 10px; }

.analytics-table-wrap {
  margin-top: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.analytics-table {
  min-width: 620px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 90px 90px 90px;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.table-row:last-child { border-bottom: 0; }

.table-head {
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
  font-weight: 900;
}

.dashboard-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.toolbar-copy p {
  margin: 8px 0 0;
  color: var(--muted);
}

.toolbar-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px auto;
}

.leads-panel { margin-bottom: 18px; }

.leads-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.item-card,
.lead-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  padding: 15px;
}

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

.item-top strong {
  display: block;
  font-size: 16px;
}

.item-top p,
.lead-card p,
.meta-row,
.empty,
.empty-state,
.error-text {
  margin: 8px 0 0;
  color: #d9e2ef;
  font-size: 13px;
  line-height: 1.55;
}

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

.card-actions {
  margin-top: 12px;
}

.empty,
.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border-style: dashed;
}

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

label {
  display: grid;
  gap: 7px;
}

label > span {
  color: #dbe4f1;
  font-size: 13px;
  font-weight: 800;
}

.wide { grid-column: 1 / -1; }

input,
textarea,
select,
.prompt-editor {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 46px;
  padding: 0 13px;
}

textarea {
  padding: 12px 13px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 168, 254, .12);
}

.primary,
.secondary,
.ghost,
.button-link {
  border: 0;
  border-radius: 11px;
  min-height: 46px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary {
  margin-top: 18px;
  color: white;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.secondary,
.button-link {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.ghost {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.prompt-editor {
  min-height: 555px;
  padding: 16px;
  line-height: 1.62;
}

.remote-console {
  display: grid;
  gap: 14px;
}

.remote-console .actions .primary {
  margin-top: 0;
}

.remote-console p {
  color: var(--muted);
  line-height: 1.7;
}

.form-message {
  display: inline-block;
  margin: 12px 0 0;
}

.run-panel { margin-top: 18px; }

.operation-history-list {
  display: grid;
  gap: 10px;
}

.progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #0a0f1c;
  border: 1px solid var(--line);
  margin-top: 12px;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--value);
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .35s ease;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(154, 167, 189, .12);
  color: var(--muted);
}

.badge.COMPLETED { color: var(--success); }
.badge.FAILED { color: var(--danger); }
.badge.RUNNING,
.badge.CLAIMED { color: var(--accent); }
.badge.PENDING { color: var(--warning); }

.error-text {
  color: var(--danger);
}

@media (max-width: 1120px) {
  .status-dashboard,
  .performance-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .leads-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1380px);
    padding-top: 24px;
  }

  .topbar,
  .panel-head,
  .dashboard-toolbar,
  .item-top {
    align-items: stretch;
    flex-direction: column;
  }

  .status-dashboard,
  .performance-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grid,
  .leads-list,
  .form-grid,
  .toolbar-controls {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }

  .primary,
  .secondary,
  .ghost,
  .button-link {
    width: 100%;
  }
}
