:root {
  --bg: #F5F2ED; --surface: #FFFFFF; --ink: #1B1F1D; --muted: #6B6F6C; --line: #E3DED6;
  --brand: #0F2A24; --brand-2: #173A32; --accent: #8B1E3F; --accent-soft: #F6E7EC;
  --ok: #1F7A4D; --warn: #A15C07; --err: #B42318;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
h1, h2, h3 { font-family: Georgia, "Playfair Display", serif; font-weight: 700; margin: 0 0 .4em; color: var(--brand); }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 17px; }
.boot { padding: 40px; color: var(--muted); }

/* layout */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.side { background: var(--brand); color: #fff; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.logo { font-family: Georgia, serif; font-size: 19px; padding: 4px 10px 18px; line-height: 1.2; }
.logo small { display: block; font-family: inherit; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #E7B8C6; margin-top: 4px; }
.side a { color: rgba(255,255,255,.82); text-decoration: none; padding: 9px 12px; border-radius: 8px; display: flex; align-items: center; gap: 10px; }
.side a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side a.on { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.side .grow { flex: 1; }
.side .spend { font-size: 12px; color: rgba(255,255,255,.7); padding: 10px 12px; }
.bar { height: 6px; background: rgba(255,255,255,.18); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: #E7B8C6; }
main { padding: 32px clamp(16px, 4vw, 48px) 64px; max-width: 1180px; width: 100%; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.sub { color: var(--muted); margin: -4px 0 20px; }

/* componentes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: #cfc8bd; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #761734; }
.btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 10px; }
.btn.ghost:hover { color: var(--ink); background: #EDE8E0; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: #3a3f3c; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=date], textarea, select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(139,30,63,.25); border-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 8px 14px; font: inherit; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--brand); color: #fff; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: #EDE8E0; color: #4a4f4c; }
.badge.carrossel { background: var(--accent-soft); color: var(--accent); }
.badge.roteiro { background: #E4EFEA; color: var(--brand-2); }
.badge.usada { background: #E4EFEA; color: var(--ok); }
.badge.pronto { background: #E4EFEA; color: var(--ok); }
.badge.publicado { background: #E0E9F5; color: #1E4E8C; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.muted { color: var(--muted); }
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.item:last-child { border-bottom: 0; }
.item:hover .t { color: var(--accent); }
.item .t { font-weight: 600; }
.item .thumb { width: 48px; height: 60px; border-radius: 6px; object-fit: cover; background: #ddd; flex: none; }
.item .grow { flex: 1; min-width: 0; }

/* calendário */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 180px; display: flex; flex-direction: column; gap: 8px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.day h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.day h4 b { color: var(--ink); font-size: 16px; letter-spacing: 0; }
.idea { border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; background: #FCFBF9; }
.idea.usada { opacity: .6; }
.idea .t { font-weight: 600; margin: 4px 0; line-height: 1.3; }
.idea .a { color: var(--muted); font-size: 12px; line-height: 1.35; }
.idea .acts { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }

/* carrossel */
.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.slides img { width: 100%; aspect-ratio: 4/5; border-radius: 8px; border: 1px solid var(--line); background: #e9e5de; display: block; cursor: zoom-in; }
.editor .slide-ed { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.editor .slide-ed img { width: 150px; aspect-ratio: 4/5; border-radius: 8px; border: 1px solid var(--line); }
.estilos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.estilo { border: 2px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; text-align: center; font-size: 13px; font-weight: 600; background: #fff; }
.estilo.on { border-color: var(--accent); }
.estilo .sw { height: 70px; border-radius: 6px; margin-bottom: 8px; }
.loading { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--accent-soft); border-radius: 10px; color: var(--accent); font-weight: 600; }
.spin { width: 20px; height: 20px; border: 3px solid rgba(139,30,63,.25); border-top-color: var(--accent); border-radius: 50%; animation: s 1s linear infinite; flex: none; }
@keyframes s { to { transform: rotate(360deg); } }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center; z-index: 50; cursor: zoom-out; }
.lightbox img { max-height: 92vh; max-width: 92vw; border-radius: 8px; }

/* roteiro */
.cena { display: grid; grid-template-columns: 90px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.cena .tm { font-weight: 700; color: var(--accent); font-size: 14px; }
.cena .fala { font-size: 16.5px; line-height: 1.55; margin: 4px 0 8px; }
.cena .meta { font-size: 13px; color: var(--muted); }
.gancho { padding: 10px 14px; border-left: 3px solid var(--accent); background: #FCFBF9; margin: 8px 0; border-radius: 0 8px 8px 0; }
.prompter { position: fixed; inset: 0; background: #000; color: #fff; z-index: 60; overflow-y: auto; padding: 12vh 8vw 60vh; font-size: clamp(28px, 5vw, 54px); line-height: 1.45; }
.prompter p { margin: 0 0 1.2em; }
.prompter .close { position: fixed; top: 16px; right: 16px; }
.prompter .ctrl { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }

/* login */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--brand); }
.auth .card { width: 100%; max-width: 380px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; z-index: 70; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--err); }

.mobile-nav { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 24px; }
  .side { display: none; }
  .mobile-nav { display: flex; overflow-x: auto; gap: 4px; background: var(--brand); padding: 10px; position: sticky; top: 0; z-index: 10; }
  .mobile-nav a { color: rgba(255,255,255,.85); text-decoration: none; padding: 7px 12px; border-radius: 8px; white-space: nowrap; font-size: 14px; }
  .mobile-nav a.on { background: rgba(255,255,255,.16); color: #fff; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .editor .slide-ed { grid-template-columns: 1fr; }
  .cena { grid-template-columns: 1fr; gap: 4px; }
  .estilos { grid-template-columns: 1fr 1fr 1fr; }
}
@media print {
  .side, .mobile-nav, .noprint, #toast { display: none !important; }
  .shell { display: block; } main { padding: 0; }
  .card { border: 0; box-shadow: none; padding: 0; }
  body { background: #fff; }
}
