/* ==========================================================================
   osTicket 1.18 — Tema "Modern" per il portale clienti
   Caricato DOPO theme.css (include/client/header.inc.php).
   Per disattivarlo basta rimuovere la riga <link> nell'header.
   ========================================================================== */

:root {
  --ost-primary: #2563eb;
  --ost-primary-600: #1d4ed8;
  --ost-primary-50: #eff6ff;
  --ost-primary-100: #dbeafe;
  --ost-text: #0f172a;
  --ost-text-2: #334155;
  --ost-muted: #64748b;
  --ost-border: #e2e8f0;
  --ost-border-strong: #cbd5e1;
  --ost-bg: #f1f5f9;
  --ost-surface: #ffffff;
  --ost-surface-2: #f8fafc;
  --ost-success: #16a34a;
  --ost-success-bg: #f0fdf4;
  --ost-warning: #d97706;
  --ost-warning-bg: #fffbeb;
  --ost-danger: #dc2626;
  --ost-danger-bg: #fef2f2;
  --ost-radius: 10px;
  --ost-radius-sm: 6px;
  --ost-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --ost-font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
body {
  background: var(--ost-bg);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ost-text);
}
body, input, select, textarea {
  font-family: var(--ost-font);
  color: var(--ost-text);
}
a, .link { color: var(--ost-primary); }
a:hover, .link:hover {
  color: var(--ost-primary-600);
  border-bottom: none;
  margin-bottom: 1px;
  text-decoration: underline;
}
h1 {
  color: var(--ost-text);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: 8px;
}
h2, .subject { font-size: 18px; font-weight: 600; color: var(--ost-text); }
h3 { font-size: 16px; font-weight: 600; }
hr { border-top-color: var(--ost-border); }
.faded { color: var(--ost-muted); }

/* ---------- Layout ---------- */
#container {
  width: auto;
  max-width: 1040px;
  margin: 24px auto;
  background: var(--ost-surface);
  border-radius: 14px;
  box-shadow: var(--ost-shadow);
  overflow: hidden;
}

/* Intestazione: logo a sinistra, area utente a destra (in pagina l'area utente
   viene prima del logo, da qui row-reverse) */
#header {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: auto;
  min-height: 76px;
  padding: 10px 32px;
  background: var(--ost-surface);
  border-bottom: 1px solid var(--ost-border);
}
#header::after { display: none; }
#header > .pull-right, #header > #logo { float: none; }
#header #logo { display: flex; align-items: center; height: auto; }
#header #logo:hover { text-decoration: none; }
#header #logo .valign-helper { display: none; }
#header #logo img { max-height: 56px; }
#header p {
  width: auto;
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: #94a3b8;
}
#header p + p:not(:has(a)) { display: none; }
#header p a {
  margin: 0 4px;
  color: var(--ost-text-2);
  font-weight: 500;
}
#header p a:hover { color: var(--ost-primary-600); text-decoration: none; }
#header p a::before {
  font-family: FontAwesome;
  font-weight: normal;
  margin-right: 6px;
  color: var(--ost-muted);
}
#header p a[href*="profile.php"]::before { content: "\f007"; }
#header p a[href*="tickets.php"]::before { content: "\f145"; }
/* Accedi / Esci come pulsanti */
#header p a[href*="login.php"],
#header p a[href*="logout.php"] {
  display: inline-block;
  margin-left: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  font-weight: 600;
  line-height: 20px;
  transition: background-color .15s, border-color .15s;
}
#header p a[href*="login.php"] {
  color: #fff;
  background: var(--ost-primary);
  border: 1px solid var(--ost-primary);
}
#header p a[href*="login.php"]:hover { color: #fff; background: var(--ost-primary-600); }
#header p a[href*="login.php"]::before { content: "\f090"; color: inherit; }
#header p a[href*="logout.php"] {
  color: var(--ost-text-2);
  background: #fff;
  border: 1px solid var(--ost-border-strong);
}
#header p a[href*="logout.php"]:hover { border-color: #94a3b8; background: var(--ost-surface-2); }
#header p a[href*="logout.php"]::before { content: "\f08b"; color: inherit; }

/* Barra di navigazione: voci con icona, quella attiva sottolineata */
#nav {
  display: flex;
  gap: 4px;
  height: auto;
  margin: 0;
  padding: 0 24px;
  background: var(--ost-surface);
  border-top: none;
  border-bottom: 1px solid var(--ost-border);
  box-shadow: none;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
#nav::-webkit-scrollbar { display: none; }
#nav li { display: block; }
#nav li a,
#nav li a[class] {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: auto;
  margin: 0;
  padding: 15px 12px;
  line-height: 20px;
  color: var(--ost-muted);
  font-weight: 500;
  border-radius: 0;
  background: none;
  transition: color .15s;
}
.rtl #nav li a { padding: 15px 12px; margin: 0; }
#nav li a::before {
  font-family: FontAwesome;
  font-weight: normal;
  font-size: 15px;
  width: 16px;
  text-align: center;
  opacity: .85;
}
#nav li a.home::before    { content: "\f015"; }
#nav li a.kb::before      { content: "\f02d"; }
#nav li a.new::before     { content: "\f067"; }
#nav li a.status::before  { content: "\f002"; }
#nav li a.tickets::before { content: "\f145"; }
#nav li a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background-color .15s;
}
#nav li a:hover {
  color: var(--ost-text);
  background: none;
  text-decoration: none;
}
#nav li a:hover::after { background: var(--ost-border-strong); }
#nav li a.active { color: var(--ost-primary-600); background: none; }
#nav li a.active::after { background: var(--ost-primary); }
#nav li a.active::before { opacity: 1; }

#content {
  margin: 0;
  padding: 28px 32px 36px;
  min-height: 380px;
}

#footer {
  max-width: 1040px;
  margin: 0 auto 32px;
  color: var(--ost-muted);
  font-size: 13px;
}
#footer a { color: var(--ost-muted); }
#footer #poweredBy { opacity: .55; margin-top: 6px; transition: opacity .2s; }
#footer #poweredBy:hover { opacity: 1; }

/* Pagina iniziale: contenuto + sidebar */
.main-content { width: calc(100% - 270px); }
.sidebar { width: 240px; }
.sidebar .front-page-button p { margin: 0 0 10px; }
.sidebar .front-page-button .button { max-width: none; }
.sidebar .content {
  padding: 16px 18px;
  border: 1px solid var(--ost-border);
  border-radius: var(--ost-radius);
  background: var(--ost-surface-2);
  line-height: 1.45;
}
.sidebar section .header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ost-muted);
  margin-bottom: 8px;
}
.sidebar section div + div { margin-top: 6px; }

.thread-body,
.thread-body h1, .thread-body h2, .thread-body h3,
.thread-body h4, .thread-body h5, .thread-body h6 { font-family: var(--ost-font); }
.thread-body { color: var(--ost-text-2); font-size: 15px !important; line-height: 1.6; }
.thread-body a:not(.button) { color: var(--ost-primary) !important; }
#ticketTable .truncate { vertical-align: middle; }

#landing_page .thread-body {
  border: none;
  padding: 4px 0 0;
}
.search-form { padding: 0 0 20px; }
.search-form form { display: flex; gap: 8px; align-items: stretch; }
.searchbar .search,
.search-form .search {
  flex: 1;
  width: auto;
  padding: 10px 14px;
  border: 1px solid var(--ost-border-strong);
  border-radius: 8px;
  box-shadow: none;
  font-size: 15px;
}
.search-form .button { margin: 0; }

/* Articoli in evidenza */
.featured-category {
  width: calc(50% - 10px);
  margin: 10px 8px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--ost-border);
  border-radius: var(--ost-radius);
  background: var(--ost-surface);
  transition: box-shadow .2s, border-color .2s;
}
.featured-category:hover { border-color: var(--ost-primary-100); box-shadow: var(--ost-shadow); }
.featured-category i { color: var(--ost-primary); text-shadow: none; }
.category-name { font-weight: 600; font-size: 16px; margin-left: 6px; }
.article-headline { margin-top: 10px; }
.article-teaser { color: var(--ost-muted); }

/* ---------- Pulsanti ---------- */
.button, .button:visited,
input[type="submit"], input[type="button"], input[type="reset"], button[type="submit"] {
  display: inline-block;
  max-width: none;
  padding: 9px 18px;
  font-family: var(--ost-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--ost-text-2);
  background: var(--ost-surface);
  border: 1px solid var(--ost-border-strong);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  text-shadow: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s;
}
input[type="button"]:hover, input[type="reset"]:hover {
  background: var(--ost-surface-2);
  border-color: #94a3b8;
}
.button:active, input[type="submit"]:active, button[type="submit"]:active { top: 0; transform: translateY(1px); }

/* Primari: azzurro e submit */
.button, .button:visited,
.blue.button, .blue.button:visited,
input[type="submit"], button[type="submit"] {
  color: #fff;
  background: var(--ost-primary);
  border-color: var(--ost-primary);
}
.button:hover, .blue.button:hover,
input[type="submit"]:hover, button[type="submit"]:hover {
  color: #fff;
  background: var(--ost-primary-600);
  border-color: var(--ost-primary-600);
  text-decoration: none;
}
/* "Verifica stato" / ricerca: secondario */
.green.button, .green.button:visited {
  color: var(--ost-primary-600);
  background: var(--ost-primary-50);
  border-color: var(--ost-primary-100);
}
.green.button:hover {
  color: var(--ost-primary-600);
  background: var(--ost-primary-100);
  border-color: var(--ost-primary-100);
}
.action-button {
  color: var(--ost-text-2) !important;
  background: var(--ost-surface);
  border: 1px solid var(--ost-border-strong);
  border-radius: var(--ost-radius-sm);
  line-height: 24px;
  padding: 0 8px;
}
.action-button span, .action-button a { color: var(--ost-text-2) !important; }

/* ---------- Campi modulo ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="search"], input[type="date"], select, textarea {
  padding: 8px 12px;
  font-size: 15px;
  border: 1px solid var(--ost-border-strong);
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
  max-width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
select { padding-right: 28px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ost-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}
#ticketForm div input, #clientLogin div input,
#ticketForm div textarea, #clientLogin div textarea,
#reply input[type=text], #reply #response_options textarea {
  border: 1px solid var(--ost-border-strong);
}
#ticketForm > table { width: 100%; max-width: 820px; table-layout: auto; }
/* la prima riga ha colspan=2: con table-layout fixed le colonne finivano 50/50 */
#ticketForm tr.captchaRow td:first-child { width: 160px; vertical-align: middle; }
#ticketForm tr.captchaRow td + td { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
#ticketForm .captcha, #ticketForm .captcha img { float: none; margin-right: 0; }
#ticketForm td { padding: 4px 0; }
#ticketForm hr { margin: 16px 0; }
#ticketForm .form-header b, .form-header h3 { font-size: 16px; font-weight: 600; }
#ticketForm .buttons, #reply .buttons, p.buttons { padding-top: 8px; }
#ticketForm .buttons input, p.buttons input { margin: 0 4px; }
label.required, span.required { font-weight: 600; }
.error, font.error { color: var(--ost-danger); }
#ticketForm div.error input, #clientLogin div.error input { border-color: var(--ost-danger); }
em, #ticketForm td em { color: var(--ost-muted); }

/* ---------- Messaggi ---------- */
#msg_notice, #msg_warning, #msg_error, #msg_info, .warning-banner,
.notice_bar, .warning_bar, .error_bar {
  height: auto;
  line-height: 1.45;
  padding: 12px 16px 12px 44px;
  margin-bottom: 18px;
  border: 1px solid;
  border-left-width: 4px;
  border-radius: 8px;
  background-position: 16px 50%;
  font-size: 14px;
}
.notice_bar, .warning_bar, .error_bar { margin: 0; border-radius: 0; border-width: 0 0 1px; }
#msg_notice, .notice_bar { border-color: #bbf7d0; border-left-color: var(--ost-success); background-color: var(--ost-success-bg); color: #14532d; }
#msg_warning, .warning-banner, .warning_bar { border-color: #fde68a; border-left-color: var(--ost-warning); background-color: var(--ost-warning-bg); color: #78350f; }
#msg_error, .error_bar { border-color: #fecaca; border-left-color: var(--ost-danger); background-color: var(--ost-danger-bg); color: #7f1d1d; }
#msg_info { padding-left: 16px; border-color: var(--ost-primary-100); border-left-color: var(--ost-primary); background-color: var(--ost-primary-50); color: #1e3a8a; }

/* ---------- Accesso cliente ---------- */
#clientLogin {
  margin-top: 16px;
  padding: 28px;
  border: 1px solid var(--ost-border);
  border-radius: 12px;
  box-shadow: none;
  background: var(--ost-surface-2);
}
#clientLogin input[type=text],
#clientLogin input[type=password] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
}
/* theme.css imposta "#clientLogin div input { background:#fff }": va battuto in specificità */
#clientLogin input[type=submit], #clientLogin div input[type=submit],
#ticketForm div input[type=submit] {
  padding: 9px 22px;
  border-radius: 8px;
  color: #fff;
  background: var(--ost-primary);
  border: 1px solid var(--ost-primary);
}
#clientLogin div input[type=submit]:hover,
#ticketForm div input[type=submit]:hover { background: var(--ost-primary-600); border-color: var(--ost-primary-600); }
#clientLogin strong { font-size: 13px; color: var(--ost-danger); }
.login-box { box-shadow: 1px 0 0 var(--ost-border); padding: 4px 28px 4px 0; }
.rtl .login-box { box-shadow: -1px 0 0 var(--ost-border); }
#clientLogin .instructions { padding-left: 28px; padding-right: 0; color: var(--ost-text-2); }

/* ---------- Elenco ticket ---------- */
.search.well {
  margin-top: 0;
  padding: 14px 16px;
  background: var(--ost-surface-2);
  border: 1px solid var(--ost-border);
  border-radius: var(--ost-radius);
}
#ticketTable {
  width: 100%;
  border: 1px solid var(--ost-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--ost-radius);
  overflow: hidden;
}
#ticketTable caption {
  padding: 0 0 10px;
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--ost-text);
}
#ticketTable th {
  height: auto;
  line-height: 1.3;
  padding: 11px 12px;
  background: var(--ost-surface-2);
  border: none;
  border-bottom: 1px solid var(--ost-border);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ost-muted);
}
#ticketTable th a { color: var(--ost-muted); }
#ticketTable td {
  padding: 11px 12px;
  border: none;
  border-bottom: 1px solid var(--ost-border);
  vertical-align: middle;
}
#ticketTable tbody tr:last-child td { border-bottom: none; }
#ticketTable tr.alt td { background: transparent; }
#ticketTable tbody tr:hover td { background: var(--ost-primary-50); }

.states { margin-bottom: 10px; }
.active.state { color: var(--ost-primary-600); }

#pagination li a, #pagination .active { border-radius: 6px; padding: 4px 9px; font-size: 13px; }
#pagination .active { background: var(--ost-primary); color: #fff; }
#pagination li a:hover { background: var(--ost-primary-50); color: var(--ost-primary-600); text-decoration: none; }

/* ---------- Dettaglio ticket e conversazione ---------- */
#ticketInfo h1 { border-bottom: 1px solid var(--ost-border); padding-bottom: 14px; margin-bottom: 14px; }
.infoTable, table.custom-data th { background: var(--ost-surface-2); }
.infoTable { border: 1px solid var(--ost-border); border-radius: var(--ost-radius); }
.infoTable th, .infoTable td { padding: 6px 10px; }
table.custom-data th { color: var(--ost-muted); font-weight: 500; }

.thread-entry .header {
  padding: 10px 14px;
  border: 1px solid var(--ost-border);
  border-radius: var(--ost-radius) var(--ost-radius) 0 0;
}
.thread-entry .thread-body {
  border: 1px solid var(--ost-border);
  border-top: none;
  border-radius: 0 0 var(--ost-radius) var(--ost-radius);
  background: #fff;
}
.thread-entry.message .header { background: var(--ost-primary-50); border-color: var(--ost-primary-100); }
.thread-entry.avatar.message .header:before { border-right-color: var(--ost-primary-100); }
.thread-entry.avatar.message .header:after { border-right-color: var(--ost-primary-50); }
.thread-entry.response .header { background: #f1f5f9; }
.thread-entry.avatar .header:before { border-left-color: var(--ost-border); }
.thread-entry.avatar.response .header:after { border-left-color: #f1f5f9; }
.thread-entry > .avatar { border-radius: 50%; overflow: hidden; }
.thread-body .attachments { background: var(--ost-surface-2); border-top: 1px solid var(--ost-border); }
#ticketThread::before { border-left-color: var(--ost-border); }
.type-icon { border-radius: 50%; background: var(--ost-surface-2); border-color: var(--ost-border); }
.label { border-radius: 999px; padding: 2px 8px; text-shadow: none; font-weight: 600; }

#reply {
  margin-top: 16px;
  padding: 20px;
  background: var(--ost-surface-2);
  border: 1px solid var(--ost-border);
  border-radius: 12px;
}
#reply h2 { border-bottom: 1px solid var(--ost-border); padding-bottom: 10px; }
#reply textarea { width: 100% !important; }

/* ---------- Knowledge base ---------- */
#kb > li {
  margin-bottom: 10px;
  padding: 14px 16px;
  background: var(--ost-surface);
  border: 1px solid var(--ost-border);
  border-radius: var(--ost-radius);
}
#kb > li h4 a { font-size: 16px; font-weight: 600; }
#faq ol { border-top-color: var(--ost-border); }
#faq ol li a { border-bottom-color: var(--ost-border); padding: 10px 0 10px 26px; }
#faq ol li a:hover { background-color: var(--ost-primary-50); text-decoration: none; }
#faq .article-meta { background: var(--ost-surface-2); border-radius: 8px; }
#breadcrumbs { color: var(--ost-muted); }

/* Editor rich-text */
.redactor-box, .redactor-editor, .redactor-layer { border-color: var(--ost-border-strong) !important; border-radius: 8px; }
.redactor-toolbar { border-radius: 8px 8px 0 0; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  #container { margin: 0; border-radius: 0; box-shadow: none; }
  #header, #content { padding-left: 16px; padding-right: 16px; }
  #header { min-height: 64px; flex-direction: column-reverse; align-items: flex-start; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
  #header > .pull-right { text-align: left; }
  #header p a:first-child { margin-left: 0; }
  #header #logo img { max-height: 44px; }
  #header p { width: auto; font-size: 13px; }
  #nav { padding: 0 6px; }
  #nav li a, #nav li a[class] { padding: 13px 10px; }
  .sidebar, .main-content, .featured-category, .span4, .span8 {
    float: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
  .sidebar { margin-bottom: 20px; }
  #ticketForm > table, #ticketForm > table td, #ticketForm > table td + td { display: block; width: 100%; }
  #ticketForm td textarea, #ticketForm div textarea, #reply textarea { width: 100% !important; }
  .login-box, #clientLogin .instructions { display: block; width: 100%; box-shadow: none; padding: 0 0 16px; }
  #ticketTable { display: block; overflow-x: auto; }
}

/* ==========================================================================
   Landing page (index.php) — hero a tema con sfondo "circuito"
   Solo CSS: index.php e il testo di benvenuto (Admin > Pagine) restano intatti.
   ========================================================================== */
:root {
  --ost-circuit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.13' stroke-width='1.4'%3E%3Cpath d='M0 40h46l22 22h44M112 62v44l22 22h46M24 180v-44l22-22h34M124 0v24l-22 22M150 128v52M60 114V90'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.28'%3E%3Ccircle cx='46' cy='40' r='3'/%3E%3Ccircle cx='112' cy='62' r='3'/%3E%3Ccircle cx='80' cy='114' r='3'/%3E%3Ccircle cx='102' cy='46' r='3'/%3E%3Ccircle cx='150' cy='128' r='3'/%3E%3Ccircle cx='60' cy='90' r='3'/%3E%3C/g%3E%3C/svg%3E");
}

/* Fascia colorata dietro la card, solo in home.
   Il primo livello sfuma la fascia nel grigio di fondo e copre il resto della pagina. */
body:has(#landing_page) {
  background-color: var(--ost-bg);
  background-image:
    linear-gradient(180deg, rgba(241, 245, 249, 0) 300px, var(--ost-bg) 470px),
    var(--ost-circuit),
    radial-gradient(900px 420px at 10% 0%, rgba(14, 165, 233, .45), transparent 65%),
    radial-gradient(800px 420px at 95% 10%, rgba(99, 102, 241, .45), transparent 65%),
    linear-gradient(160deg, #0b1e4a 0%, #1e3a8a 300px, #1d4ed8 470px);
  background-size: 100% 100%, 180px 180px, 100% 100%, 100% 100%, 100% 100%;
  background-repeat: no-repeat, repeat, no-repeat, no-repeat, no-repeat;
  min-height: 100vh;
}
body:has(#landing_page) #container { margin-top: 40px; }

/* Hero a tutta larghezza dentro la card */
#landing_page {
  position: relative;
  margin: -28px -32px -36px;
  padding: 56px 40px 60px;
  color: #fff;
  background:
    var(--ost-circuit),
    radial-gradient(600px 300px at 85% 20%, rgba(56, 189, 248, .35), transparent 70%),
    linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0ea5e9 100%);
  overflow: hidden;
}
#landing_page::after { content: ""; display: table; clear: both; }

#landing_page .main-content { width: calc(100% - 320px); }
#landing_page .thread-body { color: rgba(255, 255, 255, .88); background: transparent; padding: 0; }
#landing_page .thread-body h1 {
  margin: 0 0 16px;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #fff;
}
#landing_page .thread-body p { font-size: 16px !important; line-height: 1.65; max-width: 62ch; }
#landing_page .thread-body a:not(.button) { color: #fff !important; }

/* Riquadro azioni "in vetro" */
#landing_page .sidebar { width: 280px; margin: 0; }
#landing_page .front-page-button {
  padding: 22px 20px 12px;
  text-align: left;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 16px;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(2, 6, 23, .25);
}
#landing_page .front-page-button::before {
  content: "Come possiamo aiutarti?";
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .75);
}
#landing_page .front-page-button .button {
  padding: 13px 18px;
  font-size: 15px;
  text-align: left;
  border-radius: 10px;
  box-shadow: none;
}
#landing_page .front-page-button .button::before {
  font-family: FontAwesome;
  font-weight: normal;
  display: inline-block;
  width: 22px;
}
#landing_page .blue.button {
  color: var(--ost-primary-600);
  background: #fff;
  border-color: #fff;
}
#landing_page .blue.button::before { content: "\f067"; }
#landing_page .blue.button:hover { background: var(--ost-primary-50); color: var(--ost-primary-600); }
#landing_page .green.button {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, .5);
}
#landing_page .green.button::before { content: "\f002"; }
#landing_page .green.button:hover { background: rgba(255, 255, 255, .14); border-color: #fff; color: #fff; }

@media (max-width: 900px) {
  body:has(#landing_page) #container { margin-top: 0; }
  #landing_page { margin: -28px -16px -36px; padding: 32px 20px 36px; }
  #landing_page .main-content, #landing_page .sidebar { width: 100%; }
  #landing_page .sidebar { margin-bottom: 28px; }
  #landing_page .thread-body h1 { font-size: 26px; }
}

/* ==========================================================================
   Pagine modulo: "Apri un nuovo ticket" (#ticketForm) e
   "Verifica stato ticket" / accesso clienti (#clientLogin)
   ========================================================================== */

/* Intestazione a tema: #content diventa una griglia e una fascia (::before)
   occupa esattamente le righe del titolo e del sottotitolo */
#content:has(> #ticketForm),
#content:has(> #clientLogin) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}
#content:has(> #ticketForm)::before,
#content:has(> #clientLogin)::before {
  content: "";
  grid-row: 1 / 3;
  grid-column: 1;
  margin: -28px -32px 0;
  background:
    var(--ost-circuit),
    radial-gradient(500px 240px at 90% 0%, rgba(56, 189, 248, .35), transparent 70%),
    linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0ea5e9 100%);
}
#content:has(> #ticketForm) > h1,
#content:has(> #clientLogin) > h1 {
  grid-row: 1;
  grid-column: 1;
  position: relative;
  margin: 14px 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #fff;
}
#content:has(> #ticketForm) > h1 + p,
#content:has(> #clientLogin) > h1 + p {
  grid-row: 2;
  grid-column: 1;
  position: relative;
  max-width: 70ch;
  margin: 0;
  padding-bottom: 30px;
  font-size: 15px;
  color: rgba(255, 255, 255, .85);
}
#content:has(> #ticketForm) > h1::before,
#content:has(> #clientLogin) > h1::before {
  font-family: FontAwesome;
  font-weight: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: 12px;
  font-size: 18px;
  vertical-align: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25);
}
#content:has(> #ticketForm) > h1::before { content: "\f044"; }
body:has(#nav a.status.active) #content > h1::before { content: "\f002"; }
body:not(:has(#nav a.status.active)) #content:has(> #clientLogin) > h1::before { content: "\f090"; }
#content:has(> #ticketForm) > #msg_error,
#content:has(> #ticketForm) > #msg_warning,
#content:has(> #clientLogin) > #msg_error,
#content:has(> #clientLogin) > #msg_warning { margin-top: 24px; margin-bottom: 0; }

/* ---------- Apri un nuovo ticket: schede numerate ---------- */
#ticketForm {
  margin-top: 28px;
  counter-reset: ost-step;
}
#ticketForm > table,
#ticketForm > table > tbody,
#ticketForm > table > tbody > tr,
#ticketForm > table > tbody > tr > td {
  display: block;
  width: auto;
  max-width: none;
}
#ticketForm > table > tbody {
  margin-bottom: 16px;
  padding: 22px 26px 18px;
  background: var(--ost-surface);
  border: 1px solid var(--ost-border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
#ticketForm > table > tbody:not(:has(td)),
#ticketForm > table > tbody#dynamic-form:not(:has(input, select, textarea)) { display: none; }
#ticketForm > table > tbody > tr > td { padding: 0 0 14px; }
#ticketForm > table > tbody > tr:last-child > td { padding-bottom: 4px; }
#ticketForm td > hr, #ticketForm > hr { display: none; }

#ticketForm .form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 6px !important;
}
#ticketForm .form-header::before {
  counter-increment: ost-step;
  content: counter(ost-step);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ost-primary-600);
  background: var(--ost-primary-50);
  border: 1px solid var(--ost-primary-100);
  border-radius: 50%;
}
#ticketForm .form-header h3,
#ticketForm .form-header b {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--ost-text);
}
#ticketForm .form-header h3::first-letter { text-transform: uppercase; }
#ticketForm .form-header > div:not(:has(*:not(br))) { display: none; }

#ticketForm label { display: block; }
#ticketForm label .required,
#ticketForm label > span:first-child {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ost-text-2);
}
#ticketForm label > br { display: none; }
#ticketForm label > span:first-child + br + input:not([type=tel]),
#ticketForm label input[type=text]:not([name$="-ext"]),
#ticketForm label input[type=email],
#ticketForm select#topicId {
  display: block;
  width: 100%;
  max-width: 480px;
}
#ticketForm select#topicId { display: inline-block; width: calc(100% - 24px); vertical-align: middle; }
#ticketForm label input[type=tel] { display: inline-block; width: 240px; }
#ticketForm label input[name$="-ext"] { display: inline-block; width: 90px; margin-left: 6px; }
#ticketForm .error { margin-left: 4px; }

#ticketForm .redactor-box { border-radius: 10px; overflow: hidden; }
#ticketForm .filedrop .dropzone {
  margin-top: 10px;
  padding: 16px;
  text-align: center;
  color: var(--ost-muted);
  background: var(--ost-surface-2);
  border: 1px dashed var(--ost-border-strong);
  border-radius: 10px;
}
#ticketForm .filedrop .dropzone i { color: var(--ost-primary); margin-right: 6px; }

#ticketForm tr.captchaRow td:first-child { width: auto; margin-bottom: 8px; font-weight: 600; }
#ticketForm tr.captchaRow td + td { padding-bottom: 4px; }
#ticketForm tr.captchaRow ~ tr { display: none; }

#ticketForm > p.buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
}
#ticketForm > p.buttons input { margin: 0; }
#ticketForm > p.buttons input[type=submit] { order: 3; padding: 11px 26px; font-size: 15px; }
#ticketForm > p.buttons input[type=reset] { order: 1; }
#ticketForm > p.buttons input[type=button] { order: 2; }

/* ---------- Verifica stato / accesso clienti ---------- */
#clientLogin {
  margin-top: 28px;
  padding: 0;
  background: var(--ost-surface);
  border: 1px solid var(--ost-border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  overflow: hidden;
}
#clientLogin > div[style*="table-row"] {
  display: grid !important;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}
#clientLogin .login-box {
  display: block;
  width: auto;
  padding: 28px;
  box-shadow: none;
}
#clientLogin .login-box > div:first-child:not(:has(strong:not(:empty))) { display: none; }
#clientLogin .login-box label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ost-text-2);
}
#clientLogin .login-box input[type=text],
#clientLogin .login-box input[type=password] {
  display: block;
  width: 100%;
  margin: 6px 0 16px;
  font-weight: 400;
}
#clientLogin .login-box p { margin: 4px 0 0; }
#clientLogin .login-box input[type=submit] { width: 100%; padding: 12px 22px; font-size: 15px; }
#clientLogin .instructions {
  display: block;
  padding: 28px 28px 28px 30px;
  line-height: 1.6;
  color: var(--ost-text-2);
  background: var(--ost-surface-2);
  border-left: 1px solid var(--ost-border);
}
.rtl #clientLogin .instructions { padding: 28px; border-left: none; border-right: 1px solid var(--ost-border); }
#clientLogin .instructions::before {
  content: "\f007";
  font-family: FontAwesome;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  font-size: 20px;
  color: var(--ost-primary-600);
  background: var(--ost-primary-100);
  border-radius: 12px;
}
#clientLogin .instructions a { font-weight: 600; }
#content:has(> #clientLogin) > br { display: none; }
#content:has(> #clientLogin) > p:last-child {
  margin: 16px 0 0;
  padding: 14px 18px;
  color: var(--ost-text-2);
  background: var(--ost-primary-50);
  border: 1px solid var(--ost-primary-100);
  border-radius: 10px;
}
#content:has(> #clientLogin) > p:last-child::before {
  content: "\f05a";
  font-family: FontAwesome;
  margin-right: 8px;
  color: var(--ost-primary);
}
#content:has(> #clientLogin) > p:last-child a { font-weight: 600; }

@media (max-width: 900px) {
  #content:has(> #ticketForm)::before,
  #content:has(> #clientLogin)::before { margin: -28px -16px 0; }
  #content:has(> #ticketForm) > h1,
  #content:has(> #clientLogin) > h1 { font-size: 23px; }
  #ticketForm > table > tbody { padding: 18px 16px 14px; }
  #ticketForm label input[type=tel] { width: calc(100% - 110px); }
  #ticketForm > p.buttons { flex-wrap: wrap; }
  #ticketForm > p.buttons input[type=submit] { flex: 1 1 100%; order: 0; }
  #clientLogin > div[style*="table-row"] { grid-template-columns: minmax(0, 1fr); }
  #clientLogin .login-box { padding: 20px 18px; }
  #clientLogin .instructions { padding: 20px 18px; border-left: none; border-top: 1px solid var(--ost-border); }
}

/* ==========================================================================
   Ottimizzazione smartphone (portale clienti)
   ========================================================================== */
/* etichetta sempre sopra il campo (anche su desktop) */
#ticketForm label > span:first-child { display: block; }

@media (max-width: 640px) {
  /* campi a 16px: sotto questa misura iOS fa lo zoom al tocco */
  input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
  input[type="number"], input[type="search"], input[type="date"], select, textarea,
  .redactor-in, .redactor-styles {
    font-size: 16px !important;
  }

  /* intestazione su una riga per l'ospite: logo a sinistra, "Accedi" a destra */
  #header:not(:has(a[href*="logout.php"])) {
    flex-direction: row-reverse;
    align-items: center;
  }
  #header:not(:has(a[href*="logout.php"])) p { font-size: 0; }
  #header:not(:has(a[href*="logout.php"])) p a { font-size: 14px; margin: 0; }
  #header #logo img { max-height: 38px; }

  /* menu come barra fissa in basso, stile app */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  #nav,
  body:has(#landing_page) #nav {
    position: fixed;
    z-index: 50;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: 0;
    padding: 0 0 env(safe-area-inset-bottom);
    overflow: visible;
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--ost-border);
    border-bottom: none;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, .08);
    -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
  }
  #nav li { flex: 1 1 0; min-width: 0; }
  #nav li a,
  #nav li a[class] {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    box-sizing: border-box;
    height: 60px;
    padding: 6px 2px;
    font-size: 0;
    line-height: 0;
    text-align: center;
  }
  #nav li a b { display: none; }
  #nav li a::before { font-size: 19px; line-height: 22px; width: auto; }
  /* l'etichetta breve prende il posto della sottolineatura */
  #nav li a::after,
  #nav li a:hover::after,
  #nav li a.active::after {
    position: static;
    height: auto;
    font-size: 11px;
    font-weight: 600;
    line-height: 14px;
    background: none;
    border-radius: 0;
  }
  #nav li a.home::after    { content: "Home"; }
  #nav li a.kb::after      { content: "Guide"; }
  #nav li a.new::after     { content: "Nuovo"; }
  #nav li a.status::after  { content: "Stato"; }
  #nav li a.tickets::after { content: "Ticket"; }
  #nav li a.active { box-shadow: inset 0 2px 0 var(--ost-primary); }

  /* Telefono e prefisso sulla stessa riga */
  #ticketForm label input[type=tel] { width: calc(100% - 128px); }
  #ticketForm label input[name$="-ext"] { width: 70px; }

  #footer { margin-bottom: 12px; }
}
