/* ============================================================
   LazyPost — design system (dark-first SaaS)
   Fonte: Plus Jakarta Sans · Ícones: SVG · Micro-interações
   ============================================================ */
:root {
  /* superfícies (elevação consistente) */
  --bg:        #0a0c12;
  --surface-1: #12151d;
  --surface-2: #181c26;
  --surface-3: #1f2431;
  --border:    #262c3a;
  --border-soft: #1d222e;
  /* texto */
  --text:      #eef1f6;
  --text-2:    #aeb6c4;
  --text-3:    #6b7486;
  /* marca */
  --accent:    #5b8dff;
  --accent-hover: #6f9bff;
  --accent-soft: rgba(91,141,255,.14);
  --accent-2:  #a78bfa;
  --grad: linear-gradient(135deg, #5b8dff, #a78bfa);
  /* semânticos */
  --ok:   #34d399;
  --ok-soft: rgba(52,211,153,.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251,191,36,.14);
  --err:  #f87171;
  --err-soft: rgba(248,113,113,.14);
  /* tokens */
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3);
  --shadow-2: 0 8px 24px rgba(0,0,0,.35);
  --shadow-pop: 0 16px 48px rgba(0,0,0,.5);
  --ring: 0 0 0 3px var(--accent-soft);
  --ease: cubic-bezier(.4,0,.2,1);
  --t: 170ms var(--ease);
  --sidebar-w: 244px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.55; letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- ícones ---------- */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ico.xl { width: 40px; height: 40px; stroke-width: 1.6; }
.ico.accent { color: var(--accent); }
.brand-ico { width: 18px; height: 18px; fill: currentColor; stroke: none; flex: none; }

/* ---------- shell ---------- */
#app-shell { display: flex; min-height: 100dvh; }

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface-1);
  border-right: 1px solid var(--border-soft); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh; z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px;
  font-size: 19px; font-weight: 800; letter-spacing: -.02em;
}
.logo-mark { font-size: 22px; filter: saturate(1.1); }
.logo-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
#nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); padding: 14px 12px 6px; }
#nav button {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: transparent; color: var(--text-2); border: 0; cursor: pointer;
  padding: 9px 12px; border-radius: 10px; font: inherit; font-weight: 500; font-size: 14.5px;
  transition: background var(--t), color var(--t); position: relative;
}
#nav button .ico { width: 18px; height: 18px; }
#nav button span { flex: 1; }
#nav button .step { font-size: 11px; font-weight: 700; color: var(--text-3);
  background: var(--surface-3); width: 18px; height: 18px; border-radius: 6px;
  display: grid; place-items: center; font-style: normal; }
#nav button:hover { background: var(--surface-2); color: var(--text); }
#nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#nav button.active .step { background: var(--accent); color: #fff; }
#nav button.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar-foot { padding: 14px 20px; font-size: 12.5px; color: var(--text-3);
  border-top: 1px solid var(--border-soft); display: flex; align-items: center; gap: 8px; }
.dot-ok { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.sidebar-scrim { display: none; }

/* ---------- área principal ---------- */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; background: rgba(10,12,18,.8); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-title { font-size: 19px; font-weight: 700; letter-spacing: -.02em; flex: 1; }
.userbox { display: flex; align-items: center; gap: 8px; }
.whoami { color: var(--text-2); font-size: 13.5px; font-weight: 500; margin-right: 4px; }
.menu-toggle { display: none; }
main { padding: 28px; max-width: 1160px; width: 100%; }

/* ---------- tipografia ---------- */
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; margin: 22px 0 12px;
  display: flex; align-items: center; gap: 8px; }
h2 .ico { width: 18px; height: 18px; }
h3 { font-size: 14px; font-weight: 600; margin: 16px 0 9px; }
h3 small, .sub small { color: var(--text-3); font-weight: 400; }
.sub { color: var(--text-2); margin-bottom: 20px; font-size: 14px; max-width: 70ch; }
b { font-weight: 700; color: var(--text); }
.view { animation: fade .22s var(--ease); }
.view.hidden { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */
.card {
  background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-1);
}
.card.soft { background: linear-gradient(180deg, var(--surface-2), var(--surface-1)); }

/* ---------- inputs ---------- */
input, select, textarea {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; font-size: 14px; min-width: 0;
  transition: border-color var(--t), box-shadow var(--t);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
textarea { width: 100%; resize: vertical; line-height: 1.5; }
select { cursor: pointer; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row input:not([type]), .row input[type=text] { flex: 1; }
label { display: block; margin-bottom: 12px; color: var(--text-2); font-size: 13px; font-weight: 500; }
label input, label select, label textarea { width: 100%; margin-top: 5px; }

/* ---------- switch (toggle bonito) ---------- */
.switch { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 500;
  cursor: pointer; user-select: none; margin-bottom: 10px; }
.switch input { display: none; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3);
  border: 1px solid var(--border); position: relative; transition: background var(--t); flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--text-2); transition: transform var(--t), background var(--t); }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.warn-pill { font-size: 11px; font-weight: 600; color: var(--warn); background: var(--warn-soft);
  padding: 2px 8px; border-radius: 999px; }

/* ---------- botões ---------- */
.btn-primary, .primary {
  display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: #fff;
  border: 0; border-radius: var(--radius-sm); padding: 10px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background var(--t), transform var(--t), box-shadow var(--t);
  box-shadow: 0 1px 2px rgba(0,0,0,.2); font-family: inherit;
}
.btn-primary:hover, .primary:hover { background: var(--accent-hover); box-shadow: 0 4px 14px rgba(91,141,255,.3); }
.btn-primary:active, .primary:active { transform: scale(.97); }
.btn-primary .ico { width: 17px; height: 17px; }
.btn-primary.big, .primary.big { width: 100%; justify-content: center; padding: 13px; font-size: 15px; margin-top: 14px; }
.btn-ghost, .ghost, .icon-btn {
  display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-2); border-radius: var(--radius-sm);
  padding: 9px 13px; font-size: 13.5px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: background var(--t), color var(--t), border-color var(--t); text-decoration: none;
}
.btn-ghost:hover, .ghost:hover, .icon-btn:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost:active, .ghost:active, .icon-btn:active { transform: scale(.97); }
.icon-btn { padding: 8px 11px; }
.icon-btn .ico { width: 17px; height: 17px; }
.danger {
  display: inline-flex; align-items: center; gap: 6px; background: var(--err-soft); border: 1px solid transparent;
  color: var(--err); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background var(--t); }
.danger:hover { background: rgba(248,113,113,.22); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { color: var(--accent); cursor: pointer; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 18px 0 8px; }
.stat { background: var(--surface-1); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 16px 18px; transition: border-color var(--t), transform var(--t); }
.stat:hover { border-color: var(--border); transform: translateY(-2px); }
.stat .n { font-size: 28px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--text); }
.stat.ok .n { color: var(--ok); } .stat.err .n { color: var(--err); } .stat.accent .n { color: var(--accent); }
.stat .l { color: var(--text-3); font-size: 13px; font-weight: 500; margin-top: 2px; }

/* ---------- listas / itens ---------- */
.list { display: flex; flex-direction: column; gap: 9px; }
.post-item {
  display: flex; align-items: center; gap: 12px; background: var(--surface-1);
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px 15px;
  transition: border-color var(--t); font-size: 14px;
}
.post-item:hover { border-color: var(--border); }
.post-item .when { font-weight: 700; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.post-item .cap { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-item b { font-weight: 600; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-3);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12px;
  font-weight: 600; color: var(--text-2); }
.badge .brand-ico { width: 13px; height: 13px; }
.badge.st-published { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.st-scheduled { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge.st-publishing { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.st-failed, .badge.st-canceled { color: var(--err); background: var(--err-soft); border-color: transparent; }

/* ---------- form grid / checks ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 5px; }
.checks label {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; cursor: pointer;
  color: var(--text-2); margin: 0; font-size: 13px; font-weight: 500; transition: all var(--t);
}
.checks label .brand-ico { width: 14px; height: 14px; }
.checks label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.checks input { display: none; }

/* ---------- grid de mídia ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 11px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: 280px; overflow-y: auto; padding: 3px; }
.thumb { position: relative; background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; aspect-ratio: 1; transition: outline var(--t), transform var(--t); outline: 2px solid transparent; }
.thumb:hover { transform: translateY(-2px); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .name { position: absolute; bottom: 0; left: 0; right: 0; font-size: 10.5px; padding: 4px 7px;
  background: linear-gradient(transparent, rgba(0,0,0,.8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .del { position: absolute; top: 5px; right: 5px; background: rgba(0,0,0,.65); border: 0; color: #fff;
  border-radius: 6px; width: 24px; height: 24px; display: none; cursor: pointer; font-size: 14px; }
.thumb:hover .del { display: block; }
.thumb.selected { outline-color: var(--accent); }
.thumb .ord { position: absolute; top: 5px; left: 5px; background: var(--accent); color: #fff;
  border-radius: 50%; width: 21px; height: 21px; font-size: 11px; display: flex; align-items: center;
  justify-content: center; font-weight: 700; }

/* ---------- dropzone ---------- */
#dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 38px; text-align: center;
  color: var(--text-3); transition: all var(--t); display: flex; flex-direction: column; align-items: center; gap: 12px; }
#dropzone .ico { color: var(--text-3); }
#dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
#dropzone.drag .ico { color: var(--accent); }

/* ---------- carrossel strip ---------- */
.carousel-strip { display: flex; gap: 9px; flex-wrap: wrap; min-height: 78px; padding: 10px;
  background: var(--surface-2); border-radius: var(--radius-sm); border: 1px dashed var(--border); }
.carousel-strip .thumb { width: 64px; height: 64px; flex: none; }
.carousel-strip:empty::after { content: 'Nenhuma mídia — clique na biblioteca abaixo'; color: var(--text-3);
  align-self: center; margin: auto; font-size: 13px; }
.thumb.dragging { opacity: .4; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--surface-1); padding: 5px;
  border-radius: 11px; border: 1px solid var(--border-soft); width: fit-content; }
.tab { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; color: var(--text-2);
  padding: 8px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all var(--t); font-family: inherit; }
.tab .ico { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; background: var(--accent); }

/* ---------- logs / banner ---------- */
.banner-safe { display: flex; align-items: flex-start; gap: 10px; background: var(--ok-soft);
  border: 1px solid rgba(52,211,153,.25); border-radius: var(--radius-sm); padding: 12px 15px;
  font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.banner-safe .ico { color: var(--ok); flex: none; margin-top: 1px; }
.banner-safe b { color: var(--ok); }
.logbox { background: #070910; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 14px; height: 320px; overflow-y: auto; font-family: 'SF Mono', ui-monospace, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6; }
.logline { padding: 2px 0; }
.logline .t { color: var(--text-3); margin-right: 10px; font-variant-numeric: tabular-nums; }
.logline.warn { color: var(--warn); } .logline.error { color: var(--err); } .logline.success { color: var(--ok); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--err); }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* ---------- calendário ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin-top: 16px; }
.cal-head { text-align: center; color: var(--text-3); font-size: 12px; font-weight: 600; padding: 4px; }
.cal-day { min-height: 94px; background: var(--surface-1); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 7px; font-size: 11.5px; transition: border-color var(--t); }
.cal-day:hover { border-color: var(--border); }
.cal-day.other { opacity: .3; }
.cal-day.today { border-color: var(--accent); background: var(--accent-soft); }
.cal-day .d { color: var(--text-2); font-weight: 700; margin-bottom: 3px; }
.cal-post { margin-top: 3px; padding: 3px 6px; border-radius: 6px; background: var(--accent-soft);
  border-left: 3px solid var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.cal-post.published { border-left-color: var(--ok); background: var(--ok-soft); }
.cal-post.failed { border-left-color: var(--err); background: var(--err-soft); }
.cal-nav { justify-content: center; margin-bottom: 8px; gap: 16px; }
.cal-nav b { font-size: 16px; font-weight: 700; min-width: 180px; text-align: center; text-transform: capitalize; }
.cal-nav .icon-btn { font-size: 20px; padding: 4px 14px; line-height: 1; }

/* ---------- perfis / contas ---------- */
.profile-card { margin-bottom: 14px; }
.acc-line { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid var(--border-soft); font-size: 14px; }
.acc-line .plat { min-width: 140px; display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.acc-line .plat .brand-ico { width: 16px; height: 16px; }
.acc-line .st-ok { color: var(--ok); font-size: 13px; } .acc-line .st-error { color: var(--err); font-size: 13px; }
.acc-form { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; margin-top: 12px; }
.cap-card { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-top: 9px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; }
.cap-card .row { margin-top: 10px; }

/* ---------- barras (relatórios) ---------- */
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.bar-label { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 18px; background: var(--grad); border-radius: 5px; min-width: 3px; transition: width .4s var(--ease); }

/* ---------- textos de status ---------- */
.ok-text { color: var(--ok); margin-top: 10px; font-size: 13.5px; font-weight: 500; }
.warn-text { color: var(--warn); margin-top: 10px; white-space: pre-wrap; font-size: 13.5px; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text); border-radius: 12px;
  padding: 13px 22px; opacity: 0; pointer-events: none; transition: all .28s var(--ease);
  max-width: 80vw; z-index: 99; box-shadow: var(--shadow-pop); font-size: 14px; font-weight: 500; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--err); }

/* ---------- overlays (login / segurança) ---------- */
#auth-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 25%, #141a2e, var(--bg)); padding: 20px; }
#sec-overlay { position: fixed; inset: 0; z-index: 210; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px); padding: 20px; }
.auth-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 18px;
  padding: 34px; width: 360px; max-width: 100%; box-shadow: var(--shadow-pop);
  animation: pop .25s var(--ease); }
#sec-overlay .auth-card { max-height: 90vh; overflow-y: auto; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.auth-brand { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 8px; display: flex;
  align-items: center; justify-content: center; gap: 8px; }
.auth-brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth-card h2 { justify-content: center; margin: 6px 0; }
.auth-card .sub { text-align: center; margin-bottom: 18px; }
.auth-card input { width: 100%; margin-bottom: 12px; }
#sec-body input { width: 100%; margin: 8px 0; }
#sec-body code { background: var(--surface-2); padding: 3px 7px; border-radius: 6px; font-size: 12.5px; color: var(--accent-2); }

/* ---------- utilidades ---------- */
.hidden { display: none !important; }

/* ---------- responsivo ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .28s var(--ease); box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: none; }
  .sidebar-scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 39; }
  .menu-toggle { display: inline-flex; }
  main { padding: 20px 16px; }
  .topbar { padding: 12px 16px; }
  .hide-sm { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .calendar { gap: 3px; }
  .cal-day { min-height: 66px; font-size: 10px; padding: 4px; }
}
@media (max-width: 480px) {
  h1, .topbar-title { font-size: 18px; }
  .whoami { display: none; }
}
