/* ================================================================
   riepilogo-contratto.css
   Styles for the buildRiepilogo() contract summary — Step 5.
   All colours use var(--rv-*) tokens so they respect the active
   theme (light / pastel / dark) set on <html data-theme="...">.
   ================================================================ */

/* ── layout ────────────────────────────────────────────────────── */
#riepilogoContent { font-family: inherit; }

.rp-vi { width: 20px; height: 20px; }

/* ── header card ────────────────────────────────────────────────── */
.rp-header {
    border: .5px solid var(--rv-border);
    border-radius: 12px;
    background: var(--rv-bg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.rp-contract-eyebrow {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--rv-muted);
    margin-bottom: .35rem;
}
.rp-contract-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--rv-text);
    line-height: 1.2;
    margin-bottom: .3rem;
}
.rp-contract-sub { font-size: 13px; color: var(--rv-muted); }
.rp-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.rp-status-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    background: #FAEEDA;
    color: #633806;
    border: .5px solid #EF9F27;
    white-space: nowrap;
}
.rp-ref { font-size: 11px; color: var(--rv-hint); }

/* ── metric pills ───────────────────────────────────────────────── */
.rp-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 1rem;
}
.rp-metric {
    background: var(--rv-surface);
    border-radius: 8px;
    padding: .85rem 1rem;
}
.rp-metric-label {
    font-size: 11px;
    color: var(--rv-hint);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 500;
}
.rp-metric-value { font-size: 18px; font-weight: 500; color: var(--rv-text); }
.rp-metric-sub   { font-size: 11px; color: var(--rv-muted); margin-top: 2px; }

/* ── generic section card ───────────────────────────────────────── */
.rp-section {
    border: .5px solid var(--rv-border);
    border-radius: 12px;
    background: var(--rv-bg);
    margin-bottom: .75rem;
    overflow: hidden;
}
.rp-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: .85rem 1.25rem;
    border-bottom: .5px solid var(--rv-border);
    background: var(--rv-surface);
}
.rp-section-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.rp-section-title { font-size: 13px; font-weight: 500; color: var(--rv-text); }
.rp-section-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 9px;
    border-radius: 20px;
    background: var(--rv-bg);
    border: .5px solid var(--rv-border-h);
    color: var(--rv-muted);
}
.rp-section-body { padding: 1rem 1.25rem; }

/* ── dati field grid ────────────────────────────────────────────── */
.rp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 2rem; }
.rp-field { padding: .4rem 0; border-bottom: .5px solid var(--rv-border); }
.rp-field:last-child { border-bottom: none; }
.rp-field-label {
    font-size: 11px;
    color: var(--rv-hint);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 500;
    margin-bottom: 2px;
}
.rp-field-value { font-size: 13px; color: var(--rv-text); font-weight: 500; }

/* ── riga row ───────────────────────────────────────────────────── */
.rp-riga {
    border: .5px solid var(--rv-border);
    border-radius: 8px;
    margin-bottom: .6rem;
    overflow: hidden;
}
.rp-riga:last-child { margin-bottom: 0; }
.rp-riga-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: .65rem 1rem;
    background: var(--rv-surface);
}
.rp-riga-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--rv-bg);
    border: .5px solid var(--rv-border-h);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--rv-muted);
    flex-shrink: 0;
}
.rp-riga-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.rp-riga-info  { flex: 1; min-width: 0; }
.rp-riga-name  { font-size: 13px; font-weight: 500; color: var(--rv-text); }
.rp-riga-note  { font-size: 11px; color: var(--rv-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rp-riga-cnt {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 9px;
    border-radius: 20px;
    background: #E1F5EE;
    color: #085041;
    border: .5px solid #5DCAA5;
}
.rp-riga-cnt.empty {
    background: var(--rv-bg);
    color: var(--rv-hint);
    border-color: var(--rv-border);
}

/* ── scaglioni table ────────────────────────────────────────────── */
.rp-scaglioni { overflow-x: auto; }
.rp-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    table-layout: fixed;
}
.rp-tbl th {
    font-size: 10px;
    font-weight: 500;
    color: var(--rv-hint);
    padding: 5px 8px;
    text-align: left;
    border-bottom: .5px solid var(--rv-border);
    background: var(--rv-surface);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.rp-tbl td {
    padding: 5px 8px;
    border-bottom: .5px solid var(--rv-border);
    color: var(--rv-text);
    vertical-align: middle;
}
.rp-tbl tr:last-child td { border-bottom: none; }
.rp-tbl tbody tr:hover td { background: var(--rv-surface); }

.rp-festivi-yes {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #E1F5EE;
    border: .5px solid #5DCAA5;
    vertical-align: middle;
}
.rp-festivi-no {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--rv-surface);
    border: .5px solid var(--rv-border);
    vertical-align: middle;
}

/* ── empty state ────────────────────────────────────────────────── */
.rp-empty-state {
    text-align: center;
    padding: 1.2rem;
    color: var(--rv-muted);
    font-size: 13px;
    font-style: italic;
}

/* ── alert banner ───────────────────────────────────────────────── */
.rp-alert {
    border-radius: 8px;
    padding: .9rem 1.1rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #FAEEDA;
    border: .5px solid #EF9F27;
    margin-top: 1rem;
}
.rp-alert-title { font-size: 13px; font-weight: 500; color: #412402; margin-bottom: 2px; }
.rp-alert-text  { font-size: 12px; color: #633806; line-height: 1.5; }

/* ── responsive: stack metrics on narrow screens ────────────────── */
@media (max-width: 540px) {
    .rp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rp-grid    { grid-template-columns: 1fr; }
    .rp-header  { flex-direction: column; }
    .rp-status  { align-items: flex-start; }
}
