:root {
  --bg: #f4f7f6;
  --card: #fff;
  --ink: #00525E;
  --muted: #5d7276;
  --teal: #00525E;
  --green: #A2E527;
  --line: #d5e2e0;
  --amber: #f3e3b0;
  --yellow: #F5C518;
  --red: #F25C8A;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Montserrat, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--teal); text-decoration: none; }
.wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; }
.top { display: flex; justify-content: flex-start; align-items: center; gap: 16px; margin-bottom: 16px; }
.top > a,
a.top > span[aria-hidden="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-left: -4px;
  border-radius: 16px;
  background: var(--teal);
  color: transparent;
  font-size: 0;
  line-height: 1;
  flex: none;
}
.top > a::before,
a.top > span[aria-hidden="true"]::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border-left: 4px solid #fff;
  border-bottom: 4px solid #fff;
  transform: rotate(45deg);
}
.top h1 { font-size: 28px; margin: 0; margin-right: auto; }
.card {
  display: block;
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  margin-bottom: 12px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.plan-card { border: 2px solid var(--teal); }
.plan-title { font-size: 18px; }
.badge-ticket-priority {
  display: block;
  width: fit-content;
  margin: 0 0 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #6d4aff;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.badge-hot {
  display: inline-block;
  background: var(--green);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 8px;
}
.muted { color: var(--muted); font-size: 14px; }
[hidden] { display: none !important; }
.install-card { text-align: left; }
.install-card h1 { font-size: 26px; margin: 0 0 8px; }
.install-icon { width: 96px; height: 96px; border-radius: 22px; display: block; margin: 0 auto 16px; }
.ask-link { margin-top: 16px; }
.steps { margin: 16px 0; padding-left: 22px; }
.steps li { margin: 0 0 12px; font-size: 17px; line-height: 1.35; }
button#attiva-notifiche.btn {
  margin-top: 18px;
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
.balance { font-size: 56px; font-weight: 700; line-height: 1; margin: 6px 0; }
.btn {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--teal);
  color: #fff;
  border: 2px solid var(--teal);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn.line { background: #fff; color: var(--teal); border-color: var(--teal); margin-top: 10px; }
.btn.lime { background: var(--green); border-color: var(--green); color: var(--teal); }
.card form + form > .btn { margin-top: 10px; }
.btn.ghost { background: transparent; color: var(--teal); border-color: transparent; }
.kicker { letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--teal); font-size: 13px; }
.home-top { align-items: flex-start; flex-wrap: nowrap; margin-bottom: 2px; }
.home-top > div { flex: 1; min-width: 0; }
.brand { font-size: 13px; color: var(--teal); font-weight: 600; }
.home-top h1 { text-transform: uppercase; letter-spacing: .04em; font-size: 26px; }
.who { margin: 2px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.home-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-left: 12px; flex: none; }
.btn.abbonamenti {
  width: auto;
  flex: none;
  margin-left: 0;
  text-transform: none;
  letter-spacing: 0;
  background: #f3f4f5;
  color: #8b9196;
  border: 1px solid #d5d8dc;
  padding: 12px 18px;
  font-weight: 600;
  white-space: nowrap;
}
.btn.storico {
  width: auto;
  flex: none;
  text-transform: none;
  letter-spacing: 0;
  background: #f3f4f5;
  color: #8b9196;
  border: 1px solid #d5d8dc;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chev { color: var(--muted); font-size: 20px; }
.home-credits { border: 2px solid var(--teal); text-align: center; }
.home-credits > a.btn:not(.line) { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.ink { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.compact {
  width: auto;
  flex: none;
  white-space: nowrap;
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0;
}
.row-actions { display: flex; gap: 8px; flex: none; }
.access-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.access-row p { margin: 0; flex: 1; min-width: 0; }
.access-row .btn { margin-top: 0; }
.gauge {
  width: 150px;
  height: 150px;
  margin: 10px auto 14px;
  border-radius: 50%;
  border: 3px solid var(--teal);
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #fff;
}
.gauge::before {
  content: "";
  position: absolute;
  left: -8%;
  width: 116%;
  bottom: 0;
  height: var(--fill);
  background: var(--liquid, var(--green));
  border-radius: 45% 55% 0 0;
}
.gauge span { position: relative; z-index: 1; font-size: 42px; font-weight: 700; color: var(--teal); }
.gauge-green { --liquid: var(--green); }
.gauge-yellow { --liquid: var(--yellow); }
.gauge-red { --liquid: var(--red); }
.gauge-compact { width: 52px; height: 52px; margin: 0; border-width: 2px; }
.gauge-compact span { font-size: 16px; }
.creditbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.chat-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 4px; }
.chat-meta .creditbar { margin: 0; flex: none; }
.chat-meta .pill { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-line { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.chat-line .badge-ticket-priority { margin: 0; flex: none; }
.chat-oneline { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
.chat-two { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.chat-title,
.chat-sub { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.2; }
.chat-title { font-weight: 700; font-size: 15px; }
.chat-sub { font-weight: 600; font-size: 13px; color: var(--muted); }
.history {
  border: 2px solid var(--teal);
  border-radius: 16px;
  padding: 10px 12px;
  background: #fff;
  min-width: 190px;
}
.history h2 { font-size: 13px; margin: 0 0 8px; color: var(--teal); }
.history .row { font-size: 14px; margin: 4px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.blue { background: #3DB7E8; }
.dot.yellow { background: var(--yellow); }
.dot.pink { background: var(--red); }
.byline { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }
.linkrow { text-align: center; margin-top: 10px; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.ticket-link { flex: 1; min-width: 0; color: inherit; }
.resolved-side { display: flex; align-items: center; gap: 8px; flex: none; }
.card.row .btn.line { margin-top: 0; }
.kind { color: var(--teal); font-weight: 600; font-size: 14px; }
.unread {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}
.pill-open { background: #d4eef8; color: #1a5c78; }
.pill-in_progress { background: #b7dff2; color: #144a64; }
.pill-awaiting { background: #f3dc8a; color: #5c4818; }
.pill-waiting_client { background: #f8edc4; color: #6b5420; }
.pill-waiting_operator { background: #f6d0b8; color: #6b3a1f; }
.pill-resolved { background: #d4f0e0; color: #1c6844; }
.bubble {
  display: inline-block;
  max-width: 80%;
  padding: 6px 10px;
  font-size: 16px;
  line-height: 20px;
  border-radius: 16px;
  margin: 0;
  white-space: pre-wrap;
  text-align: left;
  vertical-align: top;
}
.bubble.mine { background: var(--teal); color: #fff; }
.bubble.theirs { background: #fff; }
.bubble img { display: block; max-width: 220px; max-height: 220px; border-radius: 12px; cursor: pointer; }
#foto-grande {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 20, 24, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#foto-grande[hidden] { display: none; }
#foto-grande img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}
.bubble.mine a { color: #fff; }
.msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 8px 0;
}
.msg.mine { align-items: flex-end; }
.time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.composer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  background: var(--bg);
  padding: 10px 0;
}
.composer input[type="text"] {
  flex: 1;
  min-width: 0;
  width: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 14px;
  font-size: 16px;
}
.composer button.send {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--teal);
  color: #fff;
  flex: none;
}
.composer .clip {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  position: relative;
  color: var(--teal);
  font-size: 22px;
}
.composer .clip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.ops {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.ops .card { padding: 10px 12px; margin: 0; }
.ops label { margin: 0 0 4px; font-size: 12px; }
.ops input, .ops select { padding: 8px 10px; font-size: 16px; }
@media (max-width: 700px) {
  .ops { grid-template-columns: 1fr; }
  .card.row > div,
  .top > div { min-width: 0; }
  .kind.company {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
}
body.operator-chat.ops-open #thread,
body.operator-chat.ops-open .composer,
body.operator-chat.ops-open .creditbar,
body.operator-chat.ops-open .byline,
body.operator-chat.ops-open .chat-meta,
body.operator-chat.ops-open .top .pill { display: none; }
body.operator-chat.ops-open .wrap { padding-bottom: 0; }
body.operator-chat.ops-open .top { margin-bottom: 6px; }
body.operator-chat.ops-open .top > div { flex: 1; min-width: 0; }
body.operator-chat.ops-open .kind,
body.operator-chat.ops-open .chat-oneline,
body.operator-chat.ops-open .chat-title,
body.operator-chat.ops-open .top strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.operator-chat.ops-open .chat-sub { display: none; }
body.operator-chat.ops-open .ops { min-height: 0; overflow-y: auto; }
body.operator-chat .ops,
body.operator-chat .ops .card { background: #FFC0A5; }
body.operator-chat .ops { border-radius: 16px; padding: 10px; }
body.operator-chat .ops .card { box-shadow: none; }
.ops .btn { margin-top: 8px; padding: 8px 6px; font-size: 12px; letter-spacing: 0; }
.ops[hidden],
.ops [hidden] { display: none !important; }
.ops input:disabled { background: #e8eeed; color: var(--muted); }
.ops-toggle {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--teal);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
body.operator-chat {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  overscroll-behavior: none;
}
body.operator .wrap { overflow-x: hidden; }
body.operator .top { min-width: 0; max-width: 100%; }
body.operator .top h1 { flex: none; margin-right: 12px; }
body.operator .nav {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
body.operator .nav a { flex: none; }
body.client-chat {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  overscroll-behavior: none;
}
body.operator-chat .wrap,
body.client-chat .wrap {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 4px;
}
body.operator-chat .byline { margin-top: 8px; margin-bottom: 8px; font-size: 12px; line-height: 1.2; }
body.operator-chat .chat-meta,
body.client-chat .chat-meta { padding: 9px 0; margin-bottom: 2px; }
body.operator-chat a.top { width: 100%; text-decoration: none; color: inherit; }
body.operator-chat .top,
body.client-chat .top { margin-bottom: 6px; gap: 16px; }
body.operator-chat .composer,
body.client-chat .composer { padding: 4px 0 0; }
body.operator-chat .composer input[type="text"],
body.client-chat .composer input[type="text"] {
  height: 40px;
  padding: 0 14px;
  line-height: 38px;
}
body.operator-chat .composer button.send,
body.client-chat .composer button.send,
body.operator-chat .composer .clip,
body.client-chat .composer .clip { width: 40px; height: 40px; margin: 0; }
body.operator-chat .ops-toggle { margin-bottom: 6px; }
body.operator-chat .top,
body.operator-chat .ops,
body.operator-chat .ops-toggle,
body.operator-chat .creditbar,
body.operator-chat .byline,
body.operator-chat .error,
body.client-chat .top,
body.client-chat .creditbar,
body.client-chat #accept-box,
body.operator-chat .composer,
body.client-chat .composer { flex: none; }
body.client-chat .byline { margin-top: 8px; margin-bottom: 8px; font-size: 12px; line-height: 1.2; flex: none; }
body.operator-chat #thread,
body.client-chat #thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.client-chat .composer { flex-direction: column; align-items: stretch; gap: 8px; }
.composer-row { display: flex; gap: 8px; align-items: center; }
.pending-photo {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
}
.pending-photo img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.pending-photo span { flex: 1; font-size: 14px; color: var(--teal); }
.pending-photo button {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
button, input, select, textarea { font-family: inherit; }
label { display: block; font-size: 14px; margin: 12px 0 6px; }
.listino-title { font-weight: 700; font-size: 15px; margin: 18px 0 8px; }
.listino-form label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-weight: 400;
}
.listino-form label.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  flex: none;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  background: #fff;
}
.error { background: #fde8e8; color: #9b1c1c; padding: 10px 12px; border-radius: 12px; }
.pay-card { min-height: 48px; margin: 12px 0; }
.pay-safe { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.pay-wait {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 247, 246, 0.92);
}
.pay-wait[hidden] { display: none; }
.pay-mark { display: flex; align-items: flex-end; gap: 8px; }
.pay-col { display: flex; flex-direction: column-reverse; gap: 8px; }
.pay-col span {
  display: block;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(10px);
  animation-duration: 1.8s;
  animation-timing-function: ease;
  animation-iteration-count: infinite;
}
.pay-col span:nth-child(1) { animation-name: pay-row-1; }
.pay-col span:nth-child(2) { animation-name: pay-row-2; }
.pay-col span:nth-child(3) { animation-name: pay-row-3; }
.pay-col span:nth-child(4) { animation-name: pay-row-4; }
.pay-col:nth-child(1) span:nth-child(1) { background: #feff9b; }
.pay-col:nth-child(1) span:nth-child(2) { background: #ff819f; }
.pay-col:nth-child(1) span:nth-child(3) { background: #cbffc7; }
.pay-col:nth-child(2) span:nth-child(1) { background: #ffcffe; }
.pay-col:nth-child(2) span:nth-child(2) { background: #bfe4f7; }
.pay-col:nth-child(2) span:nth-child(3) { background: #dcd2ff; }
.pay-col:nth-child(2) span:nth-child(4) { background: #c5b8ff; }
.pay-col:nth-child(3) span:nth-child(1) { background: #e8b8d7; }
.pay-col:nth-child(3) span:nth-child(2) { background: #8dbbd2; }
@keyframes pay-row-1 {
  0%, 4% { opacity: 0; transform: translateY(10px); }
  14%, 78% { opacity: 1; transform: translateY(0); }
  90%, 100% { opacity: 0; transform: translateY(10px); }
}
@keyframes pay-row-2 {
  0%, 16% { opacity: 0; transform: translateY(10px); }
  28%, 78% { opacity: 1; transform: translateY(0); }
  90%, 100% { opacity: 0; transform: translateY(10px); }
}
@keyframes pay-row-3 {
  0%, 30% { opacity: 0; transform: translateY(10px); }
  42%, 78% { opacity: 1; transform: translateY(0); }
  90%, 100% { opacity: 0; transform: translateY(10px); }
}
@keyframes pay-row-4 {
  0%, 44% { opacity: 0; transform: translateY(10px); }
  56%, 78% { opacity: 1; transform: translateY(0); }
  90%, 100% { opacity: 0; transform: translateY(10px); }
}
@media (prefers-reduced-motion: reduce) {
  .pay-col span { animation: none; opacity: 1; transform: none; }
}
.nav { display: flex; gap: 14px; font-size: 14px; }
@media (min-width: 900px) {
  body.operator .split { display: grid; grid-template-columns: 320px 1fr; gap: 16px; max-width: 1100px; margin: 0 auto; }
}
