:root {
  --bg: #f0f0ee;
  --panel: #fff;
  --ink: #1a1a1a;
  --muted: #666;
  --line: #e2e2e0;
  --accent: #1a1a1a;
  --good: #2e7d32;
  --focus: #1565c0;
  --radius: 8px;
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }

.app {
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  min-height: 100vh;
}

.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 18px 32px;
  overflow-y: auto;
  max-height: 100vh;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand p {
  margin: 4px 0 16px;
  font-size: 12px;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 12px;
}
.field span { color: var(--muted); font-weight: 500; }
.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafafa;
  color: var(--ink);
}
.field textarea { resize: vertical; line-height: 1.4; }
.field.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.field.checkbox input { width: auto; margin: 0; }
.field.checkbox span { color: var(--ink); font-weight: 400; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--focus) 35%, transparent);
  border-color: var(--focus);
  background: #fff;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}

.actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
button {
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: #fff;
}
button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.secondary { background: #f5f5f3; }
button:hover { filter: brightness(1.05); }

.form-block h2 {
  margin: 14px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.hint {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  font-size: 12px;
  color: var(--muted);
}
.preview-actions { display: flex; gap: 8px; }

.stage {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.stage .sheet {
  background: #fff;
  border: 1px solid var(--line);
  padding: 28px 32px 20px;
  max-width: 1100px;
  width: 100%;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}
.stage .sheet-header {
  display: grid;
  grid-template-columns: 0.9fr 1.3fr;
  gap: 16px;
  margin-bottom: 8px;
}
.stage .who { font-size: 13px; color: var(--muted); }
.stage .what { font-size: 15px; margin-top: 2px; }
.stage .when { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stage .message {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.stage .chart-host { overflow-x: auto; }
.stage .chart-host svg {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0 auto;
}
.stage .notes {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.stage .notes ol { margin: 0; padding: 0; list-style: none; }
.stage .notes li { margin-bottom: 3px; }
.stage .n {
  display: inline-flex;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 1px solid #1565c0;
  color: #1565c0;
  font-size: 10px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  margin-right: 5px;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .panel { max-height: none; border-right: none; border-bottom: 1px solid var(--line); }
}
