:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% -10%, #2f3e74 0%, #0f1115 45%);
  color: #edf2ff;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  display: grid;
  place-items: center;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed;
  inset: auto -180px -160px auto;
  width: 560px;
  height: 560px;
  background: url('https://www.bollino.care/assets/img/farfalla_sfondo.svg') no-repeat center/contain;
  opacity: 0.12;
  pointer-events: none;
}
.card {
  width: min(460px, 94vw);
  background: linear-gradient(180deg, #1a2030, #151a26);
  border: 1px solid #2a3348;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  transition: width .25s ease;
}
.card.is-dashboard {
  width: min(980px, 95vw);
}
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid #28344f;
}
.brand-title { font-size: 1.05rem; font-weight: 800; letter-spacing: .3px; }
.brand-subtitle { color: #99afd4; font-size: .9rem; }
.logo-badge { display: flex; align-items: center; gap: 10px; color: #c8d8ff; }
.logo-badge img { width: 38px; height: 38px; filter: drop-shadow(0 6px 18px rgba(85,123,255,.45)); }
h1,h2,h3 { margin: 0 0 8px; }
.muted { color: #9fb0cc; margin: 0 0 16px; }

.login-view {
  display: grid;
  justify-items: center;
}
.auth-box {
  width: min(420px, 100%);
}
.hidden { display: none !important; }
.grid { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field { position: relative; display: grid; gap: 6px; }
label { font-size: .88rem; color: #b9c6de; }
input, select {
  width: 100%;
  border: 1px solid #33405c;
  background: #0f141e;
  color: #eaf0ff;
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: #6a8dff;
  box-shadow: 0 0 0 3px rgba(106,141,255,.2);
}
button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  background: linear-gradient(180deg,#4f74ff,#3e5fe0);
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
button::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 80%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  transform: skewX(-18deg);
}
button:hover::after { animation: btnShine .85s ease; }
button:disabled { opacity: .5; cursor: not-allowed; }
.secondary { background: #2a3550; }
.section { margin-top: 18px; padding-top: 16px; border-top: 1px solid #28334a; }
.result {
  margin-top: 14px;
  border: 1px solid #2f415f;
  background: linear-gradient(180deg, #101a2a, #0f141d);
  border-radius: 12px;
  padding: 14px;
}
.result.reveal {
  animation: popIn .35s ease;
  border-color: #4f6bdd;
  box-shadow: 0 0 0 1px rgba(79,107,221,.3), 0 14px 34px rgba(52,82,182,.2);
}
.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #25344f;
}
.result-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #d8ffe9;
  background: #1f6c45;
  box-shadow: inset 0 0 0 1px rgba(166,255,208,.25);
}
.result-title {
  font-weight: 700;
  color: #e9f1ff;
}
.result-subtitle {
  color: #9fb0cc;
  font-size: .86rem;
}
.meta { color: #c2d0ea; margin-top: 8px; font-size: .92rem; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.result-item {
  background: #0d1420;
  border: 1px solid #2a3550;
  border-radius: 9px;
  padding: 8px 10px;
}
.result-item-label {
  color: #8ea3ca;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.result-item-value {
  margin-top: 2px;
  color: #e8f0ff;
  font-weight: 600;
  word-break: break-word;
}
.result-item-full {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  background: #111725;
  border: 1px solid #33405c;
  border-radius: 10px;
  z-index: 20;
  box-shadow: 0 14px 28px rgba(0,0,0,.35);
}
.dropdown-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #202c46;
  background: transparent;
  color: #dde8ff;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 500;
}
.dropdown-item:last-child { border-bottom: 0; }
.dropdown-item:hover { background: #1a2440; }
.dropdown-empty { padding: 10px 12px; color: #8ca1c7; font-size: .9rem; }

.users-toolbar {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.users-list {
  margin-top: 8px;
  border: 1px solid #2a3348;
  border-radius: 10px;
  overflow: hidden;
}
.user-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #222c42;
  background: #101725;
}
.user-row:last-child { border-bottom: 0; }
.user-meta { color: #9fb0cc; font-size: .86rem; }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-actions button { padding: 7px 10px; font-size: .82rem; }
.danger { background: #9b3a50; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 20, 0.62);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 16px;
}
.modal-card {
  width: min(460px, 94vw);
  background: #131a28;
  border: 1px solid #2a3550;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #24314b;
  color: #e9f0ff;
  border: 1px solid #36476d;
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 220px;
  box-shadow: 0 14px 30px rgba(0,0,0,.4);
  animation: toastIn .24s ease;
  z-index: 70;
}
.toast.error { background: #4a1f2b; border-color: #84374b; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  from { transform: translateY(6px) scale(.99); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes btnShine {
  from { left: -120%; }
  to { left: 140%; }
}

@media (max-width: 860px) {
  .user-row {
    grid-template-columns: 1fr;
  }
  .user-actions {
    justify-content: flex-start;
  }
}
