:root {
  color-scheme: light dark;

  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --text-muted: #71717a;

  --accent: #0284c7;
  --accent-soft: #e0f2fe;
  --accent-contrast: #ffffff;
  --accent-2: #16a34a;
  --accent-2-soft: #ecfdf3;
  --danger: #dc2626;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 26px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 28px -14px rgba(0, 0, 0, .12);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .05), 0 30px 60px -24px rgba(2, 132, 199, .3);

  --gap: 1.25rem;
  --maxw: 960px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --surface: #18181b;
    --border: #2a2a2e;
    --text: #f4f4f5;
    --text-muted: #a1a1aa;

    --accent: #38bdf8;
    --accent-soft: #0c2b3a;
    --accent-contrast: #04202e;
    --accent-2: #4ade80;
    --accent-2-soft: #0b2a17;

    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 28px -14px rgba(0, 0, 0, .7);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .6), 0 30px 60px -24px rgba(56, 189, 248, .35);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding-inline: 1.25rem;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

header {
  max-width: var(--maxw);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-block: 1.75rem 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}

.brand h1 {
  margin: 0;
}

h1 {
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

main {
  max-width: var(--maxw);
  margin-inline: auto;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  padding-bottom: 3rem;
}

section {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 420px;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

input,
button {
  font: inherit;
}

input {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  transition: border-color .15s, box-shadow .15s;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button {
  font-weight: 600;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  cursor: pointer;
  align-self: flex-start;
  transition: opacity .15s, transform .05s;
}

button:hover {
  opacity: 0.9;
}

button:active {
  transform: scale(0.98);
}

nav a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

#status.error {
  color: var(--danger);
}

/* Pagina di benvenuto */
body.landing {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px circle at 10% -12%, var(--accent-soft) 0%, transparent 55%),
    radial-gradient(800px circle at 108% 15%, var(--accent-2-soft) 0%, transparent 50%),
    var(--bg);
}

.hero {
  /* min-width: 0 evita che il logo/testo dentro .hero-card forzi .hero - flex item
     diretto di body.landing - a espandersi oltre il viewport su schermi stretti. */
  min-width: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.hero-card {
  min-width: 0;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.25rem 2.5rem;
}

.hero-logo {
  width: 190px;
  max-width: 65%;
  height: auto;
  margin-bottom: 0.75rem;
}

.hero-card h1 {
  font-size: 1.5rem;
}

.hero-tagline {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 2.75rem;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 10px 24px -10px rgba(2, 132, 199, .55);
  transition: opacity .15s, transform .05s;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-primary:active {
  transform: scale(0.97);
}

@media (max-width: 640px) {
  body {
    padding-inline: 1rem;
  }

  section {
    padding: 1.1rem;
    border-radius: var(--radius-sm);
  }

  form {
    max-width: none;
  }

  button {
    width: 100%;
  }

  .hero-card {
    padding: 2.5rem 1.5rem 2rem;
  }
}
