/* ============================================
   TECNOVITI AIPROJECT — Design System
   Stile: Precisione Industriale Italiana
   ============================================ */

:root {
    --bg:         #F3F2EE;
    --bg-card:    #FFFFFF;
    --bg-dark:    #111110;
    --bg-panel:   #1A1917;

    --ink:        #111110;
    --ink-2:      #3D3C3A;
    --ink-3:      #767472;
    --ink-4:      #B0AEA9;

    --accent:     #1B4FBF;
    --accent-h:   #153D99;
    --accent-bg:  #EBF0FD;

    --border:     #E2E0DB;
    --border-2:   #D0CEC8;

    --green:      #16A34A;
    --green-bg:   #DCFCE7;
    --orange:     #D97706;
    --orange-bg:  #FEF3C7;
    --red:        #DC2626;
    --red-bg:     #FEE2E2;

    --font-display: 'Montserrat', sans-serif;
    --font-body:    'Montserrat', sans-serif;
    --font-mono:    'JetBrains Mono', monospace;
    --radius:     4px;
    --radius-lg:  8px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 18px; }

body {
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); font-size: 0.95em; }

/* ── Header ── */
.site-header {
    background: var(--bg-dark);
    border-bottom: 2px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 54px;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-mark {
    width: 34px;
    height: 34px;
    background: var(--accent);
    color: white;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}
.brand-logo {
    height: 30px;
    width: auto;
    object-fit: contain;
}
.brand-logo-main {
    height: 34px;
    width: auto;
    object-fit: contain;
    margin-bottom: 3px;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.12em;
    color: white;
    line-height: 1;
}
.brand-sub {
    font-size: 0.65rem;
    color: var(--ink-4);
    letter-spacing: 0.06em;
    line-height: 1;
    margin-top: 2px;
}

.header-nav { margin-left: 2rem; display: flex; gap: 0.5rem; }
.nav-link {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--ink-4);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.08); }
.nav-link.active { color: white; }

.header-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.user-name {
    font-size: 0.82rem;
    color: var(--ink-3);
    letter-spacing: 0.02em;
}
.logout-link {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--ink-4);
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.12);
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius);
    transition: all 0.15s;
}
.logout-link:hover { color: white; border-color: rgba(255,255,255,0.3); }

.demo-badge {
    font-family: 'Cinzel Decorative', serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: #f59e0b;
    text-shadow: 0 0 12px rgba(245,158,11,0.5), 0 0 24px rgba(245,158,11,0.2);
    border: 1px solid rgba(245,158,11,0.35);
    padding: 0.22rem 0.75rem;
    border-radius: var(--radius);
    background: rgba(245,158,11,0.08);
    animation: demo-pulse 3s ease-in-out infinite;
}
@keyframes demo-pulse {
    0%, 100% { text-shadow: 0 0 12px rgba(245,158,11,0.5), 0 0 24px rgba(245,158,11,0.2); }
    50% { text-shadow: 0 0 18px rgba(245,158,11,0.8), 0 0 36px rgba(245,158,11,0.35); }
}

/* ── Main ── */
.site-main { min-height: calc(100vh - 54px); }

/* ── Toast ── */
.toast-container {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.toast {
    background: var(--accent);
    color: white;
    padding: 0.75rem 1.6rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 4px 24px rgba(27,79,191,0.35);
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
}
.toast-error { background: var(--red); box-shadow: 0 4px 24px rgba(220,38,38,0.35); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-decoration: none;
    border: none;
    cursor: pointer;
    padding: 0.6rem 1.3rem;
    border-radius: var(--radius);
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-accent {
    background: var(--accent);
    color: white;
}
.btn-accent:hover { background: var(--accent-h); }

.btn-ghost {
    background: transparent;
    color: var(--ink-2);
    border: 1.5px solid var(--border-2);
}
.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }

/* ── Page layout ── */
.page-wrap {
    max-width: 1800px;
    margin: 0 auto;
    padding: 2rem 2rem;
}
.oracle-error-banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.35);
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.82rem;
}
.oeb-left {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    color: #7f1d1d;
    flex: 1;
    min-width: 0;
}
.oeb-title {
    font-weight: 700;
    color: #7f1d1d;
    margin-bottom: 0.35rem;
}
.oeb-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.oeb-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: baseline;
}
.oeb-link {
    color: #991b1b;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}
.oeb-link:hover { color: #7f1d1d; text-decoration-thickness: 2px; }
.oeb-msg {
    color: #7f1d1d;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 500px;
}
.oeb-close {
    background: none;
    border: none;
    color: #7f1d1d;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
    line-height: 1;
    opacity: 1;
}
.oeb-close:hover { color: #450a0a; }
.oeb-close:hover { color: #f87171; }

.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.25rem;
}

.page-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: 0.06em;
    color: var(--ink);
    line-height: 1;
}
.page-count {
    font-size: 0.8rem;
    color: var(--ink-3);
    letter-spacing: 0.04em;
    margin-top: 0.2rem;
}

/* ── Table card ── */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: clip;
}

#tableCard {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.tv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.tv-table th {
    background: var(--bg-dark);
    color: #ffffff;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.55rem 0.45rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}

.review-table thead th {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--bg-dark);
}

.rv-desc-inner {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    max-height: 1.4em;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-right: 28px;
}
.rv-desc-full {
    display: block;
    -webkit-line-clamp: unset;
    max-height: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    user-select: text;
    -webkit-user-select: text;
}
.review-table.desc-expanded .rv-desc-inner {
    -webkit-line-clamp: unset;
    overflow: visible;
    max-height: none;
    white-space: normal;
    text-overflow: unset;
}
.desc-row-expand-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    padding: 0 5px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.6;
    color: rgba(0,0,0,0.45);
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.18);
    border-radius: 3px;
    cursor: pointer;
    z-index: 1;
}
.td-desc:hover .desc-row-expand-btn {
    color: rgba(0,0,0,0.7);
    border-color: rgba(0,0,0,0.35);
    background: rgba(0,0,0,0.07);
}
.td-desc:has(.rv-desc-row-expanded) .desc-row-expand-btn {
    top: 10px;
    transform: none;
    color: #2563eb;
    border-color: rgba(37,99,235,0.4);
    background: rgba(37,99,235,0.07);
}
.rv-desc-row-expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    max-height: none;
    white-space: normal;
    text-overflow: clip;
    user-select: text;
}
/* ── Client autocomplete widget ─────────────────────────────────────────── */
.client-search-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.client-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.client-search-icon {
    position: absolute;
    left: 8px;
    width: 14px;
    height: 14px;
    color: var(--ink-3);
    pointer-events: none;
    flex-shrink: 0;
    transition: color 0.15s;
}
.client-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--ink-1);
    font-size: 0.88rem;
    padding: 4px 10px 4px 28px;
    width: 200px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-transform: uppercase;
}
.client-input:focus {
    border-color: rgba(37,99,235,0.55);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.client-input:focus ~ .client-search-icon,
.client-input-wrap:focus-within .client-search-icon {
    color: #2563eb;
}
@keyframes client-blink {
    0%,100% { border-color: rgba(37,99,235,0.3); box-shadow: none; }
    50%      { border-color: rgba(37,99,235,0.8); box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
}
.client-input.client-blink {
    border-color: rgba(37,99,235,0.5);
    animation: client-blink 1.2s ease-in-out infinite;
}
.client-input.client-blink:focus { animation: none; border-color: rgba(37,99,235,0.8); }
.client-results {
    position: fixed;
    min-width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    z-index: 9999;
    max-height: 260px;
    overflow-y: auto;
}
.client-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    gap: 10px;
    text-transform: uppercase;
}
.client-result-item:last-child { border-bottom: none; }
.client-result-item:hover { background: rgba(255,255,255,0.05); }
.cr-name { font-size: 0.85rem; color: var(--ink-1); }
.cr-meta { font-size: 0.75rem; color: var(--ink-2); white-space: nowrap; }
/* ── Dashboard client search ─────────────────────────────────────────────── */
@keyframes dash-client-blink {
    0%,100% { color: var(--ink-2); }
    50%      { color: rgba(37,99,235,0.9); }
}
.td-client-editable { cursor: pointer; }
.td-client-editable:hover .dash-client-name { text-decoration: underline dotted; }
.dash-client-missing {
    color: var(--ink-2);
    font-style: italic;
    animation: dash-client-blink 1.2s ease-in-out infinite;
}
/* ─────────────────────────────────────────────────────────────────────────── */

.desc-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    cursor: pointer;
    color: rgba(255,255,255,0.55);
    background: none;
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 3px;
    padding: 2px 4px;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 0;
}
.desc-toggle-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}
.desc-toggle-btn svg {
    transition: transform 0.2s;
}
.review-table.desc-expanded .desc-toggle-btn svg {
    transform: rotate(180deg);
}

.tv-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--ink-2);
    text-align: center;
}

.tv-table tbody tr:last-child td { border-bottom: none; }

/* Dashboard row hover */
.tv-row {
    cursor: pointer;
    transition: background 0.1s;
}
.tv-row:hover { background: #F8F7F3; }
.tv-row:hover .row-arrow { opacity: 1; transform: translateX(3px); }
.tv-row[data-status="sent"],
.tv-row[data-status="approved"] { background: #e8f4fd; }
.tv-row[data-status="sent"]:hover,
.tv-row[data-status="approved"]:hover { background: #d4ecf7; }
.tv-row[data-status="sent"] td:first-child,
.tv-row[data-status="approved"] td:first-child {
    border-left: none;
    position: relative;
    padding-left: 18px !important;
}
.tv-row[data-status="sent"] td:first-child::before,
.tv-row[data-status="approved"] td:first-child::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 20%;
    bottom: 20%;
    width: 5px;
    border-radius: 3px;
    background: #3b82f6;
}
@media (prefers-color-scheme: dark) {
    .tv-row[data-status="sent"],
    .tv-row[data-status="approved"] { background: rgba(59,130,246,0.10); }
    .tv-row[data-status="sent"]:hover,
    .tv-row[data-status="approved"]:hover { background: rgba(59,130,246,0.18); }
}
:root[data-theme="dark"] .tv-row[data-status="sent"],
:root[data-theme="dark"] .tv-row[data-status="approved"] { background: rgba(59,130,246,0.10); }
:root[data-theme="dark"] .tv-row[data-status="sent"]:hover,
:root[data-theme="dark"] .tv-row[data-status="approved"]:hover { background: rgba(59,130,246,0.18); }

.row-arrow {
    color: var(--accent);
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    display: block;
    text-align: right;
}

.td-date { white-space: nowrap; }
.date-day { display: block; font-weight: 500; color: var(--ink); }
.date-time { display: block; font-size: 0.78rem; color: var(--ink-3); }

.td-client { font-weight: 500; color: var(--ink); }
.td-rif { color: var(--ink-3); }
.td-file { color: var(--ink-3); font-size: 0.78rem; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-center { text-align: center; }
.td-action { width: 40px; }

/* ── Badges ── */
.tipo-tag {
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    padding: 0.2rem 0.6rem;
    border-radius: 2px;
}
.tipo-preventivo { background: #DBEAFE; color: #1E40AF; }
.tipo-ordine { background: #D1FAE5; color: #065F46; }

.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--ink-2);
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-4);
    flex-shrink: 0;
}
.status-draft .status-dot   { background: var(--ink-4); }
.status-processing .status-dot { background: #F59E0B; }
.status-ready .status-dot   { background: #3B82F6; }
.status-preview .status-dot { background: #E87B0C; }
.status-approved .status-dot { background: var(--green); }
.status-sent .status-dot    { background: #8B5CF6; }
.status-error .status-dot   { background: var(--red); }

/* ── Empty state ── */
.empty-row td, td.empty-row {
    text-align: center;
    padding: 4rem 1rem !important;
}
.empty-icon { font-size: 2rem; color: var(--ink-4); margin-bottom: 0.75rem; }
.empty-text { font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: 0.05em; color: var(--ink-3); margin-bottom: 0.3rem; }
.empty-sub { font-size: 0.82rem; color: var(--ink-4); }

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17,17,16,0.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 780px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.75rem 0;
}
.modal-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.06em;
    color: var(--ink);
}
.modal-close {
    color: var(--ink-3);
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
    transition: color 0.15s;
}
.modal-close:hover { color: var(--ink); }

.upload-form { padding: 0.75rem 1.75rem; }

.tipo-section { margin-bottom: 0.75rem; }
.tipo-label-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: var(--ink-3);
    margin-bottom: 0.6rem;
}

.tipo-group { display: flex; gap: 0.75rem; }

.tipo-card {
    flex: 1;
    cursor: pointer;
}
.tipo-card input[type="radio"] { display: none; }
.tipo-card-inner {
    border: 1.5px solid var(--border-2);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    transition: all 0.15s;
}
.tipo-card:hover .tipo-card-inner { border-color: var(--ink-3); }
.tipo-card input:checked + .tipo-card-inner {
    border-color: var(--accent);
    background: var(--accent-bg);
}
.tipo-card-icon { font-size: 1.4rem; margin-bottom: 0.4rem; }
.tipo-card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    color: var(--ink);
    margin-bottom: 0.15rem;
}
.tipo-card-desc { font-size: 0.76rem; color: var(--ink-3); }

.upload-zone {
    display: block;
    border: 2.5px dashed var(--accent);
    border-radius: var(--radius);
    padding: 0.75rem 2rem;
    text-align: center;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s, background 0.15s;
    cursor: pointer;
    background: var(--accent-bg);
}
.upload-zone:hover { border-color: var(--accent-h); background: #dce8fc; }
.upload-icon { font-size: 1.4rem; margin-bottom: 0.15rem; color: var(--accent); }
.upload-label-big {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.3rem;
}
.upload-input { display: none; }
.paste-separator {
    display: flex; align-items: center; gap: 12px;
    margin: 14px 0 10px;
    color: var(--ink-3); font-size: 0.75rem; letter-spacing: 0.05em;
}
.paste-separator::before, .paste-separator::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.paste-textarea {
    width: 100%; box-sizing: border-box;
    min-height: 70px; resize: vertical;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 12px;
    font-family: var(--font-mono); font-size: 0.8rem;
    color: var(--ink-1); line-height: 1.5;
    outline: none; transition: border-color 0.15s;
}
.paste-textarea:focus { border-color: var(--accent); }
.upload-file-btn {
    display: block;
    width: fit-content;
    margin: 0 auto 0.5rem;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 0.75rem 2.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.upload-file-btn:hover { background: var(--accent-h); transform: scale(1.03); }
.upload-filename {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    min-height: 1.4em;
    margin-top: 0.5rem;
    word-break: break-all;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ── Login ── */
body.login-page {
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-layout {
    display: flex;
    width: 100%;
    max-width: 900px;
    min-height: 540px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

.login-brand-panel {
    flex: 1;
    background: var(--bg-panel);
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Subtle grid texture */
.login-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

.login-brand-content { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; }

.login-runflow-logo {
    height: 96px;
    width: auto;
    max-width: 320px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.login-logo-mark {
    width: 52px;
    height: 52px;
    background: var(--accent);
    color: white;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    margin-bottom: 2rem;
}

.login-brand-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: 0.15em;
    color: white;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.login-brand-claim {
    font-size: 0.9rem;
    color: var(--ink-3);
    line-height: 1.6;
    margin-bottom: 2.5rem;
    font-weight: 300;
}

.login-features { display: flex; flex-direction: column; gap: 0.75rem; }

.login-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--ink-3);
}
.feature-icon {
    color: var(--accent);
    font-size: 0.5rem;
    flex-shrink: 0;
}

.login-brand-footer {
    font-size: 0.7rem;
    color: #ffffff;
    letter-spacing: 0.08em;
    position: relative;
}

.login-form-panel {
    flex: 1;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.login-form-inner { width: 100%; max-width: 320px; }

.login-form-header { margin-bottom: 2rem; }
.login-form-header h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.04em;
    color: var(--ink);
    margin-bottom: 0.25rem;
}
.login-form-header p {
    font-size: 0.85rem;
    color: var(--ink-3);
}

.form-group { margin-bottom: 1.1rem; }
.form-label {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--ink-3);
    margin-bottom: 0.4rem;
}
.form-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border-2);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--ink);
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(27,79,191,0.08);
}

.form-group-inline { margin-bottom: 1.5rem; }
.check-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--ink-2);
}
.check-input { display: none; }
.check-box {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-2);
    border-radius: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.check-input:checked + .check-box {
    background: var(--accent);
    border-color: var(--accent);
}
.check-input:checked + .check-box::after {
    content: '✓';
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
}


.btn-login {
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s;
}
.btn-login:hover { background: var(--accent-h); }
.btn-arrow { font-size: 1rem; }

/* ── Review page ── */
.review-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.review-rf-logo {
    height: 18px;
    width: auto;
    object-fit: contain;
    opacity: 0.7;
    margin-left: auto;
}
.review-brand-logo {
    height: 18px;
    width: auto;
    object-fit: contain;
}
.back-link {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    text-decoration: none;
    transition: color 0.15s;
    margin-right: 0.5rem;
}
.back-link:hover { color: var(--ink); }
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    color: var(--ink-2);
    text-decoration: none;
    border: 1.5px solid var(--border-2);
    border-radius: var(--radius);
    padding: 0.35rem 0.85rem;
    transition: all 0.15s;
    margin-right: 0.5rem;
    background: white;
}
.back-btn:hover {
    border-color: var(--ink-3);
    color: var(--ink);
    background: var(--bg);
}

.btn-open-doc {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    padding: 0.35rem 0.9rem;
    border: 1.5px solid var(--border-2);
    border-radius: var(--radius);
    color: var(--ink-2);
    text-decoration: none;
    transition: all 0.15s;
    margin-left: auto;
}
.btn-open-doc:hover { border-color: var(--accent); color: var(--accent); }

.copy-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--bg);
    font-size: 0.82rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius);
    z-index: 9999;
    max-width: 520px;
    text-align: center;
    transition: opacity 0.3s;
    pointer-events: none;
}

.rv-row { cursor: pointer; }
.rv-row td input, .rv-row td label { cursor: auto; }

.review-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--ink-2);
}
.breadcrumb-sep { color: var(--ink-4); }
.breadcrumb-client { font-weight: 500; text-transform: uppercase; }
.breadcrumb-rif { color: var(--ink-3); }

.review-meta-bar {
    display: flex;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}
.meta-item {
    flex: 1;
    padding: 0.85rem 1.25rem;
    border-right: 1px solid var(--border);
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.meta-item:last-child { border-right: none; }
.meta-label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--ink-4);
    margin-bottom: 0.2rem;
}
.meta-value {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-time-saved {
    background: #fff;
    border-left: 3px solid var(--border-2);
}
.time-saved-value {
    color: var(--ink) !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
}
.time-saved-sub {
    display: block;
    font-size: 0.78rem;
    color: #374151;
    margin-top: 0.15rem;
}

.legend-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-dark);
    padding: 0.6rem 1.5rem;
    border-radius: 0;
    margin-bottom: 0;
    margin-left: -2rem;
    margin-right: -2rem;
    flex-wrap: wrap;
    width: calc(100% + 4rem);
}
.legend-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    color: #ffffff;
    flex-shrink: 0;
}
.legend-items {
    display: flex;
    gap: 2.5rem;
    flex-wrap: wrap;
    flex: 1;
    justify-content: space-evenly;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #ffffff;
    font-weight: 500;
}
.legend-bar {
    width: 6px;
    height: 22px;
    border-radius: 3px;
    flex-shrink: 0;
}
.lb-green  { background: var(--green); }
.lb-orange { background: var(--orange); }
.lb-red    { background: var(--red); }
.lb-empty  { background: #64748B; }

/* ── Review table ── */
.review-table { font-size: 0.95rem; }

.rv-row td { padding: 0.5rem 0.45rem; }

.rv-green td:first-child,
.rv-orange td:first-child,
.rv-red td:first-child,
.rv-empty td:first-child,
.rv-manual td:first-child {
    border-left: none;
    position: relative;
}
.rv-green td:first-child::before,
.rv-orange td:first-child::before,
.rv-red td:first-child::before,
.rv-empty td:first-child::before,
.rv-manual td:first-child::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 20%;
    bottom: 20%;
    width: 5px;
    border-radius: 3px;
}
.rv-green td:first-child::before  { background: var(--green); }
.rv-orange td:first-child::before { background: var(--orange); }
.rv-red td:first-child::before    { background: var(--red); }
.rv-empty td:first-child::before  { background: #64748B; }
.rv-manual td:first-child::before { background: #8B5CF6; }

.rv-green  { background: #fff; }
.rv-orange { background: #fff; }
.rv-red    { background: #fff; }
.rv-empty  { background: #fff; }
.rv-hist-used { background: #f1f1f4 !important; }
.price-confirmed-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #16a34a;
    background: rgba(22,163,74,0.10);
    border: 1px solid rgba(22,163,74,0.4);
    vertical-align: middle;
    margin-left: 4px;
}
.rv-hist-used td:first-child::before { background: #9ca3af !important; }

.td-num { text-align: center; color: var(--ink-4); font-size: 0.78rem; width: 40px; }
.td-code { width: 120px; }
.td-qty { text-align: right; width: 80px; }
.td-um { width: 50px; color: var(--ink-3); }
.td-price { width: 130px; min-width: 130px; }
.td-sc1   { width: 52px; text-align: center; padding-right: 1rem !important; }
.sc1-input {
    width: 52px;
    min-width: 52px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--ink-1);
    font-size: 0.82rem;
    padding: 3px 2px;
    text-align: center;
}
.sc1-input:focus { border-color: var(--accent); outline: none; }
.td-note { width: 130px; }
.td-source { font-size: 0.72rem; color: var(--ink-3); line-height: 1.3; max-width: 160px; }
.price-hist-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 3px 8px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    vertical-align: middle;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    animation: ph-pulse 1.8s ease-in-out infinite;
}
.price-hist-orange { background: var(--orange); }
.price-hist-red    { background: var(--red); }
.ph-arrow {
    font-size: 10px;
    display: inline-block;
    animation: ph-bounce 1.8s ease-in-out infinite;
}
.ph-label { text-transform: uppercase; }
.price-hist-btn:hover {
    opacity: 1;
    transform: scale(1.08);
    animation: none;
}
@keyframes ph-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(220,38,38,0.5); }
    50%       { opacity: 0.85; box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}
.price-hist-orange {
    animation: ph-pulse-orange 1.8s ease-in-out infinite;
}
@keyframes ph-pulse-orange {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(217,119,6,0.5); }
    50%       { opacity: 0.85; box-shadow: 0 0 0 6px rgba(217,119,6,0); }
}
@keyframes ph-bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(3px); }
}

/* Price history popup */
.ph-popup {
    position: absolute;
    z-index: 9999;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    width: 640px;
    font-size: 0.82rem;
    overflow: hidden;
}
.ph-popup-inner { padding: 0; }
.ph-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.ph-popup-title {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
}
.ph-popup-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    line-height: 1;
}
.ph-popup-close:hover { color: #fff; }
.ph-loading { padding: 1rem; color: var(--ink-3); text-align: center; }
.ph-section-label {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink);
    text-transform: uppercase;
}
.ph-table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    margin-bottom: 0.5rem;
}
.ph-table thead th {
    background: var(--bg);
    padding: 0.35rem 1rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.ph-table tbody td {
    padding: 0.45rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--ink);
}
.ph-table tbody tr:last-child td { border-bottom: none; }
.ph-price { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.ph-client { font-weight: 500; }
.ph-sim { color: var(--ink-3); font-size: 0.75rem; }
.ph-use-btn {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.2rem 0.55rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.ph-use-btn:hover { background: var(--accent-h); }

.desc-text { display: block; font-weight: 600; color: var(--ink); }
.desc-orig { display: block; font-size: 0.75rem; color: var(--ink-2); margin-top: 0.15rem; }

.price-val { font-family: var(--font-mono); font-size: 0.95rem; white-space: nowrap; display: block; }

.qty-input {
    width: 60px;
    padding: 0.3rem 0.4rem;
    border: 1.5px solid var(--border-2);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--ink);
    text-align: right;
    transition: border-color 0.15s;
    outline: none;
}
.qty-input:focus { border-color: var(--accent); }
.price-input {
    width: 112px;
    padding: 0.3rem 0.5rem;
    border: 1.5px solid var(--border-2);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--ink);
    transition: border-color 0.15s;
    outline: none;
}
.price-input:focus { border-color: var(--accent); }

.note-input {
    width: 120px;
    padding: 0.3rem 0.5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s;
}
.note-input:focus { border-color: var(--accent); }

/* Column widths */
.th-num      { width: 52px; text-align: center; }
.th-desc     { width: auto; min-width: 220px; }
.th-code     { width: 110px; }
.th-qty      { width: 80px; }
.th-um       { width: 45px; }
.th-delivery { width: 110px; }
.th-price    { min-width: 130px; }
.th-sc1      { width: 60px; text-align: center; padding-right: 1rem !important; }
.th-total    { width: 200px; text-align: right; }
.th-note     { width: 110px; }
.th-source   { width: 140px; }

.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover { background: #1B4FBF !important; color: #ffffff !important; }
.th-sortable:hover .sort-ind { color: #F97316 !important; }

.bulk-date-row td {
    background: #EBF0FD;
    border-bottom: 2px solid #1B4FBF;
    padding: 0.45rem 1rem;
}
.bulk-sc1-cell  { overflow: visible; text-align: center; position: relative; }
.bulk-sc1-input {
    width: 110px;
    padding: 0.28rem 0.45rem;
    border: 1.5px solid var(--border-2);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 0.9rem;
    color: var(--ink);
    background: var(--bg-input);
    outline: none;
}
.bulk-sc1-input:focus { border-color: var(--accent); }
.bulk-sc1-ok {
    border-radius: 0 var(--radius) var(--radius) 0 !important;
    padding: 0.28rem 0.55rem !important;
}
.sc1-wrap { display: flex; align-items: center; justify-content: center; gap: 2px; }
.sc1-pct  { font-size: 0.78rem; color: var(--ink-3); line-height: 1; }
.bulk-date-cell { text-align: left; }
.bulk-date-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
.bulk-date-row-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}
.bulk-date-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: #1B4FBF;
    white-space: nowrap;
}
.bulk-date-input {
    border: 1.5px solid #1B4FBF;
    border-radius: var(--radius);
    padding: 0.2rem 0.4rem;
    font-size: 0.82rem;
    background: #fff;
    color: var(--ink);
    outline: none;
}
.bulk-date-input:focus { box-shadow: 0 0 0 3px rgba(27,79,191,0.15); }
.bulk-date-btn {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    background: #1B4FBF;
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}
.bulk-date-btn:hover { background: #153D99; }
.bulk-total-cell { text-align: right; vertical-align: middle; padding-left: 2.5rem !important; }
.bulk-total-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
}
.th-bulk-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #93C5FD;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}
.th-bulk-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}
.th-bulk-input {
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 3px;
    padding: 0.15rem 0.25rem;
    font-size: 0.7rem;
    background: rgba(255,255,255,0.08);
    color: #fff;
    outline: none;
    color-scheme: dark;
}
.th-bulk-input:focus { border-color: #3B82F6; background: rgba(59,130,246,0.15); }
.th-bulk-btn {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    background: #1B4FBF;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.th-bulk-btn:hover { background: #153D99; }
.sort-ind { font-size: 0.65rem; color: var(--accent); font-weight: 700; margin-left: 2px; }

.date-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.2rem 0.3rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--ink);
}
.date-input:focus { border-color: var(--accent); outline: none; }

.td-delivery { font-size: 0.9rem; color: var(--ink-2); }
.row-counter { font-weight: 600; }

.td-total { text-align: right; padding-right: 1rem; }
.total-val { font-size: 0.88rem; color: var(--ink-2); }
.total-big { color: var(--ink); font-weight: 600; }
.total-empty { color: var(--ink-4); }

.total-footer-row { background: var(--bg) !important; border-top: 2px solid var(--border-2); }
.total-footer-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--ink-3);
    text-align: right;
    padding: 0.75rem 0.5rem;
}
.total-footer-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    text-align: right;
    padding-right: 1rem;
}

/* ── Action bar ── */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 0.75rem 2rem;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
}
@keyframes hint-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.action-hint {
    font-size: 0.8rem;
    color: var(--ink-3);
    flex: 1;
    animation: hint-pulse 1.8s ease-in-out infinite;
}
.action-hint::before { content: '◆ '; color: var(--accent); }
.action-btns { display: flex; gap: 0.75rem; }

/* ── Status banners ── */
.status-banner {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}
.banner-preview {
    background: rgba(232,123,12,0.08);
    border: 1px solid rgba(232,123,12,0.3);
    color: #E87B0C;
}
.banner-approved {
    background: var(--green-bg);
    border: 1px solid #A7F3D0;
    color: var(--green);
}
.banner-sent {
    background: #F5F3FF;
    border: 1px solid #DDD6FE;
    color: #5B21B6;
}

/* ── Dashboard action buttons ── */
.dash-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.td-action-btns {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: flex-end;
    white-space: nowrap;
}
.delete-form { display: inline; }

.btn-apri {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.07em;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-apri:hover { background: var(--accent-h); }

.btn-rilancia {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: none;
    color: #f59e0b;
    border: 1.5px solid currentColor;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-rilancia:hover { background: rgba(245,158,11,0.1); }
.rilancia-form { display: inline; }
.btn-elimina {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: none;
    color: var(--red);
    border: 1.5px solid currentColor;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.btn-elimina:hover { background: var(--red-bg); }
.btn-elimina-confirm { background: var(--red-bg) !important; color: #B91C1C !important; font-weight: 700 !important; }
.btn-elimina-locked {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: none;
    color: #9ca3af;
    border: 1.5px solid #9ca3af;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    cursor: not-allowed;
    pointer-events: none;
    white-space: nowrap;
}

.outcome-btns { display: flex; gap: 4px; margin-top: 4px; }
.btn-vinto {
    font-family: var(--font-display); font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.05em; padding: 0.2rem 0.55rem; border: none; border-radius: var(--radius);
    cursor: pointer; background: #D1FAE5; color: #065F46; transition: background 0.15s;
}
.btn-vinto:hover { background: #A7F3D0; }
.btn-perso {
    font-family: var(--font-display); font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.05em; padding: 0.2rem 0.55rem; border: none; border-radius: var(--radius);
    cursor: pointer; background: var(--red-bg); color: #B91C1C; transition: background 0.15s;
}
.btn-perso:hover { background: #FECACA; }
.btn-outcome-reset {
    font-family: var(--font-display); font-size: 0.68rem; font-weight: 600;
    letter-spacing: 0.05em; padding: 0.2rem 0.55rem; border: none; border-radius: var(--radius);
    cursor: pointer; background: var(--bg); color: var(--ink-3); transition: background 0.15s;
}
.btn-outcome-reset:hover { background: var(--border); color: var(--ink); }
.outcome-badge {
    display: inline-block; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em;
    padding: 0.1rem 0.4rem; border-radius: 3px; margin-left: 6px; vertical-align: middle;
}
.outcome-won { background: #D1FAE5; color: #065F46; }
.outcome-lost { background: var(--red-bg); color: #B91C1C; }

/* ── Stats toolbar ── */
.stats-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.stats-filter-form {
    display: flex;
    gap: 0.5rem;
}
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filter-search-wrap { flex: 1; min-width: 260px; max-width: 480px; }
.filter-search {
    width: 100%;
    padding: 0.38rem 0.75rem;
    border: 1.5px solid var(--border-2);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--ink);
    background: white;
    outline: none;
}
.filter-search:focus { border-color: var(--accent); }
.row-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #DC2626;
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.25;
    transition: opacity 0.15s;
    vertical-align: middle;
    margin-left: 4px;
    padding: 0;
    font-weight: 400;
}
.rv-row:hover .row-delete-btn { opacity: 1; }
.row-delete-btn:hover { background: #B91C1C; opacity: 1; }
.row-delete-btn.row-delete-confirming { background: #B91C1C; opacity: 1; animation: delete-pulse 0.6s ease infinite; }
@keyframes delete-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.5); } 50% { box-shadow: 0 0 0 5px rgba(220,38,38,0); } }
.row-delete-confirm-lbl { font-size: 0.72rem; color: #DC2626; font-weight: 600; margin-left: 6px; vertical-align: middle; }
.client-name-edit {
    cursor: pointer;
    border-bottom: 1px dashed transparent;
    transition: border-color 0.15s;
}
.client-name-edit:hover { border-bottom-color: var(--accent); }
.client-name-input {
    font: inherit;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.1rem 0.4rem;
    outline: none;
    background: white;
    color: var(--ink);
    min-width: 160px;
}
.article-match-badge {
    display: inline-block;
    margin-left: 0.5rem;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.45rem;
    border-radius: 99px;
    vertical-align: middle;
}
.filter-count {
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-3);
    letter-spacing: 0.04em;
    margin-left: auto;
}
.filter-select {
    padding: 0.35rem 0.7rem;
    border: 1.5px solid var(--border-2);
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--ink);
    background: white;
    cursor: pointer;
    outline: none;
}
.filter-select:focus { border-color: var(--accent); }
.btn-sm { font-size: 0.75rem; padding: 0.35rem 0.75rem; }

/* ── Confidence warnings ── */
.conf-warning-bar {
    background: #FFFBEB;
    border: 1px solid #F59E0B;
    border-radius: var(--radius);
    padding: 0.45rem 0.9rem;
    margin-bottom: 0.6rem;
    font-size: 0.8rem;
    color: #92400E;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.conf-warn-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
}
.conf-warn-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #92400E;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.7;
}
.conf-warn-close:hover { opacity: 1; }

.rv-low-conf {
    background: #FFFDF0 !important;
    outline: 1.5px solid #F59E0B;
    outline-offset: -1px;
}
.rv-low-conf td { background: transparent !important; }

.conf-badge {
    display: inline-block;
    background: #D97706;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    border-radius: 50%;
    margin-left: 4px;
    cursor: help;
    vertical-align: middle;
}

/* ── Stats ── */
.stats-badge {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    color: var(--accent);
    border: 1.5px solid var(--accent);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
.kpi-grid-sm { margin-bottom: 1.5rem; }

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem;
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.kpi-c-blue   { border-top: 3px solid #1B4FBF; background: linear-gradient(135deg, #fff 60%, #EBF0FD); }
.kpi-c-orange { border-top: 3px solid #E87B0C; background: linear-gradient(135deg, #fff 60%, #FEF3E8); }
.kpi-c-green  { border-top: 3px solid #16A34A; background: linear-gradient(135deg, #fff 60%, #EDFAF3); }
.kpi-c-yellow { border-top: 3px solid #EAB308; background: linear-gradient(135deg, #fff 60%, #FEFCE8); }
.kpi-c-blue::before   { background: #1B4FBF; }
.kpi-c-orange::before { background: #E87B0C; }
.kpi-c-green::before  { background: #16A34A; }
.kpi-c-yellow::before { background: #EAB308; }
.kpi-sm { padding: 1rem 1.25rem; }

.kpi-icon {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    opacity: 0.18;
    position: absolute;
    top: 1rem; right: 1.1rem;
    line-height: 1;
}
.kpi-c-blue .kpi-icon   { color: #1B4FBF; }
.kpi-c-orange .kpi-icon { color: #E87B0C; }
.kpi-c-green .kpi-icon  { color: #16A34A; }
.kpi-c-yellow .kpi-icon { color: #EAB308; }

.kpi-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    color: var(--ink-3);
    margin-bottom: 0.5rem;
}
.kpi-value {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2.2rem;
    letter-spacing: -0.01em;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 0.5rem;
}
.kpi-value-sm {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--ink);
    line-height: 1;
}
.kpi-trend {
    font-size: 0.75rem;
    font-weight: 500;
}
.kpi-up   { color: #2D6A4F; }
.kpi-down { color: var(--red); }
.kpi-neutral { color: var(--ink-3); }
.kpi-time-saved-card { border-top-color: #166534; background: #fff; }
.time-saved-kpi { color: #166534 !important; }
.kpi-time-sub { font-size: 0.78rem; color: #374151; margin-top: 0.3rem; }
.btn-reset-time {
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
}
.btn-reset-time:hover { background: #f3f4f6; }

.charts-row {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1rem;
    margin-bottom: 1rem;
}
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.chart-header { margin-bottom: 1.25rem; }
.chart-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--ink);
}
.chart-subtitle {
    font-size: 0.75rem;
    color: var(--ink-3);
    margin-top: 0.15rem;
}
.chart-wrap { height: 220px; }
.chart-donut-wrap { position: relative; display: flex; align-items: center; justify-content: center; }
.donut-center {
    position: absolute;
    text-align: center;
    pointer-events: none;
}
.donut-total {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2rem;
    color: var(--ink);
    line-height: 1;
}
.donut-label {
    font-size: 0.7rem;
    color: var(--ink-3);
    letter-spacing: 0.08em;
    font-family: var(--font-display);
    font-weight: 600;
}
.donut-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    justify-content: center;
}
.dl-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--ink-2);
}
.dl-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dl-blue { background: var(--accent); }
.dl-ink  { background: var(--ink); }

.tables-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.table-half {
    margin-bottom: 0 !important;
}
.table-card-header {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}
.table-card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--ink);
}
.table-card-sub {
    font-size: 0.72rem;
    color: var(--ink-3);
}

.th-rank  { width: 30px; text-align: center; }
.th-right { text-align: right; }
.th-bar-col { width: 80px; }
.td-rank  { text-align: center; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3); }
.td-right { text-align: right; }
.td-client-name { font-size: 0.82rem; }
.td-desc { position: relative; width: auto; min-width: 220px; text-align: left; }
.td-desc-sm { font-size: 0.78rem; color: var(--ink-2); }
.td-center { text-align: center; }
.td-rows { white-space: nowrap; }
.rows-count { font-family: monospace; font-size: 0.85rem; color: var(--ink); font-weight: 700; }
.rows-sep { opacity: 0.45; margin: 0 1px; }
.rows-ok { color: var(--ink); font-weight: 700; }
.rows-partial { color: #f59e0b; font-weight: 700; }
.td-bar-cell { padding-right: 0.75rem; }

.mini-bar {
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
    min-width: 3px;
    opacity: 0.6;
    transition: opacity 0.15s;
}
tr:hover .mini-bar { opacity: 1; }

.tv-row-static { cursor: default; }
.tv-row-static:hover { background: var(--bg); }

/* Stats table generic */
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.stats-table thead th { padding: 0.5rem 1rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-4); text-align: left; border-bottom: 1px solid var(--border); background: var(--bg); }
.stats-table tbody td { padding: 0.55rem 1rem; border-bottom: 1px solid var(--border); }
.stats-table tbody tr:last-child td { border-bottom: none; }

/* Win/Loss KPI boxes */
.wl-kpi-box { text-align: center; min-width: 64px; }
.wl-kpi-val { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; line-height: 1; }
.wl-kpi-lbl { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-3); margin-top: 4px; text-transform: uppercase; }
.wl-won .wl-kpi-val  { color: #065F46; }
.wl-lost .wl-kpi-val { color: #B91C1C; }
.wl-pending .wl-kpi-val { color: var(--ink-3); }
.wl-rate .wl-kpi-val { color: var(--accent); }
.wl-bar-wrap { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 0.5rem; }
.wl-bar-won  { background: #16A34A; }
.wl-bar-lost { background: #DC2626; }

/* Month bars */
.month-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 1.25rem 1.25rem 1rem;
    height: 140px;
}
.month-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.month-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}
.month-bar-val {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--ink-2);
}
.month-bar-fill {
    width: 100%;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    min-height: 4px;
    opacity: 0.75;
    transition: opacity 0.15s;
}
.month-col:hover .month-bar-fill { opacity: 1; }
.month-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    margin-top: 0.4rem;
}

/* ── Processing overlay ── */
.proc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8,10,18,0.98);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}
.proc-overlay.proc-active { display: flex; }

.proc-grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(27,79,191,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(27,79,191,0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

.proc-panel {
    position: relative;
    width: 560px;
    padding: 2.5rem;
    background: rgba(14,16,26,0.95);
    border: 1px solid rgba(27,79,191,0.4);
    border-radius: 16px;
    box-shadow: 0 0 120px rgba(27,79,191,0.12), 0 40px 80px rgba(0,0,0,0.7);
    overflow: hidden;
}

.proc-scan {
    position: absolute;
    top: -2px; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #1B4FBF, #60A5FA, #1B4FBF, transparent);
    animation: proc-scan 3s ease-in-out infinite;
}
@keyframes proc-scan {
    0%   { top: -2px; opacity: 0; }
    8%   { opacity: 1; }
    92%  { opacity: 1; }
    100% { top: calc(100% + 2px); opacity: 0; }
}

/* Top row: ring + title */
.proc-top {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.proc-ring-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.proc-logo-ring {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.proc-logo-ring .proc-ring-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    animation: proc-ring-rot 1.8s linear infinite;
}
.proc-ring-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    text-align: center;
}
.proc-logo-mark {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.6rem;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.proc-logo-img {
    height: 52px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
}
.proc-frase {
    font-family: 'Cinzel Decorative', 'Montserrat', serif;
    font-weight: 700;
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    color: #E87B0C;
    line-height: 1.55;
    font-style: normal;
    text-align: center;
    max-width: 600px;
    margin: 2rem auto 0;
    padding: 0 1.5rem;
    letter-spacing: 0.02em;
    text-shadow: 0 0 40px rgba(232,123,12,0.35);
}
.proc-ring-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    animation: proc-ring-rot 1.8s linear infinite;
}
@keyframes proc-ring-rot { to { transform: rotate(360deg); } }
.proc-ring-track {
    fill: none;
    stroke: rgba(27,79,191,0.18);
    stroke-width: 4;
}
.proc-ring-spin {
    fill: none;
    stroke: url(#procGrad);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 90 236;
    filter: drop-shadow(0 0 8px #3B82F6);
}
.proc-pct {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    position: relative;
    z-index: 1;
    font-variant-numeric: tabular-nums;
}

.proc-head-text { flex: 1; }
.proc-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    color: #3B82F6;
    margin-bottom: 0.4rem;
}
.proc-status {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #93C5FD;
    min-height: 1.3em;
    transition: color 0.4s;
}

/* Progress bar */
.proc-bar-outer {
    width: 100%;
    height: 4px;
    background: rgba(27,79,191,0.2);
    border-radius: 2px;
    margin-bottom: 2rem;
    overflow: hidden;
}
.proc-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #1B4FBF, #3B82F6, #60A5FA);
    border-radius: 2px;
    transition: width 0.6s ease;
    box-shadow: 0 0 8px rgba(96,165,250,0.6);
}

/* Steps */
.proc-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.proc-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    transition: background 0.3s, opacity 0.3s;
    opacity: 0.38;
    border-left: 2px solid transparent;
}

.proc-step-idx {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    color: #3B82F6;
    min-width: 1.8rem;
    letter-spacing: 0.05em;
}

.proc-step-content { flex: 1; }
.proc-step-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.88rem;
    color: #E2E8F0;
    letter-spacing: 0.02em;
    margin-bottom: 0.1rem;
}
.proc-step-desc {
    font-size: 0.72rem;
    color: #94A3B8;
    letter-spacing: 0.01em;
}

.proc-step-ind {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    flex-shrink: 0;
}
.proc-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    transition: all 0.3s;
}
.proc-step-check {
    font-size: 0.85rem;
    color: #4ADE80;
    font-weight: 700;
    display: none;
}
.proc-check-show { display: block !important; }

/* Active */
.proc-step-active {
    opacity: 1;
    background: rgba(27,79,191,0.12);
    border-left-color: #3B82F6;
}
.proc-step-active .proc-step-dot {
    border-color: #3B82F6;
    background: #3B82F6;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.2);
    animation: proc-dot-pulse 1.2s ease-in-out infinite;
}
.proc-step-active .proc-step-title { color: #fff; }
.proc-step-active .proc-step-desc  { color: #93C5FD; }

/* Done */
.proc-step-done {
    opacity: 0.72;
    border-left-color: rgba(74,222,128,0.4);
}
.proc-step-done .proc-step-dot {
    border-color: #4ADE80;
    background: #4ADE80;
    animation: none;
}
.proc-step-done .proc-step-title { color: #CBD5E1; }
.proc-step-done .proc-step-desc  { color: #64748B; }

@keyframes proc-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(59,130,246,0.2); }
    50%       { box-shadow: 0 0 0 8px rgba(59,130,246,0.05), 0 0 16px rgba(59,130,246,0.4); }
}

.proc-cancel-btn {
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.12);
    padding: 0.4rem 1.4rem;
    border-radius: var(--radius);
    transition: all 0.2s;
}
.proc-cancel-btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.05);
}

/* ── Duplicate confirm ── */
.dup-wrap {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.dup-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    animation: dup-in 0.22s cubic-bezier(0.22,1,0.36,1);
}

@keyframes dup-in {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dup-top {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.5rem 1.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--orange-bg);
}

.dup-icon-wrap {
    color: var(--orange);
    flex-shrink: 0;
    margin-top: 1px;
}

.dup-top-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--orange);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.dup-top-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.3;
}

.dup-doc-block {
    padding: 1rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.dup-doc-name {
    font-size: 0.82rem;
    color: var(--ink-2);
    margin-bottom: 0.45rem;
    word-break: break-all;
}

.dup-doc-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.5rem;
    font-size: 0.82rem;
    color: var(--ink-3);
}

.dup-dot { color: var(--ink-4); }

.dup-actions-stack {
    display: flex;
    flex-direction: column;
}

.dup-actions-stack form {
    display: block;
}

.dup-action {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.75rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
    gap: 0.2rem;
}

.dup-actions-stack form:last-child .dup-action {
    border-bottom: none;
}

.dup-action:hover { background: var(--bg); }

.dup-action-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink);
}

.dup-action-sub {
    font-size: 0.78rem;
    color: var(--ink-3);
}

.dup-action-primary .dup-action-title { color: var(--accent); }
.dup-action-primary:hover { background: var(--accent-bg); }

.dup-action-cancel .dup-action-title { color: var(--ink-3); font-weight: 500; }
.dup-action-cancel .dup-action-sub   { color: var(--ink-4); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .login-layout { flex-direction: column; max-width: 440px; }
    .login-brand-panel { display: none; }
    .review-meta-bar { flex-direction: column; }
    .meta-item { border-right: none; border-bottom: 1px solid var(--border); }
    .meta-item:last-child { border-bottom: none; }
    .page-wrap { padding: 1rem; }
    .review-table { font-size: 0.78rem; }
    .td-source { display: none; }
    .th-source { display: none; }
    .legend-strip { gap: 0.75rem; }
    .dup-choices { grid-template-columns: 1fr; }
    .dup-choice { border-right: none; border-bottom: 1px solid var(--border); }
    .dup-choice:last-child { border-bottom: none; }
    .dup-header { flex-direction: column; align-items: flex-start; }
    .dup-filename-chip { max-width: 100%; }
}

/* ── Pagina Istruzioni ─────────────────────────────────────────────────────── */
.istr-page { max-width: 860px; margin: 2.5rem auto; padding: 0 1.5rem 4rem; }
.istr-header { margin-bottom: 2.5rem; }
.istr-title { font-family: var(--font-display); font-size: 1.8rem; font-weight: 900; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 0.35rem; }
.istr-sub { color: var(--ink-3); font-size: 0.9rem; margin: 0; }
.istr-section { margin-bottom: 2.5rem; }
.istr-section-label { font-family: var(--font-display); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.istr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 0.6rem; }
.istr-card-todo { background: var(--bg); border-style: dashed; }
.istr-card-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.istr-card-title { font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; color: var(--ink); letter-spacing: 0.01em; }
.istr-desc { font-size: 0.82rem; color: var(--ink-2); margin: 0; line-height: 1.55; }
.istr-badge { font-family: var(--font-display); font-size: 0.6rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 3px; white-space: nowrap; }
.istr-badge-done { background: #D1FAE5; color: #065F46; }
.istr-badge-todo { background: var(--bg-dark); color: var(--ink-4); }
.istr-pill { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 0.05rem 0.4rem; border-radius: 3px; }
.istr-green  { background: #D1FAE5; color: #065F46; }
.istr-orange { background: #FEF3C7; color: #92400E; }
.istr-red    { background: #FEE2E2; color: #991B1B; }

/* ── Dashboard: colonna #ID ── */
.th-id { width: 40px; text-align: center !important; padding: 0.7rem 0.4rem !important; }
.td-id { width: 40px; text-align: center; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3); padding: 0 0.4rem !important; }

/* ── Dashboard: badge codici mancanti ── */
.missing-badge { display: inline-block; margin-left: 5px; font-size: 0.65rem; font-weight: 700; font-family: var(--font-mono); background: rgba(232,123,12,0.18); color: #E87B0C; border: 1px solid rgba(232,123,12,0.4); border-radius: 3px; padding: 0.05rem 0.3rem; vertical-align: middle; white-space: nowrap; }

/* ── Dashboard: user tag (admin view) ── */
.th-user { width: 90px; }
.user-tag { font-size: 0.72rem; font-weight: 700; font-family: var(--font-display); letter-spacing: 0.04em; color: var(--ink-3); background: var(--bg); border: 1px solid var(--border); padding: 0.15rem 0.45rem; border-radius: 3px; white-space: nowrap; }
.user-tag-admin { background: #FFF7E6; color: #92400E; border-color: #FDE68A; }
/* Admin nav link */
.nav-link-admin { border: 1px solid var(--border); border-radius: var(--radius); }

/* ── Dashboard: responsive columns ── */
@media (max-width: 1400px) {
    .th-file, .td-file { display: none; }
}
@media (max-width: 1200px) {
    .th-rif, .td-rif { display: none; }
}
@media (max-width: 1000px) {
    .th-date .date-time { display: none; }
}
