:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #e2e0da;
  --accent: #2f5bea;
  --accent-text: #ffffff;
  --error-bg: #fdecec;
  --error: #b42318;
  --notice-bg: #fff6e0;
  --done: #1f7a3d;
  --progress: #b26b00;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 1rem; }
h3 { font-size: 0.95rem; margin: 1.5rem 0 0.5rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
a { color: var(--accent); text-decoration: none; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.topbar nav { display: flex; align-items: center; gap: 1.25rem; }
.brand { font-weight: 700; color: var(--text); font-size: 1.1rem; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem; }
.card.narrow { width: 100%; max-width: 380px; }

form label { display: block; margin-bottom: 0.9rem; font-size: 0.9rem; font-weight: 500; }
input, select, textarea { display: block; width: 100%; margin-top: 0.3rem; padding: 0.55rem 0.7rem; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { font: inherit; cursor: pointer; border-radius: 6px; padding: 0.55rem 1rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.link { background: none; border: none; padding: 0; color: var(--accent); }
form.inline { display: inline; margin: 0; }

.row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.row label { margin-bottom: 0; }
.row .grow { flex: 1 1 220px; }

.muted { color: var(--muted); font-weight: 400; }
.error { background: var(--error-bg); color: var(--error); padding: 0.6rem 0.8rem; border-radius: 6px; }
.notice { background: var(--notice-bg); padding: 0.6rem 0.8rem; border-radius: 6px; }

.project-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.project-list a { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.project-list a:hover { border-color: var(--accent); }
.project-list .name { flex: 1; font-weight: 500; }
.prefix { font-family: ui-monospace, monospace; font-size: 0.8rem; background: var(--bg); border: 1px solid var(--border); padding: 0.1rem 0.45rem; border-radius: 4px; }

.project-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.project-head h1 { margin: 0; }

.tabs { display: flex; gap: 0.25rem; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.tab { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.6rem 0.9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-num { font-size: 0.75rem; }
.tab-label { font-weight: 600; font-size: 0.9rem; }
.status { font-size: 0.75rem; }
.status-concluida { color: var(--done); }
.status-em_curso { color: var(--progress); }
.status-por_fazer, .status-fora { color: var(--muted); }

.bible dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem 1.5rem; margin: 0; }
.bible dt { font-size: 0.8rem; color: var(--muted); }
.bible dd { margin: 0; white-space: pre-wrap; }

/* ── Fase 2 ───────────────────────────────────────────────── */
.saved { background: #e8f5ec; color: var(--done); padding: 0.6rem 0.8rem; border-radius: 6px; }
.small { font-size: 0.8rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 1rem; }
.form-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.form-head h2 { margin: 0; }
.form-foot { display: flex; justify-content: flex-end; }
.card-title { margin-top: 0; }
textarea { resize: vertical; min-height: 2.5rem; }
textarea[name="script"] { font-family: ui-monospace, monospace; font-size: 0.9rem; }

.item-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.35rem; }
.item-list a { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.item-list a:hover { border-color: var(--accent); }
.num { font-family: ui-monospace, monospace; font-size: 0.8rem; color: var(--muted); min-width: 2.5rem; }
.grow { flex: 1; }
.tag { font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.tag.ok { color: var(--done); border-color: #bfe0c9; background: #eef8f1; }

.group { border-top: 1px solid var(--border); padding-top: 0.75rem; margin-top: 0.75rem; }
.group:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.group-head { margin-bottom: 0.4rem; }
.group-head a { color: var(--text); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 0.5rem; }
.add-form { border-top: 1px dashed var(--border); padding-top: 0.9rem; }

.crumbs { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; font-size: 0.9rem; margin-bottom: 0.75rem; }
.crumbs span { color: var(--muted); }

button.danger { color: var(--error); border-color: #f1c4c0; }
button.danger:hover { background: var(--error-bg); }
.danger-zone { display: flex; justify-content: flex-end; margin-bottom: 1.5rem; }

.toc { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: 0.9rem; }
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
table.models { width: 100%; border-collapse: collapse; min-width: 720px; }
table.models th { text-align: left; font-size: 0.8rem; font-weight: 500; color: var(--muted); padding: 0 0.4rem 0.4rem; }
table.models td { padding: 0.25rem 0.4rem; }
table.models input[type="text"], table.models select { margin-top: 0; }
table.models .center { text-align: center; }
table.models input[type="checkbox"] { width: auto; display: inline-block; }
.new-row td { background: var(--bg); }
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.lists-grid .card { margin-bottom: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.lists-grid textarea { margin-top: 0; }
.lists-grid button { align-self: flex-start; }
