/* Assemblea Soci BIP — palette ispirata a biovalleypartner.com
   navy / near-black + accento teal, molto white space, sans-serif pulito. */
:root {
  --navy: #0d2138;
  --navy-2: #122a45;
  --ink: #0f1c2e;
  --teal: #12a594;
  --teal-dark: #0c7d70;
  --teal-soft: #e6f6f4;
  --bg: #f4f7fa;
  --card: #ffffff;
  --line: #e2e8f0;
  --muted: #64748b;
  --fav: #15a06b;
  --fav-dark: #0f7d52;
  --ast: #64748b;
  --ast-dark: #475569;
  --contra: #d64545;
  --contra-dark: #b22f2f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 28, 46, .08), 0 8px 24px rgba(15, 28, 46, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-dark); }

/* Header */
.site-header {
  background: var(--navy);
  color: #fff;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { font-weight: 800; letter-spacing: .5px; }
.brand .mark b { color: var(--teal); }
.brand .sub { color: #9fb3c8; font-size: .8rem; }
/* Biovalley logo (dark-on-white) shown on a white chip over the navy header */
.brand-logo { height: 34px; width: auto; background: #fff; padding: 6px 12px; border-radius: 10px; display: block; }
.brand-tag { color: #cdd9e5; font-size: .9rem; font-weight: 600; letter-spacing: .3px; }
.login-logo { display: block; margin: 0 auto 16px; max-width: 250px; width: 80%; height: auto; }
.site-header nav { display: flex; align-items: center; gap: 18px; font-size: .9rem; }
.site-header nav a { color: #cdd9e5; text-decoration: none; }
.site-header nav a:hover { color: #fff; }
.who { color: #9fb3c8; font-size: .85rem; }

/* Layout */
.container { max-width: 980px; margin: 0 auto; padding: 28px 22px 64px; }
.container.narrow { max-width: 460px; }
.page-title { margin: 0 0 4px; font-size: 1.5rem; }
.page-sub { margin: 0 0 24px; color: var(--muted); }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 1.1rem; }
.card h3 { margin: 0 0 10px; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* Forms */
label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: .98rem;
  background: #fff;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  transition: background .15s ease;
}
.btn:hover { background: var(--teal-dark); }
.btn.secondary { background: #eef2f7; color: var(--ink); }
.btn.secondary:hover { background: #e2e8f0; }
.btn.danger { background: var(--contra); }
.btn.small { padding: 7px 12px; font-size: .82rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: .92rem; }
.alert.error { background: #fdecec; color: var(--contra-dark); border: 1px solid #f5c6c6; }
.alert.ok { background: var(--teal-soft); color: var(--teal-dark); border: 1px solid #b9e6df; }
.alert.info { background: #eef4fb; color: #28527a; border: 1px solid #cfe0f1; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.badge.si { background: var(--teal-soft); color: var(--teal-dark); }
.badge.no { background: #f1f5f9; color: var(--muted); }
.badge.aperta { background: #e6f6ec; color: var(--fav-dark); }
.badge.chiusa { background: #f1f5f9; color: var(--muted); }
.badge.bozza { background: #fff4e5; color: #9a6700; }

.muted { color: var(--muted); }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-clean li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.list-clean li:last-child { border-bottom: none; }

/* ---------- Login (QR) ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 440px; text-align: center; }
.qr-box { display: flex; align-items: center; justify-content: center; min-height: 260px; margin: 8px 0; }
.qr-box img { border-radius: 12px; border: 1px solid var(--line); }
.qr-tip { color: var(--muted); font-size: .88rem; min-height: 1.2em; }
.ihi-head { display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 2px; }
.ihi-icon { width: 28px; height: 28px; border-radius: 7px; box-shadow: 0 1px 3px rgba(15,28,46,.25); }
.store-links { margin-top: 16px; }
.store-hint { display: block; color: var(--muted); font-size: .82rem; margin-bottom: 10px; }
.store-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.store-btn {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 18px;
  color: var(--navy); text-decoration: none; background: #fff; transition: background .15s, border-color .15s;
}
.store-btn:hover { background: #f4f7fa; border-color: var(--teal); }
.store-svg { width: 26px; height: 26px; flex: 0 0 auto; color: var(--navy); }
.store-txt { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.store-txt small { font-size: .7rem; color: var(--muted); }
.store-txt strong { font-size: .92rem; font-weight: 600; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 22px 0 6px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
details.pwd { margin-top: 12px; text-align: left; }
details.pwd summary { cursor: pointer; color: var(--teal-dark); font-size: .9rem; }

/* ---------- Video assemblea ---------- */
.video-wrap {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow);
}
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.zoom-wrap { width: 100%; max-width: 100%; min-height: 480px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #0d1b2a; }
/* Il canvas/video iniettato da Zoom non deve uscire dal contenitore (mobile). */
.zoom-wrap canvas, .zoom-wrap video { max-width: 100%; }

/* Barra "presenza live" sotto al menu coordinatore (sottile, resta in alto). */
.presence-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 3px 10px; padding: 5px 14px;
  font-size: .82rem; line-height: 1.2;
  background: var(--teal, #0e7c66); color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.presence-bar b { font-weight: 700; }
.presence-bar .pb-sep { opacity: .55; }
.presence-bar .pb-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #29e08f; box-shadow: 0 0 0 3px rgba(41,224,143,.35);
}
.video-placeholder { text-align: center; padding: 52px 24px; }
.video-placeholder p {
  font-size: 1.1rem; color: var(--navy); font-weight: 600;
  max-width: 580px; margin: 12px auto 0; line-height: 1.5;
}
.vp-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--teal);
  margin: 0 auto; animation: pulse 1.4s infinite;
}

/* ---------- Voting ---------- */
.delibera-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 2rem;
  color: var(--navy);
  background: #fff;
  border: 2px solid var(--teal);
  border-radius: 12px;
  padding: 6px 16px;
  min-width: 84px;
  text-align: center;
}
.countdown.urgent { border-color: var(--contra); color: var(--contra-dark); }

.ballot { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 16px; }
.ballot .ballot-label { font-weight: 700; font-size: 1.05rem; }
.ballot .ballot-meta { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.vote-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 16px; }
.vote-buttons.presenze { grid-template-columns: minmax(200px, 380px); justify-content: center; }
.vote-btn {
  border: none; border-radius: 12px; padding: 18px 8px; font-size: 1.02rem; font-weight: 700;
  color: #fff; cursor: pointer; transition: transform .08s ease, filter .15s ease;
}
.vote-btn:active { transform: translateY(1px); }
.vote-btn:disabled { opacity: .45; cursor: default; }
.vote-btn.contra { background: var(--contra); }
.vote-btn.contra:hover:not(:disabled) { background: var(--contra-dark); }
.vote-btn.ast { background: var(--ast); }
.vote-btn.ast:hover:not(:disabled) { background: var(--ast-dark); }
.vote-btn.fav { background: var(--fav); }
.vote-btn.fav:hover:not(:disabled) { background: var(--fav-dark); }
.vote-btn.chosen { outline: 4px solid rgba(18,165,148,.35); filter: saturate(1.1); }
.ballot.done .vote-buttons { opacity: .85; }
.ballot .chosen-label { margin-top: 12px; font-weight: 600; }

.waiting { text-align: center; padding: 40px 16px; color: var(--muted); }
.waiting .pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--teal); display: inline-block; margin-right: 8px; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: .3; } 50% { opacity: 1; } }

/* ---------- Results (coordinator) ---------- */
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 8px 0 4px; }
.result-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; }
.result-card.contra { border-top: 4px solid var(--contra); }
.result-card.ast { border-top: 4px solid var(--ast); }
.result-card.fav { border-top: 4px solid var(--fav); }
.result-card .rc-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.result-card .rc-pct { font-size: 2rem; font-weight: 800; margin: 4px 0; }
.result-card .rc-detail { font-size: .85rem; color: var(--muted); }
.bar { height: 10px; border-radius: 6px; background: #eef2f7; overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; }
.bar.contra > span { background: var(--contra); }
.bar.ast > span { background: var(--ast); }
.bar.fav > span { background: var(--fav); }

.kpi-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 4px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.kpi .k { font-size: .75rem; color: var(--muted); text-transform: uppercase; }
.kpi .v { font-size: 1.3rem; font-weight: 800; }

.scelta-tag { font-weight: 700; }
.scelta-tag.FAVOREVOLE { color: var(--fav-dark); }
.scelta-tag.ASTENUTO { color: var(--ast-dark); }
.scelta-tag.CONTRARIO { color: var(--contra-dark); }

/* ---------- Soci editor (grid rows that are also forms) ---------- */
.soci-grid-head, .srow {
  display: grid;
  grid-template-columns: 2.2fr 2.4fr 1fr 0.6fr 0.6fr 1.4fr;
  gap: 8px;
  align-items: center;
}
.soci-grid-head { padding: 0 6px 8px; font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.srow { padding: 6px; border-bottom: 1px solid var(--line); }
.srow:hover { background: #fafcff; }
.srow input[type=text], .srow input[type=email], .srow input:not([type]) { padding: 7px 9px; font-size: .9rem; }
.srow input[name=azioni], .srow input[name=percentuale] { text-align: right; font-variant-numeric: tabular-nums; }
.voto-cell { margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; }
.voto-cell input { width: 18px; height: 18px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.srow-new { border: none; padding: 0; }
@media (max-width: 760px) {
  .soci-grid-head { display: none; }
  .srow { grid-template-columns: 1fr 1fr; row-gap: 6px; padding: 12px 6px; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } .result-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #9fb3c8; margin-top: 48px; padding: 26px 22px 22px; }
.footer-inner { max-width: 980px; margin: 0 auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.footer-brand { font-size: .9rem; display: flex; flex-direction: column; gap: 3px; }
.footer-brand strong { color: #fff; font-weight: 700; }
.footer-brand span { color: #7f93a8; font-size: .8rem; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: #cdd9e5; text-decoration: none; font-size: .85rem; }
.footer-links a:hover { color: #fff; }
.footer-copy {
  max-width: 980px; margin: 16px auto 0; border-top: 1px solid rgba(255,255,255,.10);
  padding-top: 12px; font-size: .78rem; color: #7f93a8;
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.footer-credit a { color: #9fb3c8; text-decoration: none; }
.footer-credit a:hover { color: var(--teal); }

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 920px; margin: 0 auto;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 10px 34px rgba(15,28,46,.20);
  border-radius: 14px; padding: 16px 18px; z-index: 1000;
  display: flex; gap: 18px; align-items: center; justify-content: space-between;
}
.cookie-banner[hidden] { display: none; }
.cookie-text { font-size: .86rem; color: var(--ink); line-height: 1.45; }
.cookie-text a { color: var(--teal-dark); }
.cookie-actions { flex: 0 0 auto; }
@media (max-width: 600px) { .cookie-banner { flex-direction: column; align-items: stretch; } .cookie-actions .btn { width: 100%; } }
