/* humind webapp — stile pulito, coerente con la landing:
   bianco, una tinta (petrolio + verde acqua), bordi 1px, angoli morbidi. */

:root {
  --petrol: #00414A;
  --petrol-2: #06565F;
  --aqua: #6EC3BA;
  --aqua-soft: #B9E2DD;
  --aqua-mist: #EAF6F4;
  --aqua-ink: #2E837A;
  --ink: #0B2226;
  --ink-2: #4E6669;
  --ink-3: #7C9093;
  --line: #E3ECEA;
  --bg: #FFFFFF;
  --bg-2: #F6FAF9;
  --danger: #D64545;
  --radius: 18px;
  --tabbar-h: 62px;
  --maxw: 560px;
  --shadow-sm: 0 1px 2px rgba(0, 65, 74, 0.05), 0 6px 20px rgba(0, 65, 74, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  font-size: 16px;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }
input { font: inherit; }
ul { list-style: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }

h1 { color: var(--petrol); font-size: 26px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
h2 { color: var(--petrol); font-weight: 700; letter-spacing: -0.02em; }

.eyebrow { color: var(--aqua-ink); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; margin-bottom: 8px; }

:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; border-radius: 8px; }

/* ---------- bottoni ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s, transform .15s, opacity .15s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-block { width: 100%; }
.btn-primary { background: var(--petrol); color: #fff; }
.btn-primary:hover { background: var(--petrol-2); }
.btn-ghost { background: #fff; color: var(--petrol); border-color: #CFDEDC; }
.btn-ghost:hover { background: var(--aqua-mist); }
.btn-aqua { background: var(--aqua); color: var(--petrol); }
.btn-dark-ghost { background: rgba(255, 255, 255, 0.12); color: #fff; }
.btn-danger { background: #fff; color: var(--danger); border-color: #F0CFCF; }
.btn-text { background: none; color: var(--ink-2); padding: 10px; font-weight: 500; }
.btn-text.danger { color: var(--danger); }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--petrol);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}

.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--aqua-mist); }

/* ---------- avatar ---------- */

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--aqua-soft);
  color: var(--petrol);
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
  flex: none;
}

.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.xl { width: 88px; height: 88px; font-size: 26px; margin: 0 auto 6px; background: var(--aqua); }
.avatar-btn { border: none; cursor: pointer; width: 44px; height: 44px; border-radius: 50%; background: var(--aqua-soft); color: var(--petrol); font-weight: 700; }

/* ---------- lingua ---------- */

.lang-menu { position: relative; }

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.lang-btn svg { width: 18px; height: 18px; stroke-width: 1.7; }
.lang-btn[aria-expanded="true"] { border-color: var(--aqua); color: var(--petrol); }

.lang-dd {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 65, 74, 0.14);
  z-index: 30;
}

.lang-dd[hidden] { display: none; }

.lang-dd button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  font-size: 14px;
  padding: 9px 12px;
  border: none;
  border-radius: 9px;
  background: none;
  cursor: pointer;
}

.lang-dd button:hover { background: var(--bg-2); }
.lang-dd button.active { color: var(--petrol); font-weight: 600; }
.lang-dd button.active::after { content: ""; width: 6px; height: 11px; border-right: 2px solid var(--aqua-ink); border-bottom: 2px solid var(--aqua-ink); transform: rotate(45deg); margin-right: 4px; }


/* ---------- schermate a tutta pagina ---------- */

.screen {
  min-height: 100dvh;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
}

/* welcome */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  position: relative;
}

.welcome-lang { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; }
.welcome-logo-link { display: block; margin-bottom: 8px; }
.welcome-logo { width: 150px; height: auto; }
.welcome h1 { font-size: 28px; }
.welcome p { color: var(--ink-2); }
.welcome form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; margin-top: 10px; }

.welcome input, .row input[type="text"], .row input[type="email"] {
  font-size: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  width: 100%;
}

.welcome input:focus, .row input:focus { border-color: var(--aqua); }

/* boot */
.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.boot p { max-width: 34ch; }
.boot a { color: var(--petrol); font-weight: 600; }

.auth-msg { font-size: 13px; line-height: 1.4; padding: 10px 14px; border-radius: 12px; text-align: left; }
.auth-msg.err { background: #FFF3F3; color: var(--danger); border: 1px solid #F0CFCF; }
.auth-msg.ok  { background: var(--aqua-mist); color: var(--aqua-ink); border: 1px solid var(--aqua-soft); }

/* quiz */
.quiz { display: flex; flex-direction: column; gap: 20px; }

.quiz-head { display: flex; align-items: center; gap: 14px; }
.quiz-head .icon-btn.hidden-soft { visibility: hidden; }
.quiz-count { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

.progress { flex: 1; height: 6px; border-radius: 999px; background: var(--aqua-mist); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--aqua); border-radius: 999px; transition: width .3s; }

.quiz-body { flex: 1; display: flex; flex-direction: column; gap: 18px; padding-top: 12px; }
.quiz-body h2 { font-size: 26px; line-height: 1.15; }
.quiz-body .hint { color: var(--ink-2); margin-top: -8px; }

.opts { display: flex; flex-direction: column; gap: 10px; }

.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}

.opt:hover { border-color: var(--aqua-soft); }
.opt.on { border-color: var(--aqua); background: var(--aqua-mist); color: var(--petrol); font-weight: 600; }
.opt::after { content: ""; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; }
.opt.on::after { border-color: var(--aqua); background: var(--aqua) center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300414A' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E"); }

.opts.chips { flex-direction: row; flex-wrap: wrap; }
.opts.chips .opt { width: auto; padding: 11px 16px; border-radius: 999px; font-size: 15px; }
.opts.chips .opt::after { display: none; }

.scale { display: flex; gap: 8px; }
.scale .opt { flex: 1; justify-content: center; padding: 16px 0; font-size: 18px; font-weight: 600; }
.scale .opt::after { display: none; }
.scale-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); margin-top: -8px; }

.alert {
  border: 1px solid #F0CFCF;
  background: #FFF6F6;
  border-radius: 16px;
  padding: 16px;
  font-size: 15px;
  color: var(--ink);
}

.alert strong { color: var(--danger); }
.alert a { color: var(--danger); font-weight: 600; }

.quiz-foot { display: flex; flex-direction: column; gap: 6px; align-items: center; }

.analyzing { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--ink-2); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--aqua-mist); border-top-color: var(--aqua); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* match */
.match { display: flex; align-items: center; }
.match-wrap { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.match-wrap h1 { font-size: 28px; }

.match-card { border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.match-card .who { display: flex; align-items: center; gap: 14px; }
.match-card .avatar { width: 56px; height: 56px; font-size: 17px; }
.match-card .name { font-weight: 700; color: var(--petrol); font-size: 18px; }
.match-card .spec { color: var(--aqua-ink); font-size: 13px; font-weight: 600; }
.match-card .bio { color: var(--ink-2); font-size: 15px; }
.reasons { display: flex; flex-direction: column; gap: 8px; }
.reasons li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.reasons svg { width: 18px; height: 18px; color: var(--aqua-ink); stroke-width: 2.4; flex: none; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; font-weight: 600; background: var(--aqua-mist); color: var(--aqua-ink); border-radius: 999px; padding: 4px 10px; }

.match-alts { display: flex; flex-direction: column; gap: 10px; }
.alt { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.alt .btn { padding: 8px 14px; font-size: 13px; }

/* ---------- app shell ---------- */

.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

.view { max-width: var(--maxw); margin: 0 auto; min-height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom)); display: flex; flex-direction: column; }

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(20px + env(safe-area-inset-top)) 24px 8px;
}

.view-body { padding: 8px 24px 32px; display: flex; flex-direction: column; gap: 12px; }

.h-sec { font-size: 15px; margin: 14px 0 0; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.card.center { align-items: center; text-align: center; }
.card-dark { background: var(--petrol); color: #fff; border-color: var(--petrol); }
.card-label { color: var(--aqua-soft); font-size: 13px; }
.card-big { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.row-who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.row-actions .btn { padding: 11px 18px; font-size: 14px; }

.row-card { flex-direction: row; align-items: center; gap: 12px; }

.bar { height: 6px; border-radius: 999px; background: var(--aqua-mist); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--aqua); border-radius: 999px; transition: width .4s; }

/* umore */
.mood-pick { display: flex; justify-content: space-between; gap: 4px; }

.mood-pick button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 2px;
  border: none;
  background: none;
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 12px;
}

.mood-pick button i { width: 30px; height: 30px; border-radius: 50%; background: var(--aqua-mist); border: 1.5px solid var(--aqua-soft); transition: transform .15s, background-color .15s; }
.mood-pick button[data-v="1"] i { background: #F3F6F6; border-color: #D9E2E2; }
.mood-pick button[data-v="2"] i { background: #E6F1EF; }
.mood-pick button[data-v="4"] i { background: #D3ECE8; }
.mood-pick button[data-v="5"] i { background: var(--aqua-soft); border-color: var(--aqua); }
.mood-pick button.on { color: var(--petrol); font-weight: 600; }
.mood-pick button.on i { background: var(--aqua); border-color: var(--aqua); transform: scale(1.1); }

.mood-hist { display: flex; gap: 6px; align-items: flex-end; height: 40px; padding: 4px 2px 0; }
.mood-hist i { flex: 1; background: var(--aqua-soft); border-radius: 5px 5px 2px 2px; min-height: 4px; }
.mood-hist i.today { background: var(--aqua); }
.mood-hist i.empty { background: var(--bg-2); }

/* lista aggiornamenti */
.list { display: flex; flex-direction: column; gap: 8px; }
.list li { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.list li time { color: var(--ink-3); font-size: 12px; white-space: nowrap; margin-left: auto; }
.list li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--aqua); flex: none; margin-top: 6px; }

/* ---------- chat ---------- */

.chat-head { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 20px 12px; border-bottom: 1px solid var(--line); }
.online { font-size: 12px; color: var(--aqua-ink); display: flex; align-items: center; gap: 5px; }
.online i { width: 7px; height: 7px; border-radius: 50%; background: #34C759; }

.demo-note { font-size: 12px; color: var(--ink-3); text-align: center; padding: 8px 20px 0; }

.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }

.msg { max-width: 82%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.4; white-space: pre-line; position: relative; }
.msg.them { background: var(--bg-2); align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.me { background: var(--petrol); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.msg-time { display: block; font-size: 10.5px; opacity: 0.6; margin-top: 4px; text-align: right; }

.chat-empty { margin: auto 0; text-align: center; color: var(--ink-3); font-size: 14px; padding: 0 24px; }

.chat-input { display: flex; gap: 8px; padding: 10px 20px 14px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; font-size: 16px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 999px; outline: none; }
.chat-input input:focus { border-color: var(--aqua); }
.chat-input button { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--petrol); color: #fff; display: grid; place-items: center; cursor: pointer; }
.chat-input button svg { width: 18px; height: 18px; }

/* ---------- profilo ---------- */

.group { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  background: #fff;
  width: 100%;
  text-align: left;
}

.row:last-child { border-bottom: none; }
.row > span:first-child { flex: none; }
.row input[type="text"], .row input[type="email"] { padding: 6px 0; border: none; border-radius: 0; text-align: right; color: var(--ink-2); width: auto; flex: 1; min-width: 0; }
.row.link { border-left: none; border-right: none; border-top: none; cursor: pointer; color: var(--petrol); font-weight: 500; }
.row.link svg { width: 18px; height: 18px; color: var(--ink-3); }
.row.link:hover { background: var(--bg-2); }
.row.muted { display: block; }

.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: #D9E2E2;
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background-color .2s;
}

.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform .2s; }
.switch:checked { background: var(--aqua); }
.switch:checked::after { transform: translateX(18px); }

/* ---------- foglio prenotazione ---------- */

.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: rgba(11, 34, 38, 0.4); }
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: var(--maxw);
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 10px 24px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: up .25s ease-out;
}

@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet-grip { width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: 0 auto 8px; }
.sheet h2 { font-size: 20px; }

.slots { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.slot { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font-size: 15px; text-align: left; }
.slot.on { border-color: var(--aqua); background: var(--aqua-mist); color: var(--petrol); font-weight: 600; }
.slot .t { color: var(--ink-2); font-weight: 400; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 50;
  max-width: calc(100% - 48px);
  text-align: center;
  animation: up .2s ease-out;
}

/* ---------- videochiamata ---------- */

.call-overlay { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; flex-direction: column; }
#call-frame-wrap { flex: 1; }
#call-frame-wrap iframe { width: 100%; height: 100%; border: 0; }
.call-end { position: absolute; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--danger); color: #fff; border-color: var(--danger); }

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  z-index: 20;
}

.tab {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--petrol); }
.tab.active svg { stroke-width: 2.2; }

@media (min-width: 640px) {
  .app { background: var(--bg-2); }
  .view { background: #fff; min-height: 100dvh; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .tabbar { max-width: var(--maxw); margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
