:root { --bg:#0f1720; --card:#1a2430; --ink:#e8eef5; --mut:#8aa0b4; --acc:#3da9fc; --bad:#ff6b6b; --ok:#3ddc97; }
* { box-sizing: border-box; }
body { margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background:var(--bg); color:var(--ink); }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.topbar { display:flex; justify-content:space-between; align-items:center; padding:.8rem 1.5rem; background:var(--card); }
.brand { font-weight:700; font-size:1.1rem; }
nav { display:flex; gap:1rem; align-items:center; }
.who { color: var(--mut); }
.warn { color: #ffd166; }
.flash { background:#21364a; border-left:4px solid var(--acc); padding:.6rem .9rem; border-radius:6px; margin-bottom:1rem; }
.flash.err { border-color: var(--bad); }
.muted { color: var(--mut); }
.bad { color: var(--bad); font-weight:600; }

.centered { display:flex; min-height:100vh; align-items:center; justify-content:center; }
.card { background:var(--card); border-radius:12px; padding:1.5rem; box-shadow:0 6px 24px rgba(0,0,0,.3); }
form.card { width:340px; display:flex; flex-direction:column; gap:.8rem; }
label { display:flex; flex-direction:column; gap:.3rem; font-size:.9rem; color:var(--mut); }
input { padding:.55rem .7rem; border-radius:8px; border:1px solid #2b3a4a; background:#0f1720; color:var(--ink); font-size:1rem; }
button { padding:.6rem 1rem; border:0; border-radius:8px; background:var(--acc); color:#03121f; font-weight:600; cursor:pointer; }
button:hover { filter:brightness(1.08); }
button.link { background:none; color:var(--mut); padding:0; font-weight:400; }
button.danger { color:var(--bad); }

.cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:1rem; }
.company h2 { margin-top:0; }
table { width:100%; border-collapse:collapse; }
table.mini td { padding:.35rem .2rem; border-bottom:1px solid #243140; }
.num { text-align:right; font-variant-numeric:tabular-nums; }
.small { font-size:.8rem; }
table.data { background:var(--card); border-radius:10px; overflow:hidden; margin:1rem 0; }
table.data th, table.data td { padding:.55rem .7rem; border-bottom:1px solid #243140; text-align:left; }
table.data th { background:#17222e; color:var(--mut); font-weight:600; }
.addrow { display:flex; flex-wrap:wrap; gap:.8rem; align-items:end; background:var(--card); padding:1rem; border-radius:10px; }
.addrow label { min-width:140px; flex:1; }
.inline { display:flex; gap:.6rem; align-items:center; }
pre.secret { background:#0f1720; padding:.6rem; border-radius:8px; font-size:1.1rem; letter-spacing:2px; }
.break { word-break:break-all; }

.toolbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem; }
.simform { margin:1rem 0 1.5rem; }
.simform h2 { font-size:1rem; margin:1rem 0 .5rem; }
.grid3 { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:.8rem; }
select { padding:.55rem .7rem; border-radius:8px; border:1px solid #2b3a4a; background:#0f1720; color:var(--ink); font-size:1rem; }
.bignum { font-size:1.4rem; font-weight:700; margin:.6rem 0 .2rem; }
.bignum.good { color:var(--ok); }

/* organigramma ad albero */
.tree { overflow-x:auto; padding:1rem 0 1.5rem; }
.tree ul { padding-top:22px; position:relative; display:flex; justify-content:center; margin:0; }
.tree li { list-style:none; text-align:center; position:relative; padding:22px 12px 0; }
.tree li::before, .tree li::after {
  content:''; position:absolute; top:0; right:50%;
  border-top:2px solid #2b3a4a; width:50%; height:22px;
}
.tree li::after { right:auto; left:50%; border-left:2px solid #2b3a4a; }
.tree li:only-child { padding-top:0; }
.tree li:only-child::before, .tree li:only-child::after { display:none; }
.tree li:first-child::before, .tree li:last-child::after { border:0 none; }
.tree li:last-child::before { border-right:2px solid #2b3a4a; border-radius:0 6px 0 0; }
.tree li:first-child::after { border-radius:6px 0 0 0; }
.tree > ul > li::before, .tree > ul > li::after { display:none; }
.tree ul ul::before {
  content:''; position:absolute; top:0; left:50%;
  border-left:2px solid #2b3a4a; width:0; height:22px;
}
.tree .box {
  display:inline-flex; flex-direction:column; gap:.15rem;
  background:var(--card); border:1px solid #2b3a4a; border-radius:10px;
  padding:.6rem 1rem; min-width:150px; font-weight:600;
}
.tree .box small { color:var(--mut); font-weight:400; font-size:.78rem; }
.tree .box.holding { border-color:var(--acc); box-shadow:0 0 0 2px rgba(61,169,252,.15); }

/* albero fatto con le card di dettaglio */
.tree.cardtree .box {
  display:inline-block; text-align:left; min-width:260px; max-width:300px;
  padding:1rem 1.2rem; box-shadow:0 6px 24px rgba(0,0,0,.3); vertical-align:top;
}
.tree.cardtree .box h2 { margin:0; font-size:1.05rem; }
.tree.cardtree .box .role { color:var(--mut); font-size:.8rem; margin:.1rem 0 .6rem; }
.tree.cardtree .box .mini { width:100%; }
.tree.cardtree li { padding-left:8px; padding-right:8px; }
.md-content { background:var(--card); padding:1.5rem 2rem; border-radius:12px; line-height:1.6; }
.md-content h1 { margin-top:0; }
.md-content h2 { margin-top:2rem; border-bottom:1px solid #243140; padding-bottom:.3rem; }
.md-content blockquote { border-left:4px solid var(--acc); background:#21364a; margin:1rem 0; padding:.6rem 1rem; border-radius:6px; }
.md-content table { margin:1rem 0; }
.md-content th, .md-content td { border:1px solid #243140; padding:.5rem .7rem; text-align:left; }
.md-content th { background:#17222e; }
.md-content code { background:#0f1720; padding:.1rem .35rem; border-radius:4px; }
.md-content pre { background:#0f1720; padding:1rem; border-radius:8px; overflow:auto; }
.md-content pre code { background:none; padding:0; }
.md-content a { color:var(--acc); }
@media print {
  .topbar, .toolbar { display:none; }
  body { background:#fff; color:#000; }
  .md-content { background:#fff; box-shadow:none; }
  .md-content blockquote { background:#f3f3f3; }
}
