:root {
  --bg: #1e1f26;
  --bg-alt: #262832;
  --border: #383a45;
  --text: #e6e6ea;
  --text-dim: #9a9ba6;
  --accent: #6c8cff;
  --accent-dark: #4f6bd6;
  --code-bg: #14151b;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  height: 52px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-brand {
  font-weight: 700;
  letter-spacing: 0.3px;
}

.toolbar-brand span {
  color: var(--accent);
}

.btn-support {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.btn-support:hover {
  background: #2f313c;
  border-color: var(--accent);
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: #2f313c;
  border-color: var(--accent);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-dark);
}

.workspace {
  display: flex;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 120px;
  overflow: hidden;
}

.pane-editor {
  flex: 0 0 50%;
}

.pane-preview {
  flex: 1 1 auto;
}

.pane-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

#editor {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: var(--bg);
  color: var(--text);
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 16px;
}

#preview {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
  background: #ffffff;
  color: #1c1c1f;
}

.divider {
  flex: 0 0 6px;
  cursor: col-resize;
  background: var(--border);
  position: relative;
}

.divider:hover,
.divider.dragging {
  background: var(--accent);
}

/* Markdown rendering */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  border-bottom: 1px solid #e2e2e6;
  padding-bottom: 4px;
}

.markdown-body pre {
  background: var(--code-bg);
  color: #e6e6ea;
  padding: 12px 14px;
  border-radius: 6px;
  overflow-x: auto;
}

.markdown-body code {
  background: #f0f0f3;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.markdown-body pre code {
  background: none;
  padding: 0;
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 0;
  padding-left: 14px;
  color: #55565f;
}

.markdown-body img {
  max-width: 100%;
}

.markdown-body table {
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid #ddd;
  padding: 6px 10px;
}

/* Modal de apoio */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  position: relative;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  width: 320px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-text {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.5;
}

.modal-email-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-email-row code {
  flex: 1;
  background: var(--code-bg);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .workspace {
    flex-direction: column;
  }

  .divider {
    display: none;
  }

  .pane-editor,
  .pane-preview {
    flex: 1 1 50%;
  }
}