/*
  Orixon Identity - stile "dark glassmorphism", coerente con gli altri progetti Orixon.
  Foglio statico scritto a mano (nessuna build Node richiesta in produzione, §16).
*/

:root {
  --ox-bg: #0b0d14;
  --ox-bg-gradient: radial-gradient(circle at 20% -10%, #1e2a52 0%, transparent 45%),
                    radial-gradient(circle at 90% 10%, #3a1f52 0%, transparent 40%),
                    #0b0d14;
  --ox-surface: rgba(255, 255, 255, 0.06);
  --ox-surface-strong: rgba(255, 255, 255, 0.09);
  --ox-border: rgba(255, 255, 255, 0.12);
  --ox-text: #eef1f8;
  --ox-text-muted: #9aa3b8;
  --ox-accent: #7c8cff;
  --ox-accent-strong: #5c6dff;
  --ox-success: #34d399;
  --ox-error: #f87171;
  --ox-warning: #fbbf24;
  --ox-radius: 16px;
  --ox-radius-sm: 10px;
  --ox-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--ox-bg-gradient);
  color: var(--ox-text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--ox-accent); text-decoration: none; }
a:hover { color: var(--ox-accent-strong); }

.ox-nav {
  border-bottom: 1px solid var(--ox-border);
  background: rgba(11, 13, 20, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.ox-nav__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ox-nav__brand { font-weight: 700; font-size: 1.1rem; color: var(--ox-text); letter-spacing: 0.02em; }
.ox-nav__links { display: flex; gap: 20px; align-items: center; }
.ox-nav__links a { color: var(--ox-text-muted); font-weight: 500; }
.ox-nav__links a:hover { color: var(--ox-text); }

.ox-main { max-width: 1100px; margin: 0 auto; padding: 32px 24px 64px; }

.ox-footer { border-top: 1px solid var(--ox-border); margin-top: 48px; }
.ox-footer__inner { max-width: 1100px; margin: 0 auto; padding: 20px 24px; color: var(--ox-text-muted); font-size: 0.85rem; }

.ox-card {
  background: var(--ox-surface);
  border: 1px solid var(--ox-border);
  border-radius: var(--ox-radius);
  box-shadow: var(--ox-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 28px;
  margin-bottom: 24px;
}

.ox-card--auth {
  max-width: 420px;
  margin: 48px auto;
}

.ox-card h1, .ox-card h2 { margin-top: 0; }

.ox-form label { display: block; font-size: 0.85rem; color: var(--ox-text-muted); margin-bottom: 6px; margin-top: 16px; }
.ox-form label:first-child { margin-top: 0; }
.ox-form input, .ox-form select, .ox-form textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--ox-border);
  border-radius: var(--ox-radius-sm);
  color: var(--ox-text);
  font-size: 0.95rem;
}
.ox-form input:focus, .ox-form select:focus, .ox-form textarea:focus {
  outline: none;
  border-color: var(--ox-accent);
}

.ox-password-field { position: relative; }
.ox-password-field input { padding-right: 42px; }
.ox-password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--ox-text-muted); cursor: pointer; border-radius: 6px;
}
.ox-password-toggle:hover { color: var(--ox-text); background: rgba(255, 255, 255, 0.06); }
.ox-password-toggle svg { width: 18px; height: 18px; }
.ox-password-toggle .icon-eye-off { display: none; }
.ox-password-toggle.is-visible .icon-eye { display: none; }
.ox-password-toggle.is-visible .icon-eye-off { display: block; }
.ox-form small { display: block; color: var(--ox-text-muted); margin-top: 4px; font-size: 0.8rem; }

.ox-password-strength { display: none; align-items: center; gap: 10px; margin-top: 8px; }
.ox-password-strength.is-visible { display: flex; }
.ox-password-strength__bar { flex: 1; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ox-password-strength__bar span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width 0.2s ease, background-color 0.2s ease; }
.ox-password-strength__label { font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.ox-password-strength--weak .ox-password-strength__bar span { width: 33%; background: var(--ox-error); }
.ox-password-strength--weak .ox-password-strength__label { color: #fecaca; }
.ox-password-strength--medium .ox-password-strength__bar span { width: 66%; background: var(--ox-warning); }
.ox-password-strength--medium .ox-password-strength__label { color: #fde68a; }
.ox-password-strength--strong .ox-password-strength__bar span { width: 100%; background: var(--ox-success); }
.ox-password-strength--strong .ox-password-strength__label { color: #a7f3d0; }

.ox-info-tooltip { position: relative; display: inline-flex; align-items: center; color: var(--ox-text-muted); cursor: help; vertical-align: middle; margin-left: 2px; }
.ox-info-tooltip svg { width: 15px; height: 15px; }
.ox-info-tooltip:hover, .ox-info-tooltip:focus-within { color: var(--ox-accent); }
.ox-info-tooltip__bubble {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(4px);
  width: 240px; padding: 10px 12px; border-radius: var(--ox-radius-sm);
  background: #14161f; border: 1px solid var(--ox-border); box-shadow: var(--ox-shadow);
  color: var(--ox-text); font-size: 0.78rem; line-height: 1.45; font-weight: 400;
  opacity: 0; pointer-events: none; transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 20;
}
.ox-info-tooltip__bubble::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #14161f;
}
.ox-info-tooltip:hover .ox-info-tooltip__bubble, .ox-info-tooltip:focus-within .ox-info-tooltip__bubble {
  opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0);
}

.ox-btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--ox-radius-sm);
  border: 1px solid var(--ox-border);
  background: var(--ox-surface-strong);
  color: var(--ox-text);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}
.ox-btn:hover { border-color: var(--ox-accent); color: var(--ox-text); }
.ox-btn--primary { background: linear-gradient(135deg, var(--ox-accent), var(--ox-accent-strong)); border: none; }
.ox-btn--danger { background: rgba(248, 113, 113, 0.15); border-color: rgba(248, 113, 113, 0.4); color: #fecaca; }
.ox-btn--block { display: block; width: 100%; margin-top: 20px; }
.ox-btn--sm { padding: 6px 12px; font-size: 0.85rem; }

.ox-flash-stack { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.ox-flash { padding: 12px 16px; border-radius: var(--ox-radius-sm); border: 1px solid var(--ox-border); font-size: 0.9rem; }
.ox-flash--success { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.35); color: #a7f3d0; }
.ox-flash--error { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }
.ox-flash--info { background: rgba(124, 140, 255, 0.12); border-color: rgba(124, 140, 255, 0.35); color: #c7d2ff; }

.ox-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--ox-text-muted); font-size: 0.8rem; }
.ox-divider::before, .ox-divider::after { content: ''; flex: 1; height: 1px; background: var(--ox-border); }

.ox-social-list { display: flex; flex-direction: column; gap: 10px; }

.ox-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ox-table th, .ox-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ox-border); }
.ox-table th { color: var(--ox-text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

.ox-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; border: 1px solid var(--ox-border); }
.ox-badge--pending { color: #fde68a; border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.12); }
.ox-badge--approved, .ox-badge--active, .ox-badge--synced { color: #a7f3d0; border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.12); }
.ox-badge--rejected, .ox-badge--suspended, .ox-badge--revoked, .ox-badge--sync_error, .ox-badge--failed { color: #fecaca; border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.12); }
.ox-badge--draft, .ox-badge--not_synced, .ox-badge--queued, .ox-badge--syncing, .ox-badge--retrying, .ox-badge--processing { color: #c7d2ff; border-color: rgba(124, 140, 255, 0.4); background: rgba(124, 140, 255, 0.12); }
.ox-badge--completed { color: #a7f3d0; border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.12); }

.ox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.ox-stat { text-align: center; }
.ox-stat__value { font-size: 2rem; font-weight: 700; }
.ox-stat__label { color: var(--ox-text-muted); font-size: 0.85rem; }

.ox-secret-reveal {
  font-family: 'Consolas', 'SF Mono', monospace;
  background: rgba(0, 0, 0, 0.35);
  padding: 12px 14px;
  border-radius: var(--ox-radius-sm);
  border: 1px solid var(--ox-border);
  word-break: break-all;
  user-select: all;
}

.ox-muted { color: var(--ox-text-muted); }
.ox-mt-0 { margin-top: 0; }
.ox-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* --- Shell a sidebar (dashboard, account, partner, admin) ------------------------- */

.ox-shell { display: flex; align-items: flex-start; min-height: 100vh; }

.ox-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #08090d;
  border-right: 1px solid var(--ox-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.ox-sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; }
.ox-sidebar__brand-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--ox-accent), var(--ox-accent-strong));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 0.95rem;
}
.ox-sidebar__brand-text strong { display: block; font-size: 0.92rem; letter-spacing: 0.03em; color: var(--ox-text); }
.ox-sidebar__brand-text span { display: block; font-size: 0.62rem; letter-spacing: 0.14em; color: var(--ox-text-muted); text-transform: uppercase; margin-top: 1px; }
.ox-sidebar__brand { position: relative; }
.ox-sidebar__close { display: none; }

.ox-sidebar__nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.ox-sidebar__section { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ox-text-muted); padding: 16px 12px 6px; }
.ox-sidebar__section:first-child { padding-top: 6px; }

.ox-sidebar__link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: 10px;
  color: var(--ox-text-muted);
  font-size: 0.87rem; font-weight: 500;
}
.ox-sidebar__link svg { width: 17px; height: 17px; flex-shrink: 0; }
.ox-sidebar__link:hover { background: rgba(255, 255, 255, 0.04); color: var(--ox-text); }
.ox-sidebar__link.is-active { background: rgba(124, 140, 255, 0.14); color: #c7d2ff; }

.ox-sidebar__footer { border-top: 1px solid var(--ox-border); padding: 14px 20px; }
.ox-sidebar__user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
.ox-sidebar__user span { font-size: 0.8rem; color: var(--ox-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ox-sidebar__logout { display: flex; align-items: center; gap: 8px; color: var(--ox-text-muted); font-size: 0.85rem; }
.ox-sidebar__logout svg { width: 16px; height: 16px; }
.ox-sidebar__logout:hover { color: #fecaca; }

.ox-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--ox-accent), #a78bfa);
}
.ox-avatar--lg { width: 52px; height: 52px; }

.ox-content { flex: 1; min-width: 0; padding: 32px 40px 64px; }
.ox-content--flash { margin-bottom: 20px; }

.ox-content__header {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 24px; margin-bottom: 8px;
  border-bottom: 1px solid var(--ox-border);
}
.ox-content__header h1 { margin: 0; font-size: 1.3rem; }
.ox-content__header p { margin: 2px 0 0; color: var(--ox-text-muted); font-size: 0.9rem; }

.ox-section-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ox-text-muted); margin: 28px 0 14px; }
.ox-section-title:first-of-type { margin-top: 20px; }

.ox-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.ox-tile { position: relative; display: block; background: var(--ox-surface); border: 1px solid var(--ox-border); border-radius: 16px; padding: 20px; }
.ox-tile:hover { border-color: rgba(124, 140, 255, 0.4); }
.ox-tile__icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; color: #fff; }
.ox-tile__icon svg { width: 20px; height: 20px; }
.ox-tile h3 { margin: 0 0 6px; font-size: 0.95rem; color: var(--ox-text); }
.ox-tile p { margin: 0; font-size: 0.82rem; color: var(--ox-text-muted); line-height: 1.4; }
.ox-tile__badge {
  position: absolute; top: 16px; right: 16px;
  background: rgba(124, 140, 255, 0.16); color: #c7d2ff;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase;
}

.ox-icon-bg--purple { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.ox-icon-bg--pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.ox-icon-bg--teal { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.ox-icon-bg--gray { background: #3a3d46; }
.ox-icon-bg--green { background: linear-gradient(135deg, #34d399, #059669); }
.ox-icon-bg--indigo { background: linear-gradient(135deg, #6366f1, #4338ca); }
.ox-icon-bg--amber { background: linear-gradient(135deg, #fbbf24, #d97706); }
.ox-icon-bg--red { background: linear-gradient(135deg, #f87171, #dc2626); }
.ox-icon-bg--blue { background: linear-gradient(135deg, #60a5fa, #2563eb); }

/* --- Menu mobile (hamburger, off-canvas) ------------------------------------------ */

.ox-mobile-topbar { display: none; }
.ox-sidebar-backdrop { display: none; }

@media (max-width: 860px) {
  .ox-shell { display: block; }

  .ox-mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--ox-border);
    position: sticky; top: 0; z-index: 60;
    background: rgba(11, 13, 20, 0.92); backdrop-filter: blur(8px);
  }
  .ox-mobile-topbar__toggle {
    width: 38px; height: 38px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--ox-surface); border: 1px solid var(--ox-border); border-radius: 10px;
    color: var(--ox-text);
  }
  .ox-mobile-topbar__toggle svg { width: 19px; height: 19px; }
  .ox-mobile-topbar__brand { font-weight: 700; font-size: 0.88rem; letter-spacing: 0.04em; color: var(--ox-text); }

  .ox-sidebar {
    position: fixed; top: 0; left: 0; z-index: 90;
    width: 280px; max-width: 84vw; height: 100vh;
    flex-direction: column; flex-wrap: nowrap;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
  }
  .ox-sidebar.is-open { transform: translateX(0); }

  .ox-sidebar__close {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 16px; right: 14px;
    width: 30px; height: 30px; border-radius: 8px;
    background: transparent; border: 1px solid var(--ox-border); color: var(--ox-text-muted);
  }
  .ox-sidebar__close svg { width: 16px; height: 16px; }

  .ox-sidebar__nav { display: block; padding: 4px 12px 12px; }
  .ox-sidebar__section { display: block; }
  .ox-sidebar__link { padding: 10px 12px; }
  .ox-sidebar__footer { display: block; }

  .ox-sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 85;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
  }
  .ox-sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }

  .ox-content { padding: 20px 16px 48px; }
}

/* --- Scrollbar coerente col tema dark, desktop e mobile --------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 140, 255, 0.4) transparent;
}
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(124, 140, 255, 0.35);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(124, 140, 255, 0.6); background-clip: padding-box; }

/* Estensione v2 */

.ox-impersonation-banner {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: linear-gradient(90deg, #d97706, #b45309);
  color: #fff7ed;
  font-size: 0.88rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
.ox-impersonation-banner strong { font-weight: 700; }
.ox-impersonation-banner form { margin: 0; }
.ox-impersonation-banner__end {
  padding: 5px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.15); color: #fff7ed; font-weight: 600; font-size: 0.82rem;
  cursor: pointer;
}
.ox-impersonation-banner__end:hover { background: rgba(0, 0, 0, 0.3); }

.ox-health-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.ox-health-dot--ok { background: var(--ox-success); }
.ox-health-dot--error { background: var(--ox-error); }
.ox-health-dot--stale { background: var(--ox-warning); }

.ox-notes-list { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; max-height: 360px; overflow-y: auto; }
.ox-note { background: var(--ox-surface-strong); border: 1px solid var(--ox-border); border-radius: var(--ox-radius-sm); padding: 10px 14px; }
.ox-note__meta { font-size: 0.78rem; color: var(--ox-text-muted); margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
.ox-note__body { white-space: pre-wrap; font-size: 0.92rem; }

.ox-wizard-steps { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.ox-wizard-step {
  padding: 6px 14px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background: var(--ox-surface); color: var(--ox-text-muted); border: 1px solid var(--ox-border);
}
.ox-wizard-step.is-active { background: var(--ox-accent); color: #fff; border-color: var(--ox-accent); }
.ox-wizard-step.is-done { color: var(--ox-success); border-color: var(--ox-success); }

.ox-type-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 16px 0; }
.ox-type-choice label {
  display: block; padding: 16px; border-radius: var(--ox-radius-sm); border: 1px solid var(--ox-border);
  background: var(--ox-surface); cursor: pointer;
}
.ox-type-choice input { margin-right: 8px; }
.ox-type-choice input:checked ~ .ox-type-choice__title { color: var(--ox-accent); }

/* --- Newsletter (estensione v4, §4) ----------------------------------------------- */

.ox-newsletter-topic {
  display: block; padding: 16px; border-radius: var(--ox-radius-sm); border: 1px solid var(--ox-border);
  background: var(--ox-surface); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
}
.ox-newsletter-topic input { position: absolute; opacity: 0; pointer-events: none; }
.ox-newsletter-topic:has(input:checked) { border-color: var(--ox-accent); background: rgba(124, 140, 255, 0.1); }

.ox-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ox-modal[hidden] { display: none; }
.ox-modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.ox-modal__dialog { position: relative; z-index: 1; max-width: 480px; width: 100%; }

.ox-code-block {
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--ox-border); border-radius: var(--ox-radius-sm);
  padding: 14px; overflow-x: auto; font-size: 0.85rem; line-height: 1.5; cursor: pointer;
}
.ox-code-block code { color: var(--ox-text); }
