/* ============================================================
   DISTRIBUIDORA — Sistema de diseño NEONEXUS
   Basado en el template visual provisto.
   Todas las páginas del sistema deben importar este archivo.
   ============================================================ */

:root {
    --bg: #05070d;
    --bg-2: #080d17;
    --panel: rgba(12, 19, 32, 0.78);
    --panel-2: rgba(16, 25, 42, 0.88);
    --panel-3: rgba(20, 31, 52, 0.92);
    --line: rgba(148, 163, 184, 0.16);
    --line-strong: rgba(56, 189, 248, 0.42);
    --text: #eef6ff;
    --muted: #8ea4c6;
    --soft: #b8c7dd;
    --cyan: #38f8ff;
    --blue: #3b82f6;
    --violet: #a855f7;
    --pink: #f472b6;
    --green: #34d399;
    --amber: #fbbf24;
    --red: #fb7185;
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
    --glow: 0 0 30px rgba(56, 248, 255, 0.18);
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body { font-family: 'Space Grotesk', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.85); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--cyan), var(--violet)); border-radius: 999px; }

/* ============================================================
   APP SHELL
   ============================================================ */
#app { width: 100%; height: 100%; }

.app-shell {
    width: 100%;
    height: 100vh;
    display: flex;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 5%, rgba(56, 248, 255, 0.17), transparent 34%),
        radial-gradient(circle at 80% 0%, rgba(168, 85, 247, 0.17), transparent 35%),
        radial-gradient(circle at 50% 100%, rgba(59, 130, 246, 0.13), transparent 45%),
        linear-gradient(145deg, #04060b 0%, #07101d 45%, #03050a 100%);
}

.app-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.026) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.026) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black 0%, transparent 78%);
}

.app-shell::after {
    content: "";
    position: absolute;
    width: 520px; height: 520px;
    border-radius: 999px;
    right: -180px; bottom: -170px;
    background: radial-gradient(circle, rgba(56, 248, 255, 0.11), transparent 70%);
    filter: blur(8px);
    pointer-events: none;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: 305px;
    height: 100%;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    background:
        linear-gradient(180deg, rgba(8, 13, 24, 0.98), rgba(6, 10, 18, 0.94)),
        radial-gradient(circle at 50% 0%, rgba(56, 248, 255, 0.12), transparent 42%);
    border-right: 1px solid rgba(56, 248, 255, 0.18);
    box-shadow: 16px 0 60px rgba(0, 0, 0, 0.36);
    display: flex;
    flex-direction: column;
    transition: width 0.28s ease;
    backdrop-filter: blur(22px);
}

.sidebar.collapsed { width: 88px; }

.sidebar.collapsed .brand-area {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 0 12px;
    gap: 8px;
}

.sidebar.collapsed .brand-copy,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-chevron,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .operator-card,
.sidebar.collapsed .mini-meter span,
.sidebar.collapsed .system-state strong,
.sidebar.collapsed .system-state small { display: none; }

.brand-area {
    min-height: 94px;
    padding: 22px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.13);
}

.brand-lockup { display: flex; align-items: center; gap: 12px; overflow: hidden; }

.brand-mark {
    width: 46px; height: 46px;
    border-radius: 18px;
    display: grid; place-items: center;
    flex-shrink: 0;
    color: #00131c;
    background: linear-gradient(135deg, var(--cyan), var(--violet)), radial-gradient(circle at 25% 20%, rgba(255,255,255,0.85), transparent 30%);
    box-shadow: 0 0 26px rgba(56, 248, 255, 0.28), inset 0 0 18px rgba(255,255,255,0.18);
    font-weight: 900;
    font-size: 1rem;
}

.brand-copy { min-width: 0; white-space: nowrap; transition: opacity 0.2s ease; }
.brand-copy strong { display: block; font-size: 1.1rem; letter-spacing: 0.08em; background: linear-gradient(135deg, #ffffff, var(--cyan), #c084fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-copy span { display: block; margin-top: 2px; font-size: 0.7rem; color: var(--muted); letter-spacing: 0.13em; text-transform: uppercase; }

.icon-btn {
    width: 42px; height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.78);
    color: var(--soft);
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
}
.icon-btn:hover { color: var(--cyan); border-color: rgba(56, 248, 255, 0.45); box-shadow: var(--glow); transform: translateY(-1px); }

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

.sidebar-section-title { font-size: 0.68rem; color: #60718f; padding: 14px 12px 8px; letter-spacing: 0.16em; text-transform: uppercase; }

.nav-item { margin-bottom: 7px; }

.nav-link {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 18px;
    display: flex; align-items: center; gap: 12px;
    min-height: 48px;
    padding: 12px 14px;
    color: var(--muted);
    background: transparent;
    transition: all 0.18s ease;
    position: relative;
}
.nav-link i:first-child { width: 22px; font-size: 1.06rem; text-align: center; color: inherit; }
.nav-link:hover { color: var(--text); background: rgba(56, 248, 255, 0.07); border-color: rgba(56, 248, 255, 0.12); }
.nav-link.active {
    color: #ecfeff;
    background: linear-gradient(135deg, rgba(56, 248, 255, 0.17), rgba(168, 85, 247, 0.13)), rgba(15, 23, 42, 0.78);
    border-color: rgba(56, 248, 255, 0.34);
    box-shadow: inset 3px 0 0 var(--cyan), 0 12px 28px rgba(0,0,0,0.22);
}
.nav-label { flex: 1; text-align: left; font-weight: 600; font-size: 0.88rem; }
.nav-chevron { font-size: 0.72rem; color: #61708a; transition: transform 0.2s ease; }
.nav-link.open .nav-chevron { transform: rotate(180deg); }

.submenu { margin: 7px 0 10px 36px; max-height: 0; overflow: hidden; transition: max-height 0.22s ease; }
.submenu.open { max-height: 320px; }
.submenu button, .submenu a {
    width: 100%; border: none; background: transparent;
    color: #8397b6;
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px; border-radius: 13px;
    font-size: 0.78rem; text-align: left;
    text-decoration: none;
}
.submenu button:hover, .submenu a:hover { color: var(--cyan); background: rgba(56, 248, 255, 0.07); }

.sidebar-footer { padding: 14px 12px 18px; border-top: 1px solid rgba(148, 163, 184, 0.12); }

.operator-card {
    padding: 14px; border-radius: 22px;
    background: linear-gradient(135deg, rgba(56, 248, 255, 0.11), rgba(168, 85, 247, 0.08)), rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(56, 248, 255, 0.18);
    margin-bottom: 12px;
}
.operator-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.operator-top strong { font-size: 0.85rem; }
.operator-pill { font-size: 0.67rem; padding: 5px 9px; border-radius: 999px; color: #032017; background: var(--green); font-weight: 800; }

.mini-meter { display: flex; align-items: center; gap: 10px; }
.mini-meter span { width: 68px; color: var(--muted); font-size: 0.72rem; }
.meter-track { flex: 1; height: 8px; border-radius: 999px; background: rgba(148, 163, 184, 0.13); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--violet)); box-shadow: 0 0 18px rgba(56, 248, 255, 0.34); }

.system-state {
    height: 48px; padding: 0 14px; border-radius: 18px;
    display: flex; align-items: center; gap: 12px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.12);
}
.pulse-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--green); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.75); animation: pulse 1.65s infinite; flex-shrink: 0; }
.system-state strong { display: block; font-size: 0.78rem; }
.system-state small { display: block; color: var(--muted); font-size: 0.68rem; margin-top: 2px; }

/* ============================================================
   MAIN — TOPBAR — WORKSPACE
   ============================================================ */
.main { flex: 1; min-width: 0; height: 100%; position: relative; z-index: 2; display: flex; flex-direction: column; }

.topbar {
    min-height: 92px;
    padding: 18px 28px;
    display: flex; align-items: center; gap: 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(5, 9, 16, 0.34);
    backdrop-filter: blur(16px);
    position: relative; z-index: 20;
}

.title-zone { flex: 1; min-width: 220px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.74rem; margin-bottom: 6px; }
.breadcrumb i { color: var(--cyan); }
.title-zone h1 { font-size: clamp(1.35rem, 2vw, 2.05rem); line-height: 1.1; letter-spacing: -0.04em; }
.title-zone p { color: var(--muted); margin-top: 6px; font-size: 0.82rem; }

.command-search {
    width: min(430px, 34vw);
    height: 48px; border-radius: 18px;
    display: flex; align-items: center; gap: 10px; padding: 0 14px;
    color: var(--muted);
    background: rgba(15, 23, 42, 0.76);
    border: 1px solid rgba(148, 163, 184, 0.15);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
    cursor: text;
}
.command-search:focus-within { border-color: rgba(56, 248, 255, 0.52); box-shadow: 0 0 0 4px rgba(56, 248, 255, 0.08), var(--glow); }
.command-search input { width: 100%; border: none; outline: none; color: var(--text); background: transparent; font-size: 0.88rem; }
.command-search input::placeholder { color: #64748b; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.notification-trigger, .avatar-trigger { position: relative; }

.badge { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--red), var(--pink)); color: #fff; font-size: 0.63rem; font-weight: 800; border: 2px solid #07101d; }

.avatar-btn { width: 48px; height: 48px; border: none; border-radius: 18px; color: #05111a; background: linear-gradient(135deg, var(--cyan), #c084fc); display: grid; place-items: center; font-weight: 900; box-shadow: 0 0 28px rgba(56, 248, 255, 0.22); font-size: 0.82rem; }

.workspace { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 28px 24px; }

/* ============================================================
   FLOATING MENUS
   ============================================================ */
.floating-menu {
    position: fixed; top: 78px; right: 28px;
    width: 310px; border-radius: 24px; z-index: 9999;
    background: rgba(11, 18, 31, 0.98);
    border: 1px solid rgba(56, 248, 255, 0.36);
    box-shadow: var(--shadow), 0 0 46px rgba(56, 248, 255, 0.09);
    backdrop-filter: blur(22px);
    display: none; overflow: hidden;
}
.floating-menu.show { display: block; animation: lift 0.18s ease; }

.menu-title { padding: 16px 18px; border-bottom: 1px solid rgba(148, 163, 184, 0.13); display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(15, 23, 42, 0.64); }
.menu-title strong { font-size: 0.9rem; }
.menu-title span { color: var(--muted); font-size: 0.72rem; }
.menu-list { padding: 8px; }
.menu-list button, .menu-list a { width: 100%; border: none; text-decoration: none; background: transparent; color: var(--soft); display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 16px; text-align: left; font-size: 0.84rem; }
.menu-list button:hover, .menu-list a:hover { color: var(--cyan); background: rgba(56, 248, 255, 0.08); }

.notification-item { align-items: flex-start !important; }
.notification-item i { margin-top: 2px; }
.notification-item small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.35; }

/* ============================================================
   CARDS Y PANELS
   ============================================================ */
.control-strip { display: grid; grid-template-columns: minmax(280px, 1.1fr) minmax(260px, 0.9fr) minmax(220px, 0.7fr); gap: 18px; margin-bottom: 22px; }

.hero-card {
    position: relative; min-height: 204px; border-radius: var(--radius-xl);
    padding: 24px;
    background: linear-gradient(135deg, rgba(56, 248, 255, 0.12), rgba(168, 85, 247, 0.11)), rgba(12, 19, 32, 0.76);
    border: 1px solid rgba(56, 248, 255, 0.22);
    box-shadow: var(--shadow); overflow: hidden;
}
.hero-card::before { content: ""; position: absolute; inset: -1px; background: radial-gradient(circle at 92% 10%, rgba(56, 248, 255, 0.28), transparent 28%), radial-gradient(circle at 60% 90%, rgba(168, 85, 247, 0.18), transparent 34%); pointer-events: none; }
.hero-content { position: relative; z-index: 2; }
.hero-kicker { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(56, 248, 255, 0.09); border: 1px solid rgba(56, 248, 255, 0.2); color: var(--cyan); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.hero-card h2 { max-width: 560px; margin-top: 17px; font-size: clamp(1.45rem, 2vw, 2.25rem); line-height: 1.05; letter-spacing: -0.05em; }
.hero-card p { max-width: 600px; color: var(--muted); margin-top: 12px; line-height: 1.55; font-size: 0.9rem; }
.hero-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

.glass-card { border-radius: var(--radius-xl); padding: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); position: relative; overflow: hidden; }
.glass-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.045), transparent 38%); pointer-events: none; }
.card-content { position: relative; z-index: 2; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 0.98rem; letter-spacing: -0.02em; }
.card-head p { color: var(--muted); margin-top: 4px; font-size: 0.75rem; }

/* --- Stats --- */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 18px; margin-bottom: 22px; }

.stat-card { min-height: 158px; border-radius: 28px; padding: 18px; background: rgba(12, 19, 32, 0.78); border: 1px solid rgba(148, 163, 184, 0.14); box-shadow: 0 18px 46px rgba(0,0,0,0.28); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -45px; top: -45px; width: 130px; height: 130px; border-radius: 999px; background: var(--accent, var(--cyan)); opacity: 0.16; filter: blur(2px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; z-index: 2; }
.stat-icon { width: 44px; height: 44px; border-radius: 17px; display: grid; place-items: center; color: var(--text); background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
.stat-trend { color: #86efac; font-size: 0.72rem; font-weight: 800; }
.stat-trend.negativo { color: var(--red); }
.stat-card h3 { position: relative; z-index: 2; font-size: 2rem; margin-top: 18px; letter-spacing: -0.04em; }
.stat-card p { position: relative; z-index: 2; color: var(--muted); font-size: 0.78rem; margin-top: 5px; }
.sparkline { position: relative; z-index: 2; height: 34px; margin-top: 12px; display: flex; align-items: flex-end; gap: 5px; }
.sparkline span { width: 100%; border-radius: 999px 999px 4px 4px; background: linear-gradient(180deg, var(--cyan), rgba(56, 248, 255, 0.12)); opacity: 0.8; }

/* --- Content Grid --- */
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }

.panel { border-radius: var(--radius-xl); background: var(--panel); border: 1px solid rgba(148, 163, 184, 0.14); box-shadow: var(--shadow); backdrop-filter: blur(18px); overflow: hidden; }
.panel-header { padding: 18px 20px; border-bottom: 1px solid rgba(148, 163, 184, 0.13); display: flex; align-items: center; justify-content: space-between; gap: 14px; background: linear-gradient(135deg, rgba(56, 248, 255, 0.055), transparent), rgba(15, 23, 42, 0.5); }
.panel-header h3 { font-size: 1rem; letter-spacing: -0.02em; }
.panel-header p { color: var(--muted); font-size: 0.74rem; margin-top: 4px; }
.panel-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.panel-body { padding: 20px; }

/* ============================================================
   CHIPS Y BADGES
   ============================================================ */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: rgba(56, 248, 255, 0.08); border: 1px solid rgba(56, 248, 255, 0.16); color: var(--cyan); font-size: 0.7rem; font-weight: 800; white-space: nowrap; }
.chip.green { color: #86efac; background: rgba(52, 211, 153, 0.09); border-color: rgba(52, 211, 153, 0.22); }
.chip.amber { color: #fde68a; background: rgba(251, 191, 36, 0.09); border-color: rgba(251, 191, 36, 0.24); }
.chip.red { color: #fecdd3; background: rgba(251, 113, 133, 0.09); border-color: rgba(251, 113, 133, 0.24); }
.chip.violet { color: #e9d5ff; background: rgba(168, 85, 247, 0.09); border-color: rgba(168, 85, 247, 0.24); }

/* ============================================================
   BOTONES
   ============================================================ */
.btn { min-height: 42px; padding: 0 15px; border-radius: 15px; border: 1px solid rgba(148, 163, 184, 0.16); background: rgba(15, 23, 42, 0.72); color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 700; font-size: 0.82rem; transition: all 0.18s ease; }
.btn:hover { transform: translateY(-1px); border-color: rgba(56, 248, 255, 0.4); box-shadow: var(--glow); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { border: none; color: #00131b; background: linear-gradient(135deg, var(--cyan), #c084fc); box-shadow: 0 16px 36px rgba(56, 248, 255, 0.18); }
.btn-primary:hover { box-shadow: 0 20px 44px rgba(56, 248, 255, 0.28); }
.btn-green { border: none; color: #021a12; background: linear-gradient(135deg, var(--green), #86efac); }
.btn-amber { border: none; color: #1a1000; background: linear-gradient(135deg, var(--amber), #fde68a); }
.btn-danger { border-color: rgba(251, 113, 133, 0.42); color: #fecdd3; background: rgba(251, 113, 133, 0.1); }
.btn-danger:hover { border-color: rgba(251, 113, 133, 0.7); background: rgba(251, 113, 133, 0.18); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 0.76rem; border-radius: 12px; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 0.92rem; border-radius: 18px; }

/* ============================================================
   CONTROLES
   ============================================================ */
.switch-row { display: flex; flex-direction: column; gap: 12px; }
.switch-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border-radius: 18px; background: rgba(15, 23, 42, 0.52); border: 1px solid rgba(148, 163, 184, 0.11); }
.switch-item strong { display: block; font-size: 0.82rem; }
.switch-item small { display: block; color: var(--muted); margin-top: 2px; font-size: 0.68rem; }
.toggle { width: 48px; height: 28px; border: none; border-radius: 999px; padding: 3px; background: rgba(100, 116, 139, 0.44); flex-shrink: 0; transition: all 0.18s ease; }
.toggle::before { content: ""; width: 22px; height: 22px; border-radius: 999px; background: #dbeafe; display: block; transition: all 0.18s ease; }
.toggle.active { background: linear-gradient(135deg, var(--cyan), var(--violet)); }
.toggle.active::before { transform: translateX(20px); background: #06111c; }

.segmented { display: inline-flex; padding: 4px; border-radius: 15px; background: rgba(15, 23, 42, 0.72); border: 1px solid rgba(148, 163, 184, 0.14); }
.segmented button { height: 34px; border: none; border-radius: 12px; padding: 0 12px; background: transparent; color: var(--muted); font-weight: 800; font-size: 0.73rem; }
.segmented button.active { background: linear-gradient(135deg, rgba(56, 248, 255, 0.18), rgba(168, 85, 247, 0.14)); color: var(--text); box-shadow: inset 0 0 0 1px rgba(56, 248, 255, 0.16); }

/* ============================================================
   FORMULARIOS
   ============================================================ */
/* Barra de filtros — flex para que cada control mantenga su tamaño al envolver */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

/* Panel context: padding real (top + laterales + bottom) */
.panel .filters-bar {
    padding: 14px 20px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    margin-bottom: 0;
}

/* Controles dentro del filtro: tamaño automático (anula width:100% de .form-control) */
.filters-bar .form-control,
.filters-bar select,
.filters-bar input[type="date"],
.filters-bar input[type="text"] {
    width: auto;
    min-width: 130px;
}

/* El primer hijo (wrapper del buscador) crece para llenar el espacio disponible */
.filters-bar > div:first-child {
    flex: 1 1 200px;
    min-width: 200px;
}

/* El input de búsqueda dentro de su wrapper ocupa todo su contenedor */
.filters-bar > div:first-child input {
    width: 100%;
}

.field { position: relative; }
.field i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #64748b; pointer-events: none; font-size: 0.85rem; }
.field input, .field select {
    width: 100%; height: 44px; border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(15, 23, 42, 0.74); color: var(--text);
    outline: none; padding: 0 14px; font-size: 0.82rem;
}
.field input { padding-left: 40px; }
.field input.no-icon { padding-left: 14px; }
.field select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2338f8ff' stroke-width='2'><polyline points='6 9 12 15 18 9'></polyline></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.field input::placeholder { color: #64748b; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(56, 248, 255, 0.52); box-shadow: 0 0 0 4px rgba(56, 248, 255, 0.08); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 7px; font-weight: 600; letter-spacing: 0.04em; }
.form-control {
    width: 100%; height: 44px; border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(15, 23, 42, 0.74); color: var(--text);
    outline: none; padding: 0 14px; font-size: 0.85rem;
}
.form-control:focus { border-color: rgba(56, 248, 255, 0.52); box-shadow: 0 0 0 4px rgba(56, 248, 255, 0.08); }
.form-control::placeholder { color: #64748b; }

.textarea, textarea.form-control {
    width: 100%; min-height: 100px; resize: vertical;
    border-radius: 16px; border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(15, 23, 42, 0.74); color: var(--text);
    outline: none; padding: 12px 14px; font-size: 0.82rem; height: auto;
}

.form-error { color: var(--red); font-size: 0.74rem; margin-top: 5px; }
.form-hint { color: var(--muted); font-size: 0.72rem; margin-top: 5px; }

/* ============================================================
   TABLAS
   ============================================================ */
.data-table-wrap { overflow-x: auto; border-radius: 22px; border: 1px solid rgba(148, 163, 184, 0.12); background: rgba(15, 23, 42, 0.35); }
.panel .data-table-wrap { margin: 12px 20px 16px; }
table { width: 100%; min-width: 920px; border-collapse: collapse; }
th { height: 50px; padding: 0 14px; color: #92efff; font-size: 0.73rem; text-align: left; text-transform: uppercase; letter-spacing: 0.08em; background: rgba(15, 23, 42, 0.72); border-bottom: 1px solid rgba(148, 163, 184, 0.12); }
td { padding: 14px; border-bottom: 1px solid rgba(148, 163, 184, 0.09); color: var(--soft); font-size: 0.85rem; }
tr:hover td { background: rgba(56, 248, 255, 0.045); }
tr:last-child td { border-bottom: none; }

.entity-cell { display: flex; align-items: center; gap: 11px; }
.entity-avatar { width: 38px; height: 38px; border-radius: 14px; display: grid; place-items: center; color: #031018; background: linear-gradient(135deg, var(--cyan), #c084fc); font-weight: 900; font-size: 0.78rem; flex-shrink: 0; }
.entity-cell strong { display: block; color: var(--text); font-size: 0.86rem; }
.entity-cell small { display: block; color: var(--muted); margin-top: 2px; font-size: 0.72rem; }

/* Status pills */
.status-pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.status-activo   { color: #86efac; background: rgba(52, 211, 153, 0.1); }
.status-inactivo { color: #fca5a5; background: rgba(251, 113, 133, 0.1); }
.status-pendiente{ color: #fde68a; background: rgba(251, 191, 36, 0.1); }
.status-info     { color: #93c5fd; background: rgba(59, 130, 246, 0.1); }

/* Row actions */
.row-actions { position: relative; }
.dots-btn { width: 36px; height: 36px; border-radius: 13px; border: 1px solid rgba(148, 163, 184, 0.13); background: rgba(15, 23, 42, 0.74); color: var(--soft); }
.dots-btn:hover { color: var(--cyan); border-color: rgba(56, 248, 255, 0.38); }
.row-menu { position: fixed; z-index: 9999; width: 166px; padding: 7px; border-radius: 18px; background: rgba(11, 18, 31, 0.98); border: 1px solid rgba(56, 248, 255, 0.34); box-shadow: var(--shadow); display: none; backdrop-filter: blur(20px); }
.row-menu.show { display: block; animation: lift 0.16s ease; }
.row-menu button { width: 100%; border: none; background: transparent; color: var(--soft); display: flex; align-items: center; gap: 9px; padding: 10px; border-radius: 13px; text-align: left; font-size: 0.78rem; }
.row-menu button:hover { color: var(--cyan); background: rgba(56, 248, 255, 0.08); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; color: var(--muted); font-size: 0.78rem; }
.pagination-controls { display: flex; align-items: center; gap: 8px; }

/* ============================================================
   SIDEBAR STACKS Y UTILIDADES
   ============================================================ */
.side-stack { display: flex; flex-direction: column; gap: 18px; }

.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline-item { position: relative; padding: 13px 13px 13px 40px; border-radius: 18px; background: rgba(15, 23, 42, 0.5); border: 1px solid rgba(148, 163, 184, 0.1); }
.timeline-item::before { content: ""; position: absolute; left: 16px; top: 18px; width: 10px; height: 10px; border-radius: 999px; background: var(--cyan); box-shadow: 0 0 16px rgba(56, 248, 255, 0.7); }
.timeline-item strong { display: block; font-size: 0.82rem; }
.timeline-item span { color: var(--muted); display: block; font-size: 0.72rem; margin-top: 3px; line-height: 1.4; }
.timeline-item small { color: #64748b; display: block; margin-top: 8px; font-size: 0.68rem; }

.inspector-user { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 22px; background: rgba(15, 23, 42, 0.54); border: 1px solid rgba(148, 163, 184, 0.11); margin-bottom: 14px; }
.inspector-avatar { width: 56px; height: 56px; border-radius: 20px; display: grid; place-items: center; color: #031018; background: linear-gradient(135deg, var(--cyan), #c084fc); font-weight: 900; flex-shrink: 0; }
.inspector-user strong { display: block; font-size: 0.94rem; }
.inspector-user span { display: block; color: var(--muted); margin-top: 3px; font-size: 0.74rem; }

.detail-list { display: grid; gap: 10px; }
.detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.09); font-size: 0.78rem; }
.detail-row:last-child { border-bottom: none; }
.detail-row span { color: var(--muted); }
.detail-row strong { color: var(--text); text-align: right; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick-card { min-height: 92px; border: 1px solid rgba(148, 163, 184, 0.12); border-radius: 22px; background: rgba(15, 23, 42, 0.54); color: var(--text); padding: 14px; text-align: left; transition: all 0.18s ease; }
.quick-card:hover { transform: translateY(-2px); border-color: rgba(56, 248, 255, 0.36); box-shadow: var(--glow); }
.quick-card i { color: var(--cyan); font-size: 1.2rem; margin-bottom: 12px; display: block; }
.quick-card strong { display: block; font-size: 0.8rem; }
.quick-card span { display: block; color: var(--muted); margin-top: 4px; font-size: 0.68rem; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 18px; }
.setting-box { border-radius: 24px; padding: 18px; background: rgba(15, 23, 42, 0.56); border: 1px solid rgba(148, 163, 184, 0.12); }
.setting-box h4 { font-size: 0.92rem; margin-bottom: 5px; }
.setting-box p { color: var(--muted); font-size: 0.75rem; line-height: 1.5; margin-bottom: 14px; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-card { min-height: 300px; }
.chart-area { height: 210px; display: flex; align-items: flex-end; gap: 10px; padding-top: 26px; border-radius: 24px; background: linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px); background-size: 100% 25%, 12.5% 100%; overflow: hidden; }
.chart-bar { flex: 1; min-width: 18px; border-radius: 999px 999px 7px 7px; background: linear-gradient(180deg, var(--cyan), rgba(168, 85, 247, 0.55)); box-shadow: 0 0 22px rgba(56, 248, 255, 0.18); position: relative; transition: opacity 0.2s; }
.chart-bar:hover { opacity: 0.85; }
.chart-bar::before { content: attr(data-label); position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 0.66rem; white-space: nowrap; }
.chart-bar::after { content: attr(data-value); position: absolute; top: -23px; left: 50%; transform: translateX(-50%); color: var(--text); font-size: 0.66rem; font-weight: 800; opacity: 0; transition: opacity 0.15s ease; }
.chart-bar:hover::after { opacity: 1; }

/* Radar */
.radar-box { height: 155px; border-radius: 24px; background: radial-gradient(circle at center, rgba(56, 248, 255, 0.18), transparent 23%), repeating-radial-gradient(circle at center, rgba(56, 248, 255, 0.14) 0 1px, transparent 1px 24px), linear-gradient(135deg, rgba(15, 23, 42, 0.65), rgba(15, 23, 42, 0.22)); border: 1px solid rgba(56, 248, 255, 0.16); position: relative; overflow: hidden; }
.radar-box::before { content: ""; position: absolute; left: 50%; top: 50%; width: 80px; height: 1px; transform-origin: left center; background: linear-gradient(90deg, var(--cyan), transparent); animation: sweep 3s linear infinite; }
.radar-box::after { content: ""; position: absolute; inset: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 999px; background: var(--cyan); box-shadow: 0 0 24px var(--cyan); }

/* ============================================================
   FOOTER — TOAST — MODALES — PALETA
   ============================================================ */
.footer { margin-top: 22px; min-height: 58px; border-radius: 24px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: rgba(12, 19, 32, 0.58); border: 1px solid rgba(148, 163, 184, 0.12); color: var(--muted); font-size: 0.72rem; }

.toast-container { position: fixed; right: 24px; bottom: 24px; z-index: 30000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { width: min(360px, calc(100vw - 48px)); padding: 13px 15px; border-radius: 18px; background: rgba(11, 18, 31, 0.98); border: 1px solid rgba(56, 248, 255, 0.28); color: var(--text); box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 11px; animation: toastIn 0.2s ease; }
.toast i { margin-top: 2px; }
.toast.success i { color: var(--green); }
.toast.error i { color: var(--red); }
.toast.info i { color: var(--cyan); }
.toast.warning i { color: var(--amber); }
.toast strong { display: block; font-size: 0.82rem; }
.toast span { display: block; color: var(--muted); margin-top: 3px; font-size: 0.72rem; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.76); backdrop-filter: blur(10px); z-index: 25000; display: none; align-items: center; justify-content: center; padding: 22px; }
.modal-overlay.active { display: flex; animation: fade 0.16s ease; }
.modal { width: min(520px, 100%); border-radius: 32px; background: linear-gradient(135deg, rgba(56, 248, 255, 0.09), rgba(168, 85, 247, 0.08)), #0b1220; border: 1px solid rgba(56, 248, 255, 0.34); box-shadow: var(--shadow), 0 0 60px rgba(56, 248, 255, 0.08); overflow: hidden; }
.modal.modal-lg { width: min(780px, 100%); }
.modal-head { padding: 20px 22px; border-bottom: 1px solid rgba(148, 163, 184, 0.13); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.modal-head h3 { font-size: 1.08rem; }
.modal-body { padding: 22px; }
.modal-body p { color: var(--muted); line-height: 1.55; font-size: 0.88rem; }
.modal-actions { padding: 0 22px 22px; display: flex; justify-content: flex-end; gap: 10px; }

.command-palette { position: fixed; inset: 0; z-index: 24000; background: rgba(0, 0, 0, 0.68); backdrop-filter: blur(9px); display: none; align-items: flex-start; justify-content: center; padding-top: 9vh; }
.command-palette.active { display: flex; animation: fade 0.16s ease; }
.palette-box { width: min(680px, calc(100vw - 32px)); border-radius: 30px; background: rgba(11, 18, 31, 0.98); border: 1px solid rgba(56, 248, 255, 0.36); box-shadow: var(--shadow); overflow: hidden; }
.palette-input { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid rgba(148, 163, 184, 0.13); }
.palette-input i { color: var(--cyan); }
.palette-input input { width: 100%; background: transparent; border: none; outline: none; color: var(--text); font-size: 1rem; }
.palette-results { padding: 10px; max-height: 360px; overflow-y: auto; }
.palette-results button { width: 100%; border: none; border-radius: 18px; padding: 13px; background: transparent; color: var(--soft); display: flex; align-items: center; gap: 12px; text-align: left; }
.palette-results button:hover { color: var(--cyan); background: rgba(56, 248, 255, 0.08); }

.empty-state { padding: 32px; color: var(--muted); text-align: center; }
.empty-state i { font-size: 2.5rem; color: rgba(148, 163, 184, 0.3); display: block; margin-bottom: 12px; }
.empty-state p { font-size: 0.88rem; }

/* ============================================================
   DEUDA — ESTADOS COMERCIALES ESPECÍFICOS
   ============================================================ */
.deuda-card { border-radius: 24px; padding: 18px; border: 1px solid; }
.deuda-sin-deuda  { background: rgba(52, 211, 153, 0.06);  border-color: rgba(52, 211, 153, 0.22);  color: #86efac; }
.deuda-pendiente  { background: rgba(251, 191, 36, 0.06);  border-color: rgba(251, 191, 36, 0.22);  color: #fde68a; }
.deuda-vencida    { background: rgba(251, 113, 133, 0.06); border-color: rgba(251, 113, 133, 0.22); color: #fecdd3; }
.deuda-parcial    { background: rgba(168, 85, 247, 0.06);  border-color: rgba(168, 85, 247, 0.22);  color: #e9d5ff; }

/* Risk bar */
.risk-bar { width: 110px; height: 9px; border-radius: 999px; background: rgba(148, 163, 184, 0.12); overflow: hidden; }
.risk-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--cyan), var(--violet)); }

/* ============================================================
   ANIMACIONES
   ============================================================ */
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); } 70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
@keyframes sweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes lift { from { opacity: 0; transform: translateY(-10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(35px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-spin { animation: spin 0.8s linear infinite; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1320px) {
    .control-strip { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
    .content-grid { grid-template-columns: 1fr; }
    .side-stack { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); }
}

@media (max-width: 900px) {
    body { overflow: auto; }
    .app-shell { min-height: 100vh; height: auto; overflow: visible; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); width: 305px; z-index: 50; }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,0.5); }
    .sidebar.collapsed { width: 305px; }
    .sidebar.collapsed .brand-copy,
    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .nav-chevron,
    .sidebar.collapsed .sidebar-section-title,
    .sidebar.collapsed .operator-card,
    .sidebar.collapsed .mini-meter span,
    .sidebar.collapsed .system-state strong,
    .sidebar.collapsed .system-state small { display: block; }
    .main { min-height: 100vh; }
    .topbar { flex-wrap: wrap; padding: 16px; }
    .command-search { order: 5; width: 100%; }
    .workspace { overflow: visible; padding: 18px 16px; }
    .stats-grid, .side-stack, .settings-grid { grid-template-columns: 1fr; }
    .filters-bar > div:first-child { flex-basis: 100%; }
    .footer { align-items: flex-start; padding: 16px; flex-direction: column; }
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    table { min-width: 600px; }
    .modal { border-radius: 24px; }
    .quick-grid { grid-template-columns: 1fr; }
}
