:root {
  --bg: #f4f0e8;
  --ink: #1c1b1a;
  --muted: #6f6b67;
  --card: #ffffff;
  --accent: #0f766e;
  --accent-2: #f97316;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.ambient {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, #fff0db 0%, transparent 55%),
    radial-gradient(circle at 80% 0%, #e0f7f4 0%, transparent 45%),
    linear-gradient(140deg, #f4f0e8 0%, #f0e8d8 100%);
  z-index: -1;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.logo { font-size: 28px; font-weight: 700; }
.subtitle { margin: 4px 0 0; color: var(--muted); }

.card {
  background: var(--card);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.hidden { display: none; }

.row, .grid {
  display: grid;
  gap: 12px;
}

.row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e5e1da;
  font-size: 14px;
  font-family: inherit;
}

textarea {
  min-height: 220px;
  resize: none;
  overflow: hidden;
}

button, a.ghost {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary { background: linear-gradient(135deg, var(--accent), #0f4c5c); color: #fff; }
.ghost { background: #f1f1f1; color: var(--ink); }

.muted { color: var(--muted); }
.hint { color: var(--muted); margin-top: 12px; }
.divider {
  height: 1px;
  background: #eee7dc;
  margin: 14px 0;
  border-radius: 999px;
}

.menu-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

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

.editor-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  margin-top: 12px;
}

.preview-box {
  border: 1px solid #e9e1d6;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fffdf9;
  min-height: 220px;
}

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

.preview-content h1, .preview-content h2, .preview-content h3 { margin: 12px 0 6px; }
.preview-content ul { padding-left: 18px; margin: 8px 0; }
.preview-content p { margin: 6px 0; white-space: pre-wrap; }

.list { display: grid; gap: 10px; margin-top: 10px; }
.list-item {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #efe8dd;
  background: #faf7f1;
  cursor: pointer;
}

#sig-canvas {
  width: 100%;
  border: 1px dashed #c7c1b7;
  border-radius: 12px;
  background: #fffaf3;
}

#debug-log {
  background: #111;
  color: #f8f8f2;
  padding: 16px;
  border-radius: 12px;
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .section-head { flex-direction: column; align-items: flex-start; }
}
