/* Social Hub — Valrom. Fără build step, fără framework. */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e7ee;
  --text: #1a2230;
  --muted: #64708a;
  --primary: #0b5ea8;
  --primary-700: #094c88;
  --primary-50: #e8f1fb;
  --accent: #f28c28;
  --ok: #1f8f4e; --ok-50: #e6f5ec;
  --warn: #b7791f; --warn-50: #fdf3e0;
  --err: #c0392b; --err-50: #fbe9e7;
  --info: #2b6cb0; --info-50: #e7eefb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --sidebar-w: 240px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: .95rem; }
small, .muted { color: var(--muted); }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #0f2238; color: #cfd8e6; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 30; transition: transform .2s; }
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar h1 { flex: 1; font-size: 1.15rem; margin: 0; }
.topbar-actions { display: flex; gap: .5rem; }
#menuBtn { display: none; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.1rem; }
.brand strong { display: block; color: #fff; font-size: 1rem; }
.brand small { display: block; color: #8ea3bf; font-size: .75rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), #2b8fe0); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 8px; border-radius: 3px; background: #fff; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.login-card .brand { padding: 0 0 1rem; } .login-card .brand strong { color: var(--text); } .login-card .brand small { color: var(--muted); }
.nav { display: flex; flex-direction: column; padding: .25rem .6rem; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 8px; color: #cfd8e6; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.nav a.nav-cta { background: var(--primary); color: #fff; margin: .35rem 0; }
.nav a.nav-cta:hover { background: var(--primary-700); }
.nav .ico { width: 1.2rem; text-align: center; opacity: .8; font-size: .95rem; }
.nav-sep { height: 1px; background: rgba(255,255,255,.1); margin: .5rem .3rem; }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: .9rem 1rem; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.sidebar-foot .me { flex-basis: 100%; }
.sidebar-foot .me strong { color: #fff; display: block; font-size: .9rem; }
.sidebar-foot .me small { color: #8ea3bf; }
.sidebar-foot .btn-ghost { color: #cfd8e6; border-color: rgba(255,255,255,.15); }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.35); }
  .main { margin-left: 0; }
  #menuBtn { display: inline-flex; }
  .content { padding: 1rem; }
}

/* ---------- Componente ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: #cbd3de; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; } .btn-success:hover { background: #197a42; }
.btn-danger { background: var(--surface); border-color: #f0c2bc; color: var(--err); } .btn-danger:hover { background: var(--err-50); }
.btn-ghost { background: transparent; border-color: transparent; } .btn-ghost:hover { background: rgba(0,0,0,.05); }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-icon { width: 2.2rem; padding: .4rem; }
.btn-group { display: inline-flex; gap: .4rem; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.card-head h2, .card-head h3 { margin: 0; }
.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)); }
.grid-compose { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
@media (max-width: 1100px) { .grid-compose { grid-template-columns: 1fr; } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

label { display: block; font-weight: 500; margin-bottom: .75rem; }
label > input, label > select, label > textarea { margin-top: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font: inherit; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(11,94,168,.25); border-color: var(--primary); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.hint { font-size: .8rem; color: var(--muted); font-weight: 400; margin-top: .25rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.check input { width: auto; margin: 0; }
.form-error { background: var(--err-50); color: var(--err); padding: .6rem .8rem; border-radius: 8px; margin-bottom: .75rem; font-size: .9rem; }
.form-row { display: flex; gap: .75rem; flex-wrap: wrap; } .form-row > * { flex: 1; min-width: 160px; }
.counter { font-size: .78rem; color: var(--muted); text-align: right; margin-top: .2rem; }
.counter.over { color: var(--err); font-weight: 600; }

.badge { display: inline-flex; align-items: center; padding: .12rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); line-height: 1.5; }
.badge.draft { background: #eef1f5; color: #4a5568; }
.badge.pending_approval { background: var(--warn-50); color: var(--warn); border-color: #f2dcb0; }
.badge.approved, .badge.scheduled { background: var(--info-50); color: var(--info); border-color: #c5d6f2; }
.badge.publishing { background: var(--info-50); color: var(--info); }
.badge.published { background: var(--ok-50); color: var(--ok); border-color: #b9e2c9; }
.badge.partial { background: var(--warn-50); color: var(--warn); }
.badge.failed, .badge.rejected { background: var(--err-50); color: var(--err); border-color: #f0c2bc; }
.badge.pending { background: #eef1f5; color: #4a5568; }
.badge.count { background: var(--accent); color: #fff; border: 0; }

/* Pictograme platforme: pastile text (fără logo-uri) */
.pf { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; font-size: .68rem; font-weight: 700; color: #fff; letter-spacing: .02em; flex: none; }
.pf-sm { width: 18px; height: 18px; font-size: .58rem; border-radius: 4px; }
.pf.linkedin { background: #0a66c2; } .pf.facebook { background: #1877f2; } .pf.instagram { background: linear-gradient(135deg,#f58529,#dd2a7b,#8134af); } .pf.tiktok { background: #111; } .pf.whatsapp { background: #25d366; }
.pf-row { display: inline-flex; gap: 3px; vertical-align: middle; }

.chip { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .7rem .35rem .4rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 500; user-select: none; }
.chip:hover { border-color: #b9c6d8; }
.chip.on { background: var(--primary-50); border-color: var(--primary); color: var(--primary-700); }
.chip.disabled { opacity: .5; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: .9rem; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: .5rem .8rem; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); display: none; }
.tabs button.custom .dot { display: inline-block; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: .6rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.kpi .lbl { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .val { font-size: 1.6rem; font-weight: 700; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
.kpi.click { cursor: pointer; } .kpi.click:hover { border-color: var(--primary); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item.click { cursor: pointer; } .list-item.click:hover .title { color: var(--primary); }
.empty { color: var(--muted); padding: 1.5rem; text-align: center; }

.alert { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-warn { background: var(--warn-50); color: #7a5312; border-color: #f2dcb0; }
.alert-err { background: var(--err-50); color: var(--err); border-color: #f0c2bc; }
.alert-ok { background: var(--ok-50); color: #176437; border-color: #b9e2c9; }
.alert-info { background: var(--info-50); color: #1f4f8a; border-color: #c5d6f2; }

/* Media */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone.over { border-color: var(--primary); background: var(--primary-50); }
.media-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.media-thumb { position: relative; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; cursor: pointer; font-size: .8rem; line-height: 1; }
.media-thumb .kind { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: .65rem; padding: 1px 5px; border-radius: 4px; }
.media-thumb.uploading::after { content: "⏳"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.7); font-size: 1.4rem; }

/* Preview */
.preview { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.preview-head { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.preview-head .who strong { display: block; font-size: .9rem; } .preview-head .who small { font-size: .75rem; }
.preview-body { padding: .8rem .9rem; white-space: pre-wrap; word-wrap: break-word; font-size: .92rem; line-height: 1.5; max-height: 360px; overflow: auto; }
.preview-media { display: grid; gap: 2px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.preview-media img, .preview-media video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.preview.whatsapp .preview-body { background: #efe7dd; }
.preview.whatsapp .preview-body > div { background: #fff; border-radius: 8px; padding: .6rem .8rem; box-shadow: 0 1px 1px rgba(0,0,0,.08); }

/* Calendar */
.cal-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.cal-head h2 { flex: 1; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--border); border-top: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.cal .dow { padding: .4rem .5rem; font-size: .75rem; text-transform: uppercase; color: var(--muted); font-weight: 600; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal .day { min-height: 110px; padding: .3rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); cursor: pointer; }
.cal .day:hover { background: var(--surface-2); }
.cal .day.other { background: #fafbfc; color: #b0b8c6; }
.cal .day.today .dnum { background: var(--primary); color: #fff; }
.cal .dnum { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .8rem; font-weight: 600; margin-bottom: .2rem; }
.cal-post { display: flex; align-items: center; gap: .3rem; font-size: .75rem; padding: .2rem .35rem; border-radius: 5px; margin-bottom: 2px; background: var(--surface-2); border-left: 3px solid var(--muted); cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-post:hover { filter: brightness(.96); }
.cal-post.draft { border-left-color: #94a3b8; }
.cal-post.pending_approval { border-left-color: var(--warn); background: var(--warn-50); }
.cal-post.scheduled, .cal-post.approved, .cal-post.publishing { border-left-color: var(--info); background: var(--info-50); }
.cal-post.published { border-left-color: var(--ok); background: var(--ok-50); }
.cal-post.partial { border-left-color: var(--warn); background: var(--warn-50); }
.cal-post.failed, .cal-post.rejected { border-left-color: var(--err); background: var(--err-50); }
.cal-post .t { overflow: hidden; text-overflow: ellipsis; }
.cal-post .hh { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .cal .day { min-height: 70px; } .cal-post .t { display: none; } }

/* Bars (statistici) */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: .5rem; }
.bars .bar { flex: 1; background: var(--primary); border-radius: 3px 3px 0 0; min-width: 4px; position: relative; opacity: .85; }
.bars .bar:hover { opacity: 1; }
.bars .bar[title]:hover::after { content: attr(title); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #1a2230; color: #fff; font-size: .7rem; padding: 2px 6px; border-radius: 4px; white-space: nowrap; margin-bottom: 4px; }
.hbar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar > i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }

/* Modal & toasts */
.modal-bg { position: fixed; inset: 0; background: rgba(15,34,56,.5); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1.25rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 60; }
.toast { background: #1a2230; color: #fff; padding: .6rem .9rem; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; animation: fade .2s; }
.toast.err { background: var(--err); } .toast.ok { background: var(--ok); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.loading { color: var(--muted); padding: 2rem; text-align: center; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 1rem; }

/* Target status list (post detail) */
.target-row { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.target-row:last-child { border-bottom: 0; }
.target-row .grow { flex: 1; min-width: 0; }
.target-row .err { color: var(--err); font-size: .82rem; }
.activity { font-size: .85rem; }
.activity li { padding: .3rem 0; border-bottom: 1px dashed var(--border); list-style: none; }
.activity ul { padding: 0; margin: 0; }
.stats-mini { display: flex; gap: .75rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.stats-mini b { color: var(--text); }
.ai-box { background: var(--primary-50); border: 1px solid #c9dcf3; border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; }
.ai-box h3 { color: var(--primary-700); }
.ideas li { margin-bottom: .5rem; cursor: pointer; padding: .4rem .6rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); list-style: none; }
.ideas li:hover { border-color: var(--primary); }
.ideas ul { padding: 0; margin: .5rem 0 0; }
.secret-row { display: flex; gap: .5rem; align-items: center; }
.secret-row input { flex: 1; }
