:root {
  --bg: #f5f4fa;
  --surface: #ffffff;
  --surface-2: #f0eef8;
  --line: #e3e0ef;
  --text: #1d1b2c;
  --muted: #5f5b76;
  --primary: #5b3df5;
  --primary-ink: #ffffff;
  --primary-soft: #ece8ff;
  --ok: #157f45;
  --ok-soft: #dff5e8;
  --warn: #b95f00;
  --warn-bg: #e8890c;
  --warn-soft: #fff1dc;
  --danger: #c43b3b;
  --danger-soft: #fde6e6;
  --info: #1f6fc4;
  --info-soft: #e1eefc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 44, .06), 0 4px 16px rgba(29, 27, 44, .06);
  --font: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
img, video { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* ---------- botões e formulários ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: #cdc8e3; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nav a:focus-visible { outline: 3px solid #a99bff; outline-offset: 2px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn { background: var(--warn-bg); border-color: var(--warn-bg); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: wait; }
label.field { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
label.field .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=datetime-local], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #d3cfe4; border-radius: 10px; background: #fff; }
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); flex: none; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- layout da agência ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: #17142b; color: #e9e6f7; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; padding: 4px 10px 18px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #cfc9ea; text-decoration: none; font-weight: 700; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav .badge { margin-left: auto; }
.side .spacer { flex: 1; }
.side .me { font-size: 14px; color: #a9a3c7; padding: 10px 12px; }
.main { padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 28px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.bottom-nav { display: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card h2 { font-size: 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.section { margin-top: 22px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 30px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 14px; }
.stat.alert b { color: var(--warn); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.producao { background: var(--surface-2); color: #4b4766; }
.badge.aprovacao { background: var(--info-soft); color: var(--info); }
.badge.ajustes { background: var(--warn-soft); color: var(--warn); }
.badge.aprovado { background: var(--ok-soft); color: var(--ok); }
.badge.publicado { background: #ebe7ff; color: var(--primary); }
.badge.alta { background: var(--danger-soft); color: var(--danger); }
.badge.count { background: var(--warn-bg); color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.client-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }

/* kanban de tarefas */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 12px; min-height: 140px; }
.col.drag-over { outline: 2px dashed var(--primary); }
.col h3 { font-size: 15px; display: flex; justify-content: space-between; margin: 2px 4px 10px; }
.task { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--primary)); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; }
.task .t { font-weight: 700; }
.task.done .t { text-decoration: line-through; color: var(--muted); }
.task .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.task .acts { display: flex; gap: 6px; margin-top: 8px; }
.quick-add { display: grid; grid-template-columns: 1fr 200px auto; gap: 8px; margin-bottom: 14px; }

.list { display: grid; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: inherit; }
.item:hover { border-color: #cdc8e3; }
.item .time { font-weight: 700; min-width: 50px; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

/* conteúdos */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.tabs button { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--text); color: #fff; border-color: var(--text); }
.ccard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.thumb { aspect-ratio: 4/5; background: #201c38; display: grid; place-items: center; color: #8d86b3; position: relative; overflow: hidden; }
.thumb video, .thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge { position: absolute; top: 10px; left: 10px; }
.ccard .body { padding: 12px 14px; display: grid; gap: 4px; }
.ccard .title { font-weight: 700; }

.detail { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 22px; align-items: start; }
.player { background: #000; border-radius: var(--radius); overflow: hidden; }
.player video, .player img { width: 100%; display: block; max-height: 75vh; }
.player .none { aspect-ratio: 9/16; display: grid; place-items: center; color: #8d86b3; text-align: center; padding: 20px; }
.caption { white-space: pre-wrap; background: var(--surface-2); padding: 12px; border-radius: 10px; }
.comments { display: grid; gap: 10px; }
.cmt { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.cmt.cliente { background: var(--info-soft); }
.cmt.aprovado { background: var(--ok-soft); }
.cmt.ajuste { background: var(--warn-soft); }
.cmt.interno { background: #fff8d6; }
.cmt .who { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }

/* agenda semanal */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-height: 180px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.day.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.day .dh { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; }
.day .dh b { color: var(--text); font-size: 18px; }
.ev { display: block; border-left: 4px solid var(--c); background: var(--surface-2); border-radius: 8px; padding: 6px 8px; font-size: 13px; text-decoration: none; color: inherit; }
.ev b { display: block; font-size: 12px; color: var(--muted); }

/* ideias */
.idea { display: grid; gap: 8px; }
.idea .score { font-weight: 700; font-size: 13px; padding: 3px 8px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); }
.idea .score.mid { background: var(--warn-soft); color: var(--warn); }
.idea .score.low { background: var(--danger-soft); color: var(--danger); }
.ai-note { font-size: 14px; background: var(--primary-soft); color: #3b2a9e; padding: 8px 10px; border-radius: 10px; }

/* briefing */
.brief h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
.brief ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.mood { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); }
.mood.satisfeito { background: var(--ok-soft); color: var(--ok); }
.mood.preocupado, .mood.insatisfeito { background: var(--danger-soft); color: var(--danger); }
.chat { display: grid; gap: 6px; max-height: 420px; overflow: auto; padding: 8px; background: #efeae2; border-radius: 12px; }
.bubble { max-width: 80%; padding: 6px 10px; border-radius: 10px; background: #fff; font-size: 14px; }
.bubble.me { justify-self: end; background: #d9fdd3; }
.bubble .n { font-size: 12px; font-weight: 700; color: var(--primary); }
.bubble .h { font-size: 11px; color: var(--muted); text-align: right; }

.banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: linear-gradient(135deg, #5b3df5, #8b3df5); color: #fff; border-radius: var(--radius); padding: 16px 20px; }
.banner .btn { border-color: transparent; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--surface-2); padding: 10px; border-radius: 8px; word-break: break-all; }
.qr { width: 260px; max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple td, table.simple th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* modal e toast */
.modal-bg { position: fixed; inset: 0; background: rgba(23, 20, 43, .5); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { font-size: 22px; margin-bottom: 16px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
#toast-root { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(520px, calc(100% - 32px)); }
.toast { background: #17142b; color: #fff; padding: 14px 18px; border-radius: 14px; font-weight: 700; box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: up .2s; }
.toast.err { background: var(--danger); }
.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; background: var(--primary); width: 0; transition: width .2s; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #e4ddff, transparent), var(--bg); }
.login .card { width: min(440px, 100%); padding: 30px; }
.login h1 { font-size: 28px; margin: 14px 0 4px; }
.login .logo { width: 64px; height: 64px; border-radius: 16px; }
.login input { min-height: 56px; font-size: 18px; }
.login .btn { min-height: 58px; font-size: 19px; width: 100%; }

/* ---------- ÁREA DO CLIENTE (público mais velho) ---------- */
.portal { --ps: 1; font-size: calc(19px * var(--ps)); max-width: 680px; margin: 0 auto; padding: 18px 16px calc(120px + var(--safe-b)); }
.portal.big { --ps: 1.18; }
.portal .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.portal .hello { font-size: 1.5em; font-weight: 700; }
.portal .sub { color: var(--muted); font-size: .95em; }
.portal .bigbtn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 72px; padding: 16px 20px; font-size: 1.15em;
  font-weight: 700; border-radius: 18px; border: 2px solid transparent; cursor: pointer; text-decoration: none; text-align: center; }
.portal .bigbtn .ico { width: 30px; height: 30px; stroke-width: 2.4; }
.portal .bigbtn.approve { background: var(--ok); color: #fff; }
.portal .bigbtn.change { background: var(--warn-bg); color: #fff; }
.portal .bigbtn.primary { background: var(--primary); color: #fff; }
.portal .bigbtn.light { background: var(--surface); color: var(--text); border-color: var(--line); }
.portal .tile { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--surface); border: 2px solid var(--line); border-radius: 20px; text-decoration: none; color: var(--text); font-size: 1.1em; font-weight: 700; }
.portal .tile .ico { width: 34px; height: 34px; color: var(--primary); }
.portal .tile .num { margin-left: auto; background: var(--warn-bg); color: #fff; min-width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; font-size: .95em; padding: 0 10px; }
.portal .hero { background: linear-gradient(135deg, #5b3df5, #8b3df5); color: #fff; border-radius: 22px; padding: 22px; display: grid; gap: 14px; }
.portal .hero h2 { font-size: 1.3em; }
.portal .hero .bigbtn { background: #fff; color: var(--primary); }
.portal .allgood { background: var(--ok-soft); color: #0f5c32; border-radius: 22px; padding: 22px; font-size: 1.1em; font-weight: 700; display: flex; gap: 14px; align-items: center; }
.portal .step { font-size: 1.05em; font-weight: 700; margin: 22px 0 10px; display: flex; gap: 10px; align-items: center; }
.portal .step .n { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; }
.portal .player video, .portal .player img { max-height: 70vh; }
.portal textarea { font-size: 1em; min-height: 150px; border: 2px solid #c9c3e0; border-radius: 14px; padding: 14px; }
.portal .pcard { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; padding: 16px; display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--text); }
.portal .pcard .mini { width: 74px; height: 92px; border-radius: 12px; background: #201c38; overflow: hidden; flex: none; display: grid; place-items: center; color: #8d86b3; }
.portal .pcard .mini video, .portal .pcard .mini img { width: 100%; height: 100%; object-fit: cover; }
.portal .pcard .ttl { font-weight: 700; }
.portal .status { display: inline-block; margin-top: 4px; font-size: .82em; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.portal .status.aprovacao { background: var(--warn-soft); color: var(--warn); }
.portal .status.ajustes { background: var(--info-soft); color: var(--info); }
.portal .status.aprovado { background: var(--ok-soft); color: var(--ok); }
.portal .status.publicado { background: var(--primary-soft); color: var(--primary); }
.portal .daylabel { font-size: 1.05em; font-weight: 700; margin: 20px 0 8px; }
.portal .done-screen { text-align: center; padding: 40px 10px; display: grid; gap: 18px; justify-items: center; }
.portal .done-screen .big-check { width: 120px; height: 120px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; }
.portal .done-screen .big-check .ico { width: 70px; height: 70px; stroke-width: 3; }
.portal .back { display: inline-flex; align-items: center; gap: 8px; font-size: 1em; font-weight: 700; padding: 10px 4px; background: none; border: none; color: var(--primary); cursor: pointer; text-decoration: none; }
.portal .back .ico { width: 26px; height: 26px; }
.portal .mic.on { background: var(--danger); color: #fff; border-color: var(--danger); }
.pnav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 8px 8px calc(8px + var(--safe-b)); z-index: 20; box-shadow: 0 -4px 20px rgba(0,0,0,.06); }
.pnav a { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 16px; border-radius: 14px; position: relative; }
.pnav a .ico { width: 30px; height: 30px; }
.pnav a.active { color: var(--primary); background: var(--primary-soft); }
.pnav a .num { position: absolute; top: 2px; right: calc(50% - 30px); background: var(--warn-bg); color: #fff; font-size: 13px; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; }
.install { background: #fff8d6; border: 2px solid #f0d57a; border-radius: 18px; padding: 16px; display: grid; gap: 10px; }

/* ---------- celular ---------- */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .shell { display: block; }
  .side { display: none; }
  .main { padding: 18px 16px calc(96px + var(--safe-b)); }
  .page-head h1 { font-size: 24px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + var(--safe-b)); z-index: 20; }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; padding: 6px 2px; border-radius: 10px; position: relative; }
  .bottom-nav a .ico { width: 24px; height: 24px; }
  .bottom-nav a.active { color: var(--primary); background: var(--primary-soft); }
  .bottom-nav a .badge { position: absolute; top: 0; right: 14%; padding: 1px 6px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .kanban, .grid.cols-2, .grid.cols-3, .form-grid { grid-template-columns: 1fr; }
  .quick-add { grid-template-columns: 1fr; }
  .grid.cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ccard .body { padding: 10px; font-size: 14px; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .day.empty-day { display: none; }
  .modal { padding: 18px; border-radius: 18px 18px 0 0; align-self: end; max-height: 92vh; }
  .modal-bg { padding: 0; }
}
