:root {
  /* palette del template HONG KONG PROJECT: nero editoriale, pannelli #080808, bordi sottili, accento avorio */
  --bg: #050505;
  --panel: #080808;
  --panel-2: #111111;
  --text: #f3f1ed;
  --muted: #8f8c86;
  --accent: #eeeae2;
  --accent-2: #d9d5ce;
  --ok: #8fd19e;
  --danger: #e07a73;
  --line: #262626;
  --free: rgba(238, 234, 226, 0.14);
  --free-stroke: rgba(238, 234, 226, 0.75);
  --sel: rgba(143, 209, 158, 0.35);
  --taken: rgba(120, 120, 120, 0.45);
  --season: #c9a24a;
  --season-fill: rgba(201, 162, 74, 0.35);
  --radius: 2px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 Arial, Helvetica, sans-serif; }
html { scroll-behavior: smooth; }
a { color: var(--accent); text-decoration: none; }
.container { max-width: 1500px; margin: 0 auto; padding: 20px 22px 80px; }

.grid { display: grid; grid-template-columns: minmax(280px, 460px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .24em; color: var(--muted); margin: 22px 0 10px; font-weight: 500; }
h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; }
label { display: block; margin: 8px 0; font-size: 13px; color: var(--muted); }
input, select, textarea { width: 100%; margin-top: 4px; padding: 9px 10px; background: var(--panel-2); border: 1px solid #2a2a2a; border-radius: var(--radius); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
button { font: inherit; cursor: pointer; border-radius: 999px; border: 1px solid #3a3a3a; background: transparent; color: var(--text); padding: 9px 14px; font-size: 12px; letter-spacing: .06em; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #050505; font-weight: 700; border: 1px solid var(--accent); width: 100%; padding: 13px; margin-top: 12px; letter-spacing: .12em; text-transform: uppercase; font-size: 11px; }
button.primary:disabled { opacity: .45; cursor: not-allowed; }
button.link { background: none; border: none; color: var(--muted); }
button.danger { color: var(--danger); }

.avatar-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid #3a3a3a; border-radius: 999px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 8px 14px; }
.seg button.active { background: var(--accent); color: #050505; font-weight: 700; }
.avatar-stage { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; }
.avatar-stage img { display: block; width: 100%; height: auto; }
.avatar-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.avatar-stage polygon { fill: var(--free); stroke: var(--free-stroke); stroke-width: 3; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .15s; }
.avatar-stage polygon:hover { fill: rgba(238, 234, 226, 0.3); }
.avatar-stage polygon.selected { fill: var(--sel); stroke: var(--ok); }
.avatar-stage polygon.taken { fill: var(--taken); stroke: #777; cursor: not-allowed; }
.avatar-stage polygon.taken.taken-season { fill: var(--season-fill); stroke: var(--season); }
.avatar-stage image { pointer-events: none; }
.avatar-3d { position: relative; width: 100%; aspect-ratio: 5 / 7; background: radial-gradient(ellipse at 50% 30%, #1d1d1d, #050505 70%); border-radius: var(--radius); overflow: hidden; }
.avatar-3d[hidden] { display: none; }
.avatar-3d canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.avatar-3d .hint3d { position: absolute; left: 10px; bottom: 8px; pointer-events: none; }
.avatar-3d .err3d { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center; color: var(--danger); }
.legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.sw.free { background: var(--free-stroke); } .sw.sel { background: var(--ok); } .sw.taken { background: #777; } .sw.season { background: var(--season); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 10px; border-radius: 999px; font-size: 12px; letter-spacing: 0; }
.chip.selected { background: var(--ok); color: #05210c; border-color: var(--ok); font-weight: 700; }
.chip.taken { opacity: .6; cursor: not-allowed; border-style: dashed; text-align: left; }
.chip.taken .who { display: block; font-size: 10px; letter-spacing: .04em; color: var(--muted); margin-top: 2px; }
.chip.taken.taken-season { border-color: var(--season); opacity: .8; }
.chip.taken.taken-season .who { color: var(--season); }
.ct-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 14px; }
.ct-section { border-top: 1px solid #222; }
.ct-section summary { cursor: pointer; font-weight: 700; padding: 12px 0; letter-spacing: .04em; }
.ct-field { padding: 8px 0 10px; border-bottom: 1px solid #1a1a1a; }
.ct-field.changed { border-left: 3px solid var(--ok); padding-left: 10px; }
.ct-field label { display: block; }
.ct-key { display: block; font: 11px monospace; color: var(--muted); margin-bottom: 4px; }
.ct-field input, .ct-field textarea { width: 100%; box-sizing: border-box; }
.ct-field textarea { min-height: 64px; resize: vertical; }
.ct-default { margin-top: 3px; white-space: pre-wrap; }
.ct-field .ct-reset { margin-top: 2px; }
.scope-pill { display: inline-block; padding: 2px 8px; border: 1px solid var(--season); border-radius: 999px; color: var(--season); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.chip .price { color: var(--muted); font-size: 12px; margin-left: 4px; }
.chip.selected .price { color: #0b3a16; }

.brands { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.brand-tile { padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; border-radius: var(--radius); letter-spacing: 0; }
.brand-tile img { width: 100%; height: 44px; object-fit: contain; background: #fff; border-radius: var(--radius); }
.brand-tile.selected { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok) inset; }

.summary { margin-top: 16px; padding: 12px; border-radius: var(--radius); background: var(--panel-2); font-size: 14px; }
.summary strong { color: var(--accent); font-size: 18px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button.active { background: var(--accent); color: #050505; font-weight: 700; border-color: var(--accent); }
.tabs #adm-logout { margin-left: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.filters label { margin: 0; }
.status { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status.PAID { background: rgba(143, 209, 158, .18); color: var(--ok); }
.status.PENDING { background: rgba(238, 234, 226, .15); color: var(--accent); }
.status.FAILED, .status.CANCELLED { background: rgba(227, 52, 47, .2); color: var(--danger); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.row label { flex: 1; min-width: 140px; }
.price-grid td input { width: 110px; }
.mock-pay { max-width: 480px; margin: 40px auto; }
.mock-pay .cardnum { letter-spacing: 3px; }
.ok-box { border-left: 4px solid var(--ok); }
.warn-box { border-left: 4px solid var(--danger); }
.mp-frame { margin-top: 12px; width: 100%; height: 720px; border-radius: var(--radius); overflow: hidden; background: #000; }
.mp-frame iframe { width: 100%; height: 100%; border: 0; }
.mp-frame[hidden] { display: none; }
.logo-preview { width: 120px; height: 60px; object-fit: contain; background: #fff; border-radius: var(--radius); }

/* ---- area atleta / social login ---- */
.social { display: grid; gap: 10px; margin: 14px 0; }
.social a.btn-social { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-weight: 700; text-decoration: none; }
.social a.btn-social:hover { border-color: var(--accent); }
.social a.btn-social i { display: inline-block; width: 18px; height: 18px; border-radius: 50%; }
.social .google i { background: #fff; } .social .facebook i { background: #1877f2; } .social .instagram i { background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7); } .social .linkedin i { background: #0a66c2; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #222; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(238, 234, 226, .15); color: var(--accent); }
.badge.READY { background: rgba(143, 209, 158, .18); color: var(--ok); }
.badge.NONE { background: rgba(138, 138, 138, .25); color: #bbb; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.kpi { background: var(--panel-2); border-radius: var(--radius); padding: 10px 12px; }
.kpi b { display: block; font-size: 20px; color: var(--accent); }
.kpi span { color: var(--muted); font-size: 12px; }
.me-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .me-grid { grid-template-columns: 1fr; } }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thumbs span { font-size: 12px; background: var(--panel-2); border-radius: var(--radius); padding: 3px 8px; color: var(--muted); }
table input.fee { width: 70px; }

/* ---- mappa 3D CesiumJS ---- */
.cesium-map { position: relative; width: 100%; height: 360px; border-radius: var(--radius); overflow: hidden; background: #050505; }
.cesium-map.admin { height: 420px; margin: 10px 0; }
.media-thumb { width: 96px; height: 60px; object-fit: cover; border-radius: 2px; background: #111; display: block; }
.flag-sm { width: 22px; height: 15px; vertical-align: middle; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
.pill-final { display: inline-block; margin-left: 6px; padding: 1px 7px; border: 1px solid var(--accent); border-radius: 999px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.cesium-map.pickable canvas { cursor: crosshair; }
.cesium-map .map-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.cesium-map .cesium-viewer-bottom { font-size: 10px; }
.cesium-map .cesium-widget-credits { opacity: .7; }
.geo-row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-top: 8px; }
.geo-row label { margin: 0; width: 170px; }

/* ---- layout a tre colonne: avatar | controlli | mappa, con pannelli laterali comprimibili ---- */
.grid-3 { grid-template-columns: minmax(260px, 400px) minmax(320px, 1fr) minmax(300px, 460px); align-items: start; }
.grid-3.avatar-collapsed { grid-template-columns: 48px minmax(320px, 1fr) minmax(300px, 520px); }
.grid-3.map-collapsed { grid-template-columns: minmax(260px, 440px) minmax(320px, 1fr) 48px; }
.grid-3.avatar-collapsed.map-collapsed { grid-template-columns: 48px minmax(320px, 1fr) 48px; }
.side-card { position: relative; display: flex; flex-direction: column; min-width: 0; }
.side-card .collapsed-bar { display: none; }
.side-card.collapsed { padding: 0; }
.side-card.collapsed > *:not(.collapsed-bar) { display: none !important; }
.side-card.collapsed .collapsed-bar { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 420px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--muted); cursor: pointer; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; }
.side-card.collapsed .collapsed-bar span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 700; letter-spacing: 1px; }
.side-card.collapsed .collapsed-bar b { font-size: 18px; color: var(--accent); }
.collapse-btn { padding: 2px 8px; font-size: 16px; line-height: 1; border-radius: var(--radius); }
.map-card .cesium-map { flex: none; height: 560px; }
.map-info { display: block; margin: 0 0 8px; min-height: 1.2em; }
@media (max-width: 1100px) {
  .grid-3, .grid-3.avatar-collapsed, .grid-3.map-collapsed, .grid-3.avatar-collapsed.map-collapsed { grid-template-columns: 1fr; }
  .side-card.collapsed .collapsed-bar { height: 48px; flex-direction: row; }
  .side-card.collapsed .collapsed-bar span { writing-mode: horizontal-tb; transform: none; }
  .map-card .cesium-map { min-height: 360px; }
}

/* ---- barra di navigazione della mappa ---- */
.map-toolbar { position: absolute; top: 8px; left: 8px; z-index: 3; display: flex; gap: 4px; align-items: center; }
.map-toolbar button { width: 32px; height: 32px; padding: 0; border-radius: 999px; background: rgba(5, 5, 5, .85); border: 1px solid #3a3a3a; color: var(--text); font-weight: 700; font-size: 15px; line-height: 1; }
.map-toolbar button:hover { border-color: var(--accent); color: var(--accent); }
.map-toolbar .map-status { margin-left: 6px; padding: 3px 8px; border-radius: var(--radius); background: rgba(11, 13, 17, .8); color: var(--muted); font-size: 12px; }
.map-toolbar .map-status:empty { display: none; }
.cesium-map .cesium-viewer-toolbar { top: 8px; right: 8px; }
.cesium-map .cesium-baseLayerPicker-dropDown { max-height: 360px; overflow: auto; }
#br-preview { width: 90px; height: 44px; object-fit: contain; background: #fff; border-radius: var(--radius); }
.map-help { position: absolute; top: 48px; left: 8px; z-index: 4; max-width: 360px; padding: 10px 12px; border-radius: var(--radius); background: rgba(11, 13, 17, .92); border: 1px solid #3a3f4b; font-size: 12px; color: var(--text); }
.map-help ul { margin: 6px 0 0; padding-left: 18px; }
.map-help li { margin: 3px 0; }
.map-help kbd { padding: 0 4px; border: 1px solid #555; border-radius: 3px; font-size: 11px; }

/* pannelli con il bordo sottile del template; il modulo sponsor dentro la landing non ha margine esterno */
.card { box-shadow: none; }
.landing .grid-3 { margin-top: 10px; }
.notice { padding: 12px 14px; border: 1px solid var(--line); margin-bottom: 14px; font-size: 13px; }
