:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #21262d;
  --text: #e6edf3;
  --muted: #8b949e;
  --line: #30363d;
  --accent: #2ea043;
  --danger: #b93838;
  --link: #58a6ff;
  --warning: #d29922;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell { display: flex; min-height: 100vh; }
.side {
  width: 260px;
  flex: 0 0 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 24px;
  background: #010409;
  border-right: 1px solid var(--line);
}
.brand {
  margin-bottom: 24px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.05;
}
.brand span { color: var(--muted); font-size: 13px; letter-spacing: .04em; }
nav a {
  display: block;
  margin: 4px 0;
  padding: 11px 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
  transition: background .15s ease, color .15s ease;
}
nav a:hover, nav a.active { background: var(--panel-2); color: #fff; }
nav a.active { box-shadow: inset 3px 0 0 var(--accent); }

.main { flex: 1; min-width: 0; padding: 32px; overflow: auto; }
h1 { margin: 0 0 18px; color: #fff; font-size: clamp(28px, 3vw, 38px); }
h2 { margin: 0 0 16px; color: #fff; }
h3 { margin: 0 0 14px; color: #fff; }
p { line-height: 1.5; }
a { color: var(--link); }
small, .muted, .hint { color: var(--muted); }
.warn { color: #f2cc60; }
.ok { color: #3fb950; }
.bad { color: #ff7b72; }

.panel, .card {
  margin: 18px 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow-x: auto;
}
.auth-card {
  width: min(430px, 100%);
  margin: 10vh auto;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.cards, .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.cards .card, .grid .card { margin: 0; overflow: hidden; }
.cards .card span, .grid .card h2 {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.cards .card strong, .big { margin: 0; color: #fff; font-size: 34px; font-weight: 700; }
.grid3, .grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.wide { grid-column: 1 / -1; }

label { display: block; margin: 10px 0; color: var(--muted); font-size: 14px; }
input, textarea, select, button { font: inherit; }
input, textarea, select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, .14);
}
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0 6px 0 0; }
input[type="file"] { padding: 8px; }
textarea { min-height: 110px; resize: vertical; }

button, .button {
  display: inline-block;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { filter: brightness(1.08); }
button.danger, .danger { color: #fff; background: var(--danger) !important; }
button.danger:hover, .danger:hover { background: #d94a4a !important; }

.row, .inline, .actions-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.row input { flex: 1 1 260px; margin-top: 0; }
.inline { margin: 10px 0; }
.inline label { display: inline-flex; align-items: center; margin: 0; }
.inline input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.inline textarea, .inline select { width: auto; min-width: 150px; margin-top: 0; }
.inline textarea { min-width: 280px; }
.inline-form { display: inline; }
.actions-inline { flex-wrap: nowrap; white-space: nowrap; }
.actions-inline form { display: inline-flex; }
.actions-inline button { padding: 6px 10px; white-space: nowrap; }

.service { padding: 18px 0; border-top: 1px solid var(--line); }
.service:first-child { border-top: 0; }

.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
th { color: #fff; background: var(--panel-2); white-space: nowrap; }
td { color: #d0d7de; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(88, 166, 255, .035); }

code, pre {
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}
code { padding: 2px 6px; word-break: break-all; }
pre { max-width: 100%; padding: 12px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

details { color: var(--text); }
summary { color: var(--link); cursor: pointer; }

.messages { margin-bottom: 18px; }
.msg, .flash {
  margin: 8px 0;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.report-thread-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.report-thread-header h1 { margin-bottom: 6px; }
.back-link { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.thread-status { display: flex; gap: 8px; flex-wrap: wrap; }
.report-thread-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 18px;
  align-items: start;
}
.report-thread-info { position: sticky; top: 16px; margin: 0; }
.report-thread-chat-panel { margin: 0; padding: 0; overflow: hidden; }
.chat-window {
  min-height: 360px;
  max-height: calc(100vh - 250px);
  padding: 18px;
  overflow: auto;
  background: var(--bg);
}
.chat-bubble {
  max-width: 820px;
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.chat-bubble.admin { margin-left: auto; background: #10243b; border-color: var(--link); }
.chat-bubble.player { margin-right: auto; background: #10281a; border-color: var(--accent); }
.chat-bubble-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chat-message { white-space: pre-wrap; word-break: break-word; }
.chat-reply-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.chat-reply-box textarea { min-height: 80px; margin: 0; }

@media (max-width: 1000px) {
  .report-thread-layout { grid-template-columns: 1fr; }
  .report-thread-info { position: relative; top: auto; }
  .chat-window { max-height: none; }
}

@media (max-width: 800px) {
  .shell { display: block; }
  .side { position: relative; width: auto; height: auto; padding: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin-bottom: 12px; }
  nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
  nav a { flex: 0 0 auto; margin: 0; }
  .main { padding: 18px; }
  .report-thread-header { display: block; }
  .thread-status { margin-top: 10px; }
  .chat-reply-box { grid-template-columns: 1fr; }
}

/* Struttura informativa: chiarezza tramite gerarchia, spaziatura e stati. */
.brand span { display: block; margin-top: 6px; }
.nav-group { margin: 22px 10px 7px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 22px; }
.page-header h1 { margin-bottom: 5px; }
.page-header p { max-width: 900px; margin: 0; color: var(--muted); }
.page-header.split { align-items: flex-end; }
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0; color: var(--muted); }
.metric { color: inherit; text-decoration: none; }
.metric:hover { border-color: #6e7681; transform: translateY(-1px); }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 12px; }
.summary-card { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.summary-card span { display:block; margin-bottom:7px; color:var(--muted); font-size:13px; }
.summary-card strong { font-size:18px; }
.status { display:inline-flex; align-items:center; min-height:26px; padding:3px 9px; border:1px solid var(--line); border-radius:999px; font-size:12px; font-weight:700; white-space:nowrap; }
.status-ok { border-color:rgba(63,185,80,.55); background:rgba(46,160,67,.12); }
.status-bad { border-color:rgba(255,123,114,.5); background:rgba(185,56,56,.13); }
.status-warn { border-color:rgba(210,153,34,.55); background:rgba(210,153,34,.12); }
.status.large { padding:7px 13px; font-size:14px; }
.cell-note { margin-top:5px; color:var(--muted); font-size:12px; }
.tag-list { display:flex; flex-wrap:wrap; gap:6px; }
.tag { padding:4px 8px; border:1px solid var(--line); border-radius:7px; background:var(--bg); font-size:12px; }
.search-bar { display:flex; gap:8px; align-items:center; margin-bottom:14px; }
.search-bar input { margin:0; flex:1; min-width:220px; }
.secondary, button.secondary { background:var(--panel-2) !important; border:1px solid var(--line); }
.nowrap { white-space:nowrap; }
.empty { padding:28px; text-align:center; color:var(--muted); }
.info-strip { margin:0 0 18px; padding:13px 15px; border-left:4px solid var(--link); background:var(--panel); border-radius:8px; }
.rule-list { display:grid; gap:8px; }
.rule-row { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 12px; border:1px solid var(--line); border-radius:10px; }
.mod-stack,.action-stack { display:grid; gap:8px; }
.mod-line,.action-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.action-row { padding-bottom:8px; border-bottom:1px solid var(--line); }
.action-row:last-child { border-bottom:0; }
.action-row form { margin:0; }
.big-number { font-size:24px; font-weight:800; }
select { min-width:180px; }
@media (max-width: 900px) {
  .side { width:210px; flex-basis:210px; padding:18px 12px; }
  .main { padding:22px 16px; }
  .page-header,.page-header.split { flex-direction:column; align-items:flex-start; }
}
.check-card { display:flex; align-items:flex-start; gap:9px; min-height:54px; padding:10px; border:1px solid var(--line); border-radius:10px; background:var(--bg); }
.check-card input { margin-top:4px; }
.check-card span { display:grid; gap:3px; }
.check-card small { display:block; }
.service-grid { display:grid; gap:14px; }
.service-card { padding:16px; border:1px solid var(--line); border-radius:14px; background:var(--bg); }
.service-card-head { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; margin-bottom:12px; }
.service-card-head h3 { margin-bottom:5px; }
.service-meta { display:flex; flex-wrap:wrap; gap:8px 18px; margin-bottom:12px; color:var(--muted); font-size:13px; }
.compact-form { margin-top:14px; padding-top:14px; border-top:1px solid var(--line); }
.form-actions { align-self:end; }
.service-actions { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:14px; flex-wrap:wrap; }
.service-actions form { margin:0; }

/* Emergency BanMod kill switch. */
.danger-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 123, 114, .58);
  border-radius: 12px;
  background: rgba(185, 56, 56, .14);
  font-weight: 800;
}
.danger-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
}


/* Targeted ForceDisable controls. */
.force-disable-card.is-active {
  border-color: rgba(255, 123, 114, .72);
  box-shadow: 0 0 0 1px rgba(255, 123, 114, .20) inset;
}
button.danger-action, .button.danger-action {
  background: #a83a3a;
  border-color: #d76767;
}
button.danger-action:hover, .button.danger-action:hover {
  background: #bd4545;
}

/* Pannello semplificato 2026 */
.main { max-width: 1680px; margin: 0 auto; }
.panel { box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.anchor-section { scroll-margin-top: 18px; }
.compact-search { min-width: min(620px, 100%); margin: 0; }
.section-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  padding: 10px;
  overflow-x: auto;
  background: rgba(13,17,23,.94);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(12px);
}
.section-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 9px 12px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.section-tabs a:hover { border-color: var(--link); }
.section-tabs span { color: var(--muted); font-size: 12px; }
.control-box { margin: 14px 0; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.mini-stats span { padding: 7px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.subsection { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.copy-button { margin-top: 7px; padding: 5px 8px; font-size: 12px; }
.release-list, .provider-list { display: grid; gap: 14px; }
.release-card, .provider-card, .code-card {
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.release-card.is-private { border-color: rgba(210,153,34,.55); }
.release-card-head, .code-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.release-card h3 { margin: 0; }
.primary-panel { border-color: rgba(88,166,255,.45); }
.code-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(360px,1fr)); gap: 14px; }
.code-card.is-disabled { opacity: .78; }
.big-code { display: inline-block; padding: 8px 10px; font-size: 16px; }
.code-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 14px 0; }
.code-facts div { min-width: 0; padding: 9px; background: var(--panel); border-radius: 10px; }
.code-facts span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.code-facts strong { display: block; overflow-wrap: anywhere; }
.advanced-box { margin-top: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.large-summary { font-size: 18px; font-weight: 800; }
.target-choice { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.choice-card { display: flex; align-items: flex-start; gap: 9px; margin: 0; padding: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--link); box-shadow: 0 0 0 2px rgba(88,166,255,.12); }
.choice-card span { display: grid; gap: 3px; }
.choice-card small { color: var(--muted); }
.target-panel { margin: 12px 0 18px; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
select[multiple] { min-height: 170px; }
.compact-pre { max-height: 120px; margin: 7px 0 0; padding: 8px; }
.message-preview { max-width: 760px; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .compact-search { min-width: 100%; }
  .target-choice { grid-template-columns: 1fr; }
  .code-grid { grid-template-columns: 1fr; }
  .code-facts { grid-template-columns: 1fr; }
  .section-tabs { position: relative; }
}

.warning-notice {
  margin: 0 0 1rem;
}

.ip-history-list {
  display: grid;
  gap: .45rem;
  min-width: 250px;
  padding-top: .65rem;
}

.ip-history-list > div,
.firewall-command {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.ip-history-list span {
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}

.firewall-command + .firewall-command {
  margin-top: .45rem;
}


/* Sezioni amministrative richiudibili. */
.panel-collapsible {
  transition: border-color .18s ease, box-shadow .18s ease;
}
.panel-collapsible > .collapsible-heading {
  align-items: center;
  margin-bottom: 14px;
}
.panel-collapsible.is-collapsed > .collapsible-heading {
  margin-bottom: 0;
}
.panel-collapsible.is-collapsed > :not(.section-heading) {
  display: none !important;
}
.panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 106px;
  margin-left: auto;
  padding: 7px 10px;
  font-size: 12px;
}
.panel-toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 16px;
  line-height: 1;
}
.accordion-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.accordion-toolbar button {
  padding: 8px 11px;
  font-size: 12px;
}
@media (max-width: 900px) {
  .accordion-toolbar { margin-left: 0; }
  .panel-collapsible > .collapsible-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .panel-collapsible > .collapsible-heading > .actions-inline {
    grid-column: 1 / -1;
  }
  .panel-toggle { margin-left: 0; }
}

/* Mod control: keep refresh/search usable on narrower admin screens. */
.header-tools { flex-wrap: wrap; justify-content: flex-end; white-space: normal; }
.subsection-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .header-tools { width: 100%; justify-content: flex-start; }
  .header-tools .compact-search { min-width: 100%; }
}
