/* Avontz Studio — identidade visual Avontz (azul #0093EB, Sora + Inter) */
:root {
  --brand: #0093eb;
  --brand-hover: #007fcc;
  --brand-light: #5cc0f5;
  --brand-soft: #e3f3fd;
  --ink: #131e23;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #f0f4f7;
  --text: #131e23;
  --muted: #56666f;
  --border: rgba(19, 30, 35, .1);
  --glow: rgba(0, 147, 235, .16);
  --ok: #12a150;
  --ok-soft: #e3f6eb;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --err: #d93a4a;
  --err-soft: #fde8ea;
  --shadow: 0 1px 2px rgba(16, 42, 86, .04), 0 10px 30px rgba(16, 42, 86, .06);
  --shadow-lg: 0 10px 40px -12px rgba(19, 30, 35, .18);
  --radius: 18px;
  --ig: linear-gradient(45deg, #f9ce34, #ee2a7b 50%, #6228d7);
  --yt: #ff0033;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0f14;
  --surface: #131e23;
  --surface-2: #18242c;
  --text: #e9eef2;
  --muted: #93a6b1;
  --border: rgba(255, 255, 255, .09);
  --brand-soft: rgba(0, 147, 235, .16);
  --glow: rgba(0, 147, 235, .28);
  --ok-soft: rgba(18, 161, 80, .16);
  --warn-soft: rgba(183, 121, 31, .18);
  --err-soft: rgba(217, 58, 74, .18);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 14px/1.55 "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--glow), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, var(--glow), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, .display { font-family: "Sora", "Inter", sans-serif; }
h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -.04em; font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -.02em; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 8px; letter-spacing: -.01em; font-weight: 600; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.nowrap { flex-wrap: nowrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 18px; }
code { background: var(--surface-2); padding: 1px 7px; border-radius: 6px; font-size: 12.5px; word-break: break-all; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 24px; text-decoration: none !important; }
.logo { height: 30px; width: auto; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.brand-tag {
  font-family: "Sora", sans-serif; font-weight: 600; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-soft); padding: 3px 9px; border-radius: 99px;
}
nav { display: flex; flex-direction: column; gap: 2px; }
nav a {
  display: flex; gap: 11px; align-items: center; padding: 10px 12px; border-radius: 12px;
  color: var(--text); font-weight: 500;
}
nav a svg { width: 19px; height: 19px; fill: var(--muted); flex: none; }
nav a:hover { background: var(--surface-2); text-decoration: none; }
nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
nav a.active svg { fill: var(--brand); }
.sidebar-foot { margin-top: auto; display: flex; gap: 8px; align-items: center; padding: 0 8px; }
.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 16px;
}
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; padding: 6px; }
.link-btn:hover { color: var(--err); }
.view { padding: 32px 36px 96px; max-width: 1260px; width: 100%; outline: none; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.accounts { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.kpi .label { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.kpi .value { font-family: "Sora", sans-serif; font-size: 30px; font-weight: 700; letter-spacing: -.04em; margin-top: 6px; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.kpi-brand { background: linear-gradient(135deg, var(--brand), #0a6fc0); color: #fff; border-color: transparent; box-shadow: 0 12px 26px rgba(0, 102, 179, .28); }
.kpi.kpi-brand .label, .kpi.kpi-brand .sub { color: rgba(255, 255, 255, .8); }

/* ---------- botões e campos ---------- */
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 18px; border-radius: 99px; font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; transition: .15s; text-decoration: none !important;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 8px 20px -8px rgba(0, 147, 235, .7); }
.btn.primary:hover { background: var(--brand-hover); color: #fff; box-shadow: 0 12px 26px rgba(0, 102, 179, .28); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 5px 12px; font-size: 12.5px; }
.btn.big { padding: 13px 26px; font-size: 15px; letter-spacing: .01em; }
.btn .arrow { width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .22); display: grid; place-items: center; font-size: 12px; }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
label.field .hint, .field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type=text], input[type=url], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 12px; width: 100%; transition: .15s;
}
textarea { resize: vertical; min-height: 66px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------- badges / redes ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--brand-soft); color: var(--brand); }
.net { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; color: #fff; flex: none; }
.net svg { width: 12px; height: 12px; fill: #fff; }
.net.instagram { background: var(--ig); }
.net.tiktok { background: #111; box-shadow: inset 0 0 0 1px #3a3a3a; }
.net.youtube { background: var(--yt); }
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.avatar.ph { display: grid; place-items: center; font-family: "Sora", sans-serif; font-weight: 700; color: var(--brand); background: var(--brand-soft); }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .net { position: absolute; right: -4px; bottom: -4px; border: 2px solid var(--surface); width: 22px; height: 22px; }
.acc-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.acc-head > div { min-width: 0; }
.acc-head strong, .acc-head .small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- seleção de contas ---------- */
.acc-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.acc { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; background: var(--surface); user-select: none; transition: .15s; }
.acc:hover { border-color: var(--brand-light); }
.acc.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--glow); }
.acc.off { opacity: .55; cursor: not-allowed; }
.acc .name { font-weight: 600; line-height: 1.2; }
.acc .sub { font-size: 12px; color: var(--muted); }

/* ---------- vídeos ---------- */
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px; text-align: center; background: var(--surface-2); cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop strong { font-family: "Sora", sans-serif; font-size: 16px; }
.items { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 28px 92px 1fr auto; gap: 14px; align-items: start; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.item .idx { font-family: "Sora", sans-serif; font-weight: 700; color: var(--muted); text-align: center; padding-top: 6px; }
.thumb { width: 92px; height: 140px; border-radius: 12px; overflow: hidden; background: #000; position: relative; }
.thumb video, .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur { position: absolute; right: 4px; bottom: 4px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 11px; padding: 0 5px; border-radius: 4px; }
.item .fields { display: grid; gap: 8px; min-width: 0; }
.item .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.item .side { display: grid; gap: 6px; justify-items: end; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; width: 100%; }
.progress > div { height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.progress.ok > div { background: var(--ok); }
.progress.err > div { background: var(--err); }
.counter { font-size: 11px; color: var(--muted); white-space: nowrap; }
.counter.over { color: var(--err); font-weight: 700; }

/* ---------- horários ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 6px 4px 12px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.chip input[type=time] { border: 0; background: transparent; color: inherit; font-weight: 700; padding: 0; width: auto; outline: none; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day { width: 46px; padding: 7px 0; text-align: center; border-radius: 99px; border: 1.5px solid var(--border); cursor: pointer; font-weight: 600; user-select: none; background: var(--surface); }
.day.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.timeline { display: grid; gap: 8px; max-height: 430px; overflow: auto; padding-right: 4px; }
.tl-day { display: grid; grid-template-columns: 70px 1fr; gap: 12px; align-items: start; }
.tl-day .d { font-family: "Sora", sans-serif; font-weight: 700; padding-top: 6px; }
.tl-day .d small { display: block; color: var(--muted); font-family: "Inter", sans-serif; font-weight: 500; }
.tl-slots { display: grid; gap: 6px; }
.tl-slot { display: flex; gap: 10px; align-items: center; padding: 7px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.tl-slot .t { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand); }
.tl-slot .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- etapas ---------- */
.step { display: grid; grid-template-columns: 38px 1fr; gap: 16px; }
.step-n { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-family: "Sora", sans-serif; font-weight: 700; box-shadow: 0 8px 18px -6px rgba(0, 147, 235, .6); }
.net-box { border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: grid; gap: 10px; background: var(--surface); }
.net-box h3 { display: flex; gap: 8px; align-items: center; margin: 0; }
.sticky-bar {
  position: sticky; bottom: 14px; margin-top: 24px; padding: 14px 18px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}

/* ---------- listas ---------- */
.list-row { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row .txt { min-width: 0; flex: 1; }
.list-row .txt .c { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.empty { text-align: center; padding: 30px; color: var(--muted); }
.stat-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.stat-line strong { color: var(--text); font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 46px; display: block; margin-top: 10px; }
.spark path.line { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark path.area { fill: var(--brand-soft); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--err); }

/* ---------- calendário ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .wd { font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: center; padding-bottom: 4px; text-transform: uppercase; letter-spacing: .06em; }
.cal .cell { min-height: 112px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal .cell.out { opacity: .45; }
.cal .cell.today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--glow); }
.cal .cell .n { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal .ev { display: flex; gap: 5px; align-items: center; font-size: 11.5px; padding: 3px 5px; border-radius: 7px; background: var(--surface-2); cursor: pointer; min-width: 0; border-left: 3px solid var(--brand); }
.cal .ev .net { width: 16px; height: 16px; border-radius: 4px; }
.cal .ev .net svg { width: 9px; height: 9px; }
.cal .ev .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.cal .ev .c { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.published { border-left-color: var(--ok); }
.cal .ev.error { border-left-color: var(--err); }
.cal .ev.processing, .cal .ev.publishing { border-left-color: var(--warn); }
.cal .more { font-size: 11px; color: var(--muted); }

/* ---------- campanhas ---------- */
.camp-items { display: grid; margin-top: 12px; }
.camp-item { display: grid; grid-template-columns: 130px 22px 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; padding: 8px 0; border-top: 1px solid var(--border); }
.camp-item .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp-item .e { grid-column: 3 / -1; font-size: 12px; margin-top: -4px; }
.camp-item .e.err { color: var(--err); }

/* ---------- avisos ---------- */
.notice { padding: 13px 16px; border-radius: 14px; background: var(--brand-soft); border: 1px solid transparent; }
.notice.warn { background: var(--warn-soft); }
.notice.err { background: var(--err-soft); }
.notice.ok { background: var(--ok-soft); }
.notice ol, .notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice li + li { margin-top: 4px; }

/* ---------- login ---------- */
.gate { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 400px; text-align: center; }
.gate-card .logo { height: 40px; margin: 0 auto 6px; }
.gate-card form { display: grid; gap: 12px; margin-top: 18px; text-align: left; }

/* ---------- toasts / dialog ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); max-width: 400px; font-weight: 500; animation: pop .2s ease-out; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 24px; max-width: 580px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10, 15, 20, .5); backdrop-filter: blur(2px); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; align-content: flex-start; padding: 10px 12px; gap: 6px 8px; }
  .brand { padding: 0 8px 0 4px; }
  .logo { height: 24px; }
  nav { flex-direction: row; flex-wrap: wrap; }
  nav a { padding: 6px 9px; font-size: 13px; }
  nav a svg { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; }
  .view { padding: 20px 16px 96px; }
  .item { grid-template-columns: 70px 1fr; }
  .item .idx { display: none; }
  .thumb { width: 70px; height: 106px; }
  .item .side { grid-column: 1 / -1; grid-auto-flow: column; justify-content: end; }
  .tl-day { grid-template-columns: 1fr; gap: 4px; }
  .cal .cell { min-height: 70px; }
  .cal .ev .c, .cal .ev .t { display: none; }
  .camp-item { grid-template-columns: 22px 1fr auto; }
  .camp-item .s, .camp-item .x { display: none; }
  .camp-item .e { grid-column: 2 / -1; }
  .sticky-bar { border-radius: 18px; }
  .sticky-bar label.field { min-width: 100%; }
}
