/* BLOOM University: navy + panna + arancione dal logo varsity. Titoli in Graduate, testo in Manrope */
:root {
  --bg: #202c48;
  --surface: #283659;
  --surface-2: #314069;
  --surface-3: #3a4b77;
  --line: #45578a;
  --text: #f2f1ee;
  --muted: #aab3cb;
  --dim: #7884a3;
  /* accento bordeaux #780000 (prima arancione #e58701, logo originale in brand/logo-arancione) */
  --orange: #780000;
  --orange-hi: #e0605c; /* versione chiara per testi e contorni su navy, leggibile */
  --orange-deep: #3d0000;
  --lime: var(--orange-hi);
  --lavender: #f2a3a0;
  --mint: #9fd7b4;
  --danger: #ff9b8f;
  --grad: linear-gradient(180deg, #8f0b0b 0%, #780000 100%);
  --grad-bar: linear-gradient(90deg, #780000 0%, #c23a36 100%);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --varsity: "Graduate", "Rockwell", Georgia, serif;
  color-scheme: dark;
}
.island { background: var(--surface) !important; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); min-height: 100dvh;
  font-family: Manrope, system-ui, sans-serif; font-feature-settings: "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
}
/* trama a tessuto, come lo sfondo del logo */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.018) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(45deg, rgba(0,0,0,.05) 0 1px, transparent 1px 5px),
    radial-gradient(80% 60% at 50% 0%, rgba(255,255,255,.05), transparent 70%);
}
#app { position: relative; z-index: 1; }
[hidden] { display: none !important; }
::selection { background: var(--orange); color: #fff; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 12px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h2 { font-family: var(--varsity); font-size: 20px; font-weight: 400; letter-spacing: .02em; text-transform: uppercase; }
h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.5; }
.label { font-size: 12px; color: var(--muted); letter-spacing: .01em; }
.err { color: var(--danger); font-size: 14px; min-height: 1em; margin: 6px 0 0; }

.screen { padding: 20px 16px 48px; max-width: 1120px; margin: 0 auto; }
.center { min-height: 100dvh; display: grid; place-items: center; }
/* accesso: sfondo rosso a griglia (scurito), fisso dietro a tutto */
#login { max-width: none; position: relative; z-index: 1; }
/* accesso: sfondo rosso a griglia (scurito) + libro 3D che ci cade sopra, sotto il modulo */
#book3d {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: #e9e7e3 url("/bg-login.jpg?v=1791333450") center / cover no-repeat;
}
#book3d canvas { position: relative; z-index: 0; display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 250ms ease; }
/* un solo strato che scurisce sfondo E libro: stessa tinta per tutti e due */
#book3d::after { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(0, 0, 0, .16); }
#book3d.ready canvas { opacity: 1; }
#login .card {
  /* foglio a quadretti chiaro: il modulo diventa una carta navy */
  background: rgba(32, 44, 72, .94); border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .06), 0 22px 50px -18px rgba(20, 24, 40, .55);
}
#login input { background: rgba(0, 0, 0, .22); }
#login input:focus { background: rgba(0, 0, 0, .3); border-color: rgba(255, 255, 255, .18); }
#login .label, #login .link { color: #c3cbe0; }
/* link legali in un riquadro navy come il modulo di accesso */
#login .legal-links {
  width: fit-content; margin: 14px auto 0; padding: 9px 16px; border-radius: 14px; color: #c3cbe0;
  background: rgba(32, 44, 72, .94); border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .06), 0 12px 28px -14px rgba(20, 24, 40, .55);
}
#login .legal-links a { color: #f2f1ee; text-decoration: none; }
#login .legal-links a:hover { text-decoration: underline; text-underline-offset: 2px; }
#login .powered {
  color: #3b4566; width: fit-content; margin-left: auto; margin-right: auto; padding: 6px 12px; border-radius: 9999px;
  background: rgba(242, 241, 238, .88); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); /* leggibile anche sopra il caffè */
}
#login .powered b { color: #202c48; }
#login .hero-logo { filter: drop-shadow(0 6px 10px rgba(30, 30, 40, .28)); }
#login .err { color: #b3261e; font-weight: 600; }

.card { background: var(--surface); border-radius: 22px; padding: 22px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; }
.stack-lg { display: grid; gap: 16px; align-content: start; }

/* marchio */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand img { width: 34px; height: auto; filter: drop-shadow(0 2px 0 rgba(0,0,0,.25)); }
.brand span { font-family: var(--varsity); font-size: 19px; letter-spacing: .03em; line-height: 1; text-transform: uppercase; }
.brand span b { color: var(--orange-hi); font-weight: 400; }
.powered { text-align: center; font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 28px 0 0; }
.powered b { font-family: var(--varsity); font-weight: 400; color: var(--text); letter-spacing: .05em; }
.powered sup { font-size: .75em; }

/* accesso */
.login-box { width: 100%; max-width: 400px; display: grid; gap: 18px; text-align: center; }
.login-box form { text-align: left; }
.hero-logo { width: min(260px, 70vw); height: auto; margin: 0 auto 4px; filter: drop-shadow(0 8px 18px rgba(0,0,0,.35)); }
.lead { margin: -4px 0 6px; line-height: 1.5; }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; padding: 6px; }

input, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1px solid transparent; border-radius: 14px; padding: 13px 14px; outline: none;
  transition: border-color 160ms var(--ease-out), background-color 160ms;
}
select { padding-right: 40px; text-overflow: ellipsis; }
input:focus, select:focus { border-color: var(--line); background: var(--surface-3); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input.code { font-size: 28px; letter-spacing: .35em; text-align: center; font-weight: 700; }

.btn {
  border: 0; border-radius: 9999px; padding: 14px 20px; font: inherit; font-weight: 700; font-size: 15px;
  cursor: pointer; position: relative; overflow: hidden;
}
.btn:disabled { opacity: .5; cursor: default; }
.grad { background: var(--grad); color: #fff; }
.btn.grad {
  font-family: var(--varsity); font-weight: 400; font-size: 17px; letter-spacing: .04em; text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0,0,0,.35); box-shadow: 0 4px 0 var(--orange-deep), 0 10px 22px -10px rgba(0,0,0,.6);
  transition: transform 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
.btn.grad:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--orange-deep); }
.pill {
  display: inline-flex; align-items: center; gap: .5rem; border: 0; border-radius: 9999px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; padding: 9px 14px; cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
@media (hover: hover) { .pill:hover { background: var(--surface-3); } }
.pill[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 700; }
.press { transition: transform 160ms var(--ease-out), background-color 160ms, opacity 160ms; }
.press:active, .pill:active { transform: scale(.97); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 22px; flex-wrap: wrap; }
.top-nav { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 560px) { #me { max-width: 120px; } .top { padding-bottom: 16px; } }
#me { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr); } }

/* caricamento */
.upload { display: grid; gap: 10px; }
.upload .label { margin-top: 6px; }
.drop {
  display: grid; justify-items: center; gap: 6px; text-align: center; padding: 26px 16px;
  border: 1.5px dashed var(--line); border-radius: 18px; background: var(--surface-2); cursor: pointer;
  transition: border-color 160ms var(--ease-out), background-color 160ms;
}
.drop:hover, .drop.over { border-color: var(--lime); background: var(--surface-3); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop svg { color: var(--lime); }
.drop-title { font-weight: 600; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 9px 12px; font-size: 14px; }
.file-list .n { font-size: 11px; font-weight: 700; color: #fff; background: var(--grad); border-radius: 6px; padding: 2px 6px; }
.file-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 9999px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; border-radius: 9999px; padding: 10px 6px; cursor: pointer; transition: background-color 160ms var(--ease-out), color 160ms; }
.seg button[aria-checked="true"] { background: var(--grad); color: #fff; box-shadow: 0 2px 0 var(--orange-deep); }
#send { margin-top: 10px; }
.up { display: grid; gap: 6px; }
.bar { height: 8px; background: var(--surface-3); border-radius: 9999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--grad-bar); border-radius: 9999px; transition: width 300ms var(--ease-out); }

/* conferma */
.done-card { display: flex; gap: 14px; align-items: flex-start; background: var(--text); color: var(--bg); box-shadow: 0 5px 0 var(--orange); }
.done-card h3 { font-family: var(--varsity); font-weight: 400; text-transform: uppercase; letter-spacing: .02em; }
.done-card .muted { color: #4a5677; margin: 6px 0 0; line-height: 1.5; font-size: 14px; }
.check { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-weight: 800; }

/* lezioni */
.jobs, .users { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.job { background: var(--surface-2); border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; }
.job-top { display: flex; align-items: center; gap: 10px; }
.job-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.status { font-size: 12px; font-weight: 700; border-radius: 9999px; padding: 4px 10px; background: var(--surface-3); color: var(--text); white-space: nowrap; }
.status.done { background: var(--grad); color: #fff; }
.status.error { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.status.work { color: var(--lime); }
.job .bar { height: 6px; }
.job .bar.indet i { width: 35% !important; animation: indet 1.4s var(--ease-out) infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.job-actions { display: flex; gap: 8px; }
.job-actions .pill { padding: 7px 12px; font-size: 12px; }
.empty { margin: 4px 0 0; font-size: 14px; }
.privacy { padding: 0 6px; margin: 0; }

/* materie */
.subject-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.filters .pill { padding: 7px 12px; font-size: 12px; }
.filters .pill .count { color: var(--muted); }
.filters .pill[aria-pressed="true"] .count { color: inherit; opacity: .6; }
.job-actions { flex-wrap: wrap; }
.job-actions a.pill { text-decoration: none; }
.job-actions a.pill.dl { background: var(--grad); color: #fff; font-weight: 700; box-shadow: 0 2px 0 var(--orange-deep); }
.job-actions select { width: auto; padding: 6px 30px 6px 12px; font-size: 12px; border-radius: 9999px; }
.job-subject { font-size: 11px; font-weight: 700; color: var(--lavender); }

/* admin */
.row { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 8px; margin-bottom: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.users li { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.users .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.users .who small { color: var(--muted); }

.sheen::after {
  content: ""; position: absolute; inset: 0; width: 35%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: sheen 3.2s var(--ease-out) infinite; animation-delay: 1s; pointer-events: none;
}
@keyframes sheen { from { transform: translateX(-120%) skewX(-18deg); } to { transform: translateX(260%) skewX(-18deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* pagine legali */
.legal-page { max-width: 820px; }
.legal { line-height: 1.65; font-size: 15px; }
.legal h1 { font-family: var(--varsity); font-weight: 400; font-size: 28px; letter-spacing: .02em; margin: 0 0 4px; }
.legal h2 { font-family: var(--varsity); font-weight: 400; font-size: 17px; text-transform: none; margin: 26px 0 6px; }
.legal p, .legal ul { margin: 8px 0 0; }
.legal ul { padding-left: 1.2em; }
.legal li + li { margin-top: 6px; }
.legal a { color: var(--orange-hi); text-underline-offset: 2px; }
a.pill { text-decoration: none; }
a.brand { text-decoration: none; }

/* primo accesso: termini da accettare */
.terms h2 { margin-bottom: 2px; }
.terms ul { margin: 4px 0 6px; padding-left: 1.1em; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; text-align: left; }
.terms a, .declare a, .legal-links a { color: var(--orange-hi); }
.check-row { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: 14px; line-height: 1.45; cursor: pointer; }
.check-row input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; padding: 0; accent-color: var(--orange-hi); }
.declare { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin-top: 8px; }
.legal-links { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.legal-links a { margin: 0 6px; }

/* sfondo interno armadietti: foto fissa dietro all'app, tutto il contenuto su riquadri navy leggibili */
#main::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(16, 24, 44, .38) 0%, rgba(16, 24, 44, .22) 45%, rgba(16, 24, 44, .48) 100%),
    #5b7699 url("/bg-app.jpg?v=1") center / cover no-repeat;
}
#main .card, #main .top, #main .privacy, #main .legal-links, #main .powered {
  background: rgba(32, 44, 72, .94);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .08), 0 22px 50px -18px rgba(10, 16, 32, .65);
}
#main .done-card { background: var(--text); }
#main .top { border-radius: 20px; padding: 12px 14px 12px 16px; margin: 4px 0 18px; }
#main .privacy { border-radius: 16px; padding: 12px 16px; color: #c3cbe0; }
#main .legal-links, #main .powered { width: fit-content; margin-left: auto; margin-right: auto; border-radius: 9999px; }
#main .legal-links { margin-top: 18px; padding: 8px 16px; color: #c3cbe0; }
#main .legal-links a { color: #f2f1ee; text-decoration: none; }
#main .powered { margin-top: 10px; padding: 6px 14px; color: #c3cbe0; }
@media (max-width: 560px) { #main .top { padding: 10px 12px; } }
