/* =====================================================================
   A.S.V. Studios Support - componenti (stesso linguaggio visivo del sito)
   ===================================================================== */

:root {
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-muted: #64748b;
  --color-soft: #f1f5f9;
  --color-danger: #dc2626;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* ---------- Page hero (da BaseLayout.astro) ---------- */
.page-hero {
  background: var(--color-black);
  border-radius: var(--radius-lg);
  padding: 5rem 4rem;
  margin: 2rem 0 3rem 0;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.page-hero-content { position: relative; z-index: 2; max-width: 800px; }
.page-title {
  font-size: 3rem; color: var(--color-white); font-family: var(--font-heading);
  font-weight: 900; line-height: 1.1; margin-bottom: 1rem; letter-spacing: -1px;
}
.page-subtitle { font-size: 1.1rem; color: #a1a1aa; font-family: var(--font-body); line-height: 1.6; }
.page-hero.compact { padding: 3rem 3rem; margin: 1.5rem 0 2rem 0; }
.page-hero.compact .page-title { font-size: 2.2rem; }
.page-hero .hero-meta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; align-items: center; }
.hero-code {
  font-family: var(--font-heading); font-weight: 900; color: #fff; letter-spacing: 1px;
  border: 1.5px solid rgba(255,255,255,.5); border-radius: 999px; padding: .3rem .9rem; font-size: .9rem;
}
@media (max-width: 768px) {
  .page-hero, .page-hero.compact { padding: 2rem 1.25rem; }
  .page-title, .page-hero.compact .page-title { font-size: 2rem; }
}

/* Logo header */
.site-logo img { width: 150px; }
.site-logo .logo-white { display: none; }

/* ---------- Layout ---------- */
.section { padding-bottom: 5rem; }
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 3rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.grid-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2.5rem; align-items: start; }
@media (max-width: 1100px) { .grid-sidebar { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 1.5rem; } }
.stack > * + * { margin-top: 1.5rem; }
.muted { color: var(--color-muted); }
.small { font-size: .85rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; } .mt-2 { margin-top: 2rem; } .mb-1 { margin-bottom: 1rem; } .mb-2 { margin-bottom: 2rem; }
.hidden-el { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.section-title {
  font-family: var(--font-heading); font-weight: 900; font-size: 1.8rem; letter-spacing: -.5px; margin-bottom: 1.5rem;
}
.section-title.sm { font-size: 1.2rem; margin-bottom: 1rem; }

/* ---------- Card (come support-card / contact-card del sito) ---------- */
.support-card, .card {
  border: 2px solid var(--color-border); border-radius: 16px; transition: all .3s ease; background: transparent;
}
.support-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 3rem 2rem;
}
.support-card:hover { border-color: var(--color-black); transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,.05); }
.card { padding: 2rem; }
.card.white { background: #fff; border-color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.03); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.card-head h3 { font-size: 1.1rem; }
.support-icon {
  width: 60px; height: 60px; background: var(--color-soft); border-radius: 50%; display: flex;
  justify-content: center; align-items: center; margin-bottom: 1.5rem; color: var(--color-black); transition: all .3s ease; flex-shrink: 0;
}
.support-icon svg { width: 28px; height: 28px; }
.support-card:hover .support-icon { background: var(--color-black); color: var(--color-white); }
.support-title { font-family: var(--font-heading); font-weight: 800; font-size: 1.8rem; margin-bottom: 1rem; letter-spacing: -.5px; }
.support-desc { color: var(--color-muted); font-size: 1.05rem; line-height: 1.6; margin-bottom: 2rem; flex-grow: 1; }
.ticket-actions-group { display: flex; gap: 1rem; width: 100%; }
@media (max-width: 600px) { .ticket-actions-group { flex-direction: column; } }

/* ---------- Bottoni (btn-card / btn-massive del sito) ---------- */
.btn-card, .btn-massive {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  font-family: var(--font-heading); font-weight: 800; text-transform: uppercase; border-radius: 12px;
  transition: all .3s ease; cursor: pointer; gap: 1rem; text-align: left;
}
.btn-card { padding: 1.25rem 2rem; font-size: 1.1rem; }
.btn-massive { padding: 2rem 2.5rem; font-weight: 900; font-size: clamp(1.2rem, 3vw, 1.8rem); }
.btn-card svg, .btn-massive svg, .btn svg { transition: transform .3s ease; flex-shrink: 0; }
.btn-solid { background: var(--color-black); color: var(--color-white); border: 2px solid var(--color-black); }
.btn-solid:hover { background: transparent; color: var(--color-black); }
.btn-solid:hover svg, .btn-outline:hover svg { transform: translateX(5px); }
.btn-outline { background: transparent; color: var(--color-black); border: 2px solid var(--color-black); }
.btn-outline:hover { background: var(--color-black); color: var(--color-white); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem; padding: .85rem 1.6rem;
  font-family: var(--font-heading); font-weight: 800; font-size: .9rem; text-transform: uppercase; letter-spacing: .3px;
  border-radius: 10px; border: 2px solid var(--color-black); cursor: pointer; transition: all .25s ease; line-height: 1.2;
  background: transparent; color: var(--color-black); white-space: nowrap;
}
.btn.btn-solid { background: var(--color-black); color: #fff; }
.btn.btn-solid:hover { background: transparent; color: var(--color-black); }
.btn:not(.btn-solid):hover { background: var(--color-black); color: #fff; }
.btn.sm { padding: .5rem 1rem; font-size: .78rem; border-width: 1.5px; border-radius: 8px; }
.btn.danger { border-color: var(--color-danger); color: var(--color-danger); }
.btn.danger:hover { background: var(--color-danger); color: #fff; }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--color-soft); color: var(--color-black); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.link { text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--color-muted); }

@media (max-width: 768px) {
  .btn-massive { padding: 1.5rem; font-size: 1.1rem; }
}

/* ---------- Form ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: .5rem; }
.field label, .label {
  font-family: var(--font-heading); font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .5px;
}
.field .hint { font-size: .82rem; color: var(--color-muted); }
.req { color: var(--color-danger); }
.input, .select, .textarea {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--color-black);
  background: #fff; border: 2px solid var(--color-border); border-radius: var(--radius-md);
  padding: .9rem 1.1rem; transition: border-color .2s ease, box-shadow .2s ease; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--color-black); box-shadow: 0 0 0 4px rgba(0,0,0,.06); }
.textarea { min-height: 180px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; cursor: pointer; padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
}
.input.sm, .select.sm { padding: .55rem .8rem; font-size: .9rem; border-radius: 8px; }
.select.sm { padding-right: 2.2rem; background-position: right .6rem center; }
.check { display: flex; gap: .7rem; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: #000; margin-top: 2px; flex-shrink: 0; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Selettore categoria a schede */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
  display: flex; flex-direction: column; gap: .35rem; height: 100%; padding: 1.1rem 1.2rem; border: 2px solid var(--color-border);
  border-radius: var(--radius-md); background: #fff; transition: all .2s ease;
}
.choice-body strong { font-family: var(--font-heading); font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: .55rem; }
.choice-body span { font-size: .82rem; color: var(--color-muted); line-height: 1.45; }
.choice:hover .choice-body { border-color: var(--color-border-strong); }
.choice input:checked + .choice-body { border-color: var(--color-black); box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
.choice input:focus-visible + .choice-body { outline: 3px solid #000; outline-offset: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.priority-pills { display: flex; flex-wrap: wrap; gap: .6rem; }
.priority-pills .choice-body { flex-direction: row; align-items: center; padding: .65rem 1.1rem; border-radius: 999px; }

/* ---------- Drag & drop ---------- */
.dropzone {
  border: 2px dashed var(--color-border-strong); border-radius: var(--radius-md); background: #fff;
  padding: 2rem 1.5rem; text-align: center; cursor: pointer; transition: all .2s ease; position: relative;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--color-black); outline: none; }
.dropzone.dragover { border-color: var(--color-black); background: var(--color-soft); transform: scale(1.01); }
.dropzone .dz-icon { width: 52px; height: 52px; margin: 0 auto 1rem; border-radius: 50%; background: var(--color-soft); display: flex; align-items: center; justify-content: center; }
.dropzone.dragover .dz-icon { background: #000; color: #fff; }
.dropzone .dz-title { font-family: var(--font-heading); font-weight: 800; font-size: 1.05rem; text-transform: uppercase; }
.dropzone .dz-hint { font-size: .82rem; color: var(--color-muted); margin-top: .35rem; }
.dropzone input[type=file] { display: none; }
.dz-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; margin-top: 1rem; }
.dz-item {
  position: relative; border: 2px solid var(--color-border); border-radius: 10px; background: #fff; overflow: hidden;
  display: flex; flex-direction: column; font-size: .78rem;
}
.dz-item.error { border-color: var(--color-danger); }
.dz-thumb { height: 100px; background: var(--color-soft) center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-family: var(--font-heading); font-weight: 900; color: var(--color-muted); font-size: 1rem; text-transform: uppercase; }
.dz-meta { padding: .5rem .6rem; }
.dz-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-size { color: var(--color-muted); }
.dz-err { color: var(--color-danger); font-weight: 600; }
.dz-remove {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.75); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1;
}
.dz-remove:hover { background: #000; }

/* ---------- Alert / flash ---------- */
.flash-stack { display: flex; flex-direction: column; gap: .75rem; margin: 1.5rem 0; }
.alert {
  display: flex; gap: .9rem; align-items: flex-start; padding: 1rem 1.25rem; border-radius: var(--radius-md);
  border: 2px solid; font-size: .95rem; background: #fff;
}
.alert svg { flex-shrink: 0; margin-top: 2px; }
.alert-success { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.alert-error { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }
.alert-info { border-color: var(--color-border); background: #fff; color: #0f172a; }
.alert-warning { border-color: #fde68a; background: #fffbeb; color: #78350f; }
.alert .alert-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 1.2rem; line-height: 1; color: inherit; opacity: .6; }

.note-custom { background-color: #fffbeb; border-left: 6px solid #f59e0b; padding: 1.25rem 1.5rem; margin: 1.5rem 0; border-radius: 0 8px 8px 0; font-size: .95rem; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 999px;
  font-family: var(--font-heading); font-weight: 800; font-size: .72rem; text-transform: uppercase; letter-spacing: .4px;
  border: 1.5px solid transparent; white-space: nowrap; line-height: 1.3;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-open { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.status-in_progress { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.status-waiting_customer { background: #fefce8; color: #a16207; border-color: #fde68a; }
.status-resolved { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.status-closed { background: #f4f4f5; color: #52525b; border-color: #e4e4e7; }
.priority-low { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }
.priority-normal { background: #f8fafc; color: #334155; border-color: #cbd5e1; }
.priority-high { background: #fff7ed; color: #ea580c; border-color: #fdba74; }
.priority-urgent { background: #dc2626; color: #fff; border-color: #dc2626; }
.badge-cat { background: #fff; color: #000; border-color: var(--color-border); }
.badge-cat::before { background: var(--cat, #000); }
.badge-plain::before { display: none; }
.page-hero .badge { border-color: rgba(255,255,255,.2); }
.page-hero .badge-cat { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }

/* ---------- Avanzamento stato (cliente) ---------- */
.progress-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: .5rem 0 0; position: relative; }
.progress-step { position: relative; text-align: center; padding-top: 3rem; }
.progress-step::before {
  content: ''; position: absolute; top: 1.1rem; left: -50%; right: 50%; height: 3px; background: var(--color-border); z-index: 0;
}
.progress-step:first-child::before { display: none; }
.progress-step .pdot {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 2.3rem; height: 2.3rem; border-radius: 50%;
  border: 3px solid var(--color-border); background: #fff; z-index: 1; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 900; font-size: .85rem; color: var(--color-muted);
}
.progress-step.done::before, .progress-step.current::before { background: #000; }
.progress-step.done .pdot { background: #000; border-color: #000; color: #fff; }
.progress-step.current .pdot { border-color: #000; color: #000; box-shadow: 0 0 0 5px rgba(0,0,0,.08); }
.progress-step .plabel { font-family: var(--font-heading); font-weight: 800; font-size: .8rem; text-transform: uppercase; }
.progress-step .pdesc { font-size: .75rem; color: var(--color-muted); margin-top: .2rem; padding: 0 .3rem; }
.progress-step:not(.done):not(.current) .plabel { color: var(--color-muted); }
@media (max-width: 600px) { .progress-step .pdesc { display: none; } .progress-step .plabel { font-size: .68rem; } }

.status-callout { display: flex; gap: 1rem; align-items: flex-start; padding: 1.25rem 1.5rem; border-radius: var(--radius-md); background: #fff; border: 2px solid var(--color-border); margin-top: 1.75rem; }
.status-callout.action { border-color: #000; }
.status-callout h4 { font-size: 1rem; margin-bottom: .25rem; }
.status-callout p { font-size: .92rem; color: var(--color-muted); }

/* ---------- Conversazione ---------- */
.thread { display: flex; flex-direction: column; gap: 1.25rem; }
.msg { border: 2px solid var(--color-border); border-radius: 16px; background: #fff; overflow: hidden; }
.msg-head { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.msg-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-family: var(--font-heading); font-weight: 900; font-size: .95rem; background: var(--color-soft); color: #000; text-transform: uppercase;
}
.msg-author { font-family: var(--font-heading); font-weight: 800; font-size: 1rem; line-height: 1.2; }
.msg-role { font-size: .78rem; color: var(--color-muted); }
.msg-time { margin-left: auto; font-size: .8rem; color: var(--color-muted); text-align: right; }
.msg-body { padding: 1.4rem; font-size: .98rem; line-height: 1.7; overflow-wrap: anywhere; }
.msg-body a { text-decoration: underline; text-underline-offset: 2px; }
.msg.staff { border-color: #000; }
.msg.staff .msg-head { background: #000; color: #fff; border-bottom-color: #000; }
.msg.staff .msg-avatar { background: #fff; color: #000; }
.msg.staff .msg-role, .msg.staff .msg-time { color: #a1a1aa; }
.msg.internal { border-color: #fcd34d; background: #fffbeb; }
.msg.internal .msg-head { background: #fef3c7; border-bottom-color: #fde68a; }
.msg.system { border-style: dashed; background: transparent; }
.msg-source { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; border: 1px solid currentColor; border-radius: 999px; padding: .05rem .5rem; opacity: .75; }
.msg-attachments { display: flex; flex-wrap: wrap; gap: .75rem; padding: 0 1.4rem 1.4rem; }
.att-img { display: block; width: 140px; height: 100px; border-radius: 10px; overflow: hidden; border: 2px solid var(--color-border); background: var(--color-soft); }
.att-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.att-img:hover img { transform: scale(1.05); }
.att-file {
  display: inline-flex; align-items: center; gap: .6rem; padding: .6rem .9rem; border: 2px solid var(--color-border); border-radius: 10px;
  font-size: .85rem; max-width: 280px; transition: border-color .2s;
}
.att-file:hover { border-color: #000; }
.att-file .att-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.att-file .att-size { color: var(--color-muted); font-size: .75rem; white-space: nowrap; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 10001; display: none; align-items: center; justify-content: center; padding: 2rem; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 85vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox-close { position: absolute; top: 1.25rem; right: 1.5rem; background: #fff; border: none; border-radius: 50%; width: 44px; height: 44px; font-size: 1.4rem; cursor: pointer; }
.lightbox-caption { position: absolute; bottom: 1.25rem; left: 0; right: 0; text-align: center; color: #d4d4d8; font-size: .9rem; }

/* ---------- Timeline eventi ---------- */
.timeline { list-style: none; position: relative; padding-left: 1.4rem; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--color-border); }
.timeline li { position: relative; padding-bottom: 1rem; font-size: .85rem; }
.timeline li::before { content: ''; position: absolute; left: -1.4rem; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #000; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { background: #000; }
.timeline time { display: block; color: var(--color-muted); font-size: .75rem; }

/* ---------- Dettagli (sidebar) ---------- */
.details { display: grid; grid-template-columns: auto 1fr; gap: .7rem 1rem; font-size: .9rem; align-items: center; }
.details dt { color: var(--color-muted); font-size: .8rem; text-transform: uppercase; font-family: var(--font-heading); font-weight: 700; letter-spacing: .3px; }
.details dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.sticky-side { position: sticky; top: 110px; display: flex; flex-direction: column; gap: 1.5rem; }
@media (max-width: 1100px) { .sticky-side { position: static; } }

/* Rating */
.rating { display: inline-flex; flex-direction: row-reverse; gap: .25rem; }
.rating input { position: absolute; opacity: 0; pointer-events: none; }
.rating label { cursor: pointer; font-size: 2rem; color: var(--color-border-strong); transition: color .15s, transform .15s; line-height: 1; }
.rating label:hover, .rating label:hover ~ label, .rating input:checked ~ label { color: #000; }
.rating label:hover { transform: scale(1.15); }
.rating input:focus-visible + label { outline: 2px solid #000; outline-offset: 2px; }
.stars-static { letter-spacing: 2px; font-size: 1.1rem; }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; border: 2px solid var(--color-border); border-radius: 16px; background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-family: var(--font-heading); font-weight: 800; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px;
  color: var(--color-muted); padding: .9rem 1rem; border-bottom: 2px solid var(--color-border); white-space: nowrap; background: #fafafa;
}
.table td { padding: .9rem 1rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #fafafa; }
.table .t-subject { font-weight: 600; display: block; max-width: 460px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table .t-sub { font-size: .78rem; color: var(--color-muted); }
.table .t-code { font-family: var(--font-heading); font-weight: 900; white-space: nowrap; letter-spacing: .3px; }
.table .row-link { position: relative; }
.row-unread td:first-child { box-shadow: inset 4px 0 0 #000; }
.row-unread .t-subject { font-weight: 800; }
.empty-state { text-align: center; padding: 4rem 1.5rem; color: var(--color-muted); }
.empty-state h3 { color: #000; margin-bottom: .5rem; font-size: 1.3rem; }

/* Ticket list (cliente) */
.ticket-list { display: flex; flex-direction: column; gap: 1rem; }
.ticket-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 1.5rem; align-items: center; padding: 1.25rem 1.5rem;
  border: 2px solid var(--color-border); border-radius: 16px; background: #fff; transition: all .25s ease;
}
.ticket-row:hover { border-color: #000; transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.05); }
.ticket-row .tr-code { font-family: var(--font-heading); font-weight: 900; font-size: .95rem; }
.ticket-row .tr-subject { font-weight: 600; font-size: 1.02rem; }
.ticket-row .tr-meta { font-size: .8rem; color: var(--color-muted); margin-top: .2rem; display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
@media (max-width: 700px) { .ticket-row { grid-template-columns: 1fr; gap: .5rem; } }

/* Steps "Come funziona" */
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.step { border-top: 2px solid #000; padding-top: 1.25rem; }
.step::before { counter-increment: step; content: '0' counter(step); font-family: var(--font-heading); font-weight: 900; font-size: 2.4rem; line-height: 1; display: block; margin-bottom: .75rem; }
.step h4 { font-size: 1.05rem; margin-bottom: .4rem; }
.step p { font-size: .9rem; color: var(--color-muted); }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

.divider { width: 100%; height: 1px; background: var(--color-border); margin: 4rem 0; }

/* Category pills (home) */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.cat-link {
  display: flex; gap: 1rem; align-items: center; padding: 1.2rem 1.4rem; border: 2px solid var(--color-border); border-radius: 14px; transition: all .25s;
}
.cat-link:hover { border-color: #000; transform: translateY(-3px); }
.cat-link strong { font-family: var(--font-heading); font-weight: 800; display: block; }
.cat-link span { font-size: .82rem; color: var(--color-muted); line-height: 1.4; display: block; }
.cat-link svg { margin-left: auto; flex-shrink: 0; transition: transform .25s; }
.cat-link:hover svg { transform: translateX(4px); }

/* Pagina errore (404 del sito) */
.error-page-container { width: 100%; min-height: 60vh; display: flex; justify-content: center; align-items: center; padding: 4rem 2rem; }
.error-content { text-align: center; max-width: 640px; display: flex; flex-direction: column; align-items: center; }
.error-code { font-family: var(--font-heading); font-size: clamp(7rem, 15vw, 13rem); font-weight: 900; line-height: 1; letter-spacing: -5px; }
.error-message { font-family: var(--font-heading); font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 900; text-transform: uppercase; letter-spacing: -2px; margin-bottom: 1.5rem; line-height: 1.1; }
.error-description { font-size: 1.15rem; color: var(--color-muted); margin-bottom: 2rem; line-height: 1.6; }

/* Auth (login staff) */

/* =====================================================================
   AREA STAFF
   ===================================================================== */
.admin-body .main-content { max-width: 1600px; padding: 0 2rem 2rem; }
@media (max-width: 768px) { .admin-body .main-content { padding: 0 1rem 1rem; } }
.user-chip { display: flex; align-items: center; gap: .65rem; font-family: var(--font-heading); font-weight: 800; font-size: .85rem; }
.user-chip .msg-avatar { width: 34px; height: 34px; font-size: .8rem; background: #000; color: #fff; }
.site-header.scrolled .user-chip .msg-avatar { background: #fff; color: #000; }
.nav-count { display: inline-flex; min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: #000; color: #fff; font-size: .68rem; align-items: center; justify-content: center; margin-left: .35rem; vertical-align: 2px; }
.site-header.scrolled .nav-count, .mobile-menu-overlay .nav-count { background: #fff; color: #000; }
.inline-form { display: inline; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stat-grid { grid-template-columns: 1fr; } }
.stat {
  display: block; padding: 1.5rem; border: 2px solid var(--color-border); border-radius: 16px; background: #fff; transition: all .25s;
}
a.stat:hover { border-color: #000; transform: translateY(-3px); }
.stat .stat-num { font-family: var(--font-heading); font-weight: 900; font-size: 2.6rem; line-height: 1; letter-spacing: -1px; }
.stat .stat-label { font-family: var(--font-heading); font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--color-muted); margin-top: .6rem; }
.stat.dark { background: #000; border-color: #000; color: #fff; }
.stat.dark .stat-label { color: #a1a1aa; }
.stat.alert-stat { border-color: #fca5a5; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 1rem; }
.bar { flex: 1; background: #000; border-radius: 6px 6px 0 0; min-height: 3px; position: relative; transition: opacity .2s; }
.bar:hover { opacity: .75; }
.bar span { position: absolute; top: -1.3rem; left: 50%; transform: translateX(-50%); font-size: .7rem; font-weight: 700; }
.bars-labels { display: flex; gap: 6px; margin-top: .4rem; }
.bars-labels span { flex: 1; text-align: center; font-size: .65rem; color: var(--color-muted); }

.hbar { display: grid; grid-template-columns: 140px 1fr 36px; gap: .75rem; align-items: center; font-size: .85rem; margin-bottom: .6rem; }
.hbar-track { height: 10px; border-radius: 999px; background: var(--color-soft); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1.25rem; }
.filters .input.sm { min-width: 240px; flex: 1; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.tab {
  padding: .55rem 1.1rem; border-radius: 999px; border: 1.5px solid var(--color-border-strong); font-family: var(--font-heading); font-weight: 800;
  font-size: .78rem; text-transform: uppercase; transition: all .2s;
}
.tab:hover { border-color: #000; }
.tab.active { background: #000; color: #fff; border-color: #000; }
.bulk-bar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding: .75rem 1rem; border-radius: 12px; background: #000; color: #fff; margin-bottom: 1rem; }
.bulk-bar .select.sm { background-color: #fff; }
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 2.4rem; height: 2.4rem; padding: 0 .6rem; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--color-border-strong); border-radius: 8px; font-weight: 700; font-size: .85rem; }
.pagination a:hover { border-color: #000; }
.pagination .current { background: #000; color: #fff; border-color: #000; }

.reply-box { border: 2px solid #000; border-radius: 16px; background: #fff; overflow: hidden; }
.reply-tabs { display: flex; border-bottom: 2px solid var(--color-border); }
.reply-tab { flex: 1; padding: .9rem 1rem; background: none; border: none; cursor: pointer; font-family: var(--font-heading); font-weight: 800; font-size: .85rem; text-transform: uppercase; color: var(--color-muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.reply-tab.active { color: #000; border-bottom-color: #000; }
.reply-tab[data-mode=note].active { border-bottom-color: #f59e0b; }
.reply-box.note-mode { border-color: #f59e0b; background: #fffbeb; }
.reply-inner { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.reply-inner .textarea { min-height: 200px; }
.reply-foot { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; }
.kbd { font-family: ui-monospace, monospace; font-size: .75rem; border: 1px solid var(--color-border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35rem; }

.danger-zone { border: 2px dashed #fca5a5; border-radius: 16px; padding: 1.25rem; }

/* Email log */
.log-status { font-weight: 700; font-size: .78rem; text-transform: uppercase; }
.log-status.processed, .log-status.sent { color: var(--color-success); }
.log-status.ignored { color: var(--color-muted); }
.log-status.error, .log-status.failed { color: var(--color-danger); }

.color-input { width: 56px; height: 48px; border: 2px solid var(--color-border); border-radius: 10px; padding: 4px; background: #fff; cursor: pointer; }

/* Footer specifico supporto */
.footer-col-1 .footer-desc { color: #a1a1aa; font-size: .9rem; max-width: 320px; line-height: 1.6; }
.footer-logo { width: 230px; margin-bottom: 1.5rem; }

@media print {
  .site-header, .site-footer, .reply-box, .sticky-side form, .btn { display: none !important; }
}
@media (max-width: 1024px) { .hide-mobile, .header-actions .user-chip { display: none; } }

/* Header area staff: più voci di menu, spaziatura più compatta */
.site-nav a, .btn-outline-dark { white-space: nowrap; }
.admin-body .header-left { gap: 1.75rem; }
.admin-body .site-header .site-nav { gap: .6rem; }
.admin-body .site-header .site-nav a { font-size: .85rem; padding: .5rem .8rem; }
.admin-body .header-actions { gap: 1rem; }
.admin-body .header-actions .btn-outline-dark { padding: .65rem 1.1rem; }
@media (max-width: 1320px) {
  .admin-body .site-header .site-nav, .admin-body .header-actions .btn-outline-dark, .admin-body .header-actions .inline-form { display: none; }
  .admin-body .icon-btn { display: flex; }
}
@media (max-width: 600px) {
  .card { padding: 1.25rem; }
  .status-callout { padding: 1rem; gap: .75rem; }
  .msg-head, .msg-body { padding-left: 1rem; padding-right: 1rem; }
  .msg-attachments { padding: 0 1rem 1rem; }
  .btn-card { padding: 1.1rem 1.25rem; font-size: 1rem; }
}

/* ---------- Accesso staff (login / password) ---------- */
.auth-split {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.5rem;
  min-height: calc(100vh - 220px); margin: 2rem 0 3rem;
}
.auth-visual {
  position: relative; border-radius: var(--radius-lg); overflow: hidden; background-color: #000;
  background-size: cover; background-position: center; color: #fff;
}
.auth-visual::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.55) 55%, rgba(0,0,0,.85) 100%);
}
.auth-visual-inner {
  position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: space-between;
  gap: 3rem; padding: 3.5rem;
}
.auth-logo { width: 190px; }
.auth-headline {
  font-family: var(--font-heading); font-weight: 900; font-size: clamp(3rem, 6vw, 5.5rem);
  line-height: .95; letter-spacing: -2px; margin-bottom: 1.25rem;
}
.auth-lead { color: #d4d4d8; font-size: 1.1rem; max-width: 460px; line-height: 1.6; }
.auth-back {
  display: inline-flex; align-items: center; gap: .6rem; align-self: flex-start;
  font-family: var(--font-heading); font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .5px;
  padding: .75rem 1.25rem; border: 1.5px solid rgba(255,255,255,.6); border-radius: 999px; transition: all .3s;
}
.auth-back:hover { background: #fff; color: #000; border-color: #fff; }
.auth-back:hover svg { transform: translateX(-4px); }
.auth-back svg { transition: transform .3s; }

.auth-panel {
  background: #fff; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center;
  padding: 3.5rem 2.5rem;
}
.auth-form-wrap { width: 100%; max-width: 420px; }
.auth-title {
  font-family: var(--font-heading); font-weight: 900; font-size: 2.6rem; letter-spacing: -1px; margin-bottom: .6rem;
}
.auth-text { color: var(--color-muted); font-size: 1rem; margin-bottom: 2rem; }
.auth-form-wrap .flash-stack { margin: 0 0 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1.4rem; }
.auth-form .input { background: #f8fafc; border-color: #f1f5f9; padding: 1.05rem 1.2rem; }
.auth-form .input:focus { background: #fff; border-color: #000; }
.auth-form .btn-card { margin-top: .6rem; }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.auth-link { font-size: .85rem; color: var(--color-muted); text-decoration: underline; text-underline-offset: 3px; transition: color .2s; }
.auth-link:hover { color: #000; }
.auth-foot { text-align: center; margin-top: .25rem; }

@media (max-width: 960px) {
  .auth-split { grid-template-columns: 1fr; min-height: 0; margin-top: 1.25rem; }
  .auth-visual-inner { padding: 2rem 1.5rem; gap: 1.75rem; }
  .auth-logo { width: 150px; }
  .auth-headline { font-size: 2.8rem; margin-bottom: .75rem; }
  .auth-lead { font-size: .95rem; }
  .auth-back { display: none; }
  .auth-panel { padding: 2.25rem 1.5rem; }
  .auth-title { font-size: 2rem; }
}

/* =====================================================================
   Sistema pulsanti uniforme: <a> e <button> identici, altezze fisse per taglia
   ===================================================================== */
button { font-family: inherit; }
.inline-form { display: inline-flex; margin: 0; }
.nowrap { flex-wrap: nowrap; }
.btn-row { gap: .6rem; }

.btn {
  box-sizing: border-box; height: 46px; padding: 0 1.4rem; line-height: 1;
  font-family: var(--font-heading); font-weight: 800; font-size: .8rem; letter-spacing: .5px; text-transform: uppercase;
  border: 2px solid var(--color-black); border-radius: 10px;
  -webkit-appearance: none; appearance: none; vertical-align: middle;
}
.btn.sm { height: 36px; padding: 0 1rem; font-size: .72rem; border-width: 1.5px; border-radius: 8px; gap: .4rem; }
.btn.danger { border-color: #fca5a5; color: var(--color-danger); background: transparent; }
.btn.danger:hover { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.06); color: #000; }

/* Pulsante dell'header (stesso stile di "Supporto Tecnico" del sito) */
.btn-outline-dark {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: 42px; padding: 0 1.25rem; line-height: 1; vertical-align: middle;
  font-family: var(--font-heading); font-weight: 700; font-size: .85rem;
  -webkit-appearance: none; appearance: none;
}
.mobile-menu-overlay .btn-outline-dark { display: flex !important; width: 100%; height: 48px; }
.header-actions { gap: .75rem; }
.admin-body .header-actions .btn-outline-dark { padding: 0 1.1rem; }
.user-chip {
  height: 42px; padding: 0 .9rem 0 .35rem; border-radius: 999px; border: 1.5px solid transparent; transition: all .25s;
}
.user-chip:hover, .user-chip.active { border-color: currentColor; }
.user-chip .msg-avatar { width: 32px; height: 32px; }
.btn-logout { padding: 0 .9rem !important; }
.btn-logout svg { transition: transform .25s; }
.btn-logout:hover svg { transform: translateX(3px); }

/* Pulsanti dentro le tabelle: sempre allineati a destra sulla stessa riga */
.table .btn-row { flex-wrap: nowrap; justify-content: flex-end; }

/* Selettori compatti alla stessa altezza dei pulsanti piccoli/normali */
.input.sm, .select.sm { height: 40px; padding-top: 0; padding-bottom: 0; }
.filters .btn.sm { height: 40px; }
.bulk-bar .btn.sm { border-color: #fff; color: #fff; }
.bulk-bar .btn.sm:hover { background: #fff; color: #000; }
