/* CBG-Core pannello: brandbook Valcore (80% nero/bianco, 15% grigi, 5% arancione). */
@font-face { font-family: 'Outfit'; src: url('/cbg-assets/fonts/outfit-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('/cbg-assets/fonts/outfit-latin-ext.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-024F, U+1E00-1EFF; }
:root {
  --accent: #FF751F; --accent-rgb: 255,117,31; --accent-soft: rgba(255,117,31,.08); --accent-mid: rgba(255,117,31,.16);
  --black: #0a0a0a; --text: #0a0a0a; --muted: #666; --muted-2: #999; --border: rgba(0,0,0,.08); --bg: #f6f6f4; --card: #fff;
  --green: #22c55e; --green-soft: rgba(34,197,94,.1); --red: #ef4444; --red-soft: rgba(239,68,68,.08); --amber: #b45309; --amber-soft: rgba(245,158,11,.12);
  --radius: 16px; --radius-sm: 10px; --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }
[x-cloak] { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--black); color: #fff; padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
/* Intestazione come SocialCore: isotipo + nome app in Outfit, "Core" in arancione. */
.brand-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--black); }
.brand-logo img { width: 28px; height: 28px; object-fit: contain; }
.brand-logo span { font-family: 'Outfit', 'Inter', sans-serif; font-size: 17px; font-weight: 600; letter-spacing: -0.025em; }
.brand-logo .brand-accent { color: var(--accent); }
.brand-logo--dark { color: #fff; }
.side-head { display: flex; align-items: center; height: 64px; padding: 0 12px; margin: -22px 0 10px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: rgba(255,255,255,.72); text-decoration: none; font-size: 14px; }
.side a.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.nav.active { background: rgba(255,255,255,.1); color: #fff; }
.side a.nav.active svg { color: var(--accent); }
.side .nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.35); padding: 16px 12px 6px; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; color: rgba(255,255,255,.6); }
.side-foot button { background: none; border: 0; color: rgba(255,255,255,.6); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 36px 0; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.content { padding: 18px 36px 64px; max-width: 1360px; }
h1, h2, h3, h4, .font-display { font-family: 'Outfit', 'Inter', ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 700; margin: 0; line-height: 1.15; }
h2 { font-size: 20px; font-weight: 600; margin: 0 0 14px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 6px 0 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

/* Tabs CBG */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* Cards & grid */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat b { display: block; font-size: 28px; font-weight: 700; }
.stat span { color: var(--muted); font-size: 13px; }
.tile { display: block; text-decoration: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile-title { font-weight: 600; font-size: 16px; }
.tile-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-weight: 500; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--black); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--black); font-weight: 600; }
.btn-primary:hover { background: var(--black); border-color: var(--black); color: #fff; }
.btn-dark { background: var(--black); border-color: var(--black); color: #fff; }
.btn-dark:hover { background: var(--accent); border-color: var(--accent); color: var(--black); }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label.lbl { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid rgba(0,0,0,.14); border-radius: var(--radius-sm); font: inherit; font-size: 14px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-mid); border-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; min-height: 460px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.inline-form { display: inline; }

/* Tables */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: rgba(0,0,0,.015); }
.table-wrap { overflow-x: auto; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: rgba(0,0,0,.06); color: var(--muted); white-space: nowrap; }
.badge-on { background: var(--green-soft); color: #15803d; }
.badge-off { background: rgba(0,0,0,.05); color: var(--muted-2); }
.badge-accent { background: var(--accent-soft); color: #c2410c; }
.badge-red { background: var(--red-soft); color: #b91c1c; }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-dark { background: var(--black); color: #fff; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; }
.alert-ok { background: var(--green-soft); color: #166534; }
.alert-err { background: var(--red-soft); color: #991b1b; }
.alert-info { background: var(--accent-soft); color: #9a3412; }
.secret { font-family: ui-monospace, monospace; background: var(--black); color: #fff; padding: 12px 14px; border-radius: var(--radius-sm); word-break: break-all; }

/* Sezioni schede */
.sec { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.sec-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.sec-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sec-head b { font-size: 15px; }
.sec-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.sec-row:last-child { border-bottom: 0; }
.sec-row a.title { text-decoration: none; font-weight: 500; }
.sec-row a.title:hover { color: var(--accent); }
.sec-row .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.mt2 { margin-top: 28px; }
.right { text-align: right; }
.prewrap { white-space: pre-wrap; }
.empty { text-align: center; padding: 40px; color: var(--muted); }
details.box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; }
details.box summary { cursor: pointer; font-weight: 600; }
.q-a { padding: 12px 0; border-bottom: 1px solid var(--border); }
.q-a:last-child { border-bottom: 0; }
.q-a .q { font-weight: 600; font-size: 14px; }
.q-a .a { margin-top: 4px; white-space: pre-wrap; font-size: 14px; }
.q-a .a.none { color: var(--muted-2); font-style: italic; }
.progress { height: 6px; background: rgba(0,0,0,.06); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--black); padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: var(--radius); padding: 36px 32px; }
.auth-card img { height: 28px; margin-bottom: 8px; }
.auth-card .kicker { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 26px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .side .nav-label, .side-foot { display: none; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}
