:root {
    --primary: #003366;
    /* Blu Reale Mutua style */
    --secondary: #005bb7;
    --accent: #ffcc00;
    --bg-app: #f4f7f9;
    --bg-card: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --border: #dfe6e9;
    --success: #27ae60;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.6;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.logo span {
    font-size: 0.8rem;
    opacity: 0.7;
}

nav {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    text-align: left;
    padding: 1rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-btn:hover,
.nav-btn.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Main Content */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
}

header h2 {
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.pending-item {
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #eee;
    transition: all 0.2s;
}

.pending-item.highlight-selectable {
    background: #fffdf0;
    border-left: 4px solid var(--accent);
}

.pending-item:hover {
    background: #fdfdfd;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

/* Tables */
.recent-table {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-muted);
}

/* Forms */
.form-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    max-width: 800px;
}

.type-selector {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-app);
    border-radius: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 500;
    font-size: 0.9rem;
}

input,
select {
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.calculation-summary {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #e1f5fe;
    border-radius: 8px;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.calc-grid span {
    font-weight: 700;
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.primary-btn:hover {
    background: var(--secondary);
}

/* Versamenti & Cash Counter */
.deposit-split {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.cash-counter {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.cash-counter.highlight {
    border: 2px solid var(--accent);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.3);
}

.denomination-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.denom-row {
    display: grid;
    grid-template-columns: 60px 80px 1fr;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.denom-row span {
    font-weight: 600;
    color: var(--primary);
}

.denom-row input {
    padding: 0.4rem;
    text-align: center;
}

.denom-row strong {
    text-align: right;
    color: var(--success);
}

.cash-total {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--primary);
    font-size: 1.2rem;
    font-weight: 700;
    text-align: right;
    color: var(--primary);
}

/* Print Styles */
@media screen {
    .print-only {
        display: none;
    }
}

@media print {
    body {
        font-size: 8pt !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .app-container {
        display: none !important;
    }

    #print-area {
        display: block !important;
        width: 100% !important;
        color: #000 !important;
        font-size: 9pt !important;
        line-height: 1.2 !important;
    }

    /* Target body elements only, excluding the header */
    #print-header,
    #print-table,
    #print-cash-breakdown-section,
    #print-footer {
        font-size: 9pt !important;
    }

    #print-area table td,
    #print-area table th {
        font-size: 9pt !important;
        padding: 3px 5px !important;
        border: 1px solid #000 !important;
    }

    #print-area h1 {
        font-size: 14pt !important;
        font-weight: bold !important;
        margin: 15px 0 !important;
        text-align: center !important;
    }

    /* Explicitly keep header larger and untouched by generic rules */
    #print-header-top * {
        margin: 0 !important;
        line-height: 1.2 !important;
    }

    .print-table-small {
        width: 220px !important;
    }

    #print-footer {
        margin-top: 20px !important;
        border-top: 2px solid #000 !important;
    }

    .signatures {
        margin-top: 30px !important;
    }
}