* { box-sizing: border-box; }
:root {
  --ink: #172033;
  --muted: #67758a;
  --line: #dbe4ee;
  --panel: #ffffff;
  --soft: #f5f8fb;
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #079455;
  --orange: #f79009;
  --red: #d92d20;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f6fa;
  color: var(--ink);
}
.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.09), transparent 300px),
    #f3f6fa;
}
.shell { max-width: 1120px; margin: 0 auto; padding: 18px 16px 56px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  margin-bottom: 14px;
}
.brand, .topbar nav, .modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand { font-weight: 900; }
.brand-text { display: grid; gap: 1px; line-height: 1; }
.brand-text strong { font-size: 22px; letter-spacing: 0; }
.brand-text em { color: var(--muted); font-size: 11px; font-style: normal; text-transform: uppercase; }
.brand small {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff;
  color: var(--muted);
}
.topbar nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}
.topbar nav a:hover { background: #fff; }
.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  color: #fff;
  background: #172033;
  font-size: 20px;
  font-weight: 1000;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
}
.hero > div, .panel, .modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.hero > div:first-child { padding: 28px; }
.hero-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 24px;
  background: #172033;
  color: #fff;
}
.hero-card span { color: #93c5fd; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.hero-card strong { font-size: 24px; line-height: 1.25; }
.hero-card small { color: #cbd5e1; }
.eyebrow { color: var(--blue); font-weight: 900; font-size: 12px; text-transform: uppercase; margin: 0 0 6px; }
h1 { margin: 8px 0 12px; font-size: 38px; line-height: 1.12; letter-spacing: 0; }
h2 { margin: 0; font-size: 22px; letter-spacing: 0; }
p { color: var(--muted); line-height: 1.7; }
.deploy-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.panel { padding: 22px; margin-bottom: 16px; }
.wizard {
  display: grid;
  gap: 10px;
  position: sticky;
  top: 16px;
}
.wizard-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.wizard-step span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}
.wizard-step strong { display: block; }
.wizard-step small { color: var(--muted); }
.wizard-step.active { background: #eff6ff; border-color: #bfdbfe; }
.wizard-step.active span { background: var(--blue); color: #fff; }
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}
label { display: grid; gap: 7px; font-weight: 800; }
.primary-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.required-field > span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--red);
}
.required-field b {
  border-radius: 999px;
  padding: 2px 7px;
  background: #fef3f2;
  color: var(--red);
  border: 1px solid #fecdca;
  font-size: 11px;
}
.required-field input { border-color: #f97066; background: #fffafa; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.12);
}
textarea { min-height: 92px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
button {
  width: 100%;
  margin-top: 16px;
  border: 0;
  border-radius: 8px;
  padding: 14px 18px;
  background: #172033;
  color: #fff;
  font-weight: 900;
  font-size: 16px;
}
button:disabled { opacity: 0.6; }
.ghost-btn, .icon-btn {
  width: auto;
  margin: 0;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 13px;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}
.status-pill {
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
}
.status-pill.success { color: var(--green); border-color: #abefc6; background: #ecfdf3; }
.deploy-status {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}
.deploy-status.running { border-color: #fedf89; background: #fffaeb; color: var(--orange); }
.deploy-status.done { border-color: #abefc6; background: #ecfdf3; color: var(--green); }
.deploy-status.error { border-color: #fecdca; background: #fef3f2; color: var(--red); }
.api-field { display: none; margin-bottom: 14px; }
.packaged-app .api-field { display: grid; }
.advanced {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.advanced summary {
  cursor: pointer;
  padding: 13px 14px;
  font-weight: 900;
}
.advanced .field-grid, .config-details label { padding: 0 14px 14px; }
.steps { display: grid; gap: 8px; margin-bottom: 14px; }
.step {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
}
.step small { grid-column: 1 / -1; }
.step.done { background: #ecfdf3; color: var(--green); }
.step.error { background: #fef3f2; color: var(--red); }
.step.running { background: #fffaeb; color: var(--orange); }
.result-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.result-fields { display: grid; gap: 12px; }
.qr-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.qr-card img { width: 190px; height: 190px; border-radius: 6px; background: #fff; }
.qr-card p { margin: 0; font-size: 13px; color: #475467; text-align: center; }
.history-list { display: grid; gap: 10px; }
.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.history-item p { margin: 4px 0 0; font-size: 12px; }
.history-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.history-actions button {
  width: auto;
  margin: 0;
  padding: 8px 10px;
  background: #f8fafc;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 12px;
}
.contact-box {
  display: grid;
  gap: 5px;
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}
.contact-box strong { color: #1d4ed8; }
.contact-box span { color: var(--ink); font-size: 13px; font-weight: 800; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 30;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-weight: 900;
  box-shadow: var(--shadow);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { opacity: 1; transform: translateX(-50%) translateY(0); background: var(--red); }
.empty { margin: 0; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}
.modal-backdrop[hidden] { display: none; }
.modal { width: min(460px, 100%); padding: 20px; }
.modal p { margin-top: 0; }
.modal-actions { justify-content: flex-end; margin-top: 14px; }
.modal-actions button { width: auto; margin: 0; }
.agent-shell { max-width: 1120px; }
.agent-hero { grid-template-columns: minmax(0, 1fr) 320px; }
.agent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.metric-card {
  min-height: 116px;
  display: grid;
  align-content: center;
  gap: 8px;
}
.metric-card span, .contact-grid span {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}
.metric-card strong {
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.contact-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.agent-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.agent-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}
.agent-table th, .agent-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}
.agent-table th {
  background: #f8fafc;
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
}
.agent-table tr:last-child td { border-bottom: 0; }
.table-pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ecfdf3;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}
.admin-shell { max-width: 980px; }
.admin-result {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #ecfdf3;
}
.admin-result span {
  color: #166534;
  font-size: 13px;
  font-weight: 900;
}
.admin-result strong {
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.1;
  word-break: break-all;
}
.status-pill.error { background: #fef3f2; color: var(--red); }
.status-pill.running { background: #fffaeb; color: var(--orange); }
@media (max-width: 900px) {
  .hero, .deploy-layout, .agent-hero { grid-template-columns: 1fr; }
  .wizard { position: static; grid-template-columns: repeat(3, 1fr); }
  .agent-grid, .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 32px; }
}
@media (max-width: 700px) {
  .topbar { display: grid; }
  .hero > div:first-child, .panel { padding: 18px; }
  .wizard, .primary-fields, .field-grid, .result-grid, .agent-grid, .contact-grid { grid-template-columns: 1fr; }
  .section-title { display: grid; }
  .history-item { grid-template-columns: 1fr; }
  .history-actions { justify-content: flex-start; }
}
