/**
 * BRBOS - Black Ring Business Operating System
 * Tema: Blanco Limpio + Dorado Premium
 */

/* ============================================
   CSS VARIABLES - LIGHT PREMIUM THEME
   ============================================ */
:root {
    --gold: #B8960C;
    --gold-light: #D4AD1A;
    --gold-dark: #96790A;
    --gold-bg: rgba(184, 150, 12, 0.06);
    --gold-border: rgba(184, 150, 12, 0.18);
    
    --bg-0: #f8f7f4;
    --bg-1: #ffffff;
    --bg-2: #ffffff;
    --bg-3: #faf9f7;
    --bg-4: #f3f1ed;
    --bg-5: #eae7e0;
    
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-dim: #aaaaaa;
    
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    
    --green: #16a34a;
    --green-bg: rgba(22, 163, 74, 0.08);
    --red: #dc2626;
    --red-bg: rgba(220, 38, 38, 0.06);
    --blue: #2563eb;
    --blue-bg: rgba(37, 99, 235, 0.06);
    --orange: #d97706;
    --orange-bg: rgba(217, 119, 6, 0.06);
    --purple: #7c3aed;
    --purple-bg: rgba(124, 58, 237, 0.06);
    --cyan: #0891b2;
    
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --shadow-gold: 0 4px 20px rgba(184, 150, 12, 0.15);
    
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { 
    font-size: 18px; 
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    background: var(--bg-0);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--gold-dark); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--gold); }

img { max-width: 100%; display: block; }

input, select, textarea, button {
    font-family: var(--font-body);
    font-size: 0.95rem;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-3); }
::-webkit-scrollbar-thumb { background: var(--bg-5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

::selection { background: rgba(184, 150, 12, 0.2); color: #1a1a1a; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f7f4 0%, #f0ede6 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(184, 150, 12, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(184, 150, 12, 0.04) 0%, transparent 40%);
    animation: loginBgFloat 20s ease-in-out infinite;
}

@keyframes loginBgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-2%, 1%) rotate(0.5deg); }
    50% { transform: translate(1%, -1%) rotate(-0.3deg); }
    75% { transform: translate(-1%, 2%) rotate(0.2deg); }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .logo-ring-big {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: var(--shadow-gold);
}

.login-logo .logo-ring-big::after {
    content: '';
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 15px rgba(184, 150, 12, 0.3);
}

.login-logo h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.login-logo p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
}

.login-form .form-group { margin-bottom: 20px; }

.login-form label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.login-form .input-wrap { position: relative; }

.login-form .input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 1rem;
    transition: color 0.2s;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--bg-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s var(--ease);
    outline: none;
}

.login-form input:focus {
    border-color: var(--gold);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(184, 150, 12, 0.1);
}

.login-form input:focus + i,
.login-form .input-wrap:focus-within i { color: var(--gold); }

.login-form input::placeholder { color: var(--text-dim); }

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    margin-top: 8px;
}

.btn-login:hover { transform: translateY(-1px); box-shadow: var(--shadow-gold); }
.btn-login:active { transform: translateY(0); }

.login-error {
    background: var(--red-bg);
    border: 1px solid rgba(220, 38, 38, 0.15);
    color: var(--red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-footer { text-align: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.login-footer span { font-size: 1rem; color: var(--text-dim); letter-spacing: 1px; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #1a1714;
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s var(--ease);
}

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

.sidebar-logo { display: flex; align-items: center; gap: 12px; }

.logo-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }

.logo-ring-mini {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    position: relative;
    box-shadow: 0 0 10px rgba(184, 150, 12, 0.25);
}

.logo-ring-mini::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gold);
}

.logo-text-wrap { display: flex; flex-direction: column; }
.logo-title { 
    font-family: var(--font-display); 
    font-size: 1.15rem; 
    font-weight: 700; 
    color: #f0ede6;
    line-height: 1.1;
}
.logo-sub { font-size: 0.72rem; color: rgba(255,255,255,0.35); letter-spacing: 2px; text-transform: uppercase; }

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: rgba(255,255,255,0.55);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s var(--ease);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255,255,255,0.85);
}

.nav-item.active {
    background: rgba(184, 150, 12, 0.12);
    color: var(--gold-light);
    border: 1px solid rgba(184, 150, 12, 0.2);
}

.nav-item.active i { color: var(--gold-light); }

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: rgba(255,255,255,0.3);
    transition: color 0.2s;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    color: #fff;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 4px; }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 1rem; font-weight: 600; color: rgba(255,255,255,0.85); }
.user-role { font-size: 0.95rem; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 1px; }

.logout-btn { color: #ef4444 !important; }
.logout-btn:hover { background: rgba(239,68,68,0.1) !important; }
.logout-btn i { color: #ef4444 !important; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s var(--ease);
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    height: var(--topbar-height);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.page-subtitle { font-size: 0.95rem; color: var(--text-muted); margin-top: -2px; }

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

/* Buscador Global */
.global-search {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 12px;
    transition: all 0.2s;
}

.global-search:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 150, 12, 0.08);
    background: #ffffff;
}

.global-search i { color: var(--text-dim); font-size: 1rem; }

.global-search input {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 8px 10px;
    width: 220px;
    outline: none;
    font-size: 1rem;
}

.global-search input::placeholder { color: var(--text-dim); }

.global-search kbd {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.95rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 999;
}

.search-results.active { display: block; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--gold-bg); }

.search-result-item .sri-name { font-size: 0.95rem; font-weight: 500; }
.search-result-item .sri-detail { font-size: 1rem; color: var(--text-muted); }

/* Notificaciones */
.topbar-notifications { position: relative; cursor: pointer; color: var(--text-secondary); font-size: 1rem; padding: 8px; }

.notif-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: var(--red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-date { display: flex; align-items: center; gap: 6px; font-size: 1rem; color: var(--text-muted); }

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content { padding: 28px; max-width: 1400px; }

/* ============================================
   CARDS
   ============================================ */
.card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color 0.2s;
    box-shadow: var(--shadow-sm);
}

.card:hover { border-color: var(--border-hover); }

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i { color: var(--gold); font-size: 0.95rem; }

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

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    border-color: var(--gold-border);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-accent, var(--gold));
}

.stat-label {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-detail {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-up { color: var(--green); }
.stat-down { color: var(--red); }

/* ============================================
   TABLES
   ============================================ */
.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; }

.data-table thead th {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.data-table tbody tr:hover { background: var(--bg-4); }

.data-table tbody td {
    padding: 12px 14px;
    font-size: 0.95rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table .td-name { font-weight: 600; }
.data-table .td-muted { color: var(--text-muted); font-size: 1rem; }

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-etapa {
    background: rgba(var(--badge-r, 100), var(--badge-g, 100), var(--badge-b, 100), 0.1);
    color: rgb(var(--badge-r, 200), var(--badge-g, 200), var(--badge-b, 200));
    border: 1px solid rgba(var(--badge-r, 100), var(--badge-g, 100), var(--badge-b, 100), 0.2);
}

.badge-gold { background: var(--gold-bg); color: var(--gold-dark); border: 1px solid var(--gold-border); }
.badge-green { background: var(--green-bg); color: var(--green); border: 1px solid rgba(22,163,74,0.15); }
.badge-red { background: var(--red-bg); color: var(--red); border: 1px solid rgba(220,38,38,0.15); }
.badge-blue { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(37,99,235,0.15); }
.badge-orange { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(217,119,6,0.15); }
.badge-purple { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(124,58,237,0.15); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    text-decoration: none;
    white-space: nowrap;
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #ffffff;
}
.btn-gold:hover { 
    transform: translateY(-1px); 
    box-shadow: var(--shadow-gold);
    color: #ffffff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gold-border);
    color: var(--gold-dark);
}
.btn-outline:hover { 
    background: var(--gold-bg);
    border-color: var(--gold);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { 
    background: var(--bg-4);
    color: var(--text-primary);
}

.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.88rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ============================================
   FORMS
   ============================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 18px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--gold);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(184, 150, 12, 0.08);
}

.form-input::placeholder { color: var(--text-dim); }

.form-textarea { resize: vertical; min-height: 100px; line-height: 1.5; }

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 12L2 6h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select option { background: #ffffff; color: var(--text-primary); }

/* ============================================
   GRID LAYOUTS
   ============================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

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

.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }
.mb-28 { margin-bottom: 28px; }
.mt-20 { margin-top: 20px; }

/* ============================================
   PIPELINE BAR
   ============================================ */
.pipeline-bar { display: flex; gap: 2px; margin-bottom: 28px; border-radius: var(--radius); overflow: hidden; }

.pipeline-stage {
    flex: 1;
    padding: 14px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.pipeline-stage:hover { filter: brightness(1.1); }

.pipeline-stage.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #fff;
}

.pipeline-count { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: #fff; line-height: 1; }
.pipeline-label { font-size: 0.95rem; color: rgba(255,255,255,0.8); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; color: var(--text-dim); margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.95rem; max-width: 400px; margin: 0 auto; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-success { background: var(--green-bg); border: 1px solid rgba(22,163,74,0.15); color: var(--green); }
.alert-error { background: var(--red-bg); border: 1px solid rgba(220,38,38,0.15); color: var(--red); }
.alert-warning { background: var(--orange-bg); border: 1px solid rgba(217,119,6,0.15); color: var(--orange); }
.alert-info { background: var(--blue-bg); border: 1px solid rgba(37,99,235,0.15); color: var(--blue); }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-title { font-size: 1rem; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
}

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   LOADING
   ============================================ */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gold);
    z-index: 99999;
    animation: loadSlide 1.5s ease infinite;
    display: none;
}

@keyframes loadSlide {
    0% { transform: scaleX(0); transform-origin: left; }
    50% { transform: scaleX(1); transform-origin: left; }
    50.1% { transform-origin: right; }
    100% { transform: scaleX(0); transform-origin: right; }
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar { height: 6px; background: var(--bg-5); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.6s var(--ease); }

/* ============================================
   TOOLTIP
   ============================================ */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #1a1a1a;
    color: #f0f0f0;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 1rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .global-search input { width: 160px; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999; }
    .sidebar-overlay.active { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .topbar { padding: 0 16px; }
    .page-content { padding: 16px; }
    .global-search { display: none; }
    .topbar-date { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .pipeline-bar { flex-wrap: wrap; }
    .pipeline-stage { min-width: 80px; }
    .flex-between { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.6rem; }
    .login-card { padding: 32px 24px; }
}

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

.animate-in { animation: fadeIn 0.4s var(--ease) both; }
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }

/* ============================================
   PRINT
   ============================================ */
@media print {
    .sidebar, .topbar, .btn, .menu-toggle { display: none !important; }
    .main-content { margin-left: 0 !important; }
    body { background: #fff; color: #000; }
    .card { border: 1px solid #ccc; }
}

/* ============================================
   BRBOS MOBILE READABILITY BOOST v4.0
   15 Feb 2026
   
   Problema: inline styles usan 0.48-0.65rem = ilegible en celular
   Solucion: override global con !important en mobile
   ============================================ */

/* === TABLET (<=1024px): Boost suave === */
@media (max-width: 1024px) {
    /* Base font bump */
    html { font-size: 17px !important; }
    
    /* Inputs y selects mas grandes para dedos */
    input, select, textarea, button {
        font-size: 1rem !important;
        min-height: 42px;
    }
    textarea { min-height: 48px !important; }
    
    /* Badges legibles */
    .badge, [class*="badge"] {
        font-size: 0.72rem !important;
        padding: 2px 8px !important;
    }
}

/* === MOBILE (<=768px): Boost fuerte === */
@media (max-width: 768px) {
    html { font-size: 18px !important; }
    
    /* --- NUCLEAR OVERRIDE: todo inline font-size < 0.75rem sube --- */
    /* Esto captura los inline styles de cliente_detalle.php y otros */
    
    /* Todo el body text minimo legible */
    body, body * {
        /* No forzamos todo, pero subimos el piso */
    }
    
    /* Cards y contenedores: padding mas generoso */
    .card, [class*="card"] {
        padding: 14px 16px !important;
    }
    
    /* Titulos de seccion (los .65rem inline) */
    .card > div:first-child,
    [style*="text-transform:uppercase"],
    [style*="text-transform: uppercase"],
    [style*="letter-spacing"] {
        font-size: 1rem !important;
    }
    
    /* Chat messages: texto principal */
    .ct, .cb .ct, 
    [class="ct"],
    .cb-ia .ct,
    .cb-u .ct {
        font-size: 0.92rem !important;
        line-height: 1.55 !important;
    }
    
    /* Chat IA label */
    .cia {
        font-size: 0.95rem !important;
    }
    
    /* Chat timestamps */
    .cti {
        font-size: 0.62rem !important;
    }
    
    /* Chat bubbles: mas padding */
    .cb {
        padding: 10px 14px !important;
        max-width: 92% !important;
    }
    
    /* Briefing card content */
    #briefingContent, #briefingContent * {
        font-size: 0.88rem !important;
        line-height: 1.6 !important;
    }
    #briefingContent [style*="font-size:0.48"],
    #briefingContent [style*="font-size:0.5"],
    #briefingContent [style*="font-size:0.55"] {
        font-size: 0.68rem !important;
    }
    
    /* Diagnostico card content */
    #diagContent, #diagContent * {
        font-size: 0.88rem !important;
        line-height: 1.6 !important;
    }
    
    /* Memoria items */
    #memoriaList [style*="font-size:0.65"],
    #memoriaList [style*="font-size:0.6"] {
        font-size: 0.82rem !important;
    }
    #memoriaList [style*="font-size:0.48"] {
        font-size: 0.95rem !important;
    }
    
    /* Seguimientos y Historial text */
    #segHistorial [style*="font-size:0.72"],
    #segHistorial [style*="font-size:0.7"] {
        font-size: 0.88rem !important;
        line-height: 1.5 !important;
    }
    #segHistorial [style*="font-size:0.58"],
    #segHistorial [style*="font-size:0.55"],
    #segHistorial [style*="font-size:0.52"] {
        font-size: 1rem !important;
    }
    
    /* Stats grid numbers */
    .stats-grid [style*="font-size:0.95"] {
        font-size: 1.15rem !important;
    }
    .stats-grid [style*="font-size:0.48"] {
        font-size: 0.95rem !important;
    }
    
    /* Header: nombre del cliente */
    h2[style*="font-size:1.1"] {
        font-size: 1.25rem !important;
    }
    
    /* Contact info line */
    [style*="font-size:0.7rem"][style*="flex-wrap"] {
        font-size: 0.95rem !important;
    }
    
    /* Notas */
    [style*="font-size:0.68"] {
        font-size: 0.82rem !important;
    }
    
    /* Quick prompt buttons */
    .cb-in button, 
    #chatForm button {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Chat input bigger */
    #chatInput, 
    [id="chatInput"] {
        font-size: 1rem !important;
        padding: 10px 12px !important;
        min-height: 44px !important;
    }
    
    /* Data table: texto legible */
    .data-table th { font-size: 0.88rem !important; }
    .data-table td { font-size: 0.95rem !important; padding: 10px 8px !important; }
    .data-table .td-name { font-size: 1rem !important; }
    .data-table .td-muted { font-size: 0.88rem !important; }
    
    /* Modal: todo mas grande */
    .modal { margin: 8px !important; max-height: 95vh !important; }
    .modal .form-label { font-size: 0.95rem !important; }
    .modal .form-select, 
    .modal .form-input, 
    .modal .form-textarea {
        font-size: 0.95rem !important;
        padding: 10px 12px !important;
    }
    .modal-title { font-size: 1.05rem !important; }
    .modal-body { padding: 16px !important; }
    
    /* Botones: area tactil minima 44px */
    .btn { 
        min-height: 40px !important; 
        font-size: 0.95rem !important;
        padding: 8px 16px !important;
    }
    .btn-sm { 
        min-height: 36px !important; 
        font-size: 0.88rem !important;
        padding: 6px 12px !important;
    }
    
    /* Page header */
    .page-title { font-size: 1.4rem !important; }
    .page-subtitle { font-size: 0.95rem !important; }
    
    /* Sidebar links */
    .sidebar .nav-link { font-size: 1rem !important; padding: 12px 16px !important; }
    
    /* Alert messages */
    .alert { font-size: 1rem !important; padding: 12px 16px !important; }
    
    /* Empty states */
    .empty-state h3 { font-size: 1.1rem !important; }
    .empty-state p { font-size: 1rem !important; }
    
    /* Topbar */
    .topbar { min-height: 56px !important; }
    .topbar .user-name { font-size: 0.95rem !important; }
    
    /* Transcripcion boxes */
    [style*="background:#f0fdf4"] {
        font-size: 0.82rem !important;
        line-height: 1.5 !important;
        padding: 10px 12px !important;
    }
}

/* === PHONE SMALL (<=480px): Override maximo === */
@media (max-width: 480px) {
    html { font-size: 18px !important; }
    
    /* Stats: 2 columns but bigger */
    .stats-grid { 
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 8px !important; 
    }
    .stats-grid > div { padding: 10px 12px !important; }
    
    /* Chat area taller en phone */
    [style*="height:360px"] {
        height: 50vh !important;
        min-height: 320px !important;
        max-height: 500px !important;
    }
    
    /* Chat input row: full width */
    #chatForm {
        gap: 6px !important;
    }
    #chatInput {
        font-size: 1rem !important;
    }
    
    /* Briefing: WhatsApp message box */
    #briefMsg, [id^="briefMsg"],
    [style*="font-size:0.78rem"][style*="white-space:pre-wrap"] {
        font-size: 0.95rem !important;
        line-height: 1.55 !important;
    }
    
    /* Copy buttons: full width, big touch target */
    [onclick*="clipboard"] {
        min-height: 44px !important;
        font-size: 0.82rem !important;
    }
    
    /* Filter buttons en clientes.php */
    .flex-between .btn-sm,
    .flex-between .btn {
        font-size: 0.95rem !important;
        padding: 6px 10px !important;
    }
    
    /* Client list: hide less important columns */
    .data-table th:nth-child(3),
    .data-table td:nth-child(3),
    .data-table th:nth-child(7),
    .data-table td:nth-child(7) {
        display: none !important;
    }
    
    /* Etapa badges inline */
    .badge {
        font-size: 1rem !important;
        padding: 3px 8px !important;
    }
    
    /* Page content less padding */
    .page-content { padding: 10px !important; }
    
    /* Cards less margin */
    .card { border-radius: 10px !important; }
    .mb-10 { margin-bottom: 8px !important; }
    .mb-12 { margin-bottom: 10px !important; }
    .mb-20 { margin-bottom: 14px !important; }
}

/* === GLOBAL: Minimum touch targets (accessibility) === */
@media (pointer: coarse) {
    /* Coarse pointer = finger/touch device */
    button, a.btn, [onclick], input[type="checkbox"] {
        min-height: 40px;
        min-width: 40px;
    }
    
    /* Bigger checkboxes */
    input[type="checkbox"] {
        width: 20px !important;
        height: 20px !important;
    }
    
    /* More space between clickable items */
    #segHistorial > div,
    #memoriaList > div {
        padding: 10px 0 !important;
    }
}

/* ============================================
   GLOBAL READABILITY BOOST
   Minimum font sizes for all elements
   ============================================ */
body { font-size: 1rem; }

/* Force minimum sizes on all text */
.page-content { font-size: 1rem; }
.page-content * { min-height: 0; }

/* Stat cards */
.stat-label { font-size: 0.82rem; }
.stat-value { font-size: 2.2rem; }
.stat-detail { font-size: 0.85rem; }

/* Tables */
.data-table thead th { font-size: 0.82rem; padding: 12px 16px; }
.data-table tbody td { font-size: 0.95rem; padding: 14px 16px; }

/* Nav items bigger */
.nav-item { font-size: 0.95rem; padding: 12px 16px; }
.nav-item i { font-size: 1rem; }

/* Badges readable */
.badge { font-size: 0.8rem; padding: 4px 12px; }
.nav-badge { font-size: 0.75rem; padding: 3px 8px; }

/* Pipeline */
.pipeline-count { font-size: 1.6rem; }
.pipeline-label { font-size: 0.8rem; }
.pipeline-stage { padding: 16px 18px; }

/* Cards */
.card { padding: 28px; }
.card-title { font-size: 1rem; }

/* Buttons */
.btn { font-size: 0.95rem; padding: 12px 22px; }
.btn-sm { padding: 8px 16px; font-size: 0.88rem; }

/* Forms */
.form-label { font-size: 0.85rem; }
.form-input, .form-select, .form-textarea { font-size: 1rem; padding: 12px 16px; }

/* Sidebar */
.logo-title { font-size: 1.25rem; }
.logo-sub { font-size: 0.72rem; }
.user-name { font-size: 0.9rem; }
.user-role { font-size: 0.75rem; }

/* Topbar */
.page-title { font-size: 1.5rem; }
.page-subtitle { font-size: 0.88rem; }
.topbar-date { font-size: 0.9rem; }
.global-search input { font-size: 0.9rem; width: 260px; }

/* Search results */
.search-result-item .sri-name { font-size: 0.95rem; }
.search-result-item .sri-detail { font-size: 0.82rem; }

/* Alerts */
.alert { font-size: 0.95rem; }

/* Empty state */
.empty-state h3 { font-size: 1.2rem; }
.empty-state p { font-size: 0.95rem; }

/* Modal */
.modal-title { font-size: 1.15rem; }
.modal-body { font-size: 0.95rem; }

/* Override any remaining tiny inline styles */
[style*="font-size:0.5"] { font-size: 0.72rem !important; }
[style*="font-size:0.52"] { font-size: 0.72rem !important; }
[style*="font-size:0.55"] { font-size: 0.75rem !important; }
[style*="font-size:0.58"] { font-size: 0.78rem !important; }
[style*="font-size:.5r"] { font-size: 0.72rem !important; }
[style*="font-size:.52r"] { font-size: 0.72rem !important; }
[style*="font-size:.55r"] { font-size: 0.75rem !important; }
[style*="font-size:.58r"] { font-size: 0.78rem !important; }
