/* System Design Tokens & Variables */
:root {
    --bg-app: #fbf9f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f5efe6;
    --border-color: #e3dcd2;
    --border-focus: #d97706;
    
    /* Core Colors */
    --color-primary: #d97706;      /* Warm Amber/Gold */
    --color-secondary: #db2777;    /* Soft Rose */
    --color-success: #10b981;      /* Emerald Green */
    --color-error: #dc2626;        /* Soft Red */
    --color-warning: #d97706;      /* Amber */
    
    /* Text Colors */
    --text-main: #332822;          /* Warm dark charcoal/brown */
    --text-muted: #736257;         /* Warm brown text */
    --text-dark: #110e0c;          /* Deep warm dark */
    --text-white: #fdfcfc;          /* Deep warm dark */
    --text-white-50: #e7e7d7;          /* Deep warm dark */    
    
    /* Typography */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Shadows */
    --shadow-main: 0 10px 30px -10px rgba(51, 40, 34, 0.08);
    --shadow-glow: 0 0 15px rgba(217, 119, 6, 0.15);
}

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

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Decorative background glow */
body::before {
    content: '';
    position: absolute;
    top: -150px;
    left: -150px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, rgba(9, 13, 22, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: absolute;
    bottom: -150px;
    right: -150px;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, rgba(9, 13, 22, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

/* Layout Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px var(--color-primary));
    animation: pulseIcon 3s infinite ease-in-out;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text h1 span {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Server Status Badge */
.server-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.pinging {
    background-color: var(--color-warning);
    box-shadow: 0 0 8px var(--color-warning);
}

.status-indicator.online {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
    animation: glowSuccess 2s infinite alternate;
}

.status-indicator.offline {
    background-color: var(--color-error);
    box-shadow: 0 0 8px var(--color-error);
}

/* Main Body Layout */
.app-body {
    display: grid;
    grid-template-columns: 280px 1fr;
    flex: 1;
    overflow: hidden;
    transition: grid-template-columns 0.3s ease;
}

.app-body.no-sidebar {
    grid-template-columns: 1fr !important;
}

.app-body.sidebar-collapsed {
    grid-template-columns: 1fr !important;
}

.sidebar-toggle-btn {
    font-size: 1.1rem;
    padding: 8px 12px;
    line-height: 1;
}

.header-controls-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

/* Scrollable Sections */
.sidebar {
    padding: 1.5rem;
    height: 100%;
    overflow-y: auto;
}

.sidebar {
    padding: 1.5rem;
    overflow-y: visible;
    border-right: 1px solid var(--border-color);
    background: rgba(9, 13, 22, 0.4);
    display: flex;
    flex-direction: column;
    align-self: start;
}

.editor-section, .results-section {
    padding: 1.5rem;
    height: 100%;
    overflow-y: auto;
}

.editor-section {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.results-section {
    background: rgba(9, 13, 22, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Section Title */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1.2rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Document Selector Grid */
.document-selector-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.doc-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: inherit;
    width: 100%;
}

.doc-card:hover {
    background: var(--bg-card-hover);
    border-color: #d1c7bd;
    transform: translateY(-2px);
}

.doc-card.active {
    background: rgba(217, 119, 6, 0.08);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.card-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.doc-card.active .card-icon {
    background: rgba(217, 119, 6, 0.15);
    transform: scale(1.1);
}

.card-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.card-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.font-factura { color: #38bdf8; }
.font-boleta { color: #f472b6; }
.font-nota { color: #fb7185; }
.font-guia { color: #34d399; }
.font-resumen { color: #fbbf24; }
.font-baja { color: #f87171; }


/* Editor Styling */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.editor-wrapper {
    flex: 1;
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #060913;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

#jsonEditor {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 1.2rem;
    resize: none;
    outline: none;
    tab-size: 4;
    line-height: 1.6;
}

#jsonEditor:focus-within {
    box-shadow: 0 0 0 1px var(--color-primary);
}

/* Buttons */
.btn {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary {
    background: #f4ede2;
    border-color: #d1c7bd;
    color: #5c4d43;
}

.btn-secondary:hover {
    background: #eae1d4;
    color: #332822;
    border-color: #b5a99e;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4);
    filter: brightness(1.1);
}

.btn-large {
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    border-radius: 10px;
}

.btn-send {
    width: 100%;
}

.status-text {
    color: #d8d8c6;
}

.send-action-wrapper {
    margin-top: 0.5rem;
}

/* Loader Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.spinner.hidden {
    display: none;
}

/* Results Content Area */
.results-container {
    flex: 1;
    min-height: 250px;
    display: flex;
    flex-direction: column;
}

/* Placeholder State */
.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    gap: 0.8rem;
}

.placeholder-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.result-placeholder h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.result-placeholder p {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 280px;
}

/* Loading State card */
.result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    gap: 1rem;
}

.pulse-loader {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary);
    animation: pulseRing 1.5s infinite ease-in-out;
}

.result-loading h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.result-loading p {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 280px;
}

/* Result Cards Base styles */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.success-card {
    border-left: 4px solid var(--color-success);
}

.failure-card {
    border-left: 4px solid var(--color-error);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.result-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.result-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.result-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-error);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.result-id {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.result-content {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-content h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cdr-desc {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.8rem;
    border-radius: 8px;
}

/* Notes & Alert box */
.alert-box {
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
}

.note-box {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
    color: #fbd38d;
}

.notes-list {
    margin-left: 1.2rem;
    margin-top: 0.4rem;
}

.error-msg-box {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    padding: 1rem;
    border-radius: 8px;
    color: #fca5a5;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.error-msg-box strong {
    font-size: 0.9rem;
}

.error-advice {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* File Download Cards */
.file-downloads {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.file-downloads h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
}

.download-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.btn-download {
    background: #faf8f5;
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.8rem;
    text-align: left;
    width: 100%;
}

.btn-download:hover {
    background: #f4ede2;
    border-color: #d1c7bd;
}

.dl-icon {
    font-size: 1.4rem;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-download.xml .dl-icon {
    color: var(--color-primary);
    background: rgba(6, 182, 212, 0.1);
}

.btn-download.zip .dl-icon {
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.1);
}

.dl-details strong {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
}

.dl-details span {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* API Response Console */
.api-console-wrapper {
    margin-top: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: #030712;
}

.console-toggle {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.console-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
}

.console-toggle .arrow {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.console-toggle.active .arrow {
    transform: rotate(180deg);
}

.console-body {
    border-top: 1px solid var(--border-color);
    max-height: 200px;
    overflow-y: auto;
    padding: 1rem;
}

#consoleJson {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #a7f3d0;
}
pre {
    background: #1e1b18 !important;
    border: 1px solid #e3dcd2 !important;
    padding: 15px !important;
    border-radius: 8px !important;
    overflow-x: auto;
}
pre code {
    color: #f5efe6 !important;
    font-family: 'JetBrains Mono', monospace !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}
code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
}
:not(pre) > code {
    background: #faf6f0 !important;
    color: #b45309 !important;
    border: 1px solid #e3dcd2 !important;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Helper Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; filter: drop-shadow(0 0 12px var(--color-primary)); }
}

@keyframes glowSuccess {
    from { box-shadow: 0 0 4px var(--color-success); }
    to { box-shadow: 0 0 12px var(--color-success); }
}

@keyframes pulseRing {
    0% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.5); }
    70% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 12px rgba(6, 182, 212, 0); }
    100% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

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

/* Responsive Scaling */
@media(max-width: 1100px) {
    .app-container {
        height: auto;
        min-height: 100vh;
    }

    .app-body {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
    }
    
    body {
        overflow-y: auto;
    }
    
    .sidebar, .editor-section, .results-section {
        height: auto;
        overflow-y: visible;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .main-content-section {
        height: auto !important;
        overflow-y: visible !important;
        padding: 1rem !important;
    }
    
    .editor-wrapper {
        min-height: 350px;
    }
}

@media(max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 15px;
        align-items: center;
        text-align: center;
        padding: 1.2rem;
    }
    .logo-area {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media(max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   CLIENT MANAGEMENT CSS
   ========================================== */
.clients-wrapper {
    margin-top: 15px;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.clients-layout {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 20px;
    min-height: 450px;
}

@media(max-width: 900px) {
    .clients-layout {
        grid-template-columns: 1fr;
    }
    .console-split-layout {
        grid-template-columns: 1fr !important;
    }
}

.client-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
}

.client-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--color-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input, select, textarea {
    background: #faf8f5 !important;
    border: 1px solid #e3dcd2 !important;
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-main) !important;
    font-size: 0.85rem;
    transition: all 0.25s ease;
    font-family: inherit;
    outline: none;
}

.form-group input:focus, select:focus, textarea:focus {
    border-color: var(--color-primary) !important;
    background: #ffffff !important;
    box-shadow: 0 0 8px rgba(217, 119, 6, 0.25) !important;
    outline: none;
}

select option {
    background-color: #1f2937;
    color: #f3f4f6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.file-help {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Client Table Styling */
.clients-table-wrapper {
    max-height: 450px !important;
    overflow-y: auto !important;
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.clients-table th {
    background: rgba(255, 255, 255, 0.03);
    text-align: left;
    padding: 10px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.clients-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.clients-table tr:hover {
    background: rgba(255, 255, 255, 0.01);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-expired {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

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

/* Spaced out Client Cards List */
.clients-list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 5px;
}

.client-item-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.client-item-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--color-primary);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.15);
}

.client-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.client-company-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.client-ruc {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 700;
}

.client-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.client-item-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.client-item-details strong {
    color: rgba(255, 255, 255, 0.7);
}

.client-token-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.04);
}

.client-token {
    font-family: 'Courier New', Courier, monospace;
    color: #38bdf8;
    overflow-x: auto;
    white-space: nowrap;
    max-width: 180px;
}

.btn-copy {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-copy:hover {
    opacity: 1;
}

.client-card-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
/* Modal overlay styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.modal-card {
    background: rgba(25, 20, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--color-primary);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.btn-close-modal:hover {
    color: #ef4444;
}

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

/* APISPERU Table styling */
.apisperu-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: var(--text-main);
}

.apisperu-table th {
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.apisperu-table td {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    vertical-align: middle;
}

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

/* Action dropdown */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-dropdown-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: background 0.2s;
}
.action-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.action-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 240px;
    width: max-content;
    max-width: 320px;
    background: #334155;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 6px 0;
    z-index: 100;
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}
.action-dropdown-menu.open {
    display: block;
}

.action-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.83rem;
    color: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-wrap: normal !important;
}
.action-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}
.action-item-delete {
    color: #f87171 !important;
}
.action-item-delete:hover {
    background: rgba(248, 113, 113, 0.12) !important;
}

.action-item-icon {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.action-item-badge {
    background: #e11d48;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: auto;
    line-height: 1.4;
}

.action-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 10px;
}

/* Toast Notification System */
.toast-notification {
    background: rgba(90, 120, 184, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px 20px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastFadeOut 0.3s 2.7s forwards;
    pointer-events: auto;
}

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

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

.toast-warning {
    border-left: 4px solid var(--color-warning);
}

.toast-info {
    border-left: 4px solid var(--color-primary);
}

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(50px); }
}

/* Guide Tabs Styling */
.guide-tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 6px;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.guide-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.8rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
}

.guide-tab-btn:hover {
    color: var(--color-primary);
}

.guide-tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.guide-tabs-nav::-webkit-scrollbar {
    height: 6px !important;
    display: block !important;
    background: #e2e8f0 !important;
}

.guide-tabs-nav::-webkit-scrollbar-thumb {
    background: #d97706 !important;
    border-radius: 4px !important;
}

/* Sub-tabs for JSON Examples */
.json-tabs-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    min-height: 480px;
}

.json-subtabs-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-right: 1px solid var(--border-color);
    padding-right: 15px;
}

.json-subtab-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.json-subtab-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
}

.json-subtab-btn.active {
    background: rgba(217, 119, 6, 0.08);
    color: var(--color-primary);
    font-weight: 600;
    border-color: rgba(217, 119, 6, 0.2);
}

.json-subtab-content {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.json-subtab-content h4 {
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 5px;
}

.json-subtab-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 10px;
}

.json-subtab-content pre {
    margin: 0;
}

@media (max-width: 768px) {
    .json-tabs-layout {
        grid-template-columns: 1fr;
    }
    .json-subtabs-nav {
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 10px;
    }
}

/* ==========================================
   STATISTICS GRID STYLING
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}

.stat-card-item {
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    padding: 18px !important;
    border-radius: 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    box-shadow: 0 4px 15px rgba(51, 40, 34, 0.05) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(51, 40, 34, 0.08) !important;
}

.stat-card-item .stat-icon {
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-item .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-item .stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark, #110e0c) !important;
    margin-top: 2px;
    line-height: 1.2;
}

/* ==========================================
   LANDING HERO & BANNER COMPONENT STYLES
   ========================================== */
.hero-card {
    background: linear-gradient(135deg, #ffffff 0%, #faf6f0 100%) !important;
    border: 1px solid var(--border-color) !important;
    padding: 40px 30px !important;
    border-radius: 16px !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
    box-shadow: var(--shadow-main) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.hero-logo-img {
    height: 80px;
    margin-bottom: 5px;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(51,40,34,0.08);
    border: 2px solid var(--border-color);
}

.hero-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
    background: linear-gradient(135deg, #3d2f24 30%, #b45309 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 700px;
    line-height: 1.5;
    margin: 0;
}

.hero-actions {
    display: flex;
    gap: 12px;
    margin-top: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.banner-gescomweb {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
    border: 1.5px solid #d97706 !important;
    padding: 30px 25px !important;
    border-radius: 16px !important;
    display: grid !important;
    grid-template-columns: 1.3fr 1fr;
    gap: 25px !important;
    align-items: center !important;
    box-shadow: 0 10px 25px rgba(217, 119, 6, 0.06) !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.banner-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.banner-badge {
    background: #d97706;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: bold;
    text-transform: uppercase;
    width: fit-content;
    letter-spacing: 0.5px;
}

.banner-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #78350f;
    margin: 0;
    line-height: 1.25;
}

.banner-text {
    font-size: 0.9rem;
    color: #92400e;
    line-height: 1.45;
    margin: 0;
    font-weight: 500;
}

.banner-list {
    list-style: none;
    padding: 0;
    margin: 5px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: #78350f;
}

.banner-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-left: 1px dashed rgba(217, 119, 6, 0.25);
    padding-left: 20px;
    text-align: center;
}

.banner-cta-icon {
    font-size: 2.4rem;
}

.banner-cta-title {
    margin: 0;
    font-size: 1rem;
    color: #78350f;
    font-weight: 700;
}

.banner-cta-sub {
    font-size: 0.75rem;
    color: #92400e;
    margin: 0;
}

.banner-btn {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    border: none !important;
    font-weight: bold !important;
    width: 100% !important;
    max-width: 220px !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.25) !important;
    color: #ffffff !important;
}

.header-logo-img {
    height: 38px;
    border-radius: 6px;
    border: 1.5px solid rgba(255,255,255,0.06);
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}

.auth-buttons-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.main-content-section {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 100%;
    box-sizing: border-box;
}

/* ==========================================
   STATISTICS GRID STYLING
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}

.stat-card-item {
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    padding: 18px !important;
    border-radius: 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    box-shadow: 0 4px 15px rgba(51, 40, 34, 0.05) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(51, 40, 34, 0.08) !important;
}

.stat-card-item .stat-icon {
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-item .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-item .stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark, #110e0c) !important;
    margin-top: 2px;
    line-height: 1.2;
}

/* ==========================================
   MOBILE HORIZONTAL SCROLL & RESPONSIVE FIXES
   ========================================== */
html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
}

*, *::before, *::after {
    box-sizing: border-box !important;
}

.app-container {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
}

.app-body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.clients-table-wrapper,
.table-responsive,
div[style*="overflow-x: auto"] {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y;
    display: block !important;
    box-sizing: border-box !important;
    padding-bottom: 8px !important;
}

.clients-table,
.apisperu-table {
    min-width: 700px !important;
    width: 100% !important;
}

/* Force visible styled scrollbar for horizontal scrolling containers on mobile */
.clients-table-wrapper::-webkit-scrollbar,
div[style*="overflow-x: auto"]::-webkit-scrollbar {
    height: 10px !important;
    display: block !important;
    background: #e2e8f0 !important;
}

.clients-table-wrapper::-webkit-scrollbar-track,
div[style*="overflow-x: auto"]::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
    border-radius: 5px !important;
}

.clients-table-wrapper::-webkit-scrollbar-thumb,
div[style*="overflow-x: auto"]::-webkit-scrollbar-thumb {
    background: #d97706 !important;
    border-radius: 5px !important;
    border: 2px solid #ffffff !important;
}

/* Subpanel & Admin Settings Cards */
.clients-subpanel {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.clients-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

.clients-list-header .section-title {
    margin: 0;
    font-size: 1.5rem;
    overflow-wrap: break-word;
}

.clients-list-header .btn {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    border: none;
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 8px;
    white-space: nowrap;
}

.admin-settings-card {
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(6, 182, 212, 0.03) !important;
    border: 1px solid rgba(6, 182, 212, 0.15) !important;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

.admin-settings-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.admin-settings-header .settings-icon {
    font-size: 1.4rem;
}

.admin-settings-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #03162f;
}

.admin-settings-header p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.admin-settings-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-top: 1px solid rgba(6, 182, 212, 0.1);
    padding-top: 15px;
    width: 100%;
}

.admin-settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.admin-setting-field {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
}

.admin-setting-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #070328;
}

.admin-setting-field input[type="number"] {
    width: 80px;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-main) !important;
    font-family: monospace;
    font-weight: bold;
    text-align: center;
}

.admin-setting-field select {
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-main) !important;
    font-weight: bold;
}

.token-field {
    flex-grow: 1;
    max-width: 550px;
    min-width: 0;
}

.token-field input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-main) !important;
    font-family: monospace;
    font-size: 0.78rem;
}

#btnSaveGlobalSettings {
    padding: 8px 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.table-card-container {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 0 !important;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
}

/* GLOBAL RESPONSIVE OVERRIDES FOR ALL MOBILE DEVICES */
@media (max-width: 768px) {
    html, body, .app-container, .app-body, .main-content-section, .clients-wrapper, .clients-subpanel {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    .main-content-section {
        padding: 0.75rem 0.5rem !important;
        gap: 12px !important;
    }

    /* ===== HEADER ===== */
    .app-header {
        padding: 0.8rem 0.6rem !important;
        flex-direction: column !important;
        gap: 10px !important;
        text-align: center !important;
    }

    .logo-text h1 {
        font-size: 1rem !important;
    }

    .logo-text p {
        font-size: 0.7rem !important;
    }

    .header-right {
        justify-content: center !important;
        width: 100% !important;
        gap: 6px !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .header-controls-group {
        flex-direction: row !important;
        justify-content: center;
        gap: 8px;
    }

    .server-status {
        font-size: 0.72rem !important;
        padding: 0.3rem 0.6rem !important;
        gap: 0.4rem !important;
        max-width: 100% !important;
        text-align: center !important;
    }

    .server-status .status-text {
        font-size: 0.7rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .auth-buttons-group {
        justify-content: center !important;
        width: 100% !important;
        gap: 6px !important;
        flex-wrap: wrap !important;
    }

    .auth-buttons-group .btn {
        padding: 6px 10px !important;
        font-size: 0.76rem !important;
        flex: 1 1 auto !important;
        min-width: 85px !important;
        text-align: center !important;
    }

    .btn-header-clients,
    .btn-header-users {
        width: 100% !important;
        font-size: 0.76rem !important;
        padding: 6px 10px !important;
    }

    /* ===== SIDEBAR ===== */
    .sidebar {
        width: 100% !important;
        min-width: 100% !important;
        padding: 8px 10px !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        background: #110e0c !important;
    }

    .sidebar .section-title {
        display: none !important;
    }

    .document-selector-grid {
        flex-direction: row !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        white-space: nowrap !important;
        gap: 6px !important;
        padding-bottom: 4px !important;
        width: 100% !important;
    }

    .doc-card {
        flex: 0 0 auto !important;
        width: auto !important;
        padding: 6px 12px !important;
        border-radius: 8px !important;
        align-items: center !important;
    }

    .doc-card .card-info h3 {
        font-size: 0.8rem !important;
    }

    .doc-card .card-info p {
        display: none !important;
    }

    .sidebar-footer {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        padding-top: 8px !important;
        margin-top: 4px !important;
        border-top: 1px solid rgba(255,255,255,0.08) !important;
    }

    /* ===== CARDS ===== */
    .client-card {
        padding: 14px 10px !important;
        border-radius: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* ===== ALL GRID CONTAINERS STACK VERTICALLY ===== */
    div[style*="grid-template-columns"],
    .features-grid,
    .plans-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ===== FORMS ===== */
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea,
    .form-group input[type="file"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 0.82rem !important;
    }

    .form-group label {
        font-size: 0.75rem !important;
    }

    /* Form panels - reduced padding */
    #clientsFormPanel .client-card,
    #clientsDetailsPanel .client-card,
    #clientProfilePanel .client-card,
    #myAccountPanel .client-card {
        padding: 16px 10px !important;
    }

    /* Form buttons stack vertically */
    #clientForm > div:last-child,
    #profileForm > div:last-child {
        flex-direction: column !important;
    }

    #clientForm > div:last-child .btn,
    #profileForm > div:last-child .btn {
        width: 100% !important;
        flex: none !important;
    }

    /* Form panel header layout */
    #clientsFormPanel > div:first-child,
    #clientsDetailsPanel > div:first-child,
    #myAccountPanel > div:first-child,
    #clientProfilePanel > div:first-child,
    #usersListPanel > div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    /* RUC input + consultar button */
    .form-group > div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .form-group > div[style*="display: flex"] .btn {
        width: 100% !important;
    }

    /* ===== HERO SECTION ===== */
    .hero-card {
        padding: 20px 12px !important;
        gap: 12px !important;
    }

    .hero-title {
        font-size: 1.15rem !important;
    }

    .hero-subtitle {
        font-size: 0.78rem !important;
        line-height: 1.4 !important;
    }

    .hero-actions {
        flex-direction: column !important;
        width: 100% !important;
    }

    .hero-actions .btn {
        width: 100% !important;
    }

    /* ===== BANNER GESCOMWEB ===== */
    .banner-gescomweb {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        padding: 16px 12px !important;
    }

    .banner-cta {
        border-left: none !important;
        border-top: 1px dashed rgba(217, 119, 6, 0.25) !important;
        padding-left: 0 !important;
        padding-top: 15px !important;
        align-items: center !important;
    }

    .banner-title {
        font-size: 1.15rem !important;
    }

    .banner-text {
        font-size: 0.8rem !important;
    }

    .banner-list {
        font-size: 0.78rem !important;
    }

    .banner-btn {
        max-width: 100% !important;
    }

    /* ===== FEATURES / PLANS GRIDS ===== */
    div[style*="minmax(280px"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    div[style*="minmax(200px"] {
        grid-template-columns: 1fr !important;
    }

    /* Plans cards - reduce inner padding */
    div[style*="padding: 30px"][style*="border-radius: 12px"][style*="text-align: center"] {
        padding: 20px 14px !important;
    }

    div[style*="font-size: 2.2rem"] {
        font-size: 1.6rem !important;
    }

    /* ===== CERT INFO / PRICING NOTICE BANNERS ===== */
    div[style*="align-items: center"][style*="gap: 15px"][style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    div[style*="align-items: center"][style*="gap: 15px"][style*="flex-wrap: wrap"] > a.btn,
    div[style*="align-items: center"][style*="gap: 15px"][style*="flex-wrap: wrap"] > button.btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* ===== SUBSCRIPTION / NOTIFICATION ALERT BANNERS ===== */
    .subscription-status-card,
    .admin-alert-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 12px !important;
    }

    .subscription-status-card .btn,
    .admin-alert-banner .btn {
        width: 100% !important;
        text-align: center !important;
    }

    .sub-card-info,
    .alert-info-group {
        width: 100% !important;
    }

    .sub-card-info > div,
    .alert-info-group > div {
        font-size: 0.8rem !important;
    }

    /* ===== ADMIN SETTINGS WIDGET ===== */
    .clients-list-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .admin-settings-card {
        padding: 14px 10px !important;
    }

    .admin-settings-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .admin-settings-row[style*="flex-wrap: nowrap"],
    .admin-settings-row[style*="flex-wrap:nowrap"] {
        flex-wrap: wrap !important;
    }

    /* Override inline min-width on generate cert sections */
    #btnDashboardGenCert {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Confirmation dialog buttons */
    #btnConfirmCancel,
    #btnConfirmAccept {
        min-width: 0 !important;
        flex: 1 1 auto !important;
        max-width: none !important;
    }

    .admin-setting-field {
        width: 100% !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }

    .admin-setting-field select,
    .admin-setting-field input[type="number"] {
        width: 100% !important;
    }

    .token-field {
        max-width: 100% !important;
        width: 100% !important;
    }

    .token-field input {
        width: 100% !important;
    }

    /* ===== COMPANY STATS CARDS (768px) ===== */
    .company-stat-metrics {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .company-stat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    #btnSaveGlobalSettings {
        width: 100% !important;
        padding: 10px 20px !important;
    }

    /* ===== STATS GRID ===== */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .stat-card-item {
        padding: 12px !important;
        gap: 10px !important;
    }

    .stat-card-item .stat-icon {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        font-size: 1.1rem !important;
    }

    .stat-card-item .stat-label {
        font-size: 0.62rem !important;
        letter-spacing: 0 !important;
    }

    .stat-card-item .stat-val {
        font-size: 1.05rem !important;
    }

    /* ===== CLIENT TABLE / LIST ===== */
    .clients-table-wrapper {
        overflow-x: scroll !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 70vh !important;
        padding-bottom: 10px !important;
    }

    .clients-table-wrapper::-webkit-scrollbar {
        height: 10px !important;
        display: block !important;
        background: #e2e8f0 !important;
    }

    .clients-table-wrapper::-webkit-scrollbar-thumb {
        background: #d97706 !important;
        border-radius: 5px !important;
    }

    .clients-list-container {
        max-height: none !important;
    }

    .client-item-header {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .client-token-row {
        flex-wrap: wrap !important;
    }

    .client-token {
        max-width: 100% !important;
        font-size: 0.72rem !important;
    }

    /* ===== CLIENT DETAILS VIEW ===== */
    #clientsDetailsPanel .client-card > div > div {
        font-size: 0.8rem !important;
    }

    #clientsDetailsPanel span[style*="margin-left: 10px"] {
        margin-left: 0 !important;
        display: block !important;
        margin-top: 2px !important;
    }

    #detToken,
    #profToken,
    #detQueryToken,
    #profQueryToken {
        font-size: 0.72rem !important;
        padding: 8px !important;
    }

    #clientsDetailsPanel div[style*="display: flex"][style*="gap: 8px"],
    #clientProfilePanel div[style*="display: flex"][style*="gap: 8px"] {
        flex-direction: column !important;
    }

    #clientsDetailsPanel div[style*="display: flex"][style*="gap: 8px"] input,
    #clientProfilePanel div[style*="display: flex"][style*="gap: 8px"] input {
        width: 100% !important;
    }

    #clientsDetailsPanel div[style*="display: flex"][style*="gap: 8px"] .btn,
    #clientProfilePanel div[style*="display: flex"][style*="gap: 8px"] .btn {
        width: 100% !important;
        padding: 10px !important;
    }

    /* ===== CERT GENERATE SECTION ===== */
    div[style*="display: flex"][style*="justify-content: space-between"][style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    /* ===== CLIENT FORM CHECKBOX ROWS ===== */
    div[style*="display: flex"][style*="align-items: center"][style*="gap: 8px"] > input[type="checkbox"] {
        min-width: 18px !important;
        min-height: 18px !important;
    }

    div[style*="display: flex"][style*="align-items: center"][style*="gap: 8px"] > label {
        font-size: 0.75rem !important;
    }

    /* ===== NO EXPIRATION CHECKBOX ROW ===== */
    div[style*="display: flex"][style*="align-items: center"][style*="gap: 8px"][style*="margin-top: 4px"] {
        flex-wrap: wrap !important;
    }

    /* ===== INTEGRATION GUIDE TABS ===== */
    .guide-tabs-nav {
        gap: 4px !important;
        padding-bottom: 6px !important;
        margin-bottom: 15px !important;
    }

    .guide-tab-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.78rem !important;
    }

    .endpoint-url-code, code, pre {
        word-break: break-all !important;
        white-space: pre-wrap !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* ===== TOAST NOTIFICATIONS ===== */
    .toast-notification {
        min-width: 200px !important;
        font-size: 0.78rem !important;
        padding: 10px 14px !important;
        max-width: 90vw !important;
    }

    /* ===== MODAL ===== */
    .modal-card {
        width: 95% !important;
        padding: 20px 14px !important;
        max-height: 85vh !important;
    }

    .modal-header h3 {
        font-size: 1.05rem !important;
    }

    /* ===== ACTION DROPDOWN IN TABLE ===== */
    .action-dropdown-menu {
        min-width: 170px !important;
    }

    /* ===== MY ACCOUNT FORM ===== */
    #myAccountPanel div[style*="border-top: 1px dashed"][style*="margin: 25px 0"] {
        margin: 15px 0 !important;
        padding-top: 15px !important;
    }

    /* ===== GENERAL TEXT OVERFLOW PREVENTION ===== */
    .main-content-section * {
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }

    .stat-card-item {
        padding: 10px 8px !important;
        gap: 8px !important;
    }

    .stat-card-item .stat-icon {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        font-size: 1rem !important;
    }

    .stat-card-item .stat-val {
        font-size: 0.95rem !important;
    }

    .hero-title {
        font-size: 1rem !important;
    }

    .banner-title {
        font-size: 1rem !important;
    }

    .action-dropdown-menu {
        min-width: 150px !important;
        max-width: 260px !important;
    }
    .action-dropdown-item {
        font-size: 0.78rem !important;
        padding: 6px 12px !important;
    }

    /* ===== COMPANY STATS CARDS (480px) ===== */
    .company-stat-card {
        padding: 14px 12px !important;
    }

    .company-stat-metrics {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .company-metric-val {
        font-size: 1rem !important;
    }

    .company-stat-name {
        font-size: 0.88rem !important;
    }
}

    /* ===== COMPANY STATS CARDS ===== */
    .company-stat-card {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border: 1px solid rgba(99, 102, 241, 0.35);
        border-radius: 14px;
        padding: 18px 20px !important;
        display: flex;
        flex-direction: column;
        gap: 14px;
        transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    }

    .company-stat-card:hover {
        border-color: rgba(99, 102, 241, 0.6);
        transform: translateY(-1px);
        box-shadow: 0 6px 28px rgba(99, 102, 241, 0.2);
    }

    .company-stat-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: wrap;
    }

    .company-stat-name {
        font-weight: 700;
        font-size: 0.95rem;
        color: #f1f5f9;
        margin: 0;
    }

    .company-stat-ruc {
        font-size: 0.78rem;
        color: #94a3b8;
        font-family: monospace;
    }

    .company-stat-badges {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

    .company-badge {
        padding: 3px 10px;
        border-radius: 20px;
        font-size: 0.7rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        white-space: nowrap;
    }

    .company-badge.badge-active {
        background: rgba(34, 197, 94, 0.25);
        color: #4ade80;
        border: 1px solid rgba(34, 197, 94, 0.45);
    }

    .company-badge.badge-blocked {
        background: rgba(239, 68, 68, 0.25);
        color: #f87171;
        border: 1px solid rgba(239, 68, 68, 0.45);
    }

    .company-badge.badge-premium {
        background: rgba(251, 191, 36, 0.25);
        color: #fbbf24;
        border: 1px solid rgba(251, 191, 36, 0.45);
    }

    .company-badge.badge-free {
        background: rgba(148, 163, 184, 0.18);
        color: #cbd5e1;
        border: 1px solid rgba(148, 163, 184, 0.35);
    }

    .company-stat-metrics {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .company-metric {
        text-align: center;
        padding: 10px 4px;
        background: rgba(30, 41, 59, 0.7);
        border: 1px solid rgba(71, 85, 105, 0.25);
        border-radius: 8px;
    }

    .company-metric-val {
        font-size: 1.2rem;
        font-weight: 800;
        color: #f1f5f9;
        line-height: 1.2;
    }

    .company-metric-label {
        font-size: 0.65rem;
        color: #94a3b8;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-top: 3px;
        font-weight: 600;
    }

    .company-stat-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        font-size: 0.8rem;
        color: #94a3b8;
        flex-wrap: wrap;
    }

    .company-stat-footer span {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .company-acceptance-bar {
        height: 6px;
        background: rgba(71, 85, 105, 0.4);
        border-radius: 3px;
        overflow: hidden;
        width: 100%;
    }

    .company-acceptance-fill {
        height: 100%;
        border-radius: 2px;
        transition: width 0.4s ease;
    }
}
