:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #6f6f68;
  --line: #e5e5df;
  --soft: #f1f1ee;
  --accent: #111111;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(20, 20, 20, 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;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #111;
  color: #fff;
  font-weight: 700;
}

.brand span,
.button-editor-head span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 7px;
}

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

.content {
  padding: 32px;
  max-width: 1180px;
  width: 100%;
}

.topbar,
.section-heading.row,
.button-editor-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  margin-bottom: 6px;
  font-size: 19px;
}

.muted,
.section-heading p {
  color: var(--muted);
}

.section {
  margin-top: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

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

.form-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: #3d3d38;
  font-size: 13px;
  font-weight: 650;
}

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

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

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #9f9f96;
  box-shadow: 0 0 0 3px rgba(120, 120, 110, 0.13);
}

textarea.invalid {
  border-color: var(--danger);
}

.button-list {
  display: grid;
  gap: 14px;
}

.button-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fcfcfb;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  display: flex;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 7px;
}

.toggle input {
  width: auto;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  min-height: 38px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
}

.secondary-button,
.ghost-button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  padding: 0 14px;
}

.ghost-button {
  width: 100%;
}

.icon-button {
  width: 34px;
  background: #fff;
  border-color: var(--line);
  font-size: 20px;
  line-height: 1;
}

.status-pill {
  min-width: 74px;
  text-align: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill.dirty {
  color: #7a4a00;
  background: #fff8e6;
  border-color: #f0d99a;
}

.phone-preview {
  width: min(420px, 100%);
  background: #efefea;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.message {
  background: #ffffff;
  border-radius: 8px;
  padding: 12px;
  min-height: 52px;
  white-space: pre-wrap;
}

.preview-buttons {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.preview-label {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.preview-buttons span,
.keyboard-row span {
  display: block;
  text-align: center;
  background: #ffffff;
  border: 1px solid #dadad2;
  border-radius: 7px;
  padding: 9px;
}

.preview-keyboard {
  display: grid;
  gap: 8px;
}

.keyboard-row {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 8px;
}

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

.actions {
  position: sticky;
  bottom: 0;
  margin-top: 24px;
  padding: 16px 0;
  background: rgba(247, 247, 245, 0.92);
  backdrop-filter: blur(8px);
}

.alert {
  color: var(--danger);
  background: #fff0ef;
  border: 1px solid #ffd0cc;
  border-radius: 7px;
  padding: 10px;
}

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

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

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

  .content {
    padding: 20px;
  }

  .form-grid,
  .form-grid.compact {
    grid-template-columns: 1fr;
  }

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