:root {
  --bg: #000000;
  --header: #0a0a0a;
  --header-deep: #000000;
  --card: #141414;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --ok: #16a34a;
  --no: #e11d48;
  --line: #2a2a2a;
  --accent: #38bdf8;
  --btn: #0284c7;
  --input: #1a1a1a;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  color-scheme: dark;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sync-bar {
  margin: 0.45rem 0 0;
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  background: #422006;
  border: 1px solid #f59e0b;
  color: #fde68a;
  font-size: 0.78rem;
  font-weight: 700;
}

.sync-bar.is-send {
  background: #082f49;
  border-color: #38bdf8;
  color: #bae6fd;
}

.screen {
  min-height: 100dvh;
}

.login-card {
  max-width: 420px;
  margin: 0 auto;
  padding: calc(2.5rem + var(--safe-top)) 1.4rem 2rem;
}

.login-mark {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.9rem;
  object-fit: cover;
  display: block;
  background: #000;
}

.login-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1rem 0 0.2rem;
}

.login-title-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.login-card h1 {
  margin: 0;
  font-size: 1.6rem;
}

.btn-account {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.btn-account svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.login-sub,
.login-hint,
.who,
.detail-meta {
  color: var(--muted);
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.85rem 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.pass-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  width: 100%;
}

.pass-wrap input {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  padding-right: 0.85rem;
}

.pass-wrap input::-ms-reveal,
.pass-wrap input::-ms-clear {
  display: none;
}

.pass-toggle {
  flex: 0 0 2.85rem;
  width: 2.85rem;
  min-width: 2.85rem;
  align-self: stretch;
  display: grid;
  place-items: center;
  border: 0;
  background: #0284c7;
  color: #fff;
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pass-toggle svg {
  width: 1.45rem;
  height: 1.45rem;
  display: block;
  pointer-events: none;
}

.pass-toggle:hover,
.pass-toggle:focus-visible {
  background: #0369a1;
}

.popup-account .pass-toggle {
  background: #0f766e;
  color: #fff;
}

.popup-account .pass-toggle:hover,
.popup-account .pass-toggle:focus-visible {
  background: #0d9488;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  border-radius: 12px;
  padding: 0.78rem 0.85rem;
  font-size: 1rem;
}

.btn,
.btn-ghost,
.icon-nav,
.row-open {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.9rem;
  background: var(--btn);
  color: #fff;
  font-size: 1rem;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 0.4rem 0.55rem;
}

.top .btn-ghost {
  color: #fff;
}

.error {
  color: #fecaca;
  background: #3f1d1d;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.88rem;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--header);
  color: #fff;
  padding: calc(0.7rem + var(--safe-top)) 1rem 0.75rem;
  border-bottom: 1px solid var(--header-deep);
}

.top .who,
.top .detail-meta {
  color: #d4d4d4;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.top-logo {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 8px;
  object-fit: cover;
  background: #000;
  flex-shrink: 0;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.who {
  font-size: 0.78rem;
  margin-top: 0.1rem;
}

.btn-top-icon,
.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.btn-top-icon svg,
.btn-logout svg {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
}

.top-actions .btn-top-icon,
.top-actions .btn-logout {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.top-actions .btn-top-icon:hover,
.top-actions .btn-top-icon:focus-visible,
.top-actions .btn-logout:hover,
.top-actions .btn-logout:focus-visible,
.login-title-actions .btn-account:hover,
.login-title-actions .btn-account:focus-visible {
  background: transparent;
  border: 0;
  opacity: 0.8;
}

.btn-update {
  color: #a3a3a3;
}

.btn-update.is-new {
  background: transparent;
  border: 0;
  color: #f59e0b;
  animation: update-pulse 1.4s ease-in-out infinite;
}

.login-card .btn-update.is-new {
  background: transparent;
  border: 0;
  color: #f59e0b;
}

@keyframes update-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.update-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.72);
}

.update-card {
  width: min(22rem, 100%);
  background: #141414;
  border: 1px solid #f59e0b;
  border-radius: 16px;
  padding: 1.1rem 1.15rem 1.2rem;
  color: #f5f5f5;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.update-card h3 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  color: #fbbf24;
}

.update-phase {
  margin: 0.55rem 0 0.3rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e5e5e5;
}

.update-track {
  height: 0.72rem;
  border-radius: 999px;
  background: #2a2a2a;
  overflow: hidden;
}

.update-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #f59e0b;
  transition: width 0.25s ease;
}

.update-pct,
.update-status {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #a3a3a3;
}

.update-status {
  margin-top: 0.85rem;
}

.date-row {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  margin: 0;
  min-width: 0;
}

.date-row input {
  width: auto;
  min-width: 8.4rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 8px;
}

.icon-nav {
  width: 1.85rem;
  height: 1.85rem;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.15rem;
  flex: 0 0 auto;
  border-radius: 8px;
}

.btn-oggi {
  white-space: nowrap;
  flex: 0 0 auto;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.toolbar-icons {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.7rem;
  padding: 0;
  background: transparent;
}

.tool-icon {
  position: relative;
  flex: 1 1 0;
  display: inline-grid;
  place-items: center;
  width: auto;
  min-width: 0;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #bae6fd;
  color: #0c4a6e;
  cursor: pointer;
}

.tool-icon svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.tool-icon:active {
  transform: scale(0.96);
}

.tool-icon-date .tool-date-num {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  color: #0c4a6e;
  pointer-events: none;
}

.pick-list {
  display: grid;
  gap: 0.45rem;
}

.pick-item {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pick-orario {
  flex: 0 0 auto;
  color: #0369a1;
  font-variant-numeric: tabular-nums;
}

.pick-item.is-on .pick-orario {
  color: #111;
}

.pick-item.is-on {
  background: #f59e0b;
  border-color: #fbbf24;
  color: #111;
}

.data-popup-label {
  margin: 0 0 0.75rem;
  font-weight: 700;
  color: #0f172a;
}

.date-row-popup {
  width: 100%;
  justify-content: space-between;
}

.date-row-popup input {
  flex: 1;
  min-width: 0;
}

.app-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #d4d4d4;
}

.app-pick select {
  width: auto;
  min-width: 7.5rem;
  max-width: 12rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #1a1a1a;
  color: #f5f5f5;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
}

.ore-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.7rem;
  margin-top: 0.6rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #22c55e;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.ore-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #d4d4d4;
}

.ore-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ore-controls input {
  width: 4.4rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: #1a1a1a;
  color: #f5f5f5;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
}

.ore-unit {
  font-size: 0.82rem;
  font-weight: 700;
  color: #d4d4d4;
}

.ore-state {
  margin-left: 0.15rem;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 700;
  color: #d4d4d4;
}

.ore-state.is-ok {
  color: #9ae6b4;
}

.ore-state.is-err {
  color: #f8b4b4;
}

.search-row {
  margin-top: 0.55rem;
}

.search-row input {
  width: 100%;
}

.stats {
  display: none;
}

.group-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  margin: 0.5rem 0 0;
}

.group-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: baseline;
  font-size: 0.82rem;
  color: #d4d4d4;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.btn-part {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid #38bdf8;
  border-radius: 12px;
  background: #0ea5e9;
  color: #fff;
  cursor: pointer;
}

.btn-part svg {
  width: 1.35rem;
  height: 1.35rem;
}

.btn-part:active {
  transform: scale(0.96);
}

.group-summary strong {
  color: #f59e0b;
  margin-right: 0.15rem;
}

.group-summary .orario {
  color: #bae6fd;
  font-weight: 700;
}

.turno-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.45rem 0 0;
}

.btn-turno {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
}

.turno-popup-body {
  display: grid;
  gap: 0.75rem;
}

.turno-popup-body label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
}

.turno-popup-body select {
  width: 100%;
  min-height: 2.4rem;
}

.stats .ok {
  color: #9ae6b4;
}

.stats .no {
  color: #f8b4b4;
}

.list {
  padding: 0.4rem 0.7rem calc(1.2rem + var(--safe-bot));
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
  width: 100%;
  text-align: left;
  background: #e5e7eb;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 0.45rem 0.5rem 0.45rem 0.7rem;
  margin: 0.4rem 0;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.row.is-on {
  background: #86efac !important;
  border-color: #22c55e !important;
}

.prova-mark {
  flex: 0 0 auto;
  color: #dc2626;
  font-family: "Arial Black", Arial, Helvetica, sans-serif;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  -webkit-text-stroke: 0.45px currentColor;
  paint-order: stroke fill;
}

.row .prova-mark {
  font-size: 1.76rem;
}

.nome {
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
  overflow: visible;
  color: #000;
  flex-wrap: nowrap;
}

.row-phones,
.detail-phones-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  margin: 0;
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0;
}

.nome .row-phones {
  flex: 1 1 auto;
  min-width: 7rem;
}

.nome-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #000;
}

.num {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: #000;
}

.row-info {
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  padding: 0;
  min-width: 0;
  min-height: 2.35rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: manipulation;
}

.row-icons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.28rem;
  flex: 0 0 auto;
}

.row-phones,
.detail-phones-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.2rem;
}

.phone-link {
  color: #0369a1;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.phone-link:active,
.phone-link:hover {
  text-decoration: underline;
  color: #075985;
}

.detail-phones-line .phone-link,
.detail .phone-link {
  color: #7dd3fc;
}

.detail-phones-line .phone-link:hover,
.detail .phone-link:hover {
  color: #bae6fd;
}

.detail-phones {
  margin: 0.15rem 0 0;
}

.detail-phones.hidden {
  display: none;
}

.row-cal {
  width: 2.15rem;
  height: 2.15rem;
  border: 2px solid #fff;
  border-radius: 8px;
  background: #0ea5e9;
  color: #f0f9ff;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.row-cal svg {
  width: 1.2rem;
  height: 1.2rem;
}

.row-bell {
  width: 2.15rem;
  height: 2.15rem;
  border: 2px solid #fff;
  border-radius: 8px;
  background: #facc15;
  color: #713f12;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.row-bell svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.row-warn {
  width: 2.15rem;
  height: 2.15rem;
  border: 2px solid #fff;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
}

.row-warn svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.cert-badge {
  pointer-events: auto;
  cursor: pointer;
  color: #fff;
  border: none;
  padding: 0;
}

.row-warn-cert-ago {
  background: #dc2626;
}

.row-warn-cert-nago {
  background: #2563eb;
}

.row-warn-cert {
  background: #dc2626;
  color: #fff;
}

.row-warn-tess {
  background: #ea580c;
  color: #fff;
}

.tess-badge {
  pointer-events: auto;
  cursor: pointer;
  padding: 0.12rem;
  background: #fff;
  color: #0f172a;
  overflow: hidden;
}

.tess-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.popup {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(30, 30, 30, 0.45);
  display: grid;
  place-items: center;
  padding: 1.2rem;
  color-scheme: light;
}

.popup-card {
  width: min(28rem, 100%);
  max-height: min(70dvh, 32rem);
  overflow: auto;
  background: #fefce8;
  border: 1px solid #facc15;
  color: #0f172a;
  border-radius: 16px;
  padding: 0.9rem 1rem 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.popup input,
.popup select {
  background: #fff;
  color: #0f172a;
  border-color: #7dd3fc;
}

.popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.popup-head h3 {
  margin: 0;
  font-size: 1rem;
}

.popup-close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0f172a;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.popup-partecipanti {
  display: flex;
  flex-direction: column;
  width: min(22rem, 100%);
  max-height: min(78dvh, 36rem);
  overflow: hidden;
  background: #fff;
  border: 1px solid #7dd3fc;
}

.popup-partecipanti .popup-head {
  flex-shrink: 0;
  margin-bottom: 0.45rem;
}

.popup-back {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0f172a;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

#part-popup-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 0.15rem;
}

.part-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr));
  gap: 0.65rem;
}

.part-card {
  appearance: none;
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.part-card:active {
  transform: scale(0.97);
}

.part-card-logo,
.part-card-fallback {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.part-card-fallback {
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.78rem;
  font-weight: 800;
}

.part-card-count {
  position: absolute;
  top: 0.28rem;
  right: 0.28rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #0ea5e9;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.part-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.42rem 0.15rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.88rem;
  font-weight: 700;
}

.part-row:first-child {
  border-top: 0;
}

.part-name {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.part-empty {
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.85rem;
}

.popup-confirm {
  background: #fff;
  border: 1px solid #7dd3fc;
}

.popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1rem;
}

.popup-actions .btn,
.popup-actions .btn-primary {
  width: auto;
  margin: 0;
  padding: 0.65rem 1.05rem;
}

.popup-account {
  background: #fff;
  border: 1px solid #7dd3fc;
}

.account-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 0.7rem;
}

.account-tab {
  flex: 1;
  border: 1px solid #7dd3fc;
  background: #f8fafc;
  color: #475569;
  border-radius: 10px;
  padding: 0.45rem 0.4rem;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.account-tab.is-on {
  background: #0284c7;
  border-color: #0284c7;
  color: #fff;
}

.popup-account label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.55rem 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.popup .error {
  color: #7f1d1d;
  background: #f3d6d6;
}

.popup .ok-msg {
  color: #166534;
  background: #dcfce7;
}

.account-hint {
  margin: 0.2rem 0 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.ok-msg {
  color: #bbf7d0;
  background: #14532d;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.88rem;
}

.com-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.com-item:last-child {
  border-bottom: 0;
}

.com-item strong {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

.com-item span {
  display: block;
  margin-top: 0.15rem;
}

.row-open {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  background: #0ea5e9;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 0;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  flex: 0 0 auto;
}

.row-open svg {
  width: 1.28rem;
  height: 1.28rem;
  display: block;
}

.detail {
  padding: 0.85rem 1rem calc(1.5rem + var(--safe-bot));
}

.detail h2 {
  margin: 0.35rem 0 0.15rem;
  font-size: 1.35rem;
}

.detail h2 .prova-mark {
  margin-left: 0.35rem;
  color: #f43f5e;
  font-size: 0.88em;
  font-weight: 900;
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 0.85rem 0.9rem;
  margin: 0.7rem 0;
}

.card-com {
  background: #3f2e0a;
  border: 1px solid #ca8a04;
}

.card h3 {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.kv,
.tess-item,
.pres-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.kv:last-child,
.tess-item:last-child,
.pres-item:last-child {
  border-bottom: 0;
  padding-bottom: 0.1rem;
}

.pres-item span:last-child {
  font-weight: 700;
  white-space: nowrap;
}

.pct-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.pct-cell {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 0.55rem 0.4rem;
  text-align: center;
  display: grid;
  gap: 0.15rem;
}

.pct-cell span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.pct-cell strong {
  font-size: 1.05rem;
}

.pct-cell em {
  font-style: normal;
  font-weight: 800;
  color: var(--accent);
}

.kv-text,
.tess-meta {
  min-width: 0;
  flex: 1;
}

.tess-item {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: center;
}

.tess-logo-btn {
  width: 2.85rem;
  height: 2.85rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.tess-popup-logo {
  display: block;
  width: 4.2rem;
  height: 4.2rem;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 0.25rem;
  margin: 0 0 0.65rem;
}

.popup .kv .badge {
  margin-left: auto;
}

.popup-tipo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  min-height: 1.55rem;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.78rem;
  color: #fff;
}

.popup-tipo-chip.is-ago {
  background: #dc2626;
}

.popup-tipo-chip.is-nago {
  background: #2563eb;
}

.tess-logo {
  width: 2.85rem;
  height: 2.85rem;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 0.18rem;
}

.tess-logo-fallback {
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  color: #0f172a;
}

.tess-meta strong,
.kv-text strong {
  display: block;
  font-size: 0.92rem;
}

.tess-meta small,
.kv-text small {
  color: var(--muted);
  font-size: 0.78rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 1.55rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.badge.no {
  background: #fee2e2;
  color: #991b1b;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.login-hint {
  margin-top: 1.2rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

.cal-app-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.screen-cal {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen-cal .top {
  position: relative;
  flex: 0 0 auto;
}

.cal-mode-toggle {
  display: flex;
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.15rem;
  gap: 0.15rem;
}

.cal-mode-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: #e5e5e5;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.4rem 0.35rem;
  border-radius: 8px;
}

.cal-mode-btn.is-on {
  background: #fff;
  color: #0f172a;
}

.cal-app-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0.4rem 0.45rem calc(0.45rem + var(--safe-bot));
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.cal-app-body.is-week {
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 0.28rem;
}

.cal-app-body.is-month {
  display: block;
}

.cal-week-day {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.28rem 0.45rem 0.32rem;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cal-week-day.is-today {
  border-color: var(--accent);
}

.cal-week-day.is-festa,
.cal-month-cell.is-festa {
  background: #3f1212;
  border-color: #dc2626;
}

.cal-week-day.is-festa.is-today,
.cal-month-cell.is-festa.is-today {
  border-color: #fca5a5;
}

.cal-week-head {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  text-align: left;
  padding: 0 0 0.18rem;
  text-transform: capitalize;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 0 auto;
}

.cal-week-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-event-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
  border: 0;
  color: #fff;
  font: inherit;
  text-align: left;
  border-radius: 6px;
  padding: 0.18rem 0.4rem;
  margin-top: 0.16rem;
  overflow: hidden;
}

.cal-event-time {
  flex: 0 0 auto;
  max-width: 4.4rem;
  color: inherit;
  opacity: 0.92;
  font-size: 0.68rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-event-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-month-grid {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(6, minmax(0, 1fr));
  gap: 0.16rem;
}

.cal-month-dow {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--muted);
  padding: 0.08rem 0;
}

.cal-month-cell {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  border-radius: 6px;
  padding: 0.12rem 0.12rem 0.14rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.08rem;
  text-align: left;
  overflow: hidden;
}

.cal-month-cell.is-out {
  opacity: 0.42;
}

.cal-month-cell.is-today {
  border-color: var(--accent);
}

.cal-month-num {
  font-size: 0.68rem;
  font-weight: 800;
  flex: 0 0 auto;
  line-height: 1;
}

.cal-month-chip,
.cal-month-more {
  display: block;
  width: 100%;
  min-width: 0;
  font-size: 0.52rem;
  font-weight: 700;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 3px;
  padding: 0.05rem 0.16rem;
  color: #fff;
}

.popup-cal {
  padding: 0.75rem;
  display: grid;
  place-items: center;
  align-content: center;
  justify-items: center;
}

.popup-cal .popup-card {
  width: calc(100vw - 1.5rem);
  max-width: none;
  height: auto;
  max-height: none;
  overflow: visible;
  border-radius: 16px;
  padding: 0.85rem 0.85rem 1rem;
  margin: 0;
  align-self: center;
  justify-self: center;
}

.popup-cal .popup-head h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

#cal-event-popup-body {
  overflow: visible;
  height: auto;
}

.popup-cal .cal-event-row {
  margin-top: 0.35rem;
}

.popup-cal .cal-kv {
  grid-template-columns: 5.4rem minmax(0, 1fr);
}

.popup-cal .cal-kv dt {
  color: #64748b;
}

.popup-cal .cal-kv dd {
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.cal-kv {
  display: grid;
  grid-template-columns: 6.2rem 1fr;
  gap: 0.25rem 0.6rem;
  font-size: 0.9rem;
  margin: 0.35rem 0;
}

.cal-kv dt {
  color: var(--muted);
  font-weight: 700;
}

.cal-kv dd {
  margin: 0;
  font-weight: 650;
}
