.admin {
  background: var(--bg);
}

.admin h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.admin h2 {
  font-size: 1.35rem;
}

.admin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 14px 22px;
  background: var(--ink);
  color: #fff;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.admin-brand img {
  border-radius: 10px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-nav a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
}

.admin-nav a.is-active,
.admin-nav a:hover {
  background: var(--yellow);
  color: var(--ink);
}

.admin-nav a {
  position: relative;
}

.nav-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 6px;
  border-radius: 50%;
  background: #e11d2e;
  box-shadow: 0 0 0 2px rgba(225, 29, 46, 0.2);
  vertical-align: middle;
}

.admin-nav a.is-active .nav-dot,
.admin-nav a:hover .nav-dot {
  box-shadow: 0 0 0 2px rgba(12, 12, 14, 0.12);
}

.link-panel {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f6f6f4;
  border: 1px solid var(--line);
}

.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.md-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.md-opts label {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.md-input {
  min-height: 140px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.45;
}

.admin-toast {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 12, 14, 0.45);
}

.admin-toast-card {
  width: min(440px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.admin-toast-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.admin-toast-card p {
  margin: 0;
  color: var(--muted);
}

.admin-toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.admin-main {
  width: min(1180px, calc(100% - 28px));
  margin: 28px auto 72px;
}

.admin-warn {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 650;
}

.admin-warn a {
  font-weight: 800;
}

.admin-head,
.editor-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.admin-head p,
.hint {
  color: var(--muted);
  max-width: 62ch;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.admin-row strong {
  display: block;
}

.admin-row span,
.admin-row small {
  color: var(--muted);
  font-size: 0.92rem;
}

.composer {
  display: grid;
  gap: 22px;
}

@media (min-width: 980px) {
  .composer {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
    align-items: start;
  }

  .composer-preview {
    position: sticky;
    top: 16px;
  }
}

.panel-card,
.block,
.composer-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.fields {
  display: grid;
  gap: 12px;
}

.fields label,
.block label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin input:not([type]),
.admin input[type="text"],
.admin input[type="password"],
.admin input[type="url"],
.admin input[type="email"],
.admin input[type="tel"],
.admin input[type="number"],
.admin input[type="datetime-local"],
.admin input[type="date"],
.admin select,
.admin textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  border-radius: 12px;
  padding: 11px 12px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.admin textarea {
  min-height: 110px;
  resize: vertical;
}

.admin input:focus,
.admin select:focus,
.admin textarea:focus {
  outline: 3px solid var(--yellow);
  border-color: transparent;
}

.check {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: var(--text) !important;
}

.block {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.addbar-label {
  margin: 18px 0 8px;
  font-size: 0.95rem;
  font-weight: 800;
}

.block-tools,
.addbar,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.block-tools {
  justify-content: space-between;
  align-items: center;
}

.block-tools strong {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mini,
.danger {
  border: 0;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
}

.danger {
  background: transparent;
  color: #9a2430;
}

.thumb {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 14px;
}

.gallery-edit {
  display: grid;
  gap: 8px;
}

.gallery-edit .shot {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.gallery-edit img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
}

.status {
  min-height: 1.4em;
  font-weight: 700;
}

.status.is-bad {
  color: #9a2430;
}

.token {
  display: block;
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--yellow);
  word-break: break-all;
  font-family: ui-monospace, monospace;
  font-size: 0.92rem;
}

.api-help {
  margin: 0 0 28px;
}

.api-help h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.api-help-steps {
  margin: 12px 0 0;
  padding-left: 1.25rem;
  color: var(--muted);
  max-width: 72ch;
  display: grid;
  gap: 6px;
}

.api-help-steps li::marker {
  color: var(--ink);
  font-weight: 700;
}

.api-sample {
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: #111827;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre;
}

.dash-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin: 18px 0 28px;
}

.dash-grid a {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  text-decoration: none;
}

.dash-grid strong {
  font-size: 1.8rem;
}

.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.gate main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.gate-card label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.gate-card input[type="text"],
.gate-card input[type="password"] {
  height: 48px;
}

.upload-note {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(12, 12, 14, 0.3);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.upload-note.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.gate-fields {
  display: grid;
  gap: 14px;
}

.gate-fields[hidden] {
  display: none;
}

.gate-alt {
  justify-self: center;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.gate-alt:hover,
.gate-alt:focus-visible {
  color: var(--text);
}

.google-slot {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  opacity: 0.6;
}

.group-block {
  margin-top: 28px;
}

.group-block h2 {
  margin-bottom: 12px;
}

.cal-form {
  margin-top: 18px;
}

@media (max-width: 720px) {
  .admin-row,
  .gallery-edit .shot {
    grid-template-columns: 1fr;
    display: grid;
  }
}

/* Archivio riservato: file explorer */
.admin input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  border-radius: 12px;
  padding: 10px 12px;
}

.fx-upload {
  cursor: pointer;
}

.fx {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: outline-color 0.15s;
  outline: 3px solid transparent;
}

.fx.is-over {
  outline-color: var(--yellow);
}

.fx-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 2px 4px 12px;
}

.fx-bar input[type="search"] {
  width: min(280px, 100%);
}

.fx-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.fx-crumbs button {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.fx-crumbs button:hover,
.fx-crumbs button.is-target {
  background: var(--yellow);
  color: var(--ink);
}

.fx-crumbs span {
  color: var(--muted);
}

.fx-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 110px auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
}

.fx-row + .fx-row {
  border-top-color: var(--line);
  border-radius: 0 0 14px 14px;
}

.fx-row:hover {
  background: var(--bg);
}

.fx-row.is-target {
  background: rgba(255, 224, 0, 0.35);
  border-color: var(--yellow);
}

.fx-name {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 4px 0;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.fx-name > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fx-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
}

.is-folder .fx-ico {
  background: var(--yellow);
}

.fx-where {
  display: block;
  font-weight: 500;
  color: var(--muted);
}

.fx-meta,
.fx-date {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.fx-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.fx-actions a.mini {
  text-decoration: none;
}

.fx-empty,
.fx-hint {
  margin: 0;
  padding: 18px 10px;
  color: var(--muted);
  text-align: center;
}

.fx-hint {
  font-size: 0.88rem;
  padding-bottom: 6px;
}

.mini.fx-danger {
  background: #9a2430;
}

@media (max-width: 760px) {
  .fx-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .fx-date {
    display: none;
  }

  .fx-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}