:root {
  --bg: #07070c; --text: #f3f5fa; --muted: #9aa1b4;
  --lime: #b8ff3a; --violet: #7c5cff; --green: #38e08a; --red: #ff5c6c; --amber: #ffce4d;
  --card: rgba(255,255,255,0.04); --border: rgba(255,255,255,0.09); --radius: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Inter", system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1,h2,h3,.brand-name { font-family: "Space Grotesk", sans-serif; letter-spacing: -0.02em; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sm { font-size: 0.85rem; }
.link { color: var(--lime); cursor: pointer; font-weight: 600; }

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1000px 600px at 80% -10%, #15152a, var(--bg) 60%); }
.blob { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.4; }
.b1 { width: 480px; height: 480px; background: var(--violet); top: -160px; left: -120px; }
.b2 { width: 420px; height: 420px; background: var(--lime); bottom: -180px; right: -120px; opacity: 0.18; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--lime), var(--violet)); color: #0a0a0f; font-family: "Space Grotesk"; font-weight: 700; }
.brand-name { font-size: 1.1rem; }

.btn { font-family: "Space Grotesk"; font-weight: 600; font-size: 0.92rem; padding: 11px 18px; border-radius: 999px; cursor: pointer; border: 1px solid transparent; background: linear-gradient(135deg, var(--lime), #d6ff85); color: #0a0a0f; transition: transform 0.15s, box-shadow 0.15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(184,255,58,0.3); }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); box-shadow: none; }

/* ===== login ===== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 36px; display: flex; flex-direction: column; gap: 14px; backdrop-filter: blur(8px); }
.login-card h1 { font-size: 1.5rem; }
.login-card .sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 8px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.login-card input { background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; color: var(--text); font-size: 0.95rem; outline: none; transition: border-color 0.2s; }
.login-card input:focus { border-color: var(--lime); }
.login-card .btn { margin-top: 8px; }
.err { color: var(--red); font-size: 0.85rem; min-height: 1em; }

/* ===== app shell ===== */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--border); padding: 22px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; background: rgba(8,8,14,0.6); backdrop-filter: blur(12px); }
.side-brand { padding: 4px 8px 8px; }
.menu { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--muted); font-weight: 500; cursor: pointer; font-size: 0.95rem; border: none; background: none; font-family: inherit; text-align: left; width: 100%; transition: background 0.15s, color 0.15s; }
.menu-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.menu-item.active { background: linear-gradient(135deg, rgba(184,255,58,0.16), rgba(124,92,255,0.16)); color: var(--text); }
.mi-ic { font-size: 1.05rem; }
.side-foot { border-top: 1px solid var(--border); padding-top: 12px; }
.logout:hover { color: var(--red); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 28px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(8,8,14,0.7); backdrop-filter: blur(12px); z-index: 10; gap: 12px; }
.topbar h2 { font-size: 1.3rem; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill { font-size: 0.8rem; color: var(--muted); background: var(--card); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; }
.content { padding: 26px 32px 48px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ===== dashboard ===== */
.notice { background: rgba(255,206,77,0.1); border: 1px solid rgba(255,206,77,0.3); color: var(--amber); padding: 14px 16px; border-radius: 14px; margin-bottom: 20px; font-size: 0.92rem; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.kpi .v { font-family: "Space Grotesk"; font-size: 2rem; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.kpi .v.ok { color: var(--green); }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.panel h3 { font-size: 1.08rem; margin-bottom: 14px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.panel-head h3 { margin-bottom: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

.list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.list li:last-child { border-bottom: none; padding-bottom: 0; }
.list .tag { font-size: 0.74rem; color: var(--muted); background: rgba(255,255,255,0.05); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }

.dash-main { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; align-items: stretch; }
.dash-main .panel { margin-bottom: 0; min-width: 0; }
.dash-low { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.dash-low .panel { margin-bottom: 0; min-width: 0; }
.chart-panel { overflow: hidden; }

.summary-panel .panel-head { margin-bottom: 16px; }
.kv { list-style: none; display: flex; flex-direction: column; gap: 0; }
.kv li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.kv li:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .val { font-weight: 600; text-align: right; }
.kv .chip { font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.kv .chip.on { background: rgba(56,224,138,0.14); color: var(--green); }
.kv .chip.off { background: rgba(255,255,255,0.06); color: var(--muted); }
.kv .chip.warn { background: rgba(255,206,77,0.14); color: var(--amber); }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.bar-val { font-size: 0.72rem; font-weight: 700; color: var(--lime); min-height: 14px; }
.bar-track { width: 100%; max-width: 30px; flex: 1; display: flex; align-items: flex-end; }
.bar { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--lime), #6f9e2e); min-height: 2px; transition: height 0.5s ease; }
.bar-day { font-size: 0.62rem; color: var(--muted); white-space: nowrap; }

/* ===== forms (criação) ===== */
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.fld input, .fld textarea, .fld select { background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; color: var(--text); font-size: 0.93rem; outline: none; font-family: inherit; transition: border-color 0.2s; resize: vertical; }
.fld input:focus, .fld textarea:focus { border-color: var(--lime); }
.hint { font-size: 0.78rem; color: var(--muted); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch-row { flex-direction: row; align-items: center; justify-content: space-between; color: var(--text); }
.switch-row input[type=checkbox] { width: 42px; height: 24px; appearance: none; background: rgba(255,255,255,0.12); border-radius: 999px; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.switch-row input[type=checkbox]::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: left 0.2s; }
.switch-row input[type=checkbox]:checked { background: linear-gradient(135deg, var(--lime), var(--violet)); }
.switch-row input[type=checkbox]:checked::after { left: 21px; }

.logo-row { display: flex; align-items: center; gap: 14px; }
.logo-prev { width: 70px; height: 70px; border-radius: 14px; border: 1px dashed var(--border); display: grid; place-items: center; background: repeating-conic-gradient(#1a1a26 0% 25%, #11111a 0% 50%) 50% / 16px 16px; overflow: hidden; flex-shrink: 0; }
.logo-prev span { font-size: 0.66rem; color: var(--muted); }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; }

.models { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.model-opt { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.model-opt:hover { background: rgba(255,255,255,0.03); }
.model-opt.sel { border-color: var(--lime); background: rgba(184,255,58,0.06); }
.model-opt input { margin-top: 4px; accent-color: var(--lime); }
.model-info { flex: 1; }
.model-name { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.model-tag { font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(124,92,255,0.18); color: #b8a3ff; }
.model-tag.rec { background: rgba(184,255,58,0.16); color: var(--lime); }
.model-note { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.model-price { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

.nets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.net { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 0.88rem; user-select: none; transition: border-color 0.15s, background 0.15s; }
.net.sel { border-color: var(--lime); background: rgba(184,255,58,0.08); }
.net .soon { font-size: 0.62rem; color: var(--amber); }

.cost-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(135deg, rgba(184,255,58,0.07), rgba(124,92,255,0.07)); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.cost-v { font-family: "Space Grotesk"; font-size: 1.7rem; font-weight: 700; color: var(--lime); }

.save-bar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; position: sticky; bottom: 0; padding: 14px 0; }
.save-bar .err { color: var(--green); }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; }
.seg-btn { font-family: inherit; font-size: 0.86rem; font-weight: 600; padding: 8px 16px; border-radius: 9px; border: none; background: transparent; color: var(--muted); cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg-btn.active { background: linear-gradient(135deg, rgba(184,255,58,0.18), rgba(124,92,255,0.18)); color: var(--text); }
.warn-box { background: rgba(255,206,77,0.09); border: 1px solid rgba(255,206,77,0.28); color: #ffd97a; padding: 12px 14px; border-radius: 12px; font-size: 0.84rem; line-height: 1.5; margin-bottom: 16px; }
.warn-box b { color: var(--amber); }

.ig-status { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid rgba(56,224,138,0.4); background: rgba(56,224,138,0.07); border-radius: 14px; }
.ig-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: rgba(255,255,255,0.08); flex-shrink: 0; }
.ig-info { flex: 1; }
.ig-name { font-size: 0.95rem; }
.ig-name b { color: var(--green); }

/* ===== galeria de postagens ===== */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.post-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.2s, border-color 0.2s; }
.post-card:hover { transform: translateY(-3px); border-color: rgba(184,255,58,0.3); }
.post-img { aspect-ratio: 16/10; background: repeating-conic-gradient(#15151f 0% 25%, #0f0f17 0% 50%) 50% / 22px 22px; display: grid; place-items: center; }
.post-img img { width: 100%; height: 100%; object-fit: cover; }
.post-img .ph { font-size: 2.4rem; opacity: 0.5; }
.post-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-cap { font-size: 0.9rem; white-space: pre-wrap; max-height: 160px; overflow: auto; line-height: 1.45; }
.post-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.post-tags span { font-size: 0.72rem; color: var(--violet); background: rgba(124,92,255,0.12); padding: 2px 8px; border-radius: 999px; }
.post-meta { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.post-nets { display: flex; flex-wrap: wrap; gap: 6px; }
.netpill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; padding: 3px 9px; border-radius: 999px; }
.netpill.published { background: rgba(56,224,138,0.14); color: var(--green); }
.netpill.pending_connection { background: rgba(255,206,77,0.12); color: var(--amber); }
.netpill.failed { background: rgba(255,92,108,0.12); color: var(--red); }
.netpill.skipped { background: rgba(255,255,255,0.06); color: var(--muted); }

/* ===== toast ===== */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #15151f; border: 1px solid var(--border); padding: 13px 20px; border-radius: 14px; font-size: 0.9rem; z-index: 100; box-shadow: 0 10px 40px rgba(0,0,0,0.5); max-width: 90vw; }
.toast.ok { border-color: rgba(56,224,138,0.5); }
.toast.bad { border-color: rgba(255,92,108,0.5); }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 8px; overflow-x: auto; min-width: 0; }
  .side-brand { display: none; }
  .menu { flex-direction: row; flex: 0 0 auto; }
  .side-foot { border: none; padding: 0; }
  .menu-item { white-space: nowrap; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cols, .cols-2, .row-2, .dash-main, .dash-low { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 50px; min-width: 0; }
  .topbar { padding: 16px; flex-wrap: wrap; }
  .chart { overflow-x: auto; }
  .chart .bar-col { min-width: 18px; }
  .bar-day { font-size: 0.56rem; }
  .gallery { grid-template-columns: 1fr; }
}
