/* static/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-main: #070b14;
    --bg-sidebar: #0b1120;
    --bg-card: rgba(15, 23, 42, 0.85);
    --bg-card-hover: rgba(24, 34, 58, 0.9);
    --bg-input: #101827;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #38bdf8;
    
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: rgba(2, 132, 199, 0.15);
    
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.3);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(2, 132, 199, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
}

/* APP SHELL & SIDEBAR */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.sidebar-brand-text h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.sidebar-brand-text span {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.4);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(2, 132, 199, 0.2) 0%, rgba(6, 182, 212, 0.1) 100%);
    color: #38bdf8;
    border-left: 3px solid #38bdf8;
}

.nav-icon {
    font-size: 1.15rem;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.emisor-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(2, 132, 199, 0.2);
    border-radius: var(--radius-md);
}

.emisor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}

.emisor-badge strong {
    font-size: 0.82rem;
    display: block;
    color: #ffffff;
}

.emisor-badge small {
    font-size: 0.72rem;
    color: #fbbf24;
}

/* CONTENT WRAPPER */
.content-wrapper {
    margin-left: 260px;
    flex: 1;
    padding: 24px 32px 60px 32px;
    min-height: 100vh;
}

/* TOPBAR */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.topbar-title h1 {
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
}

.topbar-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* MAIN VIEWS */
.main-view {
    display: none;
}

.main-view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
    margin: 2px 0;
}

.stat-trend {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stat-trend.positive {
    color: #34d399;
    font-weight: 600;
}

/* DASHBOARD SPLIT */
.dashboard-split {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-top: 10px;
}

/* CARDS */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title h2 {
    font-size: 1.12rem;
    font-weight: 700;
    color: #ffffff;
}

.card-title .icon {
    color: var(--accent);
    font-size: 1.2rem;
}

/* DATA TABLE */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    padding: 12px 14px;
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-beta {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-active {
    background: var(--success-bg);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #34d399;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* SERVICE STATUS LIST */
.sunat-status-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.service-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.service-meta strong {
    font-size: 0.88rem;
    display: block;
    color: #ffffff;
}

.service-meta small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* FORMS */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 14px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.section-subtitle {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    font-weight: 700;
    margin: 16px 0 10px 0;
}

/* 2-COLUMN MAIN CONTAINER IN EMISION */
.main-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ITEMS CONTAINER */
.items-container {
    margin-top: 10px;
    background: rgba(13, 19, 33, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.items-header {
    display: grid;
    grid-template-columns: 2.2fr 0.8fr 0.9fr 1fr 1fr 36px;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(2, 132, 199, 0.1);
    font-size: 0.75rem;
    font-weight: 700;
    color: #38bdf8;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.item-row {
    display: grid;
    grid-template-columns: 2.2fr 0.8fr 0.9fr 1fr 1fr 36px;
    gap: 6px;
    padding: 8px 12px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.item-row input, .item-row select {
    padding: 6px 8px;
    font-size: 0.82rem;
}

.btn-remove {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    border-radius: var(--radius-sm);
    height: 28px;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.btn-remove:hover {
    background: var(--danger-bg);
}

.btn-add-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px dashed rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.84rem;
    margin-top: 10px;
    width: 100%;
}

.btn-add-item:hover {
    background: rgba(56, 189, 248, 0.2);
}

/* TOTALS SUMMARY */
.totals-summary {
    margin-top: 16px;
    padding: 14px;
    background: rgba(2, 132, 199, 0.06);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(2, 132, 199, 0.2);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.total-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.total-line.highlight {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 8px;
    margin-top: 4px;
}

.total-line.highlight .amount {
    color: #38bdf8;
}

/* ACTION BUTTONS */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* TABS */
.tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tab-btn {
    padding: 7px 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.tab-btn.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* PREVIEW FRAME */
.preview-frame-container {
    width: 100%;
    height: 480px;
    background: #ffffff;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* CODE VIEWER */
.code-viewer-container {
    background: #060911;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.code-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #0f172a;
    border-bottom: 1px solid var(--border-color);
}

.code-viewer-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #38bdf8;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
}

pre.code-block {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 14px;
    color: #e2e8f0;
    max-height: 440px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.4;
}

/* SUNAT STATUS CARD */
.sunat-status-card {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 14px;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.status-tag {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.cdr-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.cdr-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.cdr-item strong {
    color: var(--text-secondary);
    display: block;
    font-size: 0.72rem;
}

/* DOWNLOADS BAR */
.downloads-bar {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.btn-download {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
}

.btn-download-xml {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.btn-download-pdf {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* TOASTS */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 18px;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    font-size: 0.88rem;
    animation: slideUp 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

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

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

/* RESPONSIVE */
@media (max-width: 1024px) {
    .sidebar { width: 70px; }
    .sidebar-brand-text, .nav-label, .sidebar-footer { display: none; }
    .content-wrapper { margin-left: 70px; padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-split, .main-container { grid-template-columns: 1fr; }
}

/* =========================================================
   SUNAT CONFIGURATION & DIAGNOSTICS SUITE STYLING
========================================================= */
.config-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.config-subnav {
    display: flex;
    gap: 10px;
    background: rgba(11, 17, 32, 0.7);
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.config-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.config-nav-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
}

.config-nav-btn.active {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.25) 0%, rgba(6, 182, 212, 0.15) 100%);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.config-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.config-section.active {
    display: block;
}

/* CERTIFICATE INSPECTOR CARD */
.cert-inspector-card {
    background: linear-gradient(145deg, #0d1527 0%, #070c18 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-xl);
    padding: 24px;
    position: relative;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.08);
    margin-bottom: 20px;
}

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

.cert-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cert-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.cert-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.cert-detail-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: var(--radius-md);
}

.cert-detail-item label {
    font-size: 0.74rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}

.cert-detail-item span, .cert-detail-item code {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
}

.cert-detail-item code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #38bdf8;
    word-break: break-all;
}

.validity-bar-container {
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
}

.validity-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    border-radius: 999px;
    transition: width 0.5s ease;
}

/* FILE UPLOAD DROPZONE */
.dropzone {
    border: 2px dashed rgba(56, 189, 248, 0.35);
    background: rgba(2, 132, 199, 0.04);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 18px;
}

.dropzone:hover {
    border-color: #38bdf8;
    background: rgba(2, 132, 199, 0.08);
}

.dropzone-icon {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
}

.dropzone-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.dropzone-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* PRE-FLIGHT DIAGNOSTICS */
.preflight-summary-card {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.15) 0%, rgba(16, 185, 129, 0.1) 100%);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-xl);
    padding: 22px 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.preflight-status-title h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
}

.preflight-status-title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    transition: var(--transition);
}

.check-item:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.check-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.check-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
}

.check-icon.ok {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.check-icon.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.check-icon.error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.check-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
}

.check-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* CONNECTION TEST RESULT BOX */
.test-result-box {
    margin-top: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
    display: none;
}

.test-result-box.online {
    display: block;
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
    color: #34d399;
}

.test-result-box.offline {
    display: block;
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
}

/* MODAL OVERLAY & BOX */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-box {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 540px;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.modal-header h3 {
    font-size: 1.15rem;
    color: #ffffff;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.modal-close:hover {
    color: #ffffff;
}

/* =========================================================
   LIBROS ELECTRÓNICOS SUNAT (SIRE & PLE) CATALOG STYLING
========================================================= */
.books-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: rgba(11, 17, 32, 0.7);
    padding: 6px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.book-filter-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.book-filter-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.book-filter-btn.active {
    background: var(--bg-card);
    color: #ffffff;
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.book-filter-badge {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 9999px;
}

.badge-sire {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-ple {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.book-code-badge {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: #f1f5f9;
}

.filename-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #070d18;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.75rem;
    color: #94a3b8;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-box-large {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 900px;
    max-width: 95vw;
    max-height: 90vh;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.25s ease-out;
}

.preview-code-box {
    flex: 1;
    min-height: 260px;
    max-height: 420px;
    overflow: auto;
    background: #070d18;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 14px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #38bdf8;
    white-space: pre;
}

.preview-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    font-size: 0.82rem;
    border: 1px solid var(--border-color);
}

/* =========================================================
   ERP ENTERPRISE STYLING & SIDEBAR LABELS
========================================================= */
.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    padding: 12px 14px 4px 14px;
    text-transform: uppercase;
}

.erp-subnav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.erp-subnav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.erp-subnav-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.erp-subnav-btn.active {
    background: var(--bg-card);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.stock-badge-low {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}

.stock-badge-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}




