:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #182026;
  --muted: #65727d;
  --line: #dce3e7;
  --brand: #ff5a00;
  --brand-dark: #d94d00;
  --focus: #0f766e;
  --soft: #eef5f3;
  --danger: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

body.auth-locked .shell {
  display: none;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px;
  background: #11181d;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar h1,
.topbar h2,
.section-heading h3 {
  margin: 0;
  letter-spacing: 0;
}

.sidebar h1 {
  font-size: 32px;
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand);
}

.status-panel {
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
  background: rgba(255, 255, 255, .05);
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

.status-row span {
  color: #b5c0c8;
}

.sidebar-label {
  margin: 0;
  color: #b5c0c8;
}

.sidebar-label select {
  margin-top: 7px;
}

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

.nav a {
  color: #dbe3e8;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
}

.nav a:hover {
  background: rgba(255, 255, 255, .08);
}

.workspace {
  min-width: 0;
  width: 100%;
  max-width: 1680px;
  padding: 28px;
}

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

.topbar h2 {
  font-size: 28px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-grid,
.form-panel {
  display: grid;
  gap: 18px;
}

.section-block,
.debug-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.debug-panel {
  display: grid;
  gap: 14px;
}

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

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

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: #2a343b;
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 14px;
}

input,
select,
textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid #cfd8dd;
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, .22);
  border-color: var(--focus);
}

.two-col,
.three-col {
  display: grid;
  gap: 14px;
}

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

.category-suggest {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin-bottom: 14px;
}

.category-suggest label {
  margin-bottom: 0;
}

.category-suggest .inline-button {
  justify-self: start;
}

.seller-settings-row {
  margin-bottom: 14px;
}

.seller-settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.seller-settings-row small {
  color: var(--muted);
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-content: center;
  margin-top: 24px;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  min-height: 40px;
  padding: 10px 14px;
  font-weight: 750;
}

.primary-button {
  color: white;
  background: var(--brand);
}

.primary-button:hover {
  background: var(--brand-dark);
}

.ghost-button,
.inline-button {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.sidebar .ghost-button {
  color: white;
  background: transparent;
  border-color: rgba(255, 255, 255, .2);
}

.inline-button {
  min-height: 36px;
}

.html-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr);
  gap: 14px;
  align-items: stretch;
  margin-top: 14px;
}

.html-preview-grid label {
  margin-bottom: 0;
}

.html-preview-card {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.preview-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.preview-heading span {
  color: var(--muted);
  font-size: 13px;
}

#htmlTemplateFrame {
  width: 100%;
  height: 100%;
  min-height: 260px;
  border: 0;
  background: white;
}

.parameter-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.agent-section {
  border-color: #b8d7d1;
  background: #fbfefd;
}

.agent-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.agent-summary {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid #cfe4df;
  border-radius: 8px;
  background: #eef7f5;
}

.score-box {
  display: grid;
  place-items: center;
  min-height: 104px;
  border-radius: 8px;
  background: white;
  border: 1px solid #d5e7e3;
}

.score-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.score-box strong {
  font-size: 38px;
  line-height: 1;
}

.agent-summary p {
  margin: 8px 0 0;
  color: #36504b;
}

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

.agent-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.agent-grid h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.agent-grid ul {
  margin: 0;
  padding-left: 18px;
  color: #43525c;
  font-size: 13px;
  line-height: 1.45;
}

.agent-grid li + li {
  margin-top: 6px;
}

.parameter-row {
  display: grid;
  grid-template-columns: minmax(160px, .45fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

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

#jsonPreview {
  margin: 14px 0 0;
  overflow: auto;
  min-height: 260px;
  max-height: 520px;
  padding: 16px;
  border-radius: 8px;
  background: #10181d;
  color: #d9f0e8;
  font-size: 12px;
  line-height: 1.55;
}

details summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  font-weight: 750;
}

details summary small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.message-box {
  min-height: 40px;
  padding: 12px;
  border-radius: 6px;
  background: var(--soft);
  color: #18433d;
  font-size: 14px;
  white-space: pre-wrap;
}

.message-box.error {
  background: #fff1f0;
  color: var(--danger);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #11181d;
}

.login-view[hidden] {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: white;
}

.login-card h1 {
  margin: 0 0 22px;
  font-size: 32px;
}

.login-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 14px;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

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

  .two-col,
  .three-col,
  .category-suggest,
  .html-preview-grid,
  .agent-grid,
  .agent-summary,
  .parameter-row {
    grid-template-columns: 1fr;
  }
}
