/* Portale Gestione Elisuperfici — foglio di stile unico */

:root {
  --navy-900: #0b1a2b;
  --navy-800: #12283f;
  --navy-700: #1b3a58;
  --navy-600: #27506f;
  --ink: #16202b;
  --ink-soft: #4a5a6a;
  --ink-faint: #7b8a99;
  --line: #dde5ec;
  --line-soft: #eef3f7;
  --bg: #f4f7fa;
  --surface: #ffffff;
  --accent: #d97706;
  --accent-soft: #fff5e6;
  --ok: #0f7b53;
  --ok-soft: #e6f5ef;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --danger: #b3261e;
  --danger-soft: #fdeceb;
  --info: #1b5f9e;
  --info-soft: #e8f1fa;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 8px 24px rgba(16, 32, 48, .06);
  --shadow-sm: 0 1px 2px rgba(16, 32, 48, .08);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 640; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--navy-600); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--ink-faint); }
code, .mono { font-family: var(--mono); font-size: .9em; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  background: var(--navy-900);
  color: #e8eef4;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.topbar-inner {
  max-width: 1360px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px; min-height: 62px;
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), #f59e0b);
  color: #2a1500; font-weight: 800; font-size: 1.05rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: .98rem; letter-spacing: -.01em; }
.brand-text small { color: #8fa6bb; font-size: .68rem; letter-spacing: .02em; }

.top-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.top-nav a {
  color: #b9cadb; padding: 7px 11px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
}
.top-nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.top-nav a.active { background: rgba(255,255,255,.13); color: #fff; }
.top-actions { display: flex; gap: 8px; }
.nav-toggle {
  display: none; background: none; border: 0; color: #cfe0ee; font-size: 1.3rem; cursor: pointer;
}

/* ----------------------------------------------------------------- shell */
.shell { max-width: 1360px; margin: 0 auto; padding: 26px 20px 60px; display: flex; gap: 26px; }
.shell.no-side .main { width: 100%; }
.main { flex: 1; min-width: 0; }

.sidebar { width: 224px; flex: 0 0 224px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; }
.side-nav a {
  padding: 9px 12px; border-radius: var(--radius-sm); color: var(--ink-soft);
  font-size: .9rem; font-weight: 500;
}
.side-nav a:hover { background: #e9eff5; color: var(--ink); text-decoration: none; }
.side-nav a.active { background: var(--navy-800); color: #fff; }
.user-box {
  margin-top: 18px; padding: 13px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); position: sticky; top: 340px;
}
.user-meta { display: flex; flex-direction: column; margin-bottom: 9px; }
.user-meta strong { font-size: .9rem; }
.user-meta span { font-size: .74rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }

/* ------------------------------------------------------------- page head */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-sub { color: var(--ink-soft); margin: 0; font-size: .93rem; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: .82rem; color: var(--ink-faint); margin-bottom: 10px; }
.breadcrumb em { font-style: normal; opacity: .5; margin: 0 2px; }

/* ------------------------------------------------------------------ card */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap;
}
.card-head h2 { margin: 0; font-size: 1rem; }
.card-sub { margin: 2px 0 0; font-size: .82rem; color: var(--ink-faint); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-body > :last-child { margin-bottom: 0; }
.card.flush .card-body { padding: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ------------------------------------------------------------------ stat */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; display: flex; flex-direction: column; gap: 1px;
}
.stat-value { font-size: 1.75rem; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.stat-hint { font-size: .78rem; color: var(--ink-soft); margin-top: 4px; }

/* ----------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th {
  font-size: .71rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint); font-weight: 620; background: #fafcfd; white-space: nowrap;
}
tbody tr:hover { background: #fbfdfe; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.compact th, table.compact td { padding: 6px 10px; }
.empty { color: var(--ink-faint); font-style: italic; padding: 8px 0; margin: 0; }

/* ----------------------------------------------------------------- badge */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .72rem;
  font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.badge-neutral { background: #eef2f6; color: var(--ink-soft); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* ----------------------------------------------------------------- alert */
.alert {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 15px;
  border-radius: var(--radius); margin-bottom: 18px; font-size: .9rem;
  border: 1px solid transparent;
}
.alert-icon {
  flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%; display: grid;
  place-items: center; font-size: .72rem; font-weight: 700; color: #fff; margin-top: 1px;
}
.alert-info { background: var(--info-soft); border-color: #cfe2f3; color: #14456f; }
.alert-info .alert-icon { background: var(--info); }
.alert-ok { background: var(--ok-soft); border-color: #c9e8da; color: #0b5c3e; }
.alert-ok .alert-icon { background: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: #f2ddb8; color: #7c3d06; }
.alert-warn .alert-icon { background: var(--warn); }
.alert-danger { background: var(--danger-soft); border-color: #f3cdca; color: #86201a; }
.alert-danger .alert-icon { background: var(--danger); }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: .875rem; font-weight: 560;
  cursor: pointer; text-decoration: none; font-family: inherit; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { text-decoration: none; background: #f6f9fb; border-color: #c9d6e1; }
.btn-primary { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); border-color: var(--navy-700); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #c26905; border-color: #c26905; }
.btn-danger { background: var(--surface); border-color: #e6bfbc; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: #eef2f6; border-color: transparent; }
.btn-small { padding: 4px 10px; font-size: .79rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.inline-form { display: inline; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ----------------------------------------------------------------- forms */
.form { max-width: 100%; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.field .req { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .9rem; font-family: inherit; color: var(--ink); background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(39,80,111,.1);
}
.field textarea { resize: vertical; }
.field small { display: block; margin-top: 4px; font-size: .77rem; }
.field-check label { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--ink); font-weight: 500; }
.field-check input { width: auto; }
.form-row { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-row-3 { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.form-actions {
  display: flex; gap: 10px; align-items: center; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--line-soft);
}
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
fieldset > legend {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 680;
  color: var(--navy-700); padding: 0; margin: 18px 0 12px; width: 100%;
  border-bottom: 1px solid var(--line-soft); padding-bottom: 6px;
}
fieldset:first-of-type > legend { margin-top: 0; }

.filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 18px; background: #fafcfd; border-bottom: 1px solid var(--line-soft);
}
.filters .field { margin-bottom: 0; min-width: 150px; }

/* ------------------------------------------------------------------ misc */
.dl { display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: 7px 18px; font-size: .89rem; margin: 0; }
.dl dt { color: var(--ink-faint); font-size: .8rem; padding-top: 1px; }
.dl dd { margin: 0; }
.pill-list { display: flex; gap: 6px; flex-wrap: wrap; }
.muted { color: var(--ink-faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
hr.sep { border: 0; border-top: 1px solid var(--line-soft); margin: 18px 0; }

.progress { height: 7px; background: #e8eef3; border-radius: 5px; overflow: hidden; margin-top: 7px; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: 5px; }
.progress.warn > span { background: var(--warn); }
.progress.danger > span { background: var(--danger); }

/* ------------------------------------------------------------------- hero */
.hero {
  background: linear-gradient(140deg, var(--navy-900) 0%, var(--navy-700) 62%, #2c5f80 100%);
  color: #fff; border-radius: 14px; padding: 40px 38px; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 320px; height: 320px;
  border-radius: 50%; background: radial-gradient(circle, rgba(217,119,6,.24), transparent 68%);
}
.hero h1 { font-size: 2rem; margin-bottom: .3em; position: relative; }
.hero p { color: #c6d8e7; max-width: 62ch; position: relative; margin-bottom: 1.2em; }
.hero .btn-row { position: relative; }
.hero .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.2); }
.hero .btn-accent { background: var(--accent); border-color: var(--accent); }
.hero .btn-accent:hover { background: #c26905; }

/* -------------------------------------------------------------- helipads */
.helipad-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); }
.helipad-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 9px; box-shadow: var(--shadow-sm);
  transition: box-shadow .14s, transform .14s;
}
.helipad-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.helipad-card h3 { margin: 0; font-size: 1rem; }
.helipad-card h3 a { color: var(--ink); }
.helipad-code {
  font-family: var(--mono); font-size: .74rem; background: var(--navy-900); color: #ffd899;
  padding: 2px 7px; border-radius: 4px; letter-spacing: .04em;
}
.helipad-meta { font-size: .83rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: 2px; }
.helipad-foot { margin-top: auto; padding-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

#map, .map-box { height: 460px; width: 100%; border-radius: var(--radius); z-index: 1; background: #dbe6ee; }
.map-mini { height: 260px; }
.leaflet-container { font: inherit; }

.embed-frame {
  width: 100%; height: 560px; border: 0; border-radius: var(--radius); background: #dbe6ee;
}
.embed-note { font-size: .8rem; color: var(--ink-faint); margin-top: 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a {
  padding: 9px 14px; font-size: .875rem; font-weight: 560; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--navy-800); border-bottom-color: var(--accent); }

.notice {
  border-left: 3px solid var(--info); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 13px 16px; margin-bottom: 12px; border-top: 1px solid var(--line);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.notice.livello-attenzione { border-left-color: var(--warn); }
.notice.livello-critico { border-left-color: var(--danger); }
.notice-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 5px; }
.notice-head h3 { margin: 0; font-size: .95rem; }
.notice-body { font-size: .89rem; color: var(--ink-soft); }
.notice-when { font-size: .77rem; color: var(--ink-faint); margin-top: 6px; }

/* ------------------------------------------------------------------ auth */
.auth-wrap { max-width: 430px; margin: 8vh auto; }
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 30px; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.35rem; }
.auth-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: .86rem; }

.error-body { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.error-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 40px; text-align: center; max-width: 440px; box-shadow: var(--shadow);
}
.error-code { font-size: 3.4rem; font-weight: 720; color: var(--navy-700); display: block; line-height: 1; }

/* --------------------------------------------------------------- landing */
/* Soglia del portale: nessun dato operativo, solo identità e accesso. */
body.landing { min-height: 100vh; background: #0a1826; overflow-x: hidden; }

.landing-bg { position: fixed; inset: 0; z-index: 0; }
.landing-bg svg { width: 100%; height: 100%; display: block; }

.landing-main {
  position: relative; z-index: 1; min-height: 100vh; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px 24px; gap: 34px;
}

.landing-card {
  width: 100%; max-width: 520px; text-align: center; color: #fff;
  background: rgba(10, 24, 38, .55);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px; padding: 44px 38px 38px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
  animation: landing-in .5s cubic-bezier(.2, .7, .3, 1) both;
}

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

.landing-mark { margin-bottom: 20px; line-height: 0; }
.landing-mark svg { filter: drop-shadow(0 4px 18px rgba(240, 161, 60, .34)); }

.landing-card h1 {
  font-size: 1.95rem; font-weight: 680; letter-spacing: -.02em;
  margin: 0 0 12px; color: #fff; text-wrap: balance;
}

.landing-claim {
  color: #c2d6e6; font-size: 1.02rem; line-height: 1.6;
  margin: 0 auto 30px; max-width: 40ch; text-wrap: balance;
}

.landing-actions { display: flex; gap: 13px; justify-content: center; flex-wrap: wrap; }

.landing-btn {
  flex: 1 1 180px; min-height: 56px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0 26px; border-radius: 11px;
  font-size: 1.06rem; font-weight: 650; letter-spacing: .01em;
  text-decoration: none; cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.landing-btn:hover { text-decoration: none; transform: translateY(-2px); }
.landing-btn:active { transform: translateY(0); }
.landing-btn:focus-visible { outline: 3px solid #ffd899; outline-offset: 3px; }

.landing-btn-primary {
  background: linear-gradient(140deg, #f0a13c, #d97706);
  color: #2a1500; border: 1px solid #f0a13c;
  box-shadow: 0 8px 24px rgba(217, 119, 6, .38);
}
.landing-btn-primary:hover { box-shadow: 0 12px 30px rgba(217, 119, 6, .5); color: #2a1500; }

.landing-btn-ghost {
  background: rgba(255, 255, 255, .1); color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
}
.landing-btn-ghost:hover { background: rgba(255, 255, 255, .18); color: #fff; }

.landing-note {
  margin: 26px 0 0; font-size: .85rem; line-height: 1.55; color: #90a9be;
  max-width: 44ch; margin-inline: auto;
}

.landing-card .alert { text-align: left; margin-bottom: 24px; }

.landing-foot {
  display: flex; gap: 8px 20px; flex-wrap: wrap; justify-content: center;
  align-items: center; font-size: .8rem; color: #7d94a8; text-align: center;
}
.landing-foot a { color: #9fb6c9; }

@media (max-width: 560px) {
  .landing-card { padding: 34px 24px 30px; border-radius: 16px; }
  .landing-card h1 { font-size: 1.6rem; }
  .landing-claim { font-size: .96rem; }
  .landing-btn { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .landing-card { animation: none; }
  .landing-btn:hover { transform: none; }
}

/* ---------------------------------------------------------------- footer */
.footer { background: var(--navy-900); color: #93a9bd; margin-top: 40px; padding: 28px 0; }
.footer-inner {
  max-width: 1360px; margin: 0 auto; padding: 0 20px; display: flex;
  justify-content: space-between; gap: 26px; flex-wrap: wrap; font-size: .83rem;
}
.footer strong { color: #e2ebf3; }
.footer p { max-width: 62ch; margin: 6px 0 0; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.footer-links a { color: #a9c0d4; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .shell { flex-direction: column; padding-top: 18px; }
  .sidebar { width: 100%; flex: 1 1 auto; }
  .side-nav { flex-direction: row; flex-wrap: wrap; position: static; }
  .user-box { position: static; }
  .top-nav { display: none; width: 100%; flex-direction: column; order: 3; padding-bottom: 10px; }
  body.nav-open .top-nav { display: flex; }
  .topbar-inner { flex-wrap: wrap; gap: 12px; }
  .nav-toggle { display: block; margin-left: auto; }
  .top-actions { order: 2; }
  .hero { padding: 28px 22px; }
  .hero h1 { font-size: 1.5rem; }
}

@media print {
  .topbar, .sidebar, .footer, .page-actions, .filters, .form-actions, .btn { display: none !important; }
  .shell { display: block; padding: 0; max-width: none; }
  .card { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
  body { background: #fff; font-size: 11px; }
  table { font-size: 10px; }
  a { color: #000; }
}
