:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --surface: #f8fafc;
  --ink: #17202a;
  --muted: #64748b;
  --line: #d8e1ea;
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --green: #16805a;
  --amber: #b7791f;
  --red: #c24141;
  --violet: #6d5bd0;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
}
button, input, select { font: inherit; }
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #fff;
  font-weight: 800;
}
h1, h2, p { margin: 0; }
h1 { font-size: 20px; letter-spacing: 0; }
h2 { font-size: 17px; }
.topbar p, .summary, .mode span, .step-title p { color: var(--muted); font-size: 13px; }
.topnav {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}
.topnav a {
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.topnav a:hover {
  background: var(--surface);
  color: var(--ink);
}
.topnav a.active,
.topnav a[aria-current="page"] {
  background: #eef6ff;
  color: var(--blue-deep);
}
.status {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 13px;
}
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 rgba(32, 35, 38, 0.05);
}
.health-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 14%, transparent);
}
.health-pill.ok {
  border-color: rgba(45, 122, 82, 0.22);
  background: #eef8f1;
  color: var(--green);
}
.health-pill.pending {
  border-color: rgba(180, 107, 31, 0.22);
  background: #fff7e9;
  color: var(--amber);
}
.health-pill.error {
  border-color: rgba(184, 59, 59, 0.24);
  background: #fff0ee;
  color: var(--red);
}
.content, .panel, .monitor, .downloads, .log-panel, .history, .task, .account-panel, .admin-panel {
  min-width: 0;
  max-width: 100%;
}
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 18px;
}
.panel, .monitor, .account-panel, .plans-panel, .workspace-intro {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
  padding: 18px;
}
.account-panel, .plans-panel, .workspace-intro {
  margin-bottom: 14px;
}
.workspace-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: center;
}
.workspace-intro h2 {
  margin: 4px 0 8px;
  font-size: 28px;
  line-height: 1.15;
}
.workspace-intro p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}
.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.dashboard-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.dashboard-panel[hidden] {
  display: none;
}
.dashboard-metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}
.dashboard-metric span,
.dashboard-metric small {
  color: var(--muted);
  font-size: 12px;
}
.dashboard-metric strong {
  overflow-wrap: anywhere;
  font-size: 22px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head p {
  color: var(--muted);
  font-size: 13px;
}
.plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.plan-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}
.plan-card.recommended {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}
.plan-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.plan-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.plan-price strong {
  display: block;
  font-size: 24px;
}
.plan-price span,
.plan-points {
  color: var(--muted);
  font-size: 12px;
}
.plan-points {
  width: fit-content;
  border-radius: 8px;
  padding: 5px 8px;
  background: #eef6ff;
  color: var(--blue-deep);
  font-weight: 800;
}
.panel-placeholder {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: var(--surface);
}
.account-head, .admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.account-head p {
  color: var(--muted);
  font-size: 13px;
}
.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.auth-form input {
  min-width: 0;
}
.auth-form #authDisplayName {
  grid-column: 1 / -1;
}
.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  grid-column: 1 / -1;
}
.account-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.account-metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.account-metric strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
  overflow-wrap: anywhere;
}
.account-metric span {
  color: var(--muted);
  font-size: 12px;
}
.compact-button {
  width: auto;
  white-space: nowrap;
}
.monitor {
  position: sticky;
  top: 96px;
  align-self: start;
}
.step-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 14px;
}
.step-title > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}
.step-title.compact { margin-top: 0; }
.dropzone {
  display: grid;
  place-items: center;
  min-height: 150px;
  margin-bottom: 22px;
  padding: 18px;
  border: 2px dashed #aeb8bd;
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  text-align: center;
}
.dropzone input { display: none; }
.dropzone strong { font-size: 18px; }
.dropzone span { color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.mode {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-weight: 800;
}
.mode span { display: block; margin-top: 6px; font-weight: 600; line-height: 1.35; }
.mode.active {
  border-color: var(--blue);
  background: #eef6ff;
  box-shadow: inset 0 0 0 1px rgba(49, 95, 120, 0.35);
}
.switches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 18px;
}
.switches label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  min-height: 72px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.35;
}
.switches label > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.switches small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  flex: 0 0 17px;
  accent-color: var(--blue);
}
.advanced {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.advanced summary, .log-panel summary {
  cursor: pointer;
  padding: 13px 14px;
  color: var(--ink);
  font-weight: 800;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 14px 14px;
}

.field-note {
  align-self: end;
  padding: 10px 12px;
  border: 1px solid rgba(180, 107, 31, 0.2);
  border-radius: 8px;
  background: #fff7e9;
  color: var(--amber);
  font-size: 12px;
  line-height: 1.45;
}

.primary {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 15px 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(49, 95, 120, 0.18);
}
.primary:active { transform: translateY(1px); }
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.hero-actions .link-button {
  width: auto;
  min-width: 150px;
}
.public-shell {
  display: grid;
  gap: 18px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px 18px;
}
.public-shell.narrow {
  width: min(620px, 100%);
}
.public-hero,
.feature-card,
.auth-page-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
}
.public-hero {
  padding: 28px;
}
.public-hero.compact {
  padding: 22px;
}
.public-hero h2,
.auth-page-panel h2 {
  margin: 6px 0 10px;
  font-size: 34px;
  line-height: 1.14;
}
.public-hero p:not(.eyebrow),
.auth-page-panel p {
  color: var(--muted);
  line-height: 1.58;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.feature-card {
  padding: 18px;
}
.feature-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.feature-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.auth-page-panel {
  padding: 22px;
}
.auth-form.standalone {
  margin-top: 18px;
}
.plans-panel.standalone {
  margin-bottom: 0;
}
.summary { margin-top: 12px; line-height: 1.45; }
.task {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.task.pending { border-left: 5px solid var(--blue); }
.task.queued { border-left: 5px solid var(--blue); }
.task.running { border-left: 5px solid var(--amber); }
.task.succeeded { border-left: 5px solid var(--green); }
.task.failed { border-left: 5px solid var(--red); }
.status-help {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.progress-track {
  height: 11px;
  margin: -4px 0 12px;
  overflow: hidden;
  border-radius: 8px;
  background: #dbeafe;
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 240ms ease;
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.secondary {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}
.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.secondary.danger { color: var(--red); }
.error-text {
  color: var(--red);
  font-weight: 800;
}
.downloads {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(49, 95, 120, 0.18);
  border-radius: 8px;
  background: #f0f7ff;
}
.download-head, .download-empty {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}
.download-head strong, .download-empty strong { font-size: 17px; }
.download-head span, .download-empty span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.download-link {
  display: grid;
  gap: 4px;
  width: 100%;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.download-link:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}
.download-link.primary-download {
  border-color: rgba(49, 95, 120, 0.36);
  background: #f8fbff;
  box-shadow: 0 10px 22px rgba(49, 95, 120, 0.09);
}
.download-title {
  color: var(--blue-deep);
  font-size: 16px;
  font-weight: 900;
}
.download-desc {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}
.download-meta {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.download-action {
  width: fit-content;
  border: 1px solid rgba(49, 95, 120, 0.22);
  border-radius: 8px;
  padding: 3px 8px;
  background: #eef5f6;
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 800;
}
.system-status {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.admin-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(49, 95, 120, 0.22);
  border-radius: 8px;
  background: var(--surface);
}
.admin-panel[hidden] {
  display: none;
}
.admin-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.history {
  display: grid;
  gap: 8px;
  margin: 12px 0 12px;
  max-height: 260px;
  overflow: auto;
}
.history-item {
  width: 100%;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.history-item.running, .history-item.pending, .history-item.queued { border-left-color: var(--amber); }
.history-item.succeeded { border-left-color: var(--green); }
.history-item.failed { border-left-color: var(--red); }
.history-item strong, .history-item span, .history-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item span, .history-item small, .history-empty {
  color: var(--muted);
  font-size: 12px;
}
.log-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.log-panel summary {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.logs {
  max-width: 100%;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  padding: 0 14px 14px 32px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.logs li {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 14px;
    position: static;
  }
  .topbar h1 { font-size: 20px; }
  .topbar p { max-width: 260px; }
  .topnav { order: 3; width: 100%; margin-left: 54px; }
  .status {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
    padding-left: 60px;
  }
  .shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .workspace-intro {
    grid-template-columns: 1fr;
  }
  .dashboard-panel,
  .plan-grid,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .monitor {
    position: static;
    order: 2;
  }
  .content { order: 1; }
  .switches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .auth-form { grid-template-columns: 1fr; }
  .account-summary { grid-template-columns: 1fr; }
  .panel, .monitor, .account-panel, .plans-panel, .workspace-intro { border-radius: 8px; }
}

@media (max-width: 560px) {
  body { background: var(--bg); }
  .topbar { gap: 10px; }
  .logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
  }
  .status { display: none; }
  .topnav {
    margin-left: 0;
    overflow-x: auto;
  }
  .shell { padding: 10px; }
  .panel, .monitor, .account-panel, .plans-panel, .workspace-intro { padding: 14px; }
  .workspace-intro h2 { font-size: 22px; }
  .public-hero,
  .auth-page-panel {
    padding: 18px;
  }
  .public-hero h2,
  .auth-page-panel h2 {
    font-size: 24px;
  }
  .dashboard-panel,
  .plan-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .logs { padding: 0 10px 12px 26px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode { min-height: 74px; }
  .switches { grid-template-columns: 1fr; }
  .switches label { min-height: 58px; }
  .dropzone { min-height: 132px; }
  .dropzone strong { font-size: 16px; }
  .primary {
    position: sticky;
    bottom: 10px;
    z-index: 10;
  }
}
