/* Area personale — dashboard circolazione.
   Tessera: altezza dal contenuto (niente aspect-ratio fisso) così il barcode
   resta sempre visibile — è il dato principale al bancone. */

body.area-utente {
  background:
    radial-gradient(ellipse 80% 45% at 8% -8%, rgba(221, 197, 157, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 40% at 96% 4%, rgba(12, 53, 114, 0.09), transparent 50%),
    linear-gradient(180deg, #f3f5fb 0%, #eef1f8 40%, #f7f8fc 100%);
  min-height: 100vh;
}

/* .au-panel { display:flex } must not defeat [hidden] */
.au-page [hidden],
.au-panel[hidden],
#au-app[hidden],
#au-login-needed[hidden],
#au-loading[hidden],
#au-hero-actions[hidden],
.au-card-shell[hidden],
.au-card-pending[hidden],
.au-card-text[hidden] {
  display: none !important;
}

.au-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.au-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin: 0 0 1.35rem;
  animation: au-rise 0.4s ease-out both;
}

.au-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--scrinio-brown);
}

.au-hero h1 {
  margin: 0 0 0.4rem;
  font-family: var(--dl-font-display);
  font-size: clamp(1.7rem, 3.2vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--scrinio-blue-deep);
  line-height: 1.15;
}

.au-lead {
  margin: 0;
  max-width: 36rem;
  color: var(--dl-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.au-lead a {
  color: var(--scrinio-blue);
  font-weight: 650;
  text-decoration: none;
}

.au-lead a:hover {
  text-decoration: underline;
}

.au-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.au-loading {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem 1.15rem;
  margin: 0 0 1.25rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--dl-line);
  border-radius: 10px;
  color: var(--dl-muted);
}

.au-loading-pulse {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: var(--scrinio-blue);
  animation: au-pulse 1s ease-in-out infinite;
}

.au-gate {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0 2rem;
}

.au-gate-card {
  width: min(26rem, 100%);
  text-align: center;
  padding: 2rem 1.5rem;
  background: #fff;
  border: 1px solid var(--dl-line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(8, 38, 79, 0.08);
}

.au-gate-icon {
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 1rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--scrinio-light);
  color: var(--scrinio-blue);
}

.au-gate-card h2 {
  margin: 0 0 0.45rem;
  color: var(--scrinio-blue-deep);
  font-size: 1.25rem;
}

.au-gate-card p {
  margin: 0 0 1.15rem;
  color: var(--dl-muted);
  line-height: 1.5;
}

/* KPI strip */
.au-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
  animation: au-rise 0.45s ease-out 0.05s both;
}

.au-stat {
  appearance: none;
  border: 1px solid rgba(213, 220, 235, 0.95);
  border-radius: 12px;
  padding: 1rem 0.9rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.au-stat:hover {
  transform: translateY(-2px);
  border-color: rgba(12, 53, 114, 0.3);
  box-shadow: 0 10px 24px rgba(8, 38, 79, 0.08);
}

.au-stat-value {
  display: block;
  font-family: var(--dl-font-display);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--scrinio-blue-deep);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.au-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dl-muted);
}

.au-stat--ready .au-stat-value { color: #1a6b4a; }
.au-stat--queue .au-stat-value { color: var(--scrinio-brown-deep); }
.au-stat--hist .au-stat-value { color: #4a5568; }

/* Dashboard grid */
.au-dash {
  display: grid;
  /* Colonna tessera un po’ più larga: barcode CODE128 leggibile */
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
  animation: au-rise 0.5s ease-out 0.08s both;
}

.au-dash-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 5.5rem;
}

.au-dash-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.au-section-head {
  margin: 0 0 0.75rem;
}

.au-section-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--scrinio-blue-deep);
}

.au-card-wrap {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(213, 220, 235, 0.9);
  border-radius: 14px;
  overflow: visible;
}

/* Physical library-card simulation — altezza = contenuto (barcode sempre in vista) */
.au-card-shell {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0;
  overflow: visible;
}

.au-card-face {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 14px;
  padding: 0.85rem 0.95rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.55rem;
  color: #fff;
  background:
    linear-gradient(155deg, #0e3c82 0%, #0a2a5c 42%, #12407a 72%, #0c3572 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 16px 32px rgba(8, 38, 79, 0.34),
    0 2px 6px rgba(8, 38, 79, 0.18);
  /* Contiene angoli e barcode: altezza dal contenuto, niente clip del codice */
  overflow: hidden;
  isolation: isolate;
}

.au-card-face::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 100% 0%, rgba(221, 197, 157, 0.28), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(255, 255, 255, 0.08), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Left accent edge (library brand band) */
.au-card-stripe {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0.38rem;
  background: linear-gradient(
    180deg,
    var(--scrinio-brown) 0%,
    #e8d5a8 45%,
    var(--scrinio-brown-deep) 100%
  );
  z-index: 1;
}

.au-card-hologram {
  position: absolute;
  right: 0.7rem;
  top: 0.7rem;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(221, 197, 157, 0.55), rgba(255, 255, 255, 0.15) 40%, rgba(120, 180, 255, 0.35) 70%, rgba(221, 197, 157, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 12px rgba(221, 197, 157, 0.25);
  z-index: 2;
  opacity: 0.8;
  pointer-events: none;
}

.au-card-face-top,
.au-card-face-mid,
.au-card-face-bot {
  position: relative;
  z-index: 2;
}

.au-card-face-top {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding-left: 0.2rem;
  padding-right: 2.2rem;
}

.au-card-chip {
  flex: 0 0 auto;
  width: 2.15rem;
  height: 1.65rem;
  margin-top: 0.15rem;
  border-radius: 4px;
  background:
    linear-gradient(145deg, #e8d5a8 0%, #c9a96a 35%, #f0e0b8 55%, #b8924a 100%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  position: relative;
  overflow: hidden;
}

.au-card-chip::before,
.au-card-chip::after {
  content: "";
  position: absolute;
  background: rgba(90, 70, 30, 0.35);
}

.au-card-chip::before {
  left: 20%;
  right: 20%;
  top: 48%;
  height: 1px;
}

.au-card-chip::after {
  top: 18%;
  bottom: 18%;
  left: 48%;
  width: 1px;
}

.au-card-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.au-card-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.au-card-lib {
  margin: 0;
  font-weight: 750;
  font-size: 0.78rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.au-card-text {
  margin: 0.1rem 0 0;
  font-size: 0.62rem;
  opacity: 0.82;
  line-height: 1.3;
}

.au-card-kicker {
  margin: 0.12rem 0 0;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
}

.au-card-face-mid {
  margin-top: 0;
  padding-top: 0.15rem;
  padding-left: 0.2rem;
  padding-right: 0.15rem;
  flex: 0 0 auto;
}

.au-card-field-label {
  margin: 0 0 0.12rem;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.62;
}

.au-card-name {
  margin: 0 0 0.45rem;
  font-family: var(--dl-font-display);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Fascia barcode: blocco principale (scansionabile al bancone).
   Il numero leggibile sta sotto al barcode (.au-card-code-label), non ripetuto sopra. */
.au-card-face-bot {
  margin-top: 0.15rem;
  flex: 0 0 auto;
  background: #fff;
  border-radius: 8px;
  padding: 0.55rem 0.6rem 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.25rem;
  min-height: 4.25rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.au-card-face-bot svg {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: 58px !important;
}

.au-card-face-bot canvas {
  display: block;
  margin: 0 auto;
  width: 96px !important;
  height: 96px !important;
}

.au-card-code-label {
  margin: 0;
  text-align: center;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #0c3572;
}

.au-card-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--dl-muted);
  line-height: 1.4;
  text-align: center;
}

/* Pending / ghost card */
.au-card-shell--pending .au-card-face--ghost {
  background:
    linear-gradient(155deg, #6b7a94 0%, #4a5568 45%, #5c6b82 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 10px 22px rgba(8, 38, 79, 0.14);
  opacity: 0.88;
}

.au-card-shell--pending .au-card-stripe {
  opacity: 0.55;
}

.au-card-ghost-logo {
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px dashed rgba(255, 255, 255, 0.35);
}

.au-card-ghost-line {
  display: block;
  height: 0.55rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  margin-bottom: 0.45rem;
}

.au-card-ghost-line--name {
  width: 62%;
  height: 0.85rem;
}

.au-card-ghost-line--num {
  width: 78%;
  margin-bottom: 0;
}

.au-card-ghost-bar {
  display: block;
  width: 100%;
  height: 1.6rem;
  border-radius: 4px;
  background: repeating-linear-gradient(
    90deg,
    rgba(12, 53, 114, 0.35) 0 2px,
    transparent 2px 4px
  );
  opacity: 0.45;
}

.au-card-pending-msg {
  margin: 0;
  padding: 0.55rem 0.65rem;
  background: #fff8ef;
  border: 1px solid rgba(184, 146, 74, 0.35);
  border-radius: 8px;
  color: var(--dl-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.au-card-pending-msg strong {
  color: var(--scrinio-blue-deep);
}

.au-quick {
  padding: 1rem 1.05rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--dl-line);
  border-radius: 14px;
}

.au-quick h2 {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--scrinio-blue);
}

.au-quick a {
  display: block;
  padding: 0.55rem 0.15rem;
  border-top: 1px solid rgba(213, 220, 235, 0.85);
  color: var(--scrinio-blue-deep);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.au-quick a:first-of-type {
  border-top: 0;
}

.au-quick a:hover {
  color: var(--scrinio-blue);
}

.au-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 14rem;
  padding: 1.05rem 1.1rem 1.1rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(213, 220, 235, 0.95);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(8, 38, 79, 0.03);
}

.au-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.au-panel h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 750;
  color: var(--scrinio-blue-deep);
}

.au-panel-desc {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--dl-muted);
  line-height: 1.4;
}

.au-badge {
  flex: 0 0 auto;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--scrinio-blue);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.au-badge--ready { background: #1a6b4a; }
.au-badge--queue { background: var(--scrinio-brown-deep); }
.au-badge--muted { background: #6b7385; }

.au-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.au-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--dl-line);
  border-radius: 10px;
  background: #fff;
}

.au-item-main {
  min-width: 0;
  flex: 1;
}

.au-item h3 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--scrinio-blue-deep);
  line-height: 1.3;
}

.au-item h3 a {
  color: inherit;
  text-decoration: none;
}

.au-item h3 a:hover {
  text-decoration: underline;
}

.au-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--dl-muted);
  line-height: 1.4;
}

.au-due {
  flex: 0 0 auto;
  text-align: right;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: var(--scrinio-light);
  min-width: 5.5rem;
}

.au-due-hint {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 0.15rem;
}

.au-due strong {
  font-size: 0.78rem;
  font-weight: 750;
}

.au-due--ok {
  background: #e8f5ef;
  color: #1a6b4a;
}

.au-due--soon {
  background: #fff4e5;
  color: #9a5b00;
}

.au-due--late {
  background: #fdecee;
  color: #a12030;
}

.au-empty {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem 0.35rem;
  color: var(--dl-muted);
  font-size: 0.88rem;
}

.au-empty-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #c5ccd9;
  flex: 0 0 auto;
}

.au-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--dl-radius);
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  background: var(--scrinio-blue);
  color: #fff;
  text-decoration: none;
  transition: filter 0.15s;
}

.au-btn:hover {
  filter: brightness(1.08);
  color: #fff;
}

.au-btn-secondary {
  background: #fff;
  color: var(--scrinio-blue-deep);
  border: 1px solid rgba(12, 53, 114, 0.28);
}

.au-btn-secondary:hover {
  background: var(--scrinio-light);
  filter: none;
  color: var(--scrinio-blue-deep);
}

.au-item .au-btn {
  flex: 0 0 auto;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}

.au-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes au-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes au-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 960px) {
  .au-dash {
    grid-template-columns: 1fr;
  }

  .au-dash-side {
    position: static;
  }

  .au-dash-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .au-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
