:root {
  --bg: #f5efe3;
  --paper: #fffdf8;
  --panel: rgba(255, 252, 245, 0.96);
  --line: #dccfb4;
  --text: #2f2415;
  --muted: #746651;
  --accent: #b54f32;
  --accent-strong: #943a20;
  --teal: #2f7868;
  --teal-ink: #21584d;
  --danger: #b13c34;
  --ok: #2f7d4d;
  --shadow: 0 18px 40px rgba(64, 40, 11, 0.12);
  --page-width: calc(100% - 32px);
  --page-max-width: none;
  --panel-padding: 20px;
  --card-scale: 1;
  --gallery-gap: 12px;
  --motion-duration: 0.18s;
  --font-ui: "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at top left, rgba(181, 79, 50, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(47, 120, 104, 0.16), transparent 28%),
    linear-gradient(180deg, #fcf7ed 0%, #f4ecde 100%);
}

body[data-theme="light"] {
  --bg: #eef3f7;
  --paper: #ffffff;
  --panel: rgba(255, 255, 255, 0.96);
  --line: #d2dbe5;
  --text: #1f2937;
  --muted: #607084;
  --accent: #b7603d;
  --accent-strong: #94462a;
  --teal: #2d7d78;
  --teal-ink: #245f5b;
  --danger: #b74c42;
  --shadow: 0 18px 40px rgba(31, 41, 55, 0.08);
}

body[data-theme="night"] {
  --bg: #121820;
  --paper: #18212b;
  --panel: rgba(24, 33, 43, 0.96);
  --line: #32404f;
  --text: #edf2f7;
  --muted: #9eb0c5;
  --accent: #da8c63;
  --accent-strong: #f2b18a;
  --teal: #59a89d;
  --teal-ink: #b9efe7;
  --danger: #e07a74;
  --ok: #69c086;
  --shadow: 0 22px 44px rgba(0, 0, 0, 0.34);
}

body[data-font="inter"] {
  --font-ui: "Inter", "Segoe UI", sans-serif;
}

body[data-font="serif"] {
  --font-ui: "Iowan Old Style", "Georgia", serif;
}

body[data-width="contained"] {
  --page-width: min(1520px, calc(100% - 32px));
  --page-max-width: 1520px;
}

body[data-density="compact"] {
  --panel-padding: 16px;
}

body[data-cards="expanded"] {
  --card-scale: 1.12;
}

body[data-motion="reduced"] *,
body[data-motion="reduced"] *::before,
body[data-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 28px;
  border-bottom: 1px solid rgba(220, 207, 180, 0.9);
  background: rgba(255, 250, 241, 0.84);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.brand-logo-wrap {
  width: 210px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: #ffffff;
  overflow: hidden;
}

body .shell {
  padding-top: 92px;
}

header.topbar {
  height: 92px;
  padding-block: 7px;
}

header.topbar .brand {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: start;
  align-content: center;
  gap: 1px;
}

header.topbar .brand-logo-wrap {
  width: 250px;
  height: 54px;
  padding: 0;
  border: 0;
  background: transparent;
}

header.topbar .brand > div:last-child {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 8px;
  padding-left: 3px;
}

header.topbar .brand h1 {
  font-size: 14px;
  line-height: 1.1;
}

header.topbar .brand p {
  margin: 0;
  font-size: 10px;
  line-height: 1.1;
}

body #adminView .admin-gallery-controlbar {
  top: 92px;
}

.brand-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

/* Identità visiva derivata dal marchio Kawasaki */
:root {
  --brand-navy: #29275f;
  --brand-navy-dark: #1d1b48;
  --brand-yellow: #ffd323;
  --brand-red: #e1262d;
  --brand-green: #27835f;
}

header.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 -4px;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--brand-yellow) 0 33.333%,
    var(--brand-navy) 33.333% 66.666%,
    var(--brand-red) 66.666% 100%
  );
}

header.topbar .brand > div:last-child {
  padding-left: 9px;
}

body #adminView button,
body #adminView input,
body #adminView select,
body #adminView .pill,
body #adminView .segmented,
body #adminView .admin-metric,
body #adminView .admin-school-review-card,
body #adminView .admin-workflow-progress > div,
body #adminView .admin-school-winner-spotlight,
body #adminView .gallery-group,
body #adminView .drawing-tile,
.admin-workflow-phase > span,
.admin-workflow-live,
.admin-workflow-bar {
  border-radius: 5px;
}

body #adminView button.ghost,
body #adminView .icon-arrow-button,
body #adminView .admin-gallery-controlbar button:not(.active):not(.primary) {
  border-color: rgba(41, 39, 95, 0.42);
  color: var(--brand-navy-dark);
}

body #adminView button.ghost:hover,
body #adminView button.ghost:focus-visible,
body #adminView .icon-arrow-button:hover,
body #adminView .icon-arrow-button:focus-visible {
  border-color: var(--brand-navy);
  color: var(--brand-navy-dark);
  box-shadow: inset 0 -3px 0 var(--brand-navy);
}

body #adminView button.primary,
body #adminView .quick-icon-button.primary {
  border-color: var(--brand-red);
  background: var(--brand-red);
  color: #fff;
}

body #adminView button.primary:hover,
body #adminView button.primary:focus-visible {
  border-color: #b71920;
  background: #b71920;
}

body #adminView .segmented button.active {
  position: relative;
  border-color: var(--brand-red);
  background: var(--brand-red);
  color: #fff;
  box-shadow: inset 0 -4px 0 var(--brand-yellow);
}

body #adminView .admin-gallery-context {
  border-left-color: rgba(41, 39, 95, 0.25);
}

body #adminView .admin-filter-summary {
  border-color: rgba(41, 39, 95, 0.36);
  background: #f5f4fb;
}

.admin-workflow-phase.complete {
  color: var(--brand-navy);
}

.admin-workflow-phase.complete > span {
  border-color: var(--brand-navy);
  background: #efeff8;
  color: var(--brand-navy-dark);
}

.admin-workflow-phase.active {
  color: #9d171d;
}

.admin-workflow-phase.active > span {
  border-color: var(--brand-red);
  background: var(--brand-red);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 211, 35, 0.6);
}

.admin-workflow-phase.active + .admin-workflow-connector {
  background: linear-gradient(90deg, var(--brand-yellow), #d8d0c6);
}

.admin-workflow-live {
  border-left-color: var(--brand-yellow);
  background: #fff9dc;
}

.admin-workflow-live strong {
  color: var(--brand-navy-dark);
}

body #adminView .admin-school-review-card-current.is-ready {
  border-top-color: var(--brand-green);
}

body #adminView .admin-school-review-card-current.needs-action {
  border-top-color: var(--brand-red);
}

body #adminView .admin-school-review-card-next {
  border-top-color: var(--brand-yellow);
  box-shadow: inset 0 4px 0 var(--brand-yellow), 0 7px 18px rgba(67, 49, 28, 0.05);
}

body #adminView .admin-workflow-status.is-complete {
  border-color: var(--brand-green);
  background: #edf8f2;
  color: #176444;
}

body #adminView .admin-workflow-status.is-pending {
  border-color: var(--brand-yellow);
  background: #fff9dc;
  color: #695400;
}

body #adminView .admin-state-hint {
  border-left-color: var(--brand-navy);
}

body #adminView .admin-gallery-controlbar #adminGalleryCount {
  border-color: var(--brand-navy);
  color: var(--brand-navy-dark);
  background: #f2f1fa;
}

body #adminView .empty {
  position: relative;
  min-height: 120px;
  display: grid;
  place-items: center;
  padding-left: 100px;
  border-color: rgba(41, 39, 95, 0.3);
  background-color: #f7f5ef;
}

body #adminView .empty::before {
  content: "♡";
  position: absolute;
  left: 28px;
  top: 50%;
  translate: 0 -50%;
  color: var(--brand-navy);
  font-size: 44px;
  line-height: 1;
  text-shadow: 3px 3px 0 var(--brand-yellow);
}

body #adminView .admin-phase-message-eyebrow,
body #adminView .admin-workflow-step,
body #adminView .eyebrow {
  color: var(--brand-navy-dark);
}

body #adminView .admin-top-strip .eyebrow,
body #adminView .admin-top-strip .summary-label {
  color: rgba(255, 255, 255, 0.8);
}

/* Area ospite: gerarchia visiva senza modificare il flusso */
body .page:has(#externalView.active) {
  width: min(1680px, calc(100% - 32px));
  background: #f3f0ea;
}

body #externalView {
  --guest-paper: #fffdf9;
  --guest-soft: #f5f1eb;
  --guest-navy: #29275f;
  --guest-yellow: #ffd323;
  --guest-red: #e1262d;
}

body #externalView .section-head {
  padding: 22px 24px;
  border: 1px solid #d2c9be;
  border-top: 5px solid var(--guest-red);
  border-radius: 6px;
  background: var(--guest-paper);
  box-shadow: 0 10px 24px rgba(67, 49, 28, 0.07);
}

body #externalView .section-head .eyebrow {
  color: var(--guest-navy);
  font-weight: 800;
}

body #externalView .section-head h2 {
  color: #181818;
}

body #externalView .external-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

body #externalView .external-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid #d1c8bd;
  border-radius: 6px;
  background: #e9e3da;
  box-shadow: 0 6px 16px rgba(67, 49, 28, 0.05);
}

body #externalView .step-chip {
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 10px 16px;
  border: 0;
  border-right: 1px solid #d1c8bd;
  border-radius: 0;
  background: var(--guest-paper);
  color: var(--guest-navy);
  font-weight: 700;
}

body #externalView .step-chip:last-child {
  border-right: 0;
}

body #externalView .step-chip.active {
  background: var(--guest-red);
  color: #fff;
  box-shadow: inset 0 -5px 0 var(--guest-yellow);
}

body #externalView .external-layout {
  grid-template-columns: minmax(360px, 410px) minmax(0, 1fr);
  gap: 22px;
}

body #externalView .external-sidebar,
body #externalView .external-main {
  border: 1px solid #d1c8bd;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(67, 49, 28, 0.08);
}

body #externalView .external-sidebar {
  top: 104px;
  padding: 0;
  border-top: 5px solid var(--guest-navy);
  background: #faf6ef;
  overflow: hidden;
}

body #externalView .external-sidebar-section {
  gap: 16px;
  padding: 20px;
  border-top: 1px solid #d8d0c6;
}

body #externalView .external-sidebar-section:first-child {
  border-top: 0;
}

body #externalView .external-sidebar h3,
body #externalView .external-main h3 {
  color: #191919;
}

body #externalView .external-sidebar .eyebrow,
body #externalView .external-main .eyebrow {
  color: var(--guest-navy);
  font-weight: 800;
}

body #externalView .external-sidebar-section .field {
  gap: 7px;
  padding: 12px;
  border: 1px solid #d8d0c6;
  border-left: 4px solid rgba(41, 39, 95, 0.55);
  border-radius: 5px;
  background: var(--guest-paper);
}

body #externalView label {
  color: #4f4a44;
  font-size: 12px;
  font-weight: 700;
}

body #externalView input,
body #externalView select,
body #externalView .school-picker-trigger {
  min-height: 46px;
  border: 1px solid #bfb6aa;
  border-radius: 5px;
  background: #fff;
}

body #externalView input:focus,
body #externalView select:focus,
body #externalView .school-picker-trigger:focus-visible {
  border-color: var(--guest-navy);
  box-shadow: 0 0 0 3px rgba(255, 211, 35, 0.46);
}

body #externalView button.primary {
  min-height: 46px;
  border: 1px solid var(--guest-red);
  border-radius: 5px;
  background: var(--guest-red);
  font-weight: 800;
}

body #externalView button.ghost,
body #externalView button:not(.primary) {
  border-radius: 5px;
}

body #externalView .external-submit-row {
  padding-top: 16px;
  border-top: 1px solid #d4cbc0;
}

body #externalView .external-submit-row .primary {
  width: 100%;
}

body #externalView .external-main {
  min-height: 420px;
  padding: 22px;
  border-top: 5px solid var(--guest-navy);
  background: #f8f5ef;
}

body #externalView .external-main-head {
  margin: -22px -22px 18px;
  padding: 20px 22px;
  border-bottom: 1px solid #d5cdc2;
  background: var(--guest-paper);
}

body #externalView .empty {
  position: relative;
  min-height: 150px;
  display: grid;
  place-items: center;
  padding: 28px 32px;
  border: 2px dashed rgba(41, 39, 95, 0.34);
  border-radius: 6px;
  background: #fffaf0;
  color: #625b51;
  text-align: center;
  box-shadow: none;
}

body #externalView .empty::before {
  content: none;
}

body #externalView .class-card {
  border: 1px solid #d1c8bd;
  border-top: 5px solid var(--guest-navy);
  border-radius: 6px;
  background: var(--guest-paper);
  box-shadow: 0 8px 20px rgba(67, 49, 28, 0.07);
}

body #externalView .class-card-head {
  background: #f5f2ed;
}

body #externalView .class-card-body {
  background: var(--guest-paper);
}

body #externalView .upload-dropzone {
  border: 2px dashed rgba(41, 39, 95, 0.38);
  border-radius: 6px;
  background: #f7f6fb;
}

body #externalView .upload-dropzone:hover,
body #externalView .upload-dropzone.dragover {
  border-color: var(--guest-red);
  background: #fff3f3;
  box-shadow: inset 0 0 0 3px rgba(255, 211, 35, 0.35);
}

body #externalView .pill,
body #externalView .file-type-pill,
body #externalView .file-fresh-pill {
  border-color: rgba(41, 39, 95, 0.25);
  border-radius: 999px;
  background: #f2f1fa;
  color: var(--guest-navy);
}

body #externalView .school-order-pill {
  border-color: rgba(181, 79, 50, 0.35);
  background: #fff2d6;
  color: #7b2c1f;
}

/* Accesso email/OTP: schermata autonoma senza top bar */
body:has(#authView.active) {
  background: #ffffff;
}

body:has(#authView.active) .topbar {
  display: none;
}

body:has(#authView.active) .shell {
  padding-top: 0;
}

body:has(#authView.active) .page {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  display: grid;
  padding: 32px;
  background: #ffffff;
}

body #authView.view.active {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
}

body #authView .auth-shell {
  width: min(620px, calc(100% - 28px));
  overflow: hidden;
  border: 1px solid #a9161b;
  border-radius: 10px;
  background: #c91f24;
  box-shadow: 0 28px 70px rgba(91, 9, 13, 0.2);
}

body #authView .auth-brand-panel {
  min-height: 128px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 18px 24px 14px;
  border-bottom: 4px solid var(--brand-yellow);
  background: #c91f24;
}

body #authView .auth-brand-panel img {
  width: min(440px, 86%);
  height: 82px;
  display: block;
  object-fit: contain;
}

body #authView .auth-brand-panel > span {
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

body #authView .auth-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
  gap: 0;
  padding: 14px;
  background: #c91f24;
}

body #authView .auth-card,
body #authView .auth-guide-panel {
  min-width: 0;
  padding: 24px;
  border: 0;
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}

body #authView .auth-card {
  display: grid;
  align-content: start;
  gap: 16px;
  width: min(540px, 100%);
  margin: 0 auto;
}

body #authView .auth-card-heading {
  display: grid;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ddd5cb;
}

body #authView .auth-card-heading h2,
body #authView .auth-guide-panel h2 {
  margin: 0;
  color: #181818;
  font-size: 25px;
  line-height: 1.15;
}

body #authView .auth-card-heading p,
body #authView .auth-guide-intro,
body #authView .auth-guide-note {
  margin: 0;
  color: #625b52;
  font-size: 13px;
  line-height: 1.45;
}

body #authView .eyebrow,
body #authView .auth-step-label {
  color: var(--brand-navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

body #authView .auth-step-form {
  gap: 11px;
  padding: 14px;
  border: 1px solid #ddd5cb;
  border-left: 4px solid var(--brand-navy);
  border-radius: 6px;
  background: #faf8f4;
}

body #authView .auth-step-form + .auth-step-form {
  padding-top: 14px;
  border-top: 1px solid #ddd5cb;
  border-left-color: var(--brand-yellow);
}

body #authView .auth-consent-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid #e0d6ca;
  border-radius: 6px;
  background: #fffdfa;
  color: #675d52;
  font-size: 12px;
  line-height: 1.35;
}

body #authView .auth-consent-inline .accepted {
  color: #1f7a43;
  font-weight: 800;
}

body #authView .tiny-button {
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
}

body #authView .auth-inline-help {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid #e2d6c7;
  border-radius: 999px;
  background: #fffaf4;
  color: #4f473f;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

body #authView .auth-help-button {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  aspect-ratio: 1 / 1;
  place-items: center;
  padding: 0;
  border: 1px solid #595959;
  border-radius: 50%;
  background: transparent;
  color: #595959;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
}

body #authView .auth-help-button:hover,
body #authView .auth-help-button:focus-visible {
  border-color: #2f2f2f;
  background: rgba(89, 89, 89, 0.08);
  color: #2f2f2f;
  box-shadow: none;
}

body #authView .field {
  gap: 7px;
}

body #authView label {
  color: #4c4741;
  font-size: 12px;
  font-weight: 700;
}

body #authView input {
  min-height: 48px;
  border: 1px solid #bbb2a7;
  border-radius: 5px;
  background: #ffffff;
}

body #authView input:focus {
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 3px rgba(255, 211, 35, 0.45);
}

body #authView button.primary {
  min-height: 48px;
  border: 1px solid var(--brand-red);
  border-radius: 5px;
  background: var(--brand-red);
  color: #fff;
  font-weight: 800;
}

body #authView button.primary:hover,
body #authView button.primary:focus-visible {
  border-color: #b71920;
  background: #b71920;
}

body #authView .status-line:not(:empty),
body #authView .debug-box:not(.hidden) {
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid #d9d1c7;
  border-radius: 5px;
  background: #f7f4ef;
}

body #authView .auth-guide-panel {
  display: none;
}

body #authView .auth-guide-steps {
  display: grid;
  gap: 10px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

body #authView .auth-guide-steps li {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #ddd3c5;
  border-radius: 5px;
  background: #fff;
}

body #authView .auth-guide-steps li > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid var(--brand-navy);
  border-radius: 50%;
  color: var(--brand-navy);
  font-size: 12px;
  font-weight: 800;
}

body #authView .auth-guide-steps li > div {
  display: grid;
  gap: 2px;
}

body #authView .auth-guide-steps strong {
  color: #242424;
  font-size: 13px;
}

body #authView .auth-guide-steps small {
  color: #696158;
  font-size: 11px;
  line-height: 1.35;
}

body #authView .auth-guide-note {
  padding: 11px 12px;
  border-left: 4px solid var(--brand-yellow);
  background: #fff;
}

body #authView .auth-help-dialog {
  width: min(620px, calc(100% - 30px));
  margin: 72px auto;
  border-top-color: var(--brand-navy);
}

body #authView .auth-terms-dialog {
  width: min(720px, calc(100% - 30px));
  max-height: calc(100vh - 52px);
  margin: 26px auto;
  overflow-y: auto;
  border-top-color: var(--brand-yellow);
}

body #authView .auth-help-header {
  display: grid;
  gap: 6px;
}

body #authView .auth-terms-copy {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e0d6ca;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfa 0%, #f7f1e8 100%);
}

body #authView .auth-terms-copy p {
  margin: 0;
  color: #4f473f;
  font-size: 13px;
  line-height: 1.55;
}

body #authView .auth-terms-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid #d7c9b8;
  border-radius: 8px;
  background: #ffffff;
}

body #authView .auth-terms-check input {
  width: 18px;
  height: 18px;
  min-height: auto;
  margin-top: 2px;
}

body #authView .auth-terms-actions {
  justify-content: flex-end;
}

.external-info-dialog {
  width: min(680px, calc(100% - 30px));
  max-height: calc(100vh - 52px);
  margin: 34px auto;
  overflow-y: auto;
  border-top-color: var(--brand-navy);
}

.external-info-copy {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #ded3c7;
  border-left: 5px solid var(--brand-yellow);
  background: #fffaf2;
}

.external-info-copy.success {
  border-left-color: #27835f;
  background: #f3fbf7;
}

.external-info-copy p {
  margin: 0;
  color: #4f473f;
  font-size: 14px;
  line-height: 1.5;
}

body #authView .auth-help-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body #authView .auth-help-steps li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid #ddd3c5;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdfa 0%, #f8f4ee 100%);
}

body #authView .auth-help-steps li > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-red);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

body #authView .auth-help-steps li > div {
  display: grid;
  gap: 3px;
}

body #authView .auth-help-steps strong {
  color: #242424;
  font-size: 14px;
}

body #authView .auth-help-steps small,
body #authView .auth-help-note {
  color: #696158;
  font-size: 12px;
  line-height: 1.5;
}

body #authView .auth-help-note {
  margin: 0;
  padding: 12px 14px;
  border-left: 4px solid var(--brand-yellow);
  background: #fffaf0;
}

@media (max-width: 820px) {
  body:has(#authView.active) .page {
    padding: 18px;
  }

  body #authView .auth-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  body:has(#authView.active) .page {
    padding: 0;
  }

  body #authView.view.active {
    min-height: 100vh;
    align-items: start;
  }

  body #authView .auth-shell {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body #authView .auth-brand-panel {
    min-height: 112px;
  }

  body #authView .auth-brand-panel img {
    width: min(330px, 92%);
    height: 68px;
  }

  body #authView .auth-content-grid {
    padding: 8px;
  }

  body #authView .auth-card,
  body #authView .auth-guide-panel {
    padding: 18px;
  }

  body #authView .auth-inline-help {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    border-radius: 999px;
  }

  body #authView .auth-consent-inline {
    align-items: flex-start;
    flex-direction: column;
  }

  body #authView .auth-help-dialog {
    width: min(100%, calc(100% - 20px));
    margin: 16px auto;
  }

  body #authView .auth-terms-dialog {
    width: min(100%, calc(100% - 20px));
    margin: 16px auto;
  }
}

@media (max-width: 980px) {
  body #externalView .external-layout {
    grid-template-columns: 1fr;
  }

  body #externalView .external-sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  body .page:has(#externalView.active) {
    width: min(100%, calc(100% - 20px));
  }

  body #externalView .external-steps {
    display: flex;
    overflow-x: auto;
    border: 0;
    background: transparent;
  }

  body #externalView .step-chip {
    flex: 0 0 auto;
    border: 1px solid #d1c8bd;
    border-radius: 5px;
  }

  body #externalView .external-main,
  body #externalView .external-sidebar-section {
    padding: 16px;
  }

  body #externalView .external-main-head {
    margin: -16px -16px 16px;
    padding: 16px;
  }

  body #externalView .empty {
    padding: 24px 20px;
    text-align: center;
  }
}

@media (max-width: 720px) {
  body .shell {
    padding-top: 82px;
  }

  header.topbar {
    height: 82px;
  }

  header.topbar .brand-logo-wrap {
    width: 190px;
    height: 45px;
  }

  body #adminView .admin-gallery-controlbar {
    top: 82px;
  }

  .brand-logo-wrap {
    width: 148px;
    height: 40px;
    padding: 3px 6px;
  }

  .brand h1 {
    font-size: 15px;
  }
}

@media (max-width: 520px) {
  header.topbar .brand > div:last-child {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
  }

  header.topbar .brand p {
    display: none;
  }

  .brand-logo-wrap {
    width: 124px;
  }

  .brand > div:last-child {
    display: none;
  }
}

.brand-mark {
  width: 56px;
  min-width: 56px;
  height: 56px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(181, 79, 50, 0.95), rgba(230, 168, 88, 0.95)),
    linear-gradient(225deg, rgba(47, 120, 104, 0.95), rgba(90, 150, 210, 0.95));
  box-shadow: inset 0 0 0 4px rgba(255, 249, 238, 0.72);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.page {
  width: var(--page-width);
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 26px 0 40px;
}

.page:has(#adminView.active) {
  width: 100%;
  max-width: none;
  padding-top: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr minmax(320px, 430px);
  gap: 28px;
  align-items: start;
}

.hero-copy,
.auth-card,
.panel,
.summary-card {
  border: 1px solid rgba(220, 207, 180, 0.96);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-copy {
  min-height: 100%;
  padding: 34px;
}

.hero-copy h2,
.section-head h2 {
  margin: 8px 0 10px;
  font-size: 34px;
  line-height: 1.04;
}

.hero-copy p,
.section-head p,
.muted {
  color: var(--muted);
  line-height: 1.5;
}

.auth-card,
.panel {
  padding: var(--panel-padding);
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

label,
.eyebrow,
.summary-label {
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
select,
button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.school-picker-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.school-picker-panel {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  gap: 10px;
}

.school-picker-options {
  max-height: 240px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.school-option {
  width: 100%;
  min-height: auto;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 245, 0.84);
  text-align: left;
  display: grid;
  gap: 4px;
  align-items: start;
  line-height: 1.25;
  box-shadow: none;
  white-space: normal;
}

.school-option.active {
  border-color: rgba(181, 79, 50, 0.45);
  background: rgba(181, 79, 50, 0.08);
}

.school-option-title {
  display: block;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
}

.school-option-meta {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.school-picker-options .empty {
  padding: 16px;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  background: var(--paper);
  color: var(--text);
}

button {
  padding: 10px 14px;
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
}

.school-option,
.school-picker-trigger {
  font: inherit;
}

.school-option {
  padding: 10px 12px;
  min-height: auto;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-strong);
}

button.ghost {
  background: transparent;
}

.status-line {
  min-height: 21px;
  font-size: 14px;
  color: var(--muted);
}

.status-line.ok {
  color: var(--ok);
}

.status-line.error {
  color: var(--danger);
}

.debug-box,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 245, 0.84);
  font-size: 12px;
}

.debug-box {
  color: var(--accent-strong);
  justify-content: center;
}

.pill.subtle,
.file-fresh-pill {
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.section-head,
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 22px;
}

.admin-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.summary-card {
  padding: 18px;
}

.summary-value {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 20px;
  align-items: start;
}

.admin-layout {
  grid-template-columns: minmax(0, 1fr);
}

.admin-layout > .panel {
  min-width: 0;
}

.external-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 20px;
}

.step-chip {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.72);
  color: var(--muted);
  font-size: 13px;
}

.step-chip.active {
  background: rgba(181, 79, 50, 0.12);
  border-color: rgba(181, 79, 50, 0.32);
  color: var(--accent-strong);
}

.external-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 20px;
  align-items: start;
}

.external-sidebar {
  position: sticky;
  top: 96px;
}

.external-sidebar-section {
  padding-top: 18px;
  border-top: 1px solid rgba(220, 207, 180, 0.9);
}

.external-sidebar-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.external-submit-row {
  display: flex;
  padding-bottom: 2px;
}

.external-main-head h3,
.external-sidebar h3 {
  margin: 6px 0 8px;
}

.mobile-action-bar {
  position: sticky;
  bottom: 12px;
  z-index: 18;
  margin-top: 18px;
  border: 1px solid rgba(220, 207, 180, 0.96);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.96);
  box-shadow: var(--shadow);
  padding: 12px;
  display: none;
  gap: 12px;
  align-items: center;
}

.mobile-action-meta {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.mobile-action-meta strong {
  font-size: 14px;
  line-height: 1.2;
}

.mobile-action-meta span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.class-form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(100px, 120px) 1fr;
}

.class-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.class-card-head {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.class-card-head h4 {
  margin: 6px 0 6px;
  font-size: 24px;
}

.class-card-body {
  border-top: 1px solid var(--line);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.upload-dropzone {
  border: 2px dashed rgba(181, 79, 50, 0.3);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.72);
  padding: 20px;
  display: grid;
  gap: 10px;
  text-align: center;
  cursor: pointer;
}

.upload-dropzone.busy {
  cursor: progress;
  opacity: 0.82;
}

.upload-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(181, 79, 50, 0.08);
}

.dropzone-title {
  font-weight: 700;
}

.dropzone-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.class-card-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.helper-text {
  font-size: 13px;
  color: var(--muted);
}

.upload-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  clip-path: inset(50%);
}

.upload-feedback {
  border: 1px solid rgba(220, 207, 180, 0.95);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 252, 245, 0.84);
  display: grid;
  gap: 6px;
}

.upload-feedback.ok {
  border-color: rgba(47, 125, 77, 0.28);
  background: rgba(47, 125, 77, 0.08);
}

.upload-feedback.error {
  border-color: rgba(177, 60, 52, 0.3);
  background: rgba(177, 60, 52, 0.08);
}

.upload-feedback-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.upload-feedback-head strong {
  font-size: 13px;
}

.upload-feedback-head span,
.upload-feedback-body {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.upload-feedback-list {
  display: grid;
  gap: 8px;
}

.upload-feedback-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.upload-feedback-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.72);
  flex-shrink: 0;
}

.upload-feedback-badge.ok {
  border-color: rgba(47, 125, 77, 0.28);
  color: var(--ok);
}

.upload-feedback-badge.warning {
  border-color: rgba(181, 79, 50, 0.32);
  color: var(--accent-strong);
}

.upload-feedback-badge.error {
  border-color: rgba(177, 60, 52, 0.3);
  color: var(--danger);
}

.upload-feedback-name {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.submit-summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.submit-summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.84);
  padding: 12px;
  display: grid;
  gap: 4px;
}

.submit-summary-item strong {
  font-size: 22px;
  line-height: 1;
}

.submit-summary-item span {
  color: var(--muted);
  font-size: 13px;
}

.upload-progress {
  border: 1px solid rgba(47, 120, 104, 0.22);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(47, 120, 104, 0.08);
  display: grid;
  gap: 8px;
}

.upload-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.upload-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(47, 120, 104, 0.14);
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(47, 120, 104, 0.88), rgba(181, 79, 50, 0.88));
}

.upload-progress-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.column {
  min-width: 0;
}

.accordion-list,
.grouped-gallery,
.trash-list,
.final-board {
  display: grid;
  gap: 14px;
}

.accordion {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.accordion summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion-body {
  border-top: 1px solid var(--line);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.file-list,
.mini-list {
  display: grid;
  gap: 10px;
}

.file-list {
  grid-template-columns: 1fr;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.file-item,
.trash-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 0;
  padding: 8px 10px;
}

.file-row,
.trash-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.trash-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.file-item-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.file-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.file-open-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.84);
  font-size: 12px;
  text-decoration: none;
}

.file-type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 245, 0.84);
  font-size: 11px;
}

.file-fresh-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
}

.compact-action {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.compact-icon-button {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.3;
  min-width: 0;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.segmented button.active {
  background: var(--teal);
  color: #fff;
}

.settings-segmented {
  width: 100%;
}

.settings-section h4 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.1;
}

.settings-grid {
  display: grid;
  gap: 12px;
}

.setting-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 14px 16px;
}

.setting-toggle strong {
  display: block;
  margin-bottom: 4px;
}

.setting-toggle p {
  margin: 0;
}

.setting-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
}

.gallery-group {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.gallery-group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.gallery-group-head h3 {
  margin: 0 0 4px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.art-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf8;
  display: grid;
  grid-template-rows: 180px auto;
}

.art-preview,
.pdf-preview {
  width: 100%;
  height: 180px;
  background: linear-gradient(180deg, #f2ebdd, #e9dfcc);
  display: grid;
  place-items: center;
}

.art-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.pdf-preview span {
  font-size: 22px;
  color: var(--accent-strong);
}

.art-body {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.art-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.art-meta {
  color: var(--muted);
  font-size: 13px;
}

.admin-workbar {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  align-items: end;
}

.admin-gallery-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.admin-gallery-states {
  flex: 0 0 auto;
}

.admin-state-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
}

#adminView {
  --admin-red: #d32f2f;
  --admin-red-strong: #ab1f1f;
  --admin-red-ink: #7f1111;
  --admin-surface: #ffffff;
  --admin-surface-muted: #f4f4f4;
  --admin-line: #d7d7d7;
  --admin-line-strong: #b7b7b7;
  --admin-ink: #141414;
  --admin-ink-muted: #5f5f5f;
  --admin-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

#adminView .panel,
#adminView .summary-card,
#adminView .selection-card,
#adminView .folder-card,
#adminView .gallery-group,
#adminView .admin-metric,
#adminView .admin-class-card,
#adminView .admin-class-workbench,
#adminView .admin-school-review-card,
#adminView .admin-school-winner-spotlight,
#adminView .drawing-tile,
#adminView .lightbox-dialog,
#adminView .trash-dialog,
#adminView .admin-summary-dialog {
  border-radius: 0;
}

#adminView .panel,
#adminView .summary-card,
#adminView .gallery-group,
#adminView .admin-class-workbench,
#adminView .admin-school-review-card,
#adminView .admin-school-winner-spotlight,
#adminView .admin-metric,
#adminView .admin-class-card,
#adminView .drawing-tile {
  background: var(--admin-surface);
  border-color: var(--admin-line);
  box-shadow: var(--admin-shadow);
}

#adminView .eyebrow,
#adminView .summary-label,
#adminView label,
#adminView .muted,
#adminView .art-meta,
#adminView .admin-state-hint,
#adminView .admin-class-progress-meta,
#adminView .admin-class-decision-note {
  color: var(--admin-ink-muted);
}

#adminView .admin-top-strip,
#adminView .admin-top-strip .muted,
#adminView .admin-top-strip .summary-label,
#adminView .admin-top-strip .eyebrow,
#adminView .admin-top-strip .summary-value,
#adminView .admin-top-strip h2,
#adminView .admin-top-strip h3,
#adminView .admin-top-strip h4,
#adminView .admin-top-strip h5,
#adminView .admin-top-strip strong,
#adminView .admin-top-strip p {
  color: #ffffff;
}

#adminView h2,
#adminView h3,
#adminView h4,
#adminView h5,
#adminView strong,
#adminView .summary-value,
#adminView .file-name,
#adminView .selection-link {
  color: var(--admin-ink);
}

#adminView input,
#adminView select,
#adminView button,
#adminView .school-picker-trigger,
#adminView .school-option,
#adminView .segmented,
#adminView .pill,
#adminView .file-type-pill,
#adminView .file-fresh-pill,
#adminView .quick-icon-button,
#adminView .admin-summary-open-button {
  border-radius: 0;
}

#adminView input,
#adminView select,
#adminView button,
#adminView .school-picker-trigger,
#adminView .school-option {
  border-color: var(--admin-line);
  background: var(--admin-surface);
  color: var(--admin-ink);
}

#adminView input:focus,
#adminView select:focus,
#adminView button:focus-visible,
#adminView .school-picker-trigger:focus-visible,
#adminView .school-option:focus-visible {
  outline: 0;
  border-color: var(--admin-red);
  box-shadow: inset 0 0 0 1px var(--admin-red);
}

#adminView button.primary,
#adminView .segmented button.active,
#adminView .quick-icon-button.primary,
#adminView .status-progress {
  background: var(--admin-red);
  border-color: var(--admin-red);
  color: #ffffff;
}

#adminView button.primary:hover,
#adminView button.primary:focus-visible,
#adminView .segmented button.active:hover,
#adminView .quick-icon-button.primary:hover {
  background: var(--admin-red-strong);
  border-color: var(--admin-red-strong);
}

#adminView button.ghost,
#adminView .quick-icon-button,
#adminView .school-option,
#adminView .school-picker-trigger {
  background: var(--admin-surface);
  color: var(--admin-ink);
}

#adminView button.ghost:hover,
#adminView .quick-icon-button:hover,
#adminView .school-option:hover,
#adminView .school-picker-trigger:hover,
#adminView .admin-class-card:hover,
#adminView .admin-class-card:focus-visible,
#adminView .drawing-tile:hover,
#adminView .drawing-tile:focus-visible {
  border-color: var(--admin-red);
  color: var(--admin-ink);
  box-shadow: inset 0 -2px 0 0 var(--admin-red);
  transform: none;
}

#adminView .pill,
#adminView .file-type-pill,
#adminView .file-fresh-pill,
#adminView .pill.subtle {
  background: var(--admin-surface);
  border-color: var(--admin-line);
  color: var(--admin-red-ink);
}

#adminView .segmented {
  border-color: var(--admin-line-strong);
  background: var(--admin-surface);
  box-shadow: inset 0 0 0 1px #ffffff;
}

#adminView .segmented button {
  min-height: 46px;
  padding: 10px 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-right: 1px solid var(--admin-line);
}

#adminView .segmented button:last-child {
  border-right: 0;
}

#adminView .segmented button:not(.active):hover {
  background: var(--admin-surface-muted);
  color: var(--admin-ink);
  box-shadow: inset 0 -3px 0 0 var(--admin-red);
}

#adminView .admin-class-progress-bar,
#adminView .admin-class-progress-bar span {
  border-radius: 0;
}

#adminView .admin-class-progress-bar {
  background: #efefef;
}

#adminView .admin-class-progress-bar span {
  background: var(--admin-red);
}

#adminView .status-complete {
  background: #ffffff;
  border-color: var(--admin-red);
  color: var(--admin-red-ink);
}

#adminView .status-idle {
  background: var(--admin-surface);
  color: var(--admin-ink-muted);
}

#adminView .drawing-state-badge {
  border-radius: 0;
  background: var(--admin-red);
  color: #ffffff;
  box-shadow: none;
}

#adminView .drawing-state-badge.is-muted {
  background: rgba(20, 20, 20, 0.78);
}

#adminView .quick-icon-button.swap {
  background: var(--admin-red);
  border-color: var(--admin-red);
  color: #ffffff;
}

#adminView .quick-icon-button.danger,
#adminView .danger-button {
  background: #ffffff;
  border-color: var(--admin-red);
  color: var(--admin-red-ink);
}

#adminView .admin-winner-summary.is-winner,
#adminView .admin-school-selection-hint,
#adminView .admin-phase-complete-banner strong {
  color: var(--admin-red-ink);
}

#adminView .admin-phase-complete-banner {
  border-color: var(--admin-red);
  background: rgba(211, 47, 47, 0.08);
  border-radius: 0;
}

#adminView .admin-class-strip {
  border-top: 4px solid var(--admin-red);
}

#adminView .admin-gallery-toolbar {
  display: grid;
  grid-template-columns: auto auto auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  width: 100%;
}

#adminView .admin-gallery-states {
  min-width: 0;
}

#adminView .admin-class-toolbar-actions {
  gap: 12px;
}

#adminView .admin-workbar {
  gap: 8px;
  padding: 12px 14px 0;
  border-top: 1px solid var(--admin-line);
}

#adminView .admin-state-hint {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 2px;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#adminView .admin-filter-summary {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 46px;
  padding: 0 10px;
  border: 1px solid var(--admin-line-strong);
  background: linear-gradient(180deg, #ffffff 0%, #f6f6f6 100%);
}

#adminView .admin-filter-summary .pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
}

#adminView #adminGalleryCount {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-self: end;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#adminView #adminSchoolFilterButton,
#adminView #adminClearFilterButton,
#adminView .icon-arrow-button {
  min-height: 46px;
  padding-inline: 14px;
  font-weight: 600;
}

#adminView .icon-arrow-button {
  min-width: 46px;
  padding-inline: 0;
  background: var(--admin-surface);
  font-size: 20px;
}

#adminView #adminSchoolFilterButton:hover,
#adminView #adminClearFilterButton:hover,
#adminView .icon-arrow-button:hover {
  background: #ffffff;
}

#adminView .admin-focus-strip {
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--admin-line);
}

#adminView .admin-progress-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

#adminView .admin-winner-summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 2px;
}

#adminView .admin-class-summary,
#adminView .admin-progress-summary,
#adminView .admin-class-workbench-stats {
  gap: 6px;
}

#adminView .admin-class-list {
  gap: 10px;
  padding-bottom: 10px;
}

#adminView .admin-class-list::-webkit-scrollbar {
  height: 10px;
}

#adminView .admin-class-list::-webkit-scrollbar-track {
  background: #f0f0f0;
}

#adminView .admin-class-list::-webkit-scrollbar-thumb {
  background: var(--admin-red);
}

#adminView .admin-class-card {
  position: relative;
  gap: 10px;
  padding: 14px;
  border-width: 1px;
  border-color: var(--admin-line);
  background:
    linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  box-shadow: none;
}

#adminView .admin-class-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: transparent;
}

#adminView .admin-class-card:hover,
#adminView .admin-class-card:focus-visible {
  box-shadow: inset 0 0 0 1px var(--admin-red);
}

#adminView .admin-class-card.active {
  border-color: var(--admin-red);
  background: linear-gradient(180deg, #ffffff 0%, #fff5f5 100%);
  box-shadow: inset 0 0 0 1px var(--admin-red);
}

#adminView .admin-class-card.active::before {
  background: var(--admin-red);
}

#adminView .admin-class-card-head h4 {
  font-size: 20px;
  letter-spacing: 0.01em;
}

#adminView .admin-class-progress {
  gap: 6px;
}

#adminView .admin-class-progress-bar {
  height: 6px;
  background: #ececec;
}

#adminView .admin-class-progress-bar span {
  background: var(--admin-red);
}

#adminView .admin-class-progress-meta {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

#adminView .admin-class-workbench {
  gap: 14px;
  padding: 16px;
  border-top: 4px solid var(--admin-red);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
}

#adminView .admin-class-workbench.is-school-review {
  gap: 12px;
  padding: 16px;
}

#adminView .admin-class-workbench-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--admin-line);
}

#adminView .admin-class-workbench-head h3 {
  margin: 4px 0 2px;
  font-size: 22px;
}

#adminView .admin-class-workbench.is-school-review .admin-class-workbench-head h3 {
  font-size: 22px;
}

#adminView #adminClassWorkbenchMeta {
  max-width: 900px;
}

#adminView .admin-class-workbench-stage {
  gap: 10px;
}

#adminView .admin-school-review-grid {
  gap: 10px;
}

#adminView .admin-school-review-card {
  gap: 10px;
  padding: 12px;
  border-color: var(--admin-line);
  background:
    linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
  box-shadow: none;
}

#adminView .admin-school-review-card h4 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#adminView .admin-school-review-card-complete {
  border-color: var(--admin-red);
  box-shadow: inset 0 0 0 1px var(--admin-red);
}

#adminView .admin-class-decision-card,
#adminView .admin-class-finalists,
#adminView .admin-class-finalist-winner {
  padding-top: 14px;
  border-top-color: var(--admin-line);
}

#adminView .admin-class-decision-card {
  gap: 10px;
}

#adminView .admin-class-decision-head h4,
#adminView .admin-class-finalists-head h4,
#adminView .admin-class-finalist-winner h4 {
  font-size: 18px;
}

#adminView .admin-class-decision-note {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

#adminView .admin-school-winner-spotlight {
  gap: 14px;
  padding: 12px;
  border-color: var(--admin-line);
  background:
    linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
  box-shadow: none;
}

#adminView .admin-school-winner-spotlight.is-absolute {
  border-color: var(--admin-red);
  box-shadow: inset 0 0 0 1px var(--admin-red);
}

#adminView .admin-school-winner-copy h5 {
  font-size: 20px;
}

#adminView .admin-school-winner-open {
  border-color: var(--admin-line);
  background: #ffffff;
}

#adminView .admin-class-finalist-card {
  border-color: var(--admin-line);
  background: #ffffff;
}

#adminView .grouped-gallery {
  width: 100%;
}

#adminView .drawing-board-masonry {
  column-width: calc(210px * var(--card-scale));
  column-gap: 10px;
}

#adminView .drawing-board-discarded {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--admin-line);
}

#adminView .drawing-board-absolute,
#adminView .drawing-board-school-winners {
  margin-top: 6px;
}

#adminView .drawing-tile {
  margin: 0 0 10px;
  border-radius: 0;
  border-color: var(--admin-line);
  background: #ffffff;
  box-shadow: none;
}

#adminView .drawing-tile:hover,
#adminView .drawing-tile:focus-visible {
  border-color: var(--admin-red);
  box-shadow: inset 0 0 0 1px var(--admin-red);
}

#adminView .drawing-tile.is-discarded {
  border-color: #6a6a6a;
}

#adminView .drawing-tile.is-school-review.is-discarded {
  opacity: 0.92;
}

#adminView .drawing-tile-image-item,
#adminView .drawing-preview-button {
  background: #ffffff;
}

#adminView .drawing-preview-button:focus-visible {
  outline: 0;
}

#adminView .drawing-state-badge {
  top: 8px;
  left: 8px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 0;
  background: var(--admin-red);
  box-shadow: none;
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#adminView .drawing-state-badge.is-muted {
  background: rgba(20, 20, 20, 0.82);
}

#adminView .drawing-discard-overlay {
  background: rgba(0, 0, 0, 0.78);
}

#adminView .drawing-quick-actions {
  top: 8px;
  right: 8px;
  gap: 6px;
}

#adminView .quick-icon-button {
  width: 34px;
  min-height: 34px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: none;
  font-size: 13px;
}

#adminView .quick-icon-button.primary,
#adminView .quick-icon-button.swap {
  background: var(--admin-red);
  border-color: var(--admin-red);
  color: #ffffff;
}

#adminView .quick-icon-button.swap {
  min-width: 76px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#adminView .quick-icon-button.danger {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--admin-red);
  color: var(--admin-red-ink);
}

#adminView .quick-icon-button.is-active {
  background: var(--admin-red-strong);
  border-color: var(--admin-red-strong);
  color: #ffffff;
}

#adminView .quick-icon-button.top25,
#adminView .quick-icon-button.top25.is-active {
  background: #d9f4df;
  border-color: rgba(39, 131, 95, 0.74);
  color: #145c3f;
  box-shadow: 0 0 0 3px rgba(39, 131, 95, 0.14), 0 10px 20px rgba(39, 131, 95, 0.16);
}

#adminView .quick-icon-button.is-disabled,
#adminView .quick-icon-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.18);
}

#adminView .drawing-tile-pdf-item {
  background:
    linear-gradient(180deg, rgba(211, 47, 47, 0.05), rgba(211, 47, 47, 0.12)),
    linear-gradient(180deg, #fbfbfb, #f2f2f2);
}

#adminView .drawing-tile-pdf-card {
  min-height: 260px;
  padding: 16px;
  gap: 16px;
}

#adminView .drawing-tile-pdf-badge {
  border-radius: 0;
  background: rgba(211, 47, 47, 0.08);
  border-color: rgba(211, 47, 47, 0.2);
  color: var(--admin-red-ink);
}

#adminView .drawing-tile-pdf-sheet {
  border-radius: 0;
  background: #ffffff;
  border-color: rgba(211, 47, 47, 0.18);
  box-shadow: none;
}

#adminView .drawing-tile-pdf-sheet span {
  border-radius: 0;
  background: rgba(211, 47, 47, 0.18);
}

#adminView .lightbox-backdrop {
  background: rgba(8, 8, 8, 0.82);
}

#adminView .lightbox-dialog,
#adminView .trash-dialog,
#adminView .admin-summary-dialog,
#adminView .developer-dialog,
#adminView .app-settings-dialog {
  border-radius: 0;
  border: 1px solid var(--admin-line-strong);
  border-top: 4px solid var(--admin-red);
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  padding: 16px;
}

#adminView .lightbox-dialog,
#adminView .trash-dialog,
#adminView .admin-summary-dialog {
  max-height: calc(100vh - 28px);
}

#adminView .lightbox-toolbar {
  min-height: 48px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--admin-line);
}

#adminView .lightbox-actions,
#adminView .actions,
#adminView .lightbox-evaluation-actions {
  gap: 8px;
}

#adminView .lightbox-content {
  margin-top: 14px;
  min-height: 56vh;
  padding: 12px;
  border: 1px solid var(--admin-line);
  background:
    linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
}

#adminView .lightbox-content img,
#adminView .lightbox-content iframe {
  max-height: 72vh;
  background: #ffffff;
}

#adminView .lightbox-meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--admin-line);
}

#adminView .lightbox-meta-row {
  gap: 6px;
}

#adminView .lightbox-evaluation-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--admin-line);
}

#adminView .trash-dialog .stack,
#adminView .admin-summary-dialog .stack,
#adminView .app-settings-dialog .stack,
#adminView .developer-dialog .stack {
  gap: 14px;
}

#adminView .admin-trash-toolbar,
#adminView .admin-top25-toolbar {
  padding: 12px 0;
  border-top: 1px solid var(--admin-line);
  border-bottom: 1px solid var(--admin-line);
}

#adminView .admin-trash-summary,
#adminView .admin-top25-summary {
  gap: 4px;
}

#adminView #adminTrashList,
#adminView #adminTop25List {
  border: 1px solid var(--admin-line);
  background: #fbfbfb;
  padding: 10px;
}

#adminView .admin-summary-header {
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--admin-line);
}

#adminView .admin-summary-sections {
  gap: 14px;
}

#adminView .admin-summary-section {
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--admin-line);
}

#adminView .admin-summary-block {
  gap: 10px;
}

#adminView .admin-comparison-completion-card,
#adminView .admin-comparison-school-card,
#adminView .admin-summary-drawing-card {
  border-radius: 0;
  border-color: var(--admin-line);
  background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
  box-shadow: none;
}

#adminView .admin-summary-open-button {
  border-radius: 0;
}

#adminView .duplicate-upload-list,
#adminView .submit-summary {
  border: 1px solid var(--admin-line);
  background: #fbfbfb;
  padding: 12px;
}

#adminView .empty {
  border-radius: 0;
  border-color: var(--admin-line);
  background: #fafafa;
}

#authView.view.active,
#externalView.view {
  display: grid;
  gap: 18px;
}

#authView .hero,
#externalView .external-layout {
  gap: 18px;
}

#authView .hero-copy,
#authView .auth-card,
#externalView .panel,
#externalView .class-card,
#externalView .accordion,
#externalView .upload-feedback,
#externalView .upload-progress,
#externalView .mobile-action-bar,
#externalView .submit-summary-item,
#externalView .file-item,
#externalView .trash-item,
#externalView .school-picker-panel,
#externalView .school-option,
#externalView .file-open-link,
#externalView .upload-feedback-badge,
#externalView .step-chip {
  border-radius: 0;
}

#authView .hero-copy,
#authView .auth-card,
#externalView .panel,
#externalView .class-card,
#externalView .accordion,
#externalView .upload-feedback,
#externalView .upload-progress,
#externalView .mobile-action-bar,
#externalView .submit-summary-item,
#externalView .file-item,
#externalView .trash-item,
#externalView .school-picker-panel,
#externalView .school-option {
  border-color: #d7d7d7;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

#authView .hero-copy,
#authView .auth-card,
#externalView .panel,
#externalView .class-card,
#externalView .accordion,
#externalView .mobile-action-bar {
  border-top: 4px solid #d32f2f;
}

.topbar {
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid #b81f1f;
  background: #cf2b2b;
  backdrop-filter: none;
}

.brand-mark {
  border-radius: 0;
  background: linear-gradient(135deg, #f36c6c, #b71c1c);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.brand h1,
.brand p,
.topbar-actions .pill,
.topbar-actions button {
  color: #ffffff;
}

.brand p {
  color: rgba(255, 255, 255, 0.82);
}

.topbar-actions .pill,
.topbar-actions button {
  border-color: rgba(255, 255, 255, 0.68);
  background: transparent;
}

.topbar-actions button:hover,
.topbar-actions button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 -2px 0 0 #ffffff;
}

#authView .hero-copy,
#authView .auth-card {
  padding: 24px;
}

#authView .hero-copy h2 {
  font-size: 32px;
}

#authView .auth-card {
  display: grid;
  gap: 16px;
}

#authView form + form {
  padding-top: 14px;
  border-top: 1px solid #d7d7d7;
}

#authView input,
#authView select,
#authView button,
#externalView input,
#externalView select,
#externalView button,
#externalView .school-picker-trigger,
#externalView .file-open-link {
  border-radius: 0;
}

#authView input,
#authView select,
#authView button,
#externalView input,
#externalView select,
#externalView button,
#externalView .school-picker-trigger,
#externalView .file-open-link {
  border-color: #d7d7d7;
  background: #ffffff;
  color: #141414;
}

#authView input:focus,
#authView select:focus,
#authView button:focus-visible,
#externalView input:focus,
#externalView select:focus,
#externalView button:focus-visible,
#externalView .school-picker-trigger:focus-visible {
  outline: 0;
  border-color: #d32f2f;
  box-shadow: inset 0 0 0 1px #d32f2f;
}

#authView button.primary,
#externalView button.primary,
#externalView .upload-progress-bar {
  background: #d32f2f;
  border-color: #d32f2f;
  color: #ffffff;
}

#authView button.primary:hover,
#externalView button.primary:hover {
  background: #ab1f1f;
  border-color: #ab1f1f;
}

#authView button.ghost,
#externalView button.ghost,
#externalView .school-picker-trigger,
#externalView .file-open-link {
  background: #ffffff;
  color: #141414;
}

#authView button.ghost:hover,
#externalView button.ghost:hover,
#externalView .school-picker-trigger:hover,
#externalView .file-open-link:hover,
#externalView .school-option:hover,
#externalView .accordion summary:hover {
  border-color: #d32f2f;
  box-shadow: inset 0 -2px 0 0 #d32f2f;
}

#authView .status-line,
#externalView .status-line,
#authView .muted,
#externalView .muted,
#externalView label,
#externalView .eyebrow,
#externalView .helper-text {
  color: #5f5f5f;
}

#authView .eyebrow,
#externalView .eyebrow {
  letter-spacing: 0.08em;
}

#externalView .section-head {
  padding: 18px;
  border: 1px solid #d7d7d7;
  border-top: 4px solid #d32f2f;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

#externalView .section-head h2 {
  margin: 6px 0 8px;
  font-size: 30px;
}

#externalView .external-steps {
  gap: 8px;
  margin-bottom: 0;
}

#externalView .step-chip {
  min-height: 36px;
  border-color: #d7d7d7;
  background: #ffffff;
  color: #7f1111;
}

#externalView .step-chip.active {
  background: #d32f2f;
  border-color: #d32f2f;
  color: #ffffff;
}

#externalView .external-sidebar {
  top: 84px;
}

#externalView .external-sidebar-section {
  padding-top: 16px;
  border-top-color: #d7d7d7;
}

#externalView .external-main-head {
  padding-bottom: 10px;
  border-bottom: 1px solid #d7d7d7;
}

#externalView .external-guidance-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(211, 47, 47, 0.18);
  border-left: 4px solid #d32f2f;
  background: #fff8f8;
}

#externalView .external-guidance-card strong {
  color: #7f1111;
  font-size: 14px;
}

#externalView .external-guidance-card span {
  color: #5f5f5f;
  font-size: 13px;
  line-height: 1.45;
}

#externalView .class-card-head,
#externalView .accordion summary {
  padding: 14px;
}

#externalView .external-class-card {
  border-left: 4px solid #d7d7d7;
}

#externalView .external-class-card.is-ready {
  border-left-color: #27835f;
}

#externalView .external-class-card.is-empty {
  border-left-color: #b47b16;
}

#externalView .class-card-title-block {
  min-width: 0;
  display: grid;
  gap: 6px;
}

#externalView .class-card-head h4 {
  font-size: 22px;
}

#externalView .class-card-status {
  min-width: 150px;
  display: grid;
  gap: 3px;
  align-content: start;
  padding: 9px 10px;
  border: 1px solid #d7d7d7;
  background: #fbfbfb;
}

#externalView .class-card-status strong {
  color: #141414;
  font-size: 13px;
}

#externalView .class-card-status span {
  color: #5f5f5f;
  font-size: 12px;
}

#externalView .class-card-body,
#externalView .accordion-body {
  padding: 14px;
  border-top-color: #d7d7d7;
}

#externalView .class-card-summary {
  gap: 8px;
}

#externalView .pill,
#externalView .file-type-pill,
#externalView .file-fresh-pill,
#externalView .upload-feedback-badge,
#externalView .file-open-link {
  min-height: 28px;
  border-color: #d7d7d7;
  background: #ffffff;
  color: #7f1111;
}

#externalView .upload-dropzone {
  border-radius: 0;
  border-color: rgba(211, 47, 47, 0.3);
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
  padding: 18px;
}

#externalView .dropzone-title {
  font-size: 17px;
}

#externalView .upload-dropzone.dragover {
  border-color: #d32f2f;
  background: rgba(211, 47, 47, 0.05);
}

#externalView .upload-feedback.ok,
#externalView .upload-progress {
  border-color: rgba(211, 47, 47, 0.24);
  background: rgba(211, 47, 47, 0.05);
}

#externalView .upload-feedback.error {
  border-color: rgba(171, 31, 31, 0.3);
  background: rgba(171, 31, 31, 0.06);
}

#externalView .upload-progress-track {
  border-radius: 0;
  background: #ececec;
}

#externalView .upload-progress-bar {
  border-radius: 0;
}

#externalView .file-list {
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #d32f2f #f0f0f0;
}

#externalView .file-list::-webkit-scrollbar,
#externalView .school-picker-options::-webkit-scrollbar {
  width: 10px;
}

#externalView .file-list::-webkit-scrollbar-track,
#externalView .school-picker-options::-webkit-scrollbar-track {
  background: #f0f0f0;
}

#externalView .file-list::-webkit-scrollbar-thumb,
#externalView .school-picker-options::-webkit-scrollbar-thumb {
  background: #d32f2f;
}

#externalView .mobile-action-bar {
  bottom: 10px;
}

#adminView.view {
  display: grid;
  gap: 18px;
}

#adminView .panel {
  padding: 18px;
}

#adminView .stack {
  gap: 14px;
}

#adminView .toolbar {
  gap: 12px;
}

#adminView .admin-layout {
  gap: 16px;
}

#adminView .admin-layout > .panel {
  overflow: hidden;
}

#adminView .admin-top-actions {
  row-gap: 8px;
}

#adminView .admin-top-actions button {
  min-height: 42px;
}

#adminView .admin-top-copy {
  display: grid;
  gap: 6px;
}

#adminView .admin-top-copy p {
  margin: 0;
}

#adminView .admin-class-strip,
#adminView .admin-layout > .panel {
  border-top-width: 4px;
}

#adminView .admin-class-summary,
#adminView .admin-progress-summary,
#adminView .admin-summary-header {
  align-items: center;
}

#adminView .admin-section-divider {
  position: relative;
  height: 18px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 0 32px;
  margin: -4px 0 -2px;
}

#adminView .admin-section-divider::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: #d32f2f;
}

#adminView .admin-divider-notch {
  position: relative;
  width: 42px;
  height: 12px;
  display: inline-block;
  flex: 0 0 auto;
}

#adminView .admin-divider-notch::before,
#adminView .admin-divider-notch::after {
  content: "";
  position: absolute;
  bottom: 0;
  height: 4px;
  background: #d32f2f;
}

#adminView .admin-divider-notch::before {
  left: 0;
  width: 14px;
  transform: skewX(-38deg);
  transform-origin: left bottom;
}

#adminView .admin-divider-notch::after {
  right: 0;
  width: 28px;
}

#adminView .admin-section-divider-subtle {
  height: 14px;
  margin: -2px 0 0;
  opacity: 0.92;
}

#adminView .admin-section-divider-subtle::after,
#adminView .admin-section-divider-subtle .admin-divider-notch::before,
#adminView .admin-section-divider-subtle .admin-divider-notch::after {
  background: rgba(211, 47, 47, 0.9);
}

#adminView .pill,
#adminView .file-type-pill,
#adminView .file-fresh-pill {
  min-height: 30px;
  padding: 4px 10px;
}

#adminView .sidebar {
  top: 84px;
}

#adminView #adminTrashList,
#adminView #adminTop25List,
#adminView .duplicate-upload-list {
  scrollbar-width: thin;
  scrollbar-color: var(--admin-red) #f0f0f0;
}

#adminView #adminTrashList::-webkit-scrollbar,
#adminView #adminTop25List::-webkit-scrollbar,
#adminView .duplicate-upload-list::-webkit-scrollbar {
  width: 10px;
}

#adminView #adminTrashList::-webkit-scrollbar-track,
#adminView #adminTop25List::-webkit-scrollbar-track,
#adminView .duplicate-upload-list::-webkit-scrollbar-track {
  background: #f0f0f0;
}

#adminView #adminTrashList::-webkit-scrollbar-thumb,
#adminView #adminTop25List::-webkit-scrollbar-thumb,
#adminView .duplicate-upload-list::-webkit-scrollbar-thumb {
  background: var(--admin-red);
}

@media (max-width: 1120px) {
  #adminView .admin-metrics-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #adminView .admin-gallery-toolbar {
    grid-template-columns: repeat(4, auto) minmax(0, 1fr);
  }

  #adminView .admin-filter-summary {
    grid-column: 1 / -1;
  }

  #adminView #adminGalleryCount {
    justify-self: start;
  }

  #adminView .admin-trash-toolbar,
  #adminView .admin-top25-toolbar {
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  #authView .hero,
  #externalView .external-layout {
    grid-template-columns: 1fr;
  }

  #authView .hero-copy,
  #authView .auth-card,
  #externalView .panel,
  #externalView .section-head {
    padding: 16px;
  }

  #externalView .section-head h2,
  #authView .hero-copy h2 {
    font-size: 24px;
  }

  #externalView .class-form-grid {
    grid-template-columns: 1fr;
  }

  #externalView .mobile-action-bar {
    padding: 12px 14px;
  }

  #adminView .panel,
  #adminView .admin-top-strip,
  #adminView .admin-class-strip {
    padding: 14px;
  }

  #adminView .admin-top-copy h2 {
    font-size: 24px;
  }

  #adminView .admin-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #adminView .admin-gallery-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  #adminView .admin-gallery-states,
  #adminView #adminSchoolFilterButton,
  #adminView #adminPrevClassButton,
  #adminView #adminNextClassButton,
  #adminView .admin-filter-summary {
    width: 100%;
  }

  #adminView .admin-gallery-states,
  #adminView .admin-filter-summary {
    grid-column: 1 / -1;
  }

  #adminView #adminPrevClassButton,
  #adminView #adminNextClassButton {
    min-width: 0;
  }

  #adminView #adminGalleryCount {
    justify-self: start;
  }

  #adminView .admin-class-list {
    grid-auto-columns: minmax(220px, 240px);
  }

  #adminView .drawing-board-masonry {
    column-width: 170px;
  }

  #adminView .lightbox-dialog,
  #adminView .trash-dialog,
  #adminView .admin-summary-dialog,
  #adminView .developer-dialog,
  #adminView .app-settings-dialog {
    width: calc(100% - 16px);
    margin: 8px auto;
    padding: 14px;
  }
}

/* Testata globale fissa e dashboard gestore */
.shell {
  padding-top: 72px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  width: 100%;
  height: 72px;
  gap: 18px;
  padding: 10px 24px;
  border-bottom: 1px solid #a71919;
  background: rgba(198, 31, 31, 0.98);
  box-shadow: 0 7px 22px rgba(40, 0, 0, 0.2);
}

.lightbox {
  z-index: 200;
}

.brand {
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.brand-mark::after {
  content: "CD";
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand h1 {
  font-size: 19px;
  letter-spacing: -0.01em;
}

.brand p {
  margin-top: 4px;
  font-size: 12px;
}

.topbar-actions {
  gap: 8px;
}

.topbar-actions .pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-color: rgba(255, 255, 255, 0.46);
  background: rgba(111, 0, 0, 0.2);
  font-weight: 700;
}

.topbar-actions #logoutButton {
  min-height: 38px;
  padding: 7px 14px;
  border-color: rgba(255, 255, 255, 0.76);
  background: transparent;
  font-weight: 800;
}

#adminView .admin-top-strip {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(0, 1.35fr);
  grid-template-areas:
    "actions actions"
    "copy metrics";
  align-items: stretch;
  gap: 0;
  padding: 0;
  margin-bottom: 18px;
  border: 0;
  border-bottom: 1px solid var(--admin-line-strong);
  background: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

#adminView .admin-top-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 28px;
  border-bottom: 1px solid #a71919;
  background: #d83232;
}

#adminView .admin-top-action-group {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-right: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.35);
}

#adminView .admin-top-action-group:last-child {
  padding-right: 0;
  border-right: 0;
}

#adminView .admin-top-strip .admin-top-actions button {
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

#adminView .admin-top-strip .admin-top-action-workspace button {
  background: #fff;
  border-color: #fff;
  color: var(--admin-red-ink);
}

#adminView .admin-top-strip .admin-top-action-results button {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(120, 0, 0, 0.18);
}

#adminView .admin-top-strip .admin-top-actions button:hover,
#adminView .admin-top-strip .admin-top-actions button:focus-visible {
  border-color: #fff;
  background: #fff;
  color: var(--admin-red-ink);
  box-shadow: none;
}

#adminView .admin-top-copy {
  grid-area: copy;
  align-content: center;
  gap: 8px;
  padding: 24px 28px;
  border-right: 1px solid var(--admin-line);
  background: #fff;
}

#adminView .admin-top-copy .eyebrow {
  color: var(--admin-red-ink);
  font-weight: 800;
}

#adminView .admin-top-copy h2 {
  margin: 0;
  color: var(--admin-ink);
  font-size: 30px;
}

#adminView .admin-top-copy p {
  max-width: 720px;
  color: var(--admin-ink-muted);
  font-size: 14px;
  line-height: 1.45;
}

#adminView .admin-metrics-row {
  grid-area: metrics;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  background: #f5f5f5;
}

#adminView .admin-metric {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 16px 18px;
  border: 0;
  border-right: 1px solid var(--admin-line);
  border-bottom: 1px solid var(--admin-line);
  background: #f8f8f8;
}

#adminView .admin-metric:nth-child(3n) {
  border-right: 0;
}

#adminView .admin-metric:nth-child(n + 4) {
  border-bottom: 0;
}

#adminView .admin-metric .summary-label {
  color: var(--admin-ink-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#adminView .admin-metric .summary-value {
  color: var(--admin-ink);
  font-size: 25px;
  line-height: 1;
}

#adminView .admin-metric:nth-child(4),
#adminView .admin-metric:nth-child(5),
#adminView .admin-metric:nth-child(6) {
  box-shadow: inset 4px 0 0 var(--admin-red);
  background: #fff8f8;
}

@media (max-width: 980px) {
  #adminView .admin-top-strip {
    grid-template-columns: 1fr;
    grid-template-areas:
      "actions"
      "copy"
      "metrics";
  }

  #adminView .admin-top-copy {
    border-right: 0;
    border-bottom: 1px solid var(--admin-line);
  }

  #adminView .admin-top-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .shell {
    padding-top: 66px;
  }

  .topbar {
    height: 66px;
    padding: 8px 12px;
  }

  .brand-mark {
    width: 38px;
    min-width: 38px;
    height: 38px;
  }

  .brand p,
  .topbar-actions .pill {
    display: none;
  }

  #adminView .admin-top-actions {
    gap: 10px;
    padding: 12px;
  }

  #adminView .admin-top-action-group {
    width: 100%;
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  }

  #adminView .admin-top-action-group:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  #adminView .admin-top-action-group button {
    flex: 1;
  }

  #adminView .admin-top-copy {
    padding: 20px 16px;
  }

  #adminView .admin-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #adminView .admin-metric:nth-child(3n) {
    border-right: 1px solid var(--admin-line);
  }

  #adminView .admin-metric:nth-child(2n) {
    border-right: 0;
  }

  #adminView .admin-metric:nth-child(n + 4) {
    border-bottom: 1px solid var(--admin-line);
  }

  #adminView .admin-metric:nth-child(n + 5) {
    border-bottom: 0;
  }
}

/* Dashboard V2: densità, navigazione contestuale e avanzamento */
#adminView .admin-top-strip {
  box-shadow: none;
}

#adminView .admin-top-copy {
  padding: 14px 28px 10px;
}

#adminView .admin-top-copy h2 {
  font-size: 25px;
}

#adminView .admin-top-copy p {
  max-width: 760px;
  font-size: 13px;
}

#adminView .admin-metrics-row {
  gap: 6px;
  padding: 0 28px 14px;
}

#adminView .admin-metric,
#adminView .admin-metric:nth-child(n) {
  position: relative;
  min-height: 64px;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-content: center;
  padding: 9px 12px;
  text-align: left;
}

#adminView button.admin-metric-action {
  cursor: pointer;
}

#adminView button.admin-metric-action:hover,
#adminView button.admin-metric-action:focus-visible {
  border-color: #fff;
  background: rgba(92, 0, 0, 0.42);
  box-shadow: inset 0 0 0 1px #fff;
}

#adminView .admin-metric .summary-label {
  grid-column: 1 / -1;
}

#adminView .admin-metric .summary-value {
  grid-column: 1;
  grid-row: 2;
  font-size: 20px;
}

#adminView .admin-metric-hint {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-workflow-bar {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin: 0 0 18px;
  padding: 14px 28px;
  border-top: 1px solid #c6c6c6;
  border-bottom: 1px solid #c6c6c6;
  background: #fff;
}

.admin-workflow-steps {
  display: grid;
  grid-template-columns: auto minmax(30px, 1fr) auto minmax(30px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.admin-workflow-phase {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #777;
  cursor: pointer;
  transition: color 0.18s ease, transform 0.18s ease;
}

.admin-workflow-phase:hover,
.admin-workflow-phase:focus-visible {
  color: #8e1115;
  transform: translateY(-1px);
}

.admin-workflow-phase > span {
  width: 30px;
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid #aaa;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.admin-workflow-phase > div {
  display: grid;
  gap: 2px;
}

.admin-workflow-phase strong {
  color: inherit;
  font-size: 13px;
  line-height: 1.1;
}

.admin-workflow-phase small {
  font-size: 11px;
  line-height: 1.1;
}

.admin-workflow-phase.active {
  color: #8e1115;
}

.admin-workflow-phase.active > span {
  border-color: #d32f2f;
  background: #d32f2f;
  color: #fff;
}

.admin-workflow-phase.complete {
  color: #176444;
}

.admin-workflow-phase.complete > span {
  border-color: #27835f;
  background: #edf8f2;
  color: #176444;
}

.admin-workflow-connector {
  height: 2px;
  background: #d5d5d5;
}

.admin-workflow-live {
  min-width: 260px;
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  border-left: 4px solid #d32f2f;
  background: #fff5f5;
}

.admin-workflow-live strong {
  color: #181818;
  font-size: 13px;
}

.admin-workflow-live span {
  color: #666;
  font-size: 12px;
}

#adminView .admin-layout > .panel {
  overflow: visible;
}

#adminView .admin-gallery-controlbar {
  position: sticky;
  top: 72px;
  z-index: 18;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin: -20px -20px 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--admin-line-strong);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}

#adminView .admin-gallery-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

#adminView .admin-gallery-primary,
#adminView .admin-gallery-context {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#adminView .admin-gallery-context {
  padding-left: 14px;
  border-left: 1px solid var(--admin-line);
}

#adminView .admin-gallery-controlbar .segmented button,
#adminView .admin-gallery-controlbar button {
  min-height: 40px;
}

#adminView .admin-gallery-controlbar #adminGalleryCount {
  min-height: 34px;
  align-self: center;
  white-space: nowrap;
  background: #fff5f5;
  border-color: #d32f2f;
  font-weight: 800;
}

#adminView .admin-workbar {
  padding-top: 10px;
  border-top: 0;
}

#adminView .admin-state-hint {
  min-height: 0;
  padding: 8px 12px;
  border-left: 4px solid #b7b7b7;
  background: #f6f6f6;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
}

@media (max-width: 1050px) {
  .admin-workflow-bar {
    grid-template-columns: 1fr;
  }

  .admin-workflow-live {
    min-width: 0;
  }

  #adminView .admin-gallery-controlbar,
  #adminView .admin-gallery-toolbar {
    align-items: stretch;
  }

  #adminView .admin-gallery-toolbar {
    flex-direction: column;
  }

  #adminView .admin-gallery-context {
    padding: 10px 0 0;
    border-left: 0;
    border-top: 1px solid var(--admin-line);
  }
}

@media (max-width: 720px) {
  .admin-workflow-bar {
    padding: 12px 16px;
  }

  .admin-workflow-steps {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-workflow-connector {
    display: none;
  }

  .admin-workflow-phase {
    padding: 8px;
    border: 1px solid #ddd;
  }

  #adminView .admin-gallery-controlbar {
    top: 66px;
    grid-template-columns: 1fr;
    margin-inline: -16px;
  }

  #adminView .admin-gallery-primary,
  #adminView .admin-gallery-context {
    flex-wrap: wrap;
  }

#adminView .admin-gallery-states {
    width: 100%;
  }
}


/* Palette funzionale - override conclusivo */
body .page:has(#adminView.active) {
  background: #f3f0ea;
}

body .admin-workflow-bar {
  border-color: #d6cec3;
  background: #fffdf9;
  box-shadow: 0 7px 20px rgba(67, 49, 28, 0.07);
}

body .admin-workflow-live {
  border-left-color: #b47b16;
  background: #fff8ea;
}

body #adminView .admin-gallery-controlbar {
  border-color: #d1c9bf;
  background: rgba(255, 253, 249, 0.97);
  box-shadow: 0 8px 20px rgba(67, 49, 28, 0.09);
}

body #adminView .admin-state-hint {
  border-left-color: #9d9489;
  background: #ebe7e1;
  color: #5f584f;
}

body #adminView .admin-layout > .panel {
  border-color: #d1c9bf;
  background: #fffdf9;
  box-shadow: 0 12px 28px rgba(67, 49, 28, 0.08);
}

body #adminView .admin-class-workbench.is-school-review {
  border-color: #cfc6ba;
  border-top-color: #d32f2f;
  background: #faf7f2;
  box-shadow: 0 10px 24px rgba(67, 49, 28, 0.06);
}

body #adminView .admin-school-review-card-current.is-ready {
  background: linear-gradient(180deg, #f1f8f4, #fffdf9 48%);
}

body #adminView .admin-school-review-card-current.needs-action {
  background: linear-gradient(180deg, #fff2f2, #fffdf9 48%);
}

body #adminView .admin-school-review-card-next {
  background: linear-gradient(180deg, #fff8ea, #fffdf9 48%);
}

body #adminView .admin-workflow-progress > div,
body #adminView .gallery-group {
  border-color: #d9d1c7;
  background: #fffdf9;
}

body #adminView .admin-school-winner-spotlight {
  background: #fffdf9;
  box-shadow: 0 9px 22px rgba(67, 49, 28, 0.07);
}

body #adminView .admin-school-winner-spotlight.is-absolute {
  background: linear-gradient(110deg, #fffdf9, #fff2f2);
}

.page:has(#adminView.active) {
  background: #f3f0ea;
}

#adminView .admin-section-divider {
  background: linear-gradient(180deg, #eee8df, #f5f1eb);
  border-color: #d7d0c7;
}

.admin-workflow-bar {
  border-color: #d6cec3;
  background: #fffdf9;
  box-shadow: 0 7px 20px rgba(67, 49, 28, 0.07);
}

.admin-workflow-phase > span {
  border-color: #bbb2a7;
  background: #f7f3ed;
}

.admin-workflow-connector {
  background: #d8d0c6;
}

.admin-workflow-live {
  border-left-color: #b47b16;
  background: #fff8ea;
}

#adminView .admin-gallery-controlbar {
  border-color: #d1c9bf;
  background: rgba(255, 253, 249, 0.97);
  box-shadow: 0 8px 20px rgba(67, 49, 28, 0.09);
}

#adminView .admin-gallery-controlbar #adminGalleryCount {
  border-color: #c9a6a6;
  background: #fff2f2;
}

#adminView .admin-state-hint {
  border-left-color: #9d9489;
  background: #ebe7e1;
  color: #5f584f;
}

#adminView .admin-layout > .panel {
  border-color: #d1c9bf;
  background: #fffdf9;
  box-shadow: 0 12px 28px rgba(67, 49, 28, 0.08);
}

#adminView .admin-class-workbench.is-school-review {
  border-color: #cfc6ba;
  border-top-color: #d32f2f;
  background: #faf7f2;
  box-shadow: 0 10px 24px rgba(67, 49, 28, 0.06);
}

#adminView .admin-school-review-card-current.is-ready {
  border-top-color: #27835f;
  background: linear-gradient(180deg, #f1f8f4 0%, #fffdf9 48%);
}

#adminView .admin-school-review-card-current.needs-action {
  border-top-color: #d32f2f;
  background: linear-gradient(180deg, #fff2f2 0%, #fffdf9 48%);
}

#adminView .admin-school-review-card-next {
  border-top-color: #b47b16;
  background: linear-gradient(180deg, #fff8ea 0%, #fffdf9 48%);
}

#adminView .admin-workflow-progress > div {
  border-color: #d9d1c7;
  background: #fffdf9;
  box-shadow: inset 0 3px 0 #e6ded4;
}

#adminView .admin-school-winner-spotlight {
  border-color: #cec5ba;
  border-left-color: #27835f;
  background: #fffdf9;
  box-shadow: 0 9px 22px rgba(67, 49, 28, 0.07);
}

#adminView .admin-school-winner-spotlight.is-absolute {
  border-color: #d7a9a9;
  border-left-color: #d32f2f;
  background: linear-gradient(110deg, #fffdf9, #fff2f2);
}

#adminView .admin-highlighted-drawing-meta span {
  border-color: #d6cec4;
  background: #f3efe9;
}

#adminView .gallery-group {
  border-color: #d1c9bf;
  background: #fffdf9;
  box-shadow: 0 8px 20px rgba(67, 49, 28, 0.05);
}

#adminView .drawing-tile {
  border-color: #cec5ba;
  background: #fffefa;
  box-shadow: 0 5px 14px rgba(67, 49, 28, 0.06);
}

/* Palette calda funzionale: profondità senza rumore cromatico */
.page:has(#adminView.active) {
  background: #f3f0ea;
}

#adminView {
  --admin-page: #f3f0ea;
  --admin-paper: #fffdf9;
  --admin-soft: #f6f3ee;
  --admin-green-soft: #f1f8f4;
  --admin-green-line: #27835f;
  --admin-amber-soft: #fff8ea;
  --admin-amber-line: #b47b16;
  --admin-red-soft: #fff2f2;
}

#adminView .admin-section-divider {
  background: linear-gradient(180deg, #eee8df 0%, #f5f1eb 100%);
  border-color: #d7d0c7;
}

.admin-workflow-bar {
  border-color: #d6cec3;
  background: #fffdf9;
  box-shadow: 0 7px 20px rgba(67, 49, 28, 0.07);
}

.admin-workflow-phase {
  color: #766f66;
}

.admin-workflow-phase > span {
  border-color: #bbb2a7;
  background: #f7f3ed;
}

.admin-workflow-connector {
  background: #d8d0c6;
}

.admin-workflow-phase.complete > span {
  border-color: var(--admin-green-line);
  background: var(--admin-green-soft);
}

.admin-workflow-live {
  border-left-color: var(--admin-amber-line);
  background: var(--admin-amber-soft);
}

#adminView .admin-gallery-controlbar {
  border-color: #d1c9bf;
  background: rgba(255, 253, 249, 0.97);
  box-shadow: 0 8px 20px rgba(67, 49, 28, 0.09);
}

#adminView .admin-gallery-controlbar #adminGalleryCount {
  border-color: #c9a6a6;
  background: var(--admin-red-soft);
}

#adminView .admin-workbar {
  background: transparent;
}

#adminView .admin-state-hint {
  border-left-color: #9d9489;
  background: #ebe7e1;
  color: #5f584f;
}

#adminView .admin-layout > .panel {
  border-color: #d1c9bf;
  background: var(--admin-paper);
  box-shadow: 0 12px 28px rgba(67, 49, 28, 0.08);
}

#adminView .admin-class-workbench.is-school-review {
  border-color: #cfc6ba;
  border-top-color: var(--admin-red);
  background: #faf7f2;
  box-shadow: 0 10px 24px rgba(67, 49, 28, 0.06);
}

#adminView .admin-class-workbench.is-school-review .admin-class-workbench-head {
  border-color: #d8d0c6;
  background: var(--admin-paper);
  margin: -20px -20px 0;
  padding: 18px 20px;
}

#adminView .admin-school-review-grid-focused .admin-school-review-card {
  border-color: #d1c9bf;
  box-shadow: 0 7px 18px rgba(67, 49, 28, 0.05);
}

#adminView .admin-school-review-card-current.is-ready {
  border-top-color: var(--admin-green-line);
  background: linear-gradient(180deg, var(--admin-green-soft) 0%, #fffdf9 48%);
}

#adminView .admin-school-review-card-current.needs-action {
  border-top-color: var(--admin-red);
  background: linear-gradient(180deg, var(--admin-red-soft) 0%, #fffdf9 48%);
}

#adminView .admin-school-review-card-next {
  border-top-color: var(--admin-amber-line);
  background: linear-gradient(180deg, var(--admin-amber-soft) 0%, #fffdf9 48%);
}

#adminView .admin-workflow-progress > div {
  border-color: #d9d1c7;
  background: rgba(255, 253, 249, 0.9);
  box-shadow: inset 0 3px 0 #e6ded4;
}

#adminView .admin-class-decision-card {
  border-top-color: #c7bdb1;
  background: transparent;
}

#adminView .admin-school-winner-spotlight {
  border-color: #cec5ba;
  border-left-color: var(--admin-green-line);
  background: var(--admin-paper);
  box-shadow: 0 9px 22px rgba(67, 49, 28, 0.07);
}

#adminView .admin-school-winner-spotlight.is-absolute {
  border-color: #d7a9a9;
  border-left-color: var(--admin-red);
  background: linear-gradient(110deg, #fffdf9 0%, var(--admin-red-soft) 100%);
}

#adminView .admin-school-winner-open {
  border-color: #d1c9bf;
  background: #ede8e1;
}

#adminView .admin-highlighted-drawing-meta span {
  border-color: #d6cec4;
  background: #f3efe9;
}

#adminView .gallery-group {
  border-color: #d1c9bf;
  background: var(--admin-paper);
  box-shadow: 0 8px 20px rgba(67, 49, 28, 0.05);
}

#adminView .drawing-tile {
  border-color: #cec5ba;
  background: #fffefa;
  box-shadow: 0 5px 14px rgba(67, 49, 28, 0.06);
}

#adminView .drawing-tile:hover,
#adminView .drawing-tile:focus-visible {
  border-color: var(--admin-red);
  box-shadow: 0 9px 20px rgba(90, 25, 20, 0.12);
}

#adminView .empty {
  border-color: #cfc6ba;
  background: #f6f2ec;
}

body[data-theme="night"] .page:has(#adminView.active),
body[data-theme="night"] #adminView {
  --admin-page: #151b22;
  --admin-paper: #1d2630;
  --admin-soft: #222d38;
}

/* Anteprima del disegno scelto: centratura indipendente dalle proporzioni */
#adminView .admin-school-winner-preview {
  width: 100%;
  min-width: 0;
  display: grid;
  place-items: center;
  align-self: center;
}

#adminView .admin-school-winner-open {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
  background: #f4f4f4;
}

#adminView .admin-school-winner-open img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center center;
}

@media (max-width: 720px) {
  .topbar {
    padding: 14px 16px;
  }

  #authView.view.active,
  #externalView.view {
    gap: 14px;
  }

  #externalView .external-steps {
    gap: 6px;
  }

  #externalView .step-chip {
    white-space: nowrap;
  }

  #externalView .file-item,
  #externalView .file-item-actions,
  #externalView .dropzone-actions,
  #externalView .upload-feedback-head,
  #externalView .upload-progress-head {
    align-items: stretch;
    flex-direction: column;
  }

  #externalView .dropzone-actions button,
  #externalView .mobile-action-bar button {
    width: 100%;
  }

  #externalView .school-picker-panel {
    padding: 8px;
  }

  #adminView.view {
    gap: 14px;
  }

  #adminView .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  #adminView .admin-top-actions,
  #adminView .admin-class-toolbar-actions {
    width: 100%;
  }

  #adminView .segmented {
    width: 100%;
  }

  #adminView .admin-class-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #adminView .admin-top-actions button,
  #adminView .admin-class-toolbar-actions button {
    width: 100%;
  }

  #adminView .drawing-board-masonry {
    column-width: 150px;
    column-gap: 8px;
  }
}

/* Passaggio dalla scrematura globale alla revisione delle scuole */
#adminView .admin-focus-strip {
  display: grid;
  gap: 16px;
}

#adminView .admin-progress-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

#adminView .admin-progress-metric {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--admin-line);
  border-left: 5px solid #777;
  background: #fff;
}

#adminView .admin-progress-metric strong {
  font-size: 28px;
  line-height: 1;
  color: var(--admin-ink);
}

#adminView .admin-progress-metric small {
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--admin-ink-muted);
}

#adminView .admin-progress-metric.is-active {
  border-left-color: #24845f;
  background: #f3faf7;
}

#adminView .admin-progress-metric.is-discarded {
  border-left-color: #303030;
  background: #f5f5f5;
}

#adminView .admin-progress-metric.is-remaining {
  border-left-color: var(--admin-red);
  background: #fff7f7;
}

#adminView .admin-progress-metric.is-protected {
  border-left-color: #b47b16;
  background: #fffaf0;
}

#adminView .admin-winner-summary.is-phase-complete {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 24px 26px;
  border: 2px solid var(--admin-red);
  border-left-width: 8px;
  background: linear-gradient(110deg, #fff 0%, #fff7f7 65%, #fbe8e8 100%);
  box-shadow: 0 12px 30px rgba(80, 12, 12, 0.08);
  color: var(--admin-ink);
}

#adminView .admin-phase-message-copy {
  display: grid;
  gap: 7px;
}

#adminView .admin-phase-message-eyebrow {
  color: var(--admin-red-ink);
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#adminView .admin-phase-message-title {
  display: block;
  color: var(--admin-ink);
  font-size: clamp(22px, 2.1vw, 32px);
  line-height: 1.1;
}

#adminView .admin-phase-message-body {
  display: block;
  max-width: 850px;
  color: var(--admin-ink-muted);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
}

#adminView .admin-phase-message-meta {
  display: block;
  margin-top: 4px;
  color: var(--admin-red-ink);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 800;
}

#adminView .admin-phase-message-action {
  min-width: 250px;
  min-height: 54px;
  padding-inline: 22px;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

#adminView .gallery-group.drawing-board-absolute {
  padding: 22px;
  border: 2px solid var(--admin-red);
  border-top-width: 6px;
  background: linear-gradient(135deg, #fff 0%, #fff7f7 100%);
}

#adminView .gallery-group.drawing-board-absolute .eyebrow {
  color: var(--admin-red-ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

#adminView .gallery-group.drawing-board-absolute .drawing-board-masonry {
  width: min(380px, 100%);
  column-width: auto;
}

#adminView .gallery-group.drawing-board-absolute .drawing-tile {
  margin-bottom: 0;
  border-width: 2px;
  border-color: var(--admin-red);
  box-shadow: 0 16px 34px rgba(80, 12, 12, 0.14);
}

@media (max-width: 900px) {
  #adminView .admin-progress-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #adminView .admin-phase2-sticky-counters {
    top: 66px;
    grid-template-columns: 1fr 1fr;
    margin-inline: -16px;
    border-left-width: 0;
  }

  #adminView .admin-phase2-sticky-item {
    padding: 8px 10px;
  }

  #adminView .admin-phase2-sticky-item strong {
    font-size: 20px;
  }

  #adminView .admin-winner-summary.is-phase-complete {
    grid-template-columns: 1fr;
  }

  #adminView .admin-phase-message-action {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  #adminView .admin-progress-summary {
    grid-template-columns: 1fr;
  }
}

#adminView .admin-top-strip {
  background: #da3434;
  border-color: #b81f1f;
  box-shadow: none;
  padding: 20px 32px 18px;
  gap: 14px;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}

#adminView .admin-top-actions {
  gap: 10px;
}

#adminView .admin-top-strip button.ghost,
#adminView .admin-top-strip button.primary,
#adminView .admin-top-strip .admin-settings-button {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.92);
  color: #ffffff;
  font-weight: 600;
  box-shadow: none;
}

#adminView .admin-top-strip button.ghost:hover,
#adminView .admin-top-strip button.ghost:focus-visible,
#adminView .admin-top-strip button.primary:hover,
#adminView .admin-top-strip button.primary:focus-visible,
#adminView .admin-top-strip .admin-settings-button:hover,
#adminView .admin-top-strip .admin-settings-button:focus-visible {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--admin-red-ink);
  box-shadow: none;
}

#adminView .admin-top-strip .admin-settings-button:disabled,
#adminView .admin-top-strip button:disabled {
  opacity: 0.7;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.5);
  box-shadow: none;
}

#adminView .admin-top-copy h2 {
  margin: 2px 0 6px;
  font-size: 28px;
}

#adminView .admin-top-copy p {
  max-width: 920px;
  color: rgba(255, 255, 255, 0.86);
}

#adminView .admin-metrics-row {
  gap: 8px;
}

#adminView .admin-metric {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.26);
  box-shadow: none;
  padding: 12px;
}

#adminView .admin-metric .summary-label {
  color: rgba(255, 255, 255, 0.78);
}

#adminView .admin-metric .summary-value {
  color: #ffffff;
  font-size: 20px;
}

.admin-top-strip {
  padding: 18px 20px;
  margin-bottom: 18px;
}

.admin-top-strip {
  display: grid;
  gap: 16px;
}

.admin-top-copy h2 {
  margin: 6px 0 8px;
  font-size: 30px;
  line-height: 1.05;
}

.admin-top-copy p {
  margin: 0;
  color: var(--muted);
}

.admin-settings-button {
  justify-self: start;
}

.admin-metrics-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.admin-metric {
  border: 1px solid rgba(220, 207, 180, 0.96);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 14px;
}

.admin-filter-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.admin-focus-strip {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.admin-class-workbench {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(47, 120, 104, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.admin-class-workbench.is-school-review {
  gap: 10px;
  padding: 12px 16px;
}

.admin-class-workbench-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.admin-class-workbench-head h3 {
  margin: 6px 0 4px;
  font-size: 24px;
  line-height: 1.08;
}

.admin-class-workbench.is-school-review .admin-class-workbench-head h3 {
  margin: 2px 0 0;
  font-size: 20px;
}

.admin-class-workbench.is-school-review .admin-class-workbench-head .eyebrow {
  display: none;
}

.admin-class-workbench.is-school-review #adminClassWorkbenchMeta {
  margin: 0;
  font-size: 13px;
}

.admin-class-workbench-actions,
.admin-class-workbench-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-class-workbench-stage {
  display: grid;
  gap: 12px;
}

.admin-class-workbench.is-school-review .admin-class-workbench-stage {
  gap: 10px;
}

.admin-school-review-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-school-review-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.68);
}

.admin-school-review-card h4 {
  margin: 2px 0 0;
  font-size: 16px;
  line-height: 1.1;
}

.admin-school-review-card-complete {
  border-color: rgba(47, 120, 104, 0.32);
  box-shadow: 0 10px 24px rgba(47, 120, 104, 0.08);
  grid-column: 1 / -1;
}

.admin-school-selection-hint {
  margin: 0;
  color: var(--accent-strong);
  font-size: 13px;
}

.admin-school-class-line {
  margin: 0;
  font-size: 13px;
}

.admin-class-workbench.is-school-review .admin-school-review-card .muted {
  font-size: 13px;
  line-height: 1.35;
}

.admin-class-decision-card {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.admin-class-decision-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.admin-class-decision-head h4 {
  margin: 6px 0 4px;
  font-size: 20px;
  line-height: 1.08;
}

.admin-class-decision-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-class-decision-note {
  color: var(--muted);
  font-size: 13px;
}

.admin-school-review-status-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.admin-phase-complete-banner {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(47, 120, 104, 0.28);
  border-radius: 8px;
  padding: 14px;
  background: rgba(47, 120, 104, 0.08);
}

.admin-phase-complete-banner strong {
  color: var(--teal-ink);
}

.admin-school-winner-spotlight {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.admin-school-winner-spotlight.is-absolute {
  border-color: rgba(47, 120, 104, 0.36);
  box-shadow: 0 10px 24px rgba(47, 120, 104, 0.08);
}

.admin-school-winner-preview {
  min-width: 0;
}

.admin-school-winner-open {
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}

.admin-school-winner-open img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.admin-school-winner-copy {
  display: grid;
  gap: 10px;
  align-content: start;
}

.admin-school-winner-copy h5 {
  margin: 0;
  font-size: 22px;
  line-height: 1.08;
}

.admin-class-finalists,
.admin-class-finalist-winner {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.admin-class-finalists-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.admin-class-finalists-head h4,
.admin-class-finalist-winner h4 {
  margin: 6px 0 4px;
  font-size: 20px;
  line-height: 1.08;
}

.admin-class-finalists-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.admin-class-finalist-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf8;
  padding: 0;
  min-height: 140px;
}

.admin-class-finalist-card.is-winner {
  max-width: 220px;
}

.admin-class-finalist-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-class-strip {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-class-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-class-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-class-filters {
  grid-template-columns: repeat(4, minmax(88px, 1fr));
}

.icon-arrow-button {
  min-width: 44px;
  padding-inline: 0;
  font-size: 20px;
  line-height: 1;
}

.admin-class-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 280px);
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  align-items: stretch;
  scroll-snap-type: x proximity;
}

.admin-class-card {
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px 16px;
  display: grid;
  gap: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  scroll-snap-align: start;
}

.admin-class-card:hover,
.admin-class-card:focus-visible,
.admin-class-card.active {
  border-color: rgba(47, 120, 104, 0.42);
  box-shadow: 0 10px 24px rgba(71, 47, 18, 0.08);
  transform: translateY(-1px);
}

.admin-class-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.admin-class-card-head h4 {
  margin: 6px 0 0;
  font-size: 22px;
  line-height: 1.08;
}

.admin-class-card-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-class-progress {
  display: grid;
  gap: 8px;
}

.admin-class-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(71, 47, 18, 0.08);
  overflow: hidden;
}

.admin-class-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), rgba(47, 120, 104, 0.52));
}

.admin-class-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.status-complete {
  background: rgba(47, 125, 77, 0.12);
  border-color: rgba(47, 125, 77, 0.24);
  color: var(--ok);
}

.status-progress {
  background: rgba(181, 79, 50, 0.12);
  border-color: rgba(181, 79, 50, 0.22);
  color: var(--accent-strong);
}

.status-idle {
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.admin-progress-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-winner-summary {
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.admin-winner-summary.is-winner {
  color: var(--teal-ink);
  font-weight: 700;
}

.admin-mode-tabs {
  grid-template-columns: repeat(3, minmax(110px, 1fr));
}

.admin-breadcrumb {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb-link {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.breadcrumb-link.current {
  color: var(--text);
  font-weight: 700;
}

.breadcrumb-separator {
  color: var(--muted);
  font-size: 13px;
}

.folder-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.selection-list {
  display: grid;
  gap: 12px;
}

.selection-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 16px 18px;
  display: grid;
  gap: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.selection-card:hover,
.selection-card:focus-visible {
  border-color: rgba(47, 120, 104, 0.42);
  box-shadow: 0 10px 24px rgba(71, 47, 18, 0.08);
  transform: translateY(-1px);
}

.selection-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.selection-card-head h3 {
  margin: 6px 0 0;
  font-size: 24px;
  line-height: 1.08;
}

.selection-card-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.selection-card-footer {
  display: flex;
  justify-content: flex-end;
}

.admin-top25-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-top25-scope-tabs {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.selection-link {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-strong);
}

.folder-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.folder-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.folder-card-head h3 {
  margin: 6px 0 0;
  font-size: 22px;
  line-height: 1.08;
}

.folder-card-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.folder-preview-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.folder-preview-tile {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #f2ebdd, #e9dfcc);
  display: grid;
  place-items: center;
}

.folder-preview-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.folder-preview-tile.pdf,
.folder-preview-empty {
  color: var(--accent-strong);
  font-size: 13px;
  text-align: center;
  padding: 12px;
}

.folder-preview-tile.broken,
.drawing-tile.broken {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sidebar {
  position: sticky;
  top: 96px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.8);
}

.lightbox-dialog {
  position: relative;
  width: min(1100px, calc(100% - 30px));
  margin: 30px auto;
  background: #ffffff;
  border: 1px solid #d7d7d7;
  border-top: 4px solid #d32f2f;
  border-radius: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  padding: 16px;
}

.app-settings-dialog {
  width: min(860px, calc(100% - 30px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.admin-summary-dialog {
  width: min(1180px, calc(100% - 30px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.lightbox-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 48px;
  padding-bottom: 10px;
  border-bottom: 1px solid #d7d7d7;
}

.lightbox-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lightbox-close {
  display: inline-flex;
}

.lightbox-content {
  margin-top: 12px;
  min-height: 60vh;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid #d7d7d7;
  background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
  overflow: auto;
}

.lightbox-content img,
.lightbox-content iframe {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border: 0;
  background: #ffffff;
  transform-origin: center center;
  transition: transform 140ms ease;
}

.lightbox-content[data-rotation="90"],
.lightbox-content[data-rotation="270"] {
  min-height: min(76vh, 920px);
}

.lightbox-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #d7d7d7;
}

.lightbox-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lightbox-evaluation-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #d7d7d7;
}

.lightbox-evaluation-actions.is-phase-one-quick {
  align-items: center;
  gap: 8px;
}

.lightbox-quick-action {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #e3d5c4;
  border-radius: 999px;
  background: #fff9ec;
  color: #5f2c1f;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 18px rgba(80, 42, 28, 0.1);
}

.lightbox-quick-action:hover,
.lightbox-quick-action:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(80, 42, 28, 0.16);
}

.lightbox-quick-action.is-danger {
  border-color: rgba(207, 32, 41, 0.34);
  background: #cf2029;
  color: #ffffff;
}

.lightbox-quick-action.is-top25 {
  min-width: 42px;
  border-color: rgba(39, 131, 95, 0.32);
  background: #e7f7ec;
  color: #146044;
}

.lightbox-quick-action.is-top25.is-active {
  border-color: rgba(39, 131, 95, 0.74);
  background: #27835f;
  color: #ffffff;
}

.trash-dialog {
  width: min(920px, calc(100% - 30px));
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.trash-dialog .stack {
  min-height: 0;
}

#adminTrashList {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding-right: 6px;
}

#adminTop25List {
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  padding-right: 6px;
}

.admin-trash-toolbar {
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(220px, 1fr) minmax(150px, 0.42fr) auto;
  align-items: end;
}

.admin-trash-scope-toggle {
  align-self: end;
}

.admin-trash-sort-field {
  min-width: 150px;
}

.admin-trash-summary {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.admin-top25-summary {
  display: grid;
  gap: 6px;
  align-items: start;
}

.admin-summary-header {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid #d7d7d7;
}

.admin-summary-sections {
  display: grid;
  gap: 18px;
}

.admin-summary-section {
  display: grid;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.admin-summary-block {
  display: grid;
  gap: 12px;
}

.admin-summary-school-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.admin-comparison-completion-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-comparison-completion-card,
.admin-comparison-school-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
}

.admin-comparison-completion-card.is-ready,
.admin-comparison-school-card.is-ready {
  border-color: rgba(39, 131, 95, 0.26);
  box-shadow: inset 0 4px 0 rgba(39, 131, 95, 0.85);
}

.admin-comparison-completion-card.is-active,
.admin-comparison-school-card.is-active {
  border-color: rgba(225, 38, 45, 0.18);
  box-shadow: inset 0 4px 0 rgba(225, 38, 45, 0.82);
}

.admin-comparison-school-list {
  display: grid;
  gap: 12px;
}

.admin-comparison-admin-line {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.admin-comparison-manager-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.admin-comparison-manager-head > div {
  display: grid;
  gap: 4px;
}

.admin-comparison-progress-copy {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(41, 39, 95, 0.12);
}

.admin-comparison-progress-copy strong {
  font-size: 15px;
}

.admin-comparison-progress-copy span {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.admin-comparison-inline-note {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(39, 131, 95, 0.18);
  border-left: 4px solid var(--brand-green);
  background: rgba(39, 131, 95, 0.06);
}

.admin-comparison-inline-note span {
  line-height: 1.5;
  color: var(--muted);
}

.admin-phase-three-board {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.admin-phase-three-head {
  align-items: flex-start;
}

.admin-phase-three-section {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(41, 39, 95, 0.1);
  background: linear-gradient(180deg, #ffffff 0%, #fcfbf8 100%);
  box-shadow: 0 12px 24px rgba(71, 47, 18, 0.06);
}

.admin-phase-three-guidance {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-left: 4px solid #2f7868;
  background: rgba(47, 120, 104, 0.08);
}

.admin-phase-three-guidance strong {
  font-size: 13px;
  color: #21584c;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-phase-three-guidance span {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.admin-phase-three-manager-list {
  display: grid;
  gap: 10px;
}

.admin-phase-three-inline-panel {
  display: grid;
  gap: 12px;
  margin: -2px 0 8px;
  padding: 16px;
  border: 1px solid rgba(41, 39, 95, 0.12);
  border-top: 0;
  background: linear-gradient(180deg, #fcfcfc 0%, #f6f6f6 100%);
}

.admin-phase-three-manager-row {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1.15fr) minmax(280px, 1fr) auto;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(41, 39, 95, 0.12);
  background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
}

.admin-phase-three-manager-row.is-self {
  border-color: rgba(225, 38, 45, 0.4);
  box-shadow: inset 4px 0 0 var(--brand-red);
}

.admin-phase-three-manager-row.is-ready {
  border-left: 4px solid #2f7868;
}

.admin-phase-three-manager-row.is-active,
.admin-phase-three-manager-row.is-waiting {
  border-left: 4px solid #d4b35f;
}

.admin-phase-three-manager-identity {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.admin-phase-three-manager-title {
  display: grid;
  gap: 4px;
}

.admin-phase-three-manager-title strong {
  font-size: 18px;
}

.admin-phase-three-manager-title span {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.admin-phase-three-manager-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-phase-three-mini-stat {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(41, 39, 95, 0.1);
  background: rgba(255, 255, 255, 0.78);
}

.admin-phase-three-mini-stat span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.admin-phase-three-mini-stat strong {
  font-size: 18px;
  color: var(--ink);
}

.admin-phase-three-mini-stat strong.is-complete {
  color: #1f6f57;
}

.admin-phase-three-mini-stat strong.is-pending {
  color: #8f1d23;
}

.admin-phase-three-manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.admin-phase-three-overview {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.admin-phase-three-overview-cockpit {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-phase-three-overview-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
}

.admin-phase-three-overview-card-wide {
  grid-column: 1 / -1;
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 211, 69, 0.22), transparent 28%),
    linear-gradient(135deg, #ffffff 0%, #fff8e3 100%);
}

.admin-phase-three-cockpit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-phase-three-cockpit-head h4 {
  margin: 4px 0 6px;
  font-size: clamp(22px, 3vw, 34px);
}

.admin-phase-three-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.admin-phase-three-pair-side {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(41, 39, 95, 0.12);
  background: rgba(255, 255, 255, 0.76);
}

.admin-phase-three-pair-side.is-mine {
  border-color: rgba(225, 38, 45, 0.28);
  box-shadow: inset 4px 0 0 var(--brand-red);
}

.admin-phase-three-pair-side strong {
  font-size: 20px;
}

.admin-phase-three-pair-side > span:not(.eyebrow):not(.pill) {
  font-size: 13px;
  color: var(--muted);
}

.admin-phase-three-pair-vs {
  align-self: center;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--brand-red);
  color: #fff;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 1100px) {
  .admin-phase-three-manager-row {
    grid-template-columns: 1fr;
  }

  .admin-phase-three-manager-actions {
    justify-content: flex-start;
  }

  .admin-phase-three-overview {
    grid-template-columns: 1fr;
  }

  .admin-phase-three-overview-cockpit {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .admin-phase-three-manager-stats {
    grid-template-columns: 1fr;
  }

  .admin-phase-three-cockpit-head {
    display: grid;
  }

  .admin-phase-three-pair {
    grid-template-columns: 1fr;
  }

  .admin-phase-three-pair-vs {
    justify-self: center;
  }
}

/* Terms modal final direction: document-first, roomy, branded, easy to accept. */
#authTermsModal .auth-terms-dialog {
  width: min(860px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  border: 1px solid rgba(137, 24, 29, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(180deg, #fffdf8 0%, #fff7ea 100%);
  box-shadow: 0 28px 80px rgba(73, 25, 18, 0.28);
}

#authTermsModal .auth-terms-document-shell {
  display: block;
  max-height: min(780px, calc(100vh - 32px));
  overflow: visible;
}

#authTermsModal .auth-terms-content {
  display: grid;
  grid-template-rows: auto auto minmax(260px, 1fr) auto;
  gap: 18px;
  max-height: min(780px, calc(100vh - 32px));
  padding: clamp(20px, 3vw, 34px);
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 211, 44, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 248, 237, 0.96));
}

#authTermsModal .auth-terms-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(211, 47, 47, 0.16);
  border-radius: 18px;
  background: linear-gradient(135deg, #c91f24 0%, #95171c 100%);
  color: #ffffff;
}

#authTermsModal .auth-terms-topline > div {
  display: grid;
  gap: 2px;
}

#authTermsModal .auth-terms-topline .eyebrow {
  color: #ffd323;
}

#authTermsModal .auth-terms-topline strong,
#authTermsModal .auth-terms-topline > span {
  color: #ffffff;
}

#authTermsModal .auth-terms-topline > span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 800;
}

#authTermsModal .auth-help-header {
  padding-bottom: 2px;
}

#authTermsModal .auth-help-header h3 {
  margin: 2px 0 4px;
  color: #2f1813;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1;
  letter-spacing: -1px;
}

#authTermsModal .terms-document-card {
  min-height: 260px;
  padding: 0;
  border: 1px solid rgba(91, 67, 44, 0.14);
  border-radius: 18px;
  background: #ffffff;
  overflow: hidden;
}

#authTermsModal .terms-document-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(91, 67, 44, 0.1);
  background: #fff9ed;
}

#authTermsModal .terms-document-heading strong {
  color: #7f1111;
}

#authTermsModal .terms-document-heading span {
  color: #75685c;
  font-size: 12px;
  text-align: right;
}

#authTermsModal .terms-text-slot {
  display: grid;
  gap: 12px;
  max-height: min(330px, calc(100vh - 390px));
  min-height: 220px;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #44362f;
  line-height: 1.6;
}

#authTermsModal .terms-text-slot p {
  margin: 0;
  font-size: 14px;
}

#authTermsModal .terms-consent-footer {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

#authTermsModal .auth-terms-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 15px;
  border: 1px solid rgba(211, 47, 47, 0.18);
  border-radius: 18px;
  background: #ffffff;
  cursor: pointer;
}

#authTermsModal .auth-terms-checkmark {
  width: 36px;
  height: 36px;
  border-width: 2px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #fff8e7, #ffffff);
}

#authTermsModal .auth-terms-check input:checked + .auth-terms-checkmark {
  border-color: #2f8d5b;
  background: linear-gradient(135deg, #2f8d5b, #63bd87);
  box-shadow: 0 10px 24px rgba(47, 141, 91, 0.24);
}

#authTermsModal .auth-terms-check span:last-child {
  color: #4b3b32;
  font-size: 14px;
  line-height: 1.42;
}

#authTermsModal .auth-terms-actions {
  justify-content: flex-end;
}

#authTermsModal .auth-terms-actions .primary {
  min-width: min(100%, 240px);
  min-height: 48px;
  border-radius: 999px;
}

@media (max-width: 720px) {
  #authTermsModal.lightbox {
    padding: 12px;
  }

  #authTermsModal .auth-terms-content {
    grid-template-rows: auto auto minmax(220px, 1fr) auto;
    gap: 14px;
    padding: 16px;
  }

  #authTermsModal .auth-terms-topline,
  #authTermsModal .terms-document-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  #authTermsModal .terms-document-heading span {
    text-align: left;
  }

  #authTermsModal .terms-text-slot {
    max-height: calc(100vh - 410px);
    min-height: 210px;
  }

  #authTermsModal .auth-terms-actions .primary {
    width: 100%;
  }
}

.admin-phase-three-progress-list {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(41, 39, 95, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.admin-phase-three-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-phase-three-progress-label {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.admin-phase-three-progress-row strong {
  font-size: 14px;
  color: var(--ink);
}

.admin-phase-three-progress-row strong.is-complete {
  color: #1f6f57;
}

.admin-phase-three-progress-row strong.is-pending {
  color: #8f1d23;
}

.admin-phase-three-manager-focus {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.admin-phase-three-manager-focus strong {
  font-size: 15px;
}

.admin-phase-three-manager-focus span {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.admin-phase-three-compare-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-phase-three-compare-card {
  align-content: start;
  gap: 12px;
}

.admin-phase-three-compare-card.is-match {
  border-color: rgba(47, 120, 104, 0.34);
  box-shadow: inset 0 0 0 2px rgba(47, 120, 104, 0.12);
}

.admin-phase-three-compare-head {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(41, 39, 95, 0.12);
}

.admin-phase-three-compare-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-phase-three-compare-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-phase-three-absolute-outcome {
  grid-template-columns: minmax(280px, 1.35fr) repeat(2, minmax(0, 1fr));
}

.admin-phase-three-school-outcome {
  grid-template-columns: minmax(280px, 1.35fr) repeat(2, minmax(0, 1fr));
}

.admin-phase-three-absolute-outcome.is-match .admin-phase-three-absolute-outcome-main {
  border-color: rgba(47, 120, 104, 0.32);
  background: rgba(47, 120, 104, 0.08);
}

.admin-phase-three-school-outcome.is-match .admin-phase-three-school-outcome-main {
  border-color: rgba(47, 120, 104, 0.32);
  background: rgba(47, 120, 104, 0.08);
}

.admin-phase-three-absolute-outcome.is-same-school .admin-phase-three-absolute-outcome-main {
  border-color: rgba(212, 179, 95, 0.42);
  background: rgba(255, 211, 69, 0.12);
}

.admin-phase-three-school-outcome.is-different .admin-phase-three-school-outcome-main,
.admin-phase-three-school-outcome.is-target-only .admin-phase-three-school-outcome-main,
.admin-phase-three-school-outcome.is-mine-only .admin-phase-three-school-outcome-main {
  border-color: rgba(212, 179, 95, 0.42);
  background: rgba(255, 211, 69, 0.12);
}

.admin-phase-three-absolute-outcome.is-different .admin-phase-three-absolute-outcome-main,
.admin-phase-three-absolute-outcome.is-missing .admin-phase-three-absolute-outcome-main,
.admin-phase-three-school-outcome.is-missing .admin-phase-three-school-outcome-main {
  border-color: rgba(225, 38, 45, 0.22);
  background: rgba(225, 38, 45, 0.06);
}

.admin-phase-three-compare-summary-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(41, 39, 95, 0.1);
  background: rgba(255, 255, 255, 0.78);
}

.admin-phase-three-compare-summary-item span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.admin-phase-three-compare-summary-item strong {
  font-size: 16px;
  line-height: 1.35;
}

.admin-phase-three-compare-summary-item em {
  font-style: normal;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.admin-phase-three-absolute-block {
  display: grid;
  gap: 0.75rem;
}

.admin-phase-three-absolute-block h4 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.admin-summary-drawing-card.is-top25-shared {
  border-color: rgba(47, 120, 104, 0.42);
  box-shadow: inset 0 0 0 2px rgba(47, 120, 104, 0.1);
}

.admin-summary-drawing-card.is-top25-exclusive {
  border-color: rgba(212, 179, 95, 0.26);
}

.admin-phase-three-top25-badge {
  justify-self: start;
  padding: 5px 8px;
  border: 1px solid rgba(41, 39, 95, 0.12);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-phase-three-top25-badge.is-shared {
  border-color: rgba(47, 120, 104, 0.34);
  background: rgba(47, 120, 104, 0.08);
  color: #1f6f57;
}

.admin-phase-three-top25-badge.is-exclusive {
  border-color: rgba(212, 179, 95, 0.36);
  background: rgba(255, 211, 69, 0.1);
  color: #6d5520;
}

.admin-phase-three-compare-nav {
  justify-content: space-between;
}

@media (max-width: 960px) {
  .admin-phase-three-compare-grid {
    grid-template-columns: 1fr;
  }

  .admin-phase-three-compare-summary {
    grid-template-columns: 1fr;
  }

  .admin-phase-three-absolute-outcome {
    grid-template-columns: 1fr;
  }

  .admin-phase-three-school-outcome {
    grid-template-columns: 1fr;
  }

  .admin-phase-three-compare-nav {
    justify-content: flex-start;
  }
}

.admin-summary-drawing-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
}

.admin-summary-drawing-card.is-flagged {
  border-color: rgba(225, 38, 45, 0.65);
  box-shadow: inset 0 0 0 1px rgba(225, 38, 45, 0.35);
}

.admin-summary-drawing-card.compact {
  gap: 8px;
}

.admin-comparison-suggestion-note {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-left: 3px solid var(--brand-red);
  background: rgba(225, 38, 45, 0.06);
}

.admin-comparison-suggestion-note strong {
  font-size: 13px;
  color: #8f1d23;
}

.admin-comparison-suggestion-note span {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.admin-summary-open-button {
  width: 100%;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  display: block;
}

.admin-summary-open-button img {
  width: 100%;
  height: auto;
  display: block;
}

.admin-summary-drawing-meta {
  display: grid;
  gap: 4px;
}

.admin-summary-drawing-meta strong,
.admin-summary-drawing-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-summary-uploader-meta {
  display: grid;
  gap: 2px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(24, 24, 24, 0.08);
}

.admin-summary-uploader-meta strong {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8f1d23;
}

.admin-summary-uploader-meta span {
  font-size: 12px;
  color: var(--muted);
}

.developer-dialog {
  width: min(460px, calc(100vw - 28px));
}

.developer-role-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.developer-role-button {
  min-height: 54px;
}

.external-participant-dialog {
  width: min(760px, calc(100vw - 30px));
  border: 1px solid rgba(124, 32, 20, 0.18);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 211, 35, 0.2), transparent 34%),
    linear-gradient(135deg, #fffaf0 0%, #ffffff 58%, #fff3df 100%);
  box-shadow: 0 28px 80px rgba(38, 19, 14, 0.36);
}

.external-participant-dialog .eyebrow {
  color: #b42026;
}

.external-participant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.external-participant-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 170px;
  padding: 18px;
  border: 1px solid rgba(180, 32, 38, 0.22);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.84);
  color: #2f1916;
  text-align: left;
  box-shadow: 0 14px 34px rgba(82, 35, 22, 0.08);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.external-participant-card:hover,
.external-participant-card:focus-visible {
  transform: translateY(-2px);
  border-color: #d32f2f;
  box-shadow: 0 18px 40px rgba(82, 35, 22, 0.14);
  outline: none;
}

.external-participant-card strong {
  font-size: 24px;
  line-height: 1;
}

.external-participant-card small {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.external-participant-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #d32f2f;
  color: #ffffff;
  font-weight: 900;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}

.external-participant-card:nth-child(2) .external-participant-icon {
  background: #c07c08;
}

.external-other-placeholder {
  padding: 18px 0 72px;
}

.external-other-card {
  display: grid;
  gap: 18px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 26px;
  border: 1px solid rgba(180, 32, 38, 0.18);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 211, 35, 0.22), transparent 32%),
    #fffaf0;
  box-shadow: 0 18px 45px rgba(42, 25, 18, 0.12);
}

.external-other-card h3 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 0.95;
  color: #321815;
}

.external-other-card p {
  max-width: 680px;
  margin: 0;
  color: #6d5a4f;
  font-size: 17px;
  line-height: 1.5;
}

.external-other-next {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-left: 5px solid #ffd323;
  background: rgba(255, 255, 255, 0.72);
  color: #321815;
}

.external-other-next span {
  color: var(--muted);
}

.external-other-form {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(180, 32, 38, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.84);
}

.external-other-contact {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(192, 124, 8, 0.22);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 250, 240, 0.95), rgba(255, 255, 255, 0.9));
}

.external-other-contact p {
  max-width: none;
  font-size: 14px;
}

.external-other-email-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.external-other-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 143, 86, 0.22);
  border-radius: 14px;
  background: rgba(240, 255, 247, 0.82);
  color: #244d35;
  font-weight: 700;
}

.external-other-confirm input {
  width: 20px;
  height: 20px;
  accent-color: #1f8f56;
}

.external-other-upload-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(41, 39, 95, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
}

.external-other-upload-panel.is-disabled {
  opacity: 0.72;
}

.external-other-upload-panel .toolbar {
  align-items: center;
}

.external-other-upload-panel h4 {
  margin: 0;
  font-size: 26px;
  color: #321815;
}

.external-other-upload-panel .file-list {
  display: grid;
  gap: 8px;
}

.duplicate-upload-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #d7d7d7;
  background: #fbfbfb;
  padding: 12px;
}

.duplicate-upload-item {
  border: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.submit-summary {
  border: 1px solid #d7d7d7;
  background: #fbfbfb;
  padding: 12px;
}

.submit-summary-item {
  border-radius: 0;
  border-color: #d7d7d7;
  background: #ffffff;
}

.lightbox-dialog .stack,
.trash-dialog .stack,
.admin-summary-dialog .stack,
.app-settings-dialog .stack,
.developer-dialog .stack {
  gap: 14px;
}

.actions {
  gap: 8px;
}

.admin-top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.drawing-board {
  display: block;
}

.drawing-board-masonry {
  column-width: calc(220px * var(--card-scale));
  column-gap: var(--gallery-gap);
}

.drawing-board-discarded {
  margin-top: 18px;
}

.drawing-board-absolute {
  margin-top: 4px;
}

.drawing-board-school-winners {
  margin-top: 8px;
}

.drawing-tile {
  width: 100%;
  min-height: auto;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fffdf8;
  display: block;
  margin: 0 0 12px;
  break-inside: avoid;
  box-shadow: 0 10px 20px rgba(71, 47, 18, 0.08);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
}

body[data-cards="expanded"] .drawing-tile,
body[data-cards="expanded"] .folder-card,
body[data-cards="expanded"] .selection-card {
  box-shadow: 0 14px 28px rgba(71, 47, 18, 0.1);
}

.drawing-tile.is-discarded {
  border-color: rgba(30, 24, 18, 0.42);
}

.drawing-tile:hover,
.drawing-tile:focus-visible {
  border-color: rgba(47, 120, 104, 0.42);
  box-shadow: 0 14px 28px rgba(71, 47, 18, 0.12);
}

.drawing-tile.is-swap-armed {
  cursor: copy;
}

.drawing-tile.is-swap-armed:hover {
  border-color: rgba(181, 79, 50, 0.74);
  box-shadow: 0 16px 32px rgba(181, 79, 50, 0.18);
}

.drawing-tile.is-pending-school-winner {
  border-color: rgba(47, 120, 104, 0.88);
  box-shadow: 0 0 0 3px rgba(47, 120, 104, 0.16), 0 16px 32px rgba(71, 47, 18, 0.14);
}

#adminView .admin-gallery-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#adminView .admin-collapse-toggle {
  min-height: 32px;
  padding: 6px 11px;
  border-color: rgba(47, 120, 104, 0.26);
  color: var(--teal-ink);
  font-size: 12px;
  font-weight: 700;
}

#adminView #adminClassTrackerSection.is-collapsed #adminClassTrackerFilters,
#adminView #adminClassTrackerSection.is-collapsed #adminClassTrackerSummary,
#adminView #adminClassTrackerSection.is-collapsed #adminClassTrackerList {
  display: none;
}

#adminView #adminClassTrackerSection.is-collapsed {
  padding-bottom: 14px;
}

#adminView #adminGallery.is-collapsed,
#adminView #adminStateHint.is-collapsed-with-gallery {
  display: none;
}

.drawing-tile-image-item {
  background: #fff;
}

.drawing-tile img {
  width: 100%;
  height: auto;
  display: block;
}

.drawing-preview-button {
  width: 100%;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  display: block;
  background: transparent;
  position: relative;
  z-index: 1;
}

.drawing-quick-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.drawing-state-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(47, 120, 104, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(71, 47, 18, 0.12);
}

.drawing-state-badge.is-muted {
  background: rgba(30, 24, 18, 0.72);
}

.drawing-state-badge.is-top25 {
  background: rgba(41, 39, 95, 0.9);
}

.drawing-discard-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2;
  pointer-events: none;
}

.drawing-tile.is-school-review.is-discarded {
  opacity: 0.78;
}

.quick-icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 8px 18px rgba(71, 47, 18, 0.12);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  position: relative;
  z-index: 3;
}

.quick-icon-button.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.quick-icon-button.top25 {
  background: rgba(224, 246, 232, 0.96);
  border-color: rgba(39, 131, 95, 0.42);
  color: #176444;
}

.quick-icon-button.top25.is-active {
  background: #d9f4df;
  border-color: rgba(39, 131, 95, 0.74);
  color: #145c3f;
  box-shadow: 0 0 0 3px rgba(39, 131, 95, 0.14), 0 10px 20px rgba(39, 131, 95, 0.16);
}

.quick-icon-button.swap {
  width: auto;
  min-width: 72px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.94);
  border-color: rgba(47, 120, 104, 0.26);
  color: var(--teal-ink);
  font-size: 12px;
}

.quick-icon-button.danger,
.danger-button {
  background: rgba(177, 60, 52, 0.12);
  border-color: rgba(177, 60, 52, 0.28);
  color: var(--danger);
}

.quick-icon-button.is-active {
  background: rgba(177, 60, 52, 0.94);
  border-color: rgba(177, 60, 52, 0.94);
  color: #fff;
}

#adminView .quick-icon-button.top25,
#adminView .quick-icon-button.top25.is-active {
  background: #d9f4df;
  border-color: rgba(39, 131, 95, 0.74);
  color: #145c3f;
  box-shadow: 0 0 0 3px rgba(39, 131, 95, 0.14), 0 10px 20px rgba(39, 131, 95, 0.16);
}

.quick-icon-button.is-disabled,
.quick-icon-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.18);
}

.drawing-tile-pdf-item {
  background:
    linear-gradient(180deg, rgba(181, 79, 50, 0.08), rgba(181, 79, 50, 0.18)),
    linear-gradient(180deg, #faf3e7, #f0e2cb);
}

.drawing-tile-pdf-card {
  min-height: 280px;
  padding: 18px;
  display: grid;
  gap: 18px;
  align-items: start;
}

.drawing-tile-pdf-badge {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(148, 58, 32, 0.12);
  border: 1px solid rgba(148, 58, 32, 0.18);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.drawing-tile-pdf-sheet {
  width: min(150px, 72%);
  aspect-ratio: 0.72 / 1;
  margin: 8px auto 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(148, 58, 32, 0.18);
  box-shadow: 0 12px 22px rgba(71, 47, 18, 0.08);
  padding: 18px 14px;
  display: grid;
  gap: 10px;
}

.drawing-tile-pdf-sheet span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 58, 32, 0.18);
}

.drawing-tile-pdf-sheet span:nth-child(2) {
  width: 86%;
}

.drawing-tile-pdf-sheet span:nth-child(3) {
  width: 72%;
}

@media (max-width: 1120px) {
  .admin-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-metrics-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-nav-strip {
    grid-template-columns: 1fr;
  }

  .admin-breadcrumb {
    justify-content: flex-start;
  }

  .lightbox-toolbar {
    align-items: stretch;
  }

  .lightbox-actions {
    width: 100%;
  }

  .lightbox-actions button {
    flex: 1;
  }

  .admin-trash-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-school-review-grid {
    grid-template-columns: 1fr;
  }

  .admin-school-winner-spotlight {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .admin-top-strip,
  .admin-nav-strip,
  .panel {
    padding: 16px;
  }

  .admin-top-copy h2 {
    font-size: 26px;
  }

  .admin-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segmented {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-nav-strip > button,
  .admin-filter-summary {
    width: 100%;
  }

  .admin-filter-summary {
    justify-content: space-between;
  }

  .admin-workbar {
    grid-template-columns: 1fr;
  }

  .admin-state-hint {
    text-align: left;
  }

  .drawing-board {
    display: block;
  }

  .drawing-board-masonry {
    column-width: 160px;
  }

  .drawing-tile-actions,
  .lightbox-evaluation-actions,
  .trash-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trash-dialog {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  .setting-toggle {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .hero,
  .layout,
  .admin-layout,
  .external-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .external-sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 94px;
  }

  .page {
    width: min(100%, calc(100% - 20px));
    padding-top: 18px;
  }

  .topbar,
  .section-head,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 16px 18px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand p {
    font-size: 12px;
  }

  .external-steps {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 16px;
    scrollbar-width: thin;
  }

  .step-chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .external-layout {
    gap: 14px;
  }

  .external-sidebar,
  .external-main,
  .class-card {
    box-shadow: none;
  }

  .external-sidebar-section {
    padding-top: 16px;
  }

  .external-submit-row {
    display: none;
  }

  .summary-grid,
  .admin-grid,
  .developer-role-grid,
  .external-participant-grid,
  .submit-summary-grid {
    grid-template-columns: 1fr;
  }

  .external-participant-card {
    min-height: auto;
  }

  .external-other-card {
    padding: 20px;
    border-radius: 22px;
  }

  .external-other-form,
  .external-other-upload-panel,
  .external-other-contact {
    padding: 14px;
    border-radius: 18px;
  }

  .external-other-email-row {
    grid-template-columns: 1fr;
  }

  .class-form-grid {
    grid-template-columns: 1fr;
  }

  .class-card-head,
  .dropzone-actions,
  .upload-feedback-head,
  .upload-progress-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-workbar {
    grid-template-columns: 1fr;
  }

  .gallery-group-head,
  .art-card-head,
  .folder-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-state-hint {
    text-align: left;
  }

  .admin-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-top-strip,
  .admin-nav-strip {
    padding: 16px;
  }

  .admin-top-copy h2 {
    font-size: 24px;
  }

  .class-card-head {
    padding: 14px;
  }

  .class-card-head h4 {
    font-size: 22px;
  }

  .class-card-body {
    padding: 14px;
  }

  .upload-dropzone {
    padding: 18px 14px;
  }

  .file-item {
    align-items: stretch;
    flex-direction: column;
  }

  .file-item-actions {
    justify-content: flex-start;
  }

  .file-open-link,
  .compact-icon-button,
  .dropzone-actions button,
  .mobile-action-bar button {
    min-height: 42px;
  }

  .school-picker-panel {
    padding: 8px;
  }

  .school-picker-options {
    max-height: 280px;
  }

  .mobile-action-bar {
    display: flex;
  }

  .segmented {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .admin-nav-strip .segmented {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Workflow di revisione scuola: gerarchia e azioni principali */
#adminView .admin-class-workbench.is-school-review {
  gap: 18px;
  padding: 20px;
  border: 2px solid var(--admin-line);
  border-top: 5px solid var(--admin-red);
  background: #fff;
}

#adminView .admin-class-workbench.is-school-review .admin-class-workbench-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--admin-line);
}

#adminView .admin-school-review-grid-focused {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

#adminView .admin-school-review-grid-focused .admin-school-review-card {
  align-content: start;
  gap: 14px;
  min-height: 270px;
  padding: 20px;
  border: 1px solid var(--admin-line-strong);
  border-top: 5px solid #777;
  background: #fff;
}

#adminView .admin-school-review-card-current.is-ready {
  border-top-color: #27835f;
  background: linear-gradient(180deg, #f4fbf7 0%, #fff 45%);
}

#adminView .admin-school-review-card-current.needs-action {
  border-top-color: var(--admin-red);
  background: linear-gradient(180deg, #fff5f5 0%, #fff 45%);
}

#adminView .admin-school-review-card-next {
  border-top-color: #b47b16;
  background: linear-gradient(180deg, #fffaf0 0%, #fff 45%);
}

#adminView .admin-school-review-grid-focused h4 {
  margin: 0;
  color: var(--admin-ink);
  font-size: 21px;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
}

#adminView .admin-school-review-grid-focused p {
  margin: 0;
  max-width: 680px;
  font-size: 14px;
  line-height: 1.55;
}

#adminView .admin-workflow-step {
  color: var(--admin-red-ink);
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#adminView .admin-workflow-status {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#adminView .admin-workflow-status.is-complete {
  color: #176444;
  background: #edf8f2;
}

#adminView .admin-workflow-status.is-pending {
  color: var(--admin-red-ink);
  background: #fff1f1;
}

#adminView .admin-workflow-progress {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#adminView .admin-workflow-progress > div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--admin-line);
  background: #fff;
}

#adminView .admin-workflow-progress strong {
  color: var(--admin-ink);
  font-size: 24px;
  line-height: 1;
}

#adminView .admin-workflow-progress span {
  color: var(--admin-ink-muted);
  font-size: 12px;
  font-weight: 700;
}

#adminView .admin-workflow-actions {
  margin-top: auto;
  padding-top: 4px;
}

#adminView .admin-workflow-actions .primary,
#adminView .admin-decision-primary-actions .primary,
#adminView .admin-empty-decision-card .primary {
  min-height: 48px;
  padding-inline: 20px;
  font-weight: 800;
}

#adminView .admin-workflow-actions button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

#adminView .admin-class-decision-card {
  display: grid;
  gap: 14px;
  padding-top: 20px;
  border-top: 3px solid var(--admin-line-strong);
}

#adminView .admin-decision-section-label {
  display: grid;
  gap: 5px;
}

#adminView .admin-decision-section-label span {
  color: var(--admin-red-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#adminView .admin-decision-section-label strong {
  color: var(--admin-ink);
  font-size: 21px;
}

#adminView .admin-school-winner-spotlight {
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 24px;
  padding: 18px;
  border: 1px solid var(--admin-line-strong);
  border-left: 6px solid #27835f;
  background: #fff;
}

#adminView .admin-school-winner-spotlight.is-absolute {
  border: 1px solid var(--admin-red);
  border-left-width: 6px;
  box-shadow: none;
  background: linear-gradient(110deg, #fff 0%, #fff7f7 100%);
}

#adminView .admin-school-winner-copy {
  align-content: center;
  gap: 14px;
}

#adminView .admin-highlighted-drawing-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#adminView .admin-highlighted-drawing-meta span {
  padding: 8px 10px;
  border: 1px solid var(--admin-line);
  background: #f7f7f7;
  color: var(--admin-ink-muted);
  font-size: 13px;
}

#adminView .admin-decision-primary-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--admin-line);
}

#adminView .admin-empty-decision-card {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 24px;
  border: 2px dashed var(--admin-red);
  background: #fff7f7;
}

#adminView .admin-empty-decision-card h4,
#adminView .admin-empty-decision-card p {
  margin: 0;
}

@media (max-width: 980px) {
  #adminView .admin-school-review-grid-focused,
  #adminView .admin-school-winner-spotlight {
    grid-template-columns: 1fr;
  }

  #adminView .admin-school-winner-preview {
    max-width: 360px;
  }
}

@media (max-width: 560px) {
  #adminView .admin-workflow-progress {
    grid-template-columns: 1fr;
  }
}

/* Finestre gestore: sistema visivo condiviso */
#adminSettingsModal,
#adminTrashModal,
#adminTop25Modal,
#adminSummaryModal,
#adminComparisonModal,
#adminSchoolFilterModal {
  --admin-red: #d32f2f;
  --admin-red-ink: #7f1111;
  --admin-line: #d7d7d7;
  --admin-line-strong: #b7b7b7;
  --admin-ink: #141414;
  --admin-ink-muted: #5f5f5f;
}

#adminSettingsModal button.primary,
#adminTrashModal button.primary,
#adminTop25Modal button.primary,
#adminSummaryModal button.primary,
#adminComparisonModal button.primary,
#adminSchoolFilterModal button.primary {
  background: var(--admin-red);
  border-color: var(--admin-red);
  color: #fff;
}

.workflow-open-action {
  min-height: 48px;
  padding-inline: 20px;
  font-weight: 800;
}

#adminSettingsModal .lightbox-dialog,
#adminTrashModal .lightbox-dialog,
#adminTop25Modal .lightbox-dialog,
#adminSummaryModal .lightbox-dialog,
#adminComparisonModal .lightbox-dialog,
#adminSchoolFilterModal .lightbox-dialog {
  padding: 0;
  border: 1px solid #c9c9c9;
  border-top: 6px solid var(--admin-red);
  background: #f5f5f5;
}

#adminSettingsModal .lightbox-dialog > .stack,
#adminTrashModal .lightbox-dialog > .stack,
#adminTop25Modal .lightbox-dialog > .stack,
#adminSummaryModal .lightbox-dialog > .stack,
#adminComparisonModal .lightbox-dialog > .stack,
#adminSchoolFilterModal .lightbox-dialog > .stack {
  gap: 18px;
  padding: 22px;
}

#adminSettingsModal .lightbox-dialog > .stack > :first-child,
#adminTrashModal .lightbox-dialog > .stack > .toolbar:first-child,
#adminTop25Modal .lightbox-dialog > .stack > .toolbar:first-child,
#adminSummaryModal .lightbox-dialog > .stack > .toolbar:first-child,
#adminComparisonModal .lightbox-dialog > .stack > .toolbar:first-child,
#adminSchoolFilterModal .lightbox-dialog > .stack > :first-child {
  margin: -22px -22px 0;
  padding: 20px 22px;
  border-bottom: 1px solid #cfcfcf;
  background: #fff;
}

#adminSettingsModal h3,
#adminTrashModal h3,
#adminTop25Modal h3,
#adminSummaryModal h3,
#adminComparisonModal h3,
#adminSchoolFilterModal h3 {
  margin: 5px 0 0;
  color: var(--admin-ink);
  font-size: 25px;
  line-height: 1.15;
}

#adminTrashModal .toolbar > button,
#adminTop25Modal .toolbar > button,
#adminSummaryModal .toolbar > button,
#adminComparisonModal .toolbar > button {
  min-height: 40px;
  padding-inline: 16px;
  background: #f5f5f5;
}

#adminSettingsModal .app-settings-dialog > .stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

#adminSettingsModal .app-settings-dialog > .stack > :first-child,
#adminSettingsModal .settings-grid,
#adminSettingsModal #developerSettingsSection,
#adminSettingsModal .app-settings-dialog > .stack > .actions:last-child {
  grid-column: 1 / -1;
}

#adminSettingsModal .settings-section {
  min-height: 150px;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border: 1px solid #d1d1d1;
  border-top: 4px solid #777;
  background: #fff;
}

#adminSettingsModal .settings-section h4 {
  font-size: 19px;
}

#adminSettingsModal .settings-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#adminSettingsModal .setting-toggle {
  min-height: 110px;
  align-content: start;
  border-radius: 0;
  border-top: 4px solid #b47b16;
  background: #fffaf0;
}

#adminSettingsModal .settings-segmented,
#adminTrashModal .segmented,
#adminTop25Modal .segmented {
  border-radius: 0;
  border-color: #bdbdbd;
  background: #f7f7f7;
}

#adminSettingsModal .segmented button.active,
#adminTrashModal .segmented button.active,
#adminTop25Modal .segmented button.active {
  background: var(--admin-red);
  color: #fff;
}

#adminSettingsModal #developerSettingsSection {
  min-height: 0;
  border-top-color: var(--admin-red);
  background: #fff7f7;
}

.settings-title-with-help {
  display: flex;
  gap: 10px;
  align-items: center;
}

.info-dot-button {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(34, 34, 34, 0.28);
  border-radius: 50%;
  background: #fff;
  color: var(--admin-red);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.info-dot-button:hover,
.info-dot-button:focus-visible {
  border-color: var(--admin-red);
  background: #fff1f1;
  transform: translateY(-1px);
}

.backup-info-grid {
  display: grid;
  gap: 12px;
}

.backup-info-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e0d4cc;
  border-left: 5px solid var(--admin-red);
  background: #fffaf4;
}

.backup-info-card strong {
  color: #241714;
}

.backup-info-card p {
  margin: 0;
  color: #69594f;
  line-height: 1.45;
}

.database-backup-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(165, 44, 32, 0.22);
  background: rgba(255, 255, 255, 0.82);
}

.danger-maintenance-panel {
  border-color: rgba(171, 35, 26, 0.45);
  border-left: 5px solid var(--admin-red);
  background: #fff2f1;
}

.database-backup-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.database-backup-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.database-backup-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e0d4cc;
  background: #fff;
}

.file-backup-item {
  grid-template-columns: minmax(0, 1fr);
}

.database-backup-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.database-backup-info strong,
.database-backup-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.database-backup-item-completed {
  border-left: 5px solid #218a53;
}

.database-backup-item-failed {
  border-left: 5px solid var(--admin-red);
}

.file-backup-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.database-backup-empty {
  padding: 10px;
  border: 1px dashed #d8c9bf;
  background: #fff;
}

#adminSettingsModal .app-settings-dialog > .stack > .actions:last-child {
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid #cfcfcf;
}

#adminTrashModal .admin-trash-toolbar,
#adminTop25Modal .admin-trash-toolbar,
#adminTop25Modal .admin-top25-toolbar {
  padding: 16px;
  border: 1px solid #d0d0d0;
  border-left: 5px solid var(--admin-red);
  background: #fff;
}

#adminTop25Modal .admin-trash-toolbar {
  grid-template-columns: 1fr auto;
}

#adminTop25Modal .admin-top25-summary {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}

#adminTop25Modal #adminTop25Count,
#adminTrashModal #adminTrashCount,
#adminSummaryModal .toolbar > .pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding-inline: 12px;
  border-color: var(--admin-red);
  color: var(--admin-red-ink);
  font-weight: 800;
  background: #fff7f7;
}

#adminTrashList,
#adminTop25List {
  display: grid;
  gap: 10px;
  padding: 2px 8px 2px 0;
}

#adminTrashModal .trash-item,
#adminTop25Modal .trash-item {
  padding: 14px;
  border-radius: 0;
  border: 1px solid #d0d0d0;
  border-left: 4px solid #777;
  background: #fff;
}

#adminTrashModal .trash-item:hover,
#adminTop25Modal .trash-item:hover {
  border-left-color: var(--admin-red);
  background: #fffafa;
}

#adminTrashModal .trash-actions,
#adminTop25Modal .trash-actions {
  padding-top: 10px;
  border-top: 1px solid #e0e0e0;
}

#adminSummaryModal .admin-summary-header,
#adminComparisonModal .admin-summary-header {
  gap: 10px;
  padding: 14px;
  border: 1px solid #d0d0d0;
  border-left: 5px solid #b47b16;
  background: #fffaf0;
}

#adminSummaryModal .admin-summary-section,
#adminComparisonModal .admin-summary-section {
  gap: 16px;
  padding: 18px;
  border: 1px solid #d0d0d0;
  border-top: 4px solid var(--admin-red);
  background: #fff;
}

#adminSummaryModal .admin-summary-section h4,
#adminComparisonModal .admin-summary-section h4 {
  margin: 4px 0 0;
  font-size: 20px;
}

#adminSummaryModal .admin-summary-drawing-card,
#adminComparisonModal .admin-summary-drawing-card,
#adminComparisonModal .admin-comparison-completion-card,
#adminComparisonModal .admin-comparison-school-card {
  border-left: 4px solid #777;
  background: #fff;
}

#adminSummaryModal .admin-summary-drawing-card:hover,
#adminComparisonModal .admin-summary-drawing-card:hover {
  border-left-color: var(--admin-red);
}

#adminSchoolFilterModal .field {
  padding: 14px;
  border: 1px solid #d0d0d0;
  background: #fff;
}

#adminSchoolFilterModal .actions {
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid #cfcfcf;
}

@media (max-width: 760px) {
  #adminSettingsModal .app-settings-dialog > .stack,
  #adminSettingsModal .settings-grid {
    grid-template-columns: 1fr;
  }

  #adminSettingsModal .app-settings-dialog > .stack > * {
    grid-column: 1;
  }

  #adminTrashModal .admin-trash-toolbar,
  #adminTop25Modal .admin-trash-toolbar {
    grid-template-columns: 1fr;
  }

  #adminTrashModal .lightbox-dialog > .stack,
  #adminTop25Modal .lightbox-dialog > .stack,
  #adminSummaryModal .lightbox-dialog > .stack,
  #adminComparisonModal .lightbox-dialog > .stack,
  #adminSettingsModal .lightbox-dialog > .stack {
    padding: 16px;
  }
}

/* Revisione finale della testata: fascia unica, contrasto alto */
.shell {
  padding-top: 72px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  width: 100%;
  height: 72px;
  padding: 10px 24px;
  background: #c91f24;
  border-bottom: 1px solid #941419;
  box-shadow: 0 6px 18px rgba(55, 0, 0, 0.22);
}

.lightbox {
  z-index: 200;
}

#adminView .admin-top-strip {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "actions"
    "copy"
    "metrics";
  gap: 0;
  padding: 0;
  margin-bottom: 18px;
  border: 0;
  border-bottom: 1px solid #a8171b;
  background: #d92f34;
  box-shadow: 0 8px 20px rgba(70, 0, 0, 0.12);
}

#adminView .admin-top-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 28px;
  border-bottom: 1px solid rgba(112, 0, 0, 0.35);
  background: #cf272c;
}

#adminView .admin-top-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.38);
}

#adminView .admin-top-action-group:last-child {
  padding-right: 0;
  border-right: 0;
}

#adminView .admin-top-strip .admin-top-actions button,
#adminView .admin-top-strip .admin-settings-button {
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

#adminView .admin-top-strip .admin-top-action-workspace button {
  border-color: #fff;
  background: #fff;
  color: #8e1115;
}

#adminView .admin-top-strip .admin-top-actions button:hover,
#adminView .admin-top-strip .admin-top-actions button:focus-visible {
  border-color: #fff;
  background: #fff;
  color: #8e1115;
  box-shadow: none;
}

#adminView .admin-top-strip .admin-top-actions button:disabled {
  opacity: 0.42;
  border-color: rgba(255, 255, 255, 0.45);
  background: transparent;
  color: #fff;
}

#adminView .admin-top-copy {
  grid-area: copy;
  display: grid;
  gap: 6px;
  padding: 18px 28px 14px;
  border: 0;
  background: transparent;
}

#adminView .admin-top-copy .eyebrow {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

#adminView .admin-top-copy h2 {
  margin: 0;
  color: #fff;
  font-size: 28px;
}

#adminView .admin-top-copy p {
  max-width: 920px;
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
  line-height: 1.4;
}

#adminView .admin-metrics-row {
  grid-area: metrics;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 0 28px 20px;
  background: transparent;
}

#adminView .admin-metric,
#adminView .admin-metric:nth-child(n) {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-left: 4px solid rgba(255, 255, 255, 0.76);
  background: rgba(110, 0, 0, 0.15);
  box-shadow: none;
}

#adminView .admin-metric:nth-child(n + 4) {
  border-left-color: #fff;
  background: rgba(92, 0, 0, 0.26);
}

#adminView .admin-metric .summary-label,
#adminView .admin-top-strip .admin-metric .summary-label {
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#adminView .admin-metric .summary-value,
#adminView .admin-top-strip .admin-metric .summary-value {
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 1100px) {
  #adminView .admin-metrics-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .shell {
    padding-top: 66px;
  }

  .topbar {
    height: 66px;
    padding: 8px 12px;
  }

  #adminView .admin-top-actions {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  #adminView .admin-top-action-group {
    width: 100%;
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.28);
  }

  #adminView .admin-top-action-group:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  #adminView .admin-top-action-group button {
    flex: 1;
  }

  #adminView .admin-top-copy {
    padding: 18px 16px 12px;
  }

  #adminView .admin-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 16px 16px;
  }
}

/* V2 overrides finali: devono prevalere sul tema storico */
#adminView .admin-top-copy {
  padding: 14px 28px 10px;
}

#adminView .admin-top-copy h2 {
  font-size: 25px;
}

#adminView .admin-top-copy p {
  max-width: 760px;
  font-size: 13px;
}

#adminView .admin-metrics-row {
  gap: 6px;
  padding: 0 28px 14px;
}

#adminView .admin-metric,
#adminView .admin-metric:nth-child(n) {
  position: relative;
  min-height: 64px;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-content: center;
  padding: 9px 12px;
  text-align: left;
}

#adminView button.admin-metric-action {
  cursor: pointer;
}

#adminView button.admin-metric-action:hover,
#adminView button.admin-metric-action:focus-visible {
  border-color: #fff;
  background: rgba(92, 0, 0, 0.42);
  box-shadow: inset 0 0 0 1px #fff;
}

#adminView .admin-metric .summary-label {
  grid-column: 1 / -1;
}

#adminView .admin-metric .summary-value {
  grid-column: 1;
  grid-row: 2;
}

#adminView .admin-metric-hint {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

#adminView .admin-layout > .panel {
  overflow: visible;
}

#adminView .admin-gallery-controlbar {
  position: sticky;
  top: 72px;
  z-index: 18;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: -20px -20px 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--admin-line-strong);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.08);
}

#adminView .admin-gallery-controlbar .admin-gallery-toolbar {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 14px;
  width: auto;
  min-width: 0;
}

#adminView .admin-gallery-primary,
#adminView .admin-gallery-context {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#adminView .admin-gallery-context {
  padding-left: 14px;
  border-left: 1px solid var(--admin-line);
}

#adminView .admin-gallery-controlbar #adminGalleryCount {
  justify-self: end;
  white-space: nowrap;
  border-color: #d32f2f;
  background: #fff5f5;
  font-weight: 800;
}

#adminView .admin-state-hint {
  min-height: 0;
  padding: 8px 12px;
  border-left: 4px solid #b7b7b7;
  background: #f6f6f6;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
}

@media (max-width: 1050px) {
  #adminView .admin-gallery-controlbar {
    align-items: stretch;
  }

  #adminView .admin-gallery-controlbar .admin-gallery-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #adminView .admin-gallery-context {
    padding: 10px 0 0;
    border-left: 0;
    border-top: 1px solid var(--admin-line);
  }
}

@media (max-width: 720px) {
  #adminView .admin-top-copy {
    padding: 14px 16px 10px;
  }

  #adminView .admin-metrics-row {
    padding: 0 16px 14px;
  }

  #adminView .admin-gallery-controlbar {
    top: 66px;
    grid-template-columns: 1fr;
    margin-inline: -16px;
  }

  #adminView .admin-gallery-primary,
  #adminView .admin-gallery-context {
    flex-wrap: wrap;
  }

  #adminView .admin-gallery-states {
    width: 100%;
  }
}

/* Sprint F1.4 - override conclusivi per la schermata di scrematura globale */
#adminView .admin-workflow-bar {
  position: sticky;
  top: 0;
  z-index: 22;
  margin: -6px 0 14px;
  border: 1px solid var(--admin-line-strong);
  border-left: 6px solid var(--admin-red);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(22, 22, 22, 0.09);
}

#adminView .admin-workflow-phase {
  min-height: 62px;
}

#adminView .admin-workflow-phase > span {
  width: 34px;
  height: 34px;
  font-size: 15px;
}

#adminView .admin-workflow-phase strong {
  font-size: 13px;
  line-height: 1.1;
}

#adminView .admin-workflow-phase small {
  margin-top: 3px;
  font-size: 11px;
}

#adminView .admin-workflow-live {
  min-height: 62px;
  align-content: center;
  border-left: 1px solid var(--admin-line);
  background: linear-gradient(180deg, #fffafa 0%, #ffffff 100%);
}

#adminView .admin-workflow-live strong {
  font-size: 14px;
}

#adminView .admin-workflow-live span {
  max-width: 54ch;
  font-size: 12px;
  line-height: 1.35;
}

#adminView .admin-focus-strip {
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--admin-line);
  border-top: 4px solid var(--admin-red);
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
}

#adminView .admin-progress-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(132px, 1fr));
  gap: 8px;
}

#adminView .admin-progress-metric {
  min-height: 66px;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 6px;
  padding: 11px 12px;
  border-width: 1px;
  border-left-width: 5px;
  box-shadow: none;
}

#adminView .admin-progress-metric strong {
  font-size: 26px;
}

#adminView .admin-progress-metric small {
  font-size: 11px;
  letter-spacing: 0.03em;
}

#adminView .admin-progress-metric.is-active {
  border-left-color: #267a57;
  background: linear-gradient(180deg, #f6fcf9 0%, #ffffff 100%);
}

#adminView .admin-progress-metric.is-discarded {
  border-left-color: #2c2c2c;
  background: linear-gradient(180deg, #f3f3f3 0%, #ffffff 100%);
}

#adminView .admin-progress-metric.is-remaining {
  border-left-color: var(--admin-red);
  background: linear-gradient(180deg, #fff3f3 0%, #ffffff 100%);
}

#adminView .admin-progress-metric.is-protected {
  border-left-color: #a86f12;
  background: linear-gradient(180deg, #fff8e8 0%, #ffffff 100%);
}

#adminView .admin-winner-summary {
  min-height: 52px;
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed var(--admin-line-strong);
  background: #ffffff;
  color: var(--admin-ink-muted);
}

#adminView .admin-winner-summary.is-phase-complete {
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
  border: 2px solid var(--admin-red);
  border-left-width: 7px;
  background: linear-gradient(110deg, #ffffff 0%, #fff6f6 68%, #feecec 100%);
  box-shadow: 0 10px 22px rgba(80, 12, 12, 0.08);
}

#adminView .admin-phase-message-title {
  font-size: clamp(20px, 1.8vw, 28px);
  line-height: 1.1;
}

#adminView .admin-phase-message-body {
  max-width: 82ch;
  font-size: 14px;
}

#adminView .admin-phase-message-meta {
  width: fit-content;
  padding: 6px 9px;
  border: 1px solid rgba(211, 47, 47, 0.22);
  background: #fff8f8;
}

#adminView .admin-phase-message-action {
  min-width: 210px;
  min-height: 48px;
}

#adminView .admin-gallery-controlbar {
  top: 70px;
  z-index: 20;
  border-left: 1px solid var(--admin-line);
  border-right: 1px solid var(--admin-line);
}

#adminView .admin-phase2-sticky-counters {
  position: sticky;
  top: 70px;
  z-index: 24;
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--admin-line-strong);
  border-left: 6px solid var(--admin-red);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 22px rgba(33, 24, 16, 0.1);
}

#adminView .admin-phase2-sticky-counters.hidden {
  display: none;
}

#adminView .admin-phase2-sticky-item {
  display: grid;
  gap: 3px;
  min-height: 50px;
  align-content: center;
  padding: 9px 12px;
  border: 1px solid var(--admin-line);
  background: #fffaf7;
  text-align: left;
}

#adminView .admin-phase2-sticky-item span {
  color: var(--admin-ink-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#adminView .admin-phase2-sticky-item strong {
  color: var(--admin-ink);
  font-size: 23px;
  line-height: 1;
}

#adminView .admin-phase2-sticky-action {
  cursor: pointer;
}

#adminView .admin-phase2-sticky-action.is-pending {
  border-color: rgba(181, 79, 50, 0.42);
}

#adminView .admin-phase2-sticky-action.is-complete {
  border-color: rgba(39, 131, 95, 0.54);
  background: #f0fbf5;
}

#adminView .admin-state-hint {
  max-width: 72ch;
  border-left-color: var(--admin-red);
  background: #fffafa;
  color: var(--admin-ink-muted);
}

#adminView .drawing-board-masonry {
  column-width: clamp(168px, calc(190px * var(--card-scale)), 230px);
  column-gap: 9px;
}

#adminView .drawing-tile {
  margin-bottom: 9px;
}

@media (max-width: 1180px) {
  #adminView .admin-workflow-bar {
    grid-template-columns: 1fr;
  }

  #adminView .admin-workflow-live {
    border-top: 1px solid var(--admin-line);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  #adminView .admin-workflow-bar {
    top: 66px;
    margin-inline: -16px;
    border-left-width: 0;
  }

  #adminView .admin-workflow-steps {
    grid-template-columns: 1fr;
  }

  #adminView .admin-workflow-connector {
    display: none;
  }

  #adminView .admin-progress-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #adminView .admin-winner-summary.is-phase-complete {
    grid-template-columns: 1fr;
  }

  #adminView .admin-phase-message-action {
    width: 100%;
  }

  #adminView .drawing-board-masonry {
    column-width: clamp(140px, 46vw, 190px);
  }
}

#adminView .admin-top-strip .admin-settings-button.active {
  border-color: #ffffff;
  background: #ffffff;
  color: #8e1115;
  box-shadow: inset 0 -3px 0 rgba(142, 17, 21, 0.22);
}

/* Sprint F2.2 - card decisionale scuola piu chiara */
#adminView .admin-school-decision-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}

#adminView .admin-school-decision-main {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--admin-line-strong);
  background: #ffffff;
}

#adminView .admin-school-decision-main {
  border-left: 6px solid var(--admin-green-line);
}

#adminView .admin-school-decision-main.is-absolute-school {
  border-left-color: var(--admin-red);
  background: linear-gradient(110deg, #ffffff 0%, #fff7f7 100%);
}

#adminView .admin-school-decision-head {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
}

#adminView .admin-school-decision-head h4 {
  margin: 4px 0 6px;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.05;
}

#adminView .admin-school-decision-shell .admin-school-winner-spotlight {
  margin: 0;
}

/* Sprint F2.3 - doppia lettura scuola assoluto */
#adminView .admin-school-decision-main.is-absolute-school {
  gap: 18px;
}

#adminView .admin-absolute-locked-card {
  display: grid;
  grid-template-columns: minmax(190px, 280px) minmax(0, 1fr);
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--admin-red);
  border-left: 6px solid var(--admin-red);
  background: linear-gradient(110deg, #ffffff 0%, #fff7f7 100%);
}

#adminView .admin-absolute-locked-card .admin-school-winner-open {
  cursor: zoom-in;
}

#adminView .admin-absolute-locked-card .admin-school-winner-copy h5,
#adminView .admin-school-winner-spotlight.is-school-counterpart .admin-school-winner-copy h5 {
  margin: 6px 0 8px;
}

#adminView .admin-school-winner-spotlight.is-school-counterpart {
  border-color: var(--admin-line-strong);
  border-left-color: var(--admin-green-line);
  background: linear-gradient(110deg, #ffffff 0%, #f4fbf7 100%);
}

/* Late development - Fase 2 piu compatta e leggibile */
#adminView .admin-phase2-sticky-counters {
  top: 116px;
}

#adminView .admin-school-decision-shell {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

#adminView .admin-school-decision-main {
  gap: 12px;
  padding: 14px;
}

#adminView .admin-school-decision-head {
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--admin-line);
}

#adminView .admin-school-decision-head h4 {
  margin: 3px 0 4px;
  font-size: clamp(20px, 1.55vw, 25px);
}

#adminView .admin-school-decision-head p {
  max-width: 78ch;
  margin: 0;
  line-height: 1.38;
}

#adminView .admin-decision-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#adminView .admin-decision-primary-actions button {
  min-height: 38px;
}

#adminView .admin-school-decision-shell .admin-school-winner-spotlight,
#adminView .admin-absolute-locked-card {
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
}

#adminView .admin-school-decision-shell .admin-school-winner-preview {
  min-width: 0;
}

#adminView .admin-school-decision-shell .admin-school-winner-open {
  max-height: 220px;
  overflow: hidden;
}

#adminView .admin-school-decision-shell .admin-school-winner-open img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

#adminView .admin-school-decision-shell .admin-school-winner-copy {
  align-content: start;
  gap: 7px;
}

#adminView .admin-school-decision-shell .admin-school-winner-copy h5 {
  margin: 4px 0;
  font-size: clamp(18px, 1.4vw, 22px);
  line-height: 1.08;
}

#adminView .admin-school-decision-shell .admin-highlighted-drawing-meta {
  gap: 6px;
}

#adminView .admin-school-decision-shell .admin-highlighted-drawing-meta span {
  padding: 6px 8px;
  font-size: 12px;
}

#adminView .admin-school-decision-shell .admin-empty-decision-card {
  padding: 14px;
  border-left-width: 4px;
}

#adminView .admin-phase2-gallery-bar {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 8px 0 0;
  border-top: 1px solid rgba(132, 90, 58, 0.18);
}

#adminView .admin-phase2-gallery-bar.hidden {
  display: none;
}

#adminView .admin-phase2-gallery-bar .admin-collapse-toggle {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  border-color: rgba(176, 31, 31, 0.18);
  border-radius: 0;
  background: linear-gradient(90deg, rgba(255, 250, 238, 0.96), #ffffff);
  color: var(--admin-ink);
  font-weight: 900;
  letter-spacing: 0.01em;
  box-shadow: inset 4px 0 0 var(--admin-red);
}

#adminView .admin-phase2-gallery-bar .admin-collapse-toggle::after {
  content: "";
  width: 10px;
  height: 10px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

#adminView .admin-phase2-gallery-bar .admin-collapse-toggle[aria-expanded="false"]::after {
  transform: rotate(-45deg);
}

/* Sprint F2.5 - riepilogo finale e congelamento */
#adminSummaryModal .admin-summary-freeze-banner {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--admin-red);
  border-left: 6px solid var(--admin-red);
  background: linear-gradient(110deg, #ffffff 0%, #fff7f7 100%);
}

#adminSummaryModal .admin-summary-freeze-banner.is-pending {
  border-color: var(--admin-amber-line);
  border-left-color: var(--admin-amber-line);
  background: linear-gradient(110deg, #ffffff 0%, #fff9ed 100%);
}

#adminSummaryModal .admin-summary-freeze-banner strong {
  display: block;
  margin: 4px 0 6px;
  color: var(--admin-ink);
  font-size: clamp(20px, 1.8vw, 28px);
  line-height: 1.08;
}

#adminSummaryModal .admin-summary-freeze-banner p {
  max-width: 78ch;
  margin: 0;
  color: var(--admin-ink-muted);
  line-height: 1.45;
}

@media (max-width: 1080px) {
  #adminView .admin-school-decision-shell {
    grid-template-columns: 1fr;
  }

  #adminView .admin-school-decision-head {
    display: grid;
  }

  #adminView .admin-absolute-locked-card {
    grid-template-columns: 1fr;
  }

  #adminSummaryModal .admin-summary-freeze-banner {
    grid-template-columns: 1fr;
  }
}

/* Sprint F1.9 - notifica breve per provvisorio scuola */
#adminView .admin-notification-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 45;
  width: min(340px, calc(100vw - 36px));
  display: grid;
  gap: 4px;
  padding: 10px 13px;
  border: 1px solid rgba(39, 131, 95, 0.34);
  border-left: 5px solid var(--admin-green-line);
  background: rgba(255, 255, 255, 0.98);
  color: var(--admin-ink);
  box-shadow: 0 14px 30px rgba(22, 22, 22, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

#adminView .admin-notification-toast strong {
  font-size: 13px;
  line-height: 1.2;
  color: #176444;
}

#adminView .admin-notification-toast span {
  font-size: 13px;
  line-height: 1.35;
  color: var(--admin-ink-muted);
}

#adminView .admin-notification-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Sprint F1.7 - Focus immersivo per scrematura rapida */
#adminView.is-focus-mode .admin-top-copy,
#adminView.is-focus-mode .admin-metrics-row,
#adminView.is-focus-mode .admin-workflow-bar,
#adminView.is-focus-mode .admin-section-divider,
#adminView.is-focus-mode #adminClassTrackerSection,
#adminView.is-focus-mode #adminClassTrackerDivider,
#adminView.is-focus-mode .admin-workbar,
#adminView.is-focus-mode .admin-focus-strip {
  display: none;
}

#adminView.is-focus-mode .admin-top-strip {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(70, 0, 0, 0.14);
}

#adminView.is-focus-mode .admin-top-actions {
  min-height: 46px;
  padding: 6px 18px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(112, 0, 0, 0.38);
}

#adminView.is-focus-mode .admin-top-action-group {
  gap: 6px;
  padding-right: 10px;
}

#adminView.is-focus-mode .admin-top-action-results,
#adminView.is-focus-mode .admin-top-action-navigation #adminSettingsButton {
  display: none;
}

#adminView.is-focus-mode .admin-top-strip .admin-top-actions button,
#adminView.is-focus-mode .admin-top-strip .admin-settings-button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}

#adminView.is-focus-mode .admin-layout {
  margin-top: 0;
}

#adminView.is-focus-mode .admin-layout > .panel {
  padding-top: 0;
  border-top: 0;
}

#adminView.is-focus-mode .admin-gallery-controlbar {
  top: 48px;
  z-index: 29;
  margin: 0 -20px 12px;
  padding: 12px 14px 9px;
  border: 1px solid #d8d0c5;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: rgba(255, 255, 255, 0.985);
  box-shadow: 0 8px 18px rgba(67, 49, 28, 0.08);
  overflow: hidden;
}

#adminView.is-focus-mode .admin-gallery-controlbar .admin-gallery-toolbar {
  gap: 10px;
}

#adminView.is-focus-mode .admin-gallery-context {
  padding-left: 10px;
}

#adminView.is-focus-mode .admin-gallery-controlbar .segmented button,
#adminView.is-focus-mode .admin-gallery-controlbar button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

#adminView.is-focus-mode #adminGalleryCount {
  min-height: 30px;
  font-size: 12px;
}

#adminView.is-focus-mode .grouped-gallery {
  padding-top: 2px;
}

#adminView.is-focus-mode .gallery-group {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#adminView.is-focus-mode .gallery-group > .toolbar {
  display: none;
}

#adminView.is-focus-mode .drawing-board-masonry {
  column-width: clamp(132px, calc(154px * var(--card-scale)), 188px);
  column-gap: 7px;
}

#adminView.is-focus-mode .drawing-tile {
  margin-bottom: 7px;
  border-color: #d8d8d8;
}

#adminView.is-focus-mode .drawing-tile .art-meta,
#adminView.is-focus-mode .drawing-tile .tile-meta,
#adminView.is-focus-mode .drawing-tile .drawing-meta {
  font-size: 11px;
  line-height: 1.2;
}

#adminView.is-focus-mode #adminStatus {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(460px, calc(100vw - 36px));
  margin: 0;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

#adminView.is-focus-mode .admin-notification-toast {
  bottom: 18px;
}

@media (max-width: 760px) {
  #adminView.is-focus-mode .admin-top-strip {
    margin-inline: -16px;
    border-radius: 0;
  }

  #adminView.is-focus-mode .admin-top-actions {
    padding-inline: 12px;
  }

  #adminView.is-focus-mode .admin-top-action-group {
    width: auto;
    padding: 0;
    border: 0;
  }

  #adminView.is-focus-mode .admin-gallery-controlbar {
    top: 48px;
    margin-inline: -16px;
    border-radius: 0 0 12px 12px;
  }

  #adminView.is-focus-mode .admin-gallery-primary,
  #adminView.is-focus-mode .admin-gallery-context {
    flex-wrap: wrap;
  }

  #adminView.is-focus-mode .drawing-board-masonry {
    column-width: clamp(118px, 44vw, 170px);
  }

  #adminView .admin-notification-toast,
  #adminView.is-focus-mode .admin-notification-toast {
    top: auto;
    right: 12px;
    bottom: 72px;
    width: calc(100vw - 24px);
  }
}

/* External access refinement: consent is a real gate and the first screen feels branded. */
body.modal-open {
  overflow: hidden;
}

body:has(#authView.active) .page {
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 211, 44, 0.22), transparent 22%),
    radial-gradient(circle at 86% 78%, rgba(211, 47, 47, 0.12), transparent 28%),
    linear-gradient(145deg, #fff7ea 0%, #ffffff 42%, #f8efe2 100%);
}

body #authView .auth-shell {
  width: min(980px, calc(100% - 28px));
  border: 1px solid rgba(136, 22, 27, 0.16);
  border-radius: 26px;
  background: linear-gradient(135deg, #c91f24 0%, #98171c 100%);
  box-shadow: 0 30px 80px rgba(91, 9, 13, 0.24);
}

body #authView .auth-content-grid {
  padding: 18px;
  background:
    radial-gradient(circle at 98% 0%, rgba(255, 211, 44, 0.2), transparent 24%),
    linear-gradient(135deg, #c91f24 0%, #8d1419 100%);
}

body #authView .auth-card {
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 250, 242, 0.98)),
    repeating-linear-gradient(135deg, rgba(211, 47, 47, 0.04) 0 1px, transparent 1px 14px);
  box-shadow: 0 24px 60px rgba(80, 24, 18, 0.18);
}

body #authView .auth-card-heading h2 {
  color: #2f1813;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -1.1px;
}

body #authView .auth-step-form {
  border-left: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.78);
}

body #authView .auth-consent-inline {
  align-items: center;
  padding: 14px;
  border-color: rgba(211, 47, 47, 0.26);
  border-radius: 18px;
  background: linear-gradient(135deg, #fff6e4 0%, #ffffff 100%);
  box-shadow: 0 12px 26px rgba(74, 22, 18, 0.08);
}

body #authView .auth-consent-inline::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d32f2f;
  box-shadow: 0 0 0 5px rgba(211, 47, 47, 0.12);
}

body #authView .auth-consent-inline.accepted {
  border-color: rgba(47, 141, 91, 0.32);
  background: linear-gradient(135deg, #eefbf3 0%, #ffffff 100%);
}

body #authView .auth-consent-inline.accepted::before {
  background: #2f8d5b;
  box-shadow: 0 0 0 5px rgba(47, 141, 91, 0.13);
}

body #authView .tiny-button {
  border-color: rgba(211, 47, 47, 0.3);
  background: #ffffff;
  color: #8d1419;
  font-weight: 800;
}

body #authView button.primary {
  border-radius: 14px;
  background: linear-gradient(135deg, #d32f2f, #9f1d1d);
  box-shadow: 0 14px 28px rgba(211, 47, 47, 0.22);
}

body #authView button.primary:disabled {
  cursor: not-allowed;
  border-color: #cfc7bd;
  background: #cfc7bd;
  box-shadow: none;
}

#authTermsModal.lightbox,
#externalRulesModal.lightbox,
#externalCompleteModal.lightbox {
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: hidden;
}

#authTermsModal.lightbox.hidden,
#externalRulesModal.lightbox.hidden,
#externalCompleteModal.lightbox.hidden {
  display: none;
}

#authTermsModal .auth-terms-dialog {
  max-height: min(760px, calc(100vh - 44px));
  margin: 0;
  display: grid;
}

#authTermsModal .auth-terms-shell {
  min-height: 0;
  max-height: min(760px, calc(100vh - 44px));
  overflow: hidden;
}

#authTermsModal .auth-terms-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#externalRulesModal .external-info-dialog {
  width: min(760px, calc(100% - 32px));
  margin: 0;
  padding: 26px;
  border: 1px solid rgba(211, 47, 47, 0.16);
  border-top: 0;
  border-radius: 24px;
  background:
    radial-gradient(circle at 92% 10%, rgba(255, 211, 44, 0.24), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #fff8ed 100%);
  box-shadow: 0 28px 70px rgba(52, 34, 24, 0.24);
}

#externalRulesModal .external-info-dialog > .stack > div:first-child {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(211, 47, 47, 0.12);
}

#externalRulesModal .external-info-copy {
  border-left: 0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(211, 47, 47, 0.12);
}

#externalRulesModal .actions .primary,
#externalCompleteModal .actions .primary {
  border-radius: 999px;
  padding-inline: 22px;
}

#externalView .class-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
  gap: 16px;
  align-items: start;
}

#externalView .class-card-side {
  display: grid;
  gap: 10px;
  align-content: start;
}

#externalView .class-card-status {
  min-width: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf2 100%);
}

#externalView .class-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#externalView .class-card-actions button {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
}

@media (max-width: 860px) {
  #externalView .class-card-head {
    grid-template-columns: 1fr;
  }
}

/* External guest polish: branded consent, reliable uploads list, stronger completion. */
body #authView .auth-terms-dialog {
  width: min(920px, calc(100% - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(116, 28, 28, 0.14);
  border-top: 0;
  border-radius: 28px;
  background: #fffaf2;
  box-shadow: 0 32px 80px rgba(74, 22, 18, 0.32);
}

body #authView .auth-terms-shell {
  display: grid;
  grid-template-columns: minmax(240px, 0.92fr) minmax(0, 1.35fr);
  min-height: 520px;
}

body #authView .auth-terms-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
  min-height: 100%;
  padding: 34px;
  overflow: hidden;
  color: #ffffff;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 220, 75, 0.95) 0 11%, transparent 12%),
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, 0.18) 0 14%, transparent 15%),
    linear-gradient(145deg, #d51f2a 0%, #9d151d 58%, #641016 100%);
}

body #authView .auth-terms-brand-panel::before,
body #authView .auth-terms-brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

body #authView .auth-terms-brand-panel::before {
  width: 220px;
  height: 220px;
  right: -86px;
  bottom: -72px;
  border: 34px solid rgba(255, 211, 44, 0.34);
}

body #authView .auth-terms-brand-panel::after {
  width: 140px;
  height: 140px;
  left: -52px;
  top: 96px;
  background: rgba(255, 255, 255, 0.12);
}

body #authView .auth-terms-brand-panel .eyebrow,
body #authView .auth-terms-brand-panel h3,
body #authView .auth-terms-brand-panel p,
body #authView .auth-terms-ribbon {
  position: relative;
  z-index: 1;
}

body #authView .auth-terms-brand-panel .eyebrow {
  color: #ffdf44;
}

body #authView .auth-terms-brand-panel h3 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 0.95;
  letter-spacing: -1.5px;
}

body #authView .auth-terms-brand-panel p {
  margin: 0;
  max-width: 28ch;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  line-height: 1.55;
}

body #authView .auth-terms-ribbon {
  width: max-content;
  max-width: 100%;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-weight: 800;
}

body #authView .auth-terms-content {
  padding: clamp(24px, 4vw, 42px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 250, 242, 0.98) 100%),
    repeating-linear-gradient(135deg, rgba(211, 47, 47, 0.04) 0 1px, transparent 1px 14px);
}

body #authView .auth-terms-copy {
  gap: 12px;
  padding: 18px;
  border-color: rgba(211, 47, 47, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

body #authView .auth-terms-check {
  position: relative;
  grid-template-columns: auto 1fr;
  gap: 13px;
  align-items: center;
  padding: 16px;
  border-color: rgba(211, 47, 47, 0.22);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(74, 22, 18, 0.09);
}

body #authView .auth-terms-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

body #authView .auth-terms-checkmark {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #d32f2f;
  border-radius: 10px;
  background: #fff8e7;
  box-shadow: inset 0 0 0 4px #ffffff;
}

body #authView .auth-terms-checkmark::after {
  content: "";
  width: 7px;
  height: 13px;
  display: none;
  border: solid #ffffff;
  border-width: 0 3px 3px 0;
  transform: rotate(42deg);
}

body #authView .auth-terms-check input:checked + .auth-terms-checkmark {
  border-color: #2f8d5b;
  background: #2f8d5b;
}

body #authView .auth-terms-check input:checked + .auth-terms-checkmark::after {
  display: block;
}

body #authView .auth-terms-check:focus-within {
  outline: 3px solid rgba(255, 211, 44, 0.55);
  outline-offset: 3px;
}

body #authView .auth-terms-actions .primary {
  min-width: 190px;
  border-radius: 999px;
  background: linear-gradient(135deg, #d32f2f, #9f1d1d);
  box-shadow: 0 14px 28px rgba(211, 47, 47, 0.24);
}

body #authView .auth-terms-actions .primary:disabled {
  background: #cfc7bd;
  box-shadow: none;
}

.external-info-dialog.external-complete-dialog {
  width: min(760px, calc(100% - 32px));
  padding: 28px;
  border: 1px solid rgba(47, 141, 91, 0.2);
  border-radius: 28px;
  background:
    radial-gradient(circle at 90% 8%, rgba(255, 211, 44, 0.24), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #fff8ed 100%);
  box-shadow: 0 32px 80px rgba(52, 34, 24, 0.24);
}

.external-complete-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.external-complete-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #2f8d5b, #59b47f);
  box-shadow: 0 16px 32px rgba(47, 141, 91, 0.24);
}

.external-complete-mark::after {
  content: "";
  width: 15px;
  height: 28px;
  border: solid #ffffff;
  border-width: 0 5px 5px 0;
  transform: rotate(42deg);
}

.external-complete-next {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid rgba(211, 47, 47, 0.14);
  border-radius: 18px;
  background: #ffffff;
}

.external-complete-next strong {
  color: #34231c;
}

.external-complete-next span {
  color: #6b5b4d;
  line-height: 1.45;
}

#externalView .file-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  max-height: min(520px, 58vh);
  padding: 4px 8px 4px 2px;
  overflow-y: auto;
}

#externalView .file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 16px;
  border-color: rgba(211, 47, 47, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #fffaf2 100%);
  box-shadow: 0 8px 20px rgba(52, 34, 24, 0.06);
}

#externalView .file-item-main {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

#externalView .file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#externalView .file-item-main .art-meta {
  justify-self: end;
  white-space: nowrap;
  color: #75685c;
}

#externalView .file-item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-width: max-content;
}

#externalView .file-open-link,
#externalView .compact-icon-button {
  min-width: 44px;
  min-height: 36px;
  padding: 0 12px;
  justify-content: center;
  border-radius: 12px;
}

@media (max-width: 760px) {
  body #authView .auth-terms-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  body #authView .auth-terms-brand-panel {
    min-height: 220px;
    padding: 26px;
  }

  body #authView .auth-terms-dialog,
  .external-info-dialog.external-complete-dialog {
    border-radius: 22px;
  }

  #externalView .file-item {
    grid-template-columns: minmax(0, 1fr);
  }

  #externalView .file-item-main {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  #externalView .file-item-main .art-meta {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #externalView .file-item-actions {
    justify-content: flex-start;
    min-width: 0;
  }
}

/* External responsive refinements: desktop login balance, progress line, mobile safe actions. */
@media (min-width: 761px) {
  body:has(#authView.active) .page {
    padding: 32px;
    background:
      radial-gradient(circle at 8% 8%, rgba(255, 211, 44, 0.18), transparent 18%),
      linear-gradient(180deg, #fffdf8 0%, #fbf3e6 100%);
  }

  body #authView .auth-shell {
    width: min(620px, calc(100% - 32px));
    border-radius: 18px;
    background: #c91f24;
  }

  body #authView .auth-content-grid {
    padding: 16px;
    background: #c91f24;
  }

  body #authView .auth-card {
    border-radius: 16px;
  }

  body #authView .auth-brand-panel {
    border-radius: 18px 18px 0 0;
  }
}

@media (min-width: 721px) {
  body #externalView .external-steps {
    --external-progress-ratio: 0;
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 18px 10px 14px;
    border: 1px solid rgba(211, 47, 47, 0.14);
    border-radius: 22px;
    background:
      radial-gradient(circle at 4% 12%, rgba(255, 211, 44, 0.2), transparent 20%),
      linear-gradient(180deg, #ffffff 0%, #fff8ed 100%);
    box-shadow: 0 14px 34px rgba(67, 49, 28, 0.08);
    overflow: hidden;
  }

  body #externalView .external-steps::before,
  body #externalView .external-steps::after {
    content: "";
    position: absolute;
    left: calc(12.5% + 20px);
    right: calc(12.5% + 20px);
    top: 39px;
    height: 6px;
    border-radius: 999px;
  }

  body #externalView .external-steps::before {
    background: rgba(211, 47, 47, 0.12);
  }

  body #externalView .external-steps::after {
    right: auto;
    width: calc((75% - 40px) * var(--external-progress-ratio));
    background: linear-gradient(90deg, #d32f2f 0%, #ffd323 100%);
    box-shadow: 0 0 18px rgba(255, 211, 35, 0.38);
    transition: width 520ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  body #externalView .step-chip {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 10px;
    min-height: 82px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: #76695d;
    box-shadow: none;
    text-align: center;
  }

  body #externalView .step-chip.active {
    background: transparent;
    box-shadow: none;
  }

  body #externalView .step-chip::before {
    content: "";
    width: 42px;
    height: 42px;
    display: block;
    border: 3px solid #eadfce;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(52, 34, 24, 0.08);
    transition:
      transform 280ms ease,
      border-color 280ms ease,
      background 280ms ease,
      box-shadow 280ms ease;
  }

  body #externalView .step-chip::after {
    position: absolute;
    top: 11px;
    color: #7f1111;
    font-size: 13px;
    font-weight: 900;
  }

  body #externalView .step-chip:nth-child(1)::after {
    content: "1";
  }

  body #externalView .step-chip:nth-child(2)::after {
    content: "2";
  }

  body #externalView .step-chip:nth-child(3)::after {
    content: "3";
  }

  body #externalView .step-chip:nth-child(4)::after {
    content: "4";
  }

  body #externalView .step-chip.completed,
  body #externalView .step-chip.active {
    color: #2f1813;
  }

  body #externalView .step-chip.completed::before {
    border-color: #d32f2f;
    background: #d32f2f;
  }

  body #externalView .step-chip.completed::after {
    content: "";
    width: 9px;
    height: 17px;
    border: solid #ffffff;
    border-width: 0 3px 3px 0;
    transform: rotate(42deg);
  }

  body #externalView .step-chip.active::before {
    transform: scale(1.08);
    border-color: #d32f2f;
    background: #fff6d2;
    box-shadow:
      0 8px 18px rgba(52, 34, 24, 0.08),
      0 0 0 9px rgba(255, 211, 35, 0.18);
    animation: externalStepPulse 1600ms ease-in-out infinite;
  }

  body #externalView .step-chip.upcoming {
    opacity: 0.78;
  }
}

@keyframes externalStepPulse {
  0%,
  100% {
    box-shadow:
      0 8px 18px rgba(52, 34, 24, 0.08),
      0 0 0 7px rgba(255, 211, 35, 0.14);
  }

  50% {
    box-shadow:
      0 8px 18px rgba(52, 34, 24, 0.08),
      0 0 0 12px rgba(255, 211, 35, 0.24);
  }
}

@media (max-width: 720px) {
  body:not(:has(#authView.active)) {
    padding-bottom: 78px;
  }

  header.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 8px 10px 8px 12px;
  }

  header.topbar .brand {
    min-width: 0;
  }

  header.topbar .brand-logo-wrap {
    width: 132px;
    min-width: 132px;
  }

  header.topbar .brand h1,
  header.topbar .brand p,
  header.topbar .brand > div:last-child {
    display: none;
  }

  header.topbar .topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: max-content;
  }

  header.topbar .topbar-actions .pill {
    display: none;
  }

  header.topbar .topbar-actions #logoutButton {
    min-height: 36px;
    padding: 6px 12px;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-weight: 900;
  }

  #externalView .mobile-action-bar {
    position: fixed;
    inset: auto 12px calc(10px + env(safe-area-inset-bottom)) 12px;
    z-index: 48;
    display: block;
    padding: 8px;
    border: 1px solid rgba(211, 47, 47, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 36px rgba(52, 34, 24, 0.22);
    backdrop-filter: blur(10px);
  }

  #externalView .mobile-action-bar.hidden {
    display: none;
  }

  #externalView .mobile-action-meta {
    display: none;
  }

  #externalView .mobile-action-bar button {
    width: 100%;
    min-height: 46px;
    border-radius: 14px;
  }
}

/* Final consent polish: no decorative green dot, only the checkbox confirms acceptance. */
body #authView .auth-consent-inline::before {
  content: none !important;
  display: none !important;
}

#authTermsModal .auth-terms-checkmark {
  width: 38px;
  height: 38px;
  min-width: 38px;
  flex: 0 0 38px;
  align-self: center;
  position: relative;
  display: inline-grid;
  place-items: center;
  border: 2px solid #d32f2f;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff8e7, #ffffff);
  box-shadow: inset 0 0 0 4px #ffffff;
}

#authTermsModal .auth-terms-checkmark::after {
  content: "";
  display: none;
  width: 10px;
  height: 18px;
  border: solid #ffffff;
  border-width: 0 4px 4px 0;
  transform: translateY(-1px) rotate(42deg);
  transform-origin: center;
}

#authTermsModal .auth-terms-check input:checked + .auth-terms-checkmark {
  border-color: #2f8d5b !important;
  background: linear-gradient(135deg, #2f8d5b, #63bd87) !important;
  box-shadow: 0 10px 24px rgba(47, 141, 91, 0.24) !important;
}

#authTermsModal .auth-terms-check input:checked + .auth-terms-checkmark::after {
  display: block !important;
}

body #authView .auth-consent-inline.accepted::before,
body #authView .auth-consent-inline.accepted::after,
body #authView .auth-consent-inline::before,
body #authView .auth-consent-inline::after,
body #authView .auth-consent-inline .accepted::before,
body #authView .auth-consent-inline .accepted::after {
  content: none !important;
  display: none !important;
}

#authTermsModal .auth-terms-check input,
body #authView .auth-terms-check input {
  appearance: none !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  height: 1px !important;
  overflow: hidden !important;
  position: absolute !important;
  white-space: nowrap !important;
  width: 1px !important;
}

#authTermsModal .auth-terms-check input:checked + .auth-terms-checkmark,
body #authView #authTermsModal .auth-terms-check input:checked + .auth-terms-checkmark {
  border-color: #2f8d5b !important;
  background: linear-gradient(135deg, #2f8d5b, #63bd87) !important;
  color: #ffffff !important;
}

#authTermsModal .auth-terms-check input:checked + .auth-terms-checkmark::after,
body #authView #authTermsModal .auth-terms-check input:checked + .auth-terms-checkmark::after {
  display: block !important;
}

/* Privacy notice modal: long legal text scrolls inside the document pane, not behind the popup. */
body #authView #authTermsModal .auth-terms-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
}

body #authView #authTermsModal .auth-terms-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
  max-height: min(860px, calc(100vh - 32px));
}

body #authView #authTermsModal .auth-terms-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-height: 0;
  max-height: min(860px, calc(100vh - 32px));
  overflow: hidden;
  padding: clamp(20px, 3vw, 34px);
}

body #authView #authTermsModal .auth-terms-copy {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #fffdf8;
}

body #authView #authTermsModal .terms-document-heading {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(211, 47, 47, 0.12);
}

body #authView #authTermsModal .terms-text-slot {
  min-height: 260px;
  max-height: min(420px, 46vh);
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #c9272d #fff1d2;
}

body #authView #authTermsModal .terms-text-slot h4 {
  margin: 20px 0 8px;
  color: #11194f;
  font-size: 15px;
  letter-spacing: 0.02em;
}

body #authView #authTermsModal .terms-text-slot h4:first-child {
  margin-top: 0;
}

body #authView #authTermsModal .terms-text-slot p,
body #authView #authTermsModal .terms-text-slot li {
  color: #4f4039;
  font-size: 14px;
  line-height: 1.58;
}

body #authView #authTermsModal .terms-text-slot ul {
  margin: 8px 0 14px;
  padding-left: 22px;
}

body #authView #authTermsModal .terms-consent-footer {
  display: grid;
  gap: 14px;
  min-height: 0;
}

body #authView #authTermsModal .auth-terms-check {
  align-items: center;
  max-height: 190px;
  overflow-y: auto;
}

body #authView #authTermsModal .auth-terms-check span:last-child {
  font-size: 14px;
  line-height: 1.48;
}

@media (max-width: 720px) {
  body #authView #authTermsModal.lightbox {
    padding: 10px;
  }

  body #authView #authTermsModal .auth-terms-dialog,
  body #authView #authTermsModal .auth-terms-shell,
  body #authView #authTermsModal .auth-terms-content {
    max-height: calc(100vh - 20px);
  }

  body #authView #authTermsModal .terms-text-slot {
    max-height: 42vh;
    padding: 16px;
  }

  body #authView #authTermsModal .auth-terms-check {
    max-height: 180px;
  }
}

/* Privacy notice readability fix: the legal text must scroll all the way to the final paragraph. */
body #authView #authTermsModal .auth-terms-dialog {
  width: min(1180px, calc(100vw - 28px));
  height: calc(100dvh - 28px);
  max-height: calc(100dvh - 28px);
  border-radius: 30px;
  overflow: hidden;
}

body #authView #authTermsModal .auth-terms-shell,
body #authView #authTermsModal .auth-terms-content {
  height: 100%;
  max-height: none;
  min-height: 0;
}

body #authView #authTermsModal .auth-terms-content {
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  overflow: hidden;
  padding: clamp(18px, 2.6vw, 30px);
}

body #authView #authTermsModal .auth-help-header {
  padding: 0 2px 2px;
}

body #authView #authTermsModal .auth-help-header h3 {
  margin-bottom: 6px;
  letter-spacing: -0.03em;
}

body #authView #authTermsModal .auth-terms-copy {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(211, 47, 47, 0.14);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 249, 239, 0.98)),
    repeating-linear-gradient(90deg, rgba(211, 47, 47, 0.035) 0 1px, transparent 1px 28px);
}

body #authView #authTermsModal .terms-document-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 253, 248, 0.98);
  backdrop-filter: blur(8px);
}

body #authView #authTermsModal .terms-text-slot {
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 24px 28px 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-bottom: 120px;
}

body #authView #authTermsModal .terms-text-slot h4 {
  position: relative;
  margin: 24px 0 10px;
  padding: 2px 0 0 14px;
  color: #a5151d;
  font-size: 14px;
  text-transform: uppercase;
}

body #authView #authTermsModal .terms-text-slot h4::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 1px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e7272f, #ffd21f);
}

body #authView #authTermsModal .terms-text-slot h4:first-child {
  margin-top: 0;
}

body #authView #authTermsModal .terms-text-slot p,
body #authView #authTermsModal .terms-text-slot li {
  max-width: 92ch;
  font-size: 14.5px;
  line-height: 1.68;
}

body #authView #authTermsModal .terms-text-slot p {
  margin: 0 0 12px;
}

body #authView #authTermsModal .terms-text-slot ul {
  max-width: 92ch;
  margin: 8px 0 16px;
}

body #authView #authTermsModal .terms-consent-footer {
  display: grid;
  gap: 12px;
  padding-top: 0;
}

body #authView #authTermsModal .auth-terms-check {
  max-height: none;
  overflow: visible;
  align-items: center;
  border-radius: 20px;
}

@media (max-height: 760px) {
  body #authView #authTermsModal .auth-terms-content {
    gap: 12px;
    padding: 16px;
  }

  body #authView #authTermsModal .auth-help-header p {
    display: none;
  }

  body #authView #authTermsModal .terms-text-slot {
    padding-bottom: 96px;
  }

  body #authView #authTermsModal .auth-terms-check {
    align-items: start;
  }
}

@media (max-width: 720px) {
  body #authView #authTermsModal .auth-terms-dialog,
  body #authView #authTermsModal .auth-terms-shell,
  body #authView #authTermsModal .auth-terms-content {
    height: calc(100dvh - 18px);
    max-height: calc(100dvh - 18px);
  }

  body #authView #authTermsModal .auth-terms-content {
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px;
  }

  body #authView #authTermsModal .terms-document-heading {
    display: grid;
    gap: 4px;
    padding: 14px 16px 12px;
  }

  body #authView #authTermsModal .terms-text-slot {
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 16px 16px 100px;
  }

  body #authView #authTermsModal .auth-terms-check {
    grid-template-columns: 38px 1fr;
    padding: 14px;
  }
}

/* Privacy modal final layout: four real rows, document pane owns the scroll. */
body #authView #authTermsModal.lightbox {
  align-items: center;
  padding: 18px;
  overflow: hidden;
}

body #authView #authTermsModal .auth-terms-dialog {
  width: min(960px, calc(100vw - 40px));
  height: auto;
  max-height: calc(100vh - 40px);
  margin: 0 auto;
  overflow-y: auto;
  border: 1px solid rgba(127, 17, 17, 0.16);
  border-radius: 26px;
  background: #fffaf0;
  box-shadow: 0 28px 86px rgba(39, 18, 14, 0.34);
  scrollbar-color: #c9272d #f8ead6;
}

body #authView #authTermsModal .auth-terms-shell {
  height: auto;
  min-height: 0;
  overflow: visible;
  border-radius: inherit;
  background:
    radial-gradient(circle at 95% 2%, rgba(255, 211, 31, 0.22), transparent 24%),
    linear-gradient(180deg, #fffdfa 0%, #fff7ea 100%);
}

body #authView #authTermsModal .auth-terms-content {
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 14px;
  overflow: visible;
  padding: clamp(18px, 3vw, 28px);
  border-radius: inherit;
}

body #authView #authTermsModal .auth-terms-topline {
  min-height: 66px;
  padding: 14px 18px;
  border: 0;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(201, 31, 36, 0.98), rgba(145, 23, 28, 0.98)),
    linear-gradient(90deg, rgba(255, 211, 31, 0.18), transparent);
}

body #authView #authTermsModal .auth-help-header {
  padding: 2px 0 0;
}

body #authView #authTermsModal .auth-help-header h3 {
  margin: 3px 0 8px;
  color: #2f1813;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 0.96;
  letter-spacing: -0.045em;
}

body #authView #authTermsModal .auth-help-header p {
  max-width: 74ch;
  margin: 0;
  color: #6f5b4f;
  font-size: 16px;
  line-height: 1.45;
}

body #authView #authTermsModal .auth-terms-copy {
  min-height: 0;
  height: auto;
  display: grid;
  grid-template-rows: auto auto;
  overflow: visible;
  border: 1px solid rgba(127, 17, 17, 0.14);
  border-radius: 18px;
  background: #fffefb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

body #authView #authTermsModal .terms-document-heading {
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr);
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(127, 17, 17, 0.12);
  background:
    linear-gradient(90deg, rgba(255, 211, 31, 0.12), transparent),
    #fff8ea;
}

body #authView #authTermsModal .terms-document-heading strong {
  color: #7f1111;
  font-size: 16px;
  line-height: 1.18;
}

body #authView #authTermsModal .terms-document-heading span {
  color: #75665b;
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

body #authView #authTermsModal .terms-text-slot {
  min-height: 0;
  height: auto;
  max-height: none;
  align-self: stretch;
  overflow: visible;
  padding: 22px 24px 34px;
  scroll-padding-bottom: 34px;
  color: #3f322d;
  scrollbar-color: #c9272d #f8ead6;
  background:
    linear-gradient(90deg, rgba(255, 211, 31, 0.13) 0 4px, transparent 4px),
    linear-gradient(180deg, #fffefb, #fffaf3);
}

body #authView #authTermsModal .terms-text-slot h4 {
  margin: 26px 0 10px;
  padding: 0 0 7px;
  border-bottom: 1px solid rgba(127, 17, 17, 0.1);
  color: #8f1d23;
  font-size: 15px;
  line-height: 1.24;
  letter-spacing: 0.01em;
  text-transform: none;
}

body #authView #authTermsModal .terms-text-slot h4::before {
  content: none;
}

body #authView #authTermsModal .terms-text-slot h4:first-child {
  margin-top: 0;
}

body #authView #authTermsModal .terms-text-slot p,
body #authView #authTermsModal .terms-text-slot li {
  max-width: 86ch;
  color: #463a34;
  font-size: 14.5px;
  line-height: 1.72;
}

body #authView #authTermsModal .terms-text-slot p {
  margin: 0 0 13px;
}

body #authView #authTermsModal .terms-text-slot ul {
  max-width: 86ch;
  margin: 4px 0 16px;
  padding-left: 22px;
}

body #authView #authTermsModal .terms-consent-footer {
  min-height: 0;
  display: grid;
  gap: 12px;
}

body #authView #authTermsModal .auth-terms-check {
  align-items: center;
  max-height: none;
  overflow: visible;
  padding: 15px 16px;
  border-color: rgba(211, 47, 47, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
}

body #authView #authTermsModal .auth-terms-check span:last-child {
  color: #463a34;
  font-size: 14px;
  line-height: 1.48;
}

body #authView #authTermsModal .auth-terms-actions {
  justify-content: flex-end;
  margin: 0;
}

body #authView #authTermsModal .auth-terms-actions .primary {
  min-width: 240px;
}

@media (max-height: 760px) {
  body #authView #authTermsModal .auth-terms-dialog {
    height: auto;
    max-height: calc(100vh - 24px);
  }

  body #authView #authTermsModal .auth-terms-content {
    gap: 10px;
    padding: 16px;
  }

  body #authView #authTermsModal .auth-terms-topline {
    min-height: 54px;
    padding: 10px 14px;
  }

  body #authView #authTermsModal .auth-help-header h3 {
    font-size: clamp(26px, 4vw, 34px);
  }

  body #authView #authTermsModal .auth-help-header p {
    display: block;
    font-size: 14px;
    line-height: 1.35;
  }

  body #authView #authTermsModal .terms-text-slot {
    padding: 18px 20px 28px;
  }
}

@media (max-width: 720px) {
  body #authView #authTermsModal.lightbox {
    padding: 10px;
  }

  body #authView #authTermsModal .auth-terms-dialog {
    width: calc(100vw - 20px);
    height: auto;
    max-height: calc(100vh - 20px);
    border-radius: 20px;
  }

  body #authView #authTermsModal .auth-terms-content {
    grid-template-rows: auto auto auto auto;
    gap: 10px;
    padding: 12px;
  }

  body #authView #authTermsModal .auth-terms-topline {
    min-height: 52px;
  }

  body #authView #authTermsModal .auth-help-header h3 {
    font-size: 28px;
  }

  body #authView #authTermsModal .auth-help-header p {
    font-size: 13.5px;
  }

  body #authView #authTermsModal .terms-document-heading {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 14px;
  }

  body #authView #authTermsModal .terms-document-heading span {
    text-align: left;
  }

  body #authView #authTermsModal .terms-text-slot {
    padding: 16px 16px 28px;
  }

  body #authView #authTermsModal .auth-terms-check {
    grid-template-columns: 38px 1fr;
    padding: 13px;
  }

  body #authView #authTermsModal .auth-terms-actions .primary {
    width: 100%;
    min-width: 0;
  }
}

.phase-one-order-section {
  display: grid;
  gap: 14px;
}

.phase-one-order-section + .phase-one-order-section {
  margin-top: 24px;
}

.phase-one-order-heading {
  align-items: center;
  background: rgba(255, 248, 231, 0.94);
  border: 1px solid rgba(132, 90, 58, 0.18);
  border-radius: 18px;
  color: #3d2621;
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
}

/* G1 - Gestore Fase 1 compatta: dashboard, tracker dropdown e tab sticky. */
#adminView .admin-workflow-bar {
  margin-bottom: 4px;
}

#adminView .admin-section-divider {
  min-height: 8px;
  margin: 0;
  opacity: 0.55;
}

#adminView #adminClassTrackerSection {
  margin-top: 0;
  margin-bottom: 0;
}

#adminView #adminClassTrackerSection .toolbar {
  min-height: 0;
  padding-block: 2px;
}

#adminView #adminClassTrackerSection.is-collapsed {
  padding-bottom: 6px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

#adminView #adminClassTrackerSection.is-collapsed .toolbar + .toolbar {
  display: none;
}

#adminView .admin-class-card.is-readonly {
  cursor: default;
}

#adminView .admin-class-card.is-readonly:hover,
#adminView .admin-class-card.is-readonly:focus-visible {
  transform: none;
  box-shadow: none;
}

#adminView .admin-gallery-controlbar {
  gap: 8px;
  margin-top: 0;
  padding-bottom: 8px;
}

#adminView .admin-phase-one-tabs {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  margin: 0 -6px -2px;
  padding-top: 8px;
  border-top: 1px solid rgba(132, 90, 58, 0.18);
}

#adminView .admin-phase-one-tabs.hidden {
  display: none;
}

#adminView .admin-phase-one-metrics,
#adminView .admin-phase-one-order-tabs {
  display: flex;
  gap: 6px;
  align-items: stretch;
  min-width: 0;
}

#adminView .admin-phase-one-metrics {
  flex-wrap: wrap;
}

#adminView .admin-tab-metric,
#adminView .admin-phase-one-order-tabs button {
  min-height: 42px;
  border: 1px solid rgba(132, 90, 58, 0.2);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

#adminView .admin-tab-metric {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  color: #3d2621;
}

#adminView .admin-tab-metric small {
  color: #6d5c50;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#adminView .admin-tab-metric strong {
  min-width: 28px;
  color: #941419;
  font-size: 18px;
  line-height: 1;
  text-align: right;
}

#adminView .admin-phase-one-order-tabs {
  justify-content: flex-end;
}

#adminView .admin-phase-one-order-tabs button {
  padding: 8px 12px;
  color: #3d2621;
  font-weight: 900;
  box-shadow: none;
}

#adminView .admin-phase-one-order-tabs button.active {
  border-color: #d32f2f;
  background: linear-gradient(135deg, #d32f2f, #a8171b);
  color: #ffffff;
}

#adminView #adminProgressSummary.hidden {
  display: none;
}

@media (max-width: 1050px) {
  #adminView .admin-phase-one-tabs {
    grid-template-columns: 1fr;
  }

  #adminView .admin-phase-one-order-tabs {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  #adminView .admin-phase-one-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #adminView .admin-tab-metric {
    grid-template-columns: 1fr auto;
  }

  #adminView .admin-phase-one-order-tabs button {
    flex: 1;
  }
}

/* G2 - Gestore Fase 2: revisione plessi piu compatta e guidata. */
#adminView .admin-phase2-sticky-counters {
  top: 150px;
  z-index: 17;
  grid-template-columns: minmax(180px, 0.7fr) minmax(180px, 0.7fr);
  justify-content: end;
  margin: 0 -20px 6px;
  padding: 8px 18px;
  border-top: 0;
  border-right: 1px solid var(--admin-line);
  border-left-width: 4px;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 8px 18px rgba(33, 24, 16, 0.08);
}

#adminView .admin-phase2-sticky-item {
  min-height: 44px;
  padding: 8px 11px;
  border-radius: 14px;
}

#adminView .admin-phase2-sticky-action {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

#adminView .admin-phase2-sticky-action:hover {
  transform: translateY(-1px);
}

#adminView .admin-phase2-sticky-action strong {
  grid-row: span 2;
  align-self: center;
}

#adminView .admin-phase2-sticky-action small {
  color: var(--admin-red);
  font-size: 12px;
  font-weight: 900;
}

#adminView .admin-phase2-sticky-action::after {
  content: ">";
  align-self: center;
  color: var(--admin-red);
  font-family: var(--display-font);
  font-weight: 900;
}

#adminView .admin-phase2-sticky-action:focus-visible {
  outline: 3px solid rgba(255, 211, 35, 0.8);
  outline-offset: 2px;
}

#adminView .admin-phase2-sticky-action.is-complete small,
#adminView .admin-phase2-sticky-action.is-complete::after {
  color: var(--admin-green);
}

#adminView .admin-class-workbench.is-school-review {
  gap: 10px;
  padding: 14px;
}

#adminView .admin-class-workbench.is-school-review .admin-class-workbench-head {
  padding-bottom: 8px;
}

#adminView .admin-phase2-review-shell {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(320px, 1.15fr);
  gap: 10px;
  align-items: stretch;
}

#adminView .admin-phase2-review-card {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--admin-line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
}

#adminView .admin-phase2-review-card h4,
#adminView .admin-phase2-review-card p {
  margin: 0;
}

#adminView .admin-phase2-review-card h4 {
  color: var(--admin-ink);
  font-size: clamp(17px, 1.35vw, 22px);
  line-height: 1.08;
}

#adminView .admin-phase2-review-card p {
  font-size: 13px;
  line-height: 1.35;
}

#adminView .admin-phase2-review-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#adminView .admin-phase2-review-order {
  display: inline-flex;
  width: fit-content;
  padding: 5px 10px;
  border: 1px solid rgba(211, 47, 47, 0.2);
  border-radius: 999px;
  background: rgba(255, 211, 35, 0.18);
  color: var(--admin-red);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#adminView .admin-phase2-review-current {
  border-left: 4px solid var(--admin-red);
}

#adminView .admin-phase2-review-decision {
  border-left: 4px solid var(--admin-amber-line);
}

#adminView .admin-phase2-review-decision.is-ready {
  border-left-color: var(--admin-green-line);
  background: linear-gradient(180deg, #f2fbf6 0%, #ffffff 100%);
}

#adminView .admin-phase2-review-decision.needs-action {
  background: linear-gradient(180deg, #fff5f3 0%, #ffffff 100%);
}

#adminView .admin-phase2-requirement-line {
  display: flex;
  gap: 10px;
  align-items: center;
}

#adminView .admin-phase2-check {
  display: inline-grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(176, 31, 31, 0.24);
  border-radius: 14px;
  background: rgba(255, 211, 35, 0.18);
  color: var(--admin-red);
  font-family: var(--display-font);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

#adminView .admin-phase2-check.is-complete {
  border-color: rgba(47, 120, 104, 0.28);
  background: rgba(47, 120, 104, 0.12);
  color: var(--admin-green);
}

#adminView .admin-phase2-next-copy {
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.35;
}

#adminView .admin-phase2-review-shell .admin-workflow-actions {
  gap: 6px;
}

#adminView .admin-phase2-review-shell .admin-workflow-actions button {
  min-height: 36px;
  padding: 8px 11px;
}

#adminView .admin-class-workbench.is-other-review {
  border-left-color: #2a2860;
}

#adminView .admin-phase2-other-review-shell .admin-phase2-review-current {
  border-left-color: #2a2860;
}

#adminView .admin-phase2-other-review-panel {
  display: grid;
  gap: 14px;
}

#adminView .admin-phase2-other-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

#adminView .admin-phase2-other-group {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(42, 40, 96, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
}

#adminView .admin-phase2-other-group strong {
  color: var(--admin-ink);
  font-size: 16px;
}

#adminView .admin-phase2-other-group span,
#adminView .admin-phase2-other-group small {
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 1100px) {
  #adminView .admin-phase2-review-shell {
    grid-template-columns: 1fr 1fr;
  }

  #adminView .admin-phase2-review-decision {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (max-width: 720px) {
  #adminView .admin-phase2-sticky-counters,
  #adminView .admin-phase2-review-shell {
    grid-template-columns: 1fr;
  }

  #adminView .admin-phase2-sticky-counters {
    top: 132px;
    margin: 0 -16px 6px;
    padding-inline: 12px;
  }

  #adminView .admin-phase2-review-decision {
    grid-column: auto;
    order: initial;
  }
}

/* G3 - Gestore Fase 3: plancia personale e confronto guidato. */
#adminView .admin-phase-three-board {
  gap: 14px;
}

#adminView .admin-phase-three-head {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(132, 90, 58, 0.16);
}

#adminView .admin-phase-three-personal-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid rgba(211, 47, 47, 0.22);
  border-left: 6px solid var(--admin-red);
  border-radius: 22px;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 211, 35, 0.26), transparent 28%),
    linear-gradient(135deg, #fffdf8 0%, #ffffff 58%, #fff5f1 100%);
  box-shadow: 0 12px 28px rgba(52, 34, 24, 0.08);
}

#adminView .admin-phase-three-personal-copy {
  display: grid;
  gap: 8px;
  align-content: center;
}

#adminView .admin-phase-three-personal-copy h4 {
  margin: 0;
  color: var(--admin-ink);
  font-size: clamp(22px, 2vw, 32px);
  line-height: 1.02;
}

#adminView .admin-phase-three-personal-copy p {
  max-width: 72ch;
  margin: 0;
  line-height: 1.45;
}

#adminView .admin-phase-three-personal-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#adminView .admin-phase-three-personal-actions button {
  display: grid;
  gap: 8px;
  align-content: space-between;
  min-height: 116px;
  padding: 14px;
  border: 1px solid rgba(132, 90, 58, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--admin-ink);
  text-align: left;
  box-shadow: inset 0 -4px 0 rgba(255, 211, 35, 0.62);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

#adminView .admin-phase-three-personal-actions button:hover,
#adminView .admin-phase-three-personal-actions button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--admin-red);
  box-shadow:
    inset 0 -4px 0 var(--admin-red),
    0 10px 24px rgba(52, 34, 24, 0.12);
}

#adminView .admin-phase-three-personal-actions button span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#adminView .admin-phase-three-personal-actions button strong {
  color: var(--admin-red-ink);
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1;
}

#adminView .admin-phase-three-manager-row.is-self .admin-phase-three-manager-actions {
  justify-content: flex-start;
}

@media (max-width: 1100px) {
  #adminView .admin-phase-three-personal-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #adminView .admin-phase-three-personal-panel {
    padding: 14px;
    border-radius: 18px;
  }

  #adminView .admin-phase-three-personal-actions {
    grid-template-columns: 1fr;
  }

  #adminView .admin-phase-three-personal-actions button {
    min-height: 82px;
  }
}

/* G5 - Gestore impostazioni: pannello ordinato, backup separati e manutenzione chiara. */
#adminSettingsModal .app-settings-dialog {
  width: min(1040px, calc(100vw - 28px));
}

#adminSettingsModal .app-settings-dialog > .stack {
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#adminSettingsModal .settings-hero,
#adminSettingsModal .settings-toggle-grid,
#adminSettingsModal .settings-session-panel,
#adminSettingsModal .settings-backup-section,
#adminSettingsModal .settings-footer-actions {
  grid-column: 1 / -1;
}

#adminSettingsModal .settings-hero {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid rgba(211, 47, 47, 0.18);
  border-left: 6px solid var(--admin-red);
  border-radius: 22px;
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 211, 35, 0.22), transparent 30%),
    linear-gradient(135deg, #fffdf8 0%, #ffffff 58%, #fff4ef 100%);
}

#adminSettingsModal .settings-hero h3 {
  margin: 0;
  font-size: clamp(25px, 2.2vw, 36px);
  line-height: 1.02;
}

#adminSettingsModal .settings-hero p {
  max-width: 82ch;
  margin: 0;
}

#adminSettingsModal .settings-choice-card {
  min-height: 0;
  gap: 12px;
  padding: 15px;
  border-top-width: 0;
  border-left: 4px solid rgba(132, 90, 58, 0.28);
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
}

#adminSettingsModal .settings-choice-card h4,
#adminSettingsModal .settings-session-panel h4,
#adminSettingsModal .settings-backup-section h4 {
  margin: 2px 0 0;
}

#adminSettingsModal .settings-toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#adminSettingsModal .setting-toggle {
  min-height: 0;
  padding: 15px;
  border: 1px solid rgba(180, 123, 22, 0.28);
  border-left: 4px solid var(--admin-amber-line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

#adminSettingsModal .settings-session-panel {
  min-height: 0;
  padding: 15px;
  border-top-width: 0;
  border-left: 4px solid var(--admin-green-line);
  border-radius: 18px;
  background: linear-gradient(180deg, #f5fbf7 0%, #ffffff 100%);
}

#adminSettingsModal .settings-session-panel .developer-role-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#adminSettingsModal .settings-backup-section {
  min-height: 0;
  gap: 14px;
  padding: 16px;
  border-top-width: 0;
  border-left: 6px solid var(--admin-red);
  border-radius: 22px;
  background: linear-gradient(135deg, #fff7f7 0%, #ffffff 64%);
}

#adminSettingsModal .settings-backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#adminSettingsModal .settings-backup-actions button {
  min-height: 42px;
  padding-inline: 16px;
}

#adminSettingsModal .settings-backup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#adminSettingsModal .database-backup-panel {
  min-width: 0;
  padding: 14px;
  border-radius: 18px;
}

#adminSettingsModal .database-backup-panel-head {
  align-items: flex-start;
}

#adminSettingsModal .database-backup-panel-head strong {
  color: var(--admin-ink);
}

#adminSettingsModal .database-backup-panel p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

#adminSettingsModal .danger-maintenance-panel {
  border-radius: 18px;
  background:
    repeating-linear-gradient(135deg, rgba(211, 47, 47, 0.05) 0 8px, transparent 8px 16px),
    #fff6f5;
}

#adminSettingsModal .settings-footer-actions {
  margin-top: 2px;
  padding-top: 12px;
}

@media (max-width: 980px) {
  #adminSettingsModal .app-settings-dialog > .stack,
  #adminSettingsModal .settings-toggle-grid,
  #adminSettingsModal .settings-backup-grid {
    grid-template-columns: 1fr;
  }

  #adminSettingsModal .settings-session-panel .developer-role-grid {
    grid-template-columns: 1fr;
  }
}

/* G6 - Gestore comandi tastiera: guida rapida senza appesantire la dashboard. */
#adminKeyboardHelpModal .admin-keyboard-help-dialog {
  width: min(860px, calc(100vw - 28px));
}

#adminKeyboardHelpModal .admin-keyboard-help-hero {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid rgba(211, 47, 47, 0.18);
  border-left: 6px solid var(--admin-red);
  border-radius: 22px;
  background:
    radial-gradient(circle at 7% 10%, rgba(255, 211, 35, 0.28), transparent 32%),
    linear-gradient(135deg, #fffdf8 0%, #ffffff 58%, #fff2ed 100%);
}

#adminKeyboardHelpModal .admin-keyboard-help-hero h3 {
  margin: 0;
  font-size: clamp(26px, 2.4vw, 38px);
  line-height: 1.02;
}

#adminKeyboardHelpModal .admin-keyboard-help-hero p {
  max-width: 72ch;
  margin: 0;
}

#adminKeyboardHelpModal .admin-keyboard-help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#adminKeyboardHelpModal .admin-keyboard-shortcut-card {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 76px;
  padding: 13px;
  border: 1px solid rgba(132, 90, 58, 0.2);
  border-left: 4px solid var(--admin-amber-line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
  box-shadow: 0 10px 26px rgba(52, 34, 24, 0.08);
}

#adminKeyboardHelpModal .admin-keyboard-shortcut-card div {
  min-width: 0;
  flex: 1;
}

#adminKeyboardHelpModal .admin-keyboard-shortcut-card kbd {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(26, 25, 67, 0.24);
  border-bottom-width: 3px;
  border-radius: 10px;
  background: #ffffff;
  color: var(--admin-blue-ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 12px rgba(26, 25, 67, 0.08);
}

#adminKeyboardHelpModal .admin-keyboard-shortcut-card strong,
#adminKeyboardHelpModal .admin-keyboard-shortcut-card span {
  display: block;
}

#adminKeyboardHelpModal .admin-keyboard-shortcut-card strong {
  color: var(--admin-ink);
  line-height: 1.1;
}

#adminKeyboardHelpModal .admin-keyboard-shortcut-card span {
  margin-top: 3px;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 720px) {
  #adminKeyboardHelpModal .admin-keyboard-help-grid {
    grid-template-columns: 1fr;
  }

  #adminKeyboardHelpModal .admin-keyboard-shortcut-card {
    min-height: 0;
  }
}

/* Pulizia Fase 1 - barra workflow, dropdown e filtri senza gap intermedi. */
#adminView .admin-workflow-bar {
  margin-bottom: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

#adminView .admin-section-divider {
  min-height: 0;
  height: 0;
}

#adminView #adminClassTrackerSection {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

#adminView #adminClassTrackerSection.is-collapsed {
  margin-bottom: 0;
}

#adminView .admin-layout > .panel {
  margin-top: 0;
}

/* Logo ODV ufficiale: marchio orizzontale originale con sola aggiunta ODV. */
.shell {
  padding-top: 76px;
}

header.topbar,
body header.topbar {
  height: 76px;
  min-height: 76px;
  padding-block: 7px;
  overflow: visible;
}

header.topbar .brand-logo-wrap,
body header.topbar .brand-logo-wrap {
  width: 302px;
  min-width: 302px;
  height: 58px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

header.topbar .brand-logo,
body header.topbar .brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

body #adminView .admin-gallery-controlbar {
  top: 76px;
}

header.topbar .brand > div:last-child {
  display: none;
  grid-template-columns: auto;
  gap: 0;
}

header.topbar .brand p {
  display: none;
}

body #authView .auth-brand-panel img {
  width: min(270px, 78vw);
  height: auto;
  max-height: none;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  object-fit: contain;
  object-position: center;
}

@media (max-width: 720px) {
  .shell {
    padding-top: 66px;
  }

  header.topbar,
  body header.topbar {
    height: 66px;
    min-height: 66px;
    padding-block: 5px;
  }

  header.topbar .brand-logo-wrap,
  body header.topbar .brand-logo-wrap {
    width: 190px;
    min-width: 190px;
    height: 42px;
    padding: 0;
    border-radius: 0;
    overflow: visible;
  }

  body #adminView .admin-gallery-controlbar {
    top: 66px;
  }
}

/* Admin gapless review: compatta le stripe comuni senza modificare workflow o logiche. */
#adminView.view {
  gap: 0;
}

#adminView .admin-top-strip {
  margin: 0;
  border-radius: 0;
  border-right-width: 0;
  border-left-width: 0;
  border-bottom-width: 0;
}

#adminView .admin-top-actions {
  margin: 0;
}

#adminView .admin-top-copy {
  margin: 0;
  padding-bottom: 10px;
}

#adminView .admin-metrics-row {
  margin: 0;
  padding-bottom: 0;
}

#adminView .admin-workflow-bar {
  margin: 0;
  border-radius: 0;
  border-right-width: 0;
  border-left-width: 0;
  box-shadow: none;
}

#adminView .admin-section-divider,
#adminView .admin-section-divider-subtle,
#adminView #adminClassTrackerDivider {
  display: none;
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

#adminView #adminClassTrackerSection {
  margin: 0;
  padding: 14px 24px;
  border-radius: 0;
  border-right-width: 0;
  border-left-width: 0;
  border-top: 1px solid rgba(26, 25, 67, 0.12);
  border-bottom: 1px solid rgba(26, 25, 67, 0.12);
  box-shadow: none;
}

#adminView #adminClassTrackerSection .toolbar {
  margin: 0;
}

#adminView #adminClassTrackerSection.is-collapsed {
  padding-block: 12px;
}

#adminView .admin-layout {
  gap: 0;
  margin: 0;
}

#adminView .admin-layout > .panel {
  margin: 0;
  border-radius: 0;
  border-right-width: 0;
  border-left-width: 0;
  box-shadow: none;
}

#adminView .admin-gallery-controlbar {
  margin: 0;
  border-radius: 0;
  border-top: 0;
  border-right-width: 0;
  border-left-width: 0;
  box-shadow: none;
}

#adminView .admin-workbar {
  margin: 0;
}

#adminView .admin-class-workbench {
  margin-top: 0;
}

#adminView .admin-phase2-sticky-counters {
  margin: 0;
  border-radius: 0;
  border-right-width: 0;
  border-left-width: 0;
  box-shadow: none;
}

#adminView #adminPhase2GalleryBar {
  margin: 0;
  border-radius: 0;
}

#adminView .admin-phase-three-board {
  margin: 0;
  border-radius: 0;
  border-right-width: 0;
  border-left-width: 0;
  box-shadow: none;
}

@media (max-width: 720px) {
  #adminView #adminClassTrackerSection {
    padding-inline: 16px;
  }

  #adminView .admin-gallery-controlbar,
  #adminView .admin-phase2-sticky-counters {
    margin-inline: 0;
  }
}

/* Topbar gap correction: topbar stretta e stripe azioni senza spazio morto. */
.shell {
  padding-top: 56px;
}

header.topbar,
body header.topbar {
  height: 56px;
  min-height: 56px;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

header.topbar .brand,
body header.topbar .brand {
  align-self: center;
  align-content: center;
}

header.topbar .brand-logo-wrap,
body header.topbar .brand-logo-wrap {
  width: 250px;
  min-width: 250px;
  height: 50px;
  align-self: center;
}

header.topbar .brand-logo,
body header.topbar .brand-logo {
  object-position: left center;
}

#adminView .admin-top-strip {
  padding-top: 0 !important;
}

#adminView .admin-top-actions {
  padding-top: 0 !important;
}

body #adminView .admin-gallery-controlbar,
#adminView .admin-phase2-sticky-counters {
  top: 56px;
}

@media (max-width: 720px) {
  .shell {
    padding-top: 52px;
  }

  header.topbar,
  body header.topbar {
    height: 52px;
    min-height: 52px;
    padding-top: 0;
    padding-bottom: 0;
  }

  header.topbar .brand-logo-wrap,
  body header.topbar .brand-logo-wrap {
    width: 168px;
    min-width: 168px;
    height: 36px;
  }

  #adminView .admin-top-strip {
    padding-top: 0 !important;
  }

  body #adminView .admin-gallery-controlbar,
  #adminView .admin-phase2-sticky-counters {
    top: 52px;
  }
}

/* Topbar original-size restore: ripristina altezza sticky originale senza toccare il logo. */
body .shell {
  padding-top: 92px;
}

header.topbar,
body header.topbar {
  height: 92px;
  min-height: 92px;
  align-items: center;
  padding-top: 7px;
  padding-bottom: 7px;
}

body #adminView .admin-gallery-controlbar,
#adminView .admin-phase2-sticky-counters {
  top: 92px;
}

@media (max-width: 720px) {
  body .shell {
    padding-top: 66px;
  }

  header.topbar,
  body header.topbar {
    height: 66px;
    min-height: 66px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  body #adminView .admin-gallery-controlbar,
  #adminView .admin-phase2-sticky-counters {
    top: 66px;
  }
}

/* Privacy modal detached from #authView: final override must target the real DOM position. */
/* La barra dei contatori si appoggia sotto i filtri sticky; l'offset e' calcolato in JS. */
#adminView .admin-phase2-sticky-counters {
  z-index: 21;
  overflow: visible;
}

#adminView .admin-phase2-other-group {
  display: grid;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

#adminView .admin-phase2-other-group.is-active {
  border-color: #b63b34;
  background: #fff4ef;
}

#adminView .admin-phase2-other-picker {
  border-top: 1px solid var(--admin-line);
  padding-top: 12px;
}

#adminView .admin-phase2-other-picker summary {
  width: fit-content;
  cursor: pointer;
  color: var(--admin-red);
  font-weight: 700;
}

#adminView .admin-phase2-other-picker .admin-phase2-other-groups {
  margin-top: 12px;
}

#adminView .admin-phase2-other-absolute {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid #e8c9b8;
  background: #fff9f2;
}

/* Privacy modal detached from #authView: final override must target the real DOM position. */
body #authTermsModal.lightbox {
  align-items: center !important;
  padding: 18px !important;
  overflow: hidden !important;
}

body #authTermsModal .auth-terms-dialog {
  width: min(960px, calc(100vw - 40px)) !important;
  height: auto !important;
  max-height: calc(100vh - 40px) !important;
  margin: 0 auto !important;
  overflow: hidden !important;
  border: 1px solid rgba(127, 17, 17, 0.16) !important;
  border-radius: 26px !important;
  background: #fffaf0 !important;
  box-shadow: 0 28px 86px rgba(39, 18, 14, 0.34) !important;
}

body #authTermsModal .auth-terms-shell {
  max-height: calc(100vh - 40px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  border-radius: inherit !important;
  scrollbar-color: #c9272d #f8ead6 !important;
  scrollbar-gutter: stable !important;
}

body #authTermsModal .auth-terms-shell::-webkit-scrollbar {
  width: 12px !important;
}

body #authTermsModal .auth-terms-shell::-webkit-scrollbar-track {
  margin: 18px 0 !important;
  border-radius: 999px !important;
  background: #f8ead6 !important;
}

body #authTermsModal .auth-terms-shell::-webkit-scrollbar-thumb {
  border: 3px solid #f8ead6 !important;
  border-radius: 999px !important;
  background: #c9272d !important;
}

body #authTermsModal .auth-terms-shell::-webkit-scrollbar-button {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

body #authTermsModal .auth-terms-shell,
body #authTermsModal .auth-terms-content {
  height: auto !important;
  min-height: 0 !important;
  border-radius: inherit !important;
}

body #authTermsModal .auth-terms-content {
  display: grid !important;
  grid-template-rows: auto auto auto auto !important;
  gap: 14px !important;
  padding: clamp(18px, 3vw, 28px) !important;
  overflow: visible !important;
}

body #authTermsModal .auth-terms-copy {
  height: auto !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: auto auto !important;
  overflow: visible !important;
  border-radius: 18px !important;
  background: #fffefb !important;
}

body #authTermsModal .terms-text-slot {
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 22px 24px 34px !important;
  background:
    linear-gradient(90deg, rgba(255, 211, 31, 0.13) 0 4px, transparent 4px),
    linear-gradient(180deg, #fffefb, #fffaf3) !important;
}

body #authTermsModal .auth-terms-check {
  width: 100% !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  display: grid !important;
  grid-template-columns: 38px 1fr !important;
  gap: 14px !important;
  align-items: center !important;
  padding: 15px 16px !important;
  border: 1px solid rgba(211, 47, 47, 0.18) !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #463a34 !important;
  font: inherit !important;
  text-align: left !important;
  cursor: pointer !important;
  max-height: none !important;
  overflow: visible !important;
}

body #authTermsModal .auth-terms-check:focus-visible {
  outline: 3px solid rgba(255, 211, 31, 0.62) !important;
  outline-offset: 3px !important;
}

body #authTermsModal .auth-terms-check input {
  pointer-events: none !important;
}

body #authTermsModal .auth-terms-check[aria-pressed="true"] {
  border-color: rgba(37, 133, 78, 0.34) !important;
  background: linear-gradient(135deg, rgba(240, 255, 247, 0.98), rgba(255, 255, 255, 0.96)) !important;
}

body #authTermsModal .auth-terms-check[aria-pressed="true"] .auth-terms-checkmark {
  border-color: #1f8f56 !important;
  background: #1f8f56 !important;
  box-shadow: 0 10px 24px rgba(31, 143, 86, 0.24) !important;
}

body #authTermsModal .auth-terms-check[aria-pressed="true"] .auth-terms-checkmark::after {
  display: block !important;
}

/* External full-width and responsive hardening. */
body:has(#externalView.active) {
  overflow-x: hidden;
}

body:has(#externalView.active) .shell {
  width: 100%;
  padding-top: 92px;
}

body:has(#externalView.active) .topbar {
  margin-bottom: 0;
}

body:has(#externalView.active) header.topbar::after {
  bottom: 0;
}

body:has(#externalView.active) .page,
body .page:has(#externalView.active) {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 40px;
  background: #f3f0ea;
}

body #externalView.view.active,
body #externalView.view {
  width: 100%;
  max-width: none;
  gap: 18px;
}

body #externalView .section-head,
body #externalView #externalSchoolFlow,
body #externalView #externalOtherFlow {
  width: 100%;
  max-width: none;
}

body #externalView #externalSchoolFlow {
  display: grid;
  gap: 18px;
}

body #externalView .external-other-placeholder {
  padding: 0 0 72px;
}

body #externalView .external-other-card {
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: 12px;
}

body #externalView .external-layout {
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
}

body #externalView .external-main,
body #externalView .external-sidebar,
body #externalView .external-other-card,
body #externalView .external-other-form,
body #externalView .external-other-upload-panel {
  min-width: 0;
}

body #externalView .external-other-form .form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body #externalView .external-other-upload-panel .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

body #externalParticipantModal .external-participant-dialog {
  overflow: hidden;
  border-radius: 30px;
}

@media (max-width: 1180px) {
  body #externalView .external-layout {
    grid-template-columns: 1fr;
  }

  body #externalView .external-sidebar {
    position: static;
  }
}

@media (max-width: 820px) {
  body:has(#externalView.active) .page,
  body .page:has(#externalView.active) {
    padding-top: 0;
  }

  body #externalView .section-head {
    border-radius: 0;
  }

  body #externalView .external-other-card {
    padding: 18px;
    border-radius: 0;
  }

  body #externalView .external-other-form .form-grid.two,
  body #externalView .external-other-email-row,
  body #externalView .external-other-upload-panel .toolbar {
    grid-template-columns: 1fr;
  }

  body #externalView .external-other-upload-panel .toolbar {
    display: grid;
    align-items: stretch;
  }

  body #externalView .external-other-upload-panel .toolbar .primary {
    width: 100%;
  }
}

@media (max-width: 720px) {
  body:has(#externalView.active) .shell {
    padding-top: 66px;
  }

  body:has(#externalView.active) .page,
  body .page:has(#externalView.active) {
    padding-bottom: 98px;
  }

  body #externalParticipantModal .external-participant-dialog {
    border-radius: 24px;
  }

  body #externalView .section-head {
    padding: 16px;
  }

  body #externalView .external-main,
  body #externalView .external-sidebar,
  body #externalView .class-card,
  body #externalView .external-other-form,
  body #externalView .external-other-upload-panel,
  body #externalView .external-other-contact {
    border-radius: 0;
  }

  body #externalView .external-other-card h3 {
    font-size: clamp(26px, 9vw, 34px);
    line-height: 1.02;
  }

  body #externalView .external-other-card p {
    max-width: none;
    font-size: 15px;
  }
}

@media (max-width: 720px) {
  body #authTermsModal.lightbox {
    padding: 10px !important;
  }

  body #authTermsModal .auth-terms-dialog {
    width: calc(100vw - 20px) !important;
    height: auto !important;
    max-height: calc(100vh - 20px) !important;
    border-radius: 20px !important;
  }

  body #authTermsModal .auth-terms-shell {
    max-height: calc(100vh - 20px) !important;
  }

  body #authTermsModal .auth-terms-content {
    grid-template-rows: auto auto auto auto !important;
    gap: 10px !important;
    padding: 12px !important;
  }
}

/* La guida OTP vive fuori da #authView: questi selettori raggiungono la modale reale. */
body #authHelpModal.lightbox {
  overflow-y: auto;
}

body #authHelpModal .auth-help-dialog {
  width: min(690px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  margin: max(20px, 5vh) auto;
  padding: 24px;
  overflow-y: auto;
  border: 1px solid rgba(127, 17, 17, 0.16);
  border-radius: 26px;
  background: linear-gradient(155deg, #ffffff 0%, #fff9ed 100%);
  box-shadow: 0 28px 86px rgba(39, 18, 14, 0.34);
}

body #authHelpModal .auth-help-dialog > .stack {
  gap: 20px;
}

body #authHelpModal .auth-help-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 4px solid #ffd328;
  border-radius: 17px;
  background: linear-gradient(120deg, #c91f24, #971a1e);
  color: #fff;
}

body #authHelpModal .auth-help-brand strong {
  font-size: 17px;
}

body #authHelpModal .auth-help-brand span {
  font-size: 13px;
  font-weight: 700;
  color: #fff0a9;
}

body #authHelpModal .auth-help-header {
  display: grid;
  gap: 8px;
}

body #authHelpModal .auth-help-header .eyebrow {
  color: #901c22;
  font-size: 12px;
  font-weight: 800;
}

body #authHelpModal .auth-help-header h3 {
  margin: 0;
  color: #2f1813;
  font-size: clamp(30px, 5vw, 43px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

body #authHelpModal .auth-help-header p {
  margin: 0;
  color: #6f5b4f;
  font-size: 16px;
  line-height: 1.5;
}

body #authHelpModal .auth-help-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body #authHelpModal .auth-help-steps li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 15px;
  border: 1px solid #ead9cb;
  border-radius: 16px;
  background: #fffdf8;
}

body #authHelpModal .auth-help-steps li > span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #c91f24;
  color: #fff;
  font-weight: 800;
}

body #authHelpModal .auth-help-steps li > div {
  display: grid;
  gap: 3px;
}

body #authHelpModal .auth-help-steps strong {
  color: #2f1813;
  font-size: 16px;
}

body #authHelpModal .auth-help-steps small {
  color: #69594f;
  font-size: 14px;
  line-height: 1.45;
}

body #authHelpModal .auth-help-note {
  margin: 0;
  padding: 14px 17px;
  border-left: 4px solid #ffd328;
  border-radius: 12px;
  background: #fff2d8;
  color: #514239;
  line-height: 1.5;
}

body #authHelpModal #closeAuthHelpButton {
  justify-self: end;
  min-width: 160px;
  border: 0;
  border-radius: 999px;
  background: #c91f24;
  color: #fff;
  font-weight: 800;
}

body #externalView .external-other-confirm {
  align-items: flex-start;
  cursor: pointer;
}

body #externalView .external-other-confirm input[type="checkbox"] {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  border-radius: 5px;
  accent-color: #218752;
  appearance: auto;
}

body #externalView .external-other-confirm span {
  align-self: center;
  font-size: 14px;
  line-height: 1.45;
}

body #externalView .external-other-saved-notice {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 49;
  max-width: min(380px, calc(100vw - 32px));
  padding: 15px 19px;
  border-left: 5px solid #ffd328;
  border-radius: 14px;
  background: #245a3f;
  box-shadow: 0 18px 38px rgba(26, 47, 34, 0.25);
  color: #fff;
  font-weight: 700;
  line-height: 1.4;
}

body #externalView #externalOtherFormStatus:empty {
  display: none;
}

body #externalView #externalOtherFormStatus:not(:empty) {
  padding: 12px 15px;
  border-radius: 12px;
  background: #f0faf3;
  font-weight: 700;
  line-height: 1.45;
}

body #externalView #externalOtherFormStatus.error {
  background: #fff0ed;
}

body #externalView input:focus,
body #externalView select:focus,
body #externalView .school-picker-trigger:focus-visible {
  border-color: #c91f24;
  box-shadow: 0 0 0 2px rgba(201, 31, 36, 0.15);
}

body #externalView .upload-dropzone:hover,
body #externalView .upload-dropzone.dragover {
  border-color: #c91f24;
  background: #fff7f3;
  box-shadow: none;
}

body #externalView input.upload-hidden-input {
  display: block;
  width: 1px;
  height: 1px;
  min-height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
}

body #externalView .file-choose-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid #c91f24;
  border-radius: 12px;
  background: #fff;
  color: #8f1d23;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  cursor: pointer;
}

body #externalView .file-choose-button:hover,
body #externalView .file-choose-button:focus-visible {
  outline: 0;
  border-color: #8f1d23;
  background: #fff0ec;
  box-shadow: 0 0 0 2px rgba(201, 31, 36, 0.13);
}

body #externalView .file-choose-button[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

body #externalView input.upload-hidden-input:focus-visible + .upload-dropzone {
  border-color: #c91f24;
  box-shadow: 0 0 0 2px rgba(201, 31, 36, 0.13);
}

body #submitExternalModal .developer-dialog {
  width: min(620px, calc(100vw - 32px));
  border-radius: 22px;
  border-top-color: #ffd328;
}

body #submitExternalModal .external-guidance-card {
  display: grid;
  gap: 6px;
  padding: 14px 17px;
  border-left: 4px solid #c91f24;
  border-radius: 12px;
  background: #fff5e8;
  color: #4b3830;
  line-height: 1.45;
}

body #submitExternalModal .external-guidance-card strong {
  color: #8c1e24;
}

@media (max-width: 720px) {
  body #authHelpModal .auth-help-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    margin: 10px auto;
    padding: 15px;
    border-radius: 20px;
  }

  body #authHelpModal .auth-help-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  body #externalView .external-other-saved-notice {
    right: 12px;
    bottom: 80px;
    left: 12px;
    max-width: none;
  }

  body #externalView .file-choose-button {
    width: 100%;
  }

  body #externalView .external-other-form .actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  body #externalView .external-other-email-row .compact-icon-button {
    width: 100%;
  }
}

/* Il richiamo alla masonry della Fase 2 deve restare riconoscibile anche da chiusa. */
body #adminView .admin-phase2-gallery-bar {
  padding: 0;
  border-top: 0;
}

body #adminView .admin-phase2-gallery-bar .admin-collapse-toggle {
  width: 100%;
  min-height: 58px;
  gap: 12px;
  padding: 12px 18px;
  border: 1px solid #ae2629;
  border-left: 6px solid #ffd328;
  border-radius: 14px;
  background: linear-gradient(105deg, #c91f24, #a91e23);
  color: #fff;
  font-size: clamp(14px, 1.1vw, 17px);
  font-weight: 800;
  line-height: 1.3;
  text-align: left;
  box-shadow: 0 8px 20px rgba(128, 25, 24, 0.14);
}

body #adminView .admin-phase2-gallery-bar .admin-collapse-toggle[aria-expanded="true"] {
  border-color: #d7ba9e;
  border-left-color: #c91f24;
  background: linear-gradient(105deg, #fff7eb, #ffffff);
  color: #822126;
  box-shadow: none;
}

body #adminView .admin-phase2-gallery-bar .admin-collapse-toggle:hover {
  filter: brightness(1.06);
  box-shadow: 0 10px 24px rgba(128, 25, 24, 0.2);
}

body #adminView .admin-phase2-gallery-bar .admin-collapse-toggle:focus-visible {
  outline: 3px solid #ffd328;
  outline-offset: 2px;
}
