:root {
  --ink: #ece5d3;         /* testo principale, avorio caldo */
  --muted: #8a8fa3;       /* testo secondario, grigio-blu */
  --bg: #14161d;          /* fondo notte */
  --card: #1b1e28;        /* superfici in rilievo */
  --field: #14161d;       /* fondo dei campi input */
  --line: #262a36;        /* bordi delle superfici */
  --line2: #33363f;       /* bordi di foto e campi */
  --gold: #c9a35c;        /* accento oro caldo */
  --gold-dim: #4a4432;    /* oro spento, per bordi discreti */
  --gold-glow: rgba(201,163,92,.14);
  --ok: #9dc18f;
  --ok-line: #5c7a52;
  --warn: #d8b878;
  --warn-bg: #2a2415;
  --danger: #d08d7c;
  --danger-line: #7a4437;
  --shadow: 0 10px 26px rgba(0,0,0,.4);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(201,163,92,.06), transparent 40%),
    #14161d;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); }

/* Login */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.auth-card {
  width: 100%;
  max-width: 410px;
  padding: 36px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 0 60px var(--gold-glow);
}
.brand { text-align: center; margin-bottom: 6px; }
.brand .logo {
  color: var(--gold);
  font-size: 26px;
  line-height: 1;
  letter-spacing: 2px;
}
.brand .logo span { color: rgba(201,163,92,.55); margin-left: 4px; }
.brand .tag { color: var(--muted); font-size: 13px; font-style: italic; margin-top: 7px; }
.auth-card h1 { font-size: 20px; font-weight: normal; text-align: center; margin: 24px 0 4px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13.5px; font-style: italic; margin-bottom: 18px; }

/* Forms */
label {
  display: block;
  font-family: Verdana, sans-serif;
  font-size: .72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 15px 0 6px;
}
input, textarea, select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line2);
  border-radius: 4px;
  font: inherit;
  background: var(--field);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: 1px solid var(--gold);
  border-color: var(--gold);
}
textarea { resize: vertical; min-height: 84px; }
.row2 { display: flex; gap: 12px; }
.row2 > * { flex: 1; min-width: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--gold);
  border-radius: 3px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn.block { width: 100%; }
.btn-primary { background: var(--gold); color: #14161d; }
.btn-primary:active { transform: translateY(1px); }
.btn-soft { background: transparent; color: var(--muted); border-color: var(--line2); }
.btn-ghost { background: transparent; border-color: var(--gold-dim); color: var(--gold); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.btn-ok { background: transparent; color: var(--ok); border-color: var(--ok-line); }
.btn-sm { padding: 8px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }

/* Shell */
.topbar {
  min-height: 62px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(27,30,40,.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.topbar .logo {
  color: var(--gold);
  font-size: 21px;
  line-height: 1;
  letter-spacing: 2px;
}
.topbar .logo span { color: rgba(201,163,92,.55); margin-left: 4px; }
.topbar .who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.topbar .who .role { font-size: 13px; color: var(--muted); font-style: italic; }
.container { max-width: 980px; margin: 0 auto; padding: 22px 18px 60px; }
.container.narrow { max-width: 640px; }

.dash-hero {
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 95% 0%, rgba(201,163,92,.08), transparent 45%),
    var(--card);
}
.dash-hero .eyebrow {
  color: var(--gold);
  font-family: Verdana, sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.dash-hero h1 {
  margin-top: 8px;
  color: var(--ink);
  font-size: 28px;
  font-weight: normal;
  line-height: 1.15;
}
.dash-hero p:last-child {
  margin-top: 8px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 18px;
}
.paper-card { position: relative; }
.card h2 {
  color: var(--gold);
  font-size: 21px;
  font-weight: normal;
  line-height: 1.15;
  margin-bottom: 4px;
}
.card .hint { color: var(--muted); font-size: 13px; font-style: italic; margin-bottom: 14px; line-height: 1.5; }
.section-title {
  font-family: Verdana, sans-serif;
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 8px 0 12px;
}

/* Badges, stats, tables */
.badge { display: inline-flex; align-items: center; gap: 5px; font-family: Verdana, sans-serif; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #4a3d20; }
.badge.ok { background: #1c261c; color: var(--ok); border: 1px solid #34462f; }
.badge.muted { background: transparent; color: var(--muted); border: 1px solid var(--line2); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { font-family: Verdana, sans-serif; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.totals { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 16px;
}
.stat .k { font-family: Verdana, sans-serif; font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.stat .v { font-size: 22px; color: var(--gold); font-variant-numeric: tabular-nums; }

/* Board tiles */
.board-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
.board-tile {
  padding: 8px 8px 14px;
  background: #171a22;
  border: 1px solid var(--line2);
}
.board-tile .thumb {
  aspect-ratio: 9 / 16;
  background: linear-gradient(165deg, #3d3a33, #23211c 55%, #191712);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line2);
}
.board-tile .meta { padding: 12px 6px 0; }
.board-tile .meta strong {
  display: block;
  font-size: 18px;
  font-weight: normal;
  color: var(--ink);
}
.board-tile .meta span { display: block; color: var(--muted); font-size: 12.5px; font-style: italic; margin-top: 3px; }
.board-tile .meta .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Manager media */
.manager-card > div:first-child {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.mtile {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  padding: 4px 4px 16px;
  background: #171a22;
  border: 1px solid var(--line2);
}
.mtile img, .mtile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mtile .ov {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
  background: linear-gradient(0deg, rgba(16,18,26,.97), rgba(16,18,26,.78));
}
.mtile .ov .btn { padding: 6px; font-size: 11.5px; }
.hero-hint {
  background: var(--warn-bg);
  border: 1px solid #4a3d20;
  color: var(--warn);
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 13px;
  font-style: italic;
  line-height: 1.55;
  margin-bottom: 12px;
}
.mtile .play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 24px;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
  pointer-events: none;
}

/* Comments */
.crow { display: flex; gap: 10px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: none; }
.crow .ava {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: none;
  background: transparent;
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-family: Verdana, sans-serif;
  font-size: 14px;
  font-weight: 700;
}
.crow .body { flex: 1; }
.crow .who { color: var(--gold); font-size: 14.5px; }
.crow .when { color: var(--muted); font-size: 12px; font-style: italic; margin-left: 6px; }
.crow .text { margin-top: 4px; color: #cfc9b8; line-height: 1.6; white-space: pre-wrap; }
.crow .acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.empty { color: var(--muted); text-align: center; padding: 26px 10px; line-height: 1.6; font-style: italic; }
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  margin-bottom: 18px;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  padding: 10px 6px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}
.tab.on { background: var(--gold); color: #14161d; }
.tab .badge { margin-left: 6px; }
.tab.on .badge { background: #14161d; color: var(--gold); border-color: transparent; }
.panel[hidden] { display: none; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5,6,10,.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 18px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 16px 50px rgba(0,0,0,.5);
  max-height: 92vh;
  overflow: auto;
}
.modal h3 { margin-bottom: 8px; color: var(--gold); font-size: 20px; font-weight: normal; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.crop-viewport {
  position: relative;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 9 / 16;
  margin: 14px auto 0;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--gold);
  background: var(--bg);
  cursor: grab;
  touch-action: none;
}
.crop-viewport.dragging { cursor: grabbing; }
.crop-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
#crop-zoom { width: 100%; margin-top: 6px; accent-color: var(--gold); }
.qr-box { text-align: center; }
.qr-box img { width: 220px; height: 220px; border: 1px solid var(--gold-dim); border-radius: 4px; padding: 8px; background: #fff; }
.muted { color: var(--muted); font-size: 13px; font-style: italic; }
.creds { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 12px 14px; margin-top: 12px; font-size: 14px; word-break: break-all; }
.creds b { color: var(--gold); font-weight: normal; }
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--gold-dim);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity .2s;
  z-index: 80;
  pointer-events: none;
  font-size: 14px;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; }

@media (max-width: 700px) {
  .topbar { align-items: flex-start; }
  .topbar .who { gap: 7px; }
  .topbar .who .role { width: 100%; text-align: right; }
  .row2 { flex-direction: column; gap: 0; }
  .container { padding: 16px 12px 48px; }
  .card { padding: 18px; }
  .dash-hero { padding: 20px; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
}
