/* Pannello Radio */
:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --border: #E3E3E8;
  --border-strong: #D6D7DD;
  --line: #EEEFF2;
  --text: #17181C;
  --muted: #5B5E66;
  --accent: #CD192D;
  --accent-hover: #A8131F;
  --dark: #17181C;
  --side: #16181D;
  --side-2: #22252C;
  --side-active: #2B2E37;
  --side-text: #C9CBD1;
  --green: #1B6B3E; --green-bg: #E4F3EA;
  --amber: #7A4F00; --amber-bg: #FBF0D9;
  --blue: #1F4FA8;  --blue-bg: #E5EDFB;
  --red: #9C1020;   --red-bg: #FBE7E9;
  --grey: #4A4D55;  --grey-bg: #EEEFF2;
  --radius: 12px;
  --focus: 0 0 0 3px rgba(205, 25, 45, .35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; top: 8px; left: 8px; z-index: 10; background: #fff; padding: 8px 12px; border-radius: 8px; }
.js .nojs-only { display: none; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.inline { display: inline; margin: 0; }
.error-text { color: #B3121F; font-size: 13px; }
.ok-text { color: var(--green); font-size: 13px; }
.req { color: #B3121F; }
.hint { font-size: 13px; color: var(--muted); margin: -4px 0 12px; }

/* ---------- Struttura ---------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side {
  flex: 1 1 232px; max-width: 260px;
  background: var(--side); color: #E8E8EA;
  padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
}
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 20px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-weight: 700; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none;
}
.brand-mark .ico { width: 18px; height: 18px; }
.brand-mark-lg { width: 48px; height: 48px; border-radius: 12px; }
.brand-mark-lg .ico { width: 26px; height: 26px; }

.station-switch { display: flex; flex-direction: column; gap: 6px; padding: 0 6px; }
.station-switch label { font-size: 12px; color: #A9ACB4; }
.station-switch select {
  height: 40px; border-radius: 8px; border: 1px solid #3A3D46; background: var(--side-2); color: #F2F2F4;
  padding: 0 10px; font: inherit; font-size: 14px;
}

.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 8px;
  color: var(--side-text); text-decoration: none; font-size: 14px;
}
.nav a:hover { background: #20232A; color: #fff; }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 600; }
.ico { width: 18px; height: 18px; flex: none; }

.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid #2E313A; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #3A3D46; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.me-text { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 13px; }
.me-text small { color: #A9ACB4; font-size: 12px; }
.me .linkbtn { color: var(--side-text); }

/* ---------- Intestazioni ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-head p { margin-top: 4px; font-size: 14px; }
.actions, .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-actions { gap: 8px; }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #F2F2F5; color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-dark { background: var(--dark); border-color: var(--dark); color: #fff; font-weight: 600; }
.btn-dark:hover { background: #000; color: #fff; }
.btn-danger-ghost { color: #B3121F; border-color: #F0C7CB; }
.btn-danger-ghost:hover { background: var(--red-bg); color: #8E0E19; }
.btn-sm { min-height: 36px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; min-height: 46px; font-size: 15px; }
.btn:disabled { opacity: .6; cursor: progress; }
.linkbtn { background: none; border: 0; padding: 4px; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; text-decoration: underline; }
.push-right { margin-left: auto; }

/* ---------- Etichette ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip-green { color: var(--green); background: var(--green-bg); }
.chip-amber { color: var(--amber); background: var(--amber-bg); }
.chip-blue { color: var(--blue); background: var(--blue-bg); }
.chip-red { color: var(--red); background: var(--red-bg); }
.chip-grey { color: var(--grey); background: var(--grey-bg); }
.page-head .chip { font-size: 13px; padding: 6px 10px; }

.flash { padding: 12px 14px; border-radius: 10px; font-size: 14px; border: 1px solid transparent; }
.flash-success { background: var(--green-bg); color: var(--green); border-color: #C6E6D2; }
.flash-error { background: var(--red-bg); color: #8E0E19; border-color: #F0C7CB; }
.flash-info { background: var(--blue-bg); color: var(--blue); border-color: #CBD9F5; }

/* ---------- Schede ed elenchi ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad, .side-card, .form-card { padding: 22px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.card-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.empty { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item.is-off .item-main, .item.is-off .thumb { opacity: .55; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-title { font-size: 15px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.item-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; background: var(--grey-bg); }
.thumb-empty { display: block; }

.order { display: flex; flex-direction: column; gap: 2px; flex: none; width: 32px; }
.icon-btn {
  width: 32px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--grey-bg); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.is-hidden { visibility: hidden; }

.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); text-decoration: none; font-size: 13px;
}
.pill[aria-current] { background: var(--dark); border-color: var(--dark); color: #fff; font-weight: 600; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: 12px 10px; }
.table td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table tr.is-off td { opacity: .6; }

.roles { margin: 0; display: grid; gap: 4px; }
.roles dt { font-weight: 600; margin-top: 8px; }
.roles dd { margin: 0; font-size: 13px; color: var(--muted); }

.json {
  margin: 0; padding: 18px; overflow: auto; max-height: 70vh; font-size: 13px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; border-radius: var(--radius);
}

/* ---------- Moduli ---------- */
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > :first-child { flex: 2 1 440px; min-width: 0; }
.split > :last-child { flex: 1 1 260px; min-width: 0; }
.split-even > * { flex: 1 1 340px !important; }

.form-card { display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, legend { font-size: 13px; font-weight: 600; }
.field small { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=date], input[type=time], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; border-radius: 8px; border: 1px solid var(--border-strong);
  padding: 0 12px; font: inherit; font-size: 15px; background: #fff; color: var(--text);
}
textarea { padding: 10px 12px; resize: vertical; min-height: 96px; }
input[readonly] { background: #FAFAFB; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.has-error input, .has-error textarea { border-color: #B3121F; }
.row-input { display: flex; flex-wrap: wrap; gap: 8px; }
.row-input input { flex: 1 1 240px; min-width: 0; }
.code-input { font-size: 22px !important; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-card > .section-title:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-card > .section-head:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.section-head .section-title { margin: 0; padding: 0; border: 0; }
.gt-link { align-self: flex-start; text-decoration: none; }
.gt-link:hover { text-decoration: underline; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dates { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.lang {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 2px 5px;
  border-radius: 4px; background: var(--grey-bg); color: var(--grey); vertical-align: 1px;
}

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px;
  padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; cursor: pointer;
}
.switch-row > span { display: flex; flex-direction: column; gap: 2px; }
.switch-row small { font-size: 13px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.radio-row, .radio-col { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-col { flex-direction: column; gap: 8px; }
.radio-row legend, .radio-col legend { margin-bottom: 8px; }
.radio-row label, .radio-col label { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 32px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.link-status { display: block; }

/* Anteprima replica */
.phone-preview { background: #111215; color: #F2F2F4; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pp-cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #2B2E37; }
.pp-title { font-size: 16px; font-weight: 600; }
.pp-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.pp-buttons span { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; background: #2B2E37; font-size: 13px; }
.side-card { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Accesso ---------- */
body.auth { background: var(--side); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 32px 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.auth-head h1 { font-size: 22px; }
.steps { margin: 0; padding-left: 20px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.qr { align-self: center; width: 220px; min-height: 220px; display: flex; align-items: center; justify-content: center; background: #fff; }
.qr svg { width: 220px; height: 220px; }
.qr-missing { font-size: 13px; color: var(--muted); text-align: center; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 16px; }
.codes { list-style: none; margin: 0; padding: 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; background: #FAFAFB; border: 1px solid var(--border); border-radius: 10px; font-size: 16px; text-align: center; }

/* ---------- Schermi piccoli ---------- */
@media (max-width: 820px) {
  .side { max-width: none; flex-basis: 100%; padding: 14px 12px; gap: 12px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .nav a { white-space: nowrap; padding: 0 10px; }
  .me { margin-top: 0; padding-top: 10px; }
  .main { padding: 20px 16px 40px; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .dates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item { flex-wrap: wrap; }
  .item .row-actions { width: 100%; padding-left: 46px; }
  .item-sub { white-space: normal; word-break: break-all; }
}

@media print {
  body.auth { background: #fff; }
  .auth-card { box-shadow: none; }
  .btn, form, .steps { display: none !important; }
}

/* ---------- 1.2: DJ e approvazioni ---------- */
.nav .badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.banner {
  display: block; padding: 12px 16px; border-radius: 10px; text-decoration: none;
  background: var(--amber-bg); color: var(--amber); border: 1px solid #F0DDB0; font-size: 14px;
}
.banner:hover { color: #5C3B00; text-decoration: underline; }
.assign-bar, .bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px;
}
.assign-bar { border-bottom: 1px solid var(--border); background: #FAFAFB; }
.assign-bar select, .filter-form select { width: auto; min-height: 36px; font-size: 14px; }
.bulk-bar input { flex: 1 1 220px; min-height: 36px; width: auto; font-size: 14px; }
.filter-form { display: inline-flex; align-items: center; gap: 6px; }
.item-check { flex: none; }
.is-struck .t, .struck { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.pad-x { padding: 16px 16px 0; }
.break { word-break: break-all; }

.proposal { display: flex; flex-direction: column; }
.proposal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.proposal-head .item-title { margin: 0; }
.proposal-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.proposal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: #FAFAFB; border-radius: 0 0 var(--radius) var(--radius); }
.reject-form { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 280px; justify-content: flex-end; }
.reject-form input { flex: 1 1 180px; min-height: 36px; width: auto; font-size: 14px; }
.diff { min-width: 480px; }
.diff th[scope=row] { font-weight: 600; white-space: nowrap; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 13px; }
.diff td.old { background: #FDF2F3; }
.diff td.new { background: #EEF8F1; }
.fields { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; }
.fields dt { font-weight: 600; font-size: 13px; }
.fields dd { margin: 0; min-width: 0; }
@media (max-width: 820px) {
  .proposal-head .push-right { margin-left: 0; width: 100%; }
  .reject-form { justify-content: flex-start; }
}
.item-meta .chip { white-space: normal; }
.access-card { display: flex; flex-direction: column; gap: 10px; }
.btn.is-disabled { opacity: .45; cursor: not-allowed; }
