* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 "Segoe UI", system-ui, sans-serif; color: #1d2330; background: #f5f6f8; }
main { padding: 16px 24px; }
h1 { font-size: 20px; margin: 4px 0 12px; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 6px 24px; background: #fff; color: #1d2330; border-bottom: 1px solid #e6e9ef; }
.topbar .brand img { height: 40px; display: block; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: #4a5263; text-decoration: none; font-weight: 500; }
.topbar nav a.active { color: #1e73e8; border-bottom: 2px solid #1e73e8; }
.topbar .logout { display: flex; gap: 8px; align-items: center; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters .count { color: #6b7385; margin-left: auto; }
input, select, button { font: inherit; padding: 5px 8px; border: 1px solid #c9cfdb; border-radius: 4px; background: #fff; }
input.wide { min-width: 320px; }
button { cursor: pointer; background: #4f8cff; color: #fff; border-color: #4f8cff; }
button:disabled { opacity: .5; cursor: default; }
button.danger { background: #d94848; border-color: #d94848; }
button.link { background: none; border: none; color: #4f8cff; padding: 0 4px; }

.grid { width: 100%; border-collapse: collapse; background: #fff; }
.grid th, .grid td { padding: 6px 8px; border-bottom: 1px solid #e6e9ef; text-align: left; white-space: nowrap; }
.grid th { background: #eef0f4; font-weight: 600; }
.grid small { color: #6b7385; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.on { background: #2fb86b; }
.dot.off { background: #c9cfdb; }

.hint { color: #6b7385; }
.error { color: #d94848; }

.login { max-width: 320px; margin: 12vh auto; background: #fff; padding: 24px; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; }
.login-logo { width: 100%; margin-bottom: 8px; }

h2 { font-size: 16px; margin: 24px 0 8px; }
h1 .dot { vertical-align: middle; margin-right: 6px; }
a { color: #1e73e8; }
td.bad, dd.bad { color: #d94848; font-weight: 600; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 8px; margin-left: 6px; }
.tag.warn { background: #fff1d6; color: #9a6400; }
label.check { display: flex; align-items: center; gap: 4px; }
button.secondary { background: #fff; color: #1d2330; border-color: #c9cfdb; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.card { background: #fff; border: 1px solid #e6e9ef; border-radius: 6px; padding: 12px 16px; }
.card h3 { font-size: 14px; margin: 0 0 8px; }
.card dl { display: grid; grid-template-columns: 150px 1fr; gap: 4px 8px; margin: 0; }
.card dt { color: #6b7385; }
.card dd { margin: 0; }

.bar { width: 160px; height: 8px; background: #e6e9ef; border-radius: 4px; overflow: hidden; }
.bar div { height: 100%; background: #1e73e8; }
.bar div.full { background: #d94848; }

.commands { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.cmd { background: #fff; border: 1px solid #e6e9ef; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.cmd input.wide { min-width: 0; }
.cmd textarea { font: 13px Consolas, monospace; padding: 6px; border: 1px solid #c9cfdb; border-radius: 4px; }
td.output { white-space: normal; max-width: 520px; }
td.output pre { white-space: pre-wrap; font-size: 12px; background: #f5f6f8; padding: 8px; max-height: 300px; overflow: auto; }

/* Dettaglio PC */
.detail-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.detail-head h1 { margin: 0; }
.detail-head .back { text-decoration: none; font-size: 13px; }
.badges { display: flex; gap: 6px; }
.tag { background: #eef0f4; color: #4a5263; }
.tag.bad { background: #fde3e3; color: #b42323; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #dfe3ea; margin: 8px 0 16px; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; color: #4a5263; padding: 8px 14px; font-weight: 500; }
.tabs button.active { color: #1e73e8; border-bottom-color: #1e73e8; }
.card dd.big { font-size: 18px; font-weight: 600; font-family: Consolas, monospace; }
.cmd h3 { font-size: 14px; margin: 0 0 4px; }
.cmd .row { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.cmd label { display: flex; flex-direction: column; gap: 4px; }
.mono { font-family: Consolas, monospace; }
.notice { background: #e8f1ff; border: 1px solid #c4dafc; padding: 8px 12px; border-radius: 6px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.open { background: #f5f8ff; }
tr.out td { background: #f5f6f8; }
tr.out pre { white-space: pre-wrap; margin: 0; font-size: 12px; max-height: 400px; overflow: auto; }
.card .row.inline { display: flex; gap: 12px; margin: 8px 0; }
.card .row.inline label { display: flex; align-items: center; gap: 6px; }
input.num { width: 70px; }
b.ok { color: #1f9d57; }
.card .row { display: flex; gap: 8px; margin-top: 8px; }

/* Form anagrafiche */
.form-card { margin-bottom: 16px; }
.form-card.narrow { max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.form-card label, .form-grid label { display: flex; flex-direction: column; gap: 4px; color: #4a5263; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 16px; margin-bottom: 6px; }
button.link.danger { color: #d94848; }
td.actions { text-align: right; }
fieldset.plain { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
span.ok { color: #1f9d57; }
.topbar a.user { color: #1d2330; text-decoration: none; }
.topbar a.user:hover { text-decoration: underline; }

/* Aiuto e gestione avanzata */
p.help { color: #5b6476; background: #f0f3f8; border-left: 3px solid #b8c7e0; padding: 8px 12px; margin: 0 0 14px; max-width: 980px; }
.bad-text { color: #d94848; font-weight: 600; }
details.advanced { margin-top: 32px; color: #6b7385; }
details.advanced summary { cursor: pointer; font-size: 13px; }
details.advanced .adv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
details.advanced .adv-row small { max-width: 520px; }

/* Icona (i) di aiuto */
details.info { display: inline-block; position: relative; vertical-align: middle; font-size: 13px; font-weight: normal; }
details.info summary { list-style: none; cursor: pointer; width: 16px; height: 16px; line-height: 16px; border-radius: 50%;
  background: #dfe6f3; color: #1e73e8; font: italic 700 11px Georgia, serif; text-align: center; user-select: none; }
details.info summary::-webkit-details-marker { display: none; }
details.info[open] summary { background: #1e73e8; color: #fff; }
details.info .info-pop { position: absolute; z-index: 20; top: 22px; left: -8px; width: 320px; padding: 10px 12px;
  background: #fff; border: 1px solid #d5dce8; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
  color: #3a4252; line-height: 1.45; white-space: normal; text-align: left; }
p.tab-info { margin: -8px 0 8px; }
.notes-card { margin-bottom: 12px; }
.notes-card label.notes { display: flex; flex-direction: column; gap: 4px; color: #4a5263; margin-top: 6px; }
.notes-card textarea { font: inherit; padding: 6px 8px; border: 1px solid #c9cfdb; border-radius: 4px; resize: vertical; }
.notes-text { white-space: pre-wrap; margin: 0; }
.note-mark { margin-left: 6px; color: #8a93a6; cursor: help; }
