[hidden] { display: none !important; }
/* Studiotel · Area Clienti — palette dal logo: azzurro #2DAAE1, blu #0F70B7, antracite #35383F */
:root {
  --sky: #2daae1;
  --blue: #0f70b7;
  --blue-700: #0b5a94;
  --ink: #35383f;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #e2e8ef;
  --text: #23262d;
  --muted: #667085;
  --primary: var(--blue);
  --primary-hover: var(--blue-700);
  --primary-soft: #e7f3fb;
  --accent: var(--sky);
  --ok: #12805c;
  --ok-soft: #e6f6ef;
  --warn: #b25e09;
  --warn-soft: #fff4e5;
  --danger: #c4321c;
  --danger-soft: #fdecea;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .06);
  --shadow-lg: 0 10px 30px -12px rgb(15 112 183 / .25);
  --radius: 12px;
  --radius-sm: 8px;
  --gradient: linear-gradient(120deg, var(--sky), var(--blue));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1319;
    --surface: #151c24;
    --surface-2: #1a232d;
    --border: #273240;
    --text: #e6eaf0;
    --muted: #94a3b5;
    --primary: #2b9bd3;
    --primary-hover: #49b3e6;
    --primary-soft: #11293a;
    --ok: #3ccb92;
    --ok-soft: #10291f;
    --warn: #f0a24a;
    --warn-soft: #2e2212;
    --danger: #f17663;
    --danger-soft: #34181a;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-lg: 0 10px 30px -12px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15.5px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; color: var(--text); }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
h2 .icon { color: var(--accent); }
p { margin: 0 0 1em; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.block { display: block; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--sky) 70%, transparent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Bottoni e campi ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px; padding: .55rem 1.05rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 0 rgb(255 255 255 / .15) inset, var(--shadow); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.danger, .btn-ghost.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: .3rem .7rem; font-size: .88rem; }
.btn-stack { display: grid; gap: .5rem; margin-top: 1rem; }
.btn-stack .btn { justify-content: flex-start; }
.linklike { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.linklike:hover { text-decoration: underline; }
.iconbtn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  color: var(--muted); background: transparent; border: 1px solid transparent; cursor: pointer;
}
.iconbtn:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.iconbtn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.field { display: grid; gap: .35rem; }
.field > span { font-weight: 600; font-size: .9rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .6rem .75rem; min-height: 44px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: auto; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky) 25%, transparent); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); margin: 0; flex: none; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.check input { margin-top: .2rem; }
.stack { display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.2rem; }
.span-2 { grid-column: 1 / -1; }
.code-input { font: 600 1.6rem/1 ui-monospace, Menlo, monospace; letter-spacing: .45em; text-align: center; padding: .7rem; }
.reveal-wrap { position: relative; }
.reveal-wrap input { padding-right: 3rem; }
.reveal-btn { position: absolute; right: 4px; top: 4px; }
.strength { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin-top: .3rem; }
.strength i { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }

/* ---------- Messaggi ---------- */
.flash {
  display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius-sm);
  margin: 0 0 1.2rem; border: 1px solid; font-size: .95rem;
}
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.flash-info { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.flash span { color: var(--text); }
.flash.secret .secret-value { font-size: 1.15rem; padding: .2rem .5rem; user-select: all; }
.pill {
  display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: .12rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.pill-info { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.pill-importante { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill-urgente { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ---------- Pagine di accesso ---------- */
body.auth { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand {
  position: relative; overflow: hidden; color: #fff; display: grid; place-items: center; padding: 3rem;
  background: radial-gradient(1200px 500px at -10% 110%, rgb(255 255 255 / .18), transparent 60%), var(--gradient);
}
.auth-brand::before, .auth-brand::after {
  content: ""; position: absolute; border-radius: 50%; border: 2px solid rgb(255 255 255 / .18);
  width: 640px; height: 640px; right: -260px; bottom: -330px;
}
.auth-brand::after { width: 420px; height: 420px; right: -150px; bottom: -210px; border-color: rgb(255 255 255 / .28); }
.auth-brand-inner { max-width: 440px; position: relative; }
.auth-brand h2 { color: #fff; font-size: 1.9rem; line-height: 1.25; display: block; font-weight: 700; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; margin-bottom: .6rem; color: var(--accent); }
.auth-brand .eyebrow { color: rgb(255 255 255 / .85); }
.auth-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .9rem; font-weight: 500; }
.auth-points li { display: flex; gap: .7rem; align-items: center; }
.auth-points .icon { background: rgb(255 255 255 / .18); border-radius: 8px; padding: 6px; width: 32px; height: 32px; }
.auth-card { align-self: center; justify-self: center; width: min(420px, 100% - 32px); padding: 2.5rem 0; }
.auth-logo { display: inline-block; margin-bottom: 2rem; }
.auth-logo img { width: 190px; }
.auth-card h1 { font-size: 1.55rem; margin-bottom: 1rem; }
.auth-help { margin-top: 2rem; font-size: .85rem; color: var(--muted); text-align: center; }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card { padding-top: 3rem; }
}

.error-page { min-height: 100vh; display: grid; place-content: center; justify-items: center; text-align: center; padding: 2rem 16px; gap: .4rem; }
.error-code { font-size: 4rem; font-weight: 800; margin: 1.5rem 0 0; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }

/* ---------- Area cliente: barra superiore ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar::before { content: ""; display: block; height: 3px; background: var(--gradient); }
.topbar-inner { max-width: 1160px; margin: 0 auto; padding: .55rem 16px; display: flex; align-items: center; gap: 1.2rem; }
.brand img { display: block; width: 140px; }
.mainnav { display: flex; gap: .25rem; flex: 1; }
.mainnav a {
  display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 600; position: relative; text-decoration: none;
}
.mainnav a:hover { color: var(--text); background: var(--surface-2); }
.mainnav a.active { color: var(--primary); background: var(--primary-soft); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; }
.usermenu { position: relative; margin-left: auto; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: .55rem; cursor: pointer; padding: .3rem .4rem; border-radius: 999px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--surface-2); }
.usermenu-name { font-weight: 600; font-size: .92rem; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--gradient); color: #fff; font-weight: 700; font-size: .82rem; flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: .78rem; }
.usermenu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .6rem; display: grid; gap: .15rem; z-index: 30;
}
.usermenu-pop p { padding: .3rem .6rem; margin: 0 0 .3rem; border-bottom: 1px solid var(--border); padding-bottom: .6rem; }
.usermenu-pop a, .usermenu-pop .linklike { display: flex; gap: .6rem; align-items: center; padding: .55rem .6rem; border-radius: var(--radius-sm); color: var(--text); width: 100%; text-align: left; }
.usermenu-pop a:hover, .usermenu-pop .linklike:hover { background: var(--surface-2); text-decoration: none; }
.container { max-width: 1160px; margin: 0 auto; padding: 1.8rem 16px 3rem; }
.footer { max-width: 1160px; margin: 0 auto; padding: 1.5rem 16px 2.5rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: .4rem .8rem; }
  .mainnav {
    order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 12px .2rem;
  }
  .mainnav a { flex-direction: column; gap: .1rem; font-size: .74rem; padding: .35rem .7rem; flex: 1; }
  .mainnav .badge { position: absolute; top: 0; right: 18%; }
  .usermenu-name { display: none; }
  .container { padding-top: 1.2rem; }
  h1 { font-size: 1.35rem; }
}

/* ---------- Contenuti ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow); margin-bottom: 1.3rem; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .6rem; }
.card-head.padded { padding: 1.1rem 1.4rem .2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.3rem; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid-cal { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 0 1.3rem; }
@media (max-width: 900px) { .grid-2, .grid-2.wide-left, .grid-cal, .form-grid { grid-template-columns: 1fr; } }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.pagehead h1 { margin-bottom: .15rem; }
.pagehead p { margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: .35rem; font-size: .88rem; color: var(--muted); margin-bottom: .8rem; }
.crumbs > * + *::before { content: "›"; margin-right: .35rem; color: var(--border); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }

.hero {
  display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: 1.7rem 1.8rem; margin-bottom: 1.3rem; border-radius: calc(var(--radius) + 4px);
  background: radial-gradient(600px 200px at 100% 0, rgb(255 255 255 / .22), transparent 70%), var(--gradient);
  color: #fff; box-shadow: var(--shadow-lg);
}
.hero h1 { color: #fff; margin-bottom: .3rem; }
.hero p.muted { color: rgb(255 255 255 / .88); margin: 0; max-width: 60ch; }
.hero .eyebrow { color: rgb(255 255 255 / .8); margin-bottom: .2rem; }
.hero .btn-primary { background: #fff; color: var(--blue); }
.hero .btn-primary:hover { background: #eef7fc; }

.empty { text-align: center; padding: 1.6rem 1rem; }
.empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); margin-bottom: .6rem; }
.empty-title { font-weight: 700; margin-bottom: .2rem; }

/* scadenze */
.deadline-list, .news-list, .plain-list { list-style: none; margin: 0; padding: 0; }
.deadline { display: flex; gap: .9rem; padding: .75rem 0; border-top: 1px solid var(--border); align-items: flex-start; }
.deadline:first-child { border-top: 0; }
.deadline-body { display: grid; gap: .1rem; min-width: 0; }
.date-chip { flex: none; width: 52px; text-align: center; border-radius: 10px; padding: .35rem 0 .3rem; background: var(--primary-soft); color: var(--primary); line-height: 1.1; }
.dc-day { display: block; font-size: 1.25rem; font-weight: 800; }
.dc-month { display: block; font-size: .7rem; text-transform: uppercase; font-weight: 700; letter-spacing: .05em; }
.deadline.soon .date-chip { background: var(--danger-soft); color: var(--danger); }
.deadline.near .date-chip { background: var(--warn-soft); color: var(--warn); }
.deadline.past { opacity: .6; }
.deadline-list.compact { margin-top: 1rem; border-top: 1px solid var(--border); }

/* comunicazioni */
.news a { display: flex; align-items: center; gap: .8rem; padding: .75rem .5rem; margin: 0 -.5rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.news a:hover { background: var(--surface-2); }
.news + .news a { border-top: 1px solid var(--border); border-radius: 0; }
.news-body { display: grid; flex: 1; min-width: 0; }
.news-dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; flex: none; }
.news.unread .news-dot { background: var(--sky); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sky) 20%, transparent); }
.news.unread.level-urgente .news-dot { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.news.read strong { font-weight: 500; }
.news .icon { color: var(--muted); }
.announcement { border-top: 4px solid var(--sky); }
.announcement.level-importante { border-top-color: var(--warn); }
.announcement.level-urgente { border-top-color: var(--danger); }
.prose { max-width: 70ch; }
.prose p { margin-bottom: 1em; }
.prose a { word-break: break-word; }
.prose h3 { font-size: 1.05rem; margin: 1.4em 0 .5em; color: var(--primary); }
.prose h3:first-child { margin-top: 0; }
.prose ul { margin: 0 0 1em 1.2em; padding: 0; }
.prose li { margin-bottom: .35em; line-height: 1.5; }

/* cartelle */
.folder-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.folder-tile {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .8rem; align-items: center;
  padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .15s; text-decoration: none !important;
}
.folder-tile:hover { border-color: var(--sky); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile-icon { grid-row: span 2; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.tile-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { font-size: .82rem; color: var(--muted); }

/* tabelle */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: .7rem .9rem; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: .7rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }
.num { text-align: right; }
td.actions { white-space: nowrap; text-align: right; width: 1%; }
td.actions form { display: inline; }
table.compact td { padding: .45rem .9rem; }
tr.row-warn td { background: color-mix(in srgb, var(--warn-soft) 60%, transparent); }
tr.row-error td { background: var(--danger-soft); }
.files { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.fname { display: flex; align-items: center; gap: .75rem; color: var(--text); font-weight: 500; word-break: break-word; }
.fname:hover { color: var(--primary); }
.ficon { position: relative; width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.ficon em { position: absolute; bottom: 3px; font: 800 7.5px/1 -apple-system, sans-serif; letter-spacing: .02em; font-style: normal; }
.k-folder { background: var(--primary-soft); color: var(--primary); }
.k-pdf { background: #fdecea; color: #c4321c; }
.k-image { background: #f3e8fd; color: #7a3fc4; }
.k-sheet { background: #e6f6ef; color: #12805c; }
.k-doc { background: #e7f0fd; color: #2563c9; }
.k-archive { background: #fff4e5; color: #b25e09; }
@media (prefers-color-scheme: dark) {
  .k-pdf { background: #34181a; color: #f17663; } .k-image { background: #2a1d3a; color: #c49bf5; }
  .k-sheet { background: #10291f; color: #3ccb92; } .k-doc { background: #13233d; color: #7fb0f5; } .k-archive { background: #2e2212; color: #f0a24a; }
}
@media (max-width: 640px) { .hide-sm { display: none; } td, th { padding: .6rem .6rem; } }

.search { position: relative; display: inline-flex; align-items: center; }
.search .icon { position: absolute; left: .7rem; color: var(--muted); pointer-events: none; }
.search input { padding-left: 2.3rem; min-width: 220px; }

/* upload */
.dropzone {
  border: 2px dashed color-mix(in srgb, var(--sky) 55%, var(--border)); border-radius: var(--radius); padding: 1.4rem;
  text-align: center; background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface)); margin-bottom: 1.3rem;
  transition: background .15s, border-color .15s; color: var(--primary);
}
.dropzone p { margin: .3rem 0 0; color: var(--text); }
.dropzone.drag { background: var(--primary-soft); border-color: var(--primary); }
.upload-queue { list-style: none; padding: 0; margin: .8rem auto 0; max-width: 560px; text-align: left; display: grid; gap: .4rem; }
.upload-queue li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .7rem; font-size: .88rem; color: var(--text); }
.upload-queue .bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: .35rem; overflow: hidden; }
.upload-queue .bar i { display: block; height: 100%; width: 0; background: var(--gradient); transition: width .2s; }
.upload-queue li.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.upload-queue li.done .bar i { background: var(--ok); }
.upload-queue li.error { border-color: var(--danger); color: var(--danger); }

/* calendario */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.cal-head h2 { text-transform: capitalize; margin: 0; font-size: 1.15rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); text-align: center; padding-bottom: .2rem; }
.cal-cell { min-height: 84px; border-radius: 8px; background: var(--surface-2); padding: .3rem; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-cell.empty { background: transparent; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--sky); }
.cal-day { font-size: .8rem; font-weight: 700; color: var(--muted); }
.cal-cell.today .cal-day { color: var(--primary); }
.cal-item { font-size: .7rem; line-height: 1.25; background: var(--primary); color: #fff; border-radius: 4px; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: .7rem; color: var(--muted); }
@media (max-width: 640px) {
  .cal-cell { min-height: 46px; align-items: center; }
  .cal-item { width: 7px; height: 7px; padding: 0; border-radius: 50%; font-size: 0; }
  .cal-cell.has { background: var(--primary-soft); }
}

.copyrow { display: flex; gap: .5rem; margin-bottom: .8rem; }
.copyrow input { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; }
form.inline { display: inline; }
details.help { margin-top: 1rem; }
details.help summary { cursor: pointer; color: var(--primary); font-weight: 600; }
details.help p { margin: .5rem 0; font-size: .9rem; }
.plain-list li { padding: .6rem 0; border-top: 1px solid var(--border); }
.plain-list li:first-child { border-top: 0; }
.plain-list.tall, .checklist.tall { max-height: 360px; overflow: auto; }
.plain-list .icon.ok { color: var(--ok); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Gestione studio ---------- */
.admin-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #20242b; color: #c9d1db; padding: 1.3rem .9rem; position: sticky; top: 0; height: 100vh; overflow: auto; border-right: 1px solid #2c323b; }
.sidebar .brand img { width: 150px; margin: 0 .5rem 1.4rem; }
.sidebar-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: #8b97a6; margin: 0 .6rem .5rem; font-weight: 700; }
.sidebar nav { display: grid; gap: .15rem; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: var(--radius-sm); color: #c9d1db; font-weight: 500; text-decoration: none; }
.sidebar nav a:hover { background: #2a3039; color: #fff; }
.sidebar nav a.active { background: linear-gradient(120deg, rgb(45 170 225 / .22), rgb(15 112 183 / .3)); color: #fff; box-shadow: inset 3px 0 0 var(--sky); }
.sidebar nav a .icon { color: #8fd3f2; }
.admin-main { min-width: 0; }
.admin-top { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.8rem; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.admin-title { font-size: 1.25rem; margin: 0; }
.admin-content { padding: 1.6rem 1.8rem 3rem; max-width: 1280px; }
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: .8rem; display: flex; align-items: center; gap: .6rem; overflow-x: auto; }
  .sidebar .brand img { width: 110px; margin: 0 .4rem 0 0; }
  .sidebar-label { display: none; }
  .sidebar nav { display: flex; }
  .sidebar nav a span { display: none; }
  .admin-top, .admin-content { padding-left: 16px; padding-right: 16px; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.3rem; }
.stat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .9rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; }
a.stat:hover { border-color: var(--sky); }
.stat-icon { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: .82rem; color: var(--muted); }
.stat.warn .stat-icon { background: var(--warn-soft); color: var(--warn); }
.toolbar { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar .filters { margin: 0; }
.filters select, .filters input { width: auto; }
.person { display: flex; align-items: center; gap: .7rem; color: var(--text); }
.person:hover strong { color: var(--primary); }
.composer > summary { list-style: none; width: fit-content; }
.composer > summary::-webkit-details-marker { display: none; }
.composer[open] > summary { margin-bottom: 1.2rem; }
.audience { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1rem 1rem; margin: 0; display: grid; gap: .8rem; }
.audience legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: .4rem .85rem; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--sky) 70%, transparent); }
.audience-panel { display: none; }
.audience[data-mode="tags"] .audience-panel[data-for="tags"], .audience[data-mode="users"] .audience-panel[data-for="users"] { display: grid; gap: .5rem; }
.audience:not([data-mode]) .audience-panel { display: none; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.checklist label { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; cursor: pointer; font-size: .92rem; }
.add-folder { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.add-folder input { flex: 1 1 260px; width: auto; }
.inline-form input { min-height: 36px; padding: .35rem .6rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; }

.demo-ribbon { background: repeating-linear-gradient(135deg, #b25e09 0 14px, #c26a10 14px 28px); color: #fff; text-align: center; font-size: .8rem; font-weight: 700; letter-spacing: .04em; padding: .3rem 16px; }

/* ---------- Bottoni su sfondo colorato ---------- */
.btn-light { background: #fff; color: var(--blue); border-color: #fff; }
.btn-light:hover { background: #eef7fc; }
.btn-outline-light { background: rgb(255 255 255 / .08); color: #fff; border: 1px solid rgb(255 255 255 / .55); }
.btn-outline-light:hover { background: rgb(255 255 255 / .18); border-color: #fff; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- Accesso guidato (primo accesso / password dimenticata) ---------- */
.auth-lead { color: var(--muted); margin: -.4rem 0 1.3rem; font-size: 1rem; }
.btn-lg { min-height: 48px; font-size: 1rem; gap: .5rem; }
.back-link { margin-top: 1.2rem; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.field-row a { font-weight: 500; }

/* indicatore di avanzamento */
.stepper { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; grid-template-columns: repeat(3, 1fr); position: relative; }
.stepper li { display: grid; justify-items: center; gap: .35rem; position: relative; font-size: .8rem; font-weight: 600; color: var(--muted); text-align: center; }
.stepper li + li::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 3px; border-radius: 3px; background: var(--border); z-index: 0; }
.stepper li.done + li::before, .stepper li.current + li.current::before { background: var(--gradient); }
.stepper-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); color: var(--muted); font-weight: 800; font-size: .9rem; transition: all .2s; }
.stepper li.current { color: var(--primary); }
.stepper li.current .stepper-dot { background: var(--gradient); border-color: transparent; color: #fff; box-shadow: 0 0 0 5px var(--primary-soft); }
.stepper li.done { color: var(--ok); }
.stepper li.done .stepper-dot { background: var(--ok); border-color: var(--ok); color: #fff; }

/* pannello laterale */
.aside-steps { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .8rem; }
.aside-steps li { display: flex; gap: .9rem; align-items: center; padding: .85rem 1rem; border-radius: 14px; background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .16); transition: background .2s; }
.aside-steps li.current { background: rgb(255 255 255 / .2); border-color: rgb(255 255 255 / .45); box-shadow: 0 10px 30px -15px rgb(0 0 0 / .4); }
.aside-steps li.done { opacity: .8; }
.aside-steps strong { display: block; color: #fff; }
.aside-steps small { color: rgb(255 255 255 / .82); font-size: .86rem; }
.aside-step-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgb(255 255 255 / .18); color: #fff; }
.aside-steps li.current .aside-step-icon { background: #fff; color: var(--blue); }
.aside-note { display: flex; gap: .5rem; align-items: center; margin-top: 1.6rem; font-size: .88rem; color: rgb(255 255 255 / .85); }

/* campi e suggerimenti */
.input-icon { position: relative; display: block; }
.input-icon > .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 2.5rem; width: 100%; }
.hint { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem .9rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border); font-size: .88rem; color: var(--muted); }
.hint .icon { flex: none; color: var(--accent); margin-top: .1rem; }
.hint p { margin: 0; }
.mail-notice { display: flex; gap: .8rem; align-items: flex-start; padding: .95rem 1rem; margin-bottom: 1.2rem; border-radius: var(--radius); background: linear-gradient(135deg, var(--primary-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); }
.mail-notice p { margin: .15rem 0 0; font-size: .88rem; color: var(--muted); }
.mail-notice-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--gradient); color: #fff; }
.guided-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; margin: 0; display: grid; gap: .8rem; background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.guided-block legend { display: flex; align-items: center; gap: .5rem; padding: 0 .4rem; margin-left: -.4rem; font-weight: 700; font-size: .95rem; }
.block-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--gradient); color: #fff; font-size: .8rem; font-weight: 800; }
.guided-block .code-input { width: 100%; }
.pw-rules { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; font-size: .86rem; color: var(--muted); }
.pw-rules li { display: flex; align-items: center; gap: .45rem; transition: color .2s; }
.pw-rules .icon { padding: 2px; border-radius: 50%; background: var(--border); color: var(--surface); transition: background .2s; }
.pw-rules li.ok { color: var(--ok); font-weight: 600; }
.pw-rules li.ok .icon { background: var(--ok); color: #fff; }

/* pagina di accesso: separatore e invito all'accesso guidato */
.or-divider { display: flex; align-items: center; gap: .8rem; margin: 1.5rem 0 1.1rem; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.guided-cta {
  display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; border-radius: var(--radius); text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, var(--primary-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.guided-cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); border-color: var(--primary); text-decoration: none; }
.guided-cta-icon { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--gradient); color: #fff; box-shadow: var(--shadow-lg); }
.guided-cta-text { flex: 1; display: grid; gap: .1rem; }
.guided-cta-text small { color: var(--muted); font-size: .86rem; }
.guided-cta-arrow { color: var(--primary); transition: transform .15s; }
.guided-cta:hover .guided-cta-arrow { transform: translateX(3px); }

/* ---------- Guida di benvenuto ---------- */
.guide-hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.5rem; align-items: center;
  padding: 2.4rem 2.2rem; margin-bottom: 2rem; border-radius: calc(var(--radius) + 8px); color: #fff; box-shadow: var(--shadow-lg);
  background: radial-gradient(700px 260px at 0% 120%, rgb(255 255 255 / .22), transparent 60%), var(--gradient);
}
.guide-hero::after { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; top: -220px; border-radius: 50%; border: 2px solid rgb(255 255 255 / .2); }
.guide-hero h1 { color: #fff; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); line-height: 1.2; margin: 0 0 .7rem; }
.guide-hero p { color: rgb(255 255 255 / .9); max-width: 56ch; margin: 0; font-size: 1.02rem; }
.guide-hero .eyebrow { color: rgb(255 255 255 / .82); }
.guide-hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.4rem; position: relative; z-index: 1; }
.guide-hero-art { position: relative; height: 190px; }
.bubble { position: absolute; display: grid; place-items: center; border-radius: 22px; background: rgb(255 255 255 / .16); border: 1px solid rgb(255 255 255 / .3); backdrop-filter: blur(4px); color: #fff; box-shadow: 0 12px 30px -14px rgb(0 0 0 / .35); animation: float 6s ease-in-out infinite; }
.bubble.b1 { width: 78px; height: 78px; left: 8%; top: 18%; }
.bubble.b2 { width: 64px; height: 64px; left: 48%; top: 0; animation-delay: -1.5s; }
.bubble.b3 { width: 52px; height: 52px; left: 36%; bottom: 4%; animation-delay: -3s; }
.bubble.b4 { width: 92px; height: 92px; right: 4%; bottom: 10%; border-radius: 28px; background: rgb(255 255 255 / .24); animation-delay: -4.5s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; } }

.guide-section { margin-bottom: 2.2rem; }
.guide-title { font-size: 1.25rem; margin: 0 0 1rem; display: flex; align-items: center; gap: .6rem; }
.guide-title::before { content: ""; width: 26px; height: 4px; border-radius: 4px; background: var(--gradient); }

.guide-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; counter-reset: none; }
.guide-steps li { position: relative; padding: 1.4rem 1.3rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.guide-steps h3 { font-size: 1.02rem; margin: .8rem 0 .35rem; }
.guide-steps p { margin: 0; color: var(--muted); font-size: .93rem; }
.step-num { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--gradient); color: #fff; font-weight: 800; font-size: 1.05rem; box-shadow: var(--shadow-lg); }

.guide-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.feature-card { display: flex; flex-direction: column; padding: 1.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.feature-card h3 { font-size: 1.08rem; margin: .8rem 0 .3rem; }
.feature-card p { margin: 0 0 .8rem; font-size: .93rem; }
.feature-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.feature-link { margin-top: auto; padding-top: .6rem; display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; text-decoration: none; }
.feature-link:hover { gap: .5rem; }
.tick-list { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .45rem; font-size: .92rem; }
.tick-list li { display: flex; gap: .5rem; align-items: flex-start; }
.tick-list .icon { flex: none; margin-top: .2rem; color: var(--ok); }

.guide-bottom { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; }
.guide-card { padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.guide-card h2 { font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; margin: 0 0 .9rem; }
.guide-card.security { background: linear-gradient(160deg, var(--ok-soft), var(--surface) 60%); }
.guide-card.security h2 .icon { color: var(--ok); }
.guide-card.help { text-align: center; background: linear-gradient(160deg, var(--primary-soft), var(--surface) 70%); }
.guide-card.help h2 { justify-content: center; margin-top: .7rem; }
.guide-card.help p { color: var(--muted); margin: 0 0 1rem; }
.guide-card.help .btn { word-break: break-all; }

@media (max-width: 860px) {
  .guide-hero { grid-template-columns: 1fr; padding: 1.8rem 1.4rem; }
  .guide-hero-art { display: none; }
  .guide-steps, .guide-features, .guide-bottom { grid-template-columns: 1fr; }
}
