:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #60716c;
  --line: #d8e1de;
  --accent: #0f7b6c;
  --accent-strong: #095f54;
  --warn: #b04f19;
  --shadow: 0 16px 40px rgba(23, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

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

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

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

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

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(36px, 6vw, 72px);
  line-height: 0.95;
}

h2 {
  font-size: 28px;
}

.lead {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #16a34a;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.tool-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 16px;
}

.tool-panel label,
.field span,
.dynamic-fields label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#toolSearch,
.dynamic-fields input,
.dynamic-fields select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
}

.tool-groups {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.group-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.tool-list {
  display: grid;
  gap: 6px;
}

.tool-item {
  width: 100%;
  min-height: 38px;
  border-color: transparent;
  background: transparent;
  text-align: left;
}

.tool-item.active {
  border-color: #b7d8d2;
  background: #e9f6f3;
  color: var(--accent-strong);
  font-weight: 700;
}

.editor-panel {
  padding: 22px;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.tool-header p:last-child {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.icon-button {
  flex: 0 0 auto;
}

.dynamic-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dynamic-fields label {
  min-width: 0;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
  color: var(--ink);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1.55;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 123, 108, 0.14);
}

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

.message {
  min-height: 24px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.message.error {
  color: var(--warn);
}

.preview {
  margin-top: 14px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.preview img {
  max-width: 100%;
  max-height: 360px;
  display: block;
}

.swatch {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 900px) {
  .hero,
  .tool-header {
    display: block;
  }

  .status-card {
    margin-top: 18px;
  }

  .workspace,
  .split,
  .dynamic-fields {
    grid-template-columns: 1fr;
  }

  .tool-panel {
    position: static;
    max-height: none;
  }

  textarea {
    min-height: 260px;
  }
}
