:root {
  --ink: #07090d;
  --navy: #091321;
  --surface: #10151d;
  --surface-2: #151c26;
  --line: #2b3441;
  --text: #f7f9fc;
  --muted: #929dab;
  --blue: #2563eb;
  --blue-soft: rgba(37, 99, 235, 0.14);
  --green: #42c98c;
  --orange: #f4a340;
  --red: #f05d69;
  --heading: "Inter Tight", sans-serif;
  --body: "DM Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  color-scheme: dark;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

.login[hidden],
.dashboard[hidden],
.dialog[hidden],
.empty[hidden] {
  display: none !important;
}

.eyebrow {
  display: block;
  color: #8290a1;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

/* Accesso */
.login {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 96% 0%, rgba(37, 99, 235, 0.17), transparent 35%),
    var(--ink);
}

.login-panel {
  min-height: 100dvh;
  max-width: 620px;
  margin: 0 auto;
  padding: 24px clamp(22px, 6vw, 46px) 28px;
  display: flex;
  flex-direction: column;
}

.login-brand,
.side-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  font-family: var(--heading);
  font-weight: 700;
}

.login-brand img,
.side-brand img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.login-brand span {
  font-size: 1.05rem;
}

.login-panel > div {
  margin: auto 0 34px;
}

.login-panel h1 {
  margin: 16px 0 14px;
  max-width: 540px;
  font-family: var(--heading);
  font-size: clamp(3.1rem, 14vw, 5rem);
  line-height: 0.88;
  letter-spacing: -0.065em;
}

.login-panel h1 em {
  color: var(--blue);
  font-style: normal;
}

.login-panel > div p {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.login-panel form {
  display: grid;
  gap: 12px;
}

.login-panel label,
.dialog-card label {
  display: grid;
  gap: 9px;
  color: #dce2ea;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-panel input,
.dialog-card input,
.dialog-card select,
.tools input,
.tools select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-panel input {
  min-height: 58px;
  padding: 0 18px;
  font-size: 1rem;
  font-weight: 600;
}

.login-panel input:focus,
.dialog-card input:focus,
.dialog-card select:focus,
.tools input:focus,
.tools select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.login-panel input::placeholder,
.tools input::placeholder {
  color: #6f7b8b;
}

.login-panel form > button,
.primary {
  min-height: 58px;
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  color: white;
  font-family: var(--heading);
  font-size: 1rem;
  font-weight: 700;
}

.login-panel form > button:active,
.primary:active {
  transform: translateY(1px);
}

.login-error {
  display: none;
  margin: -2px 0 0;
  color: #ff8992;
  font-size: 0.86rem;
}

.login-error.is-visible {
  display: block;
}

.login-panel small {
  margin-top: 22px;
  color: #687484;
  font-size: 0.76rem;
  line-height: 1.5;
}

.login-image {
  display: none;
}

/* Pannello */
.dashboard {
  min-height: 100dvh;
  background: #0b0e13;
}

.dashboard:not([hidden]) {
  display: block;
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  height: 74px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.94);
  backdrop-filter: blur(16px);
}

.side-brand {
  margin-right: auto;
}

.side-brand img {
  width: 46px;
  height: 46px;
}

.side-brand span {
  font-size: 0.95rem;
  line-height: 1;
}

.sidebar nav {
  display: none;
}

.back-site {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #c5ccd5;
  font-size: 0.78rem;
  font-weight: 600;
}

.dashboard main {
  padding: 106px 18px 48px;
}

.dashboard main > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dashboard main > header h1 {
  margin: 8px 0 4px;
  font-family: var(--heading);
  font-size: clamp(2.5rem, 12vw, 4.7rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.dashboard main > header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.logout {
  min-width: 58px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: #c5ccd5;
  font-size: 0.78rem;
  font-weight: 700;
}

.stats {
  margin: 30px 0 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stats article {
  position: relative;
  min-height: 126px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.stats article:last-child {
  grid-column: 1 / -1;
}

.stats span {
  display: block;
  max-width: 150px;
  color: #8894a3;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.stats strong {
  display: block;
  margin-top: 16px;
  font-family: var(--heading);
  font-size: 2.35rem;
  line-height: 1;
}

.stats i {
  position: absolute;
  right: -16px;
  bottom: -20px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--blue-soft);
}

.requests-section {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
}

.section-head {
  padding: 20px 18px;
  display: grid;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0 0 4px;
  font-family: var(--heading);
  font-size: 1.4rem;
  letter-spacing: -0.025em;
}

.section-head > div > span {
  color: var(--muted);
  font-size: 0.84rem;
}

.tools {
  display: grid;
  gap: 9px;
}

.tools input,
.tools select {
  min-height: 48px;
  padding: 0 14px;
  font-size: 0.88rem;
}

.tools select {
  color: #d6dce4;
}

.request-list {
  display: grid;
}

.request-card {
  padding: 22px 18px;
  border-bottom: 1px solid var(--line);
}

.request-card:last-child {
  border-bottom: 0;
}

.request-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.request-id,
.request-detail > span {
  color: #7f8b9a;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.request-top h3 {
  margin: 5px 0 3px;
  font-family: var(--heading);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.created {
  color: var(--muted);
  font-size: 0.77rem;
}

.status {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}

.status--pending {
  background: rgba(244, 163, 64, 0.13);
  color: #ffc273;
}

.status--confirmed {
  background: rgba(66, 201, 140, 0.13);
  color: #7ae3b1;
}

.status--alternative {
  background: var(--blue-soft);
  color: #8fb2ff;
}

.status--rejected {
  background: rgba(240, 93, 105, 0.13);
  color: #ff929b;
}

.request-grid {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}

.request-detail {
  padding: 15px;
  border-radius: 13px;
  background: var(--surface-2);
}

.request-detail strong,
.request-detail p {
  display: block;
  margin: 7px 0 0;
  color: #e8ecf2;
  font-size: 0.9rem;
  line-height: 1.5;
}

.request-detail p {
  color: #aeb7c3;
}

.request-photos {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.request-photos img {
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
  border-radius: 11px;
  object-fit: cover;
  cursor: pointer;
}

.actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions button,
.actions a {
  min-height: 42px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: #e4e9f0;
  font-size: 0.76rem;
  font-weight: 700;
}

.actions .confirm {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.actions .reject {
  color: #ff8992;
}

.empty {
  padding: 55px 24px;
  text-align: center;
}

.empty span {
  display: block;
  width: 34px;
  height: 4px;
  margin: 0 auto 20px;
  border-radius: 4px;
  background: var(--blue);
}

.empty h3 {
  margin: 0 0 6px;
  font-family: var(--heading);
  font-size: 1.25rem;
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Dialogo */
.dialog {
  position: fixed;
  z-index: 50;
  inset: 0;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgba(2, 5, 9, 0.8);
  backdrop-filter: blur(10px);
}

.dialog-card {
  position: relative;
  width: min(100%, 470px);
  padding: 28px 22px 22px;
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
}

.dialog-card h2 {
  margin: -2px 0 -8px;
  font-family: var(--heading);
  font-size: 1.75rem;
}

.dialog-card > p {
  margin: 0 0 4px;
  color: var(--muted);
  line-height: 1.55;
}

.dialog-card input,
.dialog-card select {
  min-height: 52px;
  padding: 0 14px;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: white;
  font-size: 1.2rem;
}

.photo-lightbox {
  position: fixed;
  z-index: 60;
  inset: 0;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.92);
}

.photo-lightbox img {
  max-width: min(100%, 1100px);
  max-height: 88dvh;
  border-radius: 14px;
}

.photo-lightbox button {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: #12161c;
  color: white;
  font-size: 1.35rem;
}

@media (min-width: 720px) {
  .dashboard main {
    padding: 116px 32px 60px;
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats article:last-child {
    grid-column: auto;
  }

  .section-head {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 22px;
  }

  .tools {
    grid-template-columns: minmax(240px, 1fr) 180px;
  }

  .request-card {
    padding: 26px 22px;
  }

  .request-grid {
    grid-template-columns: 0.9fr 1.1fr 1.5fr;
  }
}

@media (min-width: 980px) {
  .login {
    height: 100dvh;
    display: grid;
    grid-template-columns: minmax(540px, 0.9fr) 1.1fr;
    overflow: hidden;
  }

  .login-panel {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    max-width: 680px;
    padding: 44px 7vw 48px;
  }

  .login-panel > div {
    margin-bottom: 42px;
  }

  .login-panel h1 {
    font-size: clamp(4rem, 6vw, 6.4rem);
  }

  .login-image {
    position: relative;
    display: block;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .login-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--ink), transparent 26%), linear-gradient(0deg, rgba(0, 0, 0, 0.5), transparent 50%);
  }

  .login-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .login-image span {
    position: absolute;
    z-index: 1;
    right: 42px;
    bottom: 38px;
    color: white;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.18em;
  }

  .dashboard:not([hidden]) {
    display: grid;
    grid-template-columns: 226px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    inset: 0 auto auto 0;
    height: 100dvh;
    padding: 28px 20px 24px;
    flex-direction: column;
    align-items: stretch;
    gap: 44px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: #080b10;
  }

  .side-brand {
    margin: 0;
  }

  .sidebar nav {
    display: grid;
    gap: 7px;
  }

  .sidebar nav button {
    min-height: 46px;
    padding: 0 14px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #8792a1;
    text-align: left;
    font-size: 0.88rem;
    font-weight: 700;
  }

  .sidebar nav button.is-active {
    background: var(--blue-soft);
    color: #a9c0ff;
  }

  .back-site {
    margin-top: auto;
    text-align: center;
  }

  .dashboard main {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 56px clamp(34px, 5vw, 74px) 72px;
  }

  .dashboard main > header h1 {
    font-size: 4.5rem;
  }

  .stats {
    margin: 40px 0 20px;
    gap: 14px;
  }

  .stats article {
    min-height: 150px;
    padding: 22px;
  }

  .stats strong {
    font-size: 3rem;
  }

  .requests-section {
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .login-panel,
  .dashboard main {
    animation: rise 420ms ease both;
  }

  @keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
