/*!
 * INTENTIONEM - Gestionale Intenzioni Messe
 * Foglio di stile dell'applicazione
 */
@view-transition { navigation: auto; }

:root {
  --brand: #8e3a78;
  --brand-2: #b24f97;
  --brand-dark: #6d2a5c;
  --brand-soft: #f7ecf4;
  --brand-line: #ecd6e6;
  --ink: #2b2230;
  --ink-2: #4a3d48;
  --muted: #7d6e7a;
  --line: #ece4ea;
  --bg: #f7f3f6;
  --card: #ffffff;
  --ok: #1f9d6b;
  --ok-soft: #e4f6ee;
  --warn: #b7791f;
  --warn-soft: #fdf3de;
  --danger: #d64545;
  --danger-soft: #fde8e8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(43, 34, 48, .06);
  --shadow: 0 1px 3px rgba(43, 34, 48, .06), 0 8px 24px rgba(43, 34, 48, .06);
  --shadow-lg: 0 20px 50px rgba(30, 10, 25, .25);
  --sb-w: 288px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
img { max-width: 100%; }
.ico { flex: none; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
.t-center { text-align: center; }
.t-right { text-align: right; }
.hint { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin: 12px 0 0; }

/* ---------------- Pulsanti ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(110, 30, 90, .25); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand-line); color: var(--brand); background: var(--brand-soft); }
.btn-light { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .28); }
.btn-light:hover { background: rgba(255, 255, 255, .26); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b93636; }
.btn-lg { height: 46px; font-size: 15px; }
.btn-block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-ghost.is-loading::after { border-color: var(--brand-line); border-top-color: var(--brand); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; transition: all .15s; }
.icon-btn:hover { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.icon-btn.is-on { color: var(--ok); }
.icon-btn.danger:hover { color: var(--danger); border-color: #f3c4c4; background: var(--danger-soft); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Campi ---------------- */
input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid #dcd0d8; border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(178, 79, 151, .16); }
input[readonly] { background: #fff; cursor: pointer; }
input:disabled { background: #f6f2f5; color: var(--muted); cursor: not-allowed; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fgrid label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fgrid label > span:first-child, .field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .2px; }
.fgrid .span2 { grid-column: 1 / -1; }
.pw { position: relative; display: block; }
.pw input { padding-right: 44px; }
.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; }
.eye:hover { color: var(--brand); background: var(--brand-soft); }

/* ---------------- Card ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-card { width: 100%; max-width: 680px; padding: 26px 28px; position: relative; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.card-head h2 { margin: 0; font-size: 19px; }
.card-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.card-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.card-art { display: block; width: 100%; max-width: 420px; margin: 24px auto 0; border-radius: 10px; opacity: .95; }
.center-wrap { min-height: calc(100vh - 190px); display: flex; align-items: center; justify-content: center; padding: 8px 0 24px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 70px 20px; color: var(--muted); text-align: center; }
.alert { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; text-align: left; }
.alert-error { background: var(--danger-soft); color: #a32f2f; border: 1px solid #f6caca; }

/* ---------------- Pagine di accesso ---------------- */
.auth-bg {
  position: relative; min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(255, 255, 255, .14), transparent 60%),
              linear-gradient(140deg, #b24f97 0%, #7f3069 45%, #3d1836 100%);
}
.auth-center { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 32px 16px 56px; }
.auth-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 30px 30px 26px; text-align: center;
  box-shadow: var(--shadow-lg); animation: cardIn .45s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.auth-logo { display: block; width: 132px; height: 132px; margin: 0 auto 10px; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(60, 20, 50, .25)); }
.auth-title { margin: 6px 0 4px; font-size: 25px; letter-spacing: 1.5px; color: var(--brand); font-weight: 800; min-height: 1.3em; }
.auth-title .scr, .home-title .scr { color: var(--brand-2); opacity: .55; }
.auth-sub { margin: 0 0 20px; color: var(--muted); font-size: 14.5px; }
.auth-form { display: grid; gap: 12px; }
.field { position: relative; display: block; }
.field input { height: 46px; padding-left: 42px; padding-right: 44px; }
.field-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #a493a0; display: flex; }
.auth-links { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; font-size: 14px; }
.auth-links a { color: var(--ink-2); text-decoration: none; }
.auth-links a:hover { color: var(--brand); text-decoration: underline; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 13px; color: var(--muted); text-decoration: none; }
.auth-back:hover { color: var(--brand); }
.auth-copy { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; font-size: 12.5px; color: rgba(255, 255, 255, .78); }
.auth-copy a { color: #fff; text-decoration: none; font-weight: 600; }
/* Sotto un dialog la scheda viene nascosta e lo sfondo sfocato */
body.auth-page:has(.ui-widget-overlay) .auth-card { visibility: hidden; }
.blocked-card { text-align: center; max-width: 440px; }
.blocked-ico { width: 76px; height: 76px; margin: 14px auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); box-shadow: 0 0 0 8px rgba(214, 69, 69, .07); }
.blocked-title { font-size: 24px; color: var(--ink); margin: 0 0 10px; }
.blocked-text { margin: 0 0 8px; color: var(--ink-2); line-height: 1.55; }
.blocked-contacts { display: grid; gap: 10px; margin-top: 20px; }

/* ---------------- Calendario pubblico ---------------- */
.public-page { background: var(--bg); }
.pub-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px;
  background: linear-gradient(120deg, #8e3a78, #5a2250); color: #fff; box-shadow: 0 2px 12px rgba(60, 20, 50, .2);
}
.pub-brand { display: flex; align-items: center; gap: 12px; }
.pub-brand img { width: 44px; height: 44px; border-radius: 50%; }
.pub-brand strong { display: block; letter-spacing: 1.5px; font-size: 17px; }
.pub-brand span { display: block; font-size: 12.5px; opacity: .8; }
.pub-main { padding: 22px 24px 30px; }
.pub-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 0 0 22px; }
.pub-foot a { color: var(--brand); text-decoration: none; font-weight: 600; }

/* ---------------- Area riservata: struttura ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60; width: var(--sb-w); display: flex; flex-direction: column;
  background: linear-gradient(180deg, #3d1836 0%, #26101f 100%); color: rgba(255, 255, 255, .86);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.app:not(.ready) .sidebar, .app:not(.ready) .content { transition: none !important; }
.content { flex: 1; min-width: 0; margin-left: var(--sb-w); transition: margin-left .25s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; min-height: 100vh; }
.app.sb-closed .sidebar { transform: translateX(-100%); }
.app.sb-closed .content { margin-left: 0; }
.sb-head { display: flex; align-items: center; gap: 10px; padding: 18px 16px 10px; }
.sb-logo { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, .15); }
.sb-name { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.sb-name strong { color: #fff; letter-spacing: .8px; font-size: 15px; }
.badge-ver { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; }
.sb-close { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; }
.sb-close:hover { background: rgba(255, 255, 255, .16); }
.sb-date { display: flex; align-items: center; gap: 6px; padding: 0 18px 14px; font-size: 12.5px; color: rgba(255, 255, 255, .62); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sb-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0; border-radius: 9px;
  color: rgba(255, 255, 255, .82); text-decoration: none; font-size: 14.5px; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(178, 79, 151, .55), rgba(178, 79, 151, .25)); color: #fff; box-shadow: inset 3px 0 0 #e7a2d3; }
.nav-link span { flex: 1; }
.caret { display: flex; transition: transform .2s; opacity: .7; }
.nav-group.open > .nav-toggle .caret { transform: rotate(180deg); }
.nav-sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.nav-sub { padding-left: 12px; }
.nav-group.open .nav-sub { grid-template-rows: 1fr; }
.nav-sub-inner { overflow: hidden; min-height: 0; }
.nav-sep { margin: 16px 12px 6px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: rgba(255, 255, 255, .45); }
.sb-foot { padding: 12px 10px 14px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 8px; }
.nav-exit:hover { background: rgba(214, 69, 69, .25); }
.sb-credits { text-align: right; font-size: 10.5px; color: rgba(255, 255, 255, .45); text-decoration: none; padding: 0 6px; }
.sb-credits:hover { color: #fff; }
.sb-backdrop { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; height: 62px; padding: 0 22px;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line);
}
.btn-menu { height: 38px; padding: 0 12px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); display: none; }
.btn-menu:hover { color: var(--brand); border-color: var(--brand-line); }
.app.sb-closed .btn-menu { display: inline-flex; }
.tb-user { flex: 1; font-size: 15px; color: var(--ink-2); }
.tb-user strong { color: var(--ink); }
.tb-hello { color: var(--muted); }
.tb-logo { width: 40px; height: 40px; border-radius: 50%; }
.main { flex: 1; padding: 22px 24px 30px; position: relative; }
.main.page-out { opacity: 0; transform: translateY(-6px); transition: opacity .16s ease, transform .16s ease; }
.main.page-in { animation: pageIn .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.main.is-loading::after { content: ""; position: absolute; top: 120px; left: 50%; width: 34px; height: 34px; margin-left: -17px; border-radius: 50%; border: 3px solid var(--brand-line); border-top-color: var(--brand); animation: spin .7s linear infinite; }

/* Titolo pagina */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pt-label { font-size: 13.5px; color: var(--muted); }
.pt-title { font-size: 22px; font-weight: 750; color: var(--ink); }
.pt-badge { align-self: center; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Home */
.home-hero { min-height: calc(100vh - 140px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.home-logo { width: 250px; height: 250px; object-fit: contain; filter: drop-shadow(0 12px 26px rgba(60, 20, 50, .25)); animation: cardIn .6s cubic-bezier(.2, .8, .2, 1) both; }
.home-title { margin: 18px 0 2px; font-size: 32px; letter-spacing: 3px; color: var(--brand); font-weight: 800; }
.home-sub { margin: 0; color: var(--muted); }

/* ---------------- Tabelle ---------------- */
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; max-height: calc(100vh - 190px); }
.tabella { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.tabella thead th {
  position: sticky; top: 0; z-index: 1; background: #faf6f9; color: var(--ink-2); font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tabella thead th.t-center { text-align: center; }
.tabella td { padding: 11px 14px; border-bottom: 1px solid #f3edf1; vertical-align: middle; }
.tabella tbody tr:nth-child(even) td { background: #fcfafb; }
.tabella tbody tr:hover td { background: var(--brand-soft); }
.tabella tr.clickable { cursor: pointer; }
.tabella tr.is-off td:not(.actions) { color: #a89aa5; }
.tabella .actions { white-space: nowrap; cursor: default; }
.tabella .actions .icon-btn { margin-left: 4px; }
.tabella a { text-decoration: none; }
.w-n { width: 60px; }
.sortable-h { cursor: pointer; user-select: none; }
.sortable-h::after { content: ""; display: inline-block; margin-left: 6px; border: 4px solid transparent; border-top-color: #c8b6c3; border-bottom-width: 0; vertical-align: middle; opacity: .7; }
.sortable-h.sort-asc::after { border-top-width: 0; border-bottom: 5px solid var(--brand); border-top-color: transparent; opacity: 1; }
.sortable-h.sort-desc::after { border-top: 5px solid var(--brand); opacity: 1; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-off { background: #eef0f5; color: #6e768c; }
.search { position: relative; display: flex; align-items: center; }
.search .ico { position: absolute; left: 11px; color: #a493a0; }
.search input { width: 240px; height: 38px; padding-left: 34px; }

/* ---------------- Calendario (FullCalendar) ---------------- */
.cal-card { padding: 16px 18px; }
.fc { font-size: 14px; }
.fc-toolbar.fc-header-toolbar { margin-bottom: 14px; gap: 8px; flex-wrap: wrap; display: flex; align-items: center; justify-content: space-between; }
.fc-toolbar > * > * { float: none; }
.fc-toolbar .fc-left, .fc-toolbar .fc-right { display: flex; gap: 6px; float: none; }
.fc-toolbar .fc-center { float: none; order: 1; }
.fc-toolbar .fc-left { order: 0; }
.fc-toolbar .fc-right { order: 2; }
.fc-toolbar::after, .fc-toolbar > .fc-clear { display: none; }
.fc-toolbar h2 { font-size: 19px; font-weight: 750; text-transform: capitalize; color: var(--ink); margin: 0; }
.fc .fc-button-group { display: inline-flex; }
.fc button.fc-button {
  height: 36px; padding: 0 12px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); text-shadow: none; box-shadow: none;
  font-weight: 600; font-size: 13.5px; border-radius: 8px; text-transform: capitalize; float: none; margin: 0;
}
.fc .fc-button-group > .fc-button { border-radius: 0; margin-left: -1px; }
.fc .fc-button-group > .fc-button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 8px 8px 0; }
.fc button.fc-button:hover { background: var(--brand-soft); color: var(--brand); }
.fc button.fc-state-active, .fc button.fc-state-active:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.fc button.fc-state-disabled { opacity: .5; }
.fc-icon { font-size: 1.2em; }
.fc-unthemed th, .fc-unthemed td, .fc-unthemed thead, .fc-unthemed tbody, .fc-unthemed .fc-divider, .fc-unthemed .fc-row, .fc-unthemed .fc-content, .fc-unthemed .fc-popover, .fc-unthemed .fc-list-view, .fc-unthemed .fc-list-heading td { border-color: var(--line); }
.fc-unthemed .fc-today { background: #fbf2f8; }
.fc-day-header { padding: 8px 0 !important; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.fc-day-number { padding: 4px 7px !important; font-size: 13px; color: var(--ink-2); }
.fc-event { border: 0; border-radius: 6px; padding: 2px 5px; font-size: 12px; background: var(--brand-soft); color: var(--ink); border-left: 3px solid var(--brand-2); cursor: pointer; margin: 1px 2px; }
.fc-event.ev-free { border-left-color: var(--ok); background: #eef8f3; }
.fc-event .fc-content { display: flex; gap: 4px; align-items: center; }
.fc-event .fc-time { font-weight: 700; }
.fc-event .fc-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fc-day-grid-event .fc-content { white-space: nowrap; }
.fc-list-view { border-radius: 10px; overflow: hidden; }
.fc-unthemed .fc-list-heading td { background: #faf3f8; }
.fc-list-heading-main { font-weight: 750; color: var(--brand); text-transform: capitalize; }
.fc-list-heading-alt { color: var(--muted); text-transform: capitalize; }
.fc-list-item td { padding: 10px 14px !important; }
.fc-list-item-time { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; width: 1%; }
.fc-list-item-marker { width: 1%; }
.fc-event-dot { background: var(--brand-2); width: 10px; height: 10px; }
.fc-list-item.ev-free .fc-event-dot { background: var(--ok); }
.fc-list-item td { vertical-align: middle !important; line-height: 1.4; }
.fc-list-item-title .ev-row { display: flex; align-items: center; gap: 10px; min-height: 26px; }
.fc-list-item-title .ev-title { flex: 1; min-width: 0; }
.fc-list-item-marker .fc-event-dot { display: block; margin: 0 auto; }
.fc-unthemed .fc-list-item:hover td { background: var(--brand-soft); }
.fc-list-empty { padding: 40px 0; color: var(--muted); }
.fc-unthemed .fc-list-empty { background: #fff; }
.ev-acts { display: inline-flex; gap: 4px; flex: none; }
.ev-acts { align-items: center; }
.ev-act { display: inline-flex; align-items: center; justify-content: center; line-height: 0; font-size: 0; width: 28px; height: 28px; flex: none; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; padding: 0; }
.ev-act:hover { color: var(--brand); border-color: var(--brand-line); }
.ev-act.ev-del:hover { color: var(--danger); border-color: #f3c4c4; background: var(--danger-soft); }
.fc-day-grid-event .ev-act { width: 18px; height: 18px; border: 0; background: transparent; }
.fc-highlight { background: rgba(178, 79, 151, .18); }
.fc-more { color: var(--brand); font-weight: 600; }

/* ---------------- Scadenza annualità ---------------- */
.license { --lic: #a3ee07; position: relative; padding: 12px 14px; border-radius: 12px; background: linear-gradient(160deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .04)); border: 1px solid rgba(255, 255, 255, .12); overflow: hidden; }
.license::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--lic); }
.lic-head { display: flex; align-items: center; gap: 7px; }
.lic-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: rgba(255, 255, 255, .1); color: var(--lic); }
.lic-label { flex: 1; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; text-transform: uppercase; color: rgba(255, 255, 255, .75); }
.lic-pill { margin-left: auto; align-self: flex-start; font-style: normal; white-space: nowrap; font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; color: #26101f; background: var(--lic); }
.lic-main { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.lic-main strong { font-size: 30px; line-height: 1; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.lic-main span { font-size: 12px; line-height: 1.2; color: rgba(255, 255, 255, .7); }
.lic-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.lic-bar i { display: block; height: 100%; border-radius: 999px; background: var(--lic); box-shadow: 0 0 10px var(--lic); }
.lic-foot { margin-top: 8px; font-size: 12px; color: rgba(255, 255, 255, .65); }
.lic-foot b { color: #fff; font-weight: 600; }
.lic-urgent .lic-pill { animation: pulse 1.6s ease-in-out infinite; }
.lic-over { background: linear-gradient(160deg, rgba(214, 69, 69, .35), rgba(214, 69, 69, .15)); border-color: rgba(255, 140, 140, .35); --lic: #ff8a8a !important; }
.lic-over .lic-pill { background: #ff5c5c; color: #fff; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.lic-card { max-width: 640px; }
.lic-now { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 10px; background: #f9f3f7; border: 1px solid var(--brand-line); margin-bottom: 20px; }
.lic-now small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.lic-now strong { font-size: 22px; color: var(--ink); }
.lic-now-sub { font-size: 13px; color: var(--muted); }
.state-pill { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.state-ok { background: var(--ok-soft); color: var(--ok); }
.state-warn { background: var(--warn-soft); color: #9a6a0e; }
.state-urgent { background: var(--danger-soft); color: var(--danger); }
.state-over { background: var(--danger); color: #fff; }
.state-none { background: #eef0f5; color: #6e768c; }
.years { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.years .btn { height: 56px; font-size: 15px; flex-direction: column; gap: 0; line-height: 1.2; }
.years .btn small { font-weight: 500; font-size: 12px; color: var(--muted); }
.years .btn-primary small { color: rgba(255, 255, 255, .85); }
.lic-preview { margin-top: 18px; padding: 12px 14px; border-radius: 10px; border: 1px dashed #e2d6df; font-size: 14px; color: var(--ink-2); text-align: center; }
.lic-preview b { color: var(--brand); font-size: 16px; }
.lic-preview.changed { border-color: var(--brand-2); background: #fffbfe; }

/* ---------------- Dialog (jQuery UI) ---------------- */
.ui-widget-overlay { position: fixed; inset: 0; background: rgba(38, 16, 31, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.ui-dialog { position: absolute; padding: 0; background: #fff; border: 0; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; outline: none; font-family: var(--font); }
.ui-dialog .ui-dialog-titlebar { display: flex; align-items: center; padding: 16px 20px 0; border: 0; background: none; }
.ui-dialog .ui-dialog-title { flex: 1; font-size: 17px; font-weight: 750; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; float: none; width: auto; margin: 0; }
.ui-dialog .ui-dialog-titlebar-close { position: static; width: 32px; height: 32px; margin: 0 -6px 0 8px; border-radius: 8px; border: 0; background: none; cursor: pointer; text-indent: -9999px; overflow: hidden; position: relative; }
.ui-dialog .ui-dialog-titlebar-close::before, .ui-dialog .ui-dialog-titlebar-close::after { content: ""; position: absolute; left: 9px; top: 15px; width: 14px; height: 2px; background: var(--muted); border-radius: 2px; transform: rotate(45deg); }
.ui-dialog .ui-dialog-titlebar-close::after { transform: rotate(-45deg); }
.ui-dialog .ui-dialog-titlebar-close:hover { background: #f4eef2; }
.ui-dialog .ui-dialog-titlebar-close .ui-icon, .ui-dialog .ui-dialog-titlebar-close .ui-button-icon-space { display: none; }
.ui-dialog .ui-dialog-content { padding: 16px 20px 6px; overflow: auto; }
.ui-dialog .ui-dialog-buttonpane { padding: 12px 20px 18px; border: 0; background: none; margin: 0; }
.ui-dialog .ui-dialog-buttonset { display: flex; justify-content: flex-end; gap: 8px; float: none; }
.ui-dialog .ui-dialog-buttonpane button { margin: 0; min-width: 96px; }
.dlg-msg .ui-dialog-titlebar { display: none; }
.dlg-msg .ui-dialog-content { padding: 22px 22px 4px; }
.dlg-body { display: flex; gap: 14px; align-items: flex-start; }
.dlg-ico { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; }
.dlg-ico.big { width: 64px; height: 64px; margin: 4px auto 12px; }
.dlg-success .dlg-ico { background: var(--ok-soft); color: var(--ok); }
.dlg-error .dlg-ico { background: var(--danger-soft); color: var(--danger); }
.dlg-warn .dlg-ico { background: var(--warn-soft); color: var(--warn); }
.dlg-info .dlg-ico { background: var(--brand-soft); color: var(--brand); }
.dlg-title { font-weight: 750; font-size: 16.5px; color: var(--ink); margin: 2px 0 4px; }
.dlg-text { color: var(--ink-2); font-size: 14.5px; line-height: 1.5; word-break: break-word; }
.dlg-text b { color: var(--ink); }
.dlg-note { margin-top: 10px; font-size: 13px; color: var(--muted); }
.dlg-result { text-align: center; padding: 4px 4px 2px; }
.dlg-result .dlg-title { font-size: 19px; }
.dlg-result .dlg-note { padding-top: 10px; border-top: 1px solid var(--line); }
.dlg-result + .ui-dialog-buttonpane .ui-dialog-buttonset, .dlg-msg .ui-dialog-buttonset { justify-content: flex-end; }
.dlg-form .ui-dialog-content { padding-top: 14px; }

/* Datepicker */
.ui-datepicker { z-index: 200 !important; width: 290px; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); font-family: var(--font); font-size: 14px; display: none; }
.ui-datepicker .ui-datepicker-header { position: relative; display: flex; align-items: center; justify-content: center; padding: 4px 36px 10px; border: 0; background: none; }
.ui-datepicker .ui-datepicker-title { display: flex; gap: 6px; margin: 0; }
.ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-year { width: auto; height: 32px; padding: 0 6px; font-size: 13.5px; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position: absolute; top: 4px; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; text-indent: -9999px; overflow: hidden; }
.ui-datepicker .ui-datepicker-prev { left: 0; } .ui-datepicker .ui-datepicker-next { right: 0; }
.ui-datepicker .ui-datepicker-prev::after, .ui-datepicker .ui-datepicker-next::after { content: ""; position: absolute; top: 11px; width: 8px; height: 8px; border: solid var(--ink-2); border-width: 0 2px 2px 0; }
.ui-datepicker .ui-datepicker-prev::after { left: 12px; transform: rotate(135deg); }
.ui-datepicker .ui-datepicker-next::after { left: 9px; transform: rotate(-45deg); }
.ui-datepicker .ui-datepicker-prev:hover, .ui-datepicker .ui-datepicker-next:hover { background: var(--brand-soft); }
.ui-datepicker .ui-icon { display: none; }
.ui-datepicker table { width: 100%; border-collapse: collapse; }
.ui-datepicker th { font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 4px 0; text-transform: uppercase; }
.ui-datepicker td { padding: 1px; }
.ui-datepicker td a, .ui-datepicker td span { display: block; text-align: center; padding: 6px 0; border-radius: 8px; text-decoration: none; color: var(--ink); }
.ui-datepicker td a:hover { background: var(--brand-soft); color: var(--brand); }
.ui-datepicker .ui-state-highlight { background: #f4e3ef; font-weight: 700; }
.ui-datepicker .ui-state-active { background: var(--brand) !important; color: #fff !important; }
.ui-datepicker .ui-state-disabled span { color: #cfc4cc; }
.ui-datepicker-other-month a { opacity: .4; }
/* Timepicker */
.ui-timepicker-wrapper { z-index: 200 !important; width: 120px !important; max-height: 220px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); font-family: var(--font); margin-top: 4px; }
.ui-timepicker-list li { padding: 6px 12px; font-size: 14px; color: var(--ink); }
.ui-timepicker-list li:hover, .ui-timepicker-list .ui-timepicker-selected { background: var(--brand) !important; color: #fff !important; }
.ui-timepicker-list li.ui-timepicker-disabled { color: #cfc4cc; }
/* Tooltip jQuery UI */
.ui-tooltip { padding: 6px 10px; background: var(--ink); color: #fff; border-radius: 6px; font-size: 12.5px; box-shadow: var(--shadow); border: 0; max-width: 300px; }
.ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .content { margin-left: 0 !important; }
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .app.sb-mobile-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.sb-mobile-open .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(38, 16, 31, .45); backdrop-filter: blur(2px); }
  .btn-menu { display: inline-flex !important; }
  .btn-menu span { display: none; }
  .topbar { padding: 0 14px; height: 58px; }
  .main { padding: 16px 14px 24px; }
  .pub-main { padding: 16px 12px 24px; }
  .pub-head { padding: 12px 14px; }
  .pub-head .btn span { display: none; }
  .tb-hello { display: none; }
}
@media (max-width: 640px) {
  .fgrid { grid-template-columns: 1fr; }
  .form-card { padding: 20px 18px; }
  .pt-title { font-size: 19px; }
  .page-actions .btn span { display: none; }
  .page-actions .btn { padding: 0 11px; }
  .search input { width: 100%; }
  .page-actions, .search { width: 100%; }
  .cal-card { padding: 10px; }
  .fc-toolbar.fc-header-toolbar { justify-content: center; }
  .fc-toolbar .fc-center { order: -1; width: 100%; text-align: center; }
  .fc-toolbar h2 { font-size: 17px; }
  .fc-list-item td { padding: 9px 8px !important; }
  .fc-list-item-title .ev-row { gap: 6px; }
  .years .btn { font-size: 14px; }
  .auth-card { padding: 24px 20px 22px; }
  /* Tabelle a schede */
  .table-wrap { max-height: none; }
  .tabella thead { display: none; }
  .tabella, .tabella tbody, .tabella tr, .tabella td { display: block; width: 100%; }
  .tabella tr { padding: 10px 12px; border-bottom: 1px solid var(--line); position: relative; }
  .tabella td { border: 0; padding: 3px 0; background: none !important; text-align: left !important; }
  .tabella td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 82px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
  .tabella td.w-n { display: none; }
  .tabella td.actions { position: absolute; right: 10px; top: 10px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .topbar, .page-actions, .pub-head .btn { display: none !important; }
  .content { margin: 0 !important; }
}

/* Lista calendario sempre ad altezza naturale (come contentHeight 9999 dell'originale) */
.fc-list-view .fc-scroller { height: auto !important; overflow: visible !important; }
/* Tablesorter: freccia accanto al testo, nessuna freccia sulle colonne non ordinabili */
.tabella thead th .tablesorter-header-inner { display: inline-block; }
.tabella thead th.no-sort::after, .tabella thead th.sorter-false::after { display: none; }

/* ---------------- Calendario pubblico: intestazione ---------------- */
.pub-top { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 12px; margin: 4px 0 18px; }
.pub-title { margin: 0; text-align: center; font-size: 26px; font-weight: 800; color: var(--brand); letter-spacing: .3px; }
.pub-side-r { display: flex; justify-content: flex-end; }
.pub-access { display: block; width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 2px 10px rgba(60, 20, 50, .25); transition: transform .15s, box-shadow .15s; }
.pub-access img { width: 44px; height: 44px; border-radius: 50%; display: block; }
.pub-access:hover { transform: scale(1.06); box-shadow: 0 4px 16px rgba(60, 20, 50, .35); }

/* ---------------- Vista mese: eventi sempre visibili e leggibili ---------------- */
.fc-month-view .fc-day-grid-event { margin: 2px 3px 3px; padding: 4px 6px; border-radius: 6px; }
.fc-month-view .fc-day-grid-event .fc-content { display: block; white-space: normal; }
.fc-month-view .ev-top { display: flex; align-items: center; gap: 4px; min-height: 18px; }
.fc-month-view .ev-top .fc-time { flex: 1; font-size: 11.5px; font-weight: 800; color: var(--ink); }
.fc-month-view .fc-day-grid-event .fc-title { display: block; white-space: normal; overflow: visible; text-overflow: clip; font-size: 12px; line-height: 1.3; word-break: break-word; margin-top: 1px; }
.fc-month-view .fc-day-grid-event .ev-act { width: 20px; height: 20px; border: 0; background: rgba(255, 255, 255, .7); border-radius: 5px; }
.fc-month-view .fc-day-grid-event .ev-act .ico { width: 12px; height: 12px; }
.fc-month-view .fc-day-number { font-weight: 700; }
.fc-month-view .fc-other-month { background: #fbf8fa; }
.fc-month-view td.fc-day-top.fc-other-month .fc-day-number { opacity: .45; }
.fc-more-cell, .fc-more { display: none !important; }
@media (max-width: 640px) {
  .pub-top { grid-template-columns: 40px 1fr 40px; }
  .pub-title { font-size: 21px; }
  .pub-access, .pub-access img { width: 38px; height: 38px; }
  .fc-month-view .fc-day-grid-event { margin: 1px; padding: 2px 3px; }
  .fc-month-view .ev-top .fc-time { font-size: 9.5px; }
  .fc-month-view .fc-day-grid-event .fc-title { font-size: 9.5px; line-height: 1.2; }
  .fc-month-view .ev-top { flex-wrap: wrap; }
  .fc-month-view .fc-day-grid-event .ev-act { width: 16px; height: 16px; }
  .fc-month-view .fc-day-grid-event .ev-act .ico { width: 10px; height: 10px; }
  .fc-month-view .fc-day-header { font-size: 10px; }
}

/* Avvisi e-mail di scadenza (pagina webmaster) */
.avvisi { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.avvisi li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; font-size: 13.5px; border-top: 1px solid var(--line); }
.avvisi li:first-child { border-top: 0; }
.avvisi li span { color: var(--ink-2); }
.avvisi li em { font-style: normal; font-weight: 600; text-align: right; }
.avvisi .av-ok em { color: var(--ok); }
.avvisi .av-wait em { color: var(--muted); }
.avvisi .av-skip em { color: var(--warn); }
@media (max-width: 640px) { .avvisi li { flex-direction: column; gap: 2px; } .avvisi li em { text-align: left; } }

/* ---------------- Ricerca messe ---------------- */
.cal-search input { width: 260px; }
.search-card { margin-bottom: 14px; overflow: hidden; }
.sr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #faf6f9; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.sr-list { max-height: 360px; overflow-y: auto; }
.sr-sep { padding: 6px 14px; font-size: 11.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); background: #fcfafb; border-bottom: 1px solid #f3edf1; }
.sr-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid #f3edf1; background: #fff; text-align: left; cursor: pointer; }
.sr-row:hover, .sr-row.is-sel { background: var(--brand-soft); }
.sr-row.is-past { opacity: .75; }
.sr-date { flex: none; width: 118px; display: flex; flex-direction: column; line-height: 1.25; }
.sr-date b { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.sr-date small, .sr-main small { font-size: 12px; color: var(--muted); }
.sr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sr-int { font-weight: 600; color: var(--ink); }
.sr-int i { font-weight: 400; color: var(--ok); font-style: normal; }
.sr-go { flex: none; color: var(--muted); display: flex; }
.sr-row:hover .sr-go { color: var(--brand); }
.sr-empty { padding: 26px 14px; text-align: center; color: var(--muted); }
.search-card mark { background: #fbe28a; color: inherit; border-radius: 3px; padding: 0 1px; }
.fc-event.ev-flash, .fc-list-item.ev-flash td { animation: evFlash 1.2s ease-in-out 3; }
.fc-list-item.ev-flash td { background: #fdf3c4 !important; }
.fc-event.ev-flash { box-shadow: 0 0 0 2px #e9b949; }
@keyframes evFlash { 50% { filter: brightness(.92); } }
@media (max-width: 640px) {
  .cal-search, .cal-search input { width: 100%; }
  .sr-row { gap: 10px; padding: 9px 12px; }
  .sr-date { width: 104px; }
  .sr-date small { font-size: 11px; }
}

/* ---------------- Dialog sempre al centro dello schermo (anche dopo lo scorrimento) ---------------- */
.ui-dialog {
  position: fixed !important; top: 50% !important; left: 50% !important; transform: translate(-50%, -50%);
  max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); display: flex !important; flex-direction: column;
}
.ui-dialog[style*="display: none"] { display: none !important; }
.ui-dialog .ui-dialog-content { flex: 1 1 auto; min-height: 0; }
.ui-dialog .ui-dialog-titlebar, .ui-dialog .ui-dialog-buttonpane { flex: none; }

/* ---------------- Navigazione anni e "Vai a" ---------------- */
.fc button.fc-prevYear-button, .fc button.fc-nextYear-button { font-size: 0; padding: 0 10px; }
.fc button.fc-prevYear-button::before, .fc button.fc-nextYear-button::before { font-size: 13px; font-weight: 700; }
.fc button.fc-prevYear-button::before { content: "\00AB  anno"; }
.fc button.fc-nextYear-button::before { content: "anno  \00BB"; }
.fc button.fc-prevYear-button .fc-icon, .fc button.fc-nextYear-button .fc-icon { display: none; }
.fc-toolbar .fc-left { flex-wrap: wrap; }
.goto { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.goto label { display: flex; flex-direction: column; gap: 6px; }
.goto label span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
@media (max-width: 640px) {
  .fc-toolbar .fc-left { justify-content: center; width: 100%; }
  .fc button.fc-prevYear-button::before { content: "\00AB"; }
  .fc button.fc-nextYear-button::before { content: "\00BB"; }
}
/* testi lunghi (nomi con trattini, telefoni) vanno a capo invece di allargare la lista */
.fc-list-table { width: 100%; }
.fc-list-item-title, .fc-list-item-title .ev-title { overflow-wrap: anywhere; word-break: break-word; }
.fc button.fc-vaiA-button { text-transform: none; }
@media (max-width: 640px) {
  .fc-list-item-time { white-space: normal !important; width: 54px; font-size: 13px; }
  .fc-list-heading-alt { white-space: nowrap; }
}
