@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #FAF7F2;
  --white: #FFFFFF;
  --ink: #1C1917;
  --ink-light: #44403C;
  --muted: #78716C;
  --line: #E7E2DA;
  --accent: #C9A84C;
  --green: #4A9B7F;
  --red: #C0392B;
  --radius: 10px;
  --shadow: 0 2px 16px rgba(28,25,23,0.07);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Botões ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--ink-light); }
.btn-accent { background: var(--accent); color: var(--ink); font-weight: 600; }
.btn-accent:hover:not(:disabled) { filter: brightness(0.94); }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-outline:hover:not(:disabled) { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); border: none; padding: 8px 12px; }
.btn-ghost:hover { color: var(--ink); background: var(--cream); }
.btn-danger { background: transparent; color: var(--red); border: 1.5px solid currentColor; }
.btn-danger:hover:not(:disabled) { background: var(--red); color: white; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ── Cards ── */
.card {
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.badge-draft    { background: #F3F4F6; color: #374151; }
.badge-published { background: #DCFCE7; color: #166534; }
.badge-closed   { background: #FEF2F2; color: #991B1B; }

/* ── Inputs ── */
.form-group { margin-bottom: 18px; }
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-light);
  margin-bottom: 6px;
}
input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.2s;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }

/* ── Nav ── */
.nav {
  background: var(--white);
  border-bottom: 1.5px solid var(--line);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.nav-logo span { color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 12px; }

/* ── Page ── */
.page { max-width: 860px; margin: 0 auto; padding: 40px 24px; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.page-header p { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ── Auth Overlay ── */
#auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.auth-box {
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.auth-box .logo {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}
.auth-box .logo span { color: var(--accent); }
.auth-box p { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.auth-error { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ── Overlay / Modal ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(28,25,23,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.modal {
  background: var(--white);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(28,25,23,0.15);
  animation: fadeUp 0.25s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  animation: fadeUp 0.3s ease;
  max-width: 320px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ── Divider ── */
hr {
  border: none;
  border-top: 1.5px solid var(--line);
  margin: 24px 0;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty-state h3 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 8px;
}
.empty-state p { font-size: 14px; margin-bottom: 24px; }

/* ── Animações ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fade-up { animation: fadeUp 0.35s ease forwards; }

/* ── Tabela ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 16px;
  border-bottom: 1.5px solid var(--line);
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--cream); }

/* ── Stat bar ── */
.stat-bar-wrap { margin: 6px 0 12px; }
.stat-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--ink-light);
}
.stat-bar-bg {
  background: var(--line);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav { padding: 0 16px; }
  .page { padding: 24px 16px; }
  .page-header { flex-direction: column; }
  .auth-box { padding: 28px 20px; }
}
