/* ========================================
   KB KNOWLEDGE BASE - FRONTEND CSS
   Design Mobile-First Professionale
   ======================================== */

/* Reset e Base - Mobile First */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    margin: 0;
    padding: 0;
    background: #f7fafc;
    font-size: 16px;
}

/* Mobile-first responsive breakpoints */
@media (min-width: 480px) { /* Small phones */
    body { font-size: 16px; }
}

@media (min-width: 768px) { /* Tablets */
    body { font-size: 17px; }
}

@media (min-width: 1024px) { /* Desktop */
    body { font-size: 18px; }
}

/* Palette Colori Unificata */
:root {
    --kb-primary: #667eea;
    --kb-primary-dark: #5a67d8;
    --kb-secondary: #4a5568;
    --kb-success: #48bb78;
    --kb-warning: #ed8936;
    --kb-danger: #f56565;
    --kb-info: #4299e1;
    --kb-light: #f7fafc;
    --kb-dark: #2d3748;
    --kb-gray: #718096;
    --kb-border: #e2e8f0;
    --kb-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --kb-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --kb-radius: 12px;
    --kb-radius-sm: 8px;
    --kb-spacing: 16px;
    --kb-spacing-lg: 24px;
}

/* Container principale */
.kb-frontend {
    max-width: 1200px;
    margin: clamp(16px, 5vw, 48px) auto;
    padding: clamp(20px, 4vw, 40px);
    background: #ffffff;
    border-radius: var(--kb-radius);
    box-shadow: var(--kb-shadow-lg);
    position: relative;
    overflow: hidden;
}

.kb-knowledge-archive::before {
    content: "";
    position: absolute;
    inset: -60% auto auto -20%;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.15), transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.kb-knowledge-archive > * {
    position: relative;
    z-index: 1;
}

/* Hero Knowledge Base */
.kb-hero {
    background: linear-gradient(135deg, #0f172a 0%, #312e81 100%);
    color: #fff !important;
    border-radius: var(--kb-radius);
    padding: clamp(24px, 6vw, 48px);
    margin-bottom: var(--kb-spacing-lg);
    box-shadow: var(--kb-shadow);
    display: grid;
    gap: var(--kb-spacing-lg);
}

.kb-hero-content {
    max-width: 680px;
}

.kb-hero-eyebrow {
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0 0 8px;
    color: rgba(255, 255, 255, 0.7);
}

.kb-hero-title {
    margin: 0 0 12px;
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    color: #fff !important;
}

.kb-hero-subtitle {
    margin: 0;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85) !important;
    line-height: 1.7;
}

.kb-hero-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--kb-spacing);
}

.kb-metric-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--kb-radius-sm);
    padding: var(--kb-spacing);
    backdrop-filter: blur(4px);
}

.kb-metric-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kb-metric-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    margin: 4px 0;
}

.kb-metric-meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

.kb-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kb-spacing);
}

.kb-action-primary,
.kb-action-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    border-radius: var(--kb-radius-sm);
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    transition: all 0.3s ease;
    min-height: 48px;
}

.kb-action-primary {
    background: linear-gradient(135deg, #facc15 0%, #f97316 100%);
    color: #0f172a;
    box-shadow: 0 15px 30px rgba(249, 115, 22, 0.35);
}

.kb-action-secondary {
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(15, 23, 42, 0.4);
}

.kb-action-primary:hover,
.kb-action-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--kb-shadow-lg);
}

@media (min-width: 992px) {
    .kb-hero {
        grid-template-columns: 1.1fr 0.9fr;
        align-items: center;
    }
}

/* Panoramica categorie */
.kb-category-overview {
    background: #fff;
    border-radius: var(--kb-radius);
    border: 1px solid var(--kb-border);
    padding: var(--kb-spacing-lg);
    margin-bottom: var(--kb-spacing-lg);
    box-shadow: var(--kb-shadow);
}

.kb-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--kb-spacing);
}

.kb-category-card {
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius);
    padding: var(--kb-spacing);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    display: flex;
    flex-direction: column;
    gap: var(--kb-spacing);
    box-shadow: var(--kb-shadow);
    transition: all 0.3s ease;
}

.kb-category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--kb-shadow-lg);
    border-color: var(--kb-primary);
}

.kb-category-card-top {
    display: flex;
    gap: var(--kb-spacing);
    align-items: flex-start;
}

.kb-category-card-top h3 {
    margin: 0 0 6px;
    font-size: 1.1rem;
    color: var(--kb-dark);
}

.kb-category-card-top p {
    margin: 0;
    color: var(--kb-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.kb-category-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: var(--kb-shadow);
}

.kb-category-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--kb-spacing);
    flex-wrap: wrap;
}

.kb-category-count {
    font-weight: 700;
    color: var(--kb-primary-dark);
}

.kb-category-link {
    text-decoration: none;
    font-weight: 600;
    color: var(--kb-primary-dark);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

.kb-category-link:hover {
    color: var(--kb-primary);
}

/* Indice Categorie (kb-categories page) */
.kb-catindex-articles {
    list-style: none;
    margin: 0 0 var(--kb-spacing);
    padding: 0;
    border-top: 1px solid var(--kb-border);
    padding-top: var(--kb-spacing);
}

.kb-catindex-article-item {
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.kb-catindex-article-item:last-child {
    margin-bottom: 0;
}

.kb-catindex-article-item a {
    color: var(--kb-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.kb-catindex-article-item a:hover {
    color: var(--kb-primary);
}

.kb-catindex-meta {
    margin-bottom: 0;
}

/* Header e navigazione */
.kb-header {
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: white !important;
    padding: var(--kb-spacing-lg);
    border-radius: var(--kb-radius) var(--kb-radius) 0 0;
    margin: calc(-1 * var(--kb-spacing)) calc(-1 * var(--kb-spacing)) var(--kb-spacing-lg) calc(-1 * var(--kb-spacing));
}

/* Bottoni di navigazione KB */
.kb-nav-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: var(--kb-spacing-lg) 0;
    padding: 16px 20px;
    background: #ffffff;
    border-radius: var(--kb-radius);
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.kb-nav-button-secondary {
    background: #2d3748 !important;
    color: #ffffff !important;
}

.kb-nav-button-secondary:hover {
    background: #1a202c !important;
    color: #ffffff !important;
}

.kb-nav-button-primary {
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%) !important;
    color: #ffffff !important;
    font-weight: 600;
}

.kb-nav-button-primary:hover {
    background: linear-gradient(135deg, var(--kb-primary-dark) 0%, #4c51bf 100%) !important;
    color: #ffffff !important;
}

.kb-header h1 {
    margin: 0 0 var(--kb-spacing) 0;
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
}

.kb-nav {
    display: flex;
    gap: var(--kb-spacing);
    justify-content: center;
    flex-wrap: wrap;
}

.kb-nav-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #f1f5f9;
    color: #475569;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    min-height: 40px;
    border: 1px solid #e2e8f0;
}

.kb-nav-button:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
    color: #1e293b;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.kb-nav-button.active {
    background: var(--kb-primary);
    color: #ffffff;
    border-color: var(--kb-primary-dark);
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}

/* Navigazione piattaforma raggruppata */
.kb-platform-nav {
    margin: var(--kb-spacing-lg) 0;
    padding: 18px 20px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--kb-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.kb-platform-nav-quick {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.kb-platform-nav-quick-label,
.kb-platform-nav-section-title {
    margin: 0 0 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.kb-platform-nav-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.kb-platform-nav-quick-link,
.kb-platform-nav-section-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.kb-platform-nav-quick-link:hover,
.kb-platform-nav-section-link:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.12);
}

.kb-platform-nav-quick-link.active,
.kb-platform-nav-section-link.active {
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    border-color: var(--kb-primary-dark);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.28);
}

.kb-platform-nav-quick-link.is-accent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #ffffff;
}

.kb-platform-nav-quick-link.is-accent:hover {
    filter: brightness(1.05);
    color: #ffffff;
}

.kb-platform-nav-quick-link.is-success {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.45);
    color: #166534;
}

.kb-platform-nav-quick-link.is-primary.active,
.kb-platform-nav-quick-link.is-accent.active,
.kb-platform-nav-quick-link.is-success.active {
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
}

.kb-platform-nav-section-link.is-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.kb-platform-nav-section-link.is-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.kb-platform-nav-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px 20px;
}

.kb-platform-nav-section-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kb-platform-nav-section-link {
    width: 100%;
    box-sizing: border-box;
}

.kb-platform-nav-icon {
    flex: 0 0 auto;
    font-size: 1rem;
    line-height: 1;
}

.kb-platform-nav-label {
    flex: 1 1 auto;
}

html.kb-dark .kb-platform-nav {
    background: #1e293b;
    border-color: #334155;
}

html.kb-dark .kb-platform-nav-quick {
    border-bottom-color: #334155;
}

html.kb-dark .kb-platform-nav-quick-label,
html.kb-dark .kb-platform-nav-section-title {
    color: #94a3b8;
}

html.kb-dark .kb-platform-nav-quick-link,
html.kb-dark .kb-platform-nav-section-link {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

html.kb-dark .kb-platform-nav-quick-link:hover,
html.kb-dark .kb-platform-nav-section-link:hover {
    background: #334155;
    border-color: #475569;
    color: #f8fafc;
}

html.kb-dark .kb-platform-nav-section-link.is-danger {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fecaca;
}

@media (max-width: 782px) {
    .kb-platform-nav {
        padding: 14px 14px 16px;
    }

    .kb-platform-nav-quick-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kb-platform-nav-quick-link {
        justify-content: flex-start;
        min-height: 48px;
    }

    .kb-platform-nav-sections {
        grid-template-columns: 1fr;
    }
}

/* Header tassonomia */
/* ───── Hero tassonomia ───── */
.kb-taxonomy-hero {
    text-align: center;
    padding: 48px 24px 40px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
    border-radius: var(--kb-radius);
    margin-bottom: 0;
    color: #ffffff !important;
}
.kb-taxonomy-hero-eyebrow {
    margin: 0 0 6px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.6) !important;
    font-weight: 600;
}
.kb-taxonomy-hero-title {
    margin: 0 0 10px;
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff !important;
    line-height: 1.2;
}
.kb-taxonomy-hero-desc {
    margin: 0 auto 16px;
    max-width: 560px;
    font-size: 1.05rem;
    color: rgba(255,255,255,0.75) !important;
    font-style: italic;
    line-height: 1.5;
}
.kb-taxonomy-hero-count {
    display: inline-block;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ffffff;
    padding: 6px 18px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Legacy header (mantieni per compatibilita) */
.kb-taxonomy-header {
    text-align: center;
    padding: var(--kb-spacing-lg);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--kb-radius);
    margin-bottom: var(--kb-spacing-lg);
    border: 2px solid var(--kb-border);
}
.kb-taxonomy-header h1 {
    color: var(--kb-dark);
    margin: 0 0 var(--kb-spacing) 0;
    font-size: 2rem;
    font-weight: 700;
}
.kb-taxonomy-description {
    color: var(--kb-gray);
    font-size: 1.1rem;
    margin: 0;
    font-style: italic;
}

/* Sezione di ricerca */
.kb-toolbar {
    display: grid;
    gap: var(--kb-spacing-lg);
    margin-bottom: var(--kb-spacing-lg);
}

.kb-section-header {
    margin-bottom: var(--kb-spacing);
}

.kb-section-header h2,
.kb-section-header h3 {
    margin: 0;
    font-size: 1.35rem;
    color: var(--kb-dark);
}

.kb-section-header p {
    margin: 6px 0 0;
    color: var(--kb-gray);
    font-size: 0.95rem;
}

.kb-search-section {
    background: linear-gradient(135deg, #fdfdfd 0%, #f4f7fb 100%);
    padding: var(--kb-spacing-lg);
    border-radius: var(--kb-radius);
    border: 1px solid var(--kb-border);
    box-shadow: var(--kb-shadow);
}

.kb-search-form {
    display: flex;
    gap: var(--kb-spacing);
    flex-wrap: wrap;
    align-items: stretch;
}

.kb-search-input {
    flex: 1;
    min-width: 200px;
    padding: 14px 16px;
    border: 2px solid var(--kb-border);
    border-radius: var(--kb-radius-sm);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.kb-search-input:focus {
    outline: none;
    border-color: var(--kb-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.kb-search-button {
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: var(--kb-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 48px;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.kb-search-button:hover {
    background: linear-gradient(135deg, var(--kb-primary-dark) 0%, #4c51bf 100%);
    transform: translateY(-2px);
    box-shadow: var(--kb-shadow-lg);
}

.kb-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Filtri */
.kb-filters {
    background: #fff;
    border-radius: var(--kb-radius);
    border: 1px solid var(--kb-border);
    padding: var(--kb-spacing-lg);
    box-shadow: var(--kb-shadow);
}

.kb-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--kb-spacing);
}

.kb-filter-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--kb-gray);
}

.kb-filter-label {
    font-weight: 600;
    color: var(--kb-secondary);
}

.kb-filter-select {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 2px solid var(--kb-border);
    border-radius: var(--kb-radius-sm);
    font-size: 0.95rem;
    line-height: 44px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

.kb-filter-select:focus {
    outline: none;
    border-color: var(--kb-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Griglia articoli */
.kb-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    margin: var(--kb-spacing-lg) 0;
}

/* ───── Card articolo (redesign) ───── */
.kb-article-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--kb-primary);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.kb-article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(102,126,234,0.15);
    border-left-color: var(--kb-primary-dark);
}

/* Accento laterale per priorita */
.kb-card-priority-critical { border-left-color: #e53e3e; }
.kb-card-priority-high     { border-left-color: #ed8936; }
.kb-card-priority-medium   { border-left-color: #667eea; }
.kb-card-priority-low      { border-left-color: #48bb78; }

/* Barra superiore (ID + data) */
.kb-card-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f7fafc;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.78rem;
    color: #718096;
    letter-spacing: 0.02em;
}
.kb-card-id {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-weight: 600;
    color: var(--kb-primary-dark);
    background: rgba(102,126,234,0.08);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}
.kb-card-date {
    font-weight: 500;
}

/* Contenuto centrale */
.kb-card-content {
    padding: 16px 18px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kb-article-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
}
.kb-article-title a {
    color: #1a202c;
    text-decoration: none;
    transition: color 0.2s;
}
.kb-article-title a:hover {
    color: var(--kb-primary);
}

.kb-article-excerpt {
    color: #64748b;
    line-height: 1.6;
    margin: 0;
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Badges (stato, priorita, categoria) */
.kb-card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}
.kb-card-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
    line-height: 1.6;
}
/* Stato */
.kb-card-badge-confirmed { background: #c6f6d5; color: #22543d; }
.kb-card-badge-partial   { background: #fefcbf; color: #744210; }
.kb-card-badge-obsolete  { background: #fed7d7; color: #742a2a; }
/* Priorita */
.kb-card-badge-priority-critical { background: #fee2e2; color: #991b1b; }
.kb-card-badge-priority-high     { background: #ffedd5; color: #9a3412; }
.kb-card-badge-priority-medium   { background: #e0e7ff; color: #3730a3; }
.kb-card-badge-priority-low      { background: #dcfce7; color: #166534; }
/* Categoria */
.kb-card-badge-cat {
    background: rgba(102,126,234,0.1);
    color: var(--kb-primary-dark);
    border: 1px solid rgba(102,126,234,0.18);
    transition: all 0.2s;
}
.kb-card-badge-cat:hover {
    background: var(--kb-primary);
    color: #fff;
    border-color: var(--kb-primary);
}

/* Footer card */
.kb-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: #f7fafc;
    border-top: 1px solid #edf2f7;
    gap: 10px;
}
.kb-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.kb-card-meta-item {
    font-size: 0.78rem;
    color: #718096;
    white-space: nowrap;
}

.kb-read-more {
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: white;
    text-decoration: none;
    padding: 7px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.kb-read-more:hover {
    background: linear-gradient(135deg, var(--kb-primary-dark) 0%, #4c51bf 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.25);
    color: white;
}

/* Legacy classes kept for search results */
.kb-article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--kb-spacing);
    padding: 12px 16px;
    border-bottom: 1px solid #edf2f7;
    background: #f7fafc;
}
.kb-article-eyebrow {
    margin: 0 0 4px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #718096;
}
.kb-article-author {
    font-size: 0.85rem;
    color: #718096;
    font-weight: 500;
}
.kb-article-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.kb-article-categories {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.kb-category-tag {
    background: rgba(102, 126, 234, 0.1);
    color: var(--kb-primary-dark);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(102,126,234,0.18);
    transition: all 0.2s;
}
.kb-category-tag:hover {
    background: var(--kb-primary);
    color: #fff;
    border-color: var(--kb-primary);
}
.kb-article-footer {
    padding: 10px 16px;
    background: #f7fafc;
    border-top: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Risultati ricerca e helper */
.kb-search-results {
    background: #fff;
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius);
    padding: var(--kb-spacing-lg);
    box-shadow: var(--kb-shadow);
    margin-bottom: var(--kb-spacing-lg);
    animation: fadeIn 0.3s ease;
}

.kb-loading {
    font-weight: 600;
    color: var(--kb-primary);
}

.kb-search-highlight {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 4px;
    padding: 0 4px;
}

.kb-no-articles {
    text-align: center;
    padding: var(--kb-spacing-lg);
    border: 2px dashed var(--kb-border);
    border-radius: var(--kb-radius);
    background: #f8fafc;
}

.kb-pagination {
    display: flex;
    justify-content: center;
    margin-bottom: var(--kb-spacing);
}

.kb-pagination ul {
    list-style: none;
    display: flex;
    gap: 12px;
    padding: 0;
    margin: 0;
}

.kb-pagination a,
.kb-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: var(--kb-radius-sm);
    border: 1px solid var(--kb-border);
    text-decoration: none;
    color: var(--kb-secondary);
    font-weight: 600;
}

.kb-pagination .current,
.kb-pagination a:hover {
    background: var(--kb-primary);
    border-color: var(--kb-primary-dark);
    color: #fff;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Badge di stato e priorità */
.kb-status-badge,
.kb-priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.kb-status-confirmed {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.kb-status-partial {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 1px solid #ffeaa7;
}

.kb-status-obsolete {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.kb-priority-critical {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.kb-priority-high {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #856404;
    border: 1px solid #fdcb6e;
}

.kb-priority-medium {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: #ffffff;
    border: 1px solid #0984e3;
}

.kb-priority-low {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: #ffffff;
    border: 1px solid #00a085;
}

/* Messaggio nessun articolo */
.kb-no-articles {
    text-align: center;
    padding: var(--kb-spacing-lg);
    color: var(--kb-gray);
    font-size: 1.1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--kb-radius);
    border: 2px dashed var(--kb-border);
}

/* Paginazione */
.kb-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: var(--kb-spacing-lg) 0;
    flex-wrap: wrap;
}

.kb-pagination a,
.kb-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 2px solid var(--kb-border);
    border-radius: var(--kb-radius-sm);
    color: var(--kb-secondary);
    text-decoration: none;
    font-weight: 600;
    min-width: 44px;
    min-height: 44px;
    transition: all 0.3s ease;
}

.kb-pagination a:hover {
    background: var(--kb-primary);
    color: white;
    border-color: var(--kb-primary);
    transform: translateY(-2px);
}

.kb-pagination .current {
    background: var(--kb-primary);
    color: white;
    border-color: var(--kb-primary);
}

/* Fallback robusto: evita testo bianco su fondo bianco se le CSS vars non sono definite */
.kb-pagination .page-numbers {
    color: var(--kb-secondary, #1f2937);
    background: #ffffff;
    border-color: var(--kb-border, #d1d5db);
}

.kb-pagination a.page-numbers:hover {
    background: var(--kb-primary, #2563eb);
    color: #ffffff;
    border-color: var(--kb-primary, #2563eb);
}

.kb-pagination .page-numbers.current {
    background: var(--kb-primary, #2563eb);
    color: #ffffff;
    border-color: var(--kb-primary, #2563eb);
}

/* Risultati di ricerca */
.kb-search-results {
    margin: var(--kb-spacing-lg) 0;
}

.kb-search-highlight {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* Loading states */
.kb-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--kb-spacing-lg);
    color: var(--kb-gray);
}

.kb-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--kb-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Template articolo singolo */
.kb-article-container {
    max-width: 100%;
    margin: 0 auto;
    background: #ffffff;
    border-radius: var(--kb-radius);
    box-shadow: var(--kb-shadow);
    overflow: hidden;
}

.kb-article-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--kb-spacing-lg);
    padding: var(--kb-spacing-lg);
}

@media (min-width: 1024px) {
    .kb-article-main {
        grid-template-columns: 2fr 1fr;
    }
}

.kb-content-section {
    background: #ffffff;
    border-radius: var(--kb-radius);
    padding: var(--kb-spacing-lg);
    border: 2px solid var(--kb-border);
}

.kb-content-body {
    line-height: 1.8;
    color: var(--kb-secondary);
    font-size: 1.1rem;
}

.kb-content-body h1,
.kb-content-body h2,
.kb-content-body h3,
.kb-content-body h4,
.kb-content-body h5,
.kb-content-body h6 {
    color: var(--kb-dark);
    margin: var(--kb-spacing-lg) 0 var(--kb-spacing) 0;
    font-weight: 700;
}

.kb-content-body p {
    margin-bottom: var(--kb-spacing);
}

.kb-content-body ul,
.kb-content-body ol {
    margin-bottom: var(--kb-spacing);
    padding-left: var(--kb-spacing-lg);
}

.kb-content-body li {
    margin-bottom: 8px;
}

.kb-content-body blockquote {
    border-left: 4px solid var(--kb-primary);
    padding-left: var(--kb-spacing);
    margin: var(--kb-spacing-lg) 0;
    font-style: italic;
    color: var(--kb-gray);
    background: #f8f9fa;
    padding: var(--kb-spacing);
    border-radius: 0 var(--kb-radius-sm) var(--kb-radius-sm) 0;
}

.kb-content-body code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--kb-danger);
}

.kb-content-body pre {
    background: #f8f9fa;
    padding: var(--kb-spacing);
    border-radius: var(--kb-radius-sm);
    overflow-x: auto;
    margin: var(--kb-spacing) 0;
    border: 1px solid var(--kb-border);
}

.kb-content-body pre code {
    background: none;
    padding: 0;
    color: var(--kb-dark);
}

/* Dettagli tecnici */
.kb-detail-item {
    display: flex;
    margin-bottom: var(--kb-spacing);
    padding: var(--kb-spacing);
    background: #f8f9fa;
    border-radius: var(--kb-radius-sm);
    border-left: 4px solid var(--kb-primary);
}

.kb-detail-item strong {
    min-width: 120px;
    color: var(--kb-dark);
    font-weight: 600;
    margin-right: var(--kb-spacing);
}

.kb-detail-item span {
    color: var(--kb-secondary);
    flex: 1;
}

/* Soluzione passo-passo */
.kb-solution-steps {
    background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
    border: 2px solid #9ae6b4;
    border-radius: var(--kb-radius);
    padding: var(--kb-spacing-lg);
    margin: var(--kb-spacing-lg) 0;
}

.kb-solution-steps h3 {
    color: #22543d;
    margin: 0 0 var(--kb-spacing) 0;
    font-size: 1.25rem;
}

.kb-solution-steps ol {
    margin: 0;
    padding-left: var(--kb-spacing-lg);
    color: #22543d;
}

.kb-solution-steps li {
    margin-bottom: var(--kb-spacing);
    line-height: 1.6;
}

/* Sidebar */
.kb-article-sidebar {
    background: #f8f9fa;
    border-radius: var(--kb-radius);
    padding: var(--kb-spacing-lg);
    border: 2px solid var(--kb-border);
    height: fit-content;
}

.kb-article-sidebar h3 {
    color: var(--kb-dark);
    margin: 0 0 var(--kb-spacing) 0;
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: var(--kb-spacing);
    border-bottom: 2px solid var(--kb-border);
}

.kb-article-sidebar .kb-status-badge,
.kb-article-sidebar .kb-priority-badge {
    display: block;
    margin-bottom: var(--kb-spacing);
    text-align: center;
}

/* Azioni articolo */
.kb-actions {
    display: flex;
    gap: var(--kb-spacing);
    margin: var(--kb-spacing-lg) 0;
    flex-wrap: wrap;
}

.kb-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--kb-radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-height: 44px;
    border: none;
    cursor: pointer;
}

.kb-action-btn:hover {
    background: linear-gradient(135deg, var(--kb-primary-dark) 0%, #4c51bf 100%);
    transform: translateY(-2px);
    box-shadow: var(--kb-shadow);
    color: white;
}

.kb-action-btn-secondary {
    background: linear-gradient(135deg, var(--kb-secondary) 0%, #2d3748 100%);
}

.kb-action-btn-secondary:hover {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: white;
}

/* Statistiche */
.kb-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--kb-spacing);
    margin: var(--kb-spacing-lg) 0;
}

.kb-stat-item {
    text-align: center;
    padding: var(--kb-spacing);
    background: white;
    border-radius: var(--kb-radius-sm);
    border: 2px solid var(--kb-border);
}

.kb-stat-item .number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--kb-primary);
    margin-bottom: 4px;
}

.kb-stat-item .label {
    font-size: 0.85rem;
    color: var(--kb-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Articoli correlati */
.kb-related-articles {
    margin: var(--kb-spacing-lg) 0;
}

.kb-related-articles h3 {
    color: var(--kb-dark);
    margin: 0 0 var(--kb-spacing) 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.kb-related-articles ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kb-related-articles li {
    margin-bottom: var(--kb-spacing);
    padding: var(--kb-spacing);
    background: #f8f9fa;
    border-radius: var(--kb-radius-sm);
    border-left: 4px solid var(--kb-primary);
    transition: all 0.3s ease;
}

.kb-related-articles li:hover {
    background: #e3f2fd;
    transform: translateX(4px);
}

.kb-related-articles a {
    color: var(--kb-dark);
    text-decoration: none;
    font-weight: 600;
}

.kb-related-articles a:hover {
    color: var(--kb-primary);
}

/* Informazioni avanzate */
.kb-advanced-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--kb-radius);
    padding: var(--kb-spacing-lg);
    margin: var(--kb-spacing-lg) 0;
    border: 2px solid var(--kb-border);
}

.kb-advanced-info h3 {
    color: var(--kb-dark);
    margin: 0 0 var(--kb-spacing) 0;
    font-size: 1.25rem;
    font-weight: 600;
    padding-bottom: var(--kb-spacing);
    border-bottom: 2px solid var(--kb-border);
}

.kb-info-row {
    display: flex;
    margin-bottom: var(--kb-spacing);
    padding: var(--kb-spacing);
    background: white;
    border-radius: var(--kb-radius-sm);
    border-left: 4px solid var(--kb-primary);
    flex-wrap: wrap;
    gap: var(--kb-spacing);
}

.kb-info-row strong {
    min-width: 150px;
    color: var(--kb-dark);
    font-weight: 600;
    flex-shrink: 0;
}

.kb-info-row span {
    color: var(--kb-secondary);
    flex: 1;
    min-width: 200px;
}

/* Badge versione e difficoltà */
.kb-version-badge {
    background: linear-gradient(135deg, var(--kb-info) 0%, #3182ce 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kb-difficulty-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kb-difficulty-beginner {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.kb-difficulty-intermediate {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.kb-difficulty-advanced {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.kb-difficulty-expert {
    background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%);
    color: white;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    .kb-frontend {
        padding: var(--kb-spacing);
        margin: var(--kb-spacing);
    }

    /* Archivio KB: hero — bottoni Crea / Vai alla ricerca e metriche compatte */
    .kb-knowledge-archive .kb-hero {
        padding: clamp(16px, 5vw, 28px);
        gap: 16px;
    }
    .kb-knowledge-archive .kb-hero-title {
        font-size: clamp(1.45rem, 6vw, 2rem);
    }
    .kb-knowledge-archive .kb-hero-subtitle {
        font-size: 0.95rem;
        line-height: 1.55;
    }
    .kb-knowledge-archive .kb-hero-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .kb-knowledge-archive .kb-metric-card {
        padding: 12px;
        min-width: 0;
    }
    .kb-knowledge-archive .kb-metric-value {
        font-size: clamp(1.25rem, 5vw, 1.65rem);
    }
    .kb-knowledge-archive .kb-metric-label,
    .kb-knowledge-archive .kb-metric-meta {
        font-size: 0.72rem;
    }
    .kb-knowledge-archive .kb-hero-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 10px;
    }
    .kb-knowledge-archive .kb-action-primary,
    .kb-knowledge-archive .kb-action-secondary {
        width: 100%;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
        min-height: 48px;
        padding: 14px 16px;
    }
    .kb-knowledge-archive .kb-dark-toggle-wrap {
        width: 100%;
        margin-top: 4px;
    }
    .kb-knowledge-archive .kb-dark-toggle {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
        min-height: 46px;
    }
    .kb-knowledge-archive .kb-search-section {
        padding: 16px;
    }
    .kb-knowledge-archive .kb-section-header h2 {
        font-size: 1.15rem;
    }
    .kb-knowledge-archive .kb-section-header p {
        font-size: 0.88rem;
    }
    /* Evita zoom automatico su focus (iOS) */
    .kb-knowledge-archive .kb-search-input {
        font-size: 16px;
    }
    
    .kb-header {
        margin: calc(-1 * var(--kb-spacing)) calc(-1 * var(--kb-spacing)) var(--kb-spacing) calc(-1 * var(--kb-spacing));
        padding: var(--kb-spacing);
    }
    
    .kb-header h1 {
        font-size: 1.5rem;
    }
    
    .kb-nav {
        flex-direction: column;
        gap: var(--kb-spacing);
    }
    
    .kb-nav-button {
        width: 100%;
        justify-content: center;
    }
    
    .kb-nav-buttons {
        flex-direction: column;
        gap: var(--kb-spacing);
    }
    
    .kb-nav-buttons .kb-nav-button {
        width: 100%;
        justify-content: center;
    }
    
    .kb-search-form {
        flex-direction: column;
        gap: var(--kb-spacing);
    }
    
    .kb-search-input {
        min-width: 100%;
    }
    
    .kb-search-button {
        width: 100%;
    }
    
    .kb-filters {
        flex-direction: column;
        gap: var(--kb-spacing);
    }
    
    .kb-filter-select {
        min-width: 100%;
    }
    
    .kb-articles-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .kb-article-card {
        margin-bottom: 0;
    }

    .kb-card-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .kb-card-meta {
        justify-content: center;
    }

    .kb-read-more {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
    
    .kb-article-main {
        grid-template-columns: 1fr;
        gap: var(--kb-spacing);
        padding: var(--kb-spacing);
    }
    
    .kb-content-section {
        padding: var(--kb-spacing);
    }
    
    .kb-article-sidebar {
        padding: var(--kb-spacing);
    }
    
    .kb-actions {
        flex-direction: column;
    }
    
    .kb-action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .kb-stats {
        grid-template-columns: 1fr;
        gap: var(--kb-spacing);
    }
    
    .kb-info-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .kb-info-row strong {
        min-width: auto;
    }
    
    .kb-info-row span {
        min-width: auto;
    }
    
    .kb-pagination {
        gap: 4px;
    }
    
    .kb-pagination a,
    .kb-pagination span {
        min-width: 40px;
        min-height: 40px;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* Utility classes */
.kb-text-center { text-align: center; }
.kb-text-left { text-align: left; }
.kb-text-right { text-align: right; }
.kb-mb-0 { margin-bottom: 0; }
.kb-mb-1 { margin-bottom: var(--kb-spacing); }
.kb-mb-2 { margin-bottom: var(--kb-spacing-lg); }
.kb-mt-0 { margin-top: 0; }
.kb-mt-1 { margin-top: var(--kb-spacing); }
.kb-mt-2 { margin-top: var(--kb-spacing-lg); }
.kb-hidden { display: none; }
.kb-visible { display: block; }

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.kb-article-card {
    animation: fadeIn 0.4s ease-out;
}

/* Focus states per accessibilità */
.kb-nav-button:focus,
.kb-search-button:focus,
.kb-action-btn:focus,
.kb-read-more:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Modal di Condivisione */
.kb-share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kb-share-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.kb-share-modal-content {
    position: relative;
    background: white;
    border-radius: var(--kb-radius);
    box-shadow: var(--kb-shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: kb-modal-slide-in 0.3s ease-out;
}

@keyframes kb-modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.kb-share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--kb-spacing-lg);
    border-bottom: 2px solid var(--kb-border);
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: white;
    border-radius: var(--kb-radius) var(--kb-radius) 0 0;
}

.kb-share-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.kb-share-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.kb-share-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.kb-share-modal-body {
    padding: var(--kb-spacing-lg);
}

.kb-share-article-info {
    margin-bottom: var(--kb-spacing-lg);
    padding: var(--kb-spacing);
    background: #f8f9fa;
    border-radius: var(--kb-radius-sm);
    border-left: 4px solid var(--kb-primary);
}

.kb-share-article-info h4 {
    margin: 0 0 var(--kb-spacing) 0;
    color: var(--kb-dark);
    font-size: 1.1rem;
    font-weight: 600;
}

.kb-share-article-info p {
    margin: 0 0 var(--kb-spacing) 0;
    color: var(--kb-gray);
    font-size: 0.9rem;
    line-height: 1.5;
}

.kb-share-url {
    display: flex;
    gap: var(--kb-spacing);
    align-items: center;
}

.kb-share-url input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--kb-border);
    border-radius: var(--kb-radius-sm);
    font-size: 0.9rem;
    background: white;
}

.kb-copy-url-btn {
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: var(--kb-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
}

.kb-copy-url-btn:hover {
    background: linear-gradient(135deg, var(--kb-primary-dark) 0%, #4c51bf 100%);
    transform: translateY(-1px);
}

.kb-share-options h4 {
    margin: 0 0 var(--kb-spacing) 0;
    color: var(--kb-dark);
    font-size: 1rem;
    font-weight: 600;
}

.kb-share-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--kb-spacing);
}

@media (min-width: 480px) {
    .kb-share-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .kb-share-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
}

.kb-share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: var(--kb-spacing);
    background: white;
    border: 2px solid var(--kb-border);
    border-radius: var(--kb-radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 80px;
    text-decoration: none;
    color: var(--kb-dark);
}

.kb-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--kb-shadow);
    border-color: var(--kb-primary);
}

.kb-share-icon {
    font-size: 1.5rem;
}

.kb-share-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

/* Colori specifici per le piattaforme */
.kb-share-whatsapp:hover {
    background: #25d366;
    color: white;
    border-color: #25d366;
}

.kb-share-email:hover {
    background: #ea4335;
    color: white;
    border-color: #ea4335;
}

.kb-share-sms:hover {
    background: #34a853;
    color: white;
    border-color: #34a853;
}

.kb-share-facebook:hover {
    background: #1877f2;
    color: white;
    border-color: #1877f2;
}

.kb-share-twitter:hover {
    background: #1da1f2;
    color: white;
    border-color: #1da1f2;
}

.kb-share-linkedin:hover {
    background: #0077b5;
    color: white;
    border-color: #0077b5;
}

.kb-share-telegram:hover {
    background: #0088cc;
    color: white;
    border-color: #0088cc;
}

.kb-share-native:hover {
    background: var(--kb-primary);
    color: white;
    border-color: var(--kb-primary);
}

/* Blocco scroll quando il modal è aperto */
body.kb-modal-open {
    overflow: hidden;
}

/* Responsive per mobile */
@media (max-width: 768px) {
    .kb-share-modal-content {
        width: 95%;
        max-height: 90vh;
        margin: var(--kb-spacing);
    }
    
    .kb-share-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--kb-spacing);
    }
    
    .kb-share-btn {
        min-height: 70px;
        padding: var(--kb-spacing);
    }
    
    .kb-share-icon {
        font-size: 1.25rem;
    }
    
    .kb-share-label {
        font-size: 0.75rem;
    }
}

/* Pagina Creazione Articolo KB */
.kb-create-article {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: var(--kb-radius);
    box-shadow: var(--kb-shadow);
    overflow: hidden;
}

.kb-create-header {
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: white !important;
    padding: var(--kb-spacing-lg);
    text-align: center;
}

.kb-create-header h2 {
    margin: 0 0 var(--kb-spacing) 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.kb-create-header p {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

.kb-create-form {
    padding: var(--kb-spacing-lg);
}

.kb-form-section {
    margin-bottom: var(--kb-spacing-lg);
    padding: var(--kb-spacing-lg);
    background: #f8f9fa;
    border-radius: var(--kb-radius);
    border-left: 4px solid var(--kb-primary);
}

.kb-form-section h3 {
    margin: 0 0 var(--kb-spacing-lg) 0;
    color: var(--kb-dark);
    font-size: 1.25rem;
    font-weight: 600;
    padding-bottom: var(--kb-spacing);
    border-bottom: 2px solid var(--kb-border);
}

.kb-form-row {
    display: flex;
    gap: var(--kb-spacing);
    margin-bottom: var(--kb-spacing);
    flex-wrap: wrap;
}

.kb-form-field-full {
    flex: 1;
    min-width: 100%;
}

.kb-form-field-half {
    flex: 1;
    min-width: 300px;
}

.kb-form-field-full label,
.kb-form-field-half label {
    display: block;
    margin-bottom: 8px;
    color: var(--kb-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

.kb-form-field-full input,
.kb-form-field-half input,
.kb-form-field-full textarea,
.kb-form-field-half textarea,
.kb-form-field-full select,
.kb-form-field-half select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--kb-border);
    border-radius: var(--kb-radius-sm);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.kb-form-field-full input:focus,
.kb-form-field-half input:focus,
.kb-form-field-full textarea:focus,
.kb-form-field-half textarea:focus,
.kb-form-field-full select:focus,
.kb-form-field-half select:focus {
    outline: none;
    border-color: var(--kb-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.kb-form-field-full textarea,
.kb-form-field-half textarea {
    resize: vertical;
    min-height: 100px;
}

.kb-content-editor {
    position: relative;
}

.kb-content-editor textarea {
    min-height: 200px;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
}

.kb-form-field-full input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    transform: scale(1.2);
}

.kb-form-actions {
    display: flex;
    gap: var(--kb-spacing);
    justify-content: center;
    flex-wrap: wrap;
    padding: var(--kb-spacing-lg);
    background: #f8f9fa;
    border-radius: var(--kb-radius);
    border-top: 2px solid var(--kb-border);
}

.kb-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--kb-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 48px;
    justify-content: center;
}

.kb-button-primary {
    background: linear-gradient(135deg, var(--kb-primary) 0%, var(--kb-primary-dark) 100%);
    color: white;
}

.kb-button-primary:hover {
    background: linear-gradient(135deg, var(--kb-primary-dark) 0%, #4c51bf 100%);
    transform: translateY(-2px);
    box-shadow: var(--kb-shadow);
    color: white;
}

.kb-button-secondary {
    background: linear-gradient(135deg, var(--kb-secondary) 0%, #2d3748 100%);
    color: white;
}

.kb-button-secondary:hover {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    transform: translateY(-2px);
    box-shadow: var(--kb-shadow);
    color: white;
}

.kb-button-outline {
    background: transparent;
    color: var(--kb-primary);
    border: 2px solid var(--kb-primary);
}

.kb-button-outline:hover {
    background: var(--kb-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--kb-shadow);
}

.kb-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.kb-button-icon {
    font-size: 1.1rem;
}

.kb-button-text {
    font-weight: 600;
}

/* Responsive per mobile */
@media (max-width: 768px) {
    .kb-create-form {
        padding: var(--kb-spacing);
    }
    
    .kb-form-section {
        padding: var(--kb-spacing);
        margin-bottom: var(--kb-spacing);
    }
    
    .kb-form-row {
        flex-direction: column;
        gap: var(--kb-spacing);
    }
    
    .kb-form-field-half {
        min-width: 100%;
    }
    
    .kb-form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .kb-button {
        width: 100%;
        justify-content: center;
    }
    
    .kb-create-header h2 {
        font-size: 1.5rem;
    }
    
    .kb-create-header p {
        font-size: 1rem;
    }
}

/* ========================================
   PAGINA DOCUMENTO SINGOLO - Layout Professionale
   ======================================== */

/* Topbar di navigazione */
.kb-doc-topbar {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: var(--kb-spacing);
    border-bottom: 1px solid var(--kb-border);
    visibility: visible !important;
}

.kb-doc-topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--kb-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.kb-doc-topbar-link:hover { color: var(--kb-primary-dark); }

.kb-doc-topbar-right {
    display: flex !important;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.kb-doc-topbar-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: 1px solid var(--kb-border) !important;
    border-radius: 6px;
    background: #fff !important;
    cursor: pointer;
    font-size: 0.85rem !important;
    font-weight: 500;
    color: var(--kb-secondary) !important;
    transition: all 0.2s;
    visibility: visible !important;
    opacity: 1 !important;
    text-decoration: none !important;
    line-height: 1.2 !important;
}
.kb-doc-topbar-btn .dashicons,
.kb-doc-topbar-btn span.dashicons {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: inherit !important;
}

.kb-doc-topbar-btn:hover {
    border-color: var(--kb-primary) !important;
    color: var(--kb-primary) !important;
    background: rgba(102,126,234,0.05) !important;
}

.kb-doc-topbar-btn-share {
    background: var(--kb-primary) !important;
    color: #fff !important;
    border-color: var(--kb-primary) !important;
}

.kb-doc-topbar-btn-share:hover {
    background: var(--kb-primary-dark) !important;
    color: #fff !important;
}

/* PDF Button */
#kb-download-pdf {
    background: #dc2626 !important;
    color: #fff !important;
    border-color: #dc2626 !important;
    font-weight: 600;
    display: inline-flex !important;
    visibility: visible !important;
}
#kb-download-pdf:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
    color: #fff !important;
}
#kb-download-pdf:disabled {
    opacity: 0.7;
    cursor: wait;
}

@keyframes kb-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.kb-spin {
    animation: kb-spin 1s linear infinite;
    display: inline-block;
}

/* Header Documento */
.kb-doc-header {
    padding: clamp(24px, 4vw, 48px);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #312e81 100%) !important;
    color: #fff !important;
    border-radius: var(--kb-radius);
    margin-bottom: var(--kb-spacing-lg);
}

.kb-doc-header,
.kb-doc-header h1,
.kb-doc-header h2,
.kb-doc-header h3,
.kb-doc-header h4,
.kb-doc-header h5,
.kb-doc-header h6,
.kb-doc-header p,
.kb-doc-header span,
.kb-doc-header a,
.kb-doc-header div {
    color: #fff !important;
}

.kb-doc-id {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 12px;
    backdrop-filter: blur(4px);
}

.kb-doc-title {
    margin: 0 0 12px;
    font-size: clamp(1.75rem, 4vw, 2.5rem) !important;
    font-weight: 800 !important;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #fff !important;
}

.kb-doc-abstract {
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.8) !important;
    margin: 0 0 var(--kb-spacing-lg);
    max-width: 700px;
}

.kb-doc-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kb-spacing-lg);
    padding-top: var(--kb-spacing);
    border-top: 1px solid rgba(255,255,255,0.15);
    margin-bottom: var(--kb-spacing);
}

.kb-doc-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kb-doc-meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.5) !important;
}

.kb-doc-meta-value {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff !important;
}

/* Badges */
.kb-doc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kb-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.kb-badge-status-confirmed { background: #22c55e; color: #fff; }
.kb-badge-status-partial   { background: #f59e0b; color: #fff; }
.kb-badge-status-obsolete  { background: #ef4444; color: #fff; }

.kb-badge-priority-critical { background: #dc2626; color: #fff; }
.kb-badge-priority-high    { background: #f97316; color: #fff; }
.kb-badge-priority-medium  { background: #3b82f6; color: #fff; }
.kb-badge-priority-low     { background: #10b981; color: #fff; }

.kb-badge-difficulty { background: rgba(255,255,255,0.15); color: #fff; }
.kb-badge-category   { background: rgba(255,255,255,0.15); color: #fff; transition: background 0.2s; }
.kb-badge-category:hover { background: rgba(255,255,255,0.3); color: #fff; }

/* Body: Sidebar + Content */
.kb-doc-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--kb-spacing-lg);
}

@media (min-width: 1024px) {
    .kb-doc-body {
        grid-template-columns: 240px 1fr;
    }
}

/* Sidebar / TOC */
.kb-doc-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .kb-doc-sidebar {
        display: block;
    }
}

.kb-doc-sidebar-inner {
    position: sticky;
    top: 80px;
}

.kb-doc-toc {
    margin-bottom: var(--kb-spacing-lg);
}

.kb-doc-toc-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--kb-gray);
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--kb-border);
}

.kb-doc-toc-nav {
    display: flex;
    flex-direction: column;
}

.kb-toc-link {
    display: block;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: var(--kb-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s;
    line-height: 1.4;
}

.kb-toc-link:hover {
    color: var(--kb-primary);
    background: rgba(102,126,234,0.05);
}

.kb-toc-link.active {
    color: var(--kb-primary);
    border-left-color: var(--kb-primary);
    font-weight: 600;
    background: rgba(102,126,234,0.05);
}

.kb-doc-sidebar-section {
    margin-bottom: var(--kb-spacing-lg);
}

.kb-doc-sidebar-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--kb-gray);
    margin: 0 0 8px;
}

.kb-doc-sidebar-section p {
    font-size: 0.9rem;
    color: var(--kb-secondary);
    margin: 0;
    line-height: 1.5;
}

.kb-doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.kb-doc-tag {
    padding: 3px 10px;
    background: var(--kb-light);
    border: 1px solid var(--kb-border);
    border-radius: 12px;
    font-size: 0.78rem;
    color: var(--kb-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.kb-doc-tag:hover {
    border-color: var(--kb-primary);
    color: var(--kb-primary);
}

/* Contenuto principale - Sezioni */
.kb-doc-content {
    min-width: 0;
}

.kb-doc-section {
    margin-bottom: var(--kb-spacing-lg);
    padding: var(--kb-spacing-lg);
    background: #fff;
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius);
}

.kb-doc-section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--kb-dark);
    margin: 0 0 var(--kb-spacing);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--kb-border);
}

.kb-doc-section-solution {
    border-left: 4px solid var(--kb-success);
    background: linear-gradient(135deg, #f0fdf4, #fff);
}

.kb-doc-section-solution .kb-doc-section-title {
    color: #166534;
}

/* Prose - Contenuto formattato */
.kb-doc-prose {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--kb-secondary);
}

.kb-doc-prose h1,
.kb-doc-prose h2,
.kb-doc-prose h3,
.kb-doc-prose h4 {
    color: var(--kb-dark);
    margin: var(--kb-spacing-lg) 0 var(--kb-spacing);
    font-weight: 700;
    line-height: 1.3;
}

.kb-doc-prose h2 { font-size: 1.4rem; }
.kb-doc-prose h3 { font-size: 1.2rem; }
.kb-doc-prose h4 { font-size: 1.05rem; }

.kb-doc-prose p { margin-bottom: var(--kb-spacing); }

.kb-doc-prose ul, .kb-doc-prose ol {
    padding-left: var(--kb-spacing-lg);
    margin-bottom: var(--kb-spacing);
}

.kb-doc-prose li { margin-bottom: 6px; }

.kb-doc-prose img {
    max-width: 100%;
    height: auto;
    border-radius: var(--kb-radius-sm);
    border: 1px solid var(--kb-border);
    margin: var(--kb-spacing) 0;
}

.kb-doc-prose blockquote {
    border-left: 4px solid var(--kb-primary);
    padding: var(--kb-spacing);
    margin: var(--kb-spacing) 0;
    background: #f8fafc;
    border-radius: 0 var(--kb-radius-sm) var(--kb-radius-sm) 0;
    color: var(--kb-gray);
    font-style: italic;
}

.kb-doc-prose pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: var(--kb-spacing);
    border-radius: var(--kb-radius-sm);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: var(--kb-spacing) 0;
}

.kb-doc-prose code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    color: #dc2626;
}

.kb-doc-prose pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.kb-doc-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--kb-spacing) 0;
    font-size: 0.95rem;
}

.kb-doc-prose table th,
.kb-doc-prose table td {
    padding: 10px 14px;
    border: 1px solid var(--kb-border);
    text-align: left;
}

.kb-doc-prose table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--kb-dark);
}

.kb-doc-prose table tr:nth-child(even) td {
    background: #fafbfc;
}

.kb-doc-note-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--kb-radius-sm);
    padding: var(--kb-spacing);
}

/* Allegati */
.kb-doc-attachments {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kb-doc-attachment {
    display: flex;
    align-items: center;
    gap: var(--kb-spacing);
    padding: 14px var(--kb-spacing);
    background: #f8fafc;
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius-sm);
    text-decoration: none;
    color: var(--kb-dark);
    transition: all 0.2s;
}

.kb-doc-attachment:hover {
    border-color: var(--kb-primary);
    background: rgba(102,126,234,0.04);
    transform: translateX(4px);
}

.kb-doc-attachment-icon {
    width: 44px;
    height: 44px;
    background: var(--kb-primary);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kb-doc-attachment-ext {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.kb-doc-attachment-info {
    flex: 1;
    min-width: 0;
}

.kb-doc-attachment-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kb-doc-attachment-meta {
    display: block;
    font-size: 0.8rem;
    color: var(--kb-gray);
}

.kb-doc-attachment-dl {
    color: var(--kb-primary);
    font-size: 1.2rem;
}

/* Feedback */
.kb-doc-feedback {
    padding: var(--kb-spacing-lg);
    background: #f8fafc;
    border-radius: var(--kb-radius);
    border: 1px solid var(--kb-border);
    margin-bottom: var(--kb-spacing-lg);
}

/* Statistiche Feedback */
.kb-feedback-stats {
    margin-bottom: 20px;
}

.kb-feedback-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.kb-feedback-stats-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--kb-dark);
    margin: 0;
}

.kb-feedback-stats-total {
    font-size: 0.85rem;
    color: var(--kb-secondary);
    font-weight: 500;
}

/* Barra progresso feedback */
.kb-feedback-bar-container {
    margin-bottom: 14px;
}

.kb-feedback-bar {
    display: flex;
    height: 10px;
    border-radius: 10px;
    overflow: hidden;
    background: #e2e8f0;
}

.kb-feedback-bar-fill {
    transition: width 0.6s ease;
    min-width: 2px;
}

.kb-feedback-bar-yes {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.kb-feedback-bar-no {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.kb-feedback-bar-empty {
    background: #e2e8f0;
}

.kb-feedback-empty-text {
    text-align: center;
    font-size: 0.82rem;
    color: #94a3b8;
    margin: 8px 0 0;
    font-style: italic;
}

/* Contatori feedback */
.kb-feedback-counts {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.kb-feedback-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--kb-secondary);
}

.kb-feedback-count .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.kb-feedback-count-yes .dashicons { color: #22c55e; }
.kb-feedback-count-no .dashicons  { color: #ef4444; }

.kb-feedback-count-label {
    font-size: 0.82rem;
    color: #94a3b8;
}

.kb-feedback-count-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.kb-feedback-count-yes .kb-feedback-count-value { color: #16a34a; }
.kb-feedback-count-no .kb-feedback-count-value  { color: #dc2626; }

.kb-feedback-count-pct {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.kb-feedback-pct-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--kb-primary);
    line-height: 1;
}

.kb-feedback-count-pct .kb-feedback-count-label {
    font-size: 0.75rem;
}

/* Sezione Vota */
.kb-feedback-vote {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--kb-border);
}

.kb-doc-feedback-question {
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--kb-dark);
}

.kb-doc-feedback-buttons {
    display: flex;
    justify-content: center;
    gap: var(--kb-spacing);
}

.kb-doc-feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 2px solid var(--kb-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--kb-secondary);
}

.kb-doc-feedback-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.kb-doc-feedback-yes:hover:not(:disabled) { border-color: #22c55e; color: #166534; background: #f0fdf4; }
.kb-doc-feedback-no:hover:not(:disabled)  { border-color: #ef4444; color: #991b1b; background: #fef2f2; }

.kb-doc-feedback-btn.kb-feedback-btn-selected.kb-doc-feedback-yes {
    border-color: #22c55e;
    color: #166534;
    background: #dcfce7;
}

.kb-doc-feedback-btn.kb-feedback-btn-selected.kb-doc-feedback-no {
    border-color: #ef4444;
    color: #991b1b;
    background: #fee2e2;
}

.kb-doc-feedback-thanks {
    color: var(--kb-success);
    font-weight: 600;
}

/* Footer documento */
.kb-doc-footer {
    padding: var(--kb-spacing);
    border-top: 1px solid var(--kb-border);
    text-align: center;
}

.kb-doc-footer p {
    font-size: 0.8rem;
    color: var(--kb-gray);
    margin: 0;
}

/* Panel Condivisione */
.kb-share-panel {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kb-share-panel-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.kb-share-panel-content {
    position: relative;
    background: #fff;
    border-radius: var(--kb-radius);
    box-shadow: var(--kb-shadow-lg);
    max-width: 480px;
    width: 90%;
    overflow: hidden;
    animation: kb-modal-slide-in 0.25s ease;
}

.kb-share-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--kb-spacing) var(--kb-spacing-lg);
    border-bottom: 1px solid var(--kb-border);
}

.kb-share-panel-header h3 { margin: 0; font-size: 1.1rem; }

.kb-share-panel-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--kb-gray);
    padding: 0;
    line-height: 1;
}

.kb-share-panel-body { padding: var(--kb-spacing-lg); }

.kb-share-url-box {
    display: flex;
    gap: 8px;
    margin-bottom: var(--kb-spacing);
}

.kb-share-url-box input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--kb-border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: #f8fafc;
}

.kb-share-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.kb-share-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    border: 1px solid var(--kb-border);
    border-radius: 8px;
    text-decoration: none;
    color: #fff;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.kb-share-item:hover { transform: translateY(-2px); box-shadow: var(--kb-shadow); }

.kb-share-item.kb-share-whatsapp { background: #25d366; border-color: #25d366; }
.kb-share-item.kb-share-email    { background: #ea4335; border-color: #ea4335; }
.kb-share-item.kb-share-telegram { background: #0088cc; border-color: #0088cc; }
.kb-share-item.kb-share-linkedin { background: #0077b5; border-color: #0077b5; }

/* ========================================
   PAGINA CREAZIONE - Layout Professionale
   ======================================== */

.kb-create-page {
    max-width: 1280px;
}

.kb-create-hero {
    position: relative;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #312e81 100%);
    color: #fff;
    padding: clamp(24px, 4vw, 40px);
    border-radius: var(--kb-radius);
    margin-bottom: var(--kb-spacing-lg);
}

.kb-hero-back-home {
    position: absolute;
    top: clamp(24px, 4vw, 40px);
    right: clamp(24px, 4vw, 40px);
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.25);
    transition: background 0.2s, border-color 0.2s;
}

.kb-hero-back-home:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    color: #fff;
}

.kb-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.kb-breadcrumb a { color: rgba(255,255,255,0.7); text-decoration: none; }
.kb-breadcrumb a:hover { color: #fff; }
.kb-breadcrumb-sep { color: rgba(255,255,255,0.3); }
.kb-breadcrumb span:last-child { color: rgba(255,255,255,0.5); }

.kb-create-hero-title {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
}

.kb-create-hero-subtitle {
    margin: 0;
    font-size: 1rem;
    color: rgba(255,255,255,0.7);
    max-width: 600px;
}

/* Layout 2 colonne */
.kb-create-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--kb-spacing-lg);
    min-width: 0;
}
.kb-create-layout > * {
    min-width: 0;
}

@media (min-width: 1024px) {
    .kb-create-layout {
        grid-template-columns: 1fr 380px;
    }
}

/* Card form */
.kb-form-card {
    background: #fff;
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius);
    margin-bottom: var(--kb-spacing);
    overflow: hidden;
}

.kb-form-card-header {
    padding: var(--kb-spacing) var(--kb-spacing-lg);
    border-bottom: 1px solid var(--kb-border);
    background: #fafbfc;
}

.kb-form-card-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--kb-dark);
}

.kb-form-card-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--kb-gray);
    margin-top: 2px;
}

.kb-form-card-body {
    padding: var(--kb-spacing-lg);
}

.kb-form-card-sticky {
    position: sticky;
    top: 40px;
    z-index: 10;
}

/* Sidebar creazione: evita che input/select forzino larghezza colonna */
.kb-create-sidebar .kb-field {
    min-width: 0;
}
.kb-create-sidebar .kb-input,
.kb-create-sidebar .kb-select,
.kb-create-sidebar .kb-textarea {
    max-width: 100%;
    min-width: 0;
}

/* Campi form */
.kb-field {
    margin-bottom: var(--kb-spacing);
}

.kb-field:last-child { margin-bottom: 0; }

.kb-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--kb-dark);
    margin-bottom: 6px;
}

.kb-required { color: #dc2626; }

.kb-field-help {
    font-size: 0.8rem;
    color: var(--kb-gray);
    margin: 4px 0 8px;
    line-height: 1.4;
}

.kb-input, .kb-textarea, .kb-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--kb-border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: var(--kb-dark);
}

.kb-input:focus, .kb-textarea:focus, .kb-select:focus {
    outline: none;
    border-color: var(--kb-primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}

/* Selettori visibilità (multi): contenuti nella colonna, testi lunghi gestiti */
#kb_visible_user_ids,
#kb_visible_company_ids {
    font-size: 0.86rem;
    line-height: 1.25;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
}

#kb_visible_user_ids option,
#kb_visible_company_ids option {
    font-size: 0.84rem;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Multi-tools sotto i select: va a capo su schermi stretti */
.kb-create-sidebar .kb-multi-tools {
    flex-wrap: wrap;
}
.kb-create-sidebar .kb-multi-tools .kb-btn {
    flex: 1 1 auto;
    min-width: min(100%, 140px);
}

.kb-input-lg {
    padding: 14px 16px;
    font-size: 1.1rem;
    font-weight: 600;
}

.kb-textarea { resize: vertical; min-height: 60px; }

.kb-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}
.kb-checkbox-label > span {
    min-width: 0;
    flex: 1;
    line-height: 1.4;
}

.kb-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--kb-primary);
}

/* Bottoni */
.kb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.kb-btn-primary {
    background: var(--kb-primary);
    color: #fff;
    border-color: var(--kb-primary);
}

.kb-btn-primary:hover {
    background: var(--kb-primary-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.kb-btn-outline {
    background: transparent;
    color: var(--kb-primary);
    border-color: var(--kb-border);
}

.kb-btn-outline:hover {
    border-color: var(--kb-primary);
    background: rgba(102,126,234,0.05);
}

.kb-btn-ghost {
    background: transparent;
    color: var(--kb-gray);
    border-color: transparent;
}

.kb-btn-ghost:hover { color: var(--kb-dark); }

.kb-btn-block { width: 100%; }
.kb-btn-lg { padding: 14px 24px; font-size: 1rem; }
.kb-btn-sm { padding: 6px 14px; font-size: 0.85rem; }

.kb-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Publish actions */
.kb-publish-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: var(--kb-spacing);
}

/* Allegati nella form */
.kb-attachments-zone {
    padding: var(--kb-spacing);
    border: 2px dashed var(--kb-border);
    border-radius: var(--kb-radius-sm);
    background: #fafbfc;
}

.kb-attachments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: var(--kb-spacing);
}

.kb-attachments-list:empty { margin-bottom: 0; }

.kb-attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--kb-border);
    border-radius: 8px;
}

.kb-attachment-icon { color: var(--kb-primary); }

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

.kb-attachment-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kb-attachment-filename {
    display: block;
    font-size: 0.78rem;
    color: var(--kb-gray);
}

.kb-attachment-size {
    font-size: 0.75rem;
    color: var(--kb-gray);
}

.kb-attachment-remove {
    background: none;
    border: none;
    color: var(--kb-gray);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.kb-attachment-remove:hover { color: #dc2626; }

/* Toast notification */
.kb-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 99999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: none;
}

.kb-toast-success { background: #16a34a; }
.kb-toast-error   { background: #dc2626; }

/* Editor wrapper - limita lo stile interno */
.kb-editor-wrapper .wp-editor-wrap {
    border: 1px solid var(--kb-border);
    border-radius: 8px;
    overflow: hidden;
}

.kb-editor-wrapper .wp-editor-tabs {
    padding: 4px 4px 0;
}

/* ========================================
   PRINT STYLES - Versione stampabile professionale
   ======================================== */
@media print {
    body { background: #fff !important; }
    
    .kb-doc-topbar,
    .kb-doc-sidebar,
    .kb-doc-feedback,
    .kb-share-panel,
    .kb-nav-buttons,
    .kb-nav,
    .kb-search-section,
    .kb-actions,
    .kb-article-sidebar,
    .kb-share-modal,
    .kb-form-actions,
    .kb-toast,
    #wpadminbar {
        display: none !important;
    }
    
    .kb-frontend, .kb-doc {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    .kb-doc-header {
        background: none !important;
        color: #000 !important;
        padding: 20px 0 !important;
        border-bottom: 2px solid #000;
        border-radius: 0 !important;
    }
    
    .kb-doc-header * { color: #000 !important; }
    
    .kb-doc-id {
        background: #eee !important;
        color: #000 !important;
    }
    
    .kb-badge {
        background: #eee !important;
        color: #000 !important;
        border: 1px solid #999 !important;
    }
    
    .kb-doc-body {
        display: block !important;
    }
    
    .kb-doc-section {
        border: none !important;
        padding: 12px 0 !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .kb-doc-section-title {
        font-size: 1.1rem !important;
    }
    
    .kb-doc-prose img {
        max-width: 100% !important;
    }
    
    .kb-doc-attachment {
        border: 1px solid #ccc !important;
    }
    
    .kb-doc-footer {
        border-top: 1px solid #999;
        margin-top: 24px;
        padding-top: 12px;
    }
}

/* Responsive mobile per documento */
@media (max-width: 768px) {
    .kb-doc-header {
        padding: var(--kb-spacing);
    }
    
    .kb-doc-title {
        font-size: 1.5rem;
    }
    
    .kb-doc-meta-bar {
        gap: var(--kb-spacing);
    }
    
    .kb-doc-section {
        padding: var(--kb-spacing);
    }
    
    .kb-doc-topbar {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .kb-doc-topbar-right {
        justify-content: center;
    }
    
    .kb-share-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive mobile per creazione */
@media (max-width: 768px) {
    .kb-create-layout {
        grid-template-columns: 1fr;
    }
    
    .kb-form-card-body {
        padding: var(--kb-spacing);
    }
    
    .kb-form-card-sticky {
        position: static;
    }

    /* Importa da URL: campo e pulsante impilati */
    .kb-import-url-block {
        padding: 16px;
    }
    .kb-import-url-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .kb-import-url-row .kb-input {
        width: 100%;
        min-width: 0;
    }
    .kb-import-url-btn {
        width: 100%;
        min-height: 46px;
    }

    .kb-create-sidebar .kb-label {
        line-height: 1.35;
    }
    .kb-create-sidebar .kb-field-help,
    .kb-create-sidebar .kb-form-help,
    .kb-create-sidebar small.kb-form-help {
        overflow-wrap: anywhere;
    }
}

/* === Bottoni Modifica/Elimina nella topbar === */
.kb-doc-topbar-btn-edit {
    background: #3b82f6 !important;
    color: #fff !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.kb-doc-topbar-btn-edit:hover {
    background: #2563eb !important;
    color: #fff !important;
}

.kb-doc-topbar-btn-delete {
    background: transparent !important;
    color: #ef4444 !important;
    border: 1px solid #ef4444 !important;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.kb-doc-topbar-btn-delete:hover {
    background: #ef4444 !important;
    color: #fff !important;
}
.kb-doc-topbar-btn-delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════
   BREADCRUMB
   ═══════════════════════════════════════════════ */
.kb-breadcrumb {
    padding: 12px 0;
    margin-bottom: 8px;
}
.kb-breadcrumb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.85rem;
    color: #64748b;
}
.kb-breadcrumb-list li { display: flex; align-items: center; gap: 4px; }
.kb-breadcrumb-list li:not(:last-child)::after { content: '›'; color: #94a3b8; margin-left: 4px; }
.kb-breadcrumb-list li a { color: var(--kb-primary, #667eea); text-decoration: none; }
.kb-breadcrumb-list li a:hover { text-decoration: underline; }
.kb-breadcrumb-list li[aria-current="page"] { color: #1e293b; font-weight: 600; }
.kb-breadcrumb-wrap { max-width: 1280px; margin: 0 auto; padding: 20px 24px 0; }

/* ═══════════════════════════════════════════════
   RELATED ARTICLES
   ═══════════════════════════════════════════════ */
.kb-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.kb-related-card {
    display: block;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}
.kb-related-card:hover {
    border-color: var(--kb-primary, #667eea);
    box-shadow: 0 4px 12px rgba(102,126,234,0.12);
    transform: translateY(-2px);
}
.kb-related-card h4 { margin: 0 0 6px; font-size: 0.95rem; color: #1e293b; }
.kb-related-card p { margin: 0 0 8px; font-size: 0.82rem; color: #64748b; line-height: 1.5; }

/* ═══════════════════════════════════════════════
   SORT BAR
   ═══════════════════════════════════════════════ */
.kb-sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 16px;
}
.kb-sort-label { font-weight: 600; font-size: 0.85rem; color: #475569; margin-right: 4px; }
.kb-sort-btn {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.kb-sort-btn:hover { background: #e2e8f0; }
.kb-sort-btn.active {
    background: var(--kb-primary, #667eea);
    color: #fff;
    border-color: var(--kb-primary, #667eea);
}

@media (max-width: 782px) {
    .kb-sort-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .kb-sort-label {
        grid-column: 1 / -1;
        margin-right: 0;
        margin-bottom: 2px;
        font-size: 0.8rem;
    }
    .kb-sort-btn {
        min-height: 44px;
        padding: 8px 10px;
        font-size: 0.78rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        line-height: 1.2;
        box-sizing: border-box;
        width: 100%;
    }
}

@media (max-width: 380px) {
    .kb-sort-bar {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════
   DARK MODE TOGGLE
   ═══════════════════════════════════════════════ */
.kb-dark-toggle-wrap { margin-top: 16px; text-align: center; }
.kb-dark-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 999px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}
.kb-dark-toggle:hover { background: rgba(255,255,255,0.25); }

/* ═══════════════════════════════════════════════
   DARK MODE THEME
   ═══════════════════════════════════════════════ */
html.kb-dark .kb-frontend,
html.kb-dark .kb-doc {
    --kb-bg: #0f172a;
    --kb-surface: #1e293b;
    --kb-text: #e2e8f0;
    --kb-text-muted: #94a3b8;
    --kb-border-dark: #334155;
}
html.kb-dark .kb-frontend { background: #0f172a; color: #e2e8f0; }
html.kb-dark body {
    background: #0f172a;
    color: #e2e8f0;
}

/* ── Portale KB: wrapper *-page (CSS inline nei template dopo frontend.css; html.kb-dark vince sulla specificità) ── */
html.kb-dark .td-page,
html.kb-dark .ld-page,
html.kb-dark .kb-chat-page,
html.kb-dark .st-page,
html.kb-dark .of-page,
html.kb-dark .ac-page,
html.kb-dark .cp-page,
html.kb-dark .vlt-page,
html.kb-dark .an-page,
html.kb-dark .iv-page,
html.kb-dark .kda-page,
html.kb-dark .tkt-page,
html.kb-dark .rp-page,
html.kb-dark .ntkt-page,
html.kb-dark .ex-page,
html.kb-dark .cd-page,
html.kb-dark .bl-page,
html.kb-dark .sc-page,
html.kb-dark .ctr-page,
html.kb-dark .bb-page,
html.kb-dark .eq-page,
html.kb-dark .kpg-page,
html.kb-dark .kta-page,
html.kb-dark .nw-page,
html.kb-dark .pcp-page,
html.kb-dark .ces-page,
html.kb-dark .le-page,
html.kb-dark .brd-page,
html.kb-dark .ksp-page,
html.kb-dark .kb-faq-embed-page,
html.kb-dark .kfm-page,
html.kb-dark .pm-page {
    background-color: #0f172a !important;
    background-image: none !important;
    color: #e2e8f0;
}
html.kb-dark .pay-page,
html.kb-dark .kb-unsub-page {
    background: #0f172a !important;
    background-image: none !important;
    color: #e2e8f0;
}

/* KPI / statistiche comuni nei template portal */
html.kb-dark .td-stat,
html.kb-dark .bl-stat,
html.kb-dark .iv-stat,
html.kb-dark .tkt-stat,
html.kb-dark .rp-stat,
html.kb-dark .qt-stat,
html.kb-dark .pl-stat,
html.kb-dark .ctr-stat,
html.kb-dark .eq-stat,
html.kb-dark .cp-stat,
html.kb-dark .pcp-stat {
    background: #1e293b !important;
    border: 1px solid #334155;
    box-shadow: none !important;
    color: #e2e8f0;
}
html.kb-dark .td-stat h3,
html.kb-dark .bl-stat h3,
html.kb-dark .iv-stat h3,
html.kb-dark .tkt-stat-info h3,
html.kb-dark .rp-stat h3,
html.kb-dark .qt-stat h3,
html.kb-dark .pl-stat h3,
html.kb-dark .ctr-stat h3,
html.kb-dark .eq-stat h3,
html.kb-dark .cp-stat h3,
html.kb-dark .pcp-stat h3 {
    color: #f8fafc !important;
}
html.kb-dark .td-stat p,
html.kb-dark .bl-stat p,
html.kb-dark .iv-stat p,
html.kb-dark .tkt-stat-info p,
html.kb-dark .rp-stat p,
html.kb-dark .qt-stat p,
html.kb-dark .pl-stat p,
html.kb-dark .ctr-stat p,
html.kb-dark .eq-stat p,
html.kb-dark .cp-stat p,
html.kb-dark .pcp-stat p {
    color: #94a3b8 !important;
}

/* ── Tech dashboard (.td-* in kb-tech-dashboard.php) ── */
html.kb-dark .td-page .td-container {
    color: #e2e8f0;
}
html.kb-dark .td-page .td-biz {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: none !important;
}
html.kb-dark .td-page .td-biz h3 {
    color: #f8fafc;
}
html.kb-dark .td-page .td-biz-card {
    background: #0f172a;
    border-color: #334155;
}
html.kb-dark .td-page .td-biz-k {
    color: #f8fafc;
}
html.kb-dark .td-page .td-biz-l {
    color: #94a3b8;
}
html.kb-dark .td-page .td-biz-trend-pill.flat {
    background: #334155;
    color: #cbd5e1;
}

/* Alert SLA dashboard (sfondo inline giallo nei template PHP) */
html.kb-dark .td-page .td-sla-alerts {
    margin-top: 14px !important;
    padding: 14px 18px !important;
    border-radius: 12px !important;
    background: rgba(120, 53, 15, 0.45) !important;
    border: 1px solid #b45309 !important;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.12) inset !important;
}
html.kb-dark .td-page .td-sla-alerts > h3 {
    color: #fde68a !important;
}
html.kb-dark .td-page .td-sla-alerts > p {
    color: #fcd34d !important;
}
html.kb-dark .td-page .td-sla-alerts a {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    border-radius: 8px !important;
    color: #f1f5f9 !important;
    border-left: 4px solid #f59e0b !important;
}
html.kb-dark .td-page .td-sla-alerts a:hover {
    border-color: #475569 !important;
    color: #fff !important;
}
html.kb-dark .td-page .td-sla-alerts .td-sla-warn {
    background: rgba(245, 158, 11, 0.28) !important;
    color: #fde68a !important;
    border-color: transparent !important;
}
html.kb-dark .td-page .td-sla-alerts .td-sla-breach {
    background: rgba(239, 68, 68, 0.25) !important;
    color: #fecaca !important;
    border-color: transparent !important;
}

html.kb-dark .td-page .td-tabs {
    background: #334155;
}
html.kb-dark .td-page .td-tab {
    color: #94a3b8;
}
html.kb-dark .td-page .td-tab.active {
    background: #0f172a;
    color: #f8fafc;
    box-shadow: none;
}
html.kb-dark .td-page .td-tab:hover:not(.active) {
    color: #e2e8f0;
}

html.kb-dark .td-page .td-tkt-table {
    background: #1e293b;
    box-shadow: none !important;
    border: 1px solid #334155;
}
html.kb-dark .td-page .td-tkt-table th {
    background: #0f172a;
    color: #94a3b8;
    border-bottom-color: #334155;
}
html.kb-dark .td-page .td-tkt-table td {
    border-bottom-color: #334155;
    color: #e2e8f0;
}
html.kb-dark .td-page .td-tkt-table tr:hover td {
    background: #233348;
}

html.kb-dark .td-page .td-card {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: none !important;
    color: #e2e8f0;
}
html.kb-dark .td-page .td-card h3 {
    color: #f8fafc;
}

html.kb-dark .td-page .td-form-group label {
    color: #cbd5e1;
}
html.kb-dark .td-page .td-input,
html.kb-dark .td-page .td-inline-select {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

html.kb-dark .td-page .td-btn-outline {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

html.kb-dark .td-page .td-modal {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
}
html.kb-dark .td-page .td-modal h3 {
    color: #f8fafc;
}

html.kb-dark .td-page .td-contact-result {
    background: #0f172a;
    border-color: #334155;
}
html.kb-dark .td-page .td-contact-result-main {
    color: #e2e8f0;
}
html.kb-dark .td-page .td-contact-result-meta {
    color: #94a3b8;
}

html.kb-dark .td-page .td-notif-dropdown {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
html.kb-dark .td-page .td-notif-header {
    border-bottom-color: #334155;
}
html.kb-dark .td-page .td-notif-title {
    color: #f1f5f9;
}
html.kb-dark .td-page .td-notif-msg,
html.kb-dark .td-page .td-notif-date {
    color: #94a3b8;
}
html.kb-dark .td-page .td-notif-item {
    border-bottom-color: #334155;
}
html.kb-dark .td-page .td-notif-item:hover {
    background: #334155;
}
html.kb-dark .td-page .td-notif-item.unread {
    background: rgba(59, 130, 246, 0.12);
}

html.kb-dark .td-page .td-kanban-col {
    background: #1e293b;
    border: 1px solid #334155;
}
html.kb-dark .td-page .td-kanban-col-header {
    color: #f8fafc;
}
html.kb-dark .td-page .td-kanban-card {
    background: #0f172a;
    border-color: #334155;
}
html.kb-dark .td-page .td-kanban-card-title {
    color: #e2e8f0;
}
html.kb-dark .td-page .td-kanban-card-meta {
    color: #94a3b8;
}
html.kb-dark .td-page .td-kanban-num {
    color: #64748b;
}

html.kb-dark .td-page .td-company-card {
    background: #1e293b;
    border-color: #334155;
}
html.kb-dark .td-page .td-company-card h4 {
    color: #f8fafc;
}
html.kb-dark .td-page .td-company-meta {
    color: #94a3b8;
}

html.kb-dark .td-page .td-user-item {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

html.kb-dark .td-page .td-kb-access label {
    color: #e2e8f0;
}

html.kb-dark .td-page .td-log-item {
    border-bottom-color: #334155;
    color: #cbd5e1;
}
html.kb-dark .td-page .td-log-text strong {
    color: #f8fafc;
}
html.kb-dark .td-page .td-log-date {
    color: #94a3b8;
}

@media (max-width: 768px) {
    html.kb-dark .td-page .td-tkt-table tr {
        background: #1e293b !important;
        border-left-color: #3b82f6;
    }
}

/* Messaggi ticket dentro tech dashboard (background inline chiaro nei template PHP) */
html.kb-dark .td-page .tkt-msg,
html.kb-dark .td-page .tkt-reply {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: none !important;
    color: #e2e8f0 !important;
}
html.kb-dark .td-page .tkt-msg-author-name {
    color: #f8fafc !important;
}
html.kb-dark .td-page .tkt-msg-author-role,
html.kb-dark .td-page .tkt-msg-date {
    color: #94a3b8 !important;
}
html.kb-dark .td-page .tkt-msg-content {
    color: #e2e8f0 !important;
}
html.kb-dark .td-page .tkt-msg.is-tech {
    background: #273349 !important;
}
html.kb-dark .td-page .tkt-msg.is-admin {
    background: #28332d !important;
}
html.kb-dark .td-page .td-tkt-subject {
    color: #f1f5f9;
}
html.kb-dark .td-page .td-tkt-number {
    color: #94a3b8;
}
html.kb-dark .td-page .td-cell-link:hover {
    color: #93c5fd;
}

/* ── I miei ticket / cliente (.tkt-*) ── */
html.kb-dark .tkt-page .tkt-container {
    color: #e2e8f0;
}
html.kb-dark .tkt-page .tkt-filters {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: none !important;
}
html.kb-dark .tkt-page .tkt-filter-btn {
    background: #0f172a;
    border-color: #475569;
    color: #cbd5e1;
}
html.kb-dark .tkt-page .tkt-filter-btn.active,
html.kb-dark .tkt-page .tkt-filter-btn:hover {
    border-color: #818cf8;
    color: #c7d2fe;
    background: #273349;
}

html.kb-dark .tkt-page .tkt-card {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: none !important;
}
html.kb-dark .tkt-page .tkt-card-subject {
    color: #f1f5f9;
}
html.kb-dark .tkt-page .tkt-card-meta,
html.kb-dark .tkt-page .tkt-card-number {
    color: #94a3b8 !important;
}

html.kb-dark .tkt-page .tkt-single-header,
html.kb-dark .tkt-page .tkt-msg,
html.kb-dark .tkt-page .tkt-reply-form {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: none !important;
    color: #e2e8f0;
}
html.kb-dark .tkt-page .tkt-single-title,
html.kb-dark .tkt-page .tkt-msg-author-name {
    color: #f8fafc !important;
}
html.kb-dark .tkt-page .tkt-single-meta,
html.kb-dark .tkt-page .tkt-msg-date,
html.kb-dark .tkt-page .tkt-msg-author-role {
    color: #94a3b8 !important;
}
html.kb-dark .tkt-page .tkt-msg-content {
    color: #e2e8f0 !important;
}
html.kb-dark .tkt-page .tkt-msg.is-tech {
    background: #273349;
}
html.kb-dark .tkt-page .tkt-msg.is-admin {
    background: #28332d;
}

html.kb-dark .tkt-page .tkt-reply-textarea {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #475569;
}
html.kb-dark .tkt-page .tkt-upload-area {
    border-color: #475569;
    background: #0f172a;
}

html.kb-dark .tkt-page .tkt-empty {
    background: #1e293b;
    border: 1px solid #334155;
}
html.kb-dark .tkt-page .tkt-empty h3 {
    color: #f8fafc !important;
}
html.kb-dark .tkt-page .tkt-empty p {
    color: #94a3b8 !important;
}

html.kb-dark .tkt-page .ticket-reply-file {
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0 !important;
}

/* ── Nuovo ticket ── */
html.kb-dark .ntkt-page .ntkt-form-card {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: none !important;
    color: #e2e8f0;
}
html.kb-dark .ntkt-page .ntkt-form-card h2 {
    color: #f8fafc !important;
}
html.kb-dark .ntkt-page .ntkt-group label {
    color: #cbd5e1 !important;
}
html.kb-dark .ntkt-page .ntkt-input,
html.kb-dark .ntkt-page .ntkt-select,
html.kb-dark .ntkt-page .ntkt-textarea {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

html.kb-dark .ntkt-page .ntkt-upload-area:hover,
html.kb-dark .ntkt-page .ntkt-upload-area.dragover {
    background: #273349;
}

html.kb-dark .ntkt-page .ntkt-back {
    color: #94a3b8;
}
html.kb-dark .ntkt-page .ntkt-back:hover {
    color: #c7d2fe;
}

html.kb-dark .ntkt-page .ntkt-kb-suggest {
    background: #273349;
    border-color: #475569;
}
html.kb-dark .ntkt-page .ntkt-kb-suggest h4 {
    color: #a5b4fc !important;
}

/* ── Gestione aziende (.ac-*): parità con tonalità sopra ── */
html.kb-dark .ac-page .ac-container {
    color: #e2e8f0;
}
html.kb-dark .ac-page .ac-tabs {
    background: #334155;
}
html.kb-dark .ac-page .ac-tab {
    color: #94a3b8;
}
html.kb-dark .ac-page .ac-tab.active {
    background: #0f172a;
    color: #f8fafc;
    box-shadow: none;
}
html.kb-dark .ac-page .ac-card {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: none !important;
    color: #e2e8f0;
}
html.kb-dark .ac-page .ac-card h3 {
    color: #f8fafc;
}

html.kb-dark .ac-page .ac-company-card {
    background: #1e293b;
    border-color: #334155;
}
html.kb-dark .ac-page .ac-company-card h4 {
    color: #f8fafc !important;
}
html.kb-dark .ac-page .ac-company-meta {
    color: #94a3b8 !important;
}

html.kb-dark .ac-page .ac-form-group label {
    color: #cbd5e1 !important;
}
html.kb-dark .ac-page .ac-input {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

html.kb-dark .ac-page .ac-btn-outline {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

html.kb-dark .ac-page .ac-user-item {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
html.kb-dark .ac-page .ac-user-item:hover {
    background: #273349 !important;
}

html.kb-dark .ac-page .ac-modal {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
}

html.kb-dark .ac-page .ac-profile-meta h4 {
    color: #f8fafc !important;
}

/* ── Fatturazione report (.bl-*): contenuto principale ── */
html.kb-dark .bl-page .bl-container {
    color: #e2e8f0;
}
html.kb-dark .bl-page .bl-filters {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: none !important;
}
html.kb-dark .bl-page .bl-filter-group label {
    color: #94a3b8 !important;
}
html.kb-dark .bl-page .bl-filter-group select {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

html.kb-dark .bl-page .bl-table {
    background: #1e293b !important;
    border: 1px solid #334155;
    box-shadow: none !important;
}
html.kb-dark .bl-page .bl-table th {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border-bottom-color: #334155 !important;
}
html.kb-dark .bl-page .bl-table td {
    border-bottom-color: #334155 !important;
    color: #e2e8f0 !important;
}
html.kb-dark .bl-page .bl-table tr:hover td {
    background: #233348 !important;
}
html.kb-dark .bl-page .bl-company-header {
    background: #0f172a !important;
    border-bottom-color: #334155 !important;
}
html.kb-dark .bl-page .bl-company-header td {
    color: #f8fafc !important;
}

html.kb-dark .bl-page .bl-summary-card {
    background: #1e293b !important;
    border: 1px solid #334155;
}
html.kb-dark .bl-page .bl-summary-card h4 {
    color: #f8fafc !important;
}
html.kb-dark .bl-page .bl-sc-actions {
    border-top-color: #334155;
}

/* ── File manager ── */
html.kb-dark .kfm-page {
    color: #e2e8f0 !important;
}
html.kb-dark .kfm-page .kfm-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0;
}
html.kb-dark .kfm-page .kfm-grid label {
    color: #cbd5e1 !important;
}
html.kb-dark .kfm-page .kfm-input,
html.kb-dark .kfm-page .kfm-xp-field {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

/* Preventivi / listini (.qt-wrap senza wrapper *-page) */
html.kb-dark .qt-wrap {
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    box-sizing: border-box;
}
html.kb-dark .qt-toolbar input,
html.kb-dark .qt-toolbar select {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
html.kb-dark .qt-card {
    background: #1e293b !important;
    border: 1px solid #334155;
    box-shadow: none !important;
    color: #e2e8f0;
}
html.kb-dark .qt-stat .s-val {
    color: #f8fafc !important;
}
html.kb-dark .qt-stat .s-lbl {
    color: #94a3b8 !important;
}

html.kb-dark .pl-wrap {
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    box-sizing: border-box;
}
html.kb-dark .pl-toolbar input,
html.kb-dark .pl-toolbar select {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
html.kb-dark .pl-stat .stat-val {
    color: #f8fafc !important;
}
html.kb-dark .pl-stat .stat-lbl {
    color: #94a3b8 !important;
}

html.kb-dark .kb-toolbar,
html.kb-dark .kb-search-section,
html.kb-dark .kb-filters { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-search-input,
html.kb-dark .kb-filter-select { background: #0f172a; color: #e2e8f0; border-color: #334155; }
html.kb-dark .kb-article-card { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-article-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
html.kb-dark .kb-card-top-bar { background: #0f172a; border-color: #334155; }
html.kb-dark .kb-card-content { color: #e2e8f0; }
html.kb-dark .kb-article-title a { color: #f1f5f9; }
html.kb-dark .kb-article-title a:hover { color: #818cf8; }
html.kb-dark .kb-article-excerpt { color: #94a3b8; }
html.kb-dark .kb-card-footer { background: #0f172a; border-color: #334155; }
html.kb-dark .kb-card-meta-item { color: #94a3b8; }
html.kb-dark .kb-nav-buttons { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-nav-button { background: #334155; color: #cbd5e1; border-color: #475569; }
html.kb-dark .kb-nav-button:hover { background: #475569; color: #f1f5f9; }
html.kb-dark .kb-sort-bar { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-sort-btn { background: #334155; color: #cbd5e1; border-color: #475569; }
html.kb-dark .kb-sort-btn.active { background: var(--kb-primary, #667eea); color: #fff; }
html.kb-dark .kb-breadcrumb-list li { color: #94a3b8; }
html.kb-dark .kb-breadcrumb-list li[aria-current="page"] { color: #f1f5f9; }
html.kb-dark .kb-category-overview { background: #1e293b; }
html.kb-dark .kb-category-card { background: #0f172a; border-color: #334155; }
html.kb-dark .kb-section-header h2,
html.kb-dark .kb-section-header h3 { color: #f1f5f9; }
html.kb-dark .kb-section-header p { color: #94a3b8; }
html.kb-dark .kb-no-articles { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.kb-dark .kb-related-card { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-related-card h4 { color: #f1f5f9; }
html.kb-dark .kb-related-card p { color: #94a3b8; }
/* Dark mode single article / doc (contenuto + sidebar allineati) */
html.kb-dark .kb-doc-header { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-doc-title { color: #f1f5f9; }
html.kb-dark .kb-doc-sidebar { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-doc-sidebar-inner { color: #cbd5e1; }
html.kb-dark .kb-doc-body { color: #e2e8f0; }
html.kb-dark .kb-doc-content,
html.kb-dark main.kb-doc-content {
    background: transparent;
    color: #e2e8f0;
}
html.kb-dark .kb-doc-section,
html.kb-dark #kb-section-content {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
html.kb-dark .kb-doc-section-title {
    color: #f8fafc;
    border-bottom-color: #334155;
}
html.kb-dark .kb-doc-section-solution {
    background: linear-gradient(135deg, #14532d 0%, #1e293b 55%);
    border-color: #334155;
}
html.kb-dark .kb-doc-section-solution .kb-doc-section-title {
    color: #86efac;
    border-bottom-color: rgba(255, 255, 255, 0.12);
}
html.kb-dark .kb-doc-prose {
    color: #e2e8f0;
}
html.kb-dark .kb-doc-prose h1,
html.kb-dark .kb-doc-prose h2,
html.kb-dark .kb-doc-prose h3,
html.kb-dark .kb-doc-prose h4 {
    color: #f8fafc;
}
html.kb-dark .kb-doc-prose a {
    color: #93c5fd;
}
html.kb-dark .kb-doc-prose a:hover {
    color: #bfdbfe;
}
html.kb-dark .kb-doc-prose img {
    border-color: #334155;
}
html.kb-dark .kb-doc-prose blockquote {
    background: #0f172a;
    border-left-color: #818cf8;
    color: #cbd5e1;
}
html.kb-dark .kb-doc-prose code {
    background: #334155;
    color: #fde047;
}
html.kb-dark .kb-doc-prose table th,
html.kb-dark .kb-doc-prose table td {
    border-color: #334155;
    color: #e2e8f0;
}
html.kb-dark .kb-doc-prose table th {
    background: #0f172a;
    color: #f8fafc;
}
html.kb-dark .kb-doc-prose table tr:nth-child(even) td {
    background: #0f172a;
}
html.kb-dark .kb-doc-note-box {
    background: #422006;
    border-color: #ca8a04;
    color: #fef3c7;
}
html.kb-dark .kb-doc-attachments,
html.kb-dark .kb-doc-footer {
    color: #e2e8f0;
    border-color: #334155;
}
html.kb-dark .kb-doc-feedback,
html.kb-dark #kb-section-feedback.kb-doc-feedback {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}
html.kb-dark .kb-feedback-stats-title {
    color: #f8fafc;
}
html.kb-dark .kb-feedback-stats-total {
    color: #94a3b8;
}
html.kb-dark .kb-feedback-bar {
    background: #334155;
}
html.kb-dark .kb-feedback-bar-empty {
    background: #475569;
}
html.kb-dark .kb-feedback-empty-text {
    color: #94a3b8;
}
html.kb-dark .kb-feedback-count {
    color: #cbd5e1;
}
html.kb-dark .kb-feedback-count-label {
    color: #94a3b8;
}
html.kb-dark .kb-feedback-pct-value {
    color: #93c5fd;
}
html.kb-dark .kb-feedback-vote {
    border-top-color: #334155;
}
html.kb-dark .kb-doc-feedback-question {
    color: #e2e8f0;
}
html.kb-dark .kb-doc-feedback-thanks {
    color: #86efac;
}
html.kb-dark .kb-doc-feedback-extra {
    border-top-color: #334155;
}
html.kb-dark .kb-doc-feedback-btn {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}
html.kb-dark .kb-doc-feedback-yes:hover:not(:disabled) {
    border-color: #22c55e;
    color: #86efac;
    background: rgba(34, 197, 94, 0.15);
}
html.kb-dark .kb-doc-feedback-no:hover:not(:disabled) {
    border-color: #f87171;
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.12);
}
html.kb-dark .kb-doc-feedback-btn.kb-feedback-btn-selected.kb-doc-feedback-yes {
    border-color: #22c55e;
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.25);
}
html.kb-dark .kb-doc-feedback-btn.kb-feedback-btn-selected.kb-doc-feedback-no {
    border-color: #ef4444;
    color: #fecaca;
    background: rgba(239, 68, 68, 0.2);
}
html.kb-dark #kb-section-feedback .kb-btn-obsolete {
    border-color: #fbbf24;
    color: #fde68a;
}
html.kb-dark #kb-section-feedback .kb-btn-obsolete:hover {
    background: rgba(251, 191, 36, 0.15);
    color: #fef08a;
}
html.kb-dark .kb-doc-attachment {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
html.kb-dark .kb-doc-attachment-name {
    color: #f1f5f9;
}
html.kb-dark .kb-doc-sidebar-section h4 {
    color: #94a3b8;
}
html.kb-dark .kb-doc-sidebar-section p {
    color: #cbd5e1;
}
html.kb-dark .kb-doc-toc-title {
    color: #94a3b8;
    border-bottom-color: #334155;
}
html.kb-dark .kb-toc-link {
    color: #e2e8f0;
}
html.kb-dark .kb-toc-link:hover {
    color: #f8fafc;
    background: rgba(148, 163, 184, 0.12);
}
html.kb-dark .kb-toc-link.active {
    color: #c7d2fe;
    border-left-color: #818cf8;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.12);
}
html.kb-dark .kb-doc-tag {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}
html.kb-dark .kb-doc-topbar { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-doc-topbar-link { color: #c7d2fe; }
html.kb-dark .kb-doc-topbar-link:hover { color: #eef2ff; }
html.kb-dark .kb-doc-topbar-btn {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}
html.kb-dark .kb-doc-topbar-btn:hover {
    background: #475569 !important;
}
html.kb-dark .kb-doc-meta-bar,
html.kb-dark .kb-doc-meta-item,
html.kb-dark .kb-doc-meta-label,
html.kb-dark .kb-doc-meta-value {
    border-color: #334155;
    color: #cbd5e1;
}
html.kb-dark .kb-doc-abstract {
    color: #cbd5e1 !important;
}
html.kb-dark .kb-doc-header .kb-doc-id {
    background: rgba(15, 23, 42, 0.55);
    color: #94a3b8;
}

/* HTML importato in tema scuro (toc/section): regole dopo _kb-custom-css in kb-html-imported-dark-after-custom.css */

/* ═══════════════════════════════════════════════
   MODAL (Email share, etc.)
   ═══════════════════════════════════════════════ */
.kb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}
.kb-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}
.kb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.kb-modal-header h3 { margin: 0; font-size: 1.1rem; }
.kb-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0 4px;
}
.kb-modal-body { padding: 20px; }
.kb-modal-body label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 0.88rem; color: #334155; }
.kb-modal-body label:first-child { margin-top: 0; }
.kb-modal-footer { padding: 16px 20px; border-top: 1px solid #e2e8f0; text-align: right; }
.kb-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.kb-input:focus { border-color: var(--kb-primary, #667eea); outline: none; box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }
.kb-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.kb-btn-primary { background: var(--kb-primary, #667eea); color: #fff; }
.kb-btn-primary:hover { background: var(--kb-primary-dark, #5a67d8); }
.kb-btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.kb-btn-secondary:hover { background: #e2e8f0; }
html.kb-dark .kb-modal { background: #1e293b; }
html.kb-dark .kb-modal-header { background: #0f172a; border-color: #334155; }
html.kb-dark .kb-modal-header h3 { color: #f1f5f9; }
html.kb-dark .kb-modal-body label { color: #cbd5e1; }
html.kb-dark .kb-input { background: #0f172a; color: #e2e8f0; border-color: #334155; }
html.kb-dark .kb-modal-footer { border-color: #334155; }

/* Storico versioni, commenti, traduzioni */
.kb-modal-overlay.kb-modal-visible { display: flex !important; align-items: center; justify-content: center; }
.kb-modal-versions { max-width: 640px; }
.kb-versions-list .kb-loading { color: #64748b; padding: 20px; }
.kb-versions-table { overflow-x: auto; }
.kb-versions-table table { width: 100%; border-collapse: collapse; }
.kb-versions-table th, .kb-versions-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.kb-versions-table th { background: #f8fafc; font-weight: 600; font-size: 0.85rem; }
.kb-btn-diff, .kb-btn-rollback { margin-right: 6px; }
.kb-diff-content { margin-top: 12px; padding: 16px; background: #f8fafc; border-radius: 8px; font-size: 0.85rem; overflow-x: auto; max-height: 400px; overflow-y: auto; }
.kb-diff-content table.diff { width: 100%; border-collapse: collapse; }
.kb-diff-content .diff-deleted { background: #fef2f2; color: #991b1b; }
.kb-diff-content .diff-added { background: #dcfce7; color: #166534; }
.kb-doc-feedback-extra { margin-top: 16px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.kb-btn-obsolete { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: transparent; border: 1px solid #f59e0b; color: #b45309; border-radius: 8px; font-size: 0.88rem; cursor: pointer; transition: all 0.2s; }
.kb-btn-obsolete:hover { background: #fef3c7; }
.kb-btn-obsolete:disabled { opacity: 0.6; cursor: default; }
.kb-doc-comments { margin-top: 24px; }
.kb-comments-list { margin-bottom: 20px; }
.kb-comment-item { padding: 16px; background: #f8fafc; border-radius: 10px; margin-bottom: 12px; border-left: 4px solid var(--kb-primary, #667eea); }
.kb-comment-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.85rem; }
.kb-comment-author { font-weight: 600; color: #1e293b; }
.kb-comment-date { color: #64748b; font-size: 0.8rem; }
.kb-comment-content { font-size: 0.9rem; line-height: 1.6; color: #334155; }
.kb-comment-form-wrap { display: flex; flex-direction: column; gap: 10px; }
.kb-comment-form-wrap .kb-input, .kb-comment-form-wrap .kb-textarea { border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 14px; font-size: 0.9rem; }
.kb-translations-links { display: flex; flex-wrap: wrap; gap: 8px; }
.kb-translation-link { display: inline-block; padding: 6px 14px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 0.88rem; text-decoration: none; color: #334155; transition: all 0.2s; }
.kb-translation-link:hover { background: #e2e8f0; color: var(--kb-primary, #667eea); }

/* ═══════════════════════════════════════════════
   TEMPLATE SELECTOR
   ═══════════════════════════════════════════════ */
.kb-templates-section,
.kb-import-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}
.kb-templates-section h3,
.kb-import-section h3 { margin: 0 0 6px; font-size: 1.15rem; }
.kb-templates-section p,
.kb-import-section p { margin: 0 0 16px; color: #64748b; font-size: 0.9rem; }
.kb-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.kb-template-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.kb-template-btn:hover { border-color: var(--kb-primary, #667eea); background: #f0f4ff; }
.kb-template-btn.active { border-color: var(--kb-primary, #667eea); background: rgba(102,126,234,0.08); box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }
.kb-template-icon { font-size: 2rem; }
.kb-template-btn strong { font-size: 0.88rem; color: #1e293b; }
.kb-template-btn small { font-size: 0.75rem; color: #64748b; }
.kb-import-row {
    display: flex;
    gap: 10px;
}
.kb-import-row .kb-input { flex: 1; }

/* Nuova categoria dal form crea articolo */
.kb-new-category-wrap {
    margin-top: 12px;
}
.kb-new-category-panel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
}
.kb-new-category-panel .kb-label {
    margin-top: 10px;
}
.kb-new-category-panel .kb-label:first-of-type {
    margin-top: 0;
}
.kb-new-category-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}
.kb-new-category-feedback {
    margin-bottom: 0 !important;
}
/* Il tema spesso forza button:hover { color: #fff }: testo illeggibile su sfondo chiaro */
.kb-new-category-wrap .kb-btn-outline,
.kb-new-category-wrap #kb-toggle-new-category {
    color: #4338ca !important;
    background: #fff !important;
    border-color: #a5b4fc !important;
}
.kb-new-category-wrap .kb-btn-outline:hover,
.kb-new-category-wrap .kb-btn-outline:focus-visible,
.kb-new-category-wrap #kb-toggle-new-category:hover,
.kb-new-category-wrap #kb-toggle-new-category:focus-visible {
    color: #312e81 !important;
    background: #eef2ff !important;
    border-color: #6366f1 !important;
}
.kb-new-category-actions .kb-btn-ghost:hover,
.kb-new-category-actions .kb-btn-ghost:focus-visible {
    color: #0f172a !important;
    background: #f1f5f9 !important;
}
.kb-form-help { display: block; margin-top: 4px; font-size: 0.78rem; color: #94a3b8; }

/* ═══════════════════════════════════════════════
   WORKFLOW BADGES
   ═══════════════════════════════════════════════ */
.kb-workflow-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.kb-workflow-draft { background: #f1f5f9; color: #475569; }
.kb-workflow-in_review { background: #fef3c7; color: #92400e; }
.kb-workflow-approved { background: #d1fae5; color: #065f46; }
.kb-workflow-published { background: #dbeafe; color: #1e40af; }
.kb-workflow-obsolete { background: #fee2e2; color: #991b1b; }

/* ═══════════════════════════════════════════════
   CATEGORY INDEX PAGE
   ═══════════════════════════════════════════════ */
.kb-catindex-articles { list-style: none; padding: 0; margin: 12px 0 0; }
.kb-catindex-article-item { padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.88rem; }
.kb-catindex-article-item:last-child { border-bottom: none; }
.kb-catindex-article-item a { color: var(--kb-primary, #667eea); text-decoration: none; }
.kb-catindex-article-item a:hover { text-decoration: underline; }
.kb-catindex-meta { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.kb-catindex-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(102,126,234,0.1);
    color: var(--kb-primary-dark, #5a67d8);
}

/* ═══════════════════════════════════════════════
   THEME OVERRIDE: Force white text on dark backgrounds
   Fixes themes that set h1-h6 { color: #333 } globally
   ═══════════════════════════════════════════════ */

/* KB Article pages */
.kb-header h1,
.kb-header h2,
.kb-header h3,
.kb-header h4,
.kb-header h5,
.kb-header h6,
.kb-header p,
.kb-header span,
.kb-create-header h1,
.kb-create-header h2,
.kb-create-header h3,
.kb-create-header p,
.kb-create-header span,
.kb-taxonomy-header h1,
.kb-taxonomy-header h2,
.kb-taxonomy-header p,
.kb-hero h1,
.kb-hero h2,
.kb-hero h3,
.kb-hero p,
.kb-hero span,
.kb-taxonomy-hero h1,
.kb-taxonomy-hero h2,
.kb-taxonomy-hero p,

/* Ticket system pages */
.td-hero h1,
.td-hero h2,
.td-hero p,
.td-hero span,
.tkt-hero h1,
.tkt-hero h2,
.tkt-hero p,
.tkt-hero span,
.ntkt-hero h1,
.ntkt-hero h2,
.ntkt-hero p,
.ntkt-hero span,

/* Admin/management pages */
.ac-hero h1,
.ac-hero h2,
.ac-hero p,
.ac-hero span,
.ctr-hero h1,
.ctr-hero h2,
.ctr-hero p,
.ctr-hero span,
.rp-hero h1,
.rp-hero h2,
.rp-hero p,
.rp-hero span,
.cp-hero h1,
.cp-hero h2,
.cp-hero p,
.cp-hero span,
.iv-hero h1,
.iv-hero h2,
.iv-hero p,
.iv-hero span,
.ex-hero h1,
.ex-hero h2,
.ex-hero p,
.ex-hero span,

/* Quotes/Pricelists/Payments */
.qt-hero h1,
.qt-hero h2,
.qt-hero p,
.qt-hero span,
.pl-hero h1,
.pl-hero h2,
.pl-hero p,
.pl-hero span,
.an-hero h1,
.an-hero h2,
.an-hero p,
.an-hero span,
.pay-header h1,
.pay-header h2,
.pay-header p,
.pay-header span,

/* KB Document single page — maximum specificity override */
.kb-doc-header h1,
.kb-doc-header h2,
.kb-doc-header h3,
.kb-doc-header h4,
.kb-doc-header p,
.kb-doc-header span,
.kb-doc-header div,
.kb-doc-header a,
.kb-doc-title,
h1.kb-doc-title,
.kb-doc .kb-doc-header h1,
.kb-doc .kb-doc-title,
.kb-frontend .kb-doc-header h1,
.kb-frontend .kb-doc-title,
body .kb-doc-header h1,
body .kb-doc-title,
body .kb-frontend h1.kb-doc-title,
.kb-doc-abstract,
.kb-doc-id,
.kb-doc-meta-label,
.kb-doc-meta-value,

/* KB Document single page */
.kb-doc-header h1,
.kb-doc-header h2,
.kb-doc-header h3,
.kb-doc-header h4,
.kb-doc-header h5,
.kb-doc-header h6,
.kb-doc-header p,
.kb-doc-header span,
.kb-doc-header div,
.kb-doc-header a,
.kb-doc-header .kb-doc-title,
.kb-doc-header .kb-doc-abstract,
.kb-doc-header .kb-doc-id,
.kb-doc-header .kb-doc-meta-label,
.kb-doc-header .kb-doc-meta-value,
h1.kb-doc-title,
.kb-doc .kb-doc-header h1,
.kb-frontend .kb-doc-header h1,
.kb-frontend h1.kb-doc-title,

/* Login page */
.kb-login-brand h1,
.kb-login-brand h2,
.kb-login-brand p,
.kb-login-brand span,
.kb-login-wrapper .kb-login-brand h1 {
    color: #fff !important;
}

/* Force topbar buttons visibility on KB doc page */
.kb-doc-topbar .kb-doc-topbar-btn,
.kb-frontend .kb-doc-topbar-btn,
.kb-doc .kb-doc-topbar-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.kb-doc-topbar .kb-doc-topbar-btn .dashicons,
.kb-frontend .kb-doc-topbar-btn .dashicons {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 20px !important;
}

/* Also force subtitle/description text in hero sections */
.kb-hero .kb-hero-subtitle,
.kb-hero .kb-hero-description,
.td-hero .td-subtitle,
.tkt-hero .tkt-subtitle,
[class*="-hero"] > p,
[class*="-hero"] > h1,
[class*="-hero"] > h2,
[class*="-hero"] > span {
    color: #fff !important;
}

/* ═══════════════════════════════════════════════
   Ultra-specific overrides for KB single article page
   Ensures no theme can override colors/visibility
   ═══════════════════════════════════════════════ */
body .kb-doc-header,
body .kb-doc-header h1,
body .kb-doc-header h2,
body .kb-doc-header h3,
body .kb-doc-header p,
body .kb-doc-header span,
body .kb-doc-header div,
body .kb-doc-header a,
body h1.kb-doc-title,
body .kb-doc-title,
body .kb-doc-abstract,
body .kb-doc-id {
    color: #fff !important;
}

body .kb-doc-topbar .kb-doc-topbar-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 8px 12px !important;
    border: 1px solid var(--kb-border, #e2e8f0) !important;
    border-radius: 6px !important;
    background: #fff !important;
    cursor: pointer !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    color: var(--kb-secondary, #64748b) !important;
}

body .kb-doc-topbar .kb-doc-topbar-btn:hover {
    border-color: var(--kb-primary, #667eea) !important;
    color: var(--kb-primary, #667eea) !important;
    background: rgba(102,126,234,0.05) !important;
}

body .kb-doc-topbar .kb-doc-topbar-btn-share {
    background: var(--kb-primary, #667eea) !important;
    color: #fff !important;
    border-color: var(--kb-primary, #667eea) !important;
}

body .kb-doc-topbar .kb-doc-topbar-btn-share:hover {
    background: var(--kb-primary-dark, #5a67d8) !important;
    color: #fff !important;
}

body .kb-doc-topbar #kb-download-pdf {
    background: #dc2626 !important;
    color: #fff !important;
    border-color: #dc2626 !important;
}

body .kb-doc-topbar #kb-download-pdf:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
    color: #fff !important;
}

/* ═══════════════════════════════════════════════
   Nuclear override — html body prefix for themes
   that use body-level selectors on buttons/headings
   ═══════════════════════════════════════════════ */
html body .kb-doc-topbar button.kb-doc-topbar-btn,
html body .kb-doc-topbar a.kb-doc-topbar-btn,
html body .kb-doc-topbar-right button,
html body .kb-doc-topbar-right a.kb-doc-topbar-btn,
html body button.kb-doc-topbar-btn,
html body a.kb-doc-topbar-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 8px 12px !important;
    border: 1px solid var(--kb-border, #e2e8f0) !important;
    border-radius: 6px !important;
    background: #fff !important;
    cursor: pointer !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    color: var(--kb-secondary, #64748b) !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
    overflow: visible !important;
    height: auto !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    text-indent: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    position: static !important;
    clip: auto !important;
    -webkit-clip-path: none !important;
    clip-path: none !important;
    margin: 0 !important;
    transform: none !important;
    pointer-events: auto !important;
    z-index: auto !important;
    float: none !important;
}

html body .kb-doc-topbar button.kb-doc-topbar-btn:hover,
html body .kb-doc-topbar a.kb-doc-topbar-btn:hover {
    border-color: var(--kb-primary, #667eea) !important;
    color: var(--kb-primary, #667eea) !important;
    background: rgba(102,126,234,0.05) !important;
}

html body .kb-doc-topbar button.kb-doc-topbar-btn-share,
html body .kb-doc-topbar a.kb-doc-topbar-btn-share,
html body button.kb-doc-topbar-btn-share {
    background: var(--kb-primary, #667eea) !important;
    color: #fff !important;
    border-color: var(--kb-primary, #667eea) !important;
}

html body .kb-doc-topbar #kb-download-pdf,
html body #kb-download-pdf {
    background: #dc2626 !important;
    color: #fff !important;
    border-color: #dc2626 !important;
}

html body .kb-doc-topbar .kb-doc-topbar-btn .dashicons,
html body .kb-doc-topbar button .dashicons,
html body button.kb-doc-topbar-btn .dashicons,
html body a.kb-doc-topbar-btn .dashicons {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: inherit !important;
    vertical-align: middle !important;
    text-indent: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    position: static !important;
}

/* Title — nuclear override */
html body h1.kb-doc-title,
html body .kb-doc-header h1.kb-doc-title,
html body .kb-doc .kb-doc-header h1,
html body .entry-content .kb-doc-header h1,
html body .page .kb-doc-header h1,
html body .single .kb-doc-header h1,
html body .kb-doc-header .kb-doc-title,
html body .kb-frontend .kb-doc-header h1 {
    color: #fff !important;
}

html body .kb-doc-topbar-right {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    gap: 8px !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
}

/* ═══════════════════════════════════════════════
   ULTIMATE override for stubborn themes
   Uses #-based specificity if theme uses IDs or
   very deep selectors like body.page .entry h1
   ═══════════════════════════════════════════════ */

/* Title must be white on dark header */
html body.page .kb-doc-header h1,
html body.single .kb-doc-header h1,
html body.page .kb-doc-header h1.kb-doc-title,
html body.single .kb-doc-header h1.kb-doc-title,
html body.single-kb_article .kb-doc-header h1,
html body .kb-frontend .kb-doc-header h1.kb-doc-title,
body .kb-doc-header h1.kb-doc-title,
body .kb-doc-header .kb-doc-title,
.kb-doc-header h1.kb-doc-title,
.kb-doc h1.kb-doc-title {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Abstract/excerpt text */
html body .kb-doc-header .kb-doc-abstract,
body .kb-doc-header .kb-doc-abstract,
.kb-doc-header .kb-doc-abstract {
    color: rgba(255,255,255,0.8) !important;
    -webkit-text-fill-color: rgba(255,255,255,0.8) !important;
}

/* Meta labels and values inside header */
html body .kb-doc-header .kb-doc-meta-label,
html body .kb-doc-header .kb-doc-meta-value,
body .kb-doc-header .kb-doc-meta-bar *,
.kb-doc-header .kb-doc-meta-bar * {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* ID badge */
html body .kb-doc-header .kb-doc-id,
body .kb-doc-header .kb-doc-id {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Status and priority badges inside header */
html body .kb-doc-header .kb-doc-badge,
body .kb-doc-header .kb-doc-badge {
    -webkit-text-fill-color: initial !important;
}

/* Topbar buttons — max specificity */
html body.page .kb-doc-topbar-btn,
html body.single .kb-doc-topbar-btn,
html body.single-kb_article .kb-doc-topbar-btn,
html body.page .kb-doc-topbar button,
html body.single .kb-doc-topbar button,
html body.single-kb_article .kb-doc-topbar button {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: var(--kb-secondary, #64748b) !important;
    background: #fff !important;
    border: 1px solid var(--kb-border, #e2e8f0) !important;
    font-size: 0.85rem !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    height: auto !important;
    width: auto !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    -webkit-clip-path: none !important;
    position: static !important;
    text-indent: 0 !important;
}

/* PDF specific — must stay red */
html body.page #kb-download-pdf,
html body.single #kb-download-pdf,
html body.single-kb_article #kb-download-pdf {
    background: #dc2626 !important;
    color: #fff !important;
    border-color: #dc2626 !important;
    -webkit-text-fill-color: #fff !important;
}

/* Share button — must stay purple, max specificity */
html body.page .kb-doc-topbar button.kb-doc-topbar-btn.kb-doc-topbar-btn-share,
html body.single .kb-doc-topbar button.kb-doc-topbar-btn.kb-doc-topbar-btn-share,
html body.single-kb_article .kb-doc-topbar button.kb-doc-topbar-btn.kb-doc-topbar-btn-share,
html body .kb-doc-topbar button#kb-share-btn,
html body button#kb-share-btn {
    background: #667eea !important;
    color: #fff !important;
    border-color: #667eea !important;
    -webkit-text-fill-color: #fff !important;
}
html body.page .kb-doc-topbar button.kb-doc-topbar-btn.kb-doc-topbar-btn-share:hover,
html body.single .kb-doc-topbar button.kb-doc-topbar-btn.kb-doc-topbar-btn-share:hover,
html body button#kb-share-btn:hover {
    background: #5a67d8 !important;
    color: #fff !important;
    border-color: #5a67d8 !important;
    -webkit-text-fill-color: #fff !important;
}
html body .kb-doc-topbar button#kb-share-btn .dashicons,
html body button#kb-share-btn .dashicons {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

/* Dashicons inside buttons */
html body.page .kb-doc-topbar-btn .dashicons,
html body.single .kb-doc-topbar-btn .dashicons,
html body.single-kb_article .kb-doc-topbar-btn .dashicons {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: inherit !important;
    -webkit-text-fill-color: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    position: static !important;
    text-indent: 0 !important;
}

/* Fix visibilità pulsanti modal Media WordPress (Carica file, Inserisci nell'articolo) */
.media-modal .media-menu-item,
.media-modal .media-frame .media-menu-item,
#wp-media-modal .media-menu-item {
    background: #f0f0f1 !important;
    color: #1d2327 !important;
    border-bottom: 1px solid #c3c4c7 !important;
}
.media-modal .media-menu-item:hover,
.media-modal .media-frame .media-menu-item:hover,
#wp-media-modal .media-menu-item:hover {
    background: #dcdcde !important;
    color: #1d2327 !important;
}
.media-modal .media-menu-item.active,
.media-modal .media-frame .media-menu-item.active,
#wp-media-modal .media-menu-item.active {
    background: #fff !important;
    color: #1d2327 !important;
    border-right: 1px solid #fff !important;
}
.media-modal .media-toolbar .media-button,
.media-modal .media-button,
.media-modal .media-button-primary,
#wp-media-modal .media-button,
#wp-media-modal .media-button-primary {
    background: #2271b1 !important;
    color: #fff !important;
    border-color: #2271b1 !important;
}
.media-modal .media-toolbar .media-button:hover,
.media-modal .media-button:hover,
.media-modal .media-button-primary:hover,
#wp-media-modal .media-button:hover,
#wp-media-modal .media-button-primary:hover {
    background: #135e96 !important;
    color: #fff !important;
    border-color: #135e96 !important;
}
.media-modal .media-router,
#wp-media-modal .media-router {
    background: #f0f0f1 !important;
}
.media-modal .media-frame-title,
#wp-media-modal .media-frame-title {
    color: #1d2327 !important;
}

/* ═══════════════════════════════════════════════
   GLOBAL NAV - Menu navigazione principale
   ═══════════════════════════════════════════════ */
body.kb-has-global-nav { padding-top: 52px !important; }
body.admin-bar.kb-has-global-nav { padding-top: 84px !important; }

/* Nasconde header + hamburger del tema (Neve) quando c'è la nav KB */
body.kb-hide-theme-header header.header,
body.kb-hide-theme-header .header,
body.kb-hide-theme-header .nv-navbar,
body.kb-hide-theme-header .header-main-inner,
body.kb-hide-theme-header .header--row,
body.kb-hide-theme-header #header-grid,
body.kb-hide-theme-header .header-menu-sidebar,
body.kb-hide-theme-header #header-menu-sidebar,
body.kb-hide-theme-header .header-menu-sidebar-overlay,
body.kb-hide-theme-header .navbar-toggle-wrapper,
body.kb-hide-theme-header button.navbar-toggle,
body.kb-hide-theme-header .site-logo,
body.kb-hide-theme-header .nv-nav-wrap {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.kb-global-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99997;
    background: rgba(15,23,42,.96);
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 16px rgba(0,0,0,.2);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
/* Sotto la admin bar WP (#wpadminbar), altrimenti la nav fixed si sovrappone in testa */
body.admin-bar .kb-global-nav {
    top: 32px;
}
@media screen and (max-width: 782px) {
    body.admin-bar .kb-global-nav {
        top: 46px;
    }
}
.kb-global-nav-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 6px 24px;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 4px;
}
.kb-global-nav-logo {
    font-weight: 700;
    font-size: 16px;
    color: #fff !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.kb-global-nav-logo:hover { color: #e2e8f0 !important; }
.kb-global-nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 8px;
}
.kb-global-nav-toggle-bar {
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transition: transform .2s, opacity .2s;
}
.kb-global-nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.kb-global-nav-link {
    padding: 7px 12px;
    color: rgba(255,255,255,.9) !important;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    transition: background .2s, color .2s;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.kb-global-nav-link:hover { background: rgba(255,255,255,.12); color: #fff !important; }
.kb-global-nav-link.active { background: rgba(102,126,234,.4); color: #fff !important; }
.kb-global-nav-dropdown-wrap {
    position: relative;
    display: inline-block;
}
.kb-global-nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 200px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    border: 1px solid #e2e8f0;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .2s, visibility .2s, transform .2s;
    z-index: 100;
}
.kb-global-nav-dropdown-wrap.open .kb-global-nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.kb-global-nav-dropdown-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: #334155 !important;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    transition: background .2s;
}
.kb-global-nav-dropdown-link:hover { background: #f1f5f9; color: #1e293b !important; }
html.kb-dark .kb-global-nav-dropdown { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-global-nav-dropdown-link { color: #cbd5e1 !important; }
html.kb-dark .kb-global-nav-dropdown-link:hover { background: #334155; color: #f1f5f9 !important; }
@media (max-width: 992px) {
    .kb-global-nav-toggle { display: flex; }
    .kb-global-nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(15,23,42,.98);
        padding: 12px;
        gap: 4px;
        max-height: 0;
        overflow: hidden;
        transition: max-height .3s;
        border-bottom: 1px solid rgba(255,255,255,.08);
        box-shadow: 0 8px 24px rgba(0,0,0,.3);
    }
    .kb-global-nav-menu.open { max-height: 80vh; overflow-y: auto; }
    .kb-global-nav-link { width: 100%; padding: 12px 16px; text-align: left; justify-content: flex-start; }
    .kb-global-nav-dropdown-wrap { width: 100%; }
    .kb-global-nav-dropdown {
        position: static; margin: 8px 0 8px 16px; transform: none; background: rgba(255,255,255,.08);
        max-height: 0; overflow: hidden; opacity: 1; visibility: visible;
        box-shadow: none; border: none; padding: 0 0 0 6px; border-left: 2px solid rgba(255,255,255,.3);
    }
    .kb-global-nav-dropdown-wrap.open .kb-global-nav-dropdown { max-height: 200px; }
    .kb-global-nav-dropdown-link { color: rgba(255,255,255,.85) !important; padding: 8px 12px; }
    .kb-global-nav-dropdown-link:hover { background: rgba(255,255,255,.12) !important; color: #fff !important; }
}
html.kb-dark .kb-global-nav { background: rgba(15,23,42,.98); }

/* Global bar: sotto il nav del plugin (mai sopra hamburger/logo) */
body.kb-has-global-nav #kb-global-bar { top: 68px; right: 16px; }
body.admin-bar.kb-has-global-nav #kb-global-bar {
    top: calc(32px + 52px + 12px);
    right: 16px;
}
@media screen and (max-width: 782px) {
    body.admin-bar.kb-has-global-nav #kb-global-bar {
        top: calc(46px + 52px + 12px);
    }
}
/* Smartphone/tablet: barra ancorata in basso (non copre header) */
@media (max-width: 992px) {
    body.kb-has-global-nav {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    }
    body.kb-has-global-nav #kb-global-bar,
    body.admin-bar.kb-has-global-nav #kb-global-bar {
        top: auto !important;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        padding: 8px 12px;
        gap: 8px;
        border-radius: 16px;
        z-index: 99996;
        box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
    }
    /* Se c'è il banner PWA, alza la barra */
    body.kb-has-global-nav:has(#kb-pwa-install:not([hidden])) #kb-global-bar {
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }
    body.kb-has-global-nav #kb-global-bar .kb-gb-label {
        display: none;
    }
    body.kb-has-global-nav #kb-global-bar .kb-gb-btn {
        padding: 10px 12px;
    }
    /* Dropdown notifiche verso l'alto */
    body.kb-has-global-nav #kb-global-bar .kb-gb-dropdown {
        top: auto;
        bottom: 100%;
        margin-top: 0;
        margin-bottom: 8px;
        width: min(320px, calc(100vw - 24px));
        right: 50%;
        transform: translateX(50%);
    }
}
@media screen and (max-width: 782px) {
    body.admin-bar.kb-has-global-nav #kb-global-bar {
        top: auto !important;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

/* ═══════════════════════════════════════════════
   GLOBAL BAR (ricerca, notifiche, dark mode)
   ═══════════════════════════════════════════════ */
.kb-global-bar {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15,23,42,.92);
    backdrop-filter: blur(12px);
    padding: 8px 12px;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,.08);
}
.kb-gb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
}
.kb-gb-btn:hover {
    background: rgba(255,255,255,.15);
    transform: translateY(-1px);
}
.kb-gb-btn .dashicons,
.kb-gb-ico {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}
.kb-gb-notifications-wrap { position: relative; }
.kb-gb-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kb-gb-badge:empty { display: none; }
.kb-gb-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 320px;
    max-height: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    border: 1px solid #e2e8f0;
    display: none;
}
.kb-gb-dropdown.show { display: block; }
.kb-gb-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kb-gb-dropdown-header strong { font-size: 14px; color: #1e293b; }
.kb-gb-dropdown-link { font-size: 12px; color: #667eea; text-decoration: none; }
.kb-gb-dropdown-body { padding: 8px; max-height: 320px; overflow-y: auto; }
.kb-gb-dropdown-item {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #334155;
    font-size: 13px;
    text-decoration: none;
    transition: background .2s;
}
.kb-gb-dropdown-item:hover { background: #f1f5f9; }
.kb-gb-dropdown-item strong { display: block; margin-bottom: 2px; }
.kb-gb-dropdown-item span { font-size: 11px; color: #94a3b8; }
.kb-gb-loading { padding: 16px; text-align: center; color: #94a3b8; font-size: 13px; }
html.kb-dark .kb-global-bar { background: rgba(15,23,42,.95); }
html.kb-dark .kb-gb-dropdown { background: #1e293b; border-color: #334155; }
html.kb-dark .kb-gb-dropdown-header { border-color: #334155; }
html.kb-dark .kb-gb-dropdown-header strong { color: #f1f5f9; }
html.kb-dark .kb-gb-dropdown-item { color: #cbd5e1; }
html.kb-dark .kb-gb-dropdown-item:hover { background: #334155; }

/* Ricerca globale overlay */
.kb-global-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}
.kb-global-search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
}
.kb-global-search-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,.3);
    overflow: hidden;
}
html.kb-dark .kb-global-search-modal { background: #1e293b; }
.kb-global-search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}
html.kb-dark .kb-global-search-header { border-color: #334155; }
.kb-global-search-header .dashicons,
.kb-global-search-lead {
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}
html.kb-dark .kb-global-search-header .dashicons,
html.kb-dark .kb-global-search-lead { color: #94a3b8; }
.kb-global-search-input {
    flex: 1;
    border: none;
    font-size: 18px;
    padding: 8px 0;
    outline: none;
    background: transparent;
    color: #1e293b;
}
html.kb-dark .kb-global-search-input { color: #f1f5f9; }
.kb-global-search-input::placeholder { color: #94a3b8; }
.kb-global-search-close {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
}
.kb-global-search-close:hover { background: #e2e8f0; }
.kb-global-search-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 12px;
}
.kb-global-search-hint {
    padding: 24px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}
.kb-global-search-result-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: #334155;
    margin-bottom: 4px;
    transition: background .2s;
}
.kb-global-search-result-item:hover { background: #f1f5f9; }
.kb-global-search-result-item .kb-gs-type {
    display: block;
    width: 100%;
    font-size: 10px;
    line-height: 1.35;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #667eea;
    font-weight: 700;
    flex: 0 0 auto;
    order: 0;
}
.kb-global-search-result-item .kb-gs-title {
    display: block;
    width: 100%;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    word-break: break-word;
    flex: 0 1 auto;
    order: 1;
}
.kb-global-search-result-item .kb-gs-excerpt {
    display: block;
    width: 100%;
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
    margin-top: 0;
    flex: 0 1 auto;
    order: 2;
}
html.kb-dark .kb-global-search-result-item { color: #e2e8f0; }
html.kb-dark .kb-global-search-result-item .kb-gs-excerpt { color: #94a3b8; }
html.kb-dark .kb-global-search-result-item:hover { background: #334155; }
.kb-global-search-result-item.kb-gs-selected { background: #eff6ff !important; border-left: 3px solid #3b82f6; }
html.kb-dark .kb-global-search-result-item.kb-gs-selected { background: #334155 !important; border-left-color: #3b82f6; }

/* =============================================================================
   Overlay / modal sopra KB global nav (99997), #kb-global-bar (99998) e wp-admin bar (~99999).
   Molti template usavano z-index 9999 e finivano sotto le barre fisse.
   ============================================================================= */
body .pl-overlay,
body .qt-overlay,
body .ac-modal-overlay,
body #ac-user-detail-modal-box,
body .td-modal-overlay,
body .kb-lightbox-overlay,
body .eq-modal-overlay,
body .pcp-modal-overlay,
body .pcp-detail-overlay,
body .ces-modal-overlay,
body .brd-modal-ov,
body #ld-create-modal,
body #ld-report-modal,
body #le-view-email-modal,
body #le-first-email-modal,
body .kpg-modal,
body .vlt-modal-ov,
body .qp-reject-modal,
body .kb-share-modal,
body .ctr-modal-overlay,
body .iv-modal-overlay,
body .rp-modal-overlay,
body .ex-modal-overlay,
body .pay-preview-modal,
body .kda-modal,
body .kb-modal-overlay,
body div.kb-global-search-overlay {
	z-index: 300050 !important;
}

/* =============================================================================
   PWA — banner Installa app (mobile)
   ============================================================================= */
.kb-pwa-install {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 300060;
    background: #0f172a;
    color: #f8fafc;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.45);
    padding: 14px 16px;
    font-family: inherit;
}
.kb-pwa-install[hidden] { display: none !important; }
.kb-pwa-install-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.kb-pwa-install-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.kb-pwa-install-text strong {
    font-size: 15px;
    font-weight: 700;
}
.kb-pwa-install-text span {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.35;
}
.kb-pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.kb-pwa-install-btn {
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.kb-pwa-install-btn:hover { background: #4338ca; }
.kb-pwa-install-dismiss {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}
.kb-pwa-ios-help {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.45;
}
.kb-pwa-ios-help[hidden] { display: none !important; }
@media (min-width: 901px) {
    .kb-pwa-install { display: none !important; }
}
body.admin-bar .kb-pwa-install { bottom: 12px; }