:root {
    --bg-darker: #0f172a;
    --bg-panel: #1e293b;
    --border: #334155;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --wallet-bg: #0f172a;
    --radius-lg: 16px;
    --radius-md: 8px;

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-darker);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Utilities */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-black { color: #000; }
.mb-1 { margin-bottom: 1rem; }
.mt-small { margin-top: 0.25rem; display: block;}
.w-full { width: 100%; }
.hidden { display: none !important; }

/* =============================================
   AUTH SCREENS
   ============================================= */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: radial-gradient(ellipse at top, #1e293b 0%, #0f172a 70%);
}

.auth-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    display: block;
}
.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.auth-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
}
.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
}
.auth-links a:hover { text-decoration: underline; }
.auth-links p { margin-top: 0.75rem; }

/* =============================================
   DASHBOARD LAYOUT (Sidebar + Main)
   ============================================= */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    overflow: hidden;
}

.mobile-top-nav { display: none; }


.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-user span,
.sidebar.collapsed .sidebar-divider {
    display: none;
}
.sidebar.collapsed .sidebar-header {
    justify-content: center;
}
.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}
.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.85rem;
}
.sidebar.collapsed .sidebar-user {
    justify-content: center;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-brand i { color: var(--primary); font-size: 1.5rem; }
.sidebar-brand-text { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: 0.2s;
}
.sidebar-toggle:hover { background: var(--border); color: var(--text-main); }

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
    width: 100%;
    text-align: left;
}
.sidebar-link:hover { background: rgba(255,255,255,0.04); color: var(--text-main); }
.sidebar-link.active { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.sidebar-link i { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-user i { font-size: 1.25rem; }

/* Main Content Area */
.dashboard-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}
.sidebar.collapsed ~ .dashboard-main {
    margin-left: var(--sidebar-collapsed);
}

.dashboard-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* =============================================
   WALLETS BAR (inside Conversiones)
   ============================================= */
.wallets-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.wallet-card {
    background: var(--wallet-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.wallet-card.highlight {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.05);
}

.wallet-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}
.wallet-card h2 {
    font-size: 1.35rem;
    font-weight: 700;
    white-space: nowrap;
}

.wallet-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* =============================================
   PANELS, FORMS, TABS (shared)
   ============================================= */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.operations-panel h3 {
    margin-bottom: 0.25rem;
    font-size: 1.15rem;
}

/* Tabs */
.tabs-header {
    display: flex;
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    padding: 0.35rem;
    margin-bottom: 1.5rem;
    gap: 0.25rem;
    overflow-x: auto;
}

.tab-link {
    flex: 1;
    padding: 0.85rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.tab-link.active {
    background: var(--bg-panel);
    color: var(--text-main);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-check-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    background: rgba(255,255,255,0.03);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    cursor: pointer;
}
.form-check-group label {
    cursor: pointer;
    margin: 0;
    user-select: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    color: var(--text-main);
    font-size: 0.95rem;
    width: 100%;
}
input:focus {
    outline: none;
    border-color: var(--primary);
}
input:read-only {
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
}

/* Input Wrappers */
.input-with-action, .input-with-lock {
    position: relative;
    display: flex;
}
.input-with-action input, .input-with-lock input {
    padding-right: 3.5rem;
}

.btn-inside {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    background: var(--border);
    color: var(--text-main);
    border: none;
    border-radius: 4px;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-inside:hover { background: var(--text-muted); color: var(--bg-darker); }

.btn-icon {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 0 0.75rem;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
}
.btn-icon:hover { color: var(--text-main); }
.btn-icon.locked { color: var(--primary); }

/* Info Box */
.info-box {
    background: var(--bg-darker);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.info-box p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; line-height: 1.4;}
.info-box p:last-child { margin-bottom: 0; }
.preview-text { font-size: 1.05rem !important; color: var(--text-main) !important; margin-top: 0.5rem;}

/* Comision Tag (tooltip) */
.comision-tag {
    text-decoration: underline dotted;
    cursor: help;
    color: var(--text-main);
}

/* Warning Badge */
.warning-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--warning);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    padding: 0.3rem 0.6rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 4px;
}

/* Buttons */
.btn {
    border: none;
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.3);
}
.btn-sm {
    padding: 0.55rem 0.85rem;
    font-size: 0.8rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }

.btn-warning { background: var(--warning); color: black; }
.btn-warning:hover:not(:disabled) { filter: brightness(1.1); }

.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: white; }

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover:not(:disabled) { background: var(--border); }

/* =============================================
   TABLES
   ============================================= */
.table-responsive {
    overflow-x: auto;
    max-height: 600px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-darker);
    min-width: 700px;
}
th {
    background: var(--bg-panel);
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--border);
}
td {
    padding: 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.015); }

.table-op-cell { white-space: nowrap; }

.tag {
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.tag-a { background: rgba(59, 130, 246, 0.1); color: var(--primary); border: 1px solid rgba(59, 130, 246, 0.3); }
.tag-b { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.tag-c { background: rgba(34, 197, 94, 0.1); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }

/* =============================================
   ANALYTICS CARDS (Admin)
   ============================================= */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.analytics-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.analytics-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.analytics-data {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.analytics-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}
.analytics-value {
    font-size: 1.15rem;
    font-weight: 700;
}

/* =============================================
   MODAL
   ============================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}
.modal.show { display: flex; }
.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
}
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body { padding: 1.5rem; }
.close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.25rem; transition: 0.2s;}
.close-btn:hover { color: var(--text-main); transform: scale(1.1); }

/* =============================================
   TOAST
   ============================================= */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-weight: 600;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* =============================================
   FLOATING CALCULATOR WIDGET
   ============================================= */
.calc-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 280px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 900;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.calc-widget.minimized {
    transform: translateY(150%);
    opacity: 0;
    pointer-events: none;
}

.calc-header {
    background: var(--bg-darker);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.calc-controls {
    display: flex;
    gap: 8px;
}

.calc-controls button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
}

.calc-controls button:hover {
    color: var(--text-main);
}

.calc-body {
    position: relative;
    background: var(--bg-darker);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    overflow: hidden;
}

.calc-history-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(4px);
    z-index: 10;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.calc-history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
}

.calc-history-list::-webkit-scrollbar { width: 4px; }
.calc-history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.history-item {
    text-align: right;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: 0.2s;
}
.history-item:hover { background: rgba(255,255,255,0.05); }
.history-expr { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 2px; }
.history-res { color: var(--text-main); font-size: 1.1rem; font-weight: 600; }

.calc-display-container { padding: 15px; text-align: right; }

.calc-expression {
    min-height: 18px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    word-break: break-all;
}

.calc-display {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 2rem;
    font-weight: 700;
    text-align: right;
    padding: 0;
}

.calc-display:focus {
    outline: none;
    border-color: transparent;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    padding: 1px;
}

.calc-btn {
    background: var(--bg-panel);
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 500;
    padding: 15px 0;
    cursor: pointer;
    transition: 0.1s;
}

.calc-btn:hover { background: rgba(255,255,255,0.05); }
.calc-btn:active { background: rgba(255,255,255,0.1); }

.calc-btn-op { color: var(--primary); background: var(--bg-darker); }
.calc-btn-op:hover { background: var(--bg-panel); }

.calc-btn-eq { background: var(--primary); color: white; }
.calc-btn-eq:hover { background: var(--primary-hover); }

/* Minimized Button */
.calc-minimized-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.calc-minimized-btn:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.calc-minimized-btn.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* Calculator Tooltips (Bubbles) */
.tooltip.bubble {
    position: fixed;
    background: var(--primary);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    animation: bounce 2s infinite;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    text-align: center;
}

.tooltip.bubble.show { opacity: 1; }

#tooltipOpenCalc { bottom: 85px; right: 15px; }
#tooltipOpenCalc .tooltip-arrow-down {
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--primary);
}

#tooltipMinCalc { z-index: 1010; }
#tooltipMinCalc .tooltip-arrow-down {
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--primary);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* =============================================
   TASAS AL MOMENTO (Cyber/Tech Aesthetic)
   ============================================= */
.tasas-tech-canvas {
    background: #0f172a;
    border-radius: 16px;
    border: 1px solid #334155;
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    color: #f8fafc;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    font-family: 'Inter', sans-serif;
}
.tech-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 1rem;
}
.tech-header h2 {
    color: #38bdf8;
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
}
.tech-header p {
    color: #94a3b8;
    margin: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.pulse-icon {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

.tech-hero-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #38bdf8;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}
.tech-hero-label {
    color: #38bdf8;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}
.tech-hero-val {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
}
.tech-hero-val small {
    font-size: 1.2rem;
    color: #94a3b8;
    font-weight: 500;
}
.tech-hero-status {
    margin-top: 0.5rem;
}
.tasa-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-auto { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid #22c55e; }
.badge-manual { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid #a855f7; }
.badge-fallback { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid #f59e0b; }

.tech-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}
.tech-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}
.tech-card:hover {
    transform: translateY(-2px);
    border-color: #64748b;
}
.card-head {
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}
.card-rate {
    font-size: 1.2rem;
    font-weight: 800;
    color: #f8fafc;
    margin-bottom: 1rem;
}
.tooltip-icon {
    margin-right: 4px;
    color: #64748b;
    cursor: help;
}
.card-input-wrapper input {
    width: 100%;
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #fff !important;
    padding: 0.5rem !important;
    text-align: center;
    border-radius: 4px !important;
    font-weight: 700;
    transition: 0.3s;
}
.card-input-wrapper input:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2) !important;
    outline: none;
}

.brecha-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed #475569;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.brecha-huge {
    font-size: 1.8rem;
    font-weight: 900;
}
.brecha-huge.positive { color: #4ade80; }
.brecha-huge.negative { color: #ef4444; }

.tech-kontigo {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.kontigo-label {
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 1px;
}
.kontigo-val {
    font-size: 1.2rem;
    font-weight: 800;
}

.tech-output-box {
    background: #000;
    border: 2px solid #38bdf8;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
    box-shadow: 0 0 15px rgba(56,189,248,0.2) inset;
}
.tech-output-box h3 {
    margin: 0;
    font-size: 2rem;
    color: #38bdf8;
    font-weight: 900;
    font-family: monospace;
    transition: 0.2s;
}
.tech-output-box h3.flash {
    color: #fff;
    transform: scale(1.05);
}

.tech-footer {
    text-align: center;
    color: #64748b;
    font-size: 0.75rem;
    border-top: 1px solid #1e293b;
    padding-top: 1rem;
}

.is-admin-editable {
    cursor: pointer;
    border-bottom: 1px dashed rgba(255,255,255,0.5);
    transition: 0.2s;
}
.is-admin-editable:hover {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    /* MÓVIL: Sidebar flotante superpuesto */
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        box-shadow: 10px 0 40px rgba(0,0,0,0.8);
        z-index: 1000 !important;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    /* Restaurar visualización completa interna del sidebar al abrirse en móvil */
    .sidebar .sidebar-brand-text,
    .sidebar .sidebar-link span,
    .sidebar .sidebar-user span,
    .sidebar .sidebar-divider { display: block; }
    .sidebar .sidebar-header { justify-content: space-between; }
    .sidebar .sidebar-brand { justify-content: flex-start; }
    .sidebar .sidebar-link { justify-content: flex-start; padding: 0.85rem 1rem; }
    .sidebar .sidebar-user { justify-content: flex-start; }

    /* Contenido Principal a full width */
    .dashboard-main {
        margin-left: 0;
        padding: 1rem;
        padding-top: 70px; /* Para la barra móvil falsa */
    }

    /* Barra Superior para Móviles (Inyectada por JS) */
    .mobile-top-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: var(--bg-darker);
        border-bottom: 1px solid var(--border);
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        z-index: 50;
        padding: 0 1rem;
    }
    .mobile-menu-btn {
        background: none;
        border: none;
        color: var(--text-main);
        font-size: 1.5rem;
        cursor: pointer;
    }
    .mobile-brand {
        font-weight: 700;
        color: white;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .mobile-brand span {
        background: linear-gradient(135deg, var(--primary), var(--success));
        color: white;
        padding: 2px 8px;
        border-radius: 6px;
        font-size: 0.9rem;
    }

    /* Wallets en Grid 2x2 para no aplastar hacia abajo */
    .wallets-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .wallet-card {
        min-width: unset;
        padding: 0.75rem;
    }
    .wallet-card h2 {
        font-size: 1.1rem; /* Más pequeño para que quepa */
    }
    .wallet-title {
        font-size: 0.65rem;
    }
    
    /* Arreglo: Header BCV para que no se monte el texto */
    .tech-header p, .tech-header h2 {
        font-size: 1.2rem;
    }
    .tasas-tech-canvas .text-sm {
        font-size: 0.7rem;
    }
    
    /* Grids a 1 columna (excepto wallets) */
    .tech-grid, .analytics-grid {
        grid-template-columns: 1fr;
    }

    /* Arreglo: Evitar que las etiquetas del formulario revienten el grid */
    .form-group label {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    .form-row {
        grid-template-columns: 1fr; /* Forzar el apilamiento de inputs largos en el móvil */
    }

    /* Calculadora */
    .calc-num-btn { display: none; }
    .calc-display {
        border: 1px solid var(--border);
        border-radius: 6px;
        background: rgba(0,0,0,0.2);
        padding: 5px;
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}
