/* ========================================
   ARGENTUM FINANCE — DESIGN SYSTEM v3.0
   Flat / Clean / Professional
   ======================================== */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --border: #e2e8f0;
    --border-light: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    --emerald: #059669;
    --red: #dc2626;
    --blue: #2563eb;
    --purple: #7c3aed;
    --gold: #b8860b;
    --primary: #2563eb;
    --primary-brand: #0f172a;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: all 0.2s ease;
}

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

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    width: 44px; height: 44px;
    border: 3px solid rgba(0,0,0,0.08);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

html {
    overflow: hidden;
    height: 100%;
    /* Pinta el área del notch y del home indicator — sin esto iOS muestra cuadros blancos */
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f8fafc;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    height: 100%;
    overscroll-behavior: none;
    /* NO usar padding-top con safe-area aquí: sumaba al height:100% y desbordaba la pantalla
       (el contenido inferior quedaba fuera). El safe-area se maneja en el header sticky y el login. */
}

/* ===== SCREENS ===== */
/* Safe-area en pantallas de auth (login/registro/premium): el contenido no queda bajo el notch. */
.screen { display:none; height:100%; overflow-y:auto; overscroll-behavior: none; -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.screen.active { display:flex; }
/* screen-app: no necesita scroll propio, .main-content lo maneja.
   Eliminar overflow evita el stacking context iOS que rompía el sidebar.
   padding:0 — el safe-area lo manejan el mobile-header (arriba) y el main-content (abajo). */
#screen-app { overflow: hidden; padding: 0; -webkit-overflow-scrolling: auto; }

/* ===== LOGIN ===== */
.login-container {
    margin: auto;
    width: 100%;
    max-width: 420px;
    padding: 40px 24px;
}
.login-logo-wrap { text-align:center; margin-bottom:48px; }
.login-logo {
    width: 80px; height: 80px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    display: inline-flex; align-items:center; justify-content:center;
    color: #2563eb;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}
.login-title { font-size:32px; font-weight:900; letter-spacing:-0.03em; }
.login-subtitle { color:var(--text-secondary); font-size:14px; margin-top:8px; }
.login-form { display:flex; flex-direction:column; gap:16px; }
.input-group { display:flex; flex-direction:column; gap:6px; }
.input-group label { font-size:12px; font-weight:600; color:var(--text-secondary); letter-spacing:0.02em; }
.input-group input, .form-input {
    width:100%;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}
.input-group input:focus, .form-input:focus { border-color: #9aa5b8; box-shadow: 0 0 0 3px rgba(74,85,104,0.12); }

/* iOS Safari hace zoom automático al enfocar un input con font-size < 16px.
   En móvil forzamos 16px en todos los campos para que NUNCA se dispare ese zoom. */
@media (max-width: 768px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select, textarea,
    .form-input,
    .topbar-search input { font-size: 16px !important; }
}
.login-footer { text-align:center; font-size:13px; color:var(--text-muted); }
.login-footer a { color:var(--accent); text-decoration:none; font-weight:600; }

/* ===== BUTTONS ===== */
.btn-primary {
    padding: 10px 20px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:active { transform:scale(0.98); }
.btn-primary.small { padding:8px 16px; font-size:13px; }
.btn-primary.full { width:100%; justify-content: center; }

.btn-outline {
    padding: 8px 16px;
    background: #ffffff;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-outline:hover { border-color: #94a3b8; color:var(--text-primary); }
.btn-outline.small { padding:6px 12px; font-size:12px; }
.btn-outline.danger { color:var(--red); border-color:rgba(239,68,68,0.3); }

.btn-ghost {
    padding: 14px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
}

.btn-gold {
    margin-top:4px;
    padding: 18px;
    width: 100%;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(245,158,11,0.3);
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.btn-gold:hover { transform:translateY(-2px); box-shadow:0 12px 32px rgba(245,158,11,0.4); }

.link-btn { background:none; border:none; color:var(--accent); font-size:13px; font-weight:600; cursor:pointer; font-family:inherit; }
.icon-btn { background:none; border:none; color:var(--text-primary); cursor:pointer; padding:8px; }

/* ===== PREMIUM PAYWALL ===== */
.premium-container {
    margin: auto;
    max-width: 520px;
    padding: 20px 24px;
    text-align: center;
}
.premium-title { font-size:24px; font-weight:900; letter-spacing:-0.03em; margin-bottom:8px; white-space:nowrap; }
.premium-title span { background:linear-gradient(135deg,#c0cee4,#e8ecf4,#8d99ae); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.premium-desc { color:var(--text-secondary); font-size:14px; line-height:1.5; margin-bottom:24px; }
.premium-features { text-align:left; margin-bottom:24px; display:flex; flex-direction:column; gap:12px; }
.pf-item { display:flex; align-items:center; gap:12px; color:var(--text-primary); font-size:14px; font-weight:500; }
.pf-item svg { color:var(--emerald); flex-shrink:0; }
.premium-price-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.ppc-label { font-size:11px; color:var(--text-muted); font-weight:700; letter-spacing:0.03em; margin-bottom:4px; }
.ppc-price { display:flex; align-items:baseline; justify-content:center; gap:4px; }
.ppc-currency { font-size:13px; color:var(--text-muted); font-weight:600; }
.ppc-amount { font-size:36px; font-weight:900; letter-spacing:-0.03em; }
.ppc-period { font-size:14px; color:var(--text-muted); font-weight:500; }
.ppc-note { font-size:11px; color:var(--text-muted); margin-top:4px; }

/* ===== APP LAYOUT ===== */
/* 100dvh = viewport dinámico: en iOS Safari mide el alto REAL visible (con barras),
   100vh medía el viewport grande y cortaba el contenido. Fallback 100vh para navegadores viejos. */
.app-layout { display:flex; height:100vh; height:100dvh; width:100%; }

/* Sidebar */
.sidebar {
    width: 220px;
    background: #0f172a;
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    overscroll-behavior: contain;
}
.sidebar-header { padding:0 8px 24px; border-bottom:1px solid var(--border); margin-bottom:16px; }
.sidebar-logo { font-size:22px; font-weight:900; letter-spacing:-0.03em; color:#f0f2f5; }
.sidebar-version { font-size:11px; color:var(--text-muted); font-weight:600; margin-top:2px; letter-spacing:0.04em; }
.sidebar-version { color: #8a92a2; }

/* Powered by Maketrix */
.powered-by-maketrix {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 7px 10px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.2);
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
    cursor: pointer;
}
.powered-by-maketrix:hover {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.4);
}
.mkt-hex-logo {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(16,185,129,0.5));
}
.mkt-text-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.mkt-powered {
    font-size: 9px;
    font-weight: 600;
    color: rgba(16, 185, 129, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.mkt-brand {
    font-size: 13px;
    font-weight: 800;
    color: #10b981;
    letter-spacing: 0.01em;
    text-shadow: 0 0 12px rgba(16,185,129,0.4);
}
.sidebar-nav { flex:1; display:flex; flex-direction:column; gap:4px; }
.nav-item {
    display: flex; align-items:center; gap:12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: none; border:none;
    color: #9aa0ac;
    font-size: 14px; font-weight: 500;
    cursor: pointer; font-family:inherit;
    transition: var(--transition);
    width: 100%; text-align:left;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}
.nav-item:active { background: rgba(255,255,255,0.1); }
.nav-item:hover { color:#f0f2f5; background:rgba(255,255,255,0.06); }
.nav-item.active { color:#ffffff; background:#2563eb; font-weight:600; }
.nav-item.logout { color:#f87171; opacity:0.6; }
.nav-item.logout:hover { opacity:1; background:rgba(239,68,68,0.1); }

.sidebar-footer { border-top:1px solid var(--border); padding-top:16px; margin-top:auto; }
.sidebar-footer { border-top-color:rgba(255,255,255,0.06); }
.sidebar-user { display:flex; align-items:center; gap:12px; padding:8px; margin-bottom:8px; }
.sidebar-avatar {
    width:40px; height:40px;
    background: linear-gradient(135deg, #c0cee4, #8a92a2);
    border-radius:12px;
    display:flex; align-items:center; justify-content:center;
    font-size:14px; font-weight:800; color:white; flex-shrink:0;
}
.sidebar-avatar.small { width:32px; height:32px; font-size:11px; border-radius:10px; }
.sidebar-username { font-size:14px; font-weight:700; color:#f0f2f5; }
.sidebar-role { font-size:11px; color:#8a92a2; text-transform:uppercase; letter-spacing:0.05em; }

/* Sidebar overlay (mobile) */
.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:98; }
.sidebar-overlay.open { display:block; animation: fadeOverlay 0.28s ease forwards; }

/* Main Content */
.main-content { flex:1; overflow-y:auto; padding-bottom: 100px; overscroll-behavior: none; -webkit-overflow-scrolling: touch; }

/* Mobile Header */
.mobile-header {
    display: none;
    position: sticky; top:0; z-index:30;
    padding: 14px 20px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding-top: env(safe-area-inset-top, 14px);
}
.mobile-logo { font-size:18px; font-weight:800; letter-spacing:-0.02em; }

/* Views */
.view { display:none; padding:0; }
.view.active { display:block; }
.view-header { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:16px; margin-bottom:24px; padding:24px 32px 0; }
.view-title { font-size:24px; font-weight:700; letter-spacing:-0.01em; }
.view-subtitle { font-size:13px; color:var(--text-muted); margin-top:2px; }

/* ===== TOP BAR (reemplaza view-header para vistas principales) ===== */
.view-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 20;
}
.view-topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.view-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    color: var(--text-muted);
}
.topbar-search input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: var(--text-primary);
    font-family: inherit;
    width: 220px;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-bell { color: var(--text-muted); }

/* ===== DASHBOARD GREETING ===== */
.dash-greeting {
    padding: 24px 32px 0;
}
.dash-greeting-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.dash-greeting-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== DASHBOARD KPI GRID (mobile-first: 1 → 2 → 4) ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 20px 32px;
}

/* ===== DASHBOARD 2 COLUMNAS ===== */
.dash-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 0 32px 32px;
}
.dash-panel {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.dash-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}
.dash-panel-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.dash-panel-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== DASHBOARD RECENT LIST ===== */
.dash-recent-list { display: flex; flex-direction: column; gap: 0; }
.dash-recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}
.dash-recent-item:last-child { border-bottom: none; }
.dash-recent-item:hover { background: #f8fafc; margin: 0 -8px; padding: 12px 8px; border-radius: 6px; }
.dash-recent-left {}
.dash-recent-info { display: flex; flex-direction: column; gap: 2px; }
.dash-recent-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.dash-recent-sub  { font-size: 12px; color: var(--text-muted); }
.dash-recent-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.dash-recent-right { display: flex; align-items: center; gap: 12px; }
.dash-recent-amount { font-size: 14px; font-weight: 600; color: var(--text-primary); }

/* Filter Pills */
.filter-pills { display:flex; gap:6px; flex-wrap: wrap; align-items: center; }
/* Inputs de rango de fechas (Dashboard + Reportes) */
.dash-filter-row, .rp-filter-row { align-items: center; }
.dash-range-inputs, .rp-range-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
}
.range-input {
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    width: 128px;
}
.range-input:focus { border-color: var(--brand); }
.range-sep {
    color: var(--text-muted);
    font-size: 12px;
    padding: 0 2px;
}
/* En la modal (reportes) los inputs van con fondo de campo de modal */
.modal-sheet .range-input {
    background: var(--modal-field-bg);
    border-color: rgba(0,0,0,0.12);
    color: var(--modal-text);
}
.pill {
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--text-secondary);
    font-size: 12px; font-weight: 600;
    cursor: pointer; font-family:inherit;
    transition: var(--transition);
}
.pill.active, .pill:hover { background:#2563eb; color:#ffffff; border-color:#2563eb; }

/* ===== KPI CARDS ===== */
.kpi-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin-bottom:24px; }
.kpi-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition);
    box-shadow: var(--shadow);
}
.kpi-card:hover { box-shadow: var(--shadow-md); }
.kpi-card.primary { border-top: 3px solid var(--emerald); }
.kpi-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.kpi-icon.bg-emerald { background:rgba(5,150,105,0.08); color:var(--emerald); }
.kpi-icon.bg-blue { background:rgba(37,99,235,0.08); color:#2563eb; }
.kpi-icon.bg-red { background:rgba(220,38,38,0.08); color:var(--red); }
.kpi-icon.bg-purple { background:rgba(124,58,237,0.08); color:var(--purple); }
.kpi-card-header { display:flex; justify-content:space-between; align-items:flex-start; }
.kpi-label { font-size:12px; color:var(--text-muted); font-weight:500; letter-spacing:0.01em; margin-bottom:6px; }
.kpi-value { font-size:28px; font-weight:700; letter-spacing:-0.02em; line-height:1; }
.kpi-delta { font-size:11px; font-weight:600; margin-top:4px; }
.kpi-delta.up { color: var(--emerald); }
.kpi-delta.down { color: var(--red); }
.text-emerald { color:var(--emerald)!important; }
.text-red { color:var(--red)!important; }

/* ===== BUDGET TABLE + TABS ===== */
.budgets-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.budget-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.budget-tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -1px;
}
.budget-tab:hover { color: var(--text-primary); }
.budget-tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }
.budget-tab-badge {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 99px;
    min-width: 20px;
    text-align: center;
}
.budget-tab.active .budget-tab-badge {
    background: rgba(37,99,235,0.08);
    color: #2563eb;
}
.budget-table-wrap {
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    background: #ffffff;
    overflow: hidden;
}
/* Móvil: ocultar Categoría (col 2), Fecha (col 4) y el botón de opciones (col 6)
   para que Cliente/Estado/Total quepan SIN que el monto se corte. El nombre de
   cliente se trunca con ellipsis para garantizar que el monto siempre sea visible
   completo (antes: el monto se recortaba silenciosamente por overflow:hidden). */
@media (max-width: 600px) {
    .budget-table th:nth-child(2), .budget-table td:nth-child(2),
    .budget-table th:nth-child(4), .budget-table td:nth-child(4),
    .budget-table th:nth-child(6), .budget-table td:nth-child(6) { display: none; }
    .budget-table th, .budget-row td { padding-left: 8px; padding-right: 8px; }
    .budget-table-wrap { overflow-x: auto; }
    .budget-table td:nth-child(1) { width: 1%; }
    .budget-table td:nth-child(3) { width: 1%; }
    .budget-row-name, .budget-row-sub {
        max-width: 20vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    /* Select de estado editable: compacto para no competir por espacio con el monto */
    .budget-table td:nth-child(3) .quote-status-pill {
        max-width: 22vw; font-size: 10px; padding: 3px 14px 3px 6px;
        overflow: hidden; text-overflow: ellipsis;
    }
    .budget-amount { white-space: nowrap; }
}
.budget-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.budget-table thead tr {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}
.budget-table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.budget-row {
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.budget-row:last-child { border-bottom: none; }
.budget-row:hover { background: #f8fafc; }
.budget-row td { padding: 14px 16px; vertical-align: middle; }
.budget-row-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.budget-row-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.budget-category-tag {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}
.budget-date { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.budget-amount { font-size: 14px; font-weight: 600; color: var(--text-primary); text-align: right; white-space: nowrap; }
.budget-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}
.budget-action-btn:hover { background: #f1f5f9; color: var(--text-primary); }

/* ===== CHARTS ===== */
.charts-grid { display:grid; grid-template-columns:1fr; gap:16px; margin-bottom:24px; }
.chart-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.chart-title { font-size:13px; font-weight:600; color:var(--text-secondary); margin-bottom:16px; }
.chart-wrap { height:200px; position:relative; }
.chart-wrap.square { height:220px; max-width:260px; margin:0 auto; }

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
}
.badge-green { background: rgba(5,150,105,0.08); color: #059669; }
.badge-blue  { background: rgba(37,99,235,0.08);  color: #2563eb; }
.badge-gray  { background: rgba(100,116,139,0.08); color: #64748b; }
.badge-amber { background: rgba(217,119,6,0.08);  color: #d97706; }
.badge-red   { background: rgba(220,38,38,0.08);  color: #dc2626; }
.badge-dot { width:6px; height:6px; border-radius:50%; background:currentColor; }

/* ===== TRANSACTIONS LIST ===== */
.tx-list { display:flex; flex-direction:column; gap:0; }

/* Date groups */
.tx-date-group { margin-bottom:4px; }
.tx-date-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 0 6px;
}

/* Transaction row */
.tx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    background: transparent;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}
.tx-item:last-child { border-bottom: none; }
.tx-item:hover { background: #f8fafc; margin: 0 -8px; padding: 10px 8px; border-radius: 6px; border-bottom: 1px solid transparent; }
.tx-item:active { transform: scale(0.99); }

/* Left color stripe */
.tx-stripe {
    width: 4px;
    align-self: stretch;
    border-radius: 0 4px 4px 0;
    flex-shrink: 0;
    min-height: 44px;
}

/* Category icon bubble */
.tx-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 18px;
}

/* Middle text block */
.tx-body { flex: 1; min-width: 0; }
.tx-name { font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tx-meta { font-size:12px; color:var(--text-muted); margin-top:2px; }

/* Right: amount + delete */
.tx-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.tx-amount { font-size:15px; font-weight:700; white-space:nowrap; }
.tx-del-btn {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 8px;
    background: transparent; border: none;
    color: var(--text-muted); cursor: pointer;
    opacity: 0; transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}
.tx-item:hover .tx-del-btn { opacity: 1; }
.tx-del-btn:hover { background: rgba(239,68,68,0.12); color: #ef4444; }

/* Quote delete button */
.quote-delete-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px; border: none;
    background: transparent; color: var(--text-muted);
    cursor: pointer; flex-shrink: 0;
    opacity: 0; transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.tx-item:hover .quote-delete-btn { opacity: 1; }
.quote-delete-btn:hover { background: rgba(239,68,68,0.12); color: #ef4444; }

/* Stat summary cards */
.tx-stat-card {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    min-width: 110px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tx-stat-card span { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.tx-stat-card strong { font-size: 14px; font-weight: 700; }

/* Empty state */
.tx-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 48px 24px;
    color: var(--text-muted);
    text-align: center;
    font-size: 14px;
}
.tx-empty-state span { font-size: 36px; line-height: 1; }

/* Legacy: keep .tx-left for dashboard widget compact rows */
.tx-left { display:flex; align-items:center; gap:14px; }

.section-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.section-header h3 { font-size:15px; font-weight:700; }

.empty-state { text-align:center; padding:60px 20px; color:var(--text-muted); }
.empty-state svg { margin:0 auto 16px; opacity:0.3; }
.empty-state p { margin-bottom:20px; }

/* ===== BUDGETS ===== */
.budget-grid { display:grid; grid-template-columns:1fr; gap:16px; }
.budget-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.budget-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.budget-name { font-size:14px; font-weight:700; }
.budget-pct { font-size:13px; font-weight:700; }
.budget-bar { height:8px; background:var(--bg-primary); border-radius:99px; overflow:hidden; }
.budget-bar-fill { height:100%; border-radius:99px; transition:width 1s ease; }
.budget-meta { display:flex; justify-content:space-between; margin-top:10px; font-size:12px; color:var(--text-muted); }

/* ===== CATEGORIES ===== */
.cat-list-view { display:flex; flex-direction:column; gap:20px; }

/* Group */
.cat-group { display:flex; flex-direction:column; gap:1px; }
.cat-group-header {
    display:flex; align-items:center; gap:8px;
    padding:8px 4px 10px;
}
.cgh-icon  { font-size:16px; line-height:1; }
.cgh-label { font-size:13px; font-weight:700; letter-spacing:0.03em; }
.cgh-count {
    margin-left:auto;
    font-size:11px; font-weight:700;
    background:var(--bg-input); color:var(--text-muted);
    padding:2px 8px; border-radius:20px;
}

/* Item */
.cat-item {
    display:flex; align-items:center; gap:0;
    background:var(--bg-card);
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    overflow:hidden;
    transition:background 0.15s;
}
.cat-item:hover { background:var(--bg-input); }

.ci-stripe { width:4px; align-self:stretch; flex-shrink:0; }

.ci-icon {
    width:36px; height:36px; margin:12px 0 12px 12px;
    border-radius:8px; display:flex; align-items:center; justify-content:center;
    font-size:18px; flex-shrink:0;
}
.ci-icon-letter {
    font-size:14px; font-weight:800; border-radius:8px;
}

.ci-body {
    flex:1; min-width:0;
    display:flex; flex-direction:column; gap:2px;
    padding:12px 10px 12px 10px;
}
.ci-name  { font-size:14px; font-weight:600; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ci-usage { font-size:11px; color:var(--text-muted); }

.ci-actions { display:flex; align-items:center; gap:2px; padding:0 8px; }
.ci-btn {
    width:32px; height:32px; border:none; background:transparent;
    cursor:pointer; border-radius:6px;
    display:flex; align-items:center; justify-content:center;
    color:var(--text-muted); transition:background 0.15s, color 0.15s;
}
.ci-btn:hover { background:rgba(255,255,255,0.06); color:var(--text-primary); }
.ci-btn-del:hover { background:rgba(239,68,68,0.12); color:#ef4444; }

/* Empty state */
.cat-empty-state {
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    padding:56px 20px; gap:6px; color:var(--text-muted); text-align:center;
}

/* Modal: emoji + color row */
.cat-modal-bottom-row {
    display:flex; gap:12px; align-items:flex-end;
}
.cat-emoji-input { font-size:22px; text-align:center; padding:10px; }

/* Emoji quick-picks */
.cat-emoji-picks {
    display:flex; flex-wrap:wrap; gap:6px;
    margin:-4px 0 8px;
}
.cep-btn {
    width:36px; height:36px; border:1px solid var(--border);
    background:var(--bg-input); border-radius:8px;
    font-size:18px; cursor:pointer; display:flex; align-items:center; justify-content:center;
    transition:background 0.15s, transform 0.1s;
}
.cep-btn:hover { background:var(--bg-card); transform:scale(1.15); }

/* Keep dot for tx category selector */
.cat-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }

/* ===== REPORTS ===== */
.rp-period-row {
    display:flex; gap:6px; margin-bottom:20px;
    overflow-x:auto; padding-bottom:4px;
    scrollbar-width:none; flex-wrap: wrap; align-items: center;
}
.rp-period-row::-webkit-scrollbar { display:none; }
.rp-pill {
    padding:6px 14px; border-radius:99px;
    border:1px solid var(--border);
    background:transparent; color:var(--text-muted);
    font-size:12px; font-weight:600;
    cursor:pointer; white-space:nowrap; transition:all 0.15s;
}
.rp-pill.active { background:var(--bg-secondary); color:var(--text-primary); border-color:var(--border); }
.rp-pill:hover:not(.active) { border-color:var(--border-light); color:var(--text-primary); }

/* Stat cards */
.rp-stats-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:24px; }
.rp-stat-card {
    background:var(--bg-card); border:1px solid var(--border);
    border-radius:var(--radius-sm); padding:14px;
    display:flex; align-items:flex-start; gap:10px;
}
.rp-stat-icon {
    width:36px; height:36px; border-radius:8px;
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.rp-stat-info { display:flex; flex-direction:column; gap:1px; min-width:0; }
.rp-stat-label { font-size:10px; color:var(--text-muted); font-weight:600; letter-spacing:0.02em; }
.rp-stat-value { font-size:15px; font-weight:900; line-height:1.2; margin:2px 0; }
.rp-stat-sub   { font-size:10px; color:var(--text-muted); }

/* Sections */
.rp-section { margin-bottom:24px; }
.rp-section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.rp-section-title  { font-size:13px; font-weight:700; color:var(--text-primary); }
.rp-empty { font-size:13px; color:var(--text-muted); padding:20px 0; text-align:center; }

/* Category bars */
.rp-cat-row    { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.rp-cat-label  { display:flex; align-items:center; gap:6px; width:110px; flex-shrink:0; }
.rp-cat-ico    { font-size:13px; width:18px; text-align:center; flex-shrink:0; }
.rp-cat-name   { font-size:12px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rp-bar-wrap   { flex:1; height:6px; background:var(--bg-input); border-radius:99px; overflow:hidden; }
.rp-bar        { height:100%; border-radius:99px; transition:width 0.5s ease; min-width:4px; }
.rp-cat-share  { font-size:10px; color:var(--text-muted); width:30px; text-align:right; flex-shrink:0; }
.rp-cat-amt    { font-size:12px; font-weight:700; white-space:nowrap; width:82px; text-align:right; flex-shrink:0; }

/* Export buttons */
.rp-export-grid { display:flex; flex-direction:column; gap:8px; }
.rp-export-btn {
    display:flex; align-items:center; gap:12px;
    padding:14px 16px; border-radius:var(--radius-sm);
    background:var(--bg-card); border:1px solid var(--border);
    cursor:pointer; text-align:left; width:100%;
    transition:background 0.15s, border-color 0.15s;
}
.rp-export-btn:hover:not(.rp-export-soon) { border-color:var(--border-light); background:var(--bg-input); }
.rp-export-soon { cursor:default; opacity:0.6; }
.rp-export-icon {
    width:44px; height:44px; border-radius:10px;
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.rp-export-info { flex:1; display:flex; flex-direction:column; gap:2px; min-width:0; }
.rp-export-name { font-size:14px; font-weight:700; }
.rp-export-desc { font-size:12px; color:var(--text-muted); }

.badge-soon {
    padding:4px 10px; background:rgba(99,102,241,0.15); color:var(--accent);
    border-radius:99px; font-size:10px; font-weight:700; text-transform:uppercase;
    flex-shrink:0;
}

/* ===== SETTINGS ===== */
.settings-list { display:flex; flex-direction:column; gap:8px; }

/* Section labels */
.settings-section-label {
    font-size:11px; font-weight:800; text-transform:uppercase;
    letter-spacing:0.06em; color:var(--text-muted);
    padding:12px 4px 4px; margin-top:4px;
}
.settings-section-label:first-child { padding-top:0; margin-top:0; }
.settings-section-label.danger-label { color:#ef4444; }

/* Base item */
.setting-item {
    display:flex; justify-content:space-between; align-items:center;
    gap:12px;
    padding:16px 18px;
    background:var(--bg-card); border:1px solid var(--border);
    border-radius:var(--radius-sm);
}
.setting-item h4 { font-size:14px; font-weight:600; margin-bottom:3px; }
.setting-item > div > p { font-size:12px; color:var(--text-muted); line-height:1.4; }

/* Danger zone */
.si-danger-item { border-color:rgba(239,68,68,0.20); }
.si-danger-item h4 { color:#f87171; }

/* ── Sección Equipo embebida (PRP-020) ───────────────────────────────── */
.setting-item-team { flex-direction: column; align-items: stretch; gap: 12px; }
.setting-team-header {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.settings-team-list { display: flex; flex-direction: column; gap: 4px; }
.team-list-loading { font-size: 12px; color: var(--text-muted); padding: 4px 0; }
.team-member-row {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.team-row-pending { opacity: 0.7; }
.team-member-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.team-member-name {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.team-member-email { font-size: 11px; color: var(--text-muted); }
.team-member-role {
    font-size: 11px; font-weight: 700; padding: 3px 8px;
    border-radius: 99px; white-space: nowrap; flex-shrink: 0;
}
.team-role-owner  { background: rgba(16,185,129,0.15); color: #10b981; }
.team-role-editor { background: rgba(99,102,241,0.15);  color: #818cf8; }
.team-role-viewer { background: rgba(148,163,184,0.15); color: #94a3b8; }
.team-pending-tag {
    font-size: 10px; font-weight: 600; color: #f59e0b;
    background: rgba(245,158,11,0.12); border-radius: 4px; padding: 1px 5px;
    margin-left: 4px;
}
.team-list-note {
    font-size: 12px; color: var(--text-muted); padding: 6px 2px; line-height: 1.5;
}

/* Profile row */
.si-profile-item { gap:14px; }
.si-avatar {
    width:52px; height:52px; border-radius:14px; flex-shrink:0;
    display:flex; align-items:center; justify-content:center;
    font-size:22px; font-weight:900; border:2px solid transparent;
    transition:background 0.3s, color 0.3s;
}
.si-profile-info { flex:1; min-width:0; }
.si-company { font-size:15px; font-weight:700; margin-bottom:2px;
              white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.si-email   { font-size:12px; color:var(--text-muted);
              white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Logo row */
.si-logo-item { align-items:flex-start; gap:12px; }
.si-logo-right {
    display:flex; flex-direction:column; align-items:flex-end; gap:8px; flex-shrink:0;
}
.si-logo-preview-wrap {
    width:72px; height:72px; border-radius:10px;
    border:1px solid var(--border); background:var(--bg-input);
    display:flex; align-items:center; justify-content:center; overflow:hidden;
}
.si-logo-preview-wrap img { width:100%; height:100%; object-fit:contain; }
.si-logo-placeholder { color:var(--text-muted); display:flex; align-items:center; justify-content:center; width:100%; height:100%; }
.si-logo-btns { display:flex; align-items:center; gap:6px; }

/* Color swatch grid */
.si-color-item { align-items:flex-start; gap:12px; flex-wrap:wrap; }
.color-presets-grid {
    display:flex; flex-wrap:wrap; gap:7px; justify-content:flex-end;
    max-width:180px;
}
.color-swatch {
    width:26px; height:26px; border-radius:50%; cursor:pointer;
    border:2px solid transparent; transition:all 0.2s;
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.color-swatch:hover { transform:scale(1.15); }
.color-swatch.active { border-color:white; box-shadow:0 0 0 3px rgba(255,255,255,0.2); }

/* Custom color swatch (label wrapping input[type=color]) */
.color-swatch-custom {
    background: conic-gradient(#ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6, #ef4444);
    color:white; position:relative; overflow:hidden;
}
.color-swatch-custom input[type=color] {
    position:absolute; inset:0; opacity:0; width:100%; height:100%; cursor:pointer; border:none; padding:0;
}
.color-swatch-custom:hover { transform:scale(1.15); }

/* Plan badge */
.set-plan-badge {
    padding:3px 10px; border-radius:99px; font-size:10px; font-weight:800; text-transform:uppercase;
}
.set-plan-badge.free    { background:rgba(100,116,139,0.15); color:#94a3b8; }
.set-plan-badge.premium { background:rgba(16,185,129,0.15); color:#10b981; }

/* Reset modal */
.reset-modal-icon {
    width:60px; height:60px; border-radius:50%; background:rgba(239,68,68,0.12);
    color:#ef4444; display:flex; align-items:center; justify-content:center;
    margin:0 auto 14px;
}
.reset-confirm-input { text-transform:uppercase; letter-spacing:0.1em; font-weight:700; text-align:center; }
.btn-danger {
    width:100%; padding:14px; border-radius:var(--radius-sm);
    background:#ef4444; color:white; font-weight:800; font-size:15px;
    border:none; cursor:pointer; transition:opacity 0.2s;
    display:flex; align-items:center; justify-content:center; gap:8px;
}
.btn-danger:disabled { opacity:0.35; cursor:not-allowed; }
.btn-danger:not(:disabled):hover { background:#dc2626; }

/* App version */
.settings-version {
    text-align:center; font-size:10px; color:var(--text-muted);
    padding:20px 0 8px; opacity:0.5;
}

/* ===== FAB ===== */
.fab {
    position:fixed; bottom:90px; right:24px;
    width:60px; height:60px;
    background:linear-gradient(135deg, #3a3f4a, #2a2e36);
    color:#f0f2f5;
    border-radius:18px; border:none;
    display:flex; align-items:center; justify-content:center;
    box-shadow:0 8px 24px rgba(0,0,0,0.2);
    cursor:pointer; z-index:40;
    transition:var(--transition);
}
.fab:hover { transform:scale(1.05); }
.fab:active { transform:scale(0.95); }

/* ===== BOTTOM NAV (Mobile) ===== */
.bottom-nav {
    display:none;
    position:fixed; bottom:0; left:0; right:0;
    background:rgba(255,255,255,0.96);
    backdrop-filter:blur(20px);
    -webkit-backdrop-filter:blur(20px);
    border-top:1px solid var(--border);
    padding:8px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    z-index:35;
    justify-content:space-around; align-items:center;
}
.bnav-item {
    display:flex; flex-direction:column; align-items:center; gap:4px;
    background:none; border:none; color:var(--text-muted);
    font-size:10px; font-weight:600; cursor:pointer; font-family:inherit;
    padding:6px 12px; transition:var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.bnav-item.active { color:var(--accent); }
.bnav-fab-space { width:60px; }

/* ===== MODAL ===== */
.modal-overlay {
    display:none; position:fixed; inset:0; z-index:200;
    background:rgba(0,0,0,0.6); backdrop-filter:blur(4px);
    align-items:flex-end; justify-content:center;
}
.modal-overlay.open { display:flex; animation: fadeOverlay 0.3s ease forwards; }
.modal-sheet {
    background: #ffffff;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    width:100%; max-width:500px;
    padding:28px 24px 40px; color:#0f172a;
    max-height:90vh; overflow-y:auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.10);
}
.modal-sheet.small { max-width:420px; }
.modal-sheet.wide { max-width:800px; }
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
@keyframes fadeOverlay { from{opacity:0} to{opacity:1} }
.modal-handle { width:40px; height:4px; background:var(--border-light); border-radius:99px; margin:0 auto 24px; }
.modal-title { font-size:20px; font-weight:800; text-align:center; margin-bottom:24px; }

/* ── MÓVIL: padding reducido y grids a 1 columna en modales ─────────────── */
@media (max-width: 480px) {
    .modal-sheet {
        /* +safe-area abajo: el botón/contenido final no queda bajo el home indicator del iPhone */
        padding: 20px 16px calc(32px + env(safe-area-inset-bottom, 0px));
    }
    .modal-sheet .input-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .modal-title { font-size: 18px; }
}

/* ── DESKTOP: modales centrados (bottom-sheet solo en móvil) ────────────── */
@media (min-width: 768px) {
    .modal-overlay {
        align-items: center;
    }
    .modal-sheet {
        border-radius: 16px;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 40px rgba(0,0,0,0.12);
        animation: modalScaleIn 0.25s ease;
        width: auto;
        min-width: 420px;
    }
    .modal-sheet.small { min-width: 380px; }
    .modal-sheet.wide  { min-width: 600px; }
    /* Ocultar handle (no es útil en desktop) */
    .modal-sheet > .modal-handle { display: none; }
}
@keyframes modalScaleIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

/* ══════════════════════════════════════════════════════════════════
   MODO OSCURO COHERENTE — todos los .modal-sheet
   Regla pwa-ux: texto claro sobre fondo oscuro, ≥4.5:1 contraste,
   no blanco puro (evita halo), font-weight≥500, placeholders visibles.
   Público: maestros 40-60+, vista cansada, celulares viejos.
   ══════════════════════════════════════════════════════════════════ */
.modal-sheet {
    --modal-text:        #0f172a;
    --modal-text-soft:   #475569;
    --modal-text-faint:  #94a3b8;
    --modal-field-bg:    #f8fafc;
    --modal-field-bg-2:  #f1f5f9;
    --modal-border:      #e2e8f0;
    --modal-border-focus:#2563eb;
}

/* ── Texto suelto en modales ─────────────────────── */
.modal-sheet .modal-title { color: var(--modal-text); }
.modal-sheet p             { color: var(--modal-text-soft); }
.modal-sheet .ws-modal-hint,
.modal-sheet .sub-footnote,
.modal-sheet .sub-status-desc { color: var(--modal-text-soft); }

/* ── Labels de formulario ────────────────────────── */
.modal-sheet .input-group label,
.modal-sheet .field-label,
.modal-sheet .step-label,
.modal-sheet label,
.modal-sheet .section-label { color: var(--modal-text-soft); }

/* ── Inputs, selects, textareas ──────────────────── */
.modal-sheet .form-input,
.modal-sheet input:not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]),
.modal-sheet select,
.modal-sheet textarea {
    background: var(--modal-field-bg) !important;
    border-color: var(--modal-border) !important;
    color: var(--modal-text) !important;
    font-weight: 500;
}
.modal-sheet .form-input::placeholder,
.modal-sheet input::placeholder,
.modal-sheet textarea::placeholder {
    color: var(--modal-text-faint) !important;
    opacity: 1;
}
.modal-sheet .form-input:focus,
.modal-sheet input:focus,
.modal-sheet select:focus,
.modal-sheet textarea:focus {
    border-color: var(--modal-border-focus) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.10) !important;
}
/* Select options — fondo coherente */
.modal-sheet select option {
    background: #ffffff;
    color: #0f172a;
}

/* ── Hint / sub-label oscuro ─────────────────────── */
.modal-sheet .pm-field-hint { color: var(--modal-text-faint); }

/* ── Sub-bloques que tenían fondo claro dentro del modal ──────────────── */

/* Toggle Gasto/Ingreso */
.modal-sheet .tx-type-toggle {
    background: var(--modal-field-bg-2);
}
.modal-sheet .tt-btn { color: var(--modal-text-soft); }

/* Monto grande (transacción) */
.modal-sheet .amount-currency { color: var(--modal-text-faint); }
.modal-sheet .amount-input    { color: var(--modal-text); }
.modal-sheet .amount-input::placeholder { color: var(--modal-text-faint); }

/* Categorías de transacción */
.modal-sheet .cat-sel-btn {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.08);
    color: var(--modal-text-soft);
}
.modal-sheet .cat-sel-btn:hover { border-color: rgba(255,255,255,0.2); }
.modal-sheet .cat-sel-btn.selected {
    border-color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.12);
    color: var(--modal-text);
}
.modal-sheet .cat-sel-name { color: inherit; }

/* Bloque Precio y Margen (modal producto) */
.modal-sheet .pm-price-block {
    background: var(--modal-field-bg-2);
    border-color: var(--modal-border);
}
.modal-sheet .pm-price-block-hint { color: var(--modal-text-faint); }

/* ── Texto de elementos varios en modales ─────────────────────────────── */
.modal-sheet .desc-required   { color: #f87171; }
.modal-sheet h4, .modal-sheet h3 { color: var(--modal-text); }
.modal-sheet .sub-status-badge { border: 1px solid rgba(255,255,255,0.15); }
.modal-sheet .sub-pay-empty   { color: var(--modal-text-faint); }
.modal-sheet .sub-payments-title { color: var(--modal-text-soft); }

/* ── Modal Quote — input de número (debe ser transparente) ─────────────── */
.modal-sheet .quote-number-input {
    background: transparent !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: 1px dashed rgba(255,255,255,0.25) !important;
    color: var(--modal-text-soft) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.modal-sheet .modal-subtitle { color: var(--modal-text-soft); }

/* ── Easy.cl sync modal ───────────────────────────────────────────────── */
.modal-sheet .ea-search-wrap {
    background: var(--modal-field-bg);
    border-color: var(--modal-border);
}
.modal-sheet .ea-search-wrap:focus-within {
    border-color: rgba(255,255,255,0.35);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.07);
}
.modal-sheet .ea-dropdown {
    background: #2f3545;
    border-color: var(--modal-border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.modal-sheet .ea-ri-name { color: var(--modal-text); }
.modal-sheet .ea-ri-cat  { color: var(--modal-text-faint); }
.modal-sheet .ea-result-item:hover,
.modal-sheet .ea-result-item.ea-focused { background: rgba(255,255,255,0.07); }
.modal-sheet .ea-result-item + .ea-result-item { border-color: var(--modal-border); }

/* Easy — lista de productos vinculados */
.modal-sheet .easy-linked-item {
    background: var(--modal-field-bg-2);
    border-color: var(--modal-border);
}
.modal-sheet .eli-name { color: var(--modal-text); }
.modal-sheet .eli-meta { color: var(--modal-text-faint); }
.modal-sheet #easy-linked-count { color: var(--modal-text-soft); }

/* ── Detalle de producto (.pdet-sheet es también .modal-sheet) ─────────── */
.modal-sheet .pdet-name      { color: var(--modal-text); }
.modal-sheet .pdet-sku       { color: var(--modal-text-faint); }
.modal-sheet .pdet-price-label { color: var(--modal-text-faint); }
.modal-sheet .pdet-price-val { color: var(--modal-text); }
.modal-sheet .pdet-meta-label { color: var(--modal-text-faint); }
.modal-sheet .pdet-meta-val  { color: var(--modal-text); }
.modal-sheet .pdet-price-divider { background: var(--modal-border); }
.modal-sheet .pdet-delete-btn { color: #f87171; opacity: 0.7; }
.modal-sheet .pdet-delete-btn:hover { opacity: 1; }

/* ── Workspace/Members modales ─────────────────────────────────────────── */
.modal-sheet .ws-list-item,
.modal-sheet .member-item { color: var(--modal-text); }
.modal-sheet .ws-item-role { color: var(--modal-text-faint); }
.modal-sheet .members-loading { color: var(--modal-text-soft); }

/* Filas de workspace — sobrescribir colores oscuros del tema global */
.modal-sheet .ws-row {
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.08);
}
.modal-sheet .ws-row-active {
    border-color: rgba(16,185,129,0.5);
    background: rgba(16,185,129,0.08);
}
.modal-sheet .ws-row-main {
    color: var(--modal-text);
}
.modal-sheet .ws-row-name {
    color: var(--modal-text);
}
.modal-sheet .ws-row-act {
    color: var(--modal-text-faint);
}
.modal-sheet .ws-row-act:hover {
    color: var(--modal-text);
    background: rgba(0,0,0,0.06);
}
.modal-sheet .ws-row-act.ws-row-del:not([disabled]):hover {
    color: #dc2626;
    background: rgba(220,38,38,0.08);
}
/* Badges de rol dentro del modal */
.modal-sheet .ws-role-badge {
    background: rgba(0,0,0,0.08);
    color: var(--modal-text-soft);
}
/* Invitaciones pendientes */
.modal-sheet .ws-invites-title { color: var(--modal-text); }
.modal-sheet .ws-invite-name   { color: var(--modal-text); }
.modal-sheet .ws-invite-role   { color: var(--modal-text-soft); }
.ws-invite-by { font-style: italic; opacity: 0.8; }

/* ══════════════════════════════════════════════════════════════════
   LEGIBILIDAD PARA PÚBLICO OBJETIVO (pwa-ux — dark-mode-physiology)
   Maestros 40-60+, vista cansada, celulares antiguos.
   Reglas: labels ≥13px, inputs 16px, font-weight ≥500, line-height ≥1.6,
   touch targets ≥44×44px.
   ══════════════════════════════════════════════════════════════════ */

/* ── Tamaños y pesos dentro de modales ──────────────────────────── */
.modal-sheet .modal-title     { font-size: 22px; font-weight: 800; line-height: 1.3; }
.modal-sheet .input-group label,
.modal-sheet .field-label,
.modal-sheet .step-label      { font-size: 13px; font-weight: 600; }
.modal-sheet .form-input,
.modal-sheet input:not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]),
.modal-sheet select,
.modal-sheet textarea          { font-size: 16px !important; }  /* evita zoom iOS */
.modal-sheet p                 { line-height: 1.65; }
.modal-sheet .ws-modal-hint    { font-size: 14px; line-height: 1.65; }

/* ── Touch targets ≥44×44px ─────────────────────────────────────── */
.modal-sheet .btn-primary,
.modal-sheet .btn-outline,
.modal-sheet .btn-ghost,
.modal-sheet .btn-gold         { min-height: 48px; font-size: 15px; }
.modal-sheet .btn-primary.small,
.modal-sheet .btn-outline.small,
.modal-sheet .btn-ghost.small  { min-height: 40px; font-size: 13px; }

/* Botones de solo icono en modales */
.modal-sheet button[title],
.modal-sheet .pdet-close-btn,
.modal-sheet .btn-close-modal  { min-width: 44px; min-height: 44px; }

/* ── Inputs de monto (transacción) — debe ser legible grande ────── */
.modal-sheet .amount-input     { font-size: 52px; font-weight: 900; }
.modal-sheet .amount-currency  { font-size: 26px; }

/* Transaction Type Toggle */
.tx-type-toggle { display:flex; background:var(--bg-card); border-radius:var(--radius-sm); padding:4px; margin-bottom:24px; }
.tt-btn {
    flex:1; padding:12px; border:none; background:none;
    color:var(--text-muted); font-size:14px; font-weight:700;
    border-radius:var(--radius-xs); cursor:pointer; font-family:inherit;
    transition:var(--transition);
}
.tt-btn.active { background:var(--red); color:white; }
.tt-btn.active.income-active { background:var(--emerald); }

/* Amount Input */
.amount-input-wrap { display:flex; align-items:center; justify-content:center; margin-bottom:24px; }
.amount-currency { font-size:28px; color:var(--text-muted); font-weight:300; margin-right:4px; }
.amount-input {
    font-size:56px; font-weight:900; color:var(--text-primary);
    background:none; border:none; outline:none;
    width:200px; text-align:center; font-family:inherit;
}
.amount-input::placeholder { color:var(--text-muted); }

.field-label { font-size:12px; font-weight:700; color:var(--text-secondary); letter-spacing:0.02em; margin-bottom:10px; display:block; }

/* Category Selector Grid */
.cat-select-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-bottom:20px; }
.cat-sel-btn {
    padding:14px 8px; border-radius:var(--radius-sm);
    background:rgba(220,220,225,0.06); border:2px solid transparent;
    display:flex; flex-direction:column; align-items:center; gap:6px;
    cursor:pointer; transition:var(--transition); font-family:inherit;
    color:var(--text-secondary);
}
.cat-sel-btn:hover { border-color:rgba(220,220,225,0.18); }
.cat-sel-btn.selected { border-color:var(--accent); background:rgba(37,99,235,0.06); color:var(--text-primary); }
.cat-sel-dot { width:8px; height:8px; border-radius:50%; }
.cat-sel-name { font-size:11px; font-weight:700; text-transform:uppercase; }

.form-color { width:100%; height:48px; border:none; border-radius:var(--radius-xs); cursor:pointer; background:var(--bg-card); }

.hidden { display:none!important; }

/* ===== RESPONSIVE ===== */
@media (min-width: 540px) {
    .kpi-grid { grid-template-columns:repeat(2,1fr); }
}

@media (min-width: 768px) {
    .charts-grid { grid-template-columns:2fr 1fr; }
    .budget-grid { grid-template-columns:repeat(2,1fr); }
}

@media (min-width: 1024px) {
    .kpi-grid { grid-template-columns:repeat(4,1fr); }
    .charts-grid.wide { grid-template-columns:2fr 1fr; }
    .fab { bottom:32px; right:32px; }
    .mobile-header { display:none!important; }
    .bottom-nav { display:none!important; }
    .main-content { padding-bottom:24px; }
    .dash-two-col { grid-template-columns:1fr 1fr; }
}

@media (max-width: 1023px) {
    .dash-two-col { grid-template-columns:1fr; }
    .view-topbar-actions .topbar-search { display:none; }
}

@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        top: 0; bottom: 0;
        left: 0;
        width: 270px;
        z-index: 9999;
        /* transform en vez de left: GPU compositing, sin bugs de touch en iOS */
        -webkit-transform: translate3d(-100%, 0, 0);
        transform: translate3d(-100%, 0, 0);
        will-change: transform;
        -webkit-transition: -webkit-transform 0.28s ease;
        transition: transform 0.28s ease;
    }
    .sidebar.open {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
    .sidebar-overlay { z-index: 9998; }
    .mobile-header { display:flex!important; }
    .bottom-nav { display:flex!important; z-index: 50; }
    /* Clearance del bottom-nav fijo (~64px) + home indicator: sin esto el último
       bloque queda oculto detrás de la barra inferior al hacer scroll. */
    .main-content { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
    .view { padding:20px; }
    /* Vistas rediseñadas: full-bleed (la topbar es una barra que debe llegar a los bordes,
       el padding:20px de arriba la recortaba y la hacía ver como una caja flotante). */
    #view-inicio, #view-dashboard, #view-budgets, #view-transactions, #view-products { padding:0; }
    /* Contención de overflow horizontal: sin esto cualquier hijo más ancho que el
       viewport (tabs, tabla) ensancha la página y la empuja → contenido cortado a la izquierda. */
    #screen-app, .app-layout, .main-content { max-width:100vw; overflow-x:hidden; }
    /* Topbar: en móvil NO sticky (evita el doble-sticky con el mobile-header que los superponía)
       y más compacta. El título se oculta porque ya está el logo en el mobile-header. */
    .view-topbar { position:static; padding:12px 16px; gap:8px; }
    .view-topbar-title { display:none; }
    .view-topbar-actions { flex:1; justify-content:flex-end; min-width:0; }
    /* Tabs: scroll horizontal INTERNO en vez de ensanchar la vista */
    .budget-tabs { overflow-x:auto; flex-wrap:nowrap; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
    .budget-tabs::-webkit-scrollbar { display:none; }
    .budget-tab { flex-shrink:0; white-space:nowrap; }
    .dash-greeting { padding:16px 16px 0; }
    .dash-greeting-title { font-size:22px; }
    .view-title { font-size:22px; }
    /* FAB sobre el bottom-nav respetando el home indicator */
    .fab { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
    .kpi-value { font-size:20px; }
    .amount-input { font-size:44px; width:160px; }
}

@media (max-width: 480px) {
    .cat-select-grid { grid-template-columns:repeat(3,1fr); }
    .filter-pills {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        scrollbar-width: none;
    }
    .filter-pills::-webkit-scrollbar { display: none; }
    .pill {
        flex-shrink: 0;
        white-space: nowrap;
        text-align: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

/* MAKETRIX CORPORATE THEME */
:root {
    --maketrix-emerald: #10b981;
    --maketrix-onyx: #0f172a;
    --maketrix-slate: #1e293b;
}

.btn-emerald {
    background: var(--maketrix-emerald);
    color: white;
    font-weight: 700;
    border-radius: 12px;
    transition: all 0.2s;
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39);
}

.btn-emerald:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.23);
    filter: brightness(1.1);
}

.status-select {
    background: var(--maketrix-slate);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
}

.crm-section {
    margin-bottom: 20px;
}

.client-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.client-pill {
    background: var(--maketrix-slate);
    color: #94a3b8;
    padding: 8px 16px;
    border-radius: 12px;
    white-space: nowrap;
    font-size: 13px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s;
}

.client-pill:hover {
    border-color: var(--maketrix-emerald);
    color: white;
}

.quote-item-row {
    display: grid;
    grid-template-columns: 80px 1fr 70px 60px 100px 36px;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.close-modal-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.close-modal-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.form-input.small {
    font-size: 12px;
    padding: 8px;
}

.profit-dashboard {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.profit-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profit-item span:first-child {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.05em;
}

.cost-value { color: #f1f5f9; font-weight: 700; }
.margin-value { color: var(--maketrix-emerald); font-weight: 900; font-size: 18px; }
.total-value { color: white; font-weight: 900; font-size: 20px; }

.low-margin .margin-value {
    color: #ef4444;
}

.delete-btn {
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    transition: color 0.2s;
}

.delete-btn:hover {
    color: #ef4444;
}

/* ===== QUOTES REMASTERED STYLES ===== */
.quotes-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.q-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.q-stat-card.q-stat-highlight {
    border-color: rgba(6,182,212,0.35);
    background: rgba(6,182,212,0.04);
}
.q-stat-label { font-size: 11px; color: var(--text-muted); font-weight: 700; margin-bottom: 2px; }
.q-stat-value { font-size: 20px; font-weight: 800; color: var(--accent); }
.q-stat-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== DASHBOARD QUOTE SUMMARY ===== */
.dash-quote-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}
.dash-q-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.dash-q-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-q-label { font-size: 11px; color: var(--text-muted); font-weight: 700; margin: 0 0 2px; }
.dash-q-value { font-size: 18px; font-weight: 800; margin: 0 0 2px; }
.dash-q-sub   { font-size: 11px; color: var(--text-muted); margin: 0; }

@media (max-width: 480px) {
    .dash-quote-grid { grid-template-columns: 1fr; }
    .quotes-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.modal-header-pro {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.quote-number-input {
    font-size: 13px; color: var(--text-muted); margin-top: 4px;
    background: transparent; border: none; border-bottom: 1px dashed var(--border);
    outline: none; padding: 1px 2px; width: 160px; font-family: inherit; cursor: text;
}
.quote-number-input:focus { border-bottom-color: var(--primary-brand); color: var(--text-primary); }
.modal-actions { display: flex; align-items: center; gap: 12px; }

.status-badge-select {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    outline: none;
    cursor: pointer;
}
.status-badge-select option {
    background: #1e293b;
    color: #f1f5f9;
    font-weight: 500;
}

.quote-modal-body {
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 16px;
}
.quote-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.section-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-input.highlight { border-color: var(--accent); font-weight: 600; }

.glosas-list { display: flex; flex-direction: column; gap: 20px; }

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.config-box {
    background: rgba(0,0,0,0.2);
    padding: 16px;
    border-radius: var(--radius-sm);
}

.tax-options { display: flex; gap: 12px; margin-top: 8px; }
.tax-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}
.tax-option input { accent-color: var(--maketrix-emerald); }

.range-wrap { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.range-val { font-weight: 800; color: var(--maketrix-emerald); min-width: 40px; }

.quote-modal-footer {
    position: sticky;
    bottom: 0;
    background: #ffffff;
    padding-top: 20px;
    padding-bottom: 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
}

.profit-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.ps-item {
    background: rgba(0,0,0,0.3);
    padding: 16px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ps-item.highlight { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); }
.ps-label { font-size: 10px; font-weight: 700; color: var(--text-muted); }
.ps-value { font-size: 18px; font-weight: 800; }
.ps-item.highlight .ps-value { color: var(--maketrix-emerald); font-size: 22px; }

/* Legacy */
.footer-actions { display: flex; justify-content: space-between; align-items: center; }
.action-group { display: flex; gap: 12px; align-items: center; }
.btn-primary.large { padding: 14px 28px; font-size: 15px; }

/* ===== QUOTE MODAL — FOOTER ACTIONS REDESIGN ===== */
.quote-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.qa-row-secondary {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.qa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s;
    border: 1px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
}
.qa-cancel {
    background: transparent;
    color: var(--text-muted);
    border-color: rgba(255,255,255,0.08);
}
.qa-cancel:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.04); }
.qa-link {
    background: rgba(16,185,129,0.08);
    color: #10b981;
    border-color: rgba(16,185,129,0.18);
}
.qa-link:hover { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); }
.qa-save {
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    border-color: var(--border-light);
}
.qa-save:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); border-color: rgba(255,255,255,0.25); }
.qa-pdf {
    height: 48px;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: transparent;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(16,185,129,0.28);
    letter-spacing: 0.01em;
}
.qa-pdf:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16,185,129,0.36); }
.qa-pdf:active { transform: scale(0.98); }

/* ── Footer simplificado: 2 CTAs + Más opciones ──────────────────────── */
.qa-row-primary {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
}
.qa-cancel-solo {
    background: transparent;
    color: var(--modal-text-soft, #4a4e5a);
    border: 1px solid rgba(0,0,0,0.15);
    height: 48px;
    padding: 0 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    transition: all 0.18s;
}
.qa-cancel-solo:hover { background: rgba(255,255,255,0.06); color: var(--modal-text, #ededf0); }
.qa-row-primary .qa-pdf { flex: 1; }

.qa-more-details { margin-top: 4px; }
.qa-more-summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--modal-text-faint, #9097a3);
    cursor: pointer;
    list-style: none;
    padding: 4px 0;
    user-select: none;
}
.qa-more-summary::-webkit-details-marker { display: none; }
.qa-more-details[open] .qa-more-summary { color: var(--modal-text-soft, #b8bdc8); }
.qa-more-body {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

@media (max-width: 600px) {
    #modal-quote .qa-row-primary { gap: 8px; }
    #modal-quote .qa-row-primary .qa-pdf { height: 52px; font-size: 15px; }
    #modal-quote .qa-cancel-solo { padding: 0 16px; }
    #modal-quote .qa-more-body { gap: 6px; }
    #modal-quote .qa-more-body .qa-btn { flex: 1 1 calc(50% - 3px); }
}

/* PDF Header & Professional Elements */
.pdf-preview-hidden { display: none; }

.empty-icon-wrap {
    width: 80px;
    height: 80px;
    background: rgba(0,0,0,0.03);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
}
.btn-close-modal:hover { background: rgba(255,255,255,0.1); color: white; }

/* Glosa Cards Design */
.glosa-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
}
.glosa-header {
    background: rgba(255,255,255,0.03);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.glosa-title-wrap { display: flex; align-items: center; gap: 10px; flex: 1; }
.glosa-number {
    font-size: 10px;
    font-weight: 900;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}
.glosa-title-input {
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 700;
    width: 100%;
    outline: none;
}
.glosa-title-input::placeholder { color: rgba(255,255,255,0.2); }

.glosa-content { padding: 16px; }

.search-box-wrap { position: relative; margin-bottom: 16px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 14px; height: 14px; }
.glosa-search-input {
    width: 100%;
    padding: 10px 10px 10px 36px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: white;
    font-size: 13px;
    outline: none;
}
.search-results {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-top: 5px;
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 16px 40px rgba(0,0,0,0.6);
}

/* ── Resultados de búsqueda mejorados ── */
.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.12s;
}
.search-result-item:last-of-type { border-bottom: none; }
.search-result-item:hover,
.search-result-item.sr-focused {
    background: rgba(255,255,255,0.07);
}
.sri-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.sri-tipo {
    font-size: 14px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}
.sri-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sri-name {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sri-cat {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sri-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sri-easy-badge {
    background: rgba(16,185,129,0.15);
    color: #10b981;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    white-space: nowrap;
}
.sri-price {
    font-size: 13px;
    font-weight: 800;
    color: #10b981;
    white-space: nowrap;
}
.search-result-empty {
    padding: 12px 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.sr-create-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.sr-create-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.search-result-more {
    padding: 8px 14px;
    font-size: 10px;
    color: rgba(255,255,255,0.25);
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-style: italic;
}

.glosa-items-list { display: flex; flex-direction: column; gap: 6px; }
.glosa-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 9px 12px;
    border-radius: 10px;
    transition: background 0.12s;
    flex-wrap: wrap;
}
.glosa-item-row:hover { background: rgba(255,255,255,0.06); }
.gi-main { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.gi-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gi-unit { font-size: 10px; color: var(--text-muted); text-transform: uppercase; flex-shrink: 0; }
.gi-easy-sku {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 10px; font-weight: 700; color: #0ea5e9;
    background: rgba(14,165,233,0.1); border: 1px solid rgba(14,165,233,0.25);
    border-radius: 5px; padding: 1px 6px; flex-shrink: 0;
    letter-spacing: 0.03em; white-space: nowrap;
}
.gi-easy-bolt { font-size: 9px; }

/* Badges de tipo en ítems */
.gi-tipo-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.gi-tipo-badge:hover { opacity: 0.7; }
.gi-tipo-badge.tipo-srv { background: rgba(16,185,129,0.12); color: #10b981; }
.gi-tipo-badge.tipo-mat { background: rgba(59,130,246,0.12); color: #60a5fa; }

.gi-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.qty-input-wrap input {
    width: 56px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.12);
    color: white;
    text-align: center;
    padding: 5px 4px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.qty-input-wrap input:focus { border-color: var(--primary); outline: none; }
.gi-price { font-size: 13px; font-weight: 700; color: #fff; min-width: 72px; text-align: right; }

/* Observación — fila extra debajo */
.gi-obs-row { width: 100%; margin-top: 4px; }
.gi-obs-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    padding: 2px 0;
    outline: none;
    font-style: italic;
}
.gi-obs-input:focus { border-bottom-color: rgba(255,255,255,0.3); color: rgba(255,255,255,0.7); }
.gi-obs-input::placeholder { color: rgba(255,255,255,0.2); }

/* Descuento por ítem */
.gi-discount-row {
    width: 100%; display: flex; align-items: center; gap: 8px;
    margin-top: 4px; flex-wrap: wrap;
}
.gi-discount-toggle-label {
    display: flex; align-items: center; gap: 5px;
    font-size: 10px; color: rgba(255,255,255,0.4); cursor: pointer;
    user-select: none; min-height: 24px;
}
.gi-discount-toggle-label input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: #f59e0b; }
.gi-discount-toggle-label:has(input:checked) { color: #f59e0b; }
.gi-discount-ctrl {
    display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap;
}
.gi-discount-type {
    background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3);
    color: #f59e0b; border-radius: 4px; font-size: 11px; padding: 2px 4px;
    cursor: pointer; outline: none;
}
.gi-discount-val {
    width: 70px; background: rgba(0,0,0,0.25); border: 1px solid rgba(245,158,11,0.3);
    border-radius: 4px; color: #fff; font-size: 11px; padding: 2px 6px; outline: none;
    min-height: 24px;
}
.gi-discount-val:focus { border-color: #f59e0b; }
.gi-discount-result { font-size: 11px; color: rgba(255,255,255,0.5); }
.gi-discount-result strong { color: #10b981; }
/* Precio con descuento activo */
.gi-price-discounted { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.gi-price-original { font-size: 10px; color: rgba(255,255,255,0.3); text-decoration: line-through; font-weight: 400; }
.gi-price-discounted > span:last-child { color: #10b981; }

/* ============================
   Hitos de Pago
   ============================ */
.milestones-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.milestone-row {
    display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap;
}
.milestone-num {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    min-width: 16px; text-align: center; flex-shrink: 0;
}
.mst-type-toggle {
    display: flex; border: 1px solid var(--border); border-radius: 6px;
    overflow: hidden; flex-shrink: 0;
}
.mst-btn {
    padding: 5px 9px; font-size: 12px; font-weight: 700;
    background: transparent; border: none; cursor: pointer;
    color: var(--text-muted); transition: background 0.15s, color 0.15s; line-height: 1;
}
.mst-btn.active { background: var(--accent-green); color: #fff; }
.mst-btn:hover:not(.active) { background: var(--surface-2); }
.milestone-value { width: 72px !important; text-align: center !important; }

.btn-remove-item, .btn-delete-glosa {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}
.btn-remove-item:hover { color: var(--red); background: rgba(239,68,68,0.08); }
.btn-delete-glosa:hover { color: var(--red); }

.empty-glosa {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.6;
}

/* ── Badges condiciones de pago en Movimientos ── */
.pay-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}
.pay-badge-contado  { background: rgba(16,185,129,0.12);  color: #10b981; }
.pay-badge-credit   { background: rgba(99,102,241,0.12);  color: #818cf8; }
.pay-badge-anticipo { background: rgba(16,185,129,0.12);  color: #10b981; }
.pay-badge-saldo    { background: rgba(245,158,11,0.12);  color: #f59e0b; }
.pay-badge-hitos    { background: rgba(99,102,241,0.12);   color: #818cf8; }

/* ── Filtros de la vista Movimientos ── */
.tx-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.tx-filter-pill:hover { border-color: var(--primary); color: var(--primary); }
.tx-filter-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}


.status-tag-success  { color: #10b981; font-weight: 700; }
.status-tag-danger   { color: #ef4444; font-weight: 700; }
.status-tag-info     { color: #3b82f6; font-weight: 700; }
.status-tag-warning  { color: #f59e0b; font-weight: 700; }
.status-tag-purple   { color: #a855f7; font-weight: 700; }
.status-tag-paid     { color: #06b6d4; font-weight: 700; }
.status-tag-default  { color: var(--text-muted); font-weight: 700; }

/* ── Selector de estado inline en la lista de presupuestos ── */
.quote-status-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 20px 3px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-repeat: no-repeat;
    background-position: right 5px center;
    background-size: 9px 9px;
    line-height: 1.4;
    transition: opacity 0.15s;
    /* Caret SVG neutral */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.quote-status-pill:hover { opacity: 0.8; }
.quote-status-pill option { background: #1e293b; color: #f1f5f9; }

.quote-status-pill.status-tag-success {
    color: #10b981;
    background-color: rgba(16,185,129,0.12);
    border-color: rgba(16,185,129,0.35);
}
.quote-status-pill.status-tag-danger {
    color: #ef4444;
    background-color: rgba(239,68,68,0.12);
    border-color: rgba(239,68,68,0.35);
}
.quote-status-pill.status-tag-info {
    color: #3b82f6;
    background-color: rgba(59,130,246,0.12);
    border-color: rgba(59,130,246,0.35);
}
.quote-status-pill.status-tag-warning {
    color: #f59e0b;
    background-color: rgba(245,158,11,0.12);
    border-color: rgba(245,158,11,0.35);
}
.quote-status-pill.status-tag-purple {
    color: #a855f7;
    background-color: rgba(168,85,247,0.12);
    border-color: rgba(168,85,247,0.35);
}
.quote-status-pill.status-tag-paid {
    color: #06b6d4;
    background-color: rgba(6,182,212,0.12);
    border-color: rgba(6,182,212,0.35);
}
.quote-status-pill.status-tag-default {
    color: var(--text-muted);
    background-color: rgba(255,255,255,0.04);
    border-color: var(--border);
}

/* Color Presets — duplicate block removed, defined in settings section above */

.brand-dot-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--maketrix-emerald);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Quick Client Selector */
.quick-client-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    max-width: 400px;
}
.quick-client-grid::-webkit-scrollbar { height: 2px; }

/* Pill con botón de edición integrado */
.client-pill-wrap {
    display: inline-flex;
    align-items: stretch;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.2s;
}
.client-pill-wrap:hover { border-color: rgba(255,255,255,0.25); }

.client-pill {
    background: rgba(255,255,255,0.05);
    border: none;
    color: white;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.client-pill:hover { background: var(--primary-brand); }

.client-pill-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.03);
    border: none;
    border-left: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.3);
    padding: 4px 7px;
    cursor: pointer;
    transition: all 0.2s;
}
.client-pill-edit:hover {
    background: rgba(255,255,255,0.12);
    color: white;
}

/* Modal cliente por encima del modal de presupuesto */
#modal-client { z-index: 300; }

/* ── Lista de clientes (vertical, reemplaza las pills) ── */
.client-quick-list {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    padding-right: 2px;
}
.client-quick-list:empty { display: none; }

/* scrollbar discreta */
.client-quick-list::-webkit-scrollbar { width: 3px; }
.client-quick-list::-webkit-scrollbar-track { background: transparent; }
.client-quick-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.client-list-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 7px 10px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s;
    flex-shrink: 0;
}
.client-list-row:hover { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.18); }
.client-list-row:active { background: var(--primary-brand); border-color: var(--primary-brand); }

.cli-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.75);
    font-size: 11px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.cli-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.cli-name {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cli-meta {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cli-edit-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    padding: 4px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.cli-edit-btn:hover { color: white; background: rgba(255,255,255,0.1); }

/* Branding Quick Bar */
.branding-quick-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
}
.branding-colors { display: flex; gap: 6px; }
.branding-logo-toggle { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }

/* Switch Mini */
.switch-mini { position: relative; display: inline-block; width: 32px; height: 18px; }
.switch-mini input { opacity: 0; width: 0; height: 0; }
.slider-mini {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155; transition: .3s; border-radius: 18px;
}
.slider-mini:before {
    position: absolute; content: ""; height: 12px; width: 12px; left: 3px; bottom: 3px;
    background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider-mini { background-color: var(--primary-brand); }
input:checked + .slider-mini:before { transform: translateX(14px); }

/* Item Tipo Badge */
.gi-tipo-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.tipo-srv { background: rgba(59,130,246,0.15); color: #3b82f6; border: 1px solid rgba(59,130,246,0.3); }
.tipo-srv:hover { background: rgba(59,130,246,0.3); }
.tipo-mat { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.tipo-mat:hover { background: rgba(245,158,11,0.3); }

/* Observation Row */
.gi-obs-row {
    padding: 0 8px 6px 8px;
}
.gi-obs-input {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.08);
    color: var(--text-muted);
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    transition: all 0.2s;
}
.gi-obs-input:focus {
    border-color: var(--primary-brand);
    background: rgba(255,255,255,0.06);
    color: white;
}
.gi-obs-input::placeholder { color: rgba(255,255,255,0.15); }

/* ===== EXPRESS QUOTE PANEL ===== */

/* Client list inside Express panel — override dark-modal defaults */
.express-panel .client-quick-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
/* ── Client pills dentro de modales claros (metallic) ── */
.modal-sheet .client-list-row {
    background: rgba(255,255,255,0.6);
    border-color: rgba(0,0,0,0.12);
    backdrop-filter: blur(4px);
}
.modal-sheet .client-list-row:hover { background: rgba(255,255,255,0.85); border-color: rgba(0,0,0,0.22); }
.modal-sheet .cli-avatar {
    background: #0f172a;
    color: #ffffff;
}
.modal-sheet .cli-name  { color: #1a1d24; }
.modal-sheet .cli-meta  { color: #5a6070; }
.modal-sheet .cli-edit-btn { color: #8a8e96; }
.modal-sheet .cli-edit-btn:hover { color: #1a1d24; }

.express-panel .client-list-row {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.08);
}
.express-panel .client-list-row:hover { background: rgba(0,0,0,0.08); border-color: rgba(0,0,0,0.15); }
.express-panel .client-list-row:active { background: var(--primary-brand); border-color: var(--primary-brand); }
.express-panel .cli-avatar {
    background: rgba(0,0,0,0.08);
    color: var(--text-secondary);
}
.express-panel .cli-name { color: var(--text-primary); }
.express-panel .cli-meta { color: var(--text-muted); }
.express-panel .cli-edit-btn { color: var(--text-muted); }
.express-panel .cli-edit-btn:hover { color: var(--text-primary); background: rgba(0,0,0,0.06); }

.express-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.express-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.express-title {
    font-size: 16px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.3px;
}
.btn-close-express {
    background: rgba(255,255,255,0.06);
    border: none;
    color: var(--text-muted);
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-close-express:hover { background: rgba(255,255,255,0.1); color: white; }

/* Steps */
.express-step {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}
.step-badge {
    width: 26px; height: 26px;
    background: var(--primary-brand);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    flex-shrink: 0;
    margin-top: 2px;
}
.step-content { flex: 1; }
.step-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    display: block;
}

/* Client pills */
.express-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.express-pill {
    padding: 4px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.express-pill:hover { background: var(--primary-brand); color: white; border-color: var(--primary-brand); }

.express-client-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Template Grid */
.express-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.express-tpl-card {
    padding: 14px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.express-tpl-card:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}
.express-tpl-card.active {
    background: rgba(30, 64, 175, 0.15);
    border-color: var(--primary-brand);
}
.express-tpl-icon { font-size: 24px; margin-bottom: 6px; display: block; }
.express-tpl-name { font-size: 12px; font-weight: 700; color: #0f172a; }
.express-tpl-count { font-size: 10px; color: #475569; margin-top: 2px; }

/* Checklist */
.express-checklist {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}
.express-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.express-check-item:hover { background: rgba(255,255,255,0.04); }
.express-check-item input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
}
.express-check-item label {
    flex: 1;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
    font-weight: 600;
}
.express-check-price {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}
.express-check-qty {
    width: 50px;
    background: rgba(15,23,42,0.05);
    border: 1px solid rgba(15,23,42,0.15);
    color: #0f172a;
    border-radius: 6px;
    padding: 4px 6px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
}

/* Step 5 — Sticky: el total de generación queda visible al scrollear */
#express-step-5 {
    position: sticky;
    bottom: 72px; /* clearance sobre el bottom-nav en mobile */
    z-index: 40;
    background: var(--bg-app, #f1f3f6);
    padding-top: 8px;
}
@media (min-width: 769px) {
    #express-step-5 { bottom: 12px; background: #fff; }
}

/* Total Bar */
.express-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 12px;
    padding: 16px 20px;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.express-total-label {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    display: block;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.express-total-value {
    font-size: 28px;
    font-weight: 900;
    color: #1a1d24;
    display: block;
    margin-top: 2px;
}
.btn-express-generate {
    background: var(--primary-brand);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.btn-express-generate:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

/* Section Labels */
.express-section-label {
    font-size: 11px;
    font-weight: 900;
    color: #1e40af;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 10px 4px;
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(15,23,42,0.1);
}
.express-check-item.mat-item {
    opacity: 0.85;
}
.express-check-item.mat-item label {
    color: #475569;
    font-weight: 400;
}

/* ── Acordeón "Más datos del cliente" en Express ────────────────────────── */
.exp-extra-details {
    margin-bottom: 4px;
}
.exp-extra-details > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}
.exp-extra-details > summary::-webkit-details-marker { display: none; }
.exp-extra-details[open] > summary svg { transform: rotate(90deg); }
.exp-extra-details > summary svg { transition: transform 0.2s; flex-shrink: 0; }
.exp-extra-fields {
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Add Item Row */
/* ── Express add section (catalog search + manual fallback) ── */
.express-add-section {
    margin-top: 12px;
    border-top: 1px dashed rgba(15,23,42,0.1);
    padding-top: 10px;
}

/* Catalog search */
.ea-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    padding: 0 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ea-search-wrap:focus-within {
    border-color: rgba(30,64,175,0.4);
    box-shadow: 0 0 0 3px rgba(30,64,175,0.08);
}
.ea-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
}
.ea-search-input::placeholder { color: var(--text-muted); }

/* Dropdown */
.ea-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
}

.ea-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    cursor: pointer;
    transition: background 0.1s;
    gap: 8px;
}
.ea-result-item:hover,
.ea-result-item.ea-focused { background: var(--bg-secondary); }
.ea-result-item + .ea-result-item { border-top: 1px solid var(--border); }

.ea-ri-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.ea-ri-icon { font-size: 14px; flex-shrink: 0; }
.ea-ri-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ea-ri-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ea-ri-cat { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

.ea-ri-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.ea-easy-pill {
    font-size: 10px;
    font-weight: 700;
    color: var(--emerald);
    background: rgba(5,150,105,0.10);
    padding: 2px 6px;
    border-radius: 20px;
}
.ea-ri-price {
    font-size: 13px;
    font-weight: 800;
    color: var(--emerald);
    white-space: nowrap;
}
.ea-no-results {
    padding: 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}
.ea-more-hint {
    padding: 6px 12px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

/* Divider between catalog search and manual row */
.ea-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 4px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.ea-divider::before,
.ea-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.express-add-row {
    display: flex;
    gap: 6px;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    align-items: center;
}
.exp-add-select {
    background: rgba(15,23,42,0.05);
    border: 1px solid rgba(15,23,42,0.12);
    color: #1e293b;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    min-width: 110px;
}
.exp-add-input { flex: 1; }
.exp-add-price { width: 90px; }
.btn-add-express-item {
    width: 34px; height: 34px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.btn-add-express-item:hover { background: #1d4ed8; transform: scale(1.05); }

/* New Template Card */
.express-tpl-card.new-tpl {
    border: 2px dashed rgba(15,23,42,0.15);
    background: transparent;
}
.express-tpl-card.new-tpl:hover {
    border-color: #1e40af;
    background: rgba(30,64,175,0.05);
}
.new-tpl-icon { font-size: 20px; color: #64748b; }
.express-check-price-input {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    transition: all 0.2s;
}
/* Botón eliminar ítem del checklist */
.express-item-del {
    background: none;
    border: none;
    color: rgba(15,23,42,0.25);
    padding: 3px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.express-item-del:hover { color: #dc2626; background: rgba(220,38,38,0.08); }

/* Empty state checklist */
.express-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    text-align: center;
    border: 2px dashed rgba(15,23,42,0.1);
    border-radius: 10px;
    margin: 4px 0 8px;
}

.express-check-price-input:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

/* ===== IA FORMULA BOX ===== */
.ai-formula-box {
    background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(168,85,247,0.06) 100%);
    border: 1.5px solid rgba(99,102,241,0.3);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 4px;
}
.ai-formula-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.ai-prompt-textarea {
    resize: vertical;
    min-height: 80px;
    font-size: 13px !important;
    line-height: 1.5;
}

/* ===== CALCULADORA DE FÓRMULAS ===== */

/* Pills de tipo */
.formula-type-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 4px;
}
.formula-type-scroll::-webkit-scrollbar { height: 2px; }

.formula-type-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 72px;
    transition: all 0.18s;
}
.formula-type-pill:hover { border-color: var(--primary); color: var(--text-primary); transform: translateY(-1px); }
.formula-type-pill.active { border-color: var(--primary); background: rgba(99,102,241,0.08); color: var(--primary); }

.ftp-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

/* ── Hint bar (shown before any calculator is selected) ── */
.calc-hint-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    padding: 10px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-xs);
    transition: opacity 0.2s;
}

/* ── Outer card that wraps a calculator ── */
.fc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    backdrop-filter: blur(8px);
}

/* ── Header inside the calculator card ── */
.fc-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}
.fc-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.fc-title { font-size: 15px; font-weight: 700; margin: 0 0 2px; }
.fc-desc  { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ── Input grid ── */
.fc-inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 4px;
}
.fc-input-wrap { display: flex; flex-direction: column; gap: 4px; }
.fc-label { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.02em; }
.fc-input-row { display: flex; align-items: center; gap: 6px; }
.fc-input { text-align: right; font-weight: 700; font-size: 15px !important; flex: 1; }
.fc-unit  { font-size: 11px; color: var(--text-muted); font-weight: 600; white-space: nowrap; min-width: 28px; }

/* ── Result card ── */
.fr-card {
    background: var(--bg-card);
    border: 1.5px solid rgba(5,150,105,0.25);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.fr-card-header {
    background: rgba(5,150,105,0.07);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
.fr-lines { padding: 4px 0; }
.fr-line {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.fr-line:last-child { border-bottom: none; }
.fr-line-labor { background: rgba(59,130,246,0.04); }
.fr-name  { color: var(--text-secondary); }
.fr-calc  { color: var(--text-muted); font-size: 11px; }
.fr-total { font-weight: 700; color: var(--text-primary); text-align: right; white-space: nowrap; }

.fr-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.fr-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-secondary); }
.fr-row-main {
    padding: 10px 14px;
    background: rgba(5,150,105,0.07);
    border: 1px solid rgba(5,150,105,0.18);
    border-radius: var(--radius-xs);
}

.fr-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

/* ── Custom (personalizada) calculator rows ── */
.custom-rows-head {
    display: grid;
    grid-template-columns: 1fr 62px 58px 88px 68px 30px;
    gap: 5px;
    padding: 4px 0 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.custom-row {
    display: grid;
    grid-template-columns: 1fr 62px 58px 88px 68px 30px;
    gap: 5px;
    align-items: center;
    margin-bottom: 5px;
}
.custom-row .form-input { padding: 7px 8px; font-size: 12px; }
.crow-total {
    font-size: 12px;
    font-weight: 700;
    color: var(--emerald);
    text-align: right;
    white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 520px) {
    .fc-inputs-grid { grid-template-columns: 1fr; }
    .custom-rows-head { display: none; }
    .custom-row {
        grid-template-columns: 1fr 52px 52px 78px 60px 28px;
        gap: 4px;
    }
}

/* ═══════════════════════════════════════════════════════
   CALCULADORA PERSONALIZADA v2 — namespace .fc2-
   PRP-004 — Variables del Trabajo + Plantillas
   ═══════════════════════════════════════════════════════ */

/* Panel wrapper */
.fc2-panel {}

/* ── Guide card ── */
.fc2-guide-card {
    background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(16,185,129,0.03));
    border: 1px solid rgba(16,185,129,0.22);
    border-radius: 12px;
    margin-bottom: 14px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}
.fc2-guide-collapsed .fc2-guide-body {
    display: none;
}
.fc2-guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    cursor: pointer;
    user-select: none;
}
.fc2-guide-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--emerald);
}
.fc2-guide-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    padding: 4px 6px;
    line-height: 1;
    border-radius: 6px;
    flex-shrink: 0;
}
.fc2-guide-close:hover { color: var(--text-primary); }
.fc2-guide-body {
    padding: 0 14px 14px;
}
.fc2-guide-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.fc2-guide-step-icon {
    font-size: 22px;
    flex-shrink: 0;
    width: 30px;
    text-align: center;
    line-height: 1.3;
}
.fc2-guide-step b {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
    color: var(--text-primary);
}
.fc2-guide-step p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* ── Help button (reopens guide) ── */
.fc2-help-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.18s, color 0.18s;
}
.fc2-help-btn:hover {
    border-color: var(--emerald);
    color: var(--emerald);
}

/* ── Template bar ── */
.fc2-template-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}
.fc2-template-select {
    flex: 1;
    min-width: 0;
    font-size: 13px;
}
.fc2-save-tpl-btn {
    white-space: nowrap;
    font-size: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── Zone containers ── */
.fc2-zone {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
}
.fc2-total-zone { text-align: center; }
.fc2-zone-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.fc2-zone-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}
.fc2-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 12px;
    line-height: 1.4;
}

/* ── Variable cards grid (PRP-019 medidas dinámicas) ── */
.fc2-vars-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.fc2-var-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
}
/* Fila top de la tarjeta: nombre editable + botón eliminar */
.fc2-var-card-top {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}
.fc2-var-name-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.fc2-var-icon { font-size: 13px; flex-shrink: 0; }
.fc2-var-name-input {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--border);
    padding: 1px 2px;
    width: 100%;
    min-width: 0;
    outline: none;
}
.fc2-var-name-input:focus {
    border-bottom-color: var(--brand);
    background: rgba(0,0,0,0.03);
}
/* Botón eliminar medida */
.fc2-var-del-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 4px;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
}
.fc2-var-del-btn:hover { color: #dc2626; background: rgba(220,38,38,0.08); }
/* Input de unidad editable dentro del stepper */
.fc2-var-unit-input {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--border);
    padding: 0 2px;
    width: 32px;
    text-align: center;
    outline: none;
}
.fc2-var-unit-input:focus {
    border-bottom-color: var(--brand);
}
/* Botón + Agregar medida */
.fc2-add-measure-btn {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding: 9px 12px;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.fc2-add-measure-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
}
/* Formulario inline agregar medida */
.fc2-add-measure-form {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-card);
    border: 1.5px solid var(--brand);
    border-radius: 10px;
    padding: 10px 12px;
}
.fc2-nm-input {
    flex: 2;
    min-width: 120px;
    font-size: 13px;
}
.fc2-nm-unit {
    flex: 1;
    min-width: 70px;
    font-size: 13px;
}
.fc2-nm-confirm, .fc2-nm-cancel {
    font-size: 12px;
    padding: 7px 12px;
    flex-shrink: 0;
}
/* Etiqueta legacy (ya no usada como bloque, se reemplaza por fc2-var-card-top) */
.fc2-var-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.fc2-var-row {
    display: flex;
    align-items: center;
    gap: 5px;
}
.fc2-var-stepper {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-primary);
    flex-shrink: 0;
    touch-action: manipulation;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.fc2-var-stepper:active { background: var(--border); }
.fc2-var-input-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}
.fc2-var-input {
    width: 100%;
    text-align: center;
    font-size: 20px !important;
    font-weight: 700 !important;
    padding: 6px 4px !important;
    height: 44px;
    border-radius: 8px;
}
.fc2-var-unit {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-muted);
    pointer-events: none;
    font-weight: 600;
}

/* ── Item rows ── */
.fc2-item-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
}
.fc2-item-top {
    display: flex;
    gap: 7px;
    align-items: center;
    margin-bottom: 9px;
}
.fc2-item-tipo {
    width: auto;
    min-width: 72px;
    flex-shrink: 0;
    font-size: 11px !important;
    padding: 6px 4px !important;
}
.fc2-item-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
}
.fc2-item-del {
    flex-shrink: 0;
    padding: 6px;
    color: var(--text-muted);
    -webkit-tap-highlight-color: transparent;
}
.fc2-item-bottom {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fc2-item-mult-row,
.fc2-item-price-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.fc2-item-field {
    flex: 1;
    min-width: 0;
}
.fc2-item-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    white-space: nowrap;
}
.fc2-item-unit { width: 100%; text-align: center; }
.fc2-item-subtotal {
    display: block;
    font-weight: 700;
    font-size: 14px;
    color: var(--emerald);
    padding-top: 8px;
    text-align: right;
    white-space: nowrap;
}
.fc2-mult-select { font-size: 12px !important; }

/* ── Add item button ── */
.fc2-add-item-btn {
    width: 100%;
    margin-top: 4px;
    font-size: 13px;
    justify-content: center;
    gap: 6px;
    display: flex;
    align-items: center;
}

/* ── Empty state ── */
.fc2-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    text-align: center;
}
.fc2-empty-icon { font-size: 32px; line-height: 1; }
.fc2-empty-text {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

/* ── Example CTA button ── */
.fc2-example-cta {
    font-size: 13px !important;
    border: 1px dashed rgba(16,185,129,0.5) !important;
    color: var(--emerald) !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.fc2-example-cta:hover {
    background: rgba(16,185,129,0.07) !important;
}

/* ── Total zone ── */
.fc2-total-big {
    font-size: 38px;
    font-weight: 800;
    color: var(--emerald);
    letter-spacing: -0.02em;
    margin: 8px 0 6px;
    line-height: 1;
}
.fc2-total-sub {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}
.fc2-breakdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    width: 100%;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}
.fc2-breakdown-toggle:hover { border-color: var(--emerald); color: var(--emerald); }
.fc2-breakdown {
    text-align: left;
    margin-bottom: 8px;
}

/* ── Responsive (mobile-first) ── */
@media (min-width: 480px) {
    .fc2-item-bottom { flex-direction: row; flex-wrap: wrap; }
    .fc2-item-mult-row { flex: 3; }
    .fc2-item-price-row { flex: 2; }
    .fc2-item-mult-row,
    .fc2-item-price-row { flex-direction: row; }
}

@media (max-width: 360px) {
    .fc2-vars-grid { grid-template-columns: 1fr; }
    .fc2-total-big { font-size: 30px; }
}

/* ===== EASY SYNC MODAL ===== */

.easy-cat-pill {
    border-radius: 20px;
    font-size: 11px;
    padding: 3px 12px;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.easy-cat-pill.active,
.easy-cat-pill:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.easy-prod-card {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
}
.ep-img-wrap {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ep-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.ep-info { flex: 1; min-width: 0; }
.ep-brand {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ep-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2px 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ep-price-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ep-price { font-size: 14px; font-weight: 900; color: var(--emerald, #10b981); }
.ep-list-price { font-size: 11px; color: var(--text-muted); text-decoration: line-through; }
.btn-easy-add {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--primary);
    color: var(--primary);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-easy-add:hover { background: var(--primary); color: #fff; }

/* Easy result states */
.easy-placeholder-state,
.easy-loading-state,
.easy-error-state,
.easy-empty-state {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
}
.easy-loading-state { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.easy-error-state { color: var(--red, #ef4444); }

/* ── Guía de bienvenida Easy (primer uso, 0 items vinculados) ── */
.easy-onboarding-guide {
    padding: 16px;
}
.easy-ob-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    text-align: center;
}
.easy-ob-steps { display: flex; flex-direction: column; gap: 12px; }
.easy-ob-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
}
.easy-ob-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.easy-ob-step div { flex: 1; }
.easy-ob-step strong { font-size: 12px; color: var(--text-primary); display: block; margin-bottom: 2px; }
.easy-ob-step p { font-size: 11px; color: var(--text-muted); margin: 0; line-height: 1.4; }
.easy-ob-hint {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 12px;
    font-style: italic;
}
.easy-preview-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 6px;
}

@media (max-width: 480px) {
    .fc-inputs-grid { grid-template-columns: 1fr; }
    .custom-rows-head { display: none; }
    .custom-row { grid-template-columns: 1fr 60px 50px 80px 60px 28px; gap: 4px; }
    .fr-line { grid-template-columns: 1fr auto; }
    .fr-calc { display: none; }
}

/* ===== CATALOG ACTIONS ROW ===== */
.catalog-actions-row {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
    padding-bottom: 2px;
}
.catalog-action-btn {
    white-space: nowrap;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
@media (max-width: 600px) {
    .catalog-actions-row {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 6px;
    }
    .catalog-actions-row::-webkit-scrollbar { display: none; }
}

/* ── Easy.cl integration button ── */
.catalog-easy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
    white-space: nowrap;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(5,150,105,0.25);
}
.catalog-easy-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.catalog-easy-btn:active { transform: translateY(0); }

/* ── Excel dropdown ── */
.catalog-excel-wrap {
    position: relative;
}
.catalog-excel-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}
.catalog-excel-btn.active {
    background: var(--bg-secondary);
    border-color: rgba(0,0,0,0.18);
}
.catalog-excel-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 230px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 32px rgba(0,0,0,0.14);
    z-index: 200;
    overflow: hidden;
}
.ced-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
    color: var(--text-primary);
}
.ced-item:hover { background: var(--bg-secondary); }
.ced-item i { color: var(--text-muted); flex-shrink: 0; }
.ced-text { display: flex; flex-direction: column; gap: 1px; }
.ced-label { font-size: 13px; font-weight: 600; }
.ced-hint { font-size: 10px; color: var(--text-muted); }
.ced-export .ced-label { color: var(--emerald); }
.ced-export i { color: var(--emerald); }
.ced-divider { height: 1px; background: var(--border); margin: 2px 0; }

/* ── Group header Easy badge ── */
.pgh-easy-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--emerald);
    background: rgba(5,150,105,0.12);
    padding: 2px 7px;
    border-radius: 20px;
}

/* ===== PRODUCT DETAIL MODAL ===== */

/* Desktop: centered card. Mobile: bottom sheet */
.modal-overlay:has(.pdet-sheet) { align-items: center; }

.pdet-sheet {
    background: var(--bg-card);
    color: var(--text-primary);
    max-width: 780px;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    grid-template-rows: 1fr;
    max-height: 88vh;
    box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}

/* ── Image column ── */
.pdet-img-wrap {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    min-height: 340px;
}
.pdet-tipo-stripe {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    z-index: 1;
}
.pdet-img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    width: 100%;
    height: 100%;
}
.pdet-img {
    max-width: 100%; max-height: 100%;
    width: auto; height: auto;
    object-fit: contain;
    padding: 24px;
}
.pdet-img-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,23,42,0.55);
}

/* ── Body column ── */
.pdet-body {
    grid-column: 2;
    grid-row: 1;
    padding: 22px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}

/* Mobile handle hidden on desktop */
.pdet-handle { display: none; }

/* Header row: badges + close */
.pdet-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.pdet-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Category badge */
.pdet-cat-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Tipo badge (color applied by JS class) */
.pdet-tipo {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.pdet-tipo.type-mat { background: rgba(59,130,246,0.14); color: #60a5fa; }
.pdet-tipo.type-srv { background: rgba(16,185,129,0.14); color: #34d399; }
.pdet-tipo.type-art { background: rgba(249,115,22,0.14); color: #fb923c; }

/* Close button */
.pdet-close-btn {
    width: 30px; height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.pdet-close-btn:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* Title block */
.pdet-title-block { display: flex; flex-direction: column; gap: 4px; }
.pdet-name {
    font-size: 19px; font-weight: 800;
    color: var(--text-primary);
    line-height: 1.25; margin: 0;
    word-wrap: break-word;
}
.pdet-sku {
    font-size: 11px; color: var(--text-muted);
    font-family: 'Courier New', monospace; margin: 0;
    cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.pdet-sku:hover { color: var(--primary); }
.pdet-sku::after { content: '⎘'; font-size: 10px; opacity: 0; transition: opacity 0.15s; }
.pdet-sku:hover::after { opacity: 0.6; }

/* Price grid */
.pdet-prices {
    display: grid;
    grid-template-columns: 1fr 1px 1fr 1px 1fr;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    gap: 0;
}
.pdet-price-box {
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
    text-align: center; padding: 0 4px; min-width: 0;
}
.pdet-price-label {
    font-size: 9px; color: var(--text-muted);
    font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; white-space: nowrap;
}
.pdet-price-val {
    font-size: 15px; font-weight: 800;
    color: var(--text-primary); line-height: 1.1; white-space: nowrap;
}
.pdet-price-val.green      { color: #10b981; }
.pdet-price-val.accent     { color: #60a5fa; }
.pdet-price-val.margin-good { color: #10b981; }
.pdet-price-val.margin-ok   { color: #f59e0b; }
.pdet-price-val.margin-bad  { color: #ef4444; }
.pdet-price-divider {
    width: 1px; height: 28px;
    background: var(--border); align-self: center;
}

/* Meta chips */
.pdet-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pdet-meta-item {
    display: inline-flex; align-items: baseline; gap: 6px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 12px;
}
.pdet-meta-label {
    font-size: 10px; color: var(--text-muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.pdet-meta-val { font-size: 12px; font-weight: 700; color: var(--text-primary); }

/* Primary action buttons */
.pdet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding-bottom: 4px;
}
.pdet-action-edit, .pdet-action-quote {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
    white-space: nowrap;
}
.pdet-action-edit {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.pdet-action-edit:hover { background: var(--bg-card-hover); }
.pdet-action-quote {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: #fff;
}
.pdet-action-quote:hover { opacity: 0.88; }

/* Delete button (subtle, below actions) */
.pdet-delete-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 5px; width: 100%;
    font-size: 11px; color: var(--text-muted); font-weight: 600;
    background: none; border: none; cursor: pointer;
    padding: 6px; border-radius: 6px; transition: all 0.15s;
}
.pdet-delete-btn:hover { color: #ef4444; background: rgba(239,68,68,0.07); }

/* ── Mobile: 1-column bottom sheet ── */
@media (max-width: 760px) {
    .modal-overlay:has(.pdet-sheet) { align-items: flex-end; }
    .pdet-sheet {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        max-width: 100%; max-height: 92vh;
        border-radius: 24px 24px 0 0;
        border-bottom: none;
    }
    .pdet-handle {
        display: block;
        grid-column: 1; grid-row: 1;
    }
    .pdet-img-wrap {
        grid-column: 1; grid-row: 2;
        height: 180px; min-height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .pdet-body {
        grid-column: 1; grid-row: 3;
        padding: 16px 16px 24px; gap: 12px;
    }
    .pdet-name { font-size: 16px; }
    .pdet-price-val { font-size: 13px; }
    .pdet-prices { padding: 10px 6px; }
    .pdet-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
    .pdet-prices { grid-template-columns: 1fr; gap: 6px; }
    .pdet-price-box {
        flex-direction: row; justify-content: space-between;
        padding: 6px 12px;
        background: var(--bg-main); border-radius: var(--radius-xs);
    }
    .pdet-price-divider { display: none; }
    .pdet-actions { grid-template-columns: 1fr; }
}

/* ===== EASY.CL PREMIUM PANEL ===== */
.pdet-easy-panel {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-top: 4px;
    position: relative;
    overflow: hidden;
}
.pdet-easy-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, #f97316, #ea580c);
}

.easy-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.easy-panel-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 13px;
    color: var(--text-primary);
}
.easy-stock-pill {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 4px;
    letter-spacing: 0.02em;
}
.easy-stock-pill.in-stock  { background: rgba(5,150,105,0.12);  color: var(--emerald); }
.easy-stock-pill.out-stock { background: rgba(220,38,38,0.12);  color: var(--red); }

.easy-promo-badge {
    background: linear-gradient(135deg, #f97316, #dc2626);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.03em;
    box-shadow: 0 4px 10px rgba(220,38,38,0.25);
    animation: pulseGlow 2s ease-in-out infinite;
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 4px 10px rgba(220,38,38,0.25); }
    50%      { box-shadow: 0 4px 16px rgba(220,38,38,0.45); }
}

.easy-brand-line {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.easy-price-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: var(--radius-xs);
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}
.easy-price-current { display: flex; flex-direction: column; gap: 2px; }
.easy-price-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.easy-price-promo {
    font-size: 22px;
    font-weight: 900;
    color: #dc2626;
    line-height: 1;
}
.easy-price-list {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: line-through;
    text-decoration-color: var(--red);
    margin-top: 2px;
}
.easy-savings {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}
.easy-savings span {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.easy-savings strong {
    font-size: 14px;
    font-weight: 800;
    color: var(--emerald);
}

.easy-margin-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: var(--radius-xs);
    margin-bottom: 10px;
}
.easy-margin-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
}
.easy-margin-label {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.easy-margin-val {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
}
.easy-margin-val.positive { color: var(--emerald); }
.easy-margin-val.negative { color: var(--red); }
.easy-margin-arrow {
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 700;
}

.easy-panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    gap: 8px;
    flex-wrap: wrap;
}
.easy-synced-text {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}
.easy-view-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #dc2626;
    font-weight: 700;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(220,38,38,0.2);
    background: rgba(220,38,38,0.05);
    transition: all 0.2s;
}
.easy-view-link:hover {
    background: #dc2626;
    color: #fff;
}

@media (max-width: 480px) {
    .easy-price-promo { font-size: 19px; }
    .easy-margin-val  { font-size: 13px; }
    .easy-margin-row  { grid-template-columns: 1fr; gap: 6px; }
    .easy-margin-arrow { transform: rotate(90deg); }
}

/* ===== CATALOG SEARCH + CATEGORY FILTER ROW ===== */
.catalog-filter-row {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
}
.catalog-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    flex: 1;
    min-width: 0;
    transition: border-color 0.15s;
}
.catalog-search-wrap:focus-within { border-color: var(--primary); }
.catalog-search-wrap input {
    flex: 1;
    background: none; border: none; outline: none;
    font-size: 13px; color: var(--text-primary);
}
.catalog-search-wrap input::placeholder { color: var(--text-muted); }
#catalog-search-clear {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 2px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
}
#catalog-search-clear:hover { color: var(--text-primary); }

/* Category dropdown */
.catalog-cat-select-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px 8px 12px;
    cursor: pointer;
    transition: border-color 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
}
.catalog-cat-select-wrap:focus-within { border-color: var(--primary); }
.catalog-cat-select-wrap select {
    background: none;
    border: none;
    outline: none;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    /* remove default arrow — we supply our own chevron icon */
    appearance: none;
    -webkit-appearance: none;
    max-width: 160px;
    text-overflow: ellipsis;
    overflow: hidden;
}
.catalog-cat-select-wrap select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Responsive: stack vertically on small screens */
@media (max-width: 520px) {
    .catalog-filter-row { flex-direction: column; }
    .catalog-cat-select-wrap { width: 100%; }
    .catalog-cat-select-wrap select { max-width: 100%; flex: 1; }
}

/* ===== CATALOG PRODUCT CARDS ===== */

/* ===== CATALOG LIST VIEW ===== */
.prod-list-view {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 0 80px;
}

/* ── Category group ── */
.prod-group {
    margin-bottom: 4px;
}

.prod-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 6px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-primary);
    backdrop-filter: blur(4px);
    cursor: pointer;
    user-select: none;
}
.prod-group-header:hover .pgh-name { color: var(--text-primary); }
.prod-group.collapsed .prod-group-items { display: none; }

.pgh-name {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.pgh-count {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 20px;
}

/* ── Product list row ── */
.prod-list-item {
    position: relative;
    display: flex;
    align-items: stretch;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.12s;
    overflow: hidden;
    min-height: 60px;
}

.prod-list-item:first-of-type {
    border-top: 1px solid var(--border);
}

.prod-list-item:hover,
.prod-list-item:active {
    background: var(--bg-card-hover);
}

/* Left color stripe — indicates tipo */
.pli-stripe {
    width: 4px;
    flex-shrink: 0;
    background: var(--border);
}
.pli-stripe.tipo-mat { background: var(--blue); }
.pli-stripe.tipo-srv { background: var(--purple); }
.pli-stripe.tipo-art { background: #b45309; }

/* Body: left info + right price */
.pli-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 10px 11px 14px;
    min-width: 0;
}

.pli-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pli-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.pli-meta-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.pli-unit {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pli-easy-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    color: var(--emerald);
    background: rgba(5,150,105,0.10);
    padding: 2px 7px;
    border-radius: 20px;
}
.pli-easy-tag.stale {
    color: #b45309;
    background: rgba(245,158,11,0.12);
}

.pli-promo-tag {
    font-size: 10px;
    font-weight: 700;
    color: #dc2626;
    background: rgba(220,38,38,0.09);
    padding: 2px 6px;
    border-radius: 20px;
}

/* Right: price block */
.pli-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.pli-client-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--emerald);
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.pli-cost {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.pli-margin-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--emerald);
    background: rgba(5,150,105,0.10);
    padding: 2px 7px;
    border-radius: 20px;
}

/* Edit button — right tap target */
.pli-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    align-self: stretch;
    transition: color 0.15s, background 0.15s;
}
.pli-edit-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

/* Indicador Easy.cl */
.prod-easy-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    color: var(--emerald);
}

/* Badge: precio Easy desactualizado (> 24 h) */
.prod-stale-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    letter-spacing: 0.03em;
    cursor: pointer;
}

/* ── Easy search results — "Ya en catálogo" ── */
.easy-prod-card.ep-in-catalog { border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.04); }
.ep-img-wrap { position: relative; }
.ep-catalog-badge {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(5, 150, 105, 0.88);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    padding: 2px 4px;
    border-radius: 0 0 4px 4px;
    letter-spacing: 0.03em;
}
.ep-discount-badge {
    background: linear-gradient(135deg, #f97316, #dc2626);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
}
.btn-easy-add.in-catalog {
    background: rgba(16, 185, 129, 0.08);
    color: var(--emerald);
    border-color: rgba(16, 185, 129, 0.3);
}
.btn-easy-add.in-catalog:hover { background: var(--emerald); color: #fff; }

/* ── Lista de productos vinculados en modal Easy ── */
.easy-linked-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.eli-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.eli-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eli-meta { font-size: 10px; color: var(--text-muted); }
.eli-meta.stale { color: #b45309; }
.eli-sync-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}
.eli-sync-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Alerta de diferencia de precio en panel Easy ── */
.easy-price-alert {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.easy-price-alert span {
    font-size: 11px;
    color: #92400e;
    font-weight: 500;
}
.easy-alert-btn {
    align-self: flex-start;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.easy-alert-btn:hover { background: #f59e0b; color: #fff; border-color: #f59e0b; }

/* ===== PRODUCT MODAL — PRICING CALCULATOR ===== */
.pm-price-block {
    background: var(--modal-field-bg-2, #2f3545);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--radius-sm);
    padding: 14px 14px 12px;
    margin-bottom: 16px;
}
.pm-price-block-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.pm-price-block-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}
.pm-price-block-hint {
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
}

/* 2-row layout: [cost | margin] then [= price full-width] */
.pm-row-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.pm-row-inputs .input-group { margin-bottom: 0; }
.pm-row-inputs label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

/* Separator row: ──── = Precio al Cliente ──── */
.pm-equals-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 10px;
}
.pm-equals-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}
.pm-equals-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Full-width price input — visually prominent */
.pm-price-full {
    margin-bottom: 0;
}
.pm-price-full input {
    font-size: 20px !important;
    font-weight: 800 !important;
    height: 50px !important;
    color: var(--text-primary) !important;
    letter-spacing: -0.5px;
    border-color: var(--primary) !important;
}
.pm-price-full input:focus {
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 99,102,241), 0.15) !important;
}

/* "lo que pagas tú" sub-labels on fields — block bajo el label */
.pm-field-hint {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    font-style: italic;
    margin-top: -4px;
    margin-bottom: 4px;
}

/* $ prefix wrapper */
.pm-input-prefix {
    position: relative;
    display: flex;
    align-items: center;
}
.pm-input-prefix > span {
    position: absolute;
    left: 11px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}
.pm-input-prefix input { padding-left: 22px !important; }

/* % suffix wrapper */
.pm-input-suffix {
    position: relative;
    display: flex;
    align-items: center;
}
.pm-input-suffix > span {
    position: absolute;
    right: 11px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}
.pm-input-suffix input { padding-right: 28px !important; }

/* Live profit preview bar */
.pm-profit-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid;
    font-size: 13px;
    transition: all 0.2s;
}
.pm-preview-icon { font-size: 16px; line-height: 1; flex-shrink: 0; }
.pm-preview-text {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.pm-preview-text strong { font-size: 12px; font-weight: 800; }
.pm-preview-text span   { color: var(--text-muted); font-size: 11px; }
.pm-preview-pct {
    font-size: 12px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
}

/* Responsive: on very narrow screens stack cost+margin vertically */
@media (max-width: 380px) {
    .pm-row-inputs {
        grid-template-columns: 1fr;
    }
}

/* Estado vacío */
.prod-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.prod-empty-state svg {
    margin: 0 auto 16px;
    opacity: 0.2;
    display: block;
}

/* ===== RESPONSIVE CATALOG LIST ===== */
@media (max-width: 768px) {
    .pli-name     { font-size: 13px; }
    .pli-client-price { font-size: 15px; }
}
@media (max-width: 520px) {
    .pli-cost { display: none; } /* save space on small phones */
}


/* ============================================================
   QUOTE MODAL — MOBILE REDESIGN (PRP-001)
   Solo afecta #modal-quote en pantallas ≤ 600px.
   El layout desktop (> 600px) queda idéntico.
   ============================================================ */
@media (max-width: 600px) {

  /* ── SHEET ──────────────────────────────────────────────── */
  #modal-quote .modal-sheet.wide {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 20px);
  }

  /* ── HEADER ─────────────────────────────────────────────── */
  #modal-quote .modal-header-pro {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px 10px;
  }
  #modal-quote .modal-title   { font-size: 18px; }
  #modal-quote .modal-subtitle { font-size: 12px; }
  #modal-quote .modal-actions { flex-wrap: wrap; gap: 8px; }

  /* ── BODY ───────────────────────────────────────────────── */
  #modal-quote .quote-modal-body {
    gap: 20px;
    padding: 0 16px;
  }

  /* ── COLOR PICKER — grid 5×2, swatches 40×40px ─────────── */
  #modal-quote .branding-quick-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
  }
  #modal-quote .branding-colors {
    display: grid;
    grid-template-columns: repeat(5, 40px);
    grid-auto-rows: 40px;
    gap: 8px;
  }
  #modal-quote .color-swatch {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px;
  }
  #modal-quote .color-swatch-custom {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px;
  }

  /* ── CLIENT FORM — columna única ────────────────────────── */
  #modal-quote .input-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* ── ALL INPUTS — font-size 16px evita zoom iOS ─────────── */
  #modal-quote .form-input,
  #modal-quote select.form-input,
  #modal-quote textarea.form-input,
  #modal-quote input[type="text"],
  #modal-quote input[type="email"],
  #modal-quote input[type="tel"],
  #modal-quote input[type="number"],
  #modal-quote select {
    font-size: 16px !important;
    min-height: 48px;
    padding: 12px 14px;
  }
  #modal-quote textarea.form-input { min-height: 80px; }

  /* ── SECTION HEADER — sin corte del botón ───────────────── */
  #modal-quote .section-header-row {
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }
  #modal-quote .section-header-row h3 { flex: 1; min-width: 160px; }
  #modal-quote .section-header-row .btn-outline.small {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ── GLOSA SEARCH ───────────────────────────────────────── */
  #modal-quote .glosa-search-input {
    font-size: 16px !important;
    padding: 14px 14px 14px 40px !important;
    min-height: 50px;
  }

  /* ── GLOSA ITEM ROW — nombre completo en línea propia ───── */
  #modal-quote .glosa-item-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }
  #modal-quote .gi-main {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  #modal-quote .gi-name {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 14px;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
  }
  #modal-quote .gi-controls {
    width: 100%;
    justify-content: flex-end;
    gap: 10px;
  }
  #modal-quote .qty-input-wrap input {
    min-height: 44px !important;
    min-width: 64px;
    font-size: 15px !important;
    text-align: center;
  }
  #modal-quote .gi-price {
    font-size: 15px;
    min-width: 80px;
  }
  #modal-quote .btn-remove-item {
    padding: 10px !important;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ── CONFIG GRID — columna única ────────────────────────── */
  #modal-quote .config-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* ── TAX OPTIONS — touch targets grandes ────────────────── */
  #modal-quote .tax-options {
    flex-direction: column;
    gap: 0;
  }
  #modal-quote .tax-option {
    padding: 13px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 15px;
    gap: 12px;
  }
  #modal-quote .tax-option:last-child { border-bottom: none; }
  #modal-quote .tax-option input[type="radio"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  /* ── SLIDERS — thumb 28px, track 6px ────────────────────── */
  #modal-quote input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    width: 100%;
    border-radius: 99px;
    outline: none;
    cursor: pointer;
  }
  #modal-quote input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    cursor: pointer;
    touch-action: none;
  }
  #modal-quote input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    cursor: pointer;
  }
  #modal-quote .range-wrap {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* ── ANTICIPO SLIDER ─────────────────────────────────────── */
  #modal-quote #q-advance-pct { width: 100% !important; }

  /* ── PROFIT SUMMARY — fila compacta ─────────────────────── */
  #modal-quote .quote-modal-footer {
    margin-top: 20px;
    padding-top: 16px;
  }
  #modal-quote .profit-summary {
    grid-template-columns: 1fr !important;
    gap: 6px;
    margin-bottom: 14px;
  }
  #modal-quote .ps-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
  }
  #modal-quote .ps-label { font-size: 11px; }
  #modal-quote .ps-value { font-size: 16px; }
  #modal-quote .ps-item.highlight { border-radius: 10px; }
  #modal-quote .ps-item.highlight .ps-value { font-size: 20px; }

  /* Footer actions — manejado por .quote-actions en el bloque global */
}

/* ═══════════════════════════════════════════════════════
   MULTI-WORKSPACE — selector en sidebar + modal (PRP-005)
   ═══════════════════════════════════════════════════════ */

.workspace-selector { margin-top: 14px; }
.ws-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 11px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #e6e9ef;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.ws-selector-btn:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.18);
}
.ws-selector-name {
    flex: 1;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ws-selector-caret { color: #8a92a2; flex-shrink: 0; }

/* Modal de gestión */
.ws-modal-hint {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin: -12px 0 20px;
    line-height: 1.4;
}
.ws-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
    max-height: 46vh;
    overflow-y: auto;
}
.ws-row {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 4px 6px 4px 4px;
}
.ws-row-active {
    border-color: rgba(16,185,129,0.5);
    background: rgba(16,185,129,0.08);
}
.ws-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    color: #f0f2f5;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 8px;
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.ws-row-icon {
    width: 18px;
    text-align: center;
    color: var(--emerald);
    font-weight: 800;
    flex-shrink: 0;
}
.ws-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ws-row-act {
    background: none;
    border: none;
    color: #8a92a2;
    cursor: pointer;
    padding: 9px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.ws-row-act:hover { color: #f0f2f5; background: rgba(255,255,255,0.06); }
.ws-row-del:hover { color: #ef4444; }
.ws-row-act:disabled { opacity: 0.3; cursor: not-allowed; }
.ws-row-act:disabled:hover { color: #8a92a2; background: none; }

/* ═══════════════════════════════════════════════════════
   ROLES E INVITACIONES (PRP-006)
   ═══════════════════════════════════════════════════════ */

/* Badges de rol en el selector y la lista */
.ws-role-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 6px;
    flex-shrink: 0;
}
.ws-role-editor { background: rgba(59,130,246,0.18); color: #93c5fd; }
.ws-role-viewer { background: rgba(148,163,184,0.18); color: #cbd5e1; }

/* Badge de invitaciones pendientes (contador) */
.ws-pend-badge {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    min-width: 17px;
    height: 17px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

/* Invitaciones pendientes dentro del modal */
.ws-invites {
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.25);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 14px;
}
.ws-invites-title { font-size: 13px; font-weight: 700; color: var(--emerald); margin-bottom: 10px; }
.ws-invite-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.ws-invite-row:first-of-type { border-top: none; }
.ws-invite-info { display: flex; flex-direction: column; min-width: 0; }
.ws-invite-name { font-weight: 700; font-size: 14px; color: #f0f2f5; }
.ws-invite-role { font-size: 11px; color: var(--text-muted); }
.ws-invite-acts { display: flex; gap: 6px; flex-shrink: 0; }
.ws-inv-accept, .ws-inv-reject {
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.ws-inv-accept { background: var(--emerald); color: #fff; }
.ws-inv-reject { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* Modal anidado (miembros) por encima del de workspaces */
.modal-overlay.modal-nested { z-index: 400; }

/* ── Plantillas de notas guardadas (chips) ──────────────────────────── */
.notes-templates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.notes-tpl-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: var(--modal-field-bg-2, #2f3545);
    border: 1px solid var(--modal-border, rgba(255,255,255,0.12));
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s;
    max-width: 180px;
}
.notes-tpl-chip:hover { background: rgba(255,255,255,0.1); }
.notes-tpl-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--modal-text-soft, #b8bdc8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notes-tpl-del {
    background: none;
    border: none;
    color: var(--modal-text-faint, #9097a3);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}
.notes-tpl-del:hover { color: #f87171; }

/* ── Textarea de notas — sin scrollbar propio, se expande naturalmente ── */
.notes-textarea {
    min-height: 120px;
    font-size: 14px !important;
    line-height: 1.6;
    resize: none;          /* sin resize manual = sin scrollbar propio */
    overflow: hidden;      /* el contenido empuja el alto, no crea scroll */
    overflow-wrap: break-word;
}

/* ── Checkboxes de Forma de Pago (Express + Personalizado) ───────────── */
.payment-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.pay-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--modal-field-bg-2, #2f3545);
    border: 1px solid var(--modal-border, rgba(255,255,255,0.12));
    cursor: pointer;
    flex: 1 1 calc(50% - 4px);
    font-size: 14px;
    font-weight: 500;
    color: var(--modal-text, #ededf0);
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}
.pay-checkbox-item:hover { background: rgba(255,255,255,0.08); }
.pay-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #10b981;
    cursor: pointer;
    flex-shrink: 0;
}
.pay-otro-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}
.pay-otro-label {
    font-size: 13px;
    color: var(--modal-text-soft, #b8bdc8);
    white-space: nowrap;
    flex-shrink: 0;
}
.pay-otro-input { flex: 1; }
.pay-conditions-wrap { margin-top: 8px; }
.pay-conditions-toggle {
    background: none;
    border: none;
    color: #4a9eff;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
    font-family: inherit;
}
.pay-conditions-toggle:hover { text-decoration: underline; }
.pay-conditions-field { margin-top: 8px; }

/* ── Acordeón "Opciones avanzadas" en modal Personalizado ─────────────── */
.quote-advanced-details {
    border: 1px solid var(--modal-border, rgba(0,0,0,0.12));
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.quote-advanced-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--modal-text-soft, #4a4e5a);
    list-style: none;
    user-select: none;
}
.quote-advanced-summary::-webkit-details-marker { display: none; }
.quote-advanced-details[open] .quote-advanced-summary { border-bottom: 1px solid var(--modal-border, rgba(0,0,0,0.12)); }
.quote-advanced-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Status row en footer */
.qa-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.qa-status-label {
    font-size: 12px;
    color: var(--modal-text-soft, #9097a3);
    white-space: nowrap;
}

/* Label Plan de pagos — legible en modo oscuro */
.milestones-plan-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--modal-text-soft, #b8bdc8);
}

/* ── Scroll único en #modal-quote: el body scrollea, el footer queda fijo ── */
#modal-quote .modal-sheet {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
}
/* ── Express trabajo: mismo patrón de scroll único ── */
#modal-express-trabajo .modal-sheet {
    overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════
   MODAL EXPRESS — Formulario de Trabajo (pasos 3-5)
   z-index 300 para estar encima del panel Express pero debajo de
   modales anidados. Bottom-sheet en móvil, centrado en desktop.
   ══════════════════════════════════════════════════════════════════ */
#modal-express-trabajo {
    z-index: 300;
}
.express-trabajo-sheet {
    max-width: 560px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 0;
    gap: 0;
}

/* Header: título + botón cerrar */
.express-trabajo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-shrink: 0;
}

/* Secciones de contenido — no scrollean (lo hace .express-trabajo-body) */
.express-trabajo-section {
    padding-bottom: 12px;
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 16px;
    margin-top: 4px;
}

/* Cuerpo único scrolleable — evita el doble scroll */
.express-trabajo-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Footer sticky con total + botón PDF */
.express-trabajo-footer {
    flex-shrink: 0;
    padding: 12px 0 20px;
    border-top: 1px solid var(--border);
    background: #ffffff;
    position: sticky;
    bottom: 0;
}

/* Desktop: centrado, no bottom-sheet */
@media (min-width: 768px) {
    .express-trabajo-sheet {
        border-radius: 24px;
        border-bottom: 1px solid rgba(0,0,0,0.08);
    }
    .express-trabajo-footer {
        border-radius: 0 0 24px 24px;
    }
}

/* Formulario de invitar */
.member-invite-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.member-invite-form .form-input { font-size: 14px; }
#member-invite-email { flex: 1; min-width: 0; }
.member-invite-role { width: auto; min-width: 90px; flex-shrink: 0; }
.member-invite-btn {
    flex-shrink: 0;
    width: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Lista de miembros */
.members-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; max-height: 44vh; overflow-y: auto; }
.members-loading, .members-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 16px;
}
.member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 12px;
}
.member-row-owner { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.07); }
.member-info { display: flex; flex-direction: column; min-width: 0; }
.member-email { font-weight: 600; font-size: 14px; color: #f0f2f5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.member-status { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.member-status-ok   { background: rgba(16,185,129,0.18); color: #6ee7b7; }
.member-status-pend { background: rgba(245,158,11,0.18); color: #fcd34d; }
.member-acts { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.member-role-select { font-size: 12px; padding: 5px 6px; border-radius: 8px; background: rgba(0,0,0,0.2); color: #f0f2f5; border: 1px solid rgba(255,255,255,0.1); }
.member-remove {
    background: none;
    border: none;
    color: #8a92a2;
    cursor: pointer;
    padding: 7px;
    border-radius: 8px;
    display: flex;
    align-items: center;
}
.member-remove:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* ── Gating por rol: Viewer no ve acciones de escritura ── */
body.is-viewer .fab,
body.is-viewer [onclick^="openProductModal"],
body.is-viewer [onclick^="openQuoteModal"],
body.is-viewer [onclick^="openClientModal"],
body.is-viewer [onclick^="openTxModal"],
body.is-viewer [onclick^="openCatModal"],
body.is-viewer [onclick^="openExpressPanel"],
body.is-viewer [onclick^="handleFabClick"] {
    display: none !important;
}

/* ── Share link btn states (PRP-007) ── */
.qa-link.qa-link-active { color: var(--emerald); border-color: rgba(16,185,129,0.5); background: rgba(16,185,129,0.08); }
.qa-link-revoke { color: #ef4444 !important; border-color: rgba(239,68,68,0.3) !important; background: rgba(239,68,68,0.06) !important; padding: 0 10px !important; min-width: auto !important; }
.qa-link-revoke:hover { background: rgba(239,68,68,0.14) !important; }

/* ═══════════════════════════════════════════════════════
   MODAL MI SUSCRIPCIÓN — PRP-009
   ═══════════════════════════════════════════════════════ */
.sub-status-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin-bottom: 12px;
}
.sub-status-badge {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 8px;
}
.sub-status-badge.premium { background: rgba(245,158,11,0.15); color: #f59e0b; }
.sub-status-badge.free    { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.sub-status-desc { font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.5; }

.sub-expiry-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    color: #f59e0b;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
}
.sub-expiry-banner i { flex-shrink: 0; }

.sub-payments-section { margin: 18px 0 12px; }
.sub-payments-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 8px;
}
.sub-payments-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.sub-pay-empty { font-size: 13px; color: var(--text-muted); text-align: center; padding: 12px; margin: 0; }
.sub-pay-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}
.sub-pay-date    { font-size: 13px; font-weight: 600; display: block; }
.sub-pay-concept { font-size: 11px; color: var(--text-muted); }
.sub-pay-right   { text-align: right; }
.sub-pay-amount  { font-size: 13px; font-weight: 700; display: block; }
.sub-pay-status  { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sub-pay-status.ok { color: var(--emerald); }

.sub-footnote {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
    margin: 8px 0 10px;
}
.sub-legal-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    background: rgba(0,0,0,0.04);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 14px;
}
.sub-legal-note svg { flex-shrink: 0; margin-top: 1px; color: var(--accent); }
.sub-legal-note a { color: var(--accent); text-decoration: none; font-weight: 600; }
.sub-legal-note a:hover { text-decoration: underline; }

/* Bloque de precio en modal suscripción (PRP-018) */
.sub-price-info {
    background: rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 4px 0 14px;
    text-align: center;
}
.sub-price-amount {
    font-size: 26px;
    font-weight: 800;
    color: var(--modal-text, #1a1d24);
    letter-spacing: -0.5px;
}
.sub-price-period {
    font-size: 15px;
    font-weight: 500;
    color: var(--modal-text-soft, #4a5060);
}
.sub-price-note {
    font-size: 12px;
    color: var(--modal-text-faint, #7a8090);
    margin: 6px 0 0;
    line-height: 1.4;
}

/* Botón cancelar suscripción (PRP-018) — acción destructiva discreta */
.sub-cancel-btn {
    color: #dc2626;
}
.sub-cancel-btn:hover {
    color: #b91c1c;
}

/* ═══════════════════════════════════════════════════════
   PWA — Banner "nueva versión disponible" (PRP-010)
   ═══════════════════════════════════════════════════════ */
.pwa-update-banner {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 14px;
    background: #1e2535;
    border: 1px solid rgba(16,185,129,0.4);
    color: #f0f2f5;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    font-size: 14px;
    max-width: calc(100vw - 32px);
    animation: pwaBannerIn 0.3s ease;
}
@keyframes pwaBannerIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.pwa-update-banner button {
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.pwa-update-banner button:active { transform: scale(0.96); }

/* ══════════════════════════════════════════════════════════════
   WIZARD ENGINE — Constructor de Presupuestos Multi-Paso
   Principios: Progreso Dotado, Zeigarnik, Gradiente de Meta, IKEA.
   ══════════════════════════════════════════════════════════════ */

/* Modal Express wizard — columna flex como quote */
#modal-express-wizard .modal-sheet {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px 20px 0;
    max-width: 500px;
}

/* Barra de progreso */
.wiz-prog-header { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:6px; }
.wiz-prog-label  { font-size:15px; font-weight:700; color:var(--modal-text,#1a1d24); }
.wiz-prog-step   { font-size:11px; font-weight:600; color:var(--modal-text-soft,#4a5060); letter-spacing:0.03em; }
.wiz-prog-bar    { height:5px; background:rgba(0,0,0,0.08); border-radius:99px; overflow:hidden; margin-bottom:16px; }
.wiz-prog-fill   { height:100%; background:linear-gradient(90deg,#10b981,#059669); border-radius:99px; transition:width 0.4s cubic-bezier(.4,0,.2,1); }

/* Cuerpo scrolleable */
.wizard-body { flex:1; overflow-y:auto; padding-bottom:8px; }

/* Barra de margen (Personalizado) */
.wiz-profit-bar {
    display:flex; gap:8px; margin-bottom:12px;
}
.wiz-profit-item {
    flex:1; display:flex; flex-direction:column; gap:2px;
    padding:8px 10px; border-radius:8px;
    background:rgba(255,255,255,0.5); border:1px solid rgba(0,0,0,0.07);
}
.wiz-profit-total { background:rgba(16,185,129,0.1); border-color:rgba(16,185,129,0.25); }
.wiz-profit-lbl { font-size:9px; color:var(--modal-text-faint,#7a8090); text-transform:uppercase; letter-spacing:0.04em; }
.wiz-profit-val { font-size:14px; font-weight:800; color:var(--modal-text,#1a1d24); }
.wiz-profit-total .wiz-profit-val { color:#059669; }

/* Steps */
.wizard-step { display:none; animation:wizFadeIn 0.22s ease; }
.wizard-step--active { display:block; }
@keyframes wizFadeIn { from{opacity:0;transform:translateX(10px)} to{opacity:1;transform:translateX(0)} }

/* Mini-preview */
.wizard-preview {
    background:rgba(255,255,255,0.55);
    border:1px solid rgba(0,0,0,0.08);
    border-radius:10px;
    padding:11px 14px;
    margin-bottom:12px;
    backdrop-filter:blur(4px);
}
.wiz-preview-doc   { display:flex; flex-direction:column; gap:5px; }
.wiz-preview-header{ display:flex; align-items:center; gap:8px; padding-bottom:6px; border-bottom:1px solid rgba(0,0,0,0.07); margin-bottom:2px; }
.wiz-preview-logo  { font-size:17px; flex-shrink:0; }
.wiz-preview-type  { font-size:10px; color:var(--modal-text-faint,#7a8090); margin:0; text-transform:uppercase; letter-spacing:0.05em; }
.wiz-preview-title { font-size:12px; font-weight:700; color:var(--modal-text,#1a1d24); margin:0; }
.wiz-preview-row   { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.wiz-preview-label { font-size:10px; color:var(--modal-text-faint,#7a8090); flex-shrink:0; }
.wiz-preview-val   { font-size:12px; font-weight:600; color:var(--modal-text,#1a1d24); text-align:right; }
.wiz-preview-items { display:flex; flex-direction:column; gap:2px; margin:2px 0; }
.wiz-preview-item  { display:flex; justify-content:space-between; gap:6px; }
.wiz-preview-item-name  { font-size:11px; color:var(--modal-text-soft,#4a5060); flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wiz-preview-item-price { font-size:11px; font-weight:600; color:var(--modal-text,#1a1d24); flex-shrink:0; }
.wiz-preview-more  { font-size:10px; color:var(--modal-text-faint,#7a8090); margin:2px 0 0; }
.wiz-preview-total { display:flex; justify-content:space-between; align-items:baseline; padding-top:5px; border-top:1px solid rgba(0,0,0,0.07); margin-top:2px; }
.wiz-preview-total span:first-child { font-size:11px; color:var(--modal-text-faint,#7a8090); }
.wiz-preview-total-val { font-size:16px; font-weight:900; color:#059669; }

/* Navegación Atrás / Siguiente */
.wizard-nav {
    display:flex; gap:10px; align-items:center;
    padding:12px 0 20px;
    border-top:1px solid var(--border);
    flex-shrink:0;
    background:#ffffff;
    position:sticky; bottom:0;
}
.wiz-btn-back {
    display:inline-flex; align-items:center; gap:6px;
    height:48px; padding:0 16px;
    background:transparent; border:1px solid rgba(0,0,0,0.12); border-radius:10px;
    color:var(--modal-text-soft,#4a5060); font-size:13px; font-weight:600;
    cursor:pointer; font-family:inherit; transition:all 0.18s; flex-shrink:0;
}
.wiz-btn-back:hover { background:rgba(0,0,0,0.05); }
.wiz-btn-back--hidden { visibility:hidden; pointer-events:none; }
.wiz-btn-next {
    display:inline-flex; align-items:center; justify-content:center; gap:6px;
    height:48px; flex:1;
    background:var(--accent);
    color:#ffffff; border:none; border-radius:10px;
    font-size:14px; font-weight:700; cursor:pointer; font-family:inherit;
    transition:all 0.18s; box-shadow:0 4px 12px rgba(37,99,235,0.2);
}
.wiz-btn-next:hover { filter:brightness(1.1); transform:translateY(-1px); }
.wiz-btn-next:active { transform:scale(0.98); }
.wiz-btn-next--final {
    background:linear-gradient(135deg,#10b981,#059669);
    box-shadow:0 4px 14px rgba(16,185,129,0.3);
}

/* Micro-celebración checkmark animado */
.wizard-celebrate-overlay {
    display:none; position:fixed; inset:0; z-index:9999;
    background:rgba(0,0,0,0.55); align-items:center; justify-content:center;
    backdrop-filter:blur(4px);
}
.wizard-celebrate-overlay.wizard-celebrate-show { display:flex; animation:wizCelebIn 0.2s ease; }
@keyframes wizCelebIn { from{opacity:0} to{opacity:1} }
.wizard-celebrate-inner { display:flex; flex-direction:column; align-items:center; gap:16px; }
.wizard-celebrate-check { width:72px; height:72px; }
.wizard-celebrate-svg   { width:72px; height:72px; }
.wizard-celebrate-circle {
    stroke:#10b981; stroke-width:3;
    stroke-dasharray:166; stroke-dashoffset:166;
    animation:wizCircle 0.6s ease forwards;
}
.wizard-celebrate-tick {
    stroke:#10b981; stroke-width:4;
    stroke-linecap:round; stroke-linejoin:round;
    stroke-dasharray:48; stroke-dashoffset:48;
    animation:wizTick 0.35s ease 0.5s forwards;
}
@keyframes wizCircle { to{stroke-dashoffset:0} }
@keyframes wizTick   { to{stroke-dashoffset:0} }
.wizard-celebrate-msg {
    font-size:18px; font-weight:800; color:#ffffff;
    text-shadow:0 2px 8px rgba(0,0,0,0.3);
    animation:wizMsgIn 0.3s ease 0.7s both;
}
@keyframes wizMsgIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

/* ===========================================================
   CREADOR DE PRESUPUESTO — PANTALLA COMPLETA (PRP-023)
   Shell flat/clean. Reutiliza los internos del wizard
   (.wizard-step, .wiz-profit-bar, .wizard-preview, .wizard-nav).
   =========================================================== */
.quote-fs {
    display:none; position:fixed; inset:0; z-index:200; background:#f8fafc;
    --modal-text:         #0f172a;
    --modal-text-soft:    #475569;
    --modal-text-faint:   #94a3b8;
    --modal-field-bg:     #f8fafc;
    --modal-field-bg-2:   #f1f5f9;
    --modal-border:       #e2e8f0;
    --modal-border-focus: #2563eb;
}
.quote-fs.open { display:block; }
/* 100dvh exacto (lección iOS); el safe-area va en el topbar, no aquí */
.quote-fs-shell { display:flex; flex-direction:column; height:100vh; height:100dvh; }

/* Cabecera flat tipo view-topbar */
.quote-fs-topbar {
    display:flex; align-items:center; justify-content:space-between;
    padding:14px 24px; padding-top:calc(14px + env(safe-area-inset-top,0px));
    background:#ffffff; border-bottom:1px solid var(--border); flex-shrink:0;
}
.quote-fs-title { font-size:16px; font-weight:700; color:var(--text-primary); }
.quote-fs-close {
    width:40px; height:40px; flex-shrink:0;
    display:flex; align-items:center; justify-content:center;
    background:#f1f5f9; border:1px solid var(--border); border-radius:10px;
    color:var(--text-secondary); cursor:pointer; transition:var(--transition);
}
.quote-fs-close:hover { background:#e2e8f0; color:var(--text-primary); }

/* Progreso horizontal — solo móvil */
.quote-fs-progress { display:none; padding:12px 16px 0; background:#f8fafc; flex-shrink:0; }

/* Main: 3 columnas en desktop */
.quote-fs-main {
    flex:1; min-height:0;
    display:grid; grid-template-columns:220px 1fr 320px;
    overflow:hidden;
}

/* Columna 1: sidebar oscuro de pasos */
.quote-fs-steps { background:#0f172a; padding:24px 14px; overflow-y:auto; }
.wiz-stepnav { display:flex; flex-direction:column; gap:6px; }
.wiz-stepnav-item {
    display:flex; align-items:center; gap:12px; width:100%; text-align:left;
    padding:12px 14px; border-radius:10px; border:none; background:transparent;
    color:#9aa0ac; font-family:inherit; font-size:13px; font-weight:600;
    cursor:pointer; transition:var(--transition);
}
.wiz-stepnav-item:disabled { cursor:default; opacity:0.5; }
.wiz-stepnav-num {
    width:26px; height:26px; flex-shrink:0; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    background:rgba(255,255,255,0.08); color:#cbd5e1; font-size:12px; font-weight:800;
}
.wiz-stepnav-item--done   { color:#cbd5e1; }
.wiz-stepnav-item--done   .wiz-stepnav-num { background:#10b981; color:#fff; }
.wiz-stepnav-item--active { background:#2563eb; color:#fff; }
.wiz-stepnav-item--active .wiz-stepnav-num { background:#fff; color:#2563eb; }
.wiz-stepnav-item:not(:disabled):not(.wiz-stepnav-item--active):hover { background:rgba(255,255,255,0.06); color:#f0f2f5; }

/* Columna 2: centro con formulario */
.quote-fs-center { display:flex; flex-direction:column; min-height:0; background:#ffffff; }
.quote-fs .wizard-body { flex:1; overflow-y:auto; overflow-x:hidden; padding:28px 32px; -webkit-overflow-scrolling:touch; }
.quote-fs .wizard-nav {
    position:static; flex-shrink:0; background:#fff; border-top:1px solid var(--border);
    padding:14px 32px calc(14px + env(safe-area-inset-bottom,0px));
}

/* Columna 3: panel resumen */
.quote-fs-summary {
    background:#f8fafc; border-left:1px solid var(--border);
    padding:24px 20px; overflow-y:auto; display:flex; flex-direction:column; gap:14px;
}
.quote-fs-summary .wiz-profit-bar { flex-direction:column; gap:10px; margin:0; }
.quote-fs-summary .wiz-profit-item { background:#ffffff; border:1px solid var(--border); }
.quote-fs-summary .wiz-profit-val { font-size:18px; }
.quote-fs-summary .wizard-preview { background:#ffffff; border:1px solid var(--border); backdrop-filter:none; margin:0; }

/* Acordeón de datos opcionales (revelación progresiva) */
.wiz-optional { border:1px solid var(--border); border-radius:10px; background:#fff; overflow:hidden; }
.wiz-optional-summary {
    display:flex; align-items:center; gap:8px; cursor:pointer; list-style:none;
    padding:13px 14px; font-size:13px; font-weight:600; color:var(--text-secondary);
    -webkit-tap-highlight-color:transparent; user-select:none;
}
.wiz-optional-summary::-webkit-details-marker { display:none; }
.wiz-optional-hint { color:var(--text-muted); font-weight:400; }
.wiz-optional-chevron { width:16px; height:16px; flex-shrink:0; transition:transform 0.2s; }
.wiz-optional[open] > .wiz-optional-summary .wiz-optional-chevron { transform:rotate(90deg); }
.wiz-optional[open] > .wiz-optional-summary { border-bottom:1px solid var(--border); }
.wiz-optional-body { padding:14px; }

/* ── Móvil: 1 columna ── */
@media (max-width:1023px) {
    .quote-fs-progress { display:block; }
    .quote-fs-main { display:flex; flex-direction:column; }
    .quote-fs-steps { display:none; }
    /* Resumen pasa a franja superior (solo costo/ganancia/total) */
    .quote-fs-summary {
        order:-1; flex-direction:row; gap:8px; overflow:visible;
        border-left:none; border-bottom:1px solid var(--border); padding:12px 16px;
    }
    .quote-fs-summary .wiz-profit-bar { flex-direction:row; flex:1; }
    .quote-fs-summary .wizard-preview { display:none; }
    .quote-fs-center { flex:1; min-height:0; }
    .quote-fs .wizard-body { padding:16px; }
    .quote-fs .wizard-nav { padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px)); }

    /* Express no tiene wiz-profit-bar: su franja resumen muestra solo el total (no se oculta vacía) */
    #modal-express-wizard .quote-fs-summary { padding:10px 16px; }
    #modal-express-wizard .quote-fs-summary .wizard-preview {
        display:flex; flex:1; background:none; border:none; padding:0;
    }
    #modal-express-wizard .quote-fs-summary .wiz-preview-doc { display:flex; width:100%; }
    #modal-express-wizard .quote-fs-summary .wiz-preview-header,
    #modal-express-wizard .quote-fs-summary .wiz-preview-row,
    #modal-express-wizard .quote-fs-summary .wiz-preview-items,
    #modal-express-wizard .quote-fs-summary .wiz-preview-more { display:none; }
    #modal-express-wizard .quote-fs-summary .wiz-preview-total {
        margin:0; width:100%; display:flex; justify-content:space-between; align-items:center;
    }
}

/* ── Selector tipo de presupuesto (Express / Personalizado) ── */
.chooser-body { flex:1; display:flex; align-items:center; justify-content:center; padding:32px 20px; overflow-y:auto; }
.chooser-grid { display:flex; gap:20px; flex-wrap:wrap; justify-content:center; max-width:560px; }
.chooser-card {
    width:220px; display:flex; flex-direction:column; align-items:center; gap:10px;
    padding:36px 20px; border:1px solid var(--border); border-radius:16px; background:#fff;
    cursor:pointer; transition:border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.chooser-card:hover { border-color:var(--accent); transform:translateY(-2px); box-shadow:0 8px 20px rgba(0,0,0,0.06); }
.chooser-card-icon { font-size:36px; line-height:1; }
.chooser-card-title { font-size:16px; font-weight:700; color:var(--text-primary); }
@media (max-width:480px) {
    .chooser-grid { flex-direction:column; align-items:center; }
    .chooser-card { width:100%; max-width:280px; }
}

/* ══════════════════════════════════════════════════════════════════
   PRP-025 — Retheme claro de .quote-fs (Express + Personalizado)
   Causa raíz: estos componentes se diseñaron para el viejo .modal-sheet
   OSCURO y usan tokens --modal-* (con fallback oscuro hardcodeado) o
   valores rgba(255,255,255,X)/rgba(0,0,0,X) directos. .quote-fs es un
   shell CLARO — sin este override caen al fallback oscuro = ilegible.
   ══════════════════════════════════════════════════════════════════ */

/* 1) Tokens --modal-* claros: fusionados directo en la regla .quote-fs (línea ~6248)
      para evitar que un segundo bloque de solo-custom-properties no se parseé.
      Arregla automáticamente todo lo que usa var(--modal-*, fallback-oscuro):
      pay-checkbox-item, notes-tpl-chip, quote-advanced-*, qa-status-label,
      qa-cancel-solo, qa-more-summary, wiz-prog-*/wiz-profit-*/wiz-preview-*. */

/* 2) Componentes con valores oscuros HARDCODEADOS (sin var) — override directo.
      Selectores con .quote-fs delante ganan por especificidad sin necesitar !important. */

/* Partidas/glosas (paso "¿Qué incluye?" de Personalizado) */
.quote-fs .glosa-card { background:#ffffff; border:1px solid var(--border); }
.quote-fs .glosa-header { background:#f8fafc; border-bottom:1px solid var(--border); }
.quote-fs .glosa-title-input { color:var(--text-primary); }
.quote-fs .glosa-title-input::placeholder { color:var(--text-muted); }
.quote-fs .glosa-search-input { background:#ffffff; border:1px solid var(--border); color:var(--text-primary); }
.quote-fs .search-results { background:#ffffff; border:1px solid var(--border); box-shadow:0 16px 40px rgba(0,0,0,0.12); }
.quote-fs .search-result-item { border-bottom:1px solid var(--border); }
.quote-fs .search-result-item:hover,
.quote-fs .search-result-item.sr-focused { background:#f8fafc; }
.quote-fs .sri-name { color:var(--text-primary); }
.quote-fs .sri-cat { color:var(--text-muted); }
.quote-fs .search-result-empty { color:var(--text-muted); }
.quote-fs .sr-create-btn { background:#f1f5f9; border:1px solid var(--border); color:var(--text-secondary); }
.quote-fs .search-result-more { color:var(--text-muted); border-top:1px solid var(--border); }

.quote-fs .glosa-item-row { background:#f8fafc; border:1px solid var(--border); }
.quote-fs .glosa-item-row:hover { background:#f1f5f9; }
.quote-fs .gi-name { color:var(--text-primary); }
.quote-fs .qty-input-wrap input { background:#ffffff; border:1px solid var(--border); color:var(--text-primary); }
.quote-fs .gi-price { color:var(--text-primary); }
.quote-fs .gi-obs-input { color:var(--text-secondary); border-bottom:1px dashed var(--border); }
.quote-fs .gi-obs-input::placeholder { color:var(--text-muted); }
.quote-fs .gi-obs-input:focus { color:var(--text-primary); border-bottom-color:var(--accent); }
.quote-fs .gi-discount-toggle-label { color:var(--text-muted); }
.quote-fs .gi-discount-val { background:#ffffff; color:var(--text-primary); }
.quote-fs .gi-discount-result { color:var(--text-secondary); }
.quote-fs .gi-price-original { color:var(--text-muted); }

/* Checkboxes de Forma de Pago (Express + Personalizado, paso "¿Cómo te pagan?") */
.quote-fs .pay-checkbox-item:hover { background:#f1f5f9; }
.quote-fs .notes-tpl-chip:hover { background:#e2e8f0; }

/* Opciones avanzadas: "Tipo de documento" / branding (paso "Opciones") */
.quote-fs .config-box { background:#f8fafc; border:1px solid var(--border); }
.quote-fs .branding-quick-bar { background:#f8fafc; border:1px solid var(--border); }
.quote-fs .qa-cancel-solo:hover { background:#f1f5f9; }
.quote-fs .qa-more-body { border-top:1px solid var(--border); }
.quote-fs .qa-status-row { border-top:1px solid var(--border); }

/* Select "Estado del presupuesto" — único uso es dentro de .quote-fs (q-status).
   Base: background rgba(255,255,255,.05) + color:white = invisible sobre shell claro. */
.quote-fs .status-badge-select { background:#f1f5f9; border:1px solid var(--border); color:var(--text-primary); }
.quote-fs .status-badge-select option { background:#ffffff; color:var(--text-primary); }

/* ── API Keys (PRP-021) ──────────────────────────────── */

/* Contenedor dentro de setting-item */
.setting-item-apikeys { flex-direction: column; align-items: stretch; gap: 12px; }
.setting-apikeys-header {
    display: flex; justify-content: space-between; align-items: center;
}
.settings-apikeys-list { display: flex; flex-direction: column; gap: 8px; }

/* Fila de key */
.apikey-row {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px; padding: 10px 12px; gap: 8px;
}
.apikey-row-revoked { opacity: 0.5; }
.apikey-row-info    { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.apikey-row-name    { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.apikey-row-prefix  { font-size: 12px; font-family: 'Courier New', monospace; color: var(--text-secondary); }
.apikey-row-meta    { font-size: 11px; color: var(--text-muted); }
.apikey-row-revoked-tag {
    display: inline-block; font-size: 10px; font-weight: 600; color: #ef4444;
    background: rgba(239,68,68,0.1); border-radius: 4px; padding: 1px 5px; margin-top: 2px;
}
.apikey-revoke-btn {
    flex-shrink: 0; background: transparent; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px; border-radius: 6px; transition: color 0.2s;
}
.apikey-revoke-btn:hover { color: #ef4444; }

/* Upsell premium */
.apikey-upsell {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-secondary);
    padding: 8px 4px;
}
.apikey-upsell a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Estados vacíos / carga */
.apikey-loading, .apikey-empty {
    font-size: 12px; color: var(--text-muted); padding: 6px 0;
}

/* Sección revocadas plegable */
.apikey-revoked-details { margin-top: 4px; }
.apikey-revoked-details summary {
    font-size: 12px; color: var(--text-muted); cursor: pointer; padding: 4px 0;
}

/* Scopes checkboxes en modal */
.apikey-scopes-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.apikey-scope-check {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-primary); cursor: pointer;
}
.apikey-scope-check input { cursor: pointer; }
.apikey-scope-check small { color: var(--text-muted); font-size: 11px; }
.input-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Modal: API Key creada */
.apikey-created-icon {
    display: flex; justify-content: center; margin: 4px 0 12px;
    color: #10b981;
}
.apikey-created-warning {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: #f59e0b; background: rgba(245,158,11,0.1);
    border-radius: 8px; padding: 8px 12px; margin-bottom: 12px;
}
.apikey-created-warning i { flex-shrink: 0; }
.apikey-display-box {
    display: flex; align-items: center; gap: 8px;
    background: rgba(0,0,0,0.06); border: 1px solid rgba(0,0,0,0.12);
    border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
    overflow: hidden;
}
.apikey-value-text {
    flex: 1; font-size: 12px; font-family: 'Courier New', monospace;
    color: var(--text-primary); word-break: break-all; overflow-wrap: anywhere;
}
.apikey-copy-btn {
    flex-shrink: 0; background: transparent; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px; border-radius: 6px; transition: color 0.2s;
}
.apikey-copy-btn:hover { color: var(--accent); }
.apikey-created-meta {
    font-size: 12px; color: var(--text-muted); text-align: center; margin-bottom: 12px;
}

/* dark mode overrides */
@media (prefers-color-scheme: dark) {
    .apikey-row { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); }
    .apikey-display-box { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
}

/* ── AI Formula panel ── */
.fc-ai-panel { display: flex; flex-direction: column; gap: 14px; padding: 4px 0; }
.fc-ai-header { display: flex; align-items: flex-start; gap: 12px; }
.fc-ai-icon { font-size: 24px; line-height: 1; padding-top: 2px; }
.fc-ai-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0 0 2px; }
.fc-ai-sub   { font-size: 12px; color: var(--text-muted); margin: 0; }
.fc-ai-key-missing {
    display: flex; align-items: flex-start; gap: 8px; font-size: 12px;
    color: var(--text-secondary); background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.2); border-radius: 10px; padding: 10px 12px;
}
.fc-ai-key-missing a { color: var(--accent); text-decoration: none; font-weight: 600; }
.fc-ai-textarea { resize: vertical; min-height: 72px; font-size: 13px; }
.fc-ai-hint {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--text-muted); margin: -6px 0 0;
}
.fc-ai-result-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.fc-ai-result-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin: 0; }
.fc-ai-items-list { display: flex; flex-direction: column; gap: 6px; }
.fc-ai-item-row {
    display: grid; grid-template-columns: 1fr auto auto; gap: 6px;
    align-items: center; font-size: 12px;
}
.fc-ai-item-name  { color: var(--text-primary); font-weight: 500; }
.fc-ai-item-meta  { color: var(--text-muted); font-size: 11px; }
.fc-ai-item-total { color: var(--text-secondary); font-weight: 600; font-size: 12px; text-align: right; }
.fc-ai-totals     { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.fc-ai-total-row  { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); }
.fc-ai-total-row small { color: var(--text-muted); font-size: 11px; }
.fc-ai-total-suggested { color: var(--text-primary); font-size: 14px; }
.fc-ai-total-suggested strong { color: #10b981; }
.fc-ai-notes { font-size: 12px; color: var(--text-muted); background: var(--bg-muted,rgba(0,0,0,0.03)); border-radius: 8px; padding: 8px 10px; margin: 0; }

/* Spinning loader icon */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; display: inline-block; }



/* ═══════════════════════════════════════════════
   LEGAL — Register checkbox + Settings items + Modal
   ═══════════════════════════════════════════════ */

/* Register form — terms checkbox */
.register-terms-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.register-terms-wrap input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    min-width: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.register-terms-wrap label { cursor: pointer; }
.register-terms-wrap a { color: var(--accent); text-decoration: none; font-weight: 600; }
.register-terms-wrap a:hover { text-decoration: underline; }

/* Settings — legal doc items */
.legal-doc-item { cursor: pointer; user-select: none; }
.legal-doc-item:hover { background: var(--bg-muted, rgba(0,0,0,0.03)); }

/* Legal modal overlay */
.legal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.legal-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.legal-modal-sheet {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(30px);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
    overflow: hidden;
}
.legal-modal-overlay.active .legal-modal-sheet {
    transform: translateY(0);
}
.legal-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.legal-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px;
}
.legal-modal-updated {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}
.legal-modal-close {
    background: var(--bg-muted, rgba(0,0,0,0.06));
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
}
.legal-modal-body {
    overflow-y: auto;
    padding: 20px 20px 40px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
    -webkit-overflow-scrolling: auto;
}
.legal-modal-body h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 20px 0 6px;
}
.legal-modal-body h3:first-child { margin-top: 0; }
.legal-modal-body p { margin: 0 0 8px; }
.legal-modal-body ul,
.legal-modal-body ol {
    margin: 0 0 8px;
    padding-left: 18px;
}
.legal-modal-body li { margin-bottom: 4px; }
.legal-modal-body strong { color: var(--text-primary); font-weight: 600; }
.legal-aviso {
    background: var(--bg-muted, rgba(0,0,0,0.04));
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px !important;
}
.legal-footer-block {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}
