:root{
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --border: #334155;
  --success: #10b981;
  --error: #ef4444;
  --font-sans: system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
*{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body{
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.site-header { padding: 1.5rem 0; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.logo-area h1 { font-size: 1.5rem; letter-spacing: -0.02em; }
.logo-area .subtitle { font-size: 0.875rem; color: var(--text-muted); }
.top-nav a { margin-left: 1.5rem; font-size: 0.9rem; color: var(--text-muted); }
.top-nav a:hover{ color: var(--text); }

.app-layout { display: grid; grid-template-columns: 1fr 380px; gap: 2rem; margin-bottom: 3rem; align-items: start; }
@media(max-width: 850px){
  .app-layout { grid-template-columns: 1fr; }
}

.builder-section, .output-section { background: var(--surface); padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border); }
.builder-section h2, .output-section h2 { margin-bottom: 1.5rem; font-size: 1.25rem; font-weight: 600; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; margin-bottom: 0.4rem; font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }
input[type="text"], select, textarea { width: 100%; padding: 0.75rem; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 4px; font-family: var(--font-sans); transition: border 0.2s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
textarea { resize: vertical; }

.checklist-row { display: flex; gap: 1.5rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.checkbox-label input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); cursor: pointer; }

.char-count { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 0.25rem; text-align: right; }

button { cursor: pointer; font-family: var(--font-sans); font-weight: 600; border-radius: 4px; border: none; padding: 0.75rem 1rem; transition: background 0.2s, opacity 0.2s; }
.primary-btn { background: var(--accent); color: #000; width: 100%; font-size: 1rem; }
.primary-btn:hover { background: var(--accent-hover); color:#fff; }
.secondary-btn { background: var(--surface-hover); color: var(--text); border: 1px solid var(--border); width: max-content; }
.secondary-btn:hover { background: var(--border); }
.text-btn { background: transparent; color: var(--text-muted); padding: 0; font-size: 0.85rem; font-weight: normal; }
.text-btn:hover { color: var(--text); text-decoration: underline; }

.sticky-box { position: sticky; top: 2rem; }
.code-preview-box { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1rem; margin-bottom: 1rem; overflow-x: auto; }
.code-preview-box pre { font-family: var(--font-mono); font-size: 0.9rem; white-space: pre-wrap; word-wrap: break-word; color: #a5b4fc; margin: 0; }

.history-section { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.history-section h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-muted); }
.history-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; max-height: 250px; overflow-y: auto; }
.history-list li { background: var(--bg); padding: 0.6rem; border-radius: 4px; border: 1px solid var(--border); font-family: var(--font-mono); font-size: 0.8rem; cursor: copy; transition: border 0.1s; }
.history-list li:hover { border-color: var(--accent); }
.history-list .empty-state { color: var(--text-muted); text-align: center; border: none; font-family: var(--font-sans); background: transparent; cursor: default; }

.document-format { max-width: 800px; margin: 0 auto 3rem; padding: 2rem; background: var(--surface); border-radius: 8px; border: 1px solid var(--border); }
.document-format h2 { margin-bottom: 1rem; font-size: 1.5rem; color: var(--accent); }
.document-format h3 { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; }
.document-format p { margin-bottom: 1rem; color: var(--text-muted); }
.document-format ul { margin-bottom: 1.5rem; padding-left: 1.5rem; color: var(--text-muted); }
.document-format li { margin-bottom: 0.5rem; }
.document-format code { font-family: var(--font-mono); background: var(--bg); padding: 0.2rem 0.4rem; border-radius: 3px; font-size: 0.9em; border: 1px solid var(--border); }

.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-top: auto; }



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
