/* ============================================================
   kit.css — linguaggio visivo comune di Azione Diretta
   Usato da: landing-factory, autoadv, media-factory, competitor-radar.
   Sorgente unica: comune/kit.css → copiato nei progetti da comune/sync.sh.
   NON modificare le copie dentro i progetti: si perde l'allineamento.
   ============================================================ */

:root {
  /* superfici */
  --bg: #0e1116;
  --panel: #161b22;
  --panel2: #1c232d;
  --panel3: #232c38;
  --line: #2a323d;
  --line2: #384454;

  /* testo */
  --ink: #e6edf3;
  --mut: #8b98a8;
  --mut2: #647084;

  /* accenti */
  --accent: #4c8dff;
  --accent2: #6ee7b7;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --viola: #a371f7;
  --rosa: #f778ba;

  /* forma */
  --radius: 14px;
  --radius-s: 10px;
  --radius-xs: 7px;
  --ombra: 0 8px 30px rgba(0, 0, 0, .35);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
h1 { font-size: 1.75rem; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 1.25rem; letter-spacing: -.01em; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
small { font-size: .82rem; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; }

/* ---------- utilità ---------- */
.muted { color: var(--mut); }
.muted2 { color: var(--mut2); }
.err-text { color: var(--err); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.row.tight { gap: .4rem; }
.col { display: flex; flex-direction: column; gap: .7rem; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 1rem; } .mt2 { margin-top: 2rem; }
.mb { margin-bottom: 1rem; } .mb2 { margin-bottom: 2rem; }
.wrap-scroll { overflow-x: auto; }

/* ---------- marchio ---------- */
.brand { font-size: 1.1rem; font-weight: 500; letter-spacing: -.01em; display: flex; align-items: center; gap: .55rem; }
.brand b { font-weight: 800; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 0 12px var(--accent); }
.dot.viola { background: linear-gradient(135deg, var(--viola), var(--rosa)); box-shadow: 0 0 12px var(--viola); }
.dot.verde { background: linear-gradient(135deg, var(--accent2), var(--ok)); box-shadow: 0 0 12px var(--accent2); }

/* ---------- struttura ---------- */
.topbar { display: flex; align-items: center; gap: 1.2rem; padding: .8rem 1.5rem;
  border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 40; }
.mainnav { display: flex; gap: .25rem; }
.navbtn { border: 0; background: transparent; color: var(--mut); padding: .5rem .85rem;
  border-radius: var(--radius-xs); font-weight: 600; font-size: .9rem; }
.navbtn:hover { color: var(--ink); background: var(--panel2); }
.navbtn.active { background: var(--panel2); color: var(--ink); }
.user { margin-left: auto; display: flex; align-items: center; gap: .9rem; color: var(--mut); font-size: .86rem; }
main { max-width: 1240px; margin: 0 auto; padding: 1.8rem 1.5rem 5rem; }
main.wide { max-width: 1600px; }
.page-head { display: flex; align-items: flex-end; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head p { color: var(--mut); max-width: 75ch; }

/* ---------- pannelli e schede ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.card.pad2 { padding: 1.8rem; }
.card.flat { background: var(--panel2); }
.card-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }
.card-head h2, .card-head h3 { margin-right: auto; }
.grid { display: grid; gap: 1rem; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.split { display: grid; grid-template-columns: 1fr 380px; gap: 1.2rem; align-items: start; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }

/* ---------- pulsanti ---------- */
.btn { border: 1px solid var(--line2); background: var(--panel2); color: var(--ink);
  padding: .58rem 1rem; border-radius: var(--radius-s); font-weight: 600; font-size: .9rem;
  transition: .14s; display: inline-flex; align-items: center; gap: .45rem; justify-content: center; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #06210d; }
.btn.danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn.danger:hover:not(:disabled) { background: var(--err); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: .38rem .7rem; font-size: .82rem; border-radius: var(--radius-xs); }
.btn.big { padding: .8rem 1.4rem; font-size: 1rem; }
.btn.block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-s) 0 0 var(--radius-s); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-s) var(--radius-s) 0; }

/* ---------- moduli ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .84rem; color: var(--mut); }
label.inline { flex-direction: row; align-items: center; gap: .5rem; color: var(--ink); font-size: .9rem; }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=search], select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: .62rem .75rem; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--mut2); }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
input[type=range] { accent-color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 1rem; }
legend { padding: 0 .4rem; color: var(--mut); font-size: .84rem; }
.form-err { color: var(--err); font-size: .86rem; min-height: 1.2em; }
.field-hint { color: var(--mut2); font-size: .78rem; }

/* ---------- etichette di stato ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem;
  border-radius: 999px; font-size: .75rem; font-weight: 700; border: 1px solid transparent;
  background: var(--panel3); color: var(--mut); white-space: nowrap; }
.badge.ok { background: rgba(63, 185, 80, .14); color: var(--ok); border-color: rgba(63, 185, 80, .3); }
.badge.warn { background: rgba(210, 153, 34, .14); color: var(--warn); border-color: rgba(210, 153, 34, .3); }
.badge.err { background: rgba(248, 81, 73, .14); color: var(--err); border-color: rgba(248, 81, 73, .3); }
.badge.info { background: rgba(76, 141, 255, .14); color: var(--accent); border-color: rgba(76, 141, 255, .3); }
.badge.viola { background: rgba(163, 113, 247, .14); color: var(--viola); border-color: rgba(163, 113, 247, .3); }
.badge.neutro { background: var(--panel3); color: var(--mut); border-color: var(--line2); }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }

/* ---------- tabelle ---------- */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--mut); font-weight: 600; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .04em; padding: .55rem .7rem; border-bottom: 1px solid var(--line); }
td { padding: .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--panel2); }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- schede a linguette ---------- */
.tabs { display: flex; gap: .25rem; background: var(--bg); padding: .28rem; border-radius: var(--radius-s);
  border: 1px solid var(--line); }
.tab { flex: 1; border: 0; background: transparent; color: var(--mut); padding: .5rem .8rem;
  border-radius: var(--radius-xs); font-weight: 600; font-size: .88rem; }
.tab.active { background: var(--panel2); color: var(--ink); }

/* ---------- stato vuoto ---------- */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--mut); }
.empty .icona { font-size: 2.2rem; display: block; margin-bottom: .6rem; opacity: .8; }
.empty h3 { color: var(--ink); margin-bottom: .35rem; }
.empty p { max-width: 46ch; margin: 0 auto .9rem; font-size: .92rem; }

/* ---------- avvisi ---------- */
.toasts { position: fixed; right: 1.2rem; bottom: 1.2rem; display: flex; flex-direction: column;
  gap: .5rem; z-index: 100; }
.toast { background: var(--panel3); border: 1px solid var(--line2); border-left: 3px solid var(--accent);
  border-radius: var(--radius-s); padding: .7rem .9rem; box-shadow: var(--ombra); font-size: .9rem;
  max-width: 380px; animation: entra .18s ease-out; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
@keyframes entra { from { opacity: 0; transform: translateY(6px) } }

/* ---------- finestra modale ---------- */
.modale { position: fixed; inset: 0; background: rgba(3, 6, 10, .72); display: grid; place-items: center;
  z-index: 90; padding: 1.5rem; animation: entra .15s ease-out; }
.modale-box { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius);
  box-shadow: var(--ombra); width: min(680px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.modale-box.large { width: min(1080px, 100%); }
.modale-head { display: flex; align-items: center; gap: .8rem; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); }
.modale-head h2 { margin-right: auto; }
.modale-body { padding: 1.3rem; overflow-y: auto; }
.modale-foot { display: flex; gap: .6rem; justify-content: flex-end; padding: 1rem 1.3rem; border-top: 1px solid var(--line); }
.chiudi { border: 0; background: transparent; color: var(--mut); font-size: 1.3rem; line-height: 1; padding: .2rem .4rem; }
.chiudi:hover { color: var(--ink); }

/* ---------- avanzamento ---------- */
.progress { height: 6px; background: var(--panel3); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 999px; transition: width .3s; }
.spinner { width: 15px; height: 15px; border: 2px solid var(--line2); border-top-color: var(--accent);
  border-radius: 50%; animation: gira .7s linear infinite; display: inline-block; flex: none; }
@keyframes gira { to { transform: rotate(360deg) } }

/* ---------- numeri in evidenza ---------- */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat .etichetta { color: var(--mut); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .valore { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; margin-top: .25rem;
  font-variant-numeric: tabular-nums; }
.stat .sotto { color: var(--mut2); font-size: .8rem; margin-top: .15rem; }

/* ---------- media ---------- */
.media-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.media-tile { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-s);
  overflow: hidden; position: relative; aspect-ratio: 1; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile.v916 { aspect-ratio: 9/16; }
.media-tile .sopra { position: absolute; inset: auto 0 0 0; padding: .4rem .5rem; font-size: .74rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8)); }
.media-tile.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(76, 141, 255, .35); }

/* ---------- calendario ---------- */
.cal-anno { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; }
.cal-mese { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.cal-mese h3 { font-size: .9rem; margin-bottom: .5rem; display: flex; justify-content: space-between; }
.cal-griglia { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-g { aspect-ratio: 1; border-radius: 4px; background: var(--panel2); font-size: .62rem;
  display: grid; place-items: center; color: var(--mut2); position: relative; }
.cal-g.ha { background: var(--panel3); color: var(--ink); cursor: pointer; font-weight: 700; }
.cal-g.ha:hover { outline: 1px solid var(--accent); }
.cal-g.oggi { outline: 1px solid var(--accent2); }
.cal-g i { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

.cal-settimana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.cal-giorno { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-s);
  min-height: 150px; padding: .5rem; display: flex; flex-direction: column; gap: .35rem; }
.cal-giorno.drop { border-color: var(--accent); background: var(--panel2); }
.cal-giorno > .data { font-size: .75rem; color: var(--mut); font-weight: 700; }

.uscita { background: var(--panel2); border: 1px solid var(--line2); border-left-width: 3px;
  border-radius: var(--radius-xs); padding: .4rem .5rem; font-size: .78rem; cursor: grab; }
.uscita:hover { border-color: var(--accent); }
.uscita.dragging { opacity: .4; }
.uscita .t { font-weight: 600; display: block; line-height: 1.3; }
.uscita .m { color: var(--mut); font-size: .72rem; display: flex; gap: .3rem; align-items: center; margin-top: .2rem; }
.uscita[data-canale=instagram] { border-left-color: var(--rosa); }
.uscita[data-canale=facebook] { border-left-color: var(--accent); }
.uscita[data-canale=tiktok] { border-left-color: var(--accent2); }
.uscita[data-canale=linkedin] { border-left-color: #58a6ff; }
.uscita[data-stato=pubblicata] { opacity: .62; }

/* ---------- accesso ---------- */
.auth { min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 70% -10%, #1b2740 0%, var(--bg) 60%); }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 2.2rem; width: min(400px, 92vw); }
.auth-card .tag { color: var(--mut); font-size: .9rem; margin: .4rem 0 1.4rem; }

/* ---------- elenco log ---------- */
.log { background: #0a0d12; border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: .8rem; max-height: 320px; overflow: auto; font-family: ui-monospace, Menlo, monospace;
  font-size: .78rem; line-height: 1.6; color: var(--mut); white-space: pre-wrap; word-break: break-word; }

/* ---------- guide di pagina ---------- */
.guida { background: linear-gradient(180deg, rgba(76,141,255,.10), rgba(76,141,255,.03));
  border: 1px solid rgba(76,141,255,.28); border-radius: var(--radius);
  padding: .9rem 1.1rem; margin-bottom: 1.2rem; }
.guida-testa { display: flex; align-items: center; gap: .55rem; margin-bottom: .4rem; }
.guida-testa b { flex: 1; font-size: .95rem; }
.guida-icona { width: 20px; height: 20px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: .74rem; font-weight: 700; flex: none; }
.guida-chiudi { border: 0; background: transparent; color: var(--mut); font-size: 1.2rem;
  line-height: 1; padding: 0 .25rem; }
.guida-chiudi:hover { color: var(--ink); }
.guida p { font-size: .87rem; color: var(--mut); line-height: 1.55; max-width: 90ch; }
.guida-passi { margin: .5rem 0 0 1.1rem; font-size: .86rem; line-height: 1.7; color: var(--mut); }
.guida-passi li { padding-left: .2rem; }
.guida-passi b, .guida p b { color: var(--ink); font-weight: 600; }
.guida-nota { margin-top: .6rem; padding: .5rem .7rem; background: rgba(210,153,34,.1);
  border-left: 3px solid var(--warn); border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-size: .82rem; color: var(--ink); }
.btn-guide { border: 0; background: transparent; color: var(--mut); font-size: 1rem;
  width: 26px; height: 26px; border-radius: 50%; }
.btn-guide:hover { background: var(--panel2); color: var(--ink); }
