/* =====================================================================
   InstalaPro — Cada instalación bajo control.
   Paleta oficial: #06254B #0866F5 #00D5F5 #FF7900 #FFC400 #FFFFFF #F3F6FA
   ===================================================================== */
:root {
  --ip-navy: #06254B;
  --ip-blue: #0866F5;
  --ip-cyan: #00D5F5;
  --ip-orange: #FF7900;
  --ip-yellow: #FFC400;
  --ip-white: #FFFFFF;
  --ip-gray: #F3F6FA;

  --ip-bg: #F3F6FA;
  --ip-surface: #FFFFFF;
  --ip-surface-2: #F8FAFD;
  --ip-text: #0F1E33;
  --ip-muted: #64748B;
  --ip-border: #E3E9F2;
  --ip-shadow: 0 6px 24px rgba(6, 37, 75, .07);
  --ip-radius: 16px;
  --ip-sidebar-w: 264px;

  --bs-primary: #0866F5;
  --bs-primary-rgb: 8, 102, 245;
  --bs-body-font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-bg: var(--ip-bg);
  --bs-body-color: var(--ip-text);
  --bs-border-color: var(--ip-border);
  --bs-link-color: #0866F5;
  --bs-link-color-rgb: 8, 102, 245;
}

[data-bs-theme="dark"] {
  --ip-bg: #07111F;
  --ip-surface: #0E1C30;
  --ip-surface-2: #12233B;
  --ip-text: #E6EDF7;
  --ip-muted: #94A3B8;
  --ip-border: #1E3352;
  --ip-shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --bs-body-bg: var(--ip-bg);
  --bs-body-color: var(--ip-text);
  --bs-border-color: var(--ip-border);
  --bs-secondary-bg: #12233B;
  --bs-tertiary-bg: #0B182A;
  --bs-link-color: #4D94FF;
  --bs-link-color-rgb: 77, 148, 255;
}

html, body { min-height: 100%; }
body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--ip-bg);
  color: var(--ip-text);
  font-size: .925rem;
  -webkit-tap-highlight-color: transparent;
}
a { text-decoration: none; }
.text-muted, .text-secondary { color: var(--ip-muted) !important; }
.fw-600 { font-weight: 600; }
.small-xs { font-size: .75rem; }
[data-lucide] { width: 18px; height: 18px; stroke-width: 2; vertical-align: -3px; }
.icon-sm [data-lucide], [data-lucide].icon-sm { width: 15px; height: 15px; }
.icon-lg[data-lucide] { width: 26px; height: 26px; }

/* ----------------------------------------------------- Botones */
.btn { border-radius: 11px; font-weight: 500; }
.btn [data-lucide] { margin-right: 4px; }
.btn-icon [data-lucide] { margin-right: 0; }
.btn-primary { --bs-btn-bg: var(--ip-blue); --bs-btn-border-color: var(--ip-blue); --bs-btn-hover-bg: #0757D1; --bs-btn-hover-border-color: #0757D1; --bs-btn-active-bg: #064BB5; }
.btn-accent, .btn-orange {
  --bs-btn-color: #fff; --bs-btn-bg: var(--ip-orange); --bs-btn-border-color: var(--ip-orange);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #E86D00; --bs-btn-hover-border-color: #E86D00;
  --bs-btn-active-bg: #CC6000; --bs-btn-active-color: #fff; --bs-btn-disabled-bg: #FFB173; --bs-btn-disabled-border-color: #FFB173; --bs-btn-disabled-color: #fff;
  box-shadow: 0 6px 16px rgba(255, 121, 0, .25);
}
.btn-navy { --bs-btn-color: #fff; --bs-btn-bg: var(--ip-navy); --bs-btn-border-color: var(--ip-navy); --bs-btn-hover-bg: #0A3466; --bs-btn-hover-color: #fff; }
.btn-soft { background: var(--ip-surface-2); border: 1px solid var(--ip-border); color: var(--ip-text); }
.btn-soft:hover { background: var(--ip-border); color: var(--ip-text); }
.text-orange { color: var(--ip-orange) !important; }
.text-navy { color: var(--ip-navy) !important; }
[data-bs-theme="dark"] .text-navy { color: #CFE0FF !important; }
.bg-navy { background: var(--ip-navy) !important; }
.bg-gradient-ip { background: linear-gradient(135deg, var(--ip-navy) 0%, var(--ip-blue) 70%, var(--ip-cyan) 130%); color: #fff; }

/* ----------------------------------------------------- Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--ip-sidebar-w); flex: 0 0 var(--ip-sidebar-w);
  background: linear-gradient(180deg, #06254B 0%, #041A36 100%);
  color: #C9D7EE; position: fixed; inset: 0 auto 0 0; z-index: 1040;
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; color: #fff; }
.sidebar .brand img { width: 44px; height: 44px; border-radius: 12px; background: #fff; padding: 3px; }
.brand-word { font-weight: 800; font-size: 1.35rem; letter-spacing: -.5px; line-height: 1; }
.brand-word .pro { color: var(--ip-orange); }
.brand-sub { font-size: .63rem; letter-spacing: 1.4px; text-transform: uppercase; color: #8FB0DA; margin-top: 3px; }
.sidebar .nav-scroll { overflow-y: auto; flex: 1; padding: 6px 12px 16px; }
.sidebar .nav-section { font-size: .66rem; letter-spacing: 1.3px; text-transform: uppercase; color: #6F8DB8; padding: 14px 12px 6px; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: 11px; color: #C9D7EE; padding: 10px 12px; border-radius: 11px;
  font-size: .9rem; font-weight: 500; margin-bottom: 2px;
}
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar .nav-link.active { background: linear-gradient(90deg, var(--ip-blue), #1C7BFF); color: #fff; box-shadow: 0 6px 18px rgba(8, 102, 245, .35); }
.sidebar .nav-link .badge { margin-left: auto; }
.sidebar .sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .78rem; }
.sidebar-backdrop { display: none; }

.main { flex: 1; margin-left: var(--ip-sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1030; background: color-mix(in srgb, var(--ip-bg) 85%, transparent);
  backdrop-filter: blur(10px); padding: 12px 24px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--ip-border);
}
.topbar .page-title { font-weight: 600; font-size: 1.1rem; margin: 0; color: var(--ip-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .tb-btn {
  width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ip-surface); border: 1px solid var(--ip-border); color: var(--ip-text); position: relative;
}
.topbar .tb-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--ip-orange); color: #fff; font-size: .65rem; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; color: #fff; background: linear-gradient(135deg, var(--ip-blue), var(--ip-cyan)); flex: 0 0 auto; }
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: .72rem; }
.content { padding: 22px 24px 40px; flex: 1; }
.conn-status { font-size: .75rem; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(4, 16, 32, .5); z-index: 1035; }
  .main { margin-left: 0; }
  .topbar { padding: 10px 14px; }
  .content { padding: 16px 14px 90px; }
}

/* ----------------------------------------------------- Tarjetas */
.card { background: var(--ip-surface); border: 1px solid var(--ip-border); border-radius: var(--ip-radius); box-shadow: var(--ip-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--ip-border); padding: 14px 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header:first-child { border-radius: var(--ip-radius) var(--ip-radius) 0 0; }
.card-body { padding: 18px; }
.kpi { position: relative; overflow: hidden; padding: 16px 16px 14px; height: 100%; }
.kpi .kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.kpi .kpi-icon [data-lucide] { width: 22px; height: 22px; }
.kpi .kpi-value { font-size: 1.65rem; font-weight: 700; line-height: 1.1; }
.kpi .kpi-label { color: var(--ip-muted); font-size: .8rem; font-weight: 500; }
.kpi::after { content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%; background: currentColor; opacity: .05; }
.tone-blue { color: var(--ip-blue); } .tone-blue .kpi-icon { background: rgba(8, 102, 245, .12); }
.tone-cyan { color: #00A9C4; } .tone-cyan .kpi-icon { background: rgba(0, 213, 245, .15); }
.tone-orange { color: var(--ip-orange); } .tone-orange .kpi-icon { background: rgba(255, 121, 0, .13); }
.tone-yellow { color: #D9A400; } .tone-yellow .kpi-icon { background: rgba(255, 196, 0, .18); }
.tone-green { color: #12A150; } .tone-green .kpi-icon { background: rgba(18, 161, 80, .12); }
.tone-red { color: #E5383B; } .tone-red .kpi-icon { background: rgba(229, 56, 59, .12); }
.tone-navy { color: var(--ip-navy); } .tone-navy .kpi-icon { background: rgba(6, 37, 75, .1); }
.tone-gray { color: #64748B; } .tone-gray .kpi-icon { background: rgba(100, 116, 139, .12); }
[data-bs-theme="dark"] .tone-navy { color: #8DB4F0; }
.kpi .kpi-value, .kpi .kpi-label { color: var(--ip-text); }
.kpi .kpi-label { color: var(--ip-muted); }

/* ----------------------------------------------------- Tablas */
.table { --bs-table-bg: transparent; --bs-table-color: var(--ip-text); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .8rem; border-bottom-color: var(--ip-border); vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--ip-muted); font-weight: 600; background: var(--ip-surface-2); white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(8, 102, 245, .04); }
.table-responsive { border-radius: 0 0 var(--ip-radius) var(--ip-radius); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters .form-control, .filters .form-select { min-width: 140px; }

/* ----------------------------------------------------- Formularios */
.form-control, .form-select { border-radius: 11px; border-color: var(--ip-border); background-color: var(--ip-surface); color: var(--ip-text); padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--ip-blue); box-shadow: 0 0 0 .2rem rgba(8, 102, 245, .15); }
.form-label { font-weight: 500; font-size: .83rem; margin-bottom: .3rem; }
.form-text { color: var(--ip-muted); }
.input-group-text { border-radius: 11px; background: var(--ip-surface-2); border-color: var(--ip-border); color: var(--ip-muted); }
.modal-content { border-radius: 18px; border: 0; background: var(--ip-surface); }
.modal-header { border-bottom-color: var(--ip-border); }
.modal-footer { border-top-color: var(--ip-border); }
.dropdown-menu { border-radius: 14px; border-color: var(--ip-border); box-shadow: var(--ip-shadow); background: var(--ip-surface); }
.required::after { content: " *"; color: var(--ip-orange); }

/* ----------------------------------------------------- Estados */
.badge { font-weight: 500; }
.badge-status { display: inline-flex; align-items: center; gap: 4px; padding: .38em .7em; border-radius: 8px; font-size: .74rem; }
.badge-status [data-lucide] { width: 13px; height: 13px; }
.bg-st-pending { background: #E9EEF5; color: #475569; }
.bg-st-scheduled { background: rgba(0, 213, 245, .16); color: #00809A; }
.bg-st-assigned { background: rgba(8, 102, 245, .13); color: #0757D1; }
.bg-st-on_way { background: rgba(8, 102, 245, .9); color: #fff; }
.bg-st-in_progress { background: rgba(18, 161, 80, .14); color: #0D7F3F; }
.bg-st-paused { background: rgba(255, 196, 0, .22); color: #8A6500; }
.bg-st-review { background: rgba(255, 121, 0, .15); color: #C25B00; }
.bg-st-completed { background: #06254B; color: #fff; }
.bg-st-cancelled { background: rgba(229, 56, 59, .12); color: #C1272D; }
[data-bs-theme="dark"] .bg-st-pending { background: #1E3352; color: #B6C4D8; }
[data-bs-theme="dark"] .bg-st-completed { background: #2B4C7E; }
[data-bs-theme="dark"] .bg-st-assigned { color: #7FB0FF; }
[data-bs-theme="dark"] .bg-st-in_progress { color: #4FD58A; }
[data-bs-theme="dark"] .bg-st-scheduled { color: #5FE3F7; }
[data-bs-theme="dark"] .bg-st-review { color: #FFA552; }
[data-bs-theme="dark"] .bg-st-paused { color: #FFD24D; }
.delayed-flag { color: #E5383B; font-size: .72rem; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.delayed-flag [data-lucide] { width: 13px; height: 13px; }
.progress { height: 8px; border-radius: 8px; background: var(--ip-surface-2); }
.progress-bar { background: linear-gradient(90deg, var(--ip-blue), var(--ip-cyan)); border-radius: 8px; }
.dot-color { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

/* ----------------------------------------------------- Listas / timeline */
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-clean > li { padding: 11px 18px; border-bottom: 1px solid var(--ip-border); }
.list-clean > li:last-child { border-bottom: 0; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 4px; bottom: 4px; width: 2px; background: var(--ip-border); }
.timeline li { position: relative; padding: 0 0 16px 44px; }
.timeline .tl-icon { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 10px; background: var(--ip-surface-2); border: 1px solid var(--ip-border); display: flex; align-items: center; justify-content: center; color: var(--ip-blue); }
.timeline .tl-icon [data-lucide] { width: 15px; height: 15px; }
.empty-state { text-align: center; padding: 36px 16px; color: var(--ip-muted); }
.empty-state [data-lucide] { width: 42px; height: 42px; color: var(--ip-blue); opacity: .45; margin-bottom: 8px; }

/* ----------------------------------------------------- Mapas */
.map-box { height: 360px; border-radius: 14px; overflow: hidden; border: 1px solid var(--ip-border); z-index: 0; }
.map-box.tall { height: 460px; }
.map-picker { height: 340px; border-radius: 12px; overflow: hidden; border: 1px solid var(--ip-border); }
.leaflet-container { font-family: 'Poppins', sans-serif; }
.ip-marker { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; }
.ip-marker span { transform: rotate(45deg); color: #fff; font-size: 11px; font-weight: 700; }

/* ----------------------------------------------------- Auth / landing */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { background: radial-gradient(circle at 20% 20%, rgba(0, 213, 245, .35), transparent 45%), radial-gradient(circle at 80% 90%, rgba(255, 121, 0, .35), transparent 40%), linear-gradient(140deg, #06254B, #0A3C7A 60%, #0866F5); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-weight: 700; font-size: 2.2rem; line-height: 1.2; }
.auth-side .feat { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.auth-side .feat [data-lucide] { color: var(--ip-yellow); flex: 0 0 auto; margin-top: 2px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--ip-surface); }
.auth-card { width: 100%; max-width: 430px; }
.auth-logo { width: 120px; height: 120px; object-fit: contain; display: block; margin: 0 auto 6px; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ----------------------------------------------------- Técnico (móvil) */
.tech-hero { border-radius: 20px; padding: 20px; color: #fff; background: radial-gradient(circle at 90% 0%, rgba(0,213,245,.45), transparent 50%), linear-gradient(135deg, #06254B, #0866F5); }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 92px; border-radius: 18px; border: 0; font-weight: 600; font-size: .9rem; color: #fff; padding: 12px; text-align: center; box-shadow: 0 8px 18px rgba(6, 37, 75, .12); }
.big-btn [data-lucide] { width: 28px; height: 28px; }
.big-btn:disabled { opacity: .4; box-shadow: none; }
.big-btn.full { grid-column: 1 / -1; min-height: 64px; flex-direction: row; font-size: 1rem; }
.bb-blue { background: var(--ip-blue); } .bb-navy { background: var(--ip-navy); } .bb-orange { background: var(--ip-orange); }
.bb-green { background: #12A150; } .bb-yellow { background: var(--ip-yellow); color: #3B2A00; } .bb-cyan { background: #00A9C4; } .bb-red { background: #E5383B; } .bb-gray { background: #64748B; }
.bottom-nav { display: none; }
@media (max-width: 991.98px) {
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: var(--ip-surface); border-top: 1px solid var(--ip-border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--ip-muted); padding: 4px; border-radius: 10px; }
  .bottom-nav a.active { color: var(--ip-blue); font-weight: 600; }
  .bottom-nav [data-lucide] { width: 22px; height: 22px; }
}
.order-card { border-left: 4px solid var(--ip-blue); }

/* ----------------------------------------------------- Varios */
.plan-card { border: 2px solid var(--ip-border); border-radius: 18px; transition: .2s; }
.plan-card.featured { border-color: var(--ip-orange); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; background: var(--ip-surface-2); border: 1px solid var(--ip-border); font-size: .75rem; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--ip-border); color: var(--ip-text); }
.notif-item.unread { background: rgba(8, 102, 245, .06); }
.notif-item:hover { background: var(--ip-surface-2); color: var(--ip-text); }
.notif-menu { width: 340px; max-width: 92vw; padding: 0; overflow: hidden; }
.ref-thumb { width: 92px; height: 92px; object-fit: cover; border-radius: 12px; border: 1px solid var(--ip-border); }
.alert { border-radius: 14px; }
.trial-banner { background: linear-gradient(90deg, rgba(255,196,0,.18), rgba(255,121,0,.12)); border: 1px solid rgba(255,121,0,.3); color: var(--ip-text); border-radius: 14px; padding: 10px 14px; font-size: .85rem; }
.toast-container { z-index: 2000; }
.cursor-pointer { cursor: pointer; }
.min-w-0 { min-width: 0; }
@media print {
  .sidebar, .topbar, .no-print, .bottom-nav { display: none !important; }
  .main { margin: 0 !important; }
  .card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; }
}
.card-header > span > [data-lucide], .card-header > [data-lucide] { margin-right: 4px; }
.tech-hero [data-conn] .text-success { color: #7CF5B0 !important; }
