/* Pannello password Clickoso – nessuna dipendenza esterna */

:root {
  --brand: #bb1e10;
  --brand-dark: #961810;
  --brand-ring: rgba(187, 30, 16, 0.22);
  --bg: #f4f4f3;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #5f6670;
  --border: #e1e4e8;
  --field: #fafafa;
  --ok-fg: #166534;
  --ok-bg: #ecfdf3;
  --ok-border: #86efac;
  --warn-fg: #854d0e;
  --warn-bg: #fefce8;
  --warn-border: #fde047;
  --err-fg: #991b1b;
  --err-bg: #fef2f2;
  --err-border: #fca5a5;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  border-top: 4px solid var(--brand);
  overflow: hidden;
}

/* Ingresso della pagina di accesso, come nel vecchio pannello: il riquadro
   parte invisibile e spostato in alto di tutta la sua altezza, scende in
   posizione in 1 s; logo, testo, campi e pulsante compaiono in dissolvenza
   uno dopo l'altro (ritardi 0,4 / 0,6 / 0,8 / 1 s). Solo sulla pagina di
   accesso: la classe card-enter la mette il layout quando $enter è true.
   Disattivato con prefers-reduced-motion (vedi in fondo). */
.card-enter {
  animation: card-enter 1s ease both;
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translate3d(0, -100%, 0);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.card-enter .enter {
  opacity: 0;
  animation: fade-in 1s ease-in forwards;
}

.card-enter .enter-1 {
  animation-delay: 0.4s;
}

.card-enter .enter-2 {
  animation-delay: 0.6s;
}

.card-enter .enter-3 {
  animation-delay: 0.8s;
}

.card-enter .enter-4 {
  animation-delay: 1s;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.card-head {
  text-align: center;
  padding: 28px 24px 8px;
}

.logo {
  display: inline-block;
  line-height: 0;
}

.logo img {
  width: 88px;
  height: 88px;
}

.kicker {
  margin: 14px 0 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

.card-body {
  padding: 16px 24px 24px;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: #faf9f9;
  border-top: 1px solid var(--border);
  font-size: 15px;
}

.colophon {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.lead,
.who,
.note,
.extra,
.hint {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 15px;
}

.who {
  color: var(--text);
  overflow-wrap: anywhere;
}

.note {
  margin-top: 20px;
  font-size: 14px;
}

/* Form */

.form {
  margin-top: 8px;
}

.field {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-ring);
}

.pw {
  position: relative;
}

.pw input {
  padding-right: 88px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
}

.pw-toggle:hover,
.pw-toggle:focus-visible {
  background: var(--brand-ring);
  outline: none;
}

.rules {
  margin: 0 0 18px;
  padding-left: 20px;
  font-size: 14px;
  color: var(--muted);
}

.rules li + li {
  margin-top: 2px;
}

/* Con JavaScript (app.js) ogni requisito mostra un segno: rosso finché non è
   rispettato, verde quando lo è. Senza JavaScript resta l'elenco puntato. */
.rules-live {
  list-style: none;
  padding-left: 0;
}

.rules-live li {
  position: relative;
  padding-left: 24px;
}

.rules-live li::before {
  content: "•";
  position: absolute;
  left: 4px;
  top: 0;
  font-weight: 700;
}

.rules-live .rule-ko {
  color: var(--err-fg);
}

.rules-live .rule-ko::before {
  content: "✗";
}

.rules-live .rule-ok {
  color: var(--ok-fg);
}

.rules-live .rule-ok::before {
  content: "✓";
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  font: inherit;
  font-weight: 600;
  padding: 13px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--brand-ring);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--brand);
  border-color: var(--brand);
}

.btn-secondary:hover {
  background: var(--err-bg);
}

/* Pulsanti che sono link (pagina di riepilogo) */
a.btn {
  display: block;
  text-align: center;
  text-decoration: none;
}

a.btn:hover,
a.btn:focus-visible {
  text-decoration: none;
}

.btn-small {
  display: inline-block;
  width: auto;
  padding: 8px 16px;
  font-size: 14px;
}

/* Stato della casella (spazio occupato, non letti) nel riepilogo */

.status {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  font-size: 15px;
}

.status-line {
  margin: 0;
}

.status-line + .status-line {
  margin-top: 6px;
}

.muted {
  color: var(--muted);
}

/* Barra dello spazio: verde fino all'80%, gialla fino al 90%, rossa oltre
   (soglie low/high nell'attributo del <meter>). */
.meter {
  display: block;
  width: 100%;
  height: 12px;
  margin: 8px 0 10px;
  border: 0;
  border-radius: 6px;
  background: var(--border);
  appearance: none;
  -webkit-appearance: none;
}

.meter::-webkit-meter-bar {
  height: 12px;
  border: 0;
  border-radius: 6px;
  background: var(--border);
}

.meter::-webkit-meter-optimum-value {
  background: #2e8b57;
  border-radius: 6px;
}

.meter::-webkit-meter-suboptimum-value {
  background: #e0a800;
  border-radius: 6px;
}

.meter::-webkit-meter-even-less-good-value {
  background: var(--brand);
  border-radius: 6px;
}

.meter::-moz-meter-bar {
  border-radius: 6px;
}

.meter:-moz-meter-optimum::-moz-meter-bar {
  background: #2e8b57;
}

.meter:-moz-meter-sub-optimum::-moz-meter-bar {
  background: #e0a800;
}

.meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
  background: var(--brand);
}

.inline {
  display: inline;
  margin: 0;
}

.link-button {
  font: inherit;
  font-weight: 600;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  cursor: pointer;
}

.link-button:hover,
.link-button:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* Messaggi */

.alert {
  margin: 4px 0 16px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 15px;
}

.alert p {
  margin: 0;
}

.alert p + p {
  margin-top: 6px;
}

.alert-error {
  color: var(--err-fg);
  background: var(--err-bg);
  border-color: var(--err-border);
}

.alert-success {
  color: var(--ok-fg);
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.alert-warning {
  color: var(--warn-fg);
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

@media (max-width: 420px) {
  .card-head {
    padding: 22px 18px 6px;
  }

  .card-body {
    padding: 12px 18px 20px;
  }

  .card-foot {
    padding: 12px 18px;
  }

  h1 {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }

  /* Senza animazione gli elementi devono restare visibili. */
  .card-enter .enter {
    opacity: 1;
  }
}

/* Ora dell'ultima lettura IMAP e link «Aggiorna» */

.status-meta {
  margin: 8px 0 0;
  font-size: 13px;
}

/* Parametri per i programmi di posta (riepilogo): riquadro richiudibile */

.client {
  margin: 18px 0 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.client summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--brand);
  list-style: none;
}

.client summary::-webkit-details-marker {
  display: none;
}

.client summary::before {
  content: "\25B8";
  display: inline-block;
  width: 1em;
  margin-right: 6px;
  transition: transform 0.15s;
}

.client[open] summary::before {
  transform: rotate(90deg);
}

.client summary:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--brand-ring);
  border-radius: 8px;
}

.client-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 14px;
}

.client-table th,
.client-table td {
  padding: 8px 14px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--border);
}

.client-table th {
  width: 44%;
  font-weight: 600;
  color: var(--muted);
}

.client-table td {
  overflow-wrap: anywhere;
}

.client-note {
  margin: 0;
  padding: 10px 14px 12px;
  font-size: 13px;
  border-top: 1px solid var(--border);
}

.client-intro {
  margin: 0;
  padding: 0 14px 10px;
  font-size: 14px;
}

/* Alias della casella (riepilogo e pagine di aggiunta/eliminazione) */

.section-title {
  margin: 22px 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.alias-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.alias-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 15px;
}

.alias-list li + li {
  border-top: 1px solid var(--border);
}

.alias-address {
  overflow-wrap: anywhere;
}

.alias-delete {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.alias-counter {
  margin: 0 0 2px;
  font-size: 15px;
}

.small {
  font-size: 13px;
}

.btn-disabled {
  display: block;
  text-align: center;
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group input {
  flex: 1 1 auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.suffix {
  display: flex;
  align-items: center;
  max-width: 55%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--field);
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}
