@charset "utf-8";
/* Pannello di amministrazione — foglio di stile autonomo, leggero. */

:root {
  --bg:      #f4f6f8;
  --surface: #fff;
  --fg:      #17242e;
  --soft:    #5d6b76;
  --line:    #e2e8ed;
  --sea:     #0e7c9b;
  --sea-dk:  #073f52;
  --sun:     #f2b705;
  --red:     #b3352c;
  --green:   #17795e;
  --radius:  12px;
  --shadow:  0 1px 2px #0f172a12, 0 8px 24px -14px #0f172a3d;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a21; --surface: #16272f; --fg: #e9f1f4; --soft: #9db0ba;
    --line: #24404e; --shadow: 0 1px 2px #0006, 0 10px 30px -18px #000a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 "Inter", system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; border-radius: 4px; }

/* ----------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
@media (width < 60rem) { .shell { grid-template-columns: 1fr; } }

.side {
  background: var(--sea-dk); color: #dbe9ee;
  display: flex; flex-direction: column; gap: 1.2rem;
  padding: 1.2rem 1rem;
  position: sticky; top: 0; height: 100vh;
}
@media (width < 60rem) { .side { position: static; height: auto; } }

.side__brand { display: flex; align-items: center; gap: .7rem; padding: .3rem .4rem 1rem; border-bottom: 1px solid #ffffff1f; }
.side__brand img { height: 38px; width: auto; }
.side__brand span { font-weight: 700; line-height: 1.2; }
.side__brand small { display: block; font-weight: 400; font-size: .72rem; color: #8fb6c4; }

.side__nav { display: grid; gap: .15rem; }
.side__nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .7rem; border-radius: 9px;
  font-size: .92rem; color: #cfe2e9;
  transition: background .2s, color .2s;
}
.side__nav a:hover { background: #ffffff14; color: #fff; }
.side__nav a[aria-current="page"] { background: var(--sea); color: #fff; font-weight: 600; }
.side__nav .badge {
  margin-left: auto; background: var(--sun); color: #402f00;
  font-size: .7rem; font-weight: 700; padding: .1rem .42rem; border-radius: 99px;
}

.side__foot {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; color: #9fc0cc; border-top: 1px solid #ffffff1f; padding-top: .9rem;
}
.side__foot a { color: var(--sun); font-weight: 600; }

.main { padding: clamp(1rem, .5rem + 2vw, 2.2rem); min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.topbar h1 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem); font-weight: 700; letter-spacing: -.02em; }

/* ------------------------------------------------------------ componenti */
.flash {
  padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1.2rem;
  font-size: .92rem; font-weight: 500;
  background: color-mix(in oklab, var(--green) 14%, var(--surface)); color: var(--green);
  border: 1px solid color-mix(in oklab, var(--green) 30%, transparent);
}
.flash--err { background: color-mix(in oklab, var(--red) 12%, var(--surface)); color: var(--red);
              border-color: color-mix(in oklab, var(--red) 30%, transparent); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.3rem;
}
.card + .card { margin-top: 1.1rem; }
.card > h2 { font-size: 1.05rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.card__hint { font-size: .85rem; color: var(--soft); margin-bottom: 1rem; }

.grid { display: grid; gap: 1.1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.9rem; line-height: 1.1; color: var(--sea); }
.stat span { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); }

/* form */
.lbl { display: block; font-size: .76rem; font-weight: 600; letter-spacing: .06em;
       text-transform: uppercase; color: var(--soft); margin-bottom: .35rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=date], select, textarea {
  width: 100%; padding: .6rem .75rem;
  background: var(--bg); color: var(--fg);
  border: 1.5px solid var(--line); border-radius: 9px;
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 5rem; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--sea);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--sea) 18%, transparent);
}
.field { margin-bottom: 1rem; }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); }

.check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.check input { width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .58rem 1.1rem; border-radius: 9px;
  background: var(--sea); color: #fff; font-weight: 600; font-size: .9rem;
  transition: filter .2s, transform .2s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--ghost:hover { background: var(--bg); }
.btn--danger { background: var(--red); }
.btn--sm { padding: .35rem .7rem; font-size: .8rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

/* Submit predefinito: raggiungibile con Invio, invisibile alla vista.
   Deve restare il PRIMO submit del form (vedi form_open()). */
.default-submit {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); border: 0;
}

/* Barra di salvataggio appiccicata in fondo alla finestra */
.savebar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: flex-end; gap: 1rem;
  margin-top: 1.2rem; padding: .85rem 1.1rem;
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 -6px 24px -16px #0f172a66, var(--shadow);
  transition: border-color .25s, background .25s;
}
.savebar.is-dirty {
  border-color: var(--sea);
  background: color-mix(in oklab, var(--sea) 8%, var(--surface));
}
.savebar.is-dirty .savebar__state { color: var(--sea); font-weight: 600; }
.savebar__state { font-size: .85rem; }
@media (width < 34rem) { .savebar { flex-direction: column; align-items: stretch; text-align: center; } }

/* schede lingua */
.langbox { margin-bottom: 1.1rem; }
.langtabs { display: flex; gap: .3rem; margin-bottom: .4rem; }
.langtab {
  padding: .2rem .6rem; border-radius: 99px; font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; color: var(--soft); box-shadow: inset 0 0 0 1.5px var(--line);
}
.langtab.on { background: var(--sea); color: #fff; box-shadow: none; }

/* tabelle */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--soft); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in oklab, var(--sea) 5%, transparent); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }

.tag { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
       padding: .15rem .45rem; border-radius: 99px; background: var(--line); color: var(--soft); }
.tag--on  { background: color-mix(in oklab, var(--green) 20%, transparent); color: var(--green); }
.tag--off { background: color-mix(in oklab, var(--red) 15%, transparent); color: var(--red); }
.tag--pos { background: color-mix(in oklab, var(--sea) 18%, transparent); color: var(--sea); }

/* galleria */
.shots { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(13rem, 100%), 1fr)); }
.shot-admin { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.shot-admin img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.shot-admin .body { padding: .7rem; display: grid; gap: .5rem; }
.shot-admin input { font-size: .82rem; padding: .35rem .5rem; }

/* login */
.login { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.login form { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line);
              border-radius: 16px; box-shadow: var(--shadow); padding: 2rem; }
.login img { height: 64px; width: auto; margin: 0 auto 1.2rem; }
.login h1 { font-size: 1.2rem; text-align: center; margin-bottom: 1.5rem; }

.muted { color: var(--soft); font-size: .85rem; }
.ico { flex: none; }
