/* =============================================================================
   Helix
   Stesso impianto visivo di WiLLMa/ad-platform (blocchi a campitura piena,
   niente gradienti tranne dove serve un accento), ripalettizzato sui colori
   del logo Helix (blu navy + verde) al posto di blu/rosa.
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=Manrope:wght@500;600;700;800&family=Montserrat:wght@500;600&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --blue: #2356b2;
  --blue-dark: #15316b;
  --green: #3c9c17;
  --green-light: #9be27a; /* solo per testo su superfici blu scure */
  --green-dark: #2f7d12;
  --ink: #0b1220;
  --slate: #57708a;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --border: #e1e8f0;

  --font-display: 'Archivo', 'Segoe UI', sans-serif;
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-wordmark: 'Montserrat', 'Segoe UI', sans-serif; /* lockup HELIX, come da marchio */

  --radius: 12px;
  --radius-sm: 8px;

  --accent-blue: #2356b2;
  --accent-green: #3c9c17;
  --accent-slate: #55708a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input { font-family: inherit; }

a { text-decoration: none; color: inherit; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--blue-dark);
  margin-bottom: 10px;
}

[hidden] { display: none !important; }

.view { width: 100vw; height: 100vh; }

.view:not([hidden]) { animation: view-in 0.55s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.view[hidden] { display: none !important; }

/* =============================================================================
   LOGIN VIEW
   ============================================================================= */

.view-login {
  display: grid;
  grid-template-columns: minmax(320px, 42%) 1fr;
}

.login-brand {
  position: relative;
  background: var(--blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-brand-inner {
  position: relative;
  z-index: 1;
  text-align: left;
  padding: 0 56px;
  color: #ffffff;
}

.brand-logo {
  width: 170px;
  height: auto;
  max-height: 90px;
  display: block;
  margin-bottom: 24px;
}

.brand-wordmark {
  font-family: var(--font-wordmark);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: #ffffff;
}

.brand-tagline {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 10px;
  color: rgba(255,255,255,0.95);
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 14px;
  max-width: 300px;
  margin: 0;
  color: rgba(255,255,255,0.88);
  line-height: 1.5;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 40px;
}

.login-form { width: 100%; max-width: 360px; }

.login-form h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.login-copy {
  color: var(--slate);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0 0 28px;
}

.field { display: block; margin-bottom: 16px; }

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #fbfcfe;
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(35, 86, 178, 0.14);
  background: #ffffff;
}

.login-error {
  background: #fdecf2;
  border: 1px solid #f6b8d1;
  color: #a30d52;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.btn-primary {
  width: 100%;
  padding: 13px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover { background: var(--green-dark); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.7; cursor: default; }

.btn-secondary {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--slate);
  background: #fbfcfe;
}

.btn-spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================================
   DASHBOARD VIEW — niente reparti/BU: topbar leggera + blocchi microservizio
   direttamente sotto il benvenuto.
   ============================================================================= */

.view-dashboard { display: flex; flex-direction: column; }

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-brand { display: flex; align-items: center; gap: 10px; }

.topbar-logo { width: auto; height: 32px; display: block; }

.topbar-wordmark {
  font-family: var(--font-wordmark);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12.5px;
  flex-shrink: 0;
}

.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-role { font-size: 11.5px; color: var(--slate); }

.btn-logout-top {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--slate);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-logout-top:hover { background: var(--bg); color: var(--ink); }

.dashboard-main-full {
  flex: 1;
  padding: 40px 48px 56px;
  overflow-y: auto;
}

.dashboard-header { margin: 0 0 32px; }

/* =============================================================================
   HERO + RICERCA — due pannelli saldati (navy + chiaro), la barra "parte" dalla
   meta' chiara. Stesso impianto di WiLLMa/ad-platform, qui senza il collasso
   drill-down (niente reparti da aprire) e con indice = lista microservizi.
   ============================================================================= */

.hero-row {
  display: flex;
  align-items: stretch;
  width: 100%;
  margin: 0 0 24px;
}

.welcome-panel {
  background: var(--blue-dark);
  border-radius: 20px 0 0 20px;
  padding: 34px 40px;
  min-width: 380px;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.015em;
  line-height: 1.08;
  color: #ffffff;
  margin: 0 0 12px;
}

.welcome-mark {
  font-family: var(--font-wordmark);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-light);
}

.welcome-copy {
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  line-height: 1.55;
  max-width: 42ch;
  margin: 0;
}

.search-panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left-width: 0;
  border-radius: 0 20px 20px 0;
  padding: 34px 40px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 16px 34px rgba(11, 18, 32, 0.08);
}

.search-lead {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 14px;
}

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 620px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(35, 86, 178, 0.14);
}

.search-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(11, 18, 32, 0.16);
  overflow: hidden;
  animation: search-in 0.15s ease;
}

@keyframes search-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  padding: 11px 16px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg); }

.search-result-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, var(--slate));
  color: var(--accent-fg, #ffffff);
}

.search-result-icon svg { width: 16px; height: 16px; }

.search-result-text { min-width: 0; }

.search-result-name { font-size: 13.5px; font-weight: 700; }

.search-result-path {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.search-empty { padding: 16px; font-size: 13px; color: var(--slate); }

@keyframes search-hit-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(35, 86, 178, 0); }
  30% { box-shadow: 0 0 0 6px rgba(35, 86, 178, 0.35); }
}

.block-card.search-hit { animation: search-hit-pulse 1.1s ease; }

.dashboard-sub { color: var(--slate); font-size: 14.5px; margin: 24px 0 0; }

.dashboard-header[hidden] { display: none !important; }

.drilldown-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 24px;
}

.drilldown-bar[hidden] {
  display: none !important;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.back-link:hover {
  background: var(--surface-hover, rgba(0,0,0,0.04));
  border-color: var(--slate);
}

.drilldown-title {
  display: none;
}

.blocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.block-card {
  position: relative;
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--accent, var(--slate));
  color: var(--ink);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.block-card:not(.is-locked):hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(11, 18, 32, 0.2);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state {
  grid-column: 1 / -1;
  color: var(--slate);
  font-size: 14.5px;
  line-height: 1.6;
  max-width: 46ch;
}

.block-icon { color: var(--accent-fg, var(--ink)); opacity: 0.9; margin-bottom: 14px; }

.block-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--accent-fg, var(--ink));
}

.block-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--accent-fg, var(--ink));
  margin: 0;
  flex: 1;
}

.block-cta {
  align-self: flex-start;
  margin-top: 18px;
  border: none;
  background: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-fg, var(--ink));
  cursor: pointer;
}

.block-cta svg { transition: transform 0.15s ease; }
.block-card:not(.is-locked):hover .block-cta svg { transform: translateX(3px); }

.block-card.is-locked,
.block-card.is-preview-only {
  background: color-mix(in srgb, var(--accent, var(--slate)) 14%, var(--bg));
}

.block-card.is-locked {
  cursor: default;
  pointer-events: none;
}

/* Microservizio non ancora collegato ma con landing/panoramica da mostrare:
   stesso grigio "non ancora reale" di is-locked, ma resta cliccabile. */
.block-card.is-preview-only { cursor: pointer; }

.block-card.is-locked .block-name, .block-card.is-preview-only .block-name,
.block-card.is-locked .block-desc, .block-card.is-preview-only .block-desc,
.block-card.is-locked .block-cta, .block-card.is-preview-only .block-cta { color: var(--slate); }

/* --accent-fg verificato AA contro il relativo --accent. */
.accent-blue  { --accent: var(--accent-blue);  --accent-fg: #ffffff; }
.accent-green { --accent: var(--accent-green); --accent-fg: #ffffff; }
.accent-slate { --accent: var(--accent-slate); --accent-fg: #ffffff; }

/* =============================================================================
   MICROSERVICE LANDING — pagina intermedia prima di "Accedi", stessa firma
   visiva dei "blocchi" (campitura piena), a piena larghezza.
   ============================================================================= */

.ms-landing {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 780px;
  margin: 0 auto;
}

.ms-hero {
  background: var(--accent, var(--slate));
  color: var(--accent-fg, var(--ink));
  border-radius: var(--radius);
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.ms-hero-icon { color: var(--accent-fg, var(--ink)); opacity: 0.9; margin-bottom: 16px; }
.ms-hero-icon svg { width: 40px; height: 40px; }

.ms-hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 32px;
  letter-spacing: -0.01em;
  margin: 2px 0 12px;
  color: var(--accent-fg, var(--ink));
}

.ms-hero-desc {
  font-size: 15.5px;
  line-height: 1.6;
  max-width: 56ch;
  margin: 0 auto;
  color: var(--accent-fg, var(--ink));
}

.ms-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 30px;
}

.ms-actions .btn-primary,
.ms-actions .btn-ghost {
  width: auto;
}

.btn-ghost {
  padding: 11px 18px;
  border: 1.5px solid color-mix(in srgb, var(--accent-fg, var(--ink)) 35%, transparent);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent-fg, var(--ink));
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-ghost:hover {
  background: color-mix(in srgb, var(--accent-fg, var(--ink)) 12%, transparent);
  border-color: var(--accent-fg, var(--ink));
}

.ms-overview {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 56px;
  animation: card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: 60ms;
}

.ms-overview .eyebrow { margin-bottom: 14px; }

.ms-overview-text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 68ch;
  margin: 0 0 22px;
}

.ms-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 68ch;
}

.ms-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.ms-step-num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--blue-dark);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ms-step-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  padding-top: 3px;
}



/* =============================================================================
   TOAST
   ============================================================================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  z-index: 50;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 860px) {
  .view-login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .dash-topbar { padding: 14px 20px; }
  .user-meta { display: none; }
  .dashboard-main-full { padding: 28px 20px 40px; }
  .welcome-title { font-size: 26px; }
  .hero-row { flex-direction: column; }
  .welcome-panel { min-width: 0; max-width: 100%; border-radius: 20px 20px 0 0; padding: 24px; }
  .search-panel { border-left-width: 1.5px; border-top-width: 0; border-radius: 0 0 20px 20px; padding: 24px; }
  .search-wrap { max-width: 100%; }
  .ms-hero, .ms-overview { padding: 28px 24px; }
  .ms-hero-title { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-spinner { animation: none; }
  .block-card { transition: none; animation: none; }
  .block-card:not(.is-locked):hover { transform: none; }
  .block-card:not(.is-locked):hover .block-cta svg { transform: none; }
  .block-card.search-hit { animation: none; }
  .search-results { animation: none; }
  .view:not([hidden]) { animation: none; }
  .ms-hero, .ms-overview { animation: none; }
}
