/* ============================================
   Scadenzario.cloud — CSS Custom
   ============================================ */

:root {
    --primary: #1B3A5C;
    --primary-light: #2A5580;
    --accent: #4A9BD9;
    --accent-hover: #3A8BC9;
    --green: #059669;
    --green-light: #10B981;
    --red: #DC2626;
    --yellow: #D97706;
    --orange: #EA580C;
    --semaforo-red: #DC2626;
    --semaforo-yellow: #D97706;
    --semaforo-green: #059669;
    --sidebar-width: 300px;
    --sidebar-bg: #1B3A5C;
    --sidebar-text: #c8d8e8;
    --sidebar-active: #4A9BD9;
    --topbar-height: 56px;
    --font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar-logo {
    max-width: 220px;
    height: auto;
    background: #1B3A5C;
    border-radius: 10px;
    padding: 3px 7px;
}

.sidebar-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.sidebar-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar-nav li.active a {
    background: rgba(74, 155, 217, 0.12);
    color: #fff;
    border-left-color: var(--accent);
}

.sidebar-nav li a i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav li a .badge {
    font-size: 10px;
    padding: 3px 6px;
}

/* Sottomenu collassabili */
.sidebar-parent > a.sidebar-toggle {
    cursor: pointer;
    position: relative;
}

.sidebar-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.25s ease;
}

.sidebar-parent.open > a .sidebar-arrow {
    transform: rotate(90deg);
}

.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background: rgba(0,0,0,0.12);
}

.sidebar-parent.open > .sidebar-submenu {
    display: block;
}

.sidebar-submenu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px 8px 48px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-submenu li a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar-submenu li.active a {
    background: rgba(74, 155, 217, 0.12);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 600;
}

.sidebar-submenu li a i {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-submenu li a .badge {
    font-size: 9px;
    padding: 2px 5px;
}

/* Voce primaria "Crea da Template" evidenziata */
.sidebar-submenu-primary a {
    color: var(--accent) !important;
    font-weight: 600 !important;
}

.sidebar-submenu-primary a:hover {
    color: #fff !important;
}

/* Voce secondaria "oppure scadenza manuale" — piccola, discreta */
.sidebar-submenu-secondary a {
    font-size: 11px !important;
    color: rgba(255,255,255,0.4) !important;
    padding-top: 2px !important;
    padding-bottom: 8px !important;
    padding-left: 72px !important;
}

.sidebar-submenu-secondary a:hover {
    color: rgba(255,255,255,0.7) !important;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
    min-width: 0;
}

.sidebar-user i {
    font-size: 28px;
    flex-shrink: 0;
}

.sidebar-user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.sidebar-user-role {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.sidebar-logout {
    color: var(--sidebar-text);
    font-size: 20px;
    padding: 4px;
    transition: color 0.2s;
}

.sidebar-logout:hover {
    color: var(--red);
}

/* ============================================
   DESKTOP TOPBAR
   ============================================ */
.desktop-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--sidebar-bg);
    z-index: 1051;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.desktop-topbar-left {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding-right: 20px;
}

.desktop-topbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.desktop-topbar-logo {
    max-width: 200px;
    height: auto;
}

.desktop-topbar::after {
    content: '';
    position: absolute;
    bottom: -16px;
    left: var(--sidebar-width);
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 100% 100%, transparent 16px, var(--sidebar-bg) 16px);
    pointer-events: none;
}

/* --- Global Search (Desktop Topbar) --- */
.desktop-topbar-search {
    flex: 1;
    max-width: 480px;
    margin: 0 24px;
}

.global-search-wrapper {
    position: relative;
}

.global-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    pointer-events: none;
    z-index: 2;
}

.global-search-input {
    width: 100%;
    padding: 7px 40px 7px 36px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.global-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.global-search-input:focus {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.global-search-kbd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
    font-family: inherit;
    line-height: 1.4;
    pointer-events: none;
}

/* --- Global Search Dropdown --- */
.global-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    max-height: 420px;
    overflow-y: auto;
    z-index: 9999;
}

.global-search-dropdown.open {
    display: block;
}

.gs-loading, .gs-empty {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}

.gs-category {
    border-bottom: 1px solid #f3f4f6;
}

.gs-category:last-child {
    border-bottom: none;
}

.gs-category-header {
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    background: #f9fafb;
}

.gs-category-header:first-child {
    border-radius: 10px 10px 0 0;
}

.gs-result-item {
    transition: background 0.1s;
}

.gs-result-item:hover,
.gs-result-item.gs-selected {
    background: #f0f6ff;
}

.gs-result-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    text-decoration: none;
    color: inherit;
}

.gs-result-icon {
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.gs-result-text {
    flex: 1;
    min-width: 0;
}

.gs-result-title {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-result-title mark {
    background: #fef08a;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.gs-result-subtitle {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.desktop-topbar-spacer {
    flex: 1;
}

.desktop-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.desktop-topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--sidebar-text);
}

.desktop-topbar-user i {
    font-size: 22px;
}

.desktop-topbar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
}

.desktop-topbar-logout {
    color: var(--sidebar-text);
    font-size: 18px;
    padding: 4px;
    transition: color 0.2s;
}

.desktop-topbar-logout:hover {
    color: var(--red);
}

/* Desktop: sidebar sotto la topbar + sfondo scuro per angolo arrotondato */
@media (min-width: 992px) {
    body {
        background: var(--sidebar-bg);
    }

    .sidebar {
        top: var(--topbar-height);
        height: calc(100vh - var(--topbar-height));
    }

    .main-content {
        margin-left: var(--sidebar-width);
        margin-top: var(--topbar-height);
    }
}

/* ============================================
   OVERLAY MOBILE
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    min-height: 100vh;
    background: #f0f2f5;
}

.content-wrapper {
    padding: 24px;
}

.topbar {
    background: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
    justify-content: center;
}

.topbar .btn-link:first-child {
    color: var(--primary);
    padding: 4px;
    position: absolute;
    left: 16px;
}

.topbar-title {
    font-weight: 600;
    font-size: 16px;
}

.topbar-logo {
    height: 34px;
    width: auto;
}

/* --- Mobile Search --- */
.mobile-search-toggle {
    color: var(--primary);
    padding: 4px 0;
    position: absolute;
    right: 16px;
    font-size: 18px;
    text-decoration: none;
    z-index: 2;
}

.mobile-search-bar {
    display: none;
    padding: 0 12px 12px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.mobile-search-bar.open {
    display: block;
}

.mobile-search-bar .global-search-wrapper {
    position: relative;
}

.mobile-search-bar .global-search-icon {
    color: #9ca3af;
}

.mobile-search-bar .global-search-input {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    padding-right: 36px;
    border-radius: 8px;
    font-size: 14px;
}

.mobile-search-bar .global-search-input::placeholder {
    color: #9ca3af;
}

.mobile-search-bar .global-search-input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.mobile-search-close {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    padding: 4px 8px;
    font-size: 14px;
    z-index: 2;
}

.mobile-search-bar .global-search-dropdown {
    left: 0;
    right: 0;
    border-radius: 8px;
    max-height: 60vh;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar.show + .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-top: 0;
    }
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* ============================================
   BANNER UPGRADE (Dashboard)
   ============================================ */
.banner-upgrade {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    border-radius: 8px;
}

.banner-upgrade-content {
    flex: 1;
}

.banner-upgrade-link {
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
}

.banner-upgrade-link:hover {
    color: #fef3c7;
}

.banner-upgrade-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 12px;
}

.banner-upgrade-close:hover {
    color: #fff;
}

/* ============================================
   WIDGET CONFORMITA (Dashboard)
   ============================================ */
.conformita-row {
    transition: background-color 0.15s ease;
}
.conformita-row:hover {
    background-color: #f8f9fa;
}
.conformita-row:last-child {
    border-bottom: none !important;
}

/* ============================================
   STAT CARDS (Dashboard) - stile "pulito"
   Fondo bianco, bordo laterale colorato, icona di sfondo, numero scuro.
   ============================================ */
.stat-card {
    position: relative;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #d1d5db;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

.stat-card .card-body {
    padding: 20px 24px;
    position: relative;
    z-index: 1;
}

.stat-card .stat-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 72px;
    opacity: 0.08;
    line-height: 1;
    z-index: 0;
    pointer-events: none;
}

.stat-card .stat-number {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    color: #111827;
}

.stat-card .stat-label {
    font-size: 13px;
    font-weight: 500;
    margin-top: 6px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-card .stat-sub {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.stat-card.stat-danger  { border-left-color: #DC2626; }
.stat-card.stat-warning { border-left-color: #D97706; }
.stat-card.stat-success { border-left-color: #059669; }

.stat-card.stat-danger  .stat-icon { color: #DC2626; }
.stat-card.stat-warning .stat-icon { color: #D97706; }
.stat-card.stat-success .stat-icon { color: #059669; }

.stat-card.stat-danger  .stat-number { color: #991B1B; }
.stat-card.stat-warning .stat-number { color: #92400E; }
.stat-card.stat-success .stat-number { color: #065F46; }

/* Section headers dentro la lista urgenti */
.scadenza-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    border-top: 1px solid #e5e7eb;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
}
.scadenza-section-header:first-child { border-top: none; }
.scadenza-section-header.danger  { color: #991B1B; background: #fef2f2; }
.scadenza-section-header.warning { color: #92400E; background: #fffbeb; }
.scadenza-section-header .count-pill {
    background: #fff;
    border: 1px solid currentColor;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Quick actions: bottoni "tiles" colorati */
.quick-action-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    text-decoration: none;
    transition: all 0.15s ease;
}
.quick-action-tile:hover {
    border-color: #2563EB;
    background: #eff6ff;
    color: #1e40af;
    transform: translateX(2px);
}
.quick-action-tile .qa-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.quick-action-tile .qa-icon.blue    { background: #dbeafe; color: #1d4ed8; }
.quick-action-tile .qa-icon.green   { background: #dcfce7; color: #15803d; }
.quick-action-tile .qa-icon.purple  { background: #f3e8ff; color: #7e22ce; }
.quick-action-tile .qa-icon.orange  { background: #ffedd5; color: #c2410c; }
.quick-action-tile .qa-text { flex: 1; min-width: 0; }
.quick-action-tile .qa-title { font-weight: 600; font-size: 14px; line-height: 1.2; }
.quick-action-tile .qa-sub { font-size: 12px; color: #9ca3af; margin-top: 2px; }

/* Wrapper grafico categorie: limita l'altezza su mobile */
.chart-categorie-wrap {
    position: relative;
    width: 100%;
    height: 260px;
    max-width: 320px;
    margin: 0 auto;
}
@media (max-width: 767.98px) {
    .chart-categorie-wrap {
        height: 220px;
        max-width: 240px;
    }
}

/* Mini-istogramma 30 giorni */
.timeline-30 {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 70px;
    padding: 8px 0 4px;
}
.timeline-30 .tl-bar {
    flex: 1;
    min-width: 6px;
    background: #e5e7eb;
    border-radius: 3px 3px 0 0;
    transition: background 0.15s;
    position: relative;
    cursor: pointer;
}
.timeline-30 .tl-bar:hover { background: #2563EB !important; }
.timeline-30 .tl-bar.has-events { background: #93c5fd; }
.timeline-30 .tl-bar.urgent    { background: #fca5a5; }
.timeline-30 .tl-bar.today {
    outline: 2px solid #2563EB;
    outline-offset: 1px;
}
.timeline-30-scale {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 2px;
}
.timeline-30-summary {
    font-size: 13px;
    color: #6b7280;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.timeline-30-summary strong { color: #111827; }

/* ============================================
   CARDS E PANNELLI
   ============================================ */
.card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    background: #fff;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 20px;
}

/* ============================================
   BADGE SEMAFORO
   ============================================ */
.badge-semaforo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-semaforo.danger {
    background: #fef2f2;
    color: var(--red);
}

.badge-semaforo.warning {
    background: #fffbeb;
    color: var(--yellow);
}

.badge-semaforo.success {
    background: #ecfdf5;
    color: var(--green);
}

/* ============================================
   SCADENZA LIST ITEMS
   ============================================ */
.scadenza-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
    gap: 12px;
}

.scadenza-item:hover {
    background: #f9fafb;
}

.scadenza-item:last-child {
    border-bottom: none;
}

.scadenza-indicator {
    display: none;
}

.scadenza-item.semaforo-danger { border-left: 4px solid var(--red); }
.scadenza-item.semaforo-warning { border-left: 4px solid var(--yellow); }
.scadenza-item.semaforo-success { border-left: 4px solid var(--green); }

.scadenza-info {
    flex: 1;
    min-width: 0;
}

.scadenza-title {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scadenza-meta {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.scadenza-date {
    text-align: right;
    flex-shrink: 0;
}

.scadenza-date .date {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.scadenza-date .days {
    font-size: 12px;
    margin-top: 2px;
}

/* ============================================
   TABELLE
   ============================================ */
.table th {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6b7280;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
    font-size: 14px;
}

/* DataTables override */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
}

/* ============================================
   FORM
   ============================================ */
.form-label {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
}

.form-control, .form-select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 155, 217, 0.15);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 18px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 48px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.empty-state h5 {
    color: #6b7280;
    font-weight: 600;
}

.empty-state p {
    color: #9ca3af;
    max-width: 360px;
    margin: 8px auto 20px;
}

/* ============================================
   LOGIN / REGISTER PAGE
   ============================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1B3A5C 0%, #2A5580 100%);
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 480px;
    padding: 40px;
}

.auth-card.auth-card-wide {
    max-width: 600px;
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-card .auth-logo i {
    font-size: 40px;
    color: var(--accent);
}

.auth-card .auth-logo h2 {
    color: var(--primary);
    font-weight: 700;
    margin: 8px 0 4px;
}

.auth-card .auth-logo p {
    color: #6b7280;
    font-size: 14px;
}

/* ============================================
   PASSWORD STRENGTH INDICATOR
   ============================================ */
.password-strength {
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    margin-top: 6px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background-color 0.3s;
    width: 0;
}

/* ============================================
   CARD MOBILE (base styles)
   ============================================ */
.scadenza-card-mobile {
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    border-left: 4px solid #e5e7eb;
}

.entity-card-mobile {
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

/* ============================================
   RESPONSIVE DASHBOARD (mobile)
   ============================================ */
@media (max-width: 767.98px) {
    .content-wrapper {
        padding: 16px 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 20px;
    }

    /* Card header: stack title and button */
    .card-header.d-flex {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start !important;
    }

    /* Scadenza items: wrap to multi-line */
    .scadenza-item {
        flex-wrap: wrap;
        padding: 12px 14px;
        gap: 6px 8px;
    }

    .scadenza-title {
        white-space: normal;
        word-break: break-word;
    }

    /* Info takes full row (minus indicator) */
    .scadenza-info {
        flex: 1 1 calc(100% - 20px);
        min-width: 0;
    }

    /* Date + actions go on second row */
    .scadenza-date {
        text-align: left;
        margin-left: 12px;
    }

    .scadenza-item .ms-2.d-flex {
        margin-left: auto !important;
    }

    /* Stat cards: smaller on mobile */
    .stat-card .stat-number {
        font-size: 28px;
    }

    .stat-card .stat-label {
        font-size: 13px;
    }

    .stat-card .card-body {
        padding: 14px;
    }

    /* Conformita widget */
    .conformita-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Banner upgrade */
    .banner-upgrade {
        flex-direction: column;
        gap: 8px;
        padding: 12px 16px;
        font-size: 13px;
    }

    /* Filtri: stack verticale su mobile */
    .card-body .row.g-2 .col-md-2 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Card mobile scadenze */
    .scadenza-card-mobile {
        border-left: 4px solid #e5e7eb;
    }
    .scadenza-card-mobile.scadenza-card-danger { border-left-color: var(--red); }
    .scadenza-card-mobile.scadenza-card-warning { border-left-color: var(--yellow); }
    .scadenza-card-mobile.scadenza-card-success { border-left-color: var(--green); }

    /* Card mobile entita (anagrafiche) */
    .entity-card-mobile {
        border-left: 3px solid var(--accent);
    }

    /* Tab: font ridotto su mobile per stare meglio su più righe */
    .nav-tabs .nav-link {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-primary-custom { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }
.bg-primary-custom { background-color: var(--primary) !important; }

.rounded-lg { border-radius: 12px !important; }

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
