:root {
  --bg: #f5f5f9;
  --card: #ffffff;
  --line: #e4e3ec;
  --line-soft: #efeef5;
  --text: #1f1b2d;
  --muted: #6b6780;
  --accent: #6d28d9;
  --accent-hover: #5b21b6;
  --accent-soft: #f1ebfd;
  --ok: #16a34a;
  --err: #dc2626;
  --warn: #ea7a0c;
  --info: #2563eb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 16, 40, .05), 0 4px 16px rgba(20, 16, 40, .04);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
svg { width: 18px; height: 18px; flex: none; }

/* ---------- layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex: none; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 0 8px 22px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-title, nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 600;
}
.nav-title { color: var(--accent); }
nav a.sub { font-weight: 500; padding-left: 38px; color: var(--muted); }
nav a:hover { background: var(--line-soft); }
nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.logout { border: 0; background: none; color: var(--muted); text-align: left; padding: 8px 10px; cursor: pointer; border-radius: 8px; }
.logout:hover { background: var(--line-soft); }
.view { flex: 1; min-width: 0; padding: 24px 28px 110px; }

/* ---------- comuns */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.loading { padding: 40px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { border-color: #cfcbdc; background: #fafaff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.outline { border-color: var(--accent); color: var(--accent); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; font-size: 13px; }
.icon-btn { border: 0; background: none; cursor: pointer; width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); font-size: 20px; }
.icon-btn:hover { background: var(--line-soft); color: var(--text); }

label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
label.field + label.field { margin-top: 12px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=search], input[type=url], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; outline: none; font-weight: 400;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; width: 100%; }
.code { font-family: Consolas, monospace; font-size: 12.5px; background: var(--line-soft); padding: 8px 10px; border-radius: 7px; word-break: break-all; }

/* ---------- ícones de rede */
.net { width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; color: #fff; flex: none; }
.net svg { width: 13px; height: 13px; }
.net.ig { background: radial-gradient(circle at 30% 110%, #fdd65b 0%, #f5793a 30%, #d62976 60%, #962fbf 85%); }
.net.fb { background: #1877f2; }
.net.tt { background: #111; }
.net.ts { background: #8b8899; }

/* ---------- status */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.st-draft { color: #6b6780; background: #efeef4; }
.st-approval { color: var(--info); background: #e7efff; }
.st-changes { color: #b45309; background: #fef3c7; }
.st-scheduled { color: var(--warn); background: #fff1e4; }
.st-publishing { color: var(--accent); background: var(--accent-soft); }
.st-published { color: var(--ok); background: #e5f6ec; }
.st-error { color: var(--err); background: #fde8e8; }

/* ---------- calendário */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { min-width: 150px; }
.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-head { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); position: relative; }
.cal-head h2 { margin: 0; font-size: 16px; min-width: 170px; text-align: center; }
.cal-head .views { position: absolute; right: 10px; display: flex; gap: 4px; }
.cal-head .views button.on { color: var(--accent); background: var(--accent-soft); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { background: #fafafc; text-align: center; font-weight: 700; font-size: 12.5px; padding: 7px; border-bottom: 1px solid var(--line); color: var(--muted); }
.day { min-height: 128px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 5px 5px 22px; position: relative; cursor: pointer; min-width: 0; }
.day:nth-child(7n) { border-right: 0; }
.day:hover { background: #fcfbff; }
.day.other { background: #f7f7fa; }
.day.other .day-num { color: #b5b2c3; }
.day.past { cursor: default; }
.day-num { text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 3px 3px; }
.day.today .day-num span { background: var(--accent); color: #fff; border-radius: 99px; padding: 1px 7px; }
.entry {
  display: flex; align-items: center; gap: 4px; width: 100%; border: 0; background: none; padding: 2px 3px;
  border-radius: 5px; cursor: pointer; font-size: 12px; text-align: left; min-width: 0;
}
.entry:hover { background: var(--accent-soft); }
.entry .net { width: 15px; height: 15px; border-radius: 4px; }
.entry .net svg { width: 11px; height: 11px; }
.entry .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.entry .time { font-weight: 700; font-size: 11.5px; }
.entry .sti svg { width: 13px; height: 13px; display: block; }
.c-published { color: var(--ok); }
.c-error { color: var(--err); }
.c-scheduled { color: var(--warn); }
.c-approval { color: var(--info); }
.c-changes { color: #b45309; }
.c-draft { color: #8b8899; }
.c-publishing { color: var(--accent); }
.day-foot { position: absolute; left: 7px; right: 7px; bottom: 4px; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.day-foot .link { font-size: 11px; }

.list-table { width: 100%; border-collapse: collapse; }
.list-table th, .list-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
.list-table th { font-size: 12px; color: var(--muted); background: #fafafc; }
.list-table tr.clickable { cursor: pointer; }
.list-table tr.clickable:hover td { background: #fcfbff; }
.cap-cell { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

/* ---------- agendar */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.compose-side { position: sticky; top: 20px; }
.acc-search { width: 100%; margin-bottom: 10px; }
.acc-group + .acc-group { margin-top: 12px; }
.acc-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 700; font-size: 13px; }
.acc-group-head .dot { width: 9px; height: 9px; border-radius: 99px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 4px 11px 4px 5px; cursor: pointer; font-size: 13px; user-select: none; background: #fff; }
.chip input { display: none; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; background: #fafafc; }
.seg button { border: 0; background: none; padding: 6px 16px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.counter { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }
.counter .over { color: var(--err); font-weight: 700; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1.5px dashed #cfcbdc;
  border-radius: 10px; padding: 22px; cursor: pointer; color: var(--muted); text-align: center; background: #fcfcfe;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 26px; height: 26px; }
.media-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.media-list:empty { display: none; }
.thumb { width: 104px; height: 104px; border-radius: 9px; overflow: hidden; position: relative; background: #eee; border: 1px solid var(--line); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; background: linear-gradient(transparent, rgba(0,0,0,.6)); padding: 4px; }
.thumb .tools button { border: 0; background: rgba(255,255,255,.9); border-radius: 5px; cursor: pointer; width: 22px; height: 22px; font-size: 13px; line-height: 1; padding: 0; }
.thumb .num { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; border-radius: 5px; padding: 0 6px; }
.thumb.loading-thumb { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.action-bar {
  position: fixed; left: 230px; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; padding: 12px 28px; z-index: 5; flex-wrap: wrap;
}
.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; border: 1px solid; }
.notice.err { background: #fef4f4; border-color: #f6caca; }
.notice.info { background: #f3f7ff; border-color: #cfdcfb; }
.notice.warn { background: #fffaf0; border-color: #f6dfb0; }
.notice h4 { margin: 0 0 6px; font-size: 14px; }
.notice ul { margin: 6px 0; padding-left: 18px; }
.target-list { display: flex; flex-direction: column; gap: 6px; }
.target-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* prévia estilo Instagram */
.pv { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.pv-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px; font-weight: 700; font-size: 13px; }
.pv-avatar { width: 30px; height: 30px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; overflow: hidden; flex: none; }
.pv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pv-media { aspect-ratio: 4 / 5; background: #f0eff4; position: relative; display: grid; place-items: center; color: #aaa; }
.pv-media.story { aspect-ratio: 9 / 16; }
.pv-media img, .pv-media video { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.pv-count { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 99px; z-index: 1; }
.pv-caption { padding: 10px; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; max-height: 220px; overflow: auto; }

/* ---------- tarefas */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: #ecebf2; border-radius: var(--radius); padding: 10px; min-height: 300px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; padding: 2px 4px 10px; }
.col-head .count { background: #fff; border-radius: 99px; padding: 0 9px; font-size: 12px; color: var(--muted); }
.task { background: #fff; border-radius: 9px; padding: 10px 12px; box-shadow: var(--shadow); cursor: grab; border: 1px solid var(--line); }
.task + .task { margin-top: 8px; }
.task.dragging { opacity: .4; }
.task-title { font-weight: 600; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--line-soft); }
.tag .dot { width: 7px; height: 7px; border-radius: 99px; }
.due-late { color: var(--err); font-weight: 700; }

/* ---------- clientes */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.client-card { border-top: 4px solid var(--accent); }
.client-card .head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.client-card .head h3 { flex: 1; margin: 0; }
.acc-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.acc-row .info { flex: 1; min-width: 0; }
.acc-row .info div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-pick { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.page-pick .opts { display: flex; gap: 14px; flex-wrap: wrap; }
.page-pick label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.page-pick .name { flex: 1; font-weight: 600; min-width: 140px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.steps { margin: 0; padding-left: 20px; }
.steps li + li { margin-top: 6px; }

/* ---------- modal e toast */
.overlay { position: fixed; inset: 0; background: rgba(20, 16, 40, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 480px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
#toast {
  position: fixed; bottom: 80px; left: 50%; transform: translate(-50%, 20px); background: #1f1b2d; color: #fff;
  padding: 10px 18px; border-radius: 9px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--err); }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login h1 { font-size: 20px; margin: 14px 0 4px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

/* ---------- responsivo */
@media (max-width: 1100px) {
  .compose { grid-template-columns: 1fr; }
  .compose-side { position: static; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 6px; }
  .brand { padding: 0 10px 0 0; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .nav-title, .nav-sep { display: none; }
  nav a.sub { padding-left: 10px; }
  .view { padding: 16px 16px 140px; }
  .action-bar { left: 0; padding: 10px 16px; }
  .kanban { grid-template-columns: 1fr; }
  .day { min-height: 80px; }
  .entry .name, .entry .time { display: none; }
}
