:root {
  color-scheme: light;
  --bg: #eef3f5;
  --panel: #ffffff;
  --ink: #16212a;
  --muted: #62717d;
  --line: #cbd7df;
  --soft: #f6f8fa;
  --brand: #276f86;
  --accent: #2f7d55;
  --amber: #b66a28;
  --violet: #66568e;
  --danger: #9c3f3f;
  --shadow: 0 14px 34px rgba(32, 48, 58, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Segoe UI",
    "Malgun Gothic",
    "Apple SD Gothic Neo",
    Arial,
    sans-serif;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  margin-bottom: 14px;
}

.identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  font-size: 24px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.05;
  letter-spacing: 0;
}

.identity p,
.section-heading p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button.secondary {
  background: #f9fbfc;
}

.button.ghost {
  background: transparent;
  box-shadow: none;
}

.button.danger {
  border-color: rgba(156, 63, 63, 0.35);
  color: var(--danger);
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 12px;
}

.panel,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel.compact {
  padding: 14px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(47, 125, 85, 0.25);
  border-radius: 999px;
  background: #f0f7f3;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.muted {
  border-color: var(--line);
  background: #f6f8fa;
  color: var(--muted);
}

.boundary-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.boundary-list div {
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.boundary-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.boundary-list dt {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
}

.boundary-list dd {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.task-summary {
  display: grid;
  gap: 10px;
}

.task-summary strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

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

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3ebef;
  margin-bottom: 12px;
}

.meter div {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 160ms ease;
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.check-list b {
  color: var(--ink);
}

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

.request-grid {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(180px, 1fr) minmax(170px, 0.8fr) 110px 110px;
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: #394a56;
  font-size: 12px;
  font-weight: 900;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 86px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39, 111, 134, 0.12);
}

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

.metric {
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.production-panel {
  padding: 0;
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f9fbfc;
}

.tab {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.tab.active {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.tab-content {
  padding: 18px;
}

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

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

.info-card,
.editor-card,
.prompt-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.info-card h3,
.editor-card h3,
.prompt-card h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.info-card p,
.prompt-card p {
  color: var(--muted);
  font-size: 13px;
}

.info-card ul,
.prompt-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.editor-list {
  display: grid;
  gap: 12px;
}

.editor-card {
  display: grid;
  gap: 10px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-head h3 {
  margin: 0;
}

.small-code {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f6;
  color: #334653;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 12px;
}

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

.option-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.option-item b {
  display: grid;
  place-items: center;
  height: 38px;
  border-radius: var(--radius);
  background: #eef3f6;
  font-size: 13px;
}

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

.textarea-tall {
  min-height: 130px;
}

.artifact-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

pre {
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-radius: var(--radius);
  background: #14212a;
  color: #eaf2f6;
  font-size: 12px;
  line-height: 1.55;
}

code {
  font-family: Consolas, "Cascadia Code", monospace;
}

.deploy-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

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

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 220px;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .layout,
  .grid-two,
  .deploy-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 10px;
  }

  .topbar,
  .identity,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .identity {
    gap: 10px;
  }

  .top-actions,
  .artifact-bar {
    justify-content: stretch;
  }

  .button,
  .top-actions .button {
    width: 100%;
  }

  .sidebar,
  .request-grid,
  .metric-row,
  .grid-three,
  .option-grid,
  .inline-fields {
    grid-template-columns: 1fr;
  }
}
