/* =============================================
   Login / imposta-password — card centrata
   ============================================= */
.auth-shell {
  min-height: calc(100vh - 80px);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 20px;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-title { font-size: 30px; margin: 10px 0 8px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
.auth-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-input {
  background: var(--black); border: 1px solid rgba(var(--on-surface-rgb),0.16); border-radius: 10px;
  padding: 12px 14px; color: var(--white); font-family: var(--font-body); font-size: 14.5px;
}
.auth-input:focus { outline: none; border-color: var(--orange); }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-error { color: #E65555; font-size: 13.5px; }
.auth-ok { color: #4FBE7A; font-size: 13.5px; }

/* =============================================
   Area profilo
   ============================================= */
.profile-avatar-row { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.profile-avatar { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(var(--on-surface-rgb),0.12); flex-shrink: 0; }
.profile-avatar-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--orange) 0%, var(--orange-dk) 100%);
  color: var(--white); font-family: var(--font-display); font-size: 28px; font-weight: 700;
}
.profile-avatar-btn { display: inline-flex; cursor: pointer; }

/* =============================================
   Area Super Admin
   ============================================= */
.admin-shell { padding-top: 8px; }

.admin-menu { display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0 30px; }
.admin-menu-item {
  display: flex; align-items: center; gap: 9px; appearance: none; cursor: pointer;
  padding: 11px 18px; border-radius: 12px; background: var(--black-2); border: 1px solid rgba(var(--on-surface-rgb),0.1);
  color: var(--muted); font-family: var(--font-body); font-size: 13.5px; font-weight: 700;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.admin-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.admin-menu-item:hover { color: var(--white); border-color: rgba(230,85,18,0.35); }
.admin-menu-item.active { color: #fff; background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dk) 100%); border-color: transparent; }
.admin-section { display: none; }
.admin-section.active { display: block; }
.admin-section-empty { text-align: center; padding: 70px 20px; color: var(--gray); }
.admin-section-empty h3 { color: var(--white); font-size: 16px; margin-bottom: 8px; }
.admin-section-empty p { max-width: 52ch; margin: 0 auto; font-size: 13.5px; }
.admin-section-empty code { font-size: 12px; }

.integration-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.integration-card { background: var(--black-2); border: 1px solid rgba(var(--on-surface-rgb),0.08); border-radius: 14px; padding: 20px; }
.integration-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.integration-mark { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12.5px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dk) 100%); }
.integration-status { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray); padding: 4px 9px; border-radius: 99px; background: rgba(var(--on-surface-rgb),0.06); }
.integration-card h4 { font-size: 14.5px; color: var(--white); margin: 0 0 5px; }
.integration-card p { font-size: 12px; color: var(--gray); margin: 0; }
.integration-card.add { display: flex; align-items: center; justify-content: center; border-style: dashed; color: var(--gray); cursor: pointer; min-height: 116px; font-family: var(--font-body); font-weight: 700; font-size: 13px; }
.integration-card.add:hover { border-color: var(--orange); color: var(--orange-lt); }

.kb-grid, .content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.kb-card, .content-card { display: block; background: var(--black-2); border: 1px solid rgba(var(--on-surface-rgb),0.08); border-radius: 14px; padding: 20px; text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.kb-card:hover, .content-card:hover { border-color: rgba(230,85,18,0.35); transform: translateY(-2px); }
.kb-card h4, .content-card h4 { font-size: 14.5px; color: var(--white); margin: 0 0 6px; }
.kb-card p, .content-card p { font-size: 12px; color: var(--gray); margin: 0; }
.content-card .tag { display: inline-block; margin-top: 10px; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--orange-lt); }

.admin-graph-layout { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 14px; }
.admin-graph-panel { position: relative; background: var(--black-2); border: 1px solid rgba(var(--on-surface-rgb), 0.12); border-radius: 12px; overflow: hidden; aspect-ratio: 1100 / 760; min-height: 380px; }
.admin-graph-svg { width: 100%; height: 100%; display: block; cursor: grab; color: var(--muted); }
.admin-graph-area-label { font: 700 11px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; fill: var(--gray); }
.admin-graph-edge { stroke: var(--gray); stroke-width: 1.3; opacity: 0.35; }
.admin-graph-edge.assumed-weak { opacity: 0.18; }
.admin-graph-edge[data-dimmed="true"] { opacity: 0.06; }
.admin-graph-edge[data-dimmed="false"] { stroke: var(--orange-lt); opacity: 0.9; }
.admin-graph-node-shape[data-selected="true"] { stroke: var(--orange-lt); stroke-width: 2.5; }
.admin-graph-sidebar { display: flex; flex-direction: column; gap: 12px; }
.admin-graph-side-block h3 { font: 700 11px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.admin-graph-empty { color: var(--muted); font-size: 13px; }
.admin-graph-badge-row { display: flex; gap: 6px; margin: 8px 0 10px; }
.admin-graph-badge { font: 700 10px var(--font-mono); padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(var(--on-surface-rgb), 0.18); color: var(--muted); }
.admin-graph-ref { font: 11px var(--font-mono); color: var(--muted); word-break: break-all; margin-bottom: 12px; }
.admin-graph-rel-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 6px; }
.admin-graph-rel-list, .admin-graph-problem-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.admin-graph-rel-item, .admin-graph-problem-item { display: flex; gap: 8px; width: 100%; text-align: left; background: transparent; border: 1px solid rgba(var(--on-surface-rgb), 0.12); color: var(--white); border-radius: 8px; padding: 7px 9px; font-size: 12px; cursor: pointer; }
.admin-graph-rel-item:hover, .admin-graph-problem-item:hover { border-color: var(--orange-lt); }
@media (max-width: 860px) { .admin-graph-layout { grid-template-columns: 1fr; } }

.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 28px; border-bottom: 1px solid rgba(var(--on-surface-rgb),0.1); }
.admin-tab {
  appearance: none; background: transparent; border: none; cursor: pointer;
  padding: 12px 6px; margin-right: 18px; font-family: var(--font-body); font-size: 14px; font-weight: 700;
  color: var(--muted); border-bottom: 2px solid transparent;
}
.admin-tab:hover { color: var(--white); }
.admin-tab.active { color: var(--orange); border-bottom-color: var(--orange); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-denied { text-align: center; padding: 80px 20px; }

.admin-block { margin-bottom: 32px; }
.admin-block h3 { font-size: 17px; margin-bottom: 4px; }
.admin-block .hint { color: var(--gray); font-size: 13px; margin-bottom: 14px; }

.admin-table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid rgba(var(--on-surface-rgb),0.08); }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--black-2); }
table.admin-table th, table.admin-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid rgba(var(--on-surface-rgb),0.06); white-space: nowrap; }
table.admin-table th { color: var(--gray); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; }
table.admin-table tr:last-child td { border-bottom: none; }
table.admin-table td.wrap { white-space: normal; }

.role-select, .status-select {
  background: var(--black); color: var(--white); border: 1px solid rgba(var(--on-surface-rgb),0.16);
  border-radius: 8px; padding: 6px 8px; font-size: 12.5px; font-family: var(--font-body);
}

.btn-sm { padding: 8px 16px; font-size: 11.5px; letter-spacing: 0.8px; }
.btn-danger { border-color: #C0392B; color: #E67E73; }
.btn-danger:hover { box-shadow: 0 0 24px rgba(192,57,43,0.35); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.avatar-mini { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 8px; background: rgba(var(--on-surface-rgb),0.08); }

.vis-grid-wrap { overflow-x: auto; }
table.vis-grid { border-collapse: collapse; background: var(--black-2); border-radius: 14px; overflow: hidden; border: 1px solid rgba(var(--on-surface-rgb),0.08); }
table.vis-grid th, table.vis-grid td { padding: 10px 16px; border-bottom: 1px solid rgba(var(--on-surface-rgb),0.06); text-align: center; font-size: 13px; }
table.vis-grid th:first-child, table.vis-grid td:first-child { text-align: left; color: var(--muted); }
table.vis-grid th { color: var(--gray); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }

.audit-list { display: flex; flex-direction: column; gap: 10px; }
.audit-row { display: flex; gap: 12px; align-items: baseline; padding: 12px 14px; background: var(--black-2); border: 1px solid rgba(var(--on-surface-rgb),0.08); border-radius: 12px; font-size: 13px; }
.audit-row time { color: var(--gray); font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap; }
.audit-row .audit-action { color: var(--orange-lt); font-weight: 700; }

.preview-select { margin-bottom: 18px; }
.preview-checklist { list-style: none; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.preview-checklist li { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--black-2); border-radius: 10px; border: 1px solid rgba(var(--on-surface-rgb),0.08); font-size: 13.5px; }
.preview-checklist .ok { color: #4FBE7A; }
.preview-checklist .no { color: #E67E73; }

.admin-empty { color: var(--gray); font-size: 13.5px; padding: 18px 0; }
.admin-toast { position: fixed; bottom: 24px; right: 24px; background: var(--black-2); border: 1px solid var(--orange); border-radius: 12px; padding: 14px 18px; font-size: 13.5px; box-shadow: 0 20px 44px rgba(0,0,0,0.5); transform: translateY(20px); opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 500; }
.admin-toast.show { transform: translateY(0); opacity: 1; }
