/* ===== PED Positano — Mobile-first design system ===== */
:root {
  --blu: #5B8DB8;
  --blu-d: #2E6DA4;
  --blu-l: #D6E4F0;
  --rosso: #C0392B;
  --accent: #FF6B35;
  --accent-d: #E54E1B;
  --accent-l: #FF8C5A;
  --gold: #FF6B35;  /* legacy alias */
  --dark: #1a2430;
  --light: #F4F7FA;
  --white: #FFFFFF;
  --muted: #94a3b8;
  --border: #e5eaf0;
  --green: #10B981;
  --orange: #F59E0B;
  --red: #EF4444;
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);
  --bottom-nav-h: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--light);
  color: var(--dark);
  overscroll-behavior-y: none;  /* niente pull-to-refresh accidentale */
  -webkit-text-size-adjust: 100%;
}
body { min-height: 100dvh; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit;
  font-size: 16px;   /* min 16px → niente zoom auto iOS */
}
a { color: var(--blu-d); }

.hidden { display: none !important; }

/* ===== Login ===== */
.login-bg {
  min-height: 100dvh;
  background: linear-gradient(150deg, var(--blu-d) 0%, var(--blu) 60%, #3a7bd5 100%);
  display: flex; align-items: center; justify-content: center;
  padding: max(20px, var(--sat)) 20px max(20px, var(--sab));
}
.login-card {
  background: var(--white); border-radius: 20px;
  padding: 28px 22px; width: 100%; max-width: 380px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.2);
}
.login-card h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.55rem; font-weight: 700; color: var(--blu-d);
  margin: 0; line-height: 1.2; text-align: center;
}
.login-card .sub {
  font-size: 0.62rem; color: var(--muted); margin: 4px 0 22px;
  letter-spacing: 0.1em; text-transform: uppercase; text-align: center;
}
.tabs-login {
  display: flex; gap: 0; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.tabs-login button {
  flex: 1; padding: 12px; border: none; background: transparent;
  font-size: 0.85rem; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; min-height: 44px;
}
.tabs-login button.active {
  color: var(--blu-d); border-bottom-color: var(--blu-d);
}

.fg { margin-bottom: 14px; }
.fg label {
  display: block; font-size: 0.64rem; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.in, input[type=text], input[type=password], input[type=email],
input[type=date], input[type=color], select, textarea {
  width: 100%; padding: 12px 14px; min-height: 44px;
  border: 1.5px solid #dde3ea; border-radius: 10px;
  font-size: 16px; color: var(--dark);
  background: #fafaf8; outline: none;
  -webkit-appearance: none; appearance: none;
}
.in:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--blu);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }

.btn { width: 100%; padding: 14px; border: none; border-radius: 12px;
  font-size: 0.92rem; font-weight: 600; cursor: pointer; letter-spacing: 0.02em;
  min-height: 48px; }
.btn-primary { background: var(--blu-d); color: var(--white); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; }
.btn-danger {
  background: transparent; color: var(--red);
  border: 1.5px solid var(--red);
}
.btn-secondary {
  background: var(--light); color: #6b7280;
  border: 1.5px solid var(--border);
}
.btn-ai {
  background: linear-gradient(135deg, #8B5CF6, #5B8DB8);
  color: var(--white); display: flex; align-items: center; justify-content: center; gap: 6px;
}
.err { color: var(--rosso); font-size: 0.78rem; margin: 6px 0 8px; }
.ok  { color: var(--green); font-size: 0.78rem; margin: 6px 0 8px; }

/* ===== App layout (mobile-first) ===== */
.app {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--light);
}
.header {
  background: var(--blu-d); color: var(--white);
  padding: calc(max(8px, var(--sat))) 14px 10px;
  flex-shrink: 0; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-row {
  display: flex; align-items: center; gap: 10px;
}
.header h1 {
  margin: 0; font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem; font-weight: 700; line-height: 1.1;
}
.header .who {
  font-size: 0.62rem; opacity: 0.75; margin-top: 1px;
}
.icon-btn {
  background: rgba(255,255,255,0.18); border: none; color: var(--white);
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 1.05rem; display: flex; align-items: center; justify-content: center;
  position: relative; flex-shrink: 0;
}
.icon-btn .badge {
  position: absolute; top: 0; right: 0;
  background: var(--rosso); color: var(--white);
  border-radius: 50%; min-width: 16px; height: 16px; padding: 0 3px;
  font-size: 0.55rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--blu-d);
}
.month-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
}
.month-nav button {
  background: rgba(255,255,255,0.15); border: none; color: var(--white);
  width: 40px; height: 40px; border-radius: 50%; font-size: 1.3rem;
}
.month-nav .month {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.2rem; font-weight: 600;
}

/* Filtri orizzontali scrollabili */
.filters {
  background: var(--white); padding: 10px 12px;
  overflow-x: auto; border-bottom: 1px solid var(--border);
  display: flex; gap: 6px; align-items: center;
  flex-shrink: 0; scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 12px; border-radius: 22px; min-height: 32px;
  border: 1.5px solid var(--border); background: var(--white);
  color: #6b7280; font-size: 0.74rem; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.chip .dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.sep { width: 1px; height: 20px; background: #e0e7ef; flex-shrink: 0; }
.chip-add {
  padding: 7px 12px; border-radius: 22px; min-height: 32px;
  border: 1.5px dashed #c0cad6; background: transparent;
  color: var(--muted); font-size: 0.72rem; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}

/* Content area */
.content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--bottom-nav-h) + var(--sab) + 12px);
}

/* ===== Bottom nav (mobile) ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white);
  padding: 6px 8px calc(6px + var(--sab));
  border-top: 1px solid var(--border);
  display: flex; gap: 4px;
  z-index: 90;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.bnav-item {
  flex: 1; background: transparent; border: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border-radius: 10px;
  color: var(--muted); font-size: 0.62rem; font-weight: 600;
  min-height: 52px; position: relative;
}
.bnav-item .ico {
  font-size: 1.3rem; line-height: 1;
}
.bnav-item.active {
  color: var(--blu-d); background: rgba(46,109,164,0.08);
}
.bnav-item .badge {
  position: absolute; top: 4px; right: 18%;
  background: var(--rosso); color: var(--white);
  border-radius: 50%; min-width: 16px; height: 16px; padding: 0 3px;
  font-size: 0.55rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ===== Calendario ===== */
.cal-wrap { padding: 10px 6px; }
.cal-dow {
  display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; margin-bottom: 4px;
}
.cal-dow div {
  text-align: center; font-size: 0.62rem; font-weight: 600;
  color: var(--muted); padding: 4px 0;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7,1fr); gap: 3px;
}
.cal-cell {
  min-height: 78px; background: var(--white); border-radius: 8px;
  padding: 4px; border: 1.5px solid transparent;
  overflow: hidden;
}
.cal-cell.cur { cursor: pointer; }
.cal-cell.other { background: #f0f3f7; }
.cal-cell.today { border-color: var(--gold); }
.cal-day {
  font-size: 0.74rem; font-weight: 600; color: var(--blu-d);
  margin-bottom: 3px; line-height: 1;
}
.cal-cell.other .cal-day { color: #c0cad6; }
.cal-cell.today .cal-day {
  background: var(--gold); color: var(--white);
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700;
}
.cal-posts {
  display: flex; flex-direction: column; gap: 2px;
}
.cal-post {
  border-radius: 4px; padding: 2px 5px;
  font-size: 0.58rem; font-weight: 600; color: var(--white);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
}
.cal-post .tov {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
}
.cal-more { font-size: 0.55rem; color: var(--muted); font-weight: 600; }

/* ===== List view ===== */
.list-wrap { padding: 12px; display: flex; flex-direction: column; gap: 16px; }
.list-day-header {
  font-size: 0.7rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  display: flex; align-items: baseline; gap: 8px;
}
.list-day-header .day-num {
  font-size: 1.4rem; font-weight: 700; color: var(--blu-d);
}
.list-card {
  background: var(--white); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 6px rgba(26,58,92,0.08);
}
.list-card-row1 {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px;
}
.list-card-row1 .tov {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
}
.list-card-row1 .titolo {
  font-size: 0.93rem; font-weight: 600; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.canale-pill {
  font-size: 0.66rem; font-weight: 600; padding: 3px 9px;
  border-radius: 22px; color: var(--white);
  white-space: nowrap;
}
.list-card-row2 { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.stato-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pill-soft {
  font-size: 0.68rem; padding: 3px 9px; border-radius: 22px;
  background: #f0f4f8; color: #6b7280; font-weight: 500;
}
.pill-tag {
  font-size: 0.66rem; padding: 3px 9px; border-radius: 22px;
  background: var(--blu-l); color: var(--blu-d); font-weight: 600;
}
.list-card .copy {
  font-size: 0.8rem; color: #4a5568; line-height: 1.5; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-card .attach-row {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}
.attach-thumb {
  width: 44px; height: 44px; border-radius: 8px;
  background: #f0f4f8 center/cover no-repeat; flex-shrink: 0;
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
}

/* ===== Activity ===== */
.act-wrap { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.act-card {
  background: var(--white); border-radius: 10px;
  padding: 10px 14px; box-shadow: 0 1px 4px rgba(26,58,92,0.06);
  display: flex; gap: 12px;
}
.act-ts { font-size: 0.66rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; min-width: 76px; }
.act-msg { font-size: 0.82rem; color: var(--dark); line-height: 1.4; }

.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty .ico { font-size: 2rem; }
.empty .txt { font-size: 0.86rem; margin-top: 10px; line-height: 1.5; }

/* ===== FAB ===== */
.fab {
  position: fixed;
  right: calc(18px + var(--sar));
  bottom: calc(var(--bottom-nav-h) + var(--sab) + 16px);
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent);
  color: var(--white); border: none; padding: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.32);
  z-index: 95;
  transition: background 0.16s, transform 0.12s;
  cursor: pointer;
}
.fab:hover { background: var(--accent-d); }
.fab:active { transform: scale(0.94); background: var(--accent-d); }
.fab .icn { color: var(--white); }
.fab .icn svg { stroke-width: 2.6; }
@media (prefers-reduced-motion: reduce) {
  .fab { transition: none; }
}

/* ===== Modal (bottom-sheet style) ===== */
.modal-bg {
  position: fixed; inset: 0; background: rgba(10,22,40,0.55);
  z-index: 300; display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--white); border-radius: 22px 22px 0 0;
  width: 100%; max-width: 640px;
  padding: 18px 18px calc(38px + var(--sab));
  max-height: 92dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-handle {
  width: 38px; height: 4px; background: #dde3ea;
  border-radius: 2px; margin: 0 auto 16px;
}
.modal h2 {
  margin: 0 0 14px;
  font-size: 1.1rem; font-weight: 700; color: var(--blu-d);
}

.tov-badge {
  display: flex; align-items: center; gap: 10px;
  border-radius: 12px; padding: 10px 12px; margin-bottom: 14px;
  border: 1px solid;
}
.tov-badge.on  { background: rgba(16,185,129,0.08);  border-color: rgba(16,185,129,0.3);  color: var(--green); }
.tov-badge.off { background: rgba(192,57,43,0.07);  border-color: rgba(192,57,43,0.3);   color: var(--rosso); }
.tov-badge .dot { width: 12px; height: 12px; border-radius: 50%; }
.tov-badge.on  .dot { background: var(--green); }
.tov-badge.off .dot { background: var(--rosso); }
.tov-badge .label { font-size: 0.78rem; font-weight: 600; flex: 1; }
.tov-badge button {
  padding: 7px 14px; color: var(--white); border: none;
  border-radius: 8px; font-size: 0.68rem; font-weight: 600; min-height: 32px;
}
.tov-badge.on  button { background: var(--rosso); }
.tov-badge.off button { background: var(--green); }

.tag-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag-pill {
  padding: 7px 12px; border-radius: 22px; min-height: 32px;
  border: 1.5px solid #dde3ea; background: var(--white);
  color: var(--muted); font-size: 0.72rem; font-weight: 600;
}
.tag-pill.active {
  border-color: var(--blu-d); background: var(--blu-l); color: var(--blu-d);
}
.tag-pill.dashed { border-style: dashed; border-color: #c0cad6; background: transparent; }

.link-row {
  display: flex; align-items: center; gap: 8px;
  background: #f0f4f8; border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
}
.link-row span {
  font-size: 0.76rem; flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.link-row button {
  background: none; border: none; color: var(--red);
  font-size: 1.2rem; padding: 0 4px; min-width: 32px; min-height: 32px;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== Attachments UI nel modal ===== */
.att-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.att-item {
  width: 76px; height: 76px; border-radius: 10px;
  background: #f0f4f8 center/cover no-repeat;
  position: relative; overflow: hidden;
}
.att-item .name {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.55); color: var(--white);
  padding: 3px 4px; font-size: 0.55rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.att-item .x {
  position: absolute; top: 3px; right: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: var(--white);
  border: none; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
}
.att-item .doc {
  font-size: 1.8rem; height: 100%;
  display: flex; align-items: center; justify-content: center; color: #6b7280;
}
.att-add {
  width: 76px; height: 76px; border-radius: 10px;
  border: 2px dashed #c0cad6; background: transparent;
  color: var(--muted); font-size: 0.66rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
}
.att-add .ico { font-size: 1.4rem; }

/* ===== Admin / Profilo ===== */
.section { padding: 14px; }
.section h3 {
  font-size: 0.92rem; color: var(--blu-d);
  margin: 0 0 12px; font-weight: 700;
}
.kpi-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 16px;
}
.kpi {
  background: var(--white); border-radius: 12px; padding: 10px;
  text-align: center; box-shadow: 0 1px 4px rgba(26,58,92,0.06);
}
.kpi .v { font-size: 1.3rem; font-weight: 700; color: var(--blu-d); }
.kpi .l { font-size: 0.62rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

.user-card {
  background: var(--white); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(26,58,92,0.06);
}
.user-card-row1 {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px;
}
.user-card .name { font-weight: 700; font-size: 0.92rem; flex: 1; min-width: 0; }
.role-pill {
  font-size: 0.62rem; padding: 3px 8px; border-radius: 22px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.role-pill.admin   { background: var(--blu-l); color: var(--blu-d); }
.role-pill.editor  { background: #f0f4f8; color: #6b7280; }
.role-pill.pending { background: rgba(245,158,11,0.18); color: var(--orange); }
.user-stats {
  display: flex; gap: 12px; font-size: 0.72rem; color: var(--muted); margin-top: 4px;
}
.user-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.user-actions button {
  flex: 1; padding: 8px; border: none; border-radius: 8px;
  font-size: 0.74rem; font-weight: 600; min-height: 38px;
}
.act-approve { background: var(--green); color: var(--white); }
.act-reset   { background: var(--orange); color: var(--white); }
.act-role    { background: var(--blu); color: var(--white); }
.act-del     { background: var(--red); color: var(--white); }

/* Pending screen */
.pending-bg {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--blu-d), var(--blu));
  padding: max(20px, var(--sat)) 20px max(20px, var(--sab));
}
.pending-card {
  background: var(--white); border-radius: 22px; padding: 32px 26px;
  max-width: 380px; text-align: center;
}
.pending-card h2 {
  color: var(--blu-d); font-family: 'Cormorant Garamond', Georgia, serif;
  margin: 0 0 8px;
}
.pending-card p { color: #6b7280; font-size: 0.88rem; line-height: 1.5; }

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--sab) + 80px);
  left: 50%; transform: translateX(-50%);
  background: var(--dark); color: var(--white);
  padding: 11px 18px; border-radius: 24px;
  font-size: 0.82rem; font-weight: 500;
  box-shadow: 0 4px 18px rgba(0,0,0,0.3); z-index: 400;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  max-width: 86vw;
}
.toast.show { opacity: 1; }

.search-bar {
  padding: 10px 12px; background: var(--white);
  border-bottom: 1px solid var(--border);
}
.search-bar input {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: #fafaf8;
  font-size: 16px;
}

/* AI loading shimmer */
.ai-loading {
  background: linear-gradient(90deg, #e5eaf0, #f4f7fa, #e5eaf0);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
  border-radius: 8px; height: 96px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Toggle mese/settimana ===== */
.mode-toggle {
  display: flex; gap: 4px; margin-top: 10px;
  background: rgba(255,255,255,0.12); border-radius: 22px; padding: 3px;
}
.mode-toggle button {
  flex: 1; padding: 7px; border: none; background: transparent;
  color: rgba(255,255,255,0.7); border-radius: 19px;
  font-size: 0.72rem; font-weight: 600;
}
.mode-toggle button.active {
  background: var(--white); color: var(--blu-d);
}

/* ===== Vista settimanale ===== */
.week-wrap {
  padding: 8px 6px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.week-day {
  background: var(--white); border-radius: 12px;
  padding: 10px 12px; border: 1.5px solid transparent;
  box-shadow: 0 1px 4px rgba(26,58,92,0.06);
}
.week-day.today { border-color: var(--gold); }
.week-day-head {
  display: flex; align-items: baseline; gap: 8px;
  padding-bottom: 8px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.wd-dow {
  font-size: 0.65rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.wd-num {
  font-size: 1.6rem; font-weight: 700; color: var(--blu-d);
  font-family: 'Cormorant Garamond', Georgia, serif;
}
.week-day.today .wd-num { color: var(--gold); }
.wd-mon { font-size: 0.74rem; color: var(--muted); text-transform: lowercase; }
.week-day-body { display: flex; flex-direction: column; gap: 8px; }
.week-empty {
  font-size: 0.74rem; color: var(--muted); padding: 4px 0;
  font-style: italic;
}
.week-card {
  background: #fafaf8; border-radius: 8px;
  padding: 8px 10px; cursor: pointer;
  user-select: none; -webkit-user-select: none;
  touch-action: pan-y;
}
.week-card-row1 {
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
}
.week-card-row1 .tov {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.wc-titolo {
  font-size: 0.84rem; font-weight: 600; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.week-card-row2 { display: flex; gap: 5px; flex-wrap: wrap; }
.week-card-row2 .canale-pill { color: #fff; border-radius: 22px; font-weight: 600; }
.wc-copy {
  font-size: 0.72rem; color: #4a5568; margin-top: 5px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.week-add {
  margin-top: 4px; padding: 8px 10px; min-height: 36px;
  background: transparent; border: 1.5px dashed #c0cad6;
  color: var(--muted); border-radius: 8px;
  font-size: 0.74rem; font-weight: 600;
}

/* ===== Drag & drop ===== */
.cal-post, .week-card { touch-action: pan-y; }
.dragging { opacity: 0.4; }
.drop-hot {
  background: rgba(255,107,53,0.18) !important;
  border-color: var(--gold) !important;
  transition: background 0.12s;
}
.drag-ghost {
  border-radius: 10px;
  font-size: 0.78rem;
  padding: 8px 10px;
}

/* ===== Filtri raggruppati v2 ===== */
.filters-wrap {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.filters-bar {
  display: flex; gap: 6px; padding: 10px 12px;
  align-items: center;
}
.fbtn {
  flex: 1; min-height: 38px;
  background: #f6f8fb; border: 1.5px solid var(--border); border-radius: 22px;
  font-size: 0.78rem; font-weight: 600; color: #2b3340;
  padding: 6px 12px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.fbtn.has { background: var(--blu-l); border-color: var(--blu-d); color: var(--blu-d); }
.fbtn.open { background: var(--blu-d); color: var(--white); border-color: var(--blu-d); }
.fbtn .fchev { font-size: 0.75rem; }
.fbtn .fbadge {
  background: var(--blu-d); color: var(--white);
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 0.62rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.fbtn.open .fbadge { background: var(--gold); color: var(--blu-d); }
.fbtn-clear {
  flex: 0 0 auto; background: transparent;
  border-color: var(--rosso); color: var(--rosso);
}

.filters-summary {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 12px 10px;
}

.filters-drawer {
  padding: 10px 12px 14px;
  background: #fafbfd;
  border-top: 1px solid var(--border);
  animation: fdSlide 0.16s ease-out;
}
@keyframes fdSlide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.fdhead {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.72rem; font-weight: 700; color: var(--blu-d);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.flink {
  background: transparent; border: 1.5px dashed #c0cad6;
  border-radius: 18px; padding: 5px 10px;
  font-size: 0.66rem; font-weight: 600; color: var(--muted);
  text-transform: none; letter-spacing: 0;
}
.fdgrid {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.fdgrid .chip {
  min-height: 34px; padding: 6px 12px;
  font-size: 0.74rem;
}

/* Nascondi la vecchia barra orizzontale .filters (se ancora presente) */
.filters { display: none; }

/* ===== Icone SVG (sostituiscono emoji UI) ===== */
.icn {
  display: inline-flex;
  align-items: center;
  vertical-align: -3px;
  line-height: 0;
  flex-shrink: 0;
}
.icn svg { display: block; }

/* Centratura icone dentro bottom-nav .ico */
.bnav-item .ico { display: inline-flex; align-items: center; justify-content: center; }
.bnav-item .ico .icn { vertical-align: 0; }

/* Header bell con badge */
.icon-btn .icn { color: currentColor; }

/* Pulsanti btn con icona inline */
.btn .icn { vertical-align: -4px; margin-right: 4px; }
.btn-pill .icn { vertical-align: -3px; margin-right: 4px; }
.act-approve .icn, .act-reset .icn, .act-del .icn, .act-role .icn { vertical-align: -2px; margin-right: 3px; }

/* Empty state ico */
.empty .ico .icn { vertical-align: 0; }
.empty .ico { color: var(--muted); }

/* Modale h2 con icone */
.modal h2 .icn { vertical-align: -3px; margin-right: 6px; color: var(--blu-d); }
.section h3 .icn { vertical-align: -3px; margin-right: 6px; color: var(--blu-d); }

/* Frecce mese-nav (chevron rotation) */
.month-nav button .icn {
  display: inline-flex; align-items: center; justify-content: center;
}
.month-nav button:first-child .icn { transform: rotate(90deg); }
.month-nav button:last-child  .icn { transform: rotate(-90deg); }

/* Toggle mode-toggle non più usato — nascondo */
.mode-toggle { display: none; }

/* FAB plus */
.fab .icn { vertical-align: 0; color: var(--white); }

/* Bell badge contrast */
.icon-btn { color: var(--white); }


/* ===== Multi-canali in post modal ===== */
.canali-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.canale-chk {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; min-height: 38px;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 22px;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: transform 0.1s;
}
.canale-chk:active { transform: scale(0.96); }
.canale-chk.on { color: var(--white); }
.canale-chk .dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* Multi-pill canali in lista */
.canale-pills {
  display: flex; gap: 4px; flex-wrap: wrap;
}

/* ===== Admin: tab bar interne ===== */
.admin-wrap { padding: 0; }
.admin-tabs {
  display: flex; gap: 4px;
  padding: 10px 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; min-height: 36px;
  background: #f6f8fb; border: 1.5px solid transparent;
  border-radius: 20px;
  font-size: 0.76rem; font-weight: 600; color: #6b7280;
  white-space: nowrap; flex-shrink: 0;
}
.admin-tab.active {
  background: var(--blu-d); color: var(--white);
  border-color: var(--blu-d);
}
.admin-panel {
  padding: 14px 12px 24px;
}

/* CRUD inline list */
.crud-list {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px;
}
.crud-row {
  background: var(--white);
  border-radius: 10px; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 1px 3px rgba(26,58,92,0.05);
}
.crud-row .spacer { flex: 1; }
.crud-color-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}
.crud-name {
  font-size: 0.84rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.crud-edit, .crud-del {
  background: transparent; border: none;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #6b7280;
}
.crud-edit:hover { background: var(--blu-l); color: var(--blu-d); }
.crud-del:hover { background: rgba(239,68,68,0.12); color: var(--red); }
.crud-add {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px;
}
.crud-add .in { flex: 1; margin: 0; }
