/*
  Ricordi al Sicuro — design system
  Allineato al sito (src/Website/pagine.css): fondo bianco, inchiostro blu-ardesia #12213A,
  palette brand #1F6FEB / #4C8DEF / #8FB7F5 / #BCD4F9 / #e6e6e6, font Inter + DM Mono.
  Corpo testo generoso (17-18px) e contrasti alti: il pubblico è over 40/50, non nativo digitale.
  I nomi dei token storici (navy, verdigris, brass...) restano per compatibilità: ora puntano alla palette del sito.
  L'ottone resta solo come colore semantico di avviso.
*/

:root {
    --paper: #ffffff;
    --paper-raised: color-mix(in srgb, #BCD4F9 10%, #ffffff);
    --paper-band: color-mix(in srgb, #BCD4F9 26%, #ffffff);
    --white: #ffffff;
    --ink: #12213A;
    --ink-muted: #44546F;
    --navy: #12213A;
    --navy-dark: #16272f;
    --brand: #1F6FEB;
    --brand-soft: #4C8DEF;
    --brand-deep: #1959BC;
    --verdigris: #1F6FEB;
    --verdigris-dark: #1959BC;
    --brass: #b8863b;
    --brass-light: #d9b37c;
    --line: #e6e6e6;
    --error: #a6402b;
    --error-bg: #f5e6e1;
    --focus-ring: rgba(31, 111, 235, 0.25);

    --font-display: "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;
    --font-mono: "DM Mono", ui-monospace, monospace;

    --radius: 8px;
    --shadow-card: 0 1px 0 rgba(18, 33, 58, 0.05);
}

* {
    box-sizing: border-box;
}

html, body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 560;
    letter-spacing: -0.01em;
    text-wrap: balance;
    color: var(--ink);
    line-height: 1.25;
    margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.9rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }

a {
    color: var(--brand-deep);
    text-decoration: underline;
    text-decoration-color: var(--brand-deep);
    text-underline-offset: 2px;
}

a:hover { color: var(--brand); }

:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
}

/* ---------- Layout shell ---------- */

.ras-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ras-header__brand {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--ink);
}

.ras-header__wordmark {
    font-family: var(--font-display);
    font-weight: 560;
    font-size: 1.2rem;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.ras-header__tagline {
    display: none;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand);
}

@media (min-width: 640px) {
    .ras-header__tagline { display: inline; }
}

.ras-header__actions {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    font-size: 0.92rem;
}

.ras-header__actions a {
    color: var(--ink-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.ras-header__actions a:hover {
    color: var(--brand);
}

.ras-header__actions a.active {
    color: var(--brand-deep);
    border-bottom-color: var(--brand);
    font-weight: 600;
}

.ras-main {
    max-width: 880px;
    margin: 0 auto;
    padding: clamp(1.5rem, 1rem + 2vw, 3.5rem) 1.5rem 4rem;
}

.ras-main--wide {
    max-width: 1120px;
}

/* ---------- Eyebrow / section labels ---------- */

.ras-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand);
    display: block;
    margin-bottom: 0.4rem;
}

.ras-section-title {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
}

.ras-section-rule {
    border: none;
    border-top: 1px solid var(--line);
    margin: 2.25rem 0;
}

/* ---------- Sprocket motif (signature element) ----------
   Fila di piccoli fori come su pellicola/VHS: usata come divisore
   e, con .ras-sprocket--progress, come indicatore di avanzamento pratica. */

.ras-sprocket {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 1.5rem 0;
}

.ras-sprocket__hole {
    flex: 1;
    height: 1px;
    background: var(--line);
    position: relative;
}

.ras-sprocket__hole::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--paper-raised);
    border: 1.5px solid var(--line);
    transform: translate(-50%, -50%);
}

.ras-sprocket__hole:first-child,
.ras-sprocket__hole:last-child {
    flex: 0 0 0;
}

.ras-sprocket--filled .ras-sprocket__hole::before {
    background: var(--brand);
    border-color: var(--brand-deep);
}

.ras-sprocket__hole.is-filled::before {
    background: var(--brand);
    border-color: var(--brand-deep);
}

.ras-sprocket__hole.is-current::before {
    background: var(--brand-soft);
    border-color: var(--brand-soft);
    width: 12px;
    height: 12px;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

/* ---------- Cards ---------- */

.ras-card {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: clamp(1.5rem, 1.2rem + 1.5vw, 2.5rem);
}

/* ---------- Forms ---------- */

.ras-field {
    margin-bottom: 1.4rem;
}

.ras-field label {
    display: block;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.4rem;
    font-size: 0.97rem;
}

.ras-hint {
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.ras-field .ras-hint {
    margin-top: 0.35rem;
}

.ras-field input[type="text"],
.ras-field input[type="email"],
.ras-field input[type="tel"],
.ras-field input[type="password"],
.ras-field select,
.ras-field textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.75rem 0.9rem;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    color: var(--ink);
    min-height: 48px;
}

.ras-field textarea {
    min-height: 110px;
    resize: vertical;
}

.ras-field input:focus,
.ras-field select:focus,
.ras-field textarea:focus {
    border-color: var(--brand);
    outline: 3px solid var(--focus-ring);
    outline-offset: 0;
}

.ras-field input:disabled {
    background: var(--paper-raised);
    color: var(--ink-muted);
    cursor: not-allowed;
}

.validation-message {
    display: block;
    color: var(--error);
    font-size: 0.88rem;
    font-weight: 500;
}

.ras-field .validation-message {
    margin-top: 0.35rem;
}

.validation-errors {
    list-style: none;
    margin: 0 0 1.4rem;
    padding: 0.9rem 1rem;
    background: var(--error-bg);
    border: 1.5px solid var(--error);
    border-radius: 8px;
}

.validation-errors:empty {
    display: none;
    margin: 0;
    padding: 0;
    border: none;
}

.validation-errors .validation-message {
    margin: 0;
}

/* ---------- Messaggi di stato (StatusMessage Identity) ---------- */

.alert {
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    border: 1.5px solid transparent;
    margin-bottom: 1.4rem;
}

.alert-danger {
    background: var(--error-bg);
    border-color: var(--error);
    color: var(--error);
}

.alert-success {
    background: var(--paper-band);
    border-color: var(--brand);
    color: var(--brand-deep);
}

.alert-warning {
    background: #f3e6d1;
    border-color: var(--brass);
    color: #7a5a24;
}

.alert p:last-child {
    margin-bottom: 0;
}

.recovery-code {
    font-family: var(--font-mono);
    font-size: 1rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.15rem 0.5rem;
}

/* ---------- Area account (pagine Identity: login/registrazione/gestione) ---------- */

.ras-auth-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    align-items: flex-start;
}

.ras-auth-columns > .ras-card {
    flex: 1 1 380px;
}

.ras-auth-columns > .ras-auth-columns__aside {
    flex: 1 1 280px;
}

.ras-manage {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: flex-start;
}

.ras-manage__nav {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ras-manage__nav a {
    display: block;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
}

.ras-manage__nav a:hover {
    background: var(--paper-raised);
}

.ras-manage__nav a.active {
    background: var(--brand);
    color: #ffffff;
}

.ras-manage__content {
    flex: 1 1 420px;
    min-width: 0;
}

.ras-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.6rem;
}

.ras-checkbox {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.8rem;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--paper-raised);
    cursor: pointer;
    font-size: 0.97rem;
}

.ras-checkbox:has(input:checked) {
    border-color: var(--brand);
    background: var(--paper-band);
}

.ras-checkbox input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--brand);
}

/* Il caricamento viene avviato dal pulsante "Carica" custom (chiama la PUT S3 presigned):
   nascondiamo i pulsanti Upload/Clear integrati di Syncfusion per non avere due trigger ridondanti. */
.ras-field .e-upload-actions {
    display: none;
}

/* ---------- Buttons ---------- */

.ras-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    padding: 0.85rem 1.4rem;
    min-height: 48px;
    border-radius: 3px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.ras-btn--primary {
    background: var(--brand);
    color: #ffffff;
}

.ras-btn--primary:hover {
    background: var(--brand-deep);
    color: #ffffff;
    transform: translateY(-1px);
}

.ras-btn--secondary {
    background: transparent;
    border-color: var(--line);
    color: var(--ink);
}

.ras-btn--secondary:hover {
    border-color: var(--brand-soft);
    color: var(--brand);
}

.ras-btn--danger {
    background: transparent;
    border-color: var(--error);
    color: var(--error);
}

.ras-btn--danger:hover {
    background: var(--error-bg);
}

.ras-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---------- Badges (stato pratica) ---------- */

.ras-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
}

.ras-badge--muted { background: #eceeef; color: var(--ink-muted); }
.ras-badge--brass { background: #f3e6d1; color: #7a5a24; }
.ras-badge--verdigris { background: var(--paper-band); color: var(--brand-deep); }
.ras-badge--error { background: var(--error-bg); color: var(--error); }

/* ---------- Chips (elenco tipi di materiale) ---------- */

.ras-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ras-chip {
    font-size: 0.85rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: #eceeef;
    color: var(--ink-muted);
    border: 1px solid var(--line);
}

/* ---------- Select (cambio stato inline) ---------- */

.ras-select {
    font-family: var(--font-body);
    font-size: 0.92rem;
    padding: 0.5rem 0.7rem;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    color: var(--ink);
    min-height: 40px;
}

.ras-select:focus {
    border-color: var(--brand);
    outline: 3px solid var(--focus-ring);
}

/* ---------- Request cards (backoffice) ---------- */

.ras-request-card {
    display: grid;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.ras-request-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.5rem;
    font-size: 0.92rem;
    color: var(--ink-muted);
}

.ras-request-card__meta strong {
    color: var(--ink);
    font-weight: 600;
}

.ras-compact-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.92rem;
    color: var(--ink-muted);
}

.ras-compact-row:last-child {
    border-bottom: none;
}

/* ---------- Empty state ---------- */

.ras-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--ink-muted);
}

.ras-empty h3 {
    color: var(--ink);
    margin-bottom: 0.5rem;
}

/* ---------- Confirmation panel ---------- */

.ras-confirm {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--paper-band);
    border: 1.5px solid var(--brand);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.ras-confirm__icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* ---------- Syncfusion Grid skin ----------
   Il parametro CssClass di SfGrid non applica una classe propria in modo affidabile:
   si punta quindi al contenitore che avvolge il componente nella pagina. */

.ras-grid-shell .e-grid {
    font-family: var(--font-body);
    border-color: var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.ras-grid-shell .e-gridheader {
    background: var(--paper-band);
    border-color: var(--line);
}

.ras-grid-shell .e-headercell {
    background: var(--paper-band);
    color: var(--ink-muted);
}

.ras-grid-shell .e-headertext {
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ras-grid-shell .e-rowcell {
    padding: 0.9rem 1rem;
    font-size: 0.97rem;
    border-color: var(--line);
}

.ras-grid-shell .e-row:hover .e-rowcell {
    background: var(--paper-raised);
}

/* ---------- Syncfusion (tema bootstrap5): il blu di default diventa il colore brand ----------
   Il tema usa selettori lunghi con :not(.e-success/warning/error): il prefisso "body" e gli stessi :not
   servono a superarne la specificita. */

body .e-input-group:not(.e-success):not(.e-warning):not(.e-error),
body .e-input-group.e-control-wrapper:not(.e-success):not(.e-warning):not(.e-error) {
    border-color: #cfdadf;
    font-family: var(--font-body);
}

body .e-input:focus:not(.e-success):not(.e-warning):not(.e-error),
body .e-input-group.e-input-focus:not(.e-success):not(.e-warning):not(.e-error),
body .e-input-group.e-control-wrapper.e-input-focus:not(.e-success):not(.e-warning):not(.e-error),
body .e-float-input.e-input-focus:not(.e-success):not(.e-warning):not(.e-error),
body .e-input-group:not(.e-disabled):active:not(.e-success):not(.e-warning):not(.e-error),
body .e-input-group.e-control-wrapper:not(.e-disabled):active:not(.e-success):not(.e-warning):not(.e-error) {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

body .e-input-group .e-input-group-icon,
body .e-input-group.e-control-wrapper .e-input-group-icon,
body .e-input-group .e-input[readonly] ~ span.e-input-group-icon,
body .e-input-group.e-control-wrapper .e-input[readonly] ~ span.e-input-group-icon,
body .e-input-group:not(.e-disabled) .e-control.e-dropdownlist ~ .e-ddl-icon:hover,
body .e-input-group:not(.e-disabled) .e-control.e-dropdownlist ~ .e-ddl-icon:active,
body .e-calendar .e-date-icon-prev,
body .e-calendar .e-date-icon-next {
    color: var(--ink-muted);
}

body .e-input-group:not(.e-disabled) .e-input-group-icon.e-active,
body .e-input-group:not(.e-disabled) .e-input-group-icon:hover {
    color: var(--brand-deep);
}

body .e-checkbox-wrapper .e-frame.e-check,
body .e-checkbox-wrapper:hover .e-frame.e-check,
body .e-checkbox-wrapper .e-frame.e-stop {
    background-color: var(--brand);
    border-color: var(--brand);
}

body .e-calendar .e-header a span,
body .e-calendar .e-header .e-title,
body .e-calendar .e-header.e-decade .e-title {
    color: var(--ink);
}

body .e-calendar .e-header .e-title:hover {
    background: var(--paper-band);
}

body .e-calendar .e-content td:hover span.e-day,
body .e-calendar .e-content td:focus span.e-day,
body .e-calendar .e-content td.e-focused-date span.e-day,
body .e-calendar .e-content td.e-focused-date:hover span.e-day,
body .e-calendar .e-content td.e-focused-date:focus span.e-day,
body .e-calendar .e-content td.e-today:hover span.e-day,
body .e-calendar .e-content td.e-today:focus span.e-day,
body .e-calendar .e-content td.e-focused-date.e-today span.e-day,
body .e-calendar .e-content td.e-focused-date.e-today:hover span.e-day,
body .e-calendar .e-content td.e-focused-date.e-today:focus span.e-day {
    background: var(--paper-band);
    color: var(--ink);
}

body .e-calendar .e-content td.e-today span.e-day,
body .e-calendar .e-content td.e-focused-date.e-today span.e-day {
    box-shadow: inset 0 0 0 2px var(--brand);
    color: var(--brand-deep);
}

body .e-calendar .e-content td.e-selected span.e-day,
body .e-calendar .e-content td.e-selected:hover span.e-day,
body .e-calendar .e-content td.e-today.e-selected span.e-day,
body .e-calendar .e-content td.e-focused-date.e-selected span.e-day,
body .e-dropdownbase .e-list-item.e-active {
    background-color: var(--brand);
    box-shadow: none;
    color: #ffffff;
}

body .e-dropdownbase .e-list-item.e-hover,
body .e-dropdownbase .e-list-item.e-item-focus {
    background-color: var(--paper-band);
    color: var(--ink);
}

.ras-header__brand { align-items: center; }

.ras-header__mark {
    width: 36px;
    height: 36px;
    flex: none;
}
