/* =========================================================
   CRISTINA OLIVEIRA STUDIO — Design System
   Paleta: branca / tons claros / dourado como acento
   ========================================================= */

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

:root {
  /* Superfícies */
  --bg:          #f4f5f7;
  --surface:     #ffffff;
  --surface-alt: #fafafa;

  /* Tipografia */
  --ink:         #111827;
  --muted:       #6b7280;
  --subtle:      #9ca3af;

  /* Bordas */
  --line:        #e5e7eb;
  --line-strong: #d1d5db;

  /* Marca */
  --gold:        #c89035;
  --gold-dark:   #a87420;
  --gold-light:  #fdf8ee;
  --gold-mid:    #f5e8c7;

  /* Sidebar */
  --sidebar-bg:  #ffffff;
  --sidebar-w:   256px;

  /* Status */
  --green:       #059669;
  --green-bg:    #ecfdf5;
  --red:         #dc2626;
  --red-bg:      #fef2f2;
  --blue:        #2563eb;
  --blue-bg:     #eff6ff;
  --amber:       #d97706;
  --amber-bg:    #fffbeb;
  --purple:      #7c3aed;
  --purple-bg:   #f5f3ff;

  /* Sombras */
  --shadow-xs:   0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:   0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);

  /* Raios */
  --r-sm:        6px;
  --r-md:        10px;
  --r-lg:        14px;
  --r-pill:      100px;

  /* Transição */
  --t:           150ms ease;
}

/* ── Base ─────────────────────────────────────────────── */
html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  font-size: .9375rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Layout principal ─────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo img {
  height: 36px;
  width: auto;
}

.sidebar-logo-text {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  font-weight: normal;
  color: var(--ink);
  letter-spacing: .02em;
}
.sidebar-logo-text span {
  display: block;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar-new-btn {
  margin: 16px 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--gold);
  color: #fff;
  border-radius: var(--r-md);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: background var(--t), box-shadow var(--t);
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.sidebar-new-btn:hover { background: var(--gold-dark); box-shadow: var(--shadow-sm); }
.sidebar-new-btn svg { flex-shrink: 0; }

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--subtle);
  padding: 12px 8px 6px;
  margin-top: 8px;
}
.nav-section-label:first-child { margin-top: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--t), color var(--t);
  cursor: pointer;
}
.nav-link:hover { background: var(--bg); color: var(--ink); }
.nav-link.active { background: var(--gold-light); color: var(--gold-dark); }
.nav-link.active svg { color: var(--gold); }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-md);
  transition: background var(--t);
  cursor: pointer;
}
.user-card:hover { background: var(--bg); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold-mid);
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: .75rem;
  color: var(--muted);
}

/* ── Conteúdo principal ───────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: Georgia, serif;
  font-size: 1.125rem;
  font-weight: normal;
  color: var(--ink);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.page-body {
  padding: 32px;
  flex: 1;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: normal;
  color: var(--ink);
}

.card-body { padding: 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ── Stat cards (dashboard) ───────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
}

.stat-label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: Georgia, serif;
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
}

.stat-sub {
  font-size: .8125rem;
  color: var(--muted);
  margin-top: 4px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.stat-icon.gold  { background: var(--gold-light); color: var(--gold); }
.stat-icon.green { background: var(--green-bg);   color: var(--green); }
.stat-icon.blue  { background: var(--blue-bg);    color: var(--blue); }
.stat-icon.amber { background: var(--amber-bg);   color: var(--amber); }

/* ── Badges de status ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-briefing  { background: var(--blue-bg);   color: var(--blue); }
.badge-orcamento { background: var(--amber-bg);  color: var(--amber); }
.badge-aprovado  { background: var(--purple-bg); color: var(--purple); }
.badge-execucao  { background: var(--gold-light); color: var(--gold-dark); }
.badge-entregue  { background: var(--green-bg);  color: var(--green); }
.badge-cancelado { background: var(--red-bg);    color: var(--red); }

/* ── Botões ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--t);
  line-height: 1;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.btn-primary:hover { background: var(--gold-dark); border-color: var(--gold-dark); box-shadow: var(--shadow-sm); }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-secondary:hover { background: var(--bg); border-color: var(--ink); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding-left: 8px;
  padding-right: 8px;
}
.btn-ghost:hover { background: var(--bg); color: var(--ink); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 6px 13px; font-size: .8125rem; }
.btn-lg { padding: 12px 26px; font-size: 1rem; }

/* ── Formulários ──────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.form-label .req { color: var(--gold); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: .9375rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-mid);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--subtle); }
.form-textarea { resize: vertical; min-height: 100px; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint { font-size: .8125rem; color: var(--muted); margin-top: 5px; }
.form-error { font-size: .8125rem; color: var(--red); margin-top: 5px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Tabela ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: .875rem;
  color: var(--ink);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t); }
tbody tr:hover { background: var(--bg); }
tbody tr[data-href] { cursor: pointer; }

.table-project-num {
  font-family: 'Courier New', monospace;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--gold-dark);
  letter-spacing: .04em;
}

/* ── Empty state ──────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--gold);
}
.empty-title {
  font-family: Georgia, serif;
  font-size: 1.125rem;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty-text { font-size: .875rem; color: var(--muted); max-width: 360px; }

/* ── Page header ──────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header-info {}
.eyebrow {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.page-title {
  font-family: Georgia, serif;
  font-size: 1.625rem;
  font-weight: normal;
  color: var(--ink);
  line-height: 1.2;
}

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

/* ── Toast ────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-md);
  font-size: .875rem;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: slide-in .2s ease;
  max-width: 360px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

@keyframes slide-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Login ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--surface);
}

.login-left {
  flex: 1;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
}
.login-photo {
  width: 100%;
  height: 100%;
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, rgba(29,27,24,.18) 0%, rgba(45,42,37,.28) 100%),
              url('/assets/projeto-biblioteca.png') center/cover no-repeat;
}

.login-brand {
  text-align: center;
  position: relative;
  z-index: 1;
}
.login-brand img { height: 56px; margin: 0 auto 20px; filter: brightness(0) invert(1); }
.login-brand-name {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  color: #fff;
  font-weight: normal;
  letter-spacing: .02em;
}
.login-brand-sub {
  font-size: .75rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 6px;
}
.login-tagline {
  margin-top: 40px;
  font-size: .9375rem;
  color: rgba(255,255,255,.55);
  line-height: 1.7;
  max-width: 320px;
}

.login-right {
  width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 64px;
}

.login-box { width: 100%; }
.login-greeting {
  font-family: Georgia, serif;
  font-size: 1.75rem;
  color: var(--ink);
  font-weight: normal;
  margin-bottom: 6px;
}
.login-sub { font-size: .9375rem; color: var(--muted); margin-bottom: 36px; }

.login-submit {
  width: 100%;
  padding: 12px;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: var(--r-pill);
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .03em;
  transition: background var(--t), box-shadow var(--t);
  margin-top: 4px;
}
.login-submit:hover { background: var(--gold-dark); box-shadow: var(--shadow-sm); }

.login-alert {
  background: var(--red-bg);
  border: 1px solid #fca5a5;
  color: var(--red);
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: .875rem;
  margin-bottom: 20px;
}

/* ── Construção ───────────────────────────────────────── */
.wip-banner {
  background: var(--gold-light);
  border: 1px solid var(--gold-mid);
  border-radius: var(--r-lg);
  padding: 40px;
  text-align: center;
}
.wip-banner .wip-icon { font-size: 2.5rem; margin-bottom: 12px; }
.wip-title { font-family: Georgia, serif; font-size: 1.25rem; color: var(--ink); margin-bottom: 6px; }
.wip-text  { font-size: .9375rem; color: var(--muted); }

/* ── Dashboard activity ───────────────────────────────── */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 7px;
  flex-shrink: 0;
}
.activity-text { font-size: .875rem; color: var(--ink); line-height: 1.5; }
.activity-time { font-size: .75rem; color: var(--subtle); margin-top: 2px; }

/* ── Menu mobile (sidebar toggle) ─────────────────────── */
.sidebar { transition: transform .25s ease; }

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 9px;
  left: 14px;
  z-index: 160;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 150;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  .login-left { display: none; }
  .login-right { width: 100%; padding: 40px 24px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); z-index: 201; box-shadow: var(--shadow-md); }
  .sidebar-toggle { display: flex; }
  .sidebar-backdrop.is-visible { display: block; }
  .main-content { margin-left: 0; }
  .topbar { padding-left: 68px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ── Marketing / criador de post ──────────────────────── */
.page-subtitle { font-size: .9rem; color: var(--muted); margin-top: 6px; }

.mkt-studio {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
}
.mkt-controls { flex: 1; min-width: 260px; }
.mkt-genimg {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
}
.mkt-free {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}
.mkt-preview { flex: 0 0 auto; }
.mkt-preview-label {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.post-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
  z-index: 2;
}
.post-canvas.has-photo .post-empty { display: none; }

.post-frame {
  width: 360px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px;
  background: repeating-conic-gradient(#f3f3f3 0% 25%, #fff 0% 50%) 50% / 20px 20px;
}

.post-canvas {
  --accent: #b08d57;
  position: relative;
  width: 340px;
  height: 340px;
  overflow: hidden;
  background: #25211c;
  color: #fff;
  font-family: Georgia, serif;
  user-select: none;
}
.post-canvas .post-photo {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #4a4239, #25211c);
  background-size: cover;
  background-position: center;
}
.post-canvas .post-overlay { position: absolute; inset: 0; }
.post-canvas .post-brand {
  position: absolute;
  top: 18px; left: 20px; right: 20px;
  display: flex; align-items: center; gap: 8px;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; z-index: 3;
}
.post-canvas .post-brand img { height: 22px; max-width: 120px; width: auto; object-fit: contain; }
.post-canvas .post-title {
  position: absolute;
  z-index: 3;
  font-size: 30px;
  line-height: 1.15;
}

/* Clássico: foto cheia, gradiente embaixo, título inferior */
.post-canvas.tpl-classic .post-overlay {
  background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.15) 45%, rgba(0,0,0,.35) 100%);
}
.post-canvas.tpl-classic .post-title {
  left: 24px; right: 24px; bottom: 30px;
  padding-bottom: 14px;
}
.post-canvas.tpl-classic .post-title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 48px; height: 3px; background: var(--accent);
}

/* Editorial: foto em cima, bloco de cor embaixo */
.post-canvas.tpl-editorial .post-photo { bottom: 38%; }
.post-canvas.tpl-editorial .post-overlay {
  top: 62%; background: var(--accent);
}
.post-canvas.tpl-editorial .post-title {
  left: 24px; right: 24px; bottom: 28px;
  font-size: 26px;
}

/* Minimalista: moldura branca, título em barra inferior */
.post-canvas.tpl-minimal .post-overlay {
  border: 10px solid #fff;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.post-canvas.tpl-minimal .post-title {
  left: 24px; right: 24px; bottom: 26px;
  background: rgba(255,255,255,.92);
  color: #25211c;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  font-size: 22px;
}
.post-canvas.tpl-minimal .post-brand { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
