/* SocialMan — interface do painel. Sem dependências externas (self-hosted). */
:root {
  --bg: #f6f7fb; --panel: #ffffff; --ink: #14161f; --muted: #626a7d; --line: #e4e7ef;
  --brand: #4f46e5; --brand-ink: #ffffff; --brand-soft: #eef0ff;
  --green: #0f9f6e; --green-soft: #e3f7ef; --red: #d93a3a; --red-soft: #fdeceb;
  --amber: #b7791f; --amber-soft: #fdf4e3; --blue: #2563eb; --blue-soft: #e8f0ff; --gray-soft: #eef0f4;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,22,31,.05), 0 4px 16px rgba(20,22,31,.04);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1117; --panel: #171a23; --ink: #e9ebf2; --muted: #9aa1b3; --line: #262a37;
    --brand-soft: #22234a; --green-soft: #0f2b22; --red-soft: #351818; --amber-soft: #33270f; --blue-soft: #14213d; --gray-soft: #1f2330; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
small, .muted { color: var(--muted); }
code { background: var(--gray-soft); padding: .1rem .35rem; border-radius: 6px; font-size: .88em; word-break: break-all; }

/* ------------------------------------------------------------ layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 1.1rem .9rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; color: var(--ink); padding: 0 .4rem; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), #db2777); display: grid; place-items: center; color: #fff; font-size: .9rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: var(--ink); padding: .5rem .65rem; border-radius: 8px; display: flex; align-items: center; gap: .55rem; }
.nav a:hover { background: var(--gray-soft); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav .cta { background: var(--brand); color: var(--brand-ink); justify-content: center; font-weight: 600; margin-bottom: .5rem; }
.nav .cta:hover { background: var(--brand); filter: brightness(1.08); }
.side-foot { margin-top: auto; font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: .5rem; }
.ws-switch select { width: 100%; }
.main { padding: 1.75rem 2.2rem 3rem; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .main { padding: 1.2rem; } }

/* ------------------------------------------------------------ componentes */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stat { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: .5rem .9rem; border-radius: 9px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--gray-soft); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-danger { color: var(--red); }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
form.inline { display: inline; }
label { font-weight: 500; font-size: .9rem; display: block; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=datetime-local], input[type=color], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: .55rem .7rem; }
input[type=color] { padding: .15rem; height: 2.4rem; }
textarea { resize: vertical; min-height: 140px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.field { margin-bottom: .95rem; }
.help { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray { background: var(--gray-soft); color: var(--muted); }
.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-ok { background: var(--green-soft); color: var(--green); }
.flash-error { background: var(--red-soft); color: var(--red); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.pf { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; font-size: .72rem; font-weight: 700; flex: none; }
.pf-lg { width: 40px; height: 40px; border-radius: 11px; font-size: .95rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--gray-soft); flex: none; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.error-list { margin: .3rem 0 0; padding-left: 1.1rem; color: var(--red); font-size: .86rem; }

/* ------------------------------------------------------------ contas */
.provider { display: flex; align-items: center; gap: .75rem; padding: .8rem; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink); }
.provider:hover { border-color: var(--brand); text-decoration: none; }
.provider.off { opacity: .55; }
.account { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.account:last-child { border-bottom: 0; }

/* ------------------------------------------------------------ compositor */
.composer { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 1000px) { .composer { grid-template-columns: 1fr; } }
.targets { display: flex; flex-wrap: wrap; gap: .5rem; }
.target-toggle { display: flex; align-items: center; gap: .5rem; border: 1.5px solid var(--line); border-radius: 999px; padding: .3rem .75rem .3rem .3rem; cursor: pointer; background: var(--panel); user-select: none; font-size: .88rem; }
.target-toggle input { display: none; }
.target-toggle.on { border-color: var(--brand); background: var(--brand-soft); }
.target-toggle.inactive { opacity: .5; cursor: not-allowed; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 1.2rem; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.thumbs { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }
.thumb { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; background: var(--gray-soft); border: 1px solid var(--line); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; border: 0; border-radius: 50%; width: 22px; height: 22px; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; line-height: 1; }
.thumb .meta { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: .68rem; padding: 2px 5px; }
.thumb.uploading { display: grid; place-items: center; font-size: .78rem; color: var(--muted); }
.net-card { border: 1px solid var(--line); border-radius: 11px; padding: .8rem .9rem; margin-bottom: .7rem; background: var(--panel); }
.net-card header { display: flex; align-items: center; gap: .55rem; margin-bottom: .4rem; }
.net-card .count { margin-left: auto; font-size: .8rem; font-variant-numeric: tabular-nums; }
.net-card .count.over { color: var(--red); font-weight: 700; }
.net-card textarea { min-height: 80px; font-size: .9rem; }
.net-card .opts { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.net-card .opts label { font-size: .78rem; margin: 0; }
.net-card .opts select { padding: .3rem .5rem; font-size: .85rem; width: auto; }
.net-card .ok { color: var(--green); font-size: .82rem; }
.actions-bar { position: sticky; bottom: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-top: 1rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg label { margin: 0; padding: .45rem .8rem; cursor: pointer; font-weight: 500; }
.seg input { display: none; }
.seg input:checked + span { color: var(--brand); font-weight: 700; }

/* ------------------------------------------------------------ autenticação */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent), var(--bg); }
.auth .card { width: 100%; max-width: 410px; padding: 1.8rem; }
.auth .logo { justify-content: center; margin-bottom: 1.2rem; }

/* ------------------------------------------------------------ páginas públicas */
.prose { max-width: 760px; margin: 2.5rem auto; padding: 0 1.2rem; }
.prose h1 { margin-bottom: 1rem; }
.prose h2 { margin-top: 1.6rem; }
