/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1117;
  --bg-surface: #161822;
  --bg-elevated: #1c1f2e;
  --bg-input: #13151e;
  --border: #2a2d3e;
  --border-light: #353850;
  --text: #e2e4f0;
  --text-muted: #8b8fa8;
  --text-dim: #5c5f75;
  --accent: #6c8cff;
  --accent-hover: #829dff;
  --accent-bg: rgba(108,140,255,0.1);
  --accent-border: rgba(108,140,255,0.3);
  --green: #4ade80;
  --green-bg: rgba(74,222,128,0.1);
  --red: #f87171;
  --red-bg: rgba(248,113,113,0.1);
  --yellow: #fbbf24;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { color: var(--accent-hover); text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
.skip-link {
  position: absolute; top: -100%; left: 16px; z-index: 100;
  background: var(--accent); color: #000; padding: 8px 16px;
  border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 16px; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* === Header === */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15,17,23,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); font-weight: 700; font-size: 1.1rem;
}
.logo:hover, .logo:focus-visible { text-decoration: none; color: var(--text); }
.logo-icon { color: var(--accent); }
.logo-text .accent { color: var(--accent); }
.nav { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
}
.nav-link:hover, .nav-link:focus-visible {
  color: var(--text); background: var(--bg-elevated); text-decoration: none;
}

/* === Hero === */
.hero {
  padding: 64px 0 48px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800; line-height: 1.2;
  max-width: 700px; margin: 0 auto 16px;
}
.hero-sub {
  font-size: 1.05rem; color: var(--text-muted);
  max-width: 560px; margin: 0 auto 28px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: var(--font);
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--accent-hover); text-decoration: none; color: #000; }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--border); }
.btn-secondary:hover, .btn-secondary:focus-visible { background: var(--border); text-decoration: none; color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover, .btn-ghost:focus-visible { color: var(--text); border-color: var(--text-muted); text-decoration: none; }
.btn-danger-ghost { background: transparent; color: var(--red); border-color: transparent; }
.btn-danger-ghost:hover, .btn-danger-ghost:focus-visible { background: var(--red-bg); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* === Sections === */
.section-header { margin-bottom: 28px; }
.section-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.section-header p { color: var(--text-muted); font-size: 0.925rem; }

/* === Builder === */
.builder-section { padding: 48px 0; }
.builder-layout {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; align-items: start;
}
.builder-controls, .builder-preview {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.control-group { margin-bottom: 18px; }
.control-label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.input, .select {
  width: 100%; padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 0.875rem; font-family: var(--font);
  transition: border-color 0.15s;
}
.input:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.control-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Presets */
.preset-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.preset-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  font-family: var(--font); font-size: 0.8rem;
  transition: all 0.15s;
}
.preset-btn:hover, .preset-btn:focus-visible {
  border-color: var(--accent); color: var(--text);
}
.preset-btn.active {
  background: var(--accent-bg); border-color: var(--accent);
  color: var(--accent);
}
.preset-icon { font-size: 1.25rem; }

/* Task List */
.task-list { max-height: 360px; overflow-y: auto; padding-right: 4px; }
.task-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  margin-bottom: 4px; transition: background 0.1s;
}
.task-item:hover { background: var(--bg-elevated); }
.task-item input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 2px;
  accent-color: var(--accent); flex-shrink: 0;
  cursor: pointer;
}
.task-item label {
  font-size: 0.875rem; cursor: pointer; flex: 1;
  line-height: 1.4;
}
.task-item label .task-category {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  padding: 1px 6px; border-radius: 4px; margin-left: 6px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.cat-access { background: rgba(108,140,255,0.15); color: var(--accent); }
.cat-environment { background: rgba(74,222,128,0.15); color: var(--green); }
.cat-code { background: rgba(251,191,36,0.15); color: var(--yellow); }
.cat-docs { background: rgba(248,113,113,0.15); color: var(--red); }
.cat-people { background: rgba(167,139,250,0.15); color: #a78bfa; }
.cat-process { background: rgba(244,114,182,0.15); color: #f472b6; }
.task-item.custom .task-remove {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 1rem; padding: 0 4px;
  font-family: var(--font); line-height: 1;
}
.task-item.custom .task-remove:hover { color: var(--red); }

/* Add Task */
.add-task-row { display: flex; gap: 8px; }
.add-task-row .input { flex: 1; }
.select-sm { width: auto; min-width: 110px; }

/* Builder Actions */
.builder-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  margin-top: 12px; padding: 10px 16px;
  background: var(--green-bg); border: 1px solid rgba(74,222,128,0.3);
  border-radius: var(--radius-sm); color: var(--green);
  font-size: 0.85rem; font-weight: 500;
}

/* Preview */
.preview-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.preview-header h3 { font-size: 1rem; font-weight: 700; }
.preview-badge {
  font-size: 0.75rem; font-weight: 600;
  background: var(--accent-bg); color: var(--accent);
  padding: 3px 10px; border-radius: 20px;
}
.preview-content {
  font-size: 0.85rem; line-height: 1.65;
  max-height: 520px; overflow-y: auto;
}
.preview-meta { margin-bottom: 16px; }
.preview-meta .preview-name {
  font-size: 1.15rem; font-weight: 700; margin-bottom: 2px;
}
.preview-meta .preview-team {
  color: var(--text-muted); font-size: 0.825rem;
}
.preview-meta .preview-details {
  color: var(--text-dim); font-size: 0.8rem; margin-top: 4px;
}
.preview-section { margin-bottom: 16px; }
.preview-section h4 {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.preview-task {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 4px 0;
}
.preview-task .check-box {
  width: 16px; height: 16px; border: 2px solid var(--border-light);
  border-radius: 4px; flex-shrink: 0; margin-top: 2px;
}
.preview-task .task-text { flex: 1; }
.preview-empty {
  color: var(--text-dim); text-align: center;
  padding: 40px 20px; font-style: italic;
}

/* === Guide === */
.guide-section { padding: 48px 0; background: var(--bg-surface); border-top: 1px solid var(--border); }
.guide-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.guide-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.guide-card h3 {
  font-size: 1rem; font-weight: 700; margin-bottom: 10px;
}
.guide-card p, .guide-card li {
  font-size: 0.875rem; color: var(--text-muted); line-height: 1.65;
}
.guide-card ul { padding-left: 18px; }
.guide-card li { margin-bottom: 6px; }

/* === History === */
.history-section { padding: 48px 0; }
.history-list {
  display: grid; gap: 12px;
}
.history-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
}
.history-item-info { flex: 1; min-width: 0; }
.history-item-name {
  font-weight: 600; font-size: 0.925rem; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-item-meta {
  font-size: 0.78rem; color: var(--text-dim);
}
.history-item-actions { display: flex; gap: 6px; flex-shrink: 0; margin-left: 16px; }
.empty-state {
  color: var(--text-dim); text-align: center;
  padding: 32px; font-size: 0.9rem;
}

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0; margin-top: 24px;
}
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 20px; justify-content: space-between;
}
.footer-brand { flex: 1; min-width: 180px; }
.footer-tagline { font-size: 0.825rem; color: var(--text-dim); margin-top: 4px; }
.footer-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-nav a { font-size: 0.825rem; color: var(--text-muted); }
.footer-nav a:hover { color: var(--text); }
.footer-meta { font-size: 0.78rem; color: var(--text-dim); width: 100%; text-align: center; margin-top: 8px; }

/* === Print === */
@media print {
  .site-header, .site-footer, .builder-controls, .hero-actions, .builder-actions, .toast, .history-section, .guide-section, .preview-header .preview-badge { display: none !important; }
  body { background: #fff; color: #000; }
  .builder-layout { display: block; }
  .builder-preview { border: none; padding: 0; }
  .preview-content { max-height: none; overflow: visible; }
  .preview-task .check-box { border-color: #999; }
  .preview-section h4 { color: #555; border-color: #ddd; }
  .preview-meta .preview-name { color: #000; }
  .preview-meta .preview-team { color: #555; }
  .preview-meta .preview-details { color: #777; }
}

/* === Responsive === */
@media (max-width: 900px) {
  .builder-layout { grid-template-columns: 1fr; }
  .control-row { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .hero { padding: 40px 0 32px; }
  .hero h1 { font-size: 1.5rem; }
  .builder-controls, .builder-preview { padding: 16px; }
  .preset-grid { grid-template-columns: repeat(2, 1fr); }
  .add-task-row { flex-wrap: wrap; }
  .select-sm { width: 100%; }
  .builder-actions { justify-content: stretch; }
  .builder-actions .btn { flex: 1; }
  .guide-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .history-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .history-item-actions { margin-left: 0; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* Focus visible */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }



/* 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;
}
