:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --panel: #ffffff;
  --ink: #171923;
  --muted: #697386;
  --line: #e5e8ef;
  --line-strong: #d8dde8;
  --accent: #6258f6;
  --accent-dark: #463ed1;
  --accent-soft: #eeedff;
  --green: #dff6e8;
  --green-ink: #11613a;
  --amber: #fff1d8;
  --amber-ink: #855400;
  --red: #ffe4e2;
  --red-ink: #a1261d;
  --gray: #eef1f5;
  --gray-ink: #4b5565;
  --shadow: 0 10px 24px rgba(21, 27, 38, 0.05);
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

button:hover { background: var(--accent-dark); }
button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.link-button {
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
}

.link-button:hover { background: transparent; text-decoration: underline; }

input,
select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  padding: 22px 16px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}

.mark {
  display: block;
  width: 26px;
  height: 26px;
  flex: none;
}

.wordmark strong {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.wordmark .stage {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.nav {
  display: grid;
  gap: 3px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  border-radius: 6px;
  color: var(--gray-ink);
  padding: 0 10px;
  text-decoration: none;
  font-size: 14px;
}

.nav-ico {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--gray-soft, #98a2b3);
}

.nav a:hover .nav-ico,
.nav a.active .nav-ico {
  color: var(--accent);
}

.nav a:hover,
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.main {
  min-width: 0;
  padding: 18px 26px 34px;
}

.command {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(190px, 0.7fr) minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.command label,
.launch-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.api-field input,
.key-field input {
  font-family: var(--mono);
  font-size: 12px;
}

.auth-field {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: end;
  min-height: 36px;
}
.auth-user {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
#signOutButton {
  background: none;
  color: var(--muted);
  border: 1px solid var(--line);
}
#signOutButton:hover {
  background: var(--panel);
  color: var(--ink);
}

.notice,
.run-banner {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  color: var(--gray-ink);
  margin-bottom: 14px;
}

.notice.fail,
.run-banner.fail {
  border-color: #ffd0cc;
  background: var(--red);
  color: var(--red-ink);
}

.run-banner.ok {
  border-color: #c4edd4;
  background: var(--green);
  color: var(--green-ink);
}

.activity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.activity strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.activity-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.activity-pill {
  border-radius: 999px;
  background: var(--gray);
  color: var(--gray-ink);
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.view {
  display: grid;
  gap: 16px;
}

.view-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.view-head.compact {
  align-items: center;
}

.view-head h1 {
  margin-top: 2px;
  font-size: 28px;
  line-height: 1.05;
  font-weight: 700;
}

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

.kpi {
  min-width: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.kpi strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.kpi span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
}

.store-card,
.panel,
.table-wrap,
.launch-preview,
.report-detail,
.report-item,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.store-card {
  min-height: 196px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.store-card h2 {
  font-size: 17px;
  overflow-wrap: anywhere;
}

.store-meta {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  padding: 0;
  background: none;
  font-size: 12.5px;
  font-weight: 550;
  letter-spacing: -.003em;
  white-space: nowrap;
  color: #424b59;
}
.chip::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.chip.green::before { background: #2f9d68; }
.chip.amber::before { background: #c2902f; }
.chip.red::before { background: #cd5347; }
.chip.gray { color: #8a94a3; }
.chip.gray::before { background: #b4bcc6; }

.keys-panel { margin-top: 32px; }
.keys-list { display: grid; gap: 8px; margin-top: 12px; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.key-prefix { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.new-key { margin-top: 12px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 12px 16px; }
.new-key-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--accent-dark); margin-bottom: 8px; }
.new-key-row { display: flex; gap: 8px; }
.new-key-value { flex: 1; font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  height: 48px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

tbody tr {
  cursor: pointer;
  transition: background 140ms ease;
}

tbody tr:hover {
  background: #fafbff;
}

.num {
  text-align: right;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.run-main,
.inspector {
  display: grid;
  gap: 14px;
  align-content: start;
}

.progress-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--gray);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 240ms ease;
}

.progress-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.metric {
  min-height: 92px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.metric:last-child { border-right: 0; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
}

.panel-head h2 {
  font-size: 14px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.budget-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.budget-item {
  min-height: 104px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.budget-item:last-child { border-right: 0; }
.budget-item span { color: var(--muted); font-size: 12px; }
.budget-item strong {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 16px;
}

.budget-meter {
  height: 6px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--gray);
  overflow: hidden;
}

.budget-meter i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.budget-meter.warn i { background: #c98210; }
.budget-meter.fail i { background: #d33d32; }

.ledger-feed,
.line-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ledger-row,
.line-log li {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  font-size: 13px;
}

.ledger-row {
  grid-template-columns: 112px minmax(120px, 1fr) minmax(120px, 0.7fr) auto;
  cursor: pointer;
}

.ledger-row:hover {
  background: #fafbff;
}

code,
pre {
  font-family: var(--mono);
}

pre {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.action-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
}

.action-stack button:nth-child(n+4) {
  background: #fff;
  color: var(--accent);
  border-color: var(--line-strong);
}

.action-stack button:nth-child(n+4):hover {
  border-color: var(--accent);
}

.action-preview {
  border-top: 1px solid var(--line);
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.launch-layout,
.reports-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 0.48fr);
  gap: 16px;
}

.launch-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.launch-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.launch-preview {
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.preview-box {
  display: grid;
  gap: 10px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.preview-row strong {
  color: var(--ink);
}

.empty-state {
  border-style: dashed;
  padding: 16px;
  color: var(--muted);
  line-height: 1.5;
}

.report-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.report-item {
  padding: 14px;
  cursor: pointer;
}

.report-item:hover {
  border-color: var(--accent);
}

.report-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.report-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.report-detail {
  min-height: 420px;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.toggle-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.ceremony-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.36fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.ceremony-rail,
.ceremony-workspace {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.ceremony-form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.ceremony-form label {
  min-width: 0;
}

.ceremony-form .wide {
  display: grid;
  gap: 6px;
}

.ceremony-form textarea {
  min-height: 150px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
}

.terminal-panel p {
  margin: 0;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.ceremony-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.ceremony-item {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  text-align: left;
  color: var(--ink);
  display: grid;
  gap: 4px;
}

.ceremony-item:hover,
.ceremony-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.ceremony-item strong,
.ceremony-title strong {
  overflow-wrap: anywhere;
}

.ceremony-item span {
  color: var(--muted);
  font-size: 12px;
}

.ceremony-detail {
  display: grid;
  gap: 14px;
}

.ceremony-title {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ceremony-title h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

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

.step-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.step-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.step-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.step-card pre,
.result-box pre {
  max-height: 260px;
}

.result-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.result-table th,
.result-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: right;
}

.result-table th:first-child,
.result-table td:first-child {
  text-align: left;
}

@media (max-width: 1120px) {
  .shell { grid-template-columns: 196px minmax(0, 1fr); }
  .command { grid-template-columns: 1fr 1fr; }
  .command button { grid-column: 2; }
  .store-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .detail-layout,
  .launch-layout,
  .reports-layout,
  .ceremony-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .main { padding: 14px; }
  .command,
  .store-grid,
  .metric-row,
  .launch-form { grid-template-columns: 1fr; }
  .command button { grid-column: auto; }
  .activity,
  .view-head { align-items: stretch; flex-direction: column; }
  .activity-strip,
  .kpis { justify-content: flex-start; }
  .budget-grid { grid-template-columns: 1fr; }
  .budget-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .ledger-row { grid-template-columns: 1fr; padding: 10px 14px; }
  .step-card,
  .ceremony-title { grid-template-columns: 1fr; flex-direction: column; }
}
