/* ============================================================
   Portal de Distribuidores — Exacto Menu
   Design System
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ── */
:root {
    --primary:       #0b4c8c;
    --primary-dark:  #083a6e;
    --primary-light: #1a6bbf;
    --accent:        #00a8e8;
    --accent-dark:   #0090cc;
    --success:       #10b981;
    --success-bg:    #d1fae5;
    --warning:       #f59e0b;
    --warning-bg:    #fef3c7;
    --danger:        #ef4444;
    --danger-bg:     #fee2e2;
    --info:          #3b82f6;
    --info-bg:       #dbeafe;
    --gray-50:       #f9fafb;
    --gray-100:      #f3f4f6;
    --gray-200:      #e5e7eb;
    --gray-300:      #d1d5db;
    --gray-400:      #9ca3af;
    --gray-500:      #6b7280;
    --gray-600:      #4b5563;
    --gray-700:      #374151;
    --gray-800:      #1f2937;
    --bg:            #f0f2f5;
    --card-bg:       #ffffff;
    --card-radius:   12px;
    --card-shadow:   0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08);
    --nav-h:         64px;
    --sidebar-w:     240px;
    --transition:    0.2s ease;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--gray-700);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-dark); }

img { max-width: 100%; height: auto; }

/* ── Typography ── */
h1, h2, h3, h4, h5 { color: var(--gray-800); font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

.text-muted  { color: var(--gray-500); }
.text-small  { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }

/* ── Layout: Login ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #051e3e 100%);
    padding: 24px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-logo {
    display: block;
    margin: 0 auto 12px;
    max-width: 200px;
    height: auto;
}

.login-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-600);
    text-align: center;
    margin-bottom: 8px;
}

.login-dist {
    font-size: 0.875rem;
    color: var(--accent);
    text-align: center;
    margin-bottom: 32px;
    font-weight: 500;
}

/* ── Layout: App Shell ── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 20px 18px 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.sidebar-brand-primary img {
    width: 180px;
    max-width: 100%;
    max-height: 44px;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.sidebar-brand-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 9px;
    color: rgba(255,255,255,.48);
    font-size: .57rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-brand-divider::before,
.sidebar-brand-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(255,255,255,.16);
}

.sidebar-brand-partner img {
    max-width: 80px;
    max-height: 50px;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.sidebar-brand-partner-fallback {
    display: none;
    color: #fff;
    font-size: .92rem;
    font-weight: 700;
    text-align: center;
}

.sidebar-dist {
    font-size: 0.75rem;
    color: rgba(255,255,255,.6);
    text-align: center;
    margin-top: 6px;
    font-weight: 500;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,.75);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: rgba(0,168,232,.18);
    color: #fff;
    border-left-color: var(--accent);
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

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

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,.6);
    font-size: 0.85rem;
    transition: color var(--transition);
}

.sidebar-footer a:hover { color: #fff; text-decoration: none; }

/* Main content */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--nav-h);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title { font-size: 1.125rem; font-weight: 700; color: var(--gray-800); }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content {
    padding: 28px;
    flex: 1;
}

/* ── Cards ── */
.card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

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

.card-header h3 { margin: 0; font-size: 1rem; }

.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

/* ── Stat Cards ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: box-shadow var(--transition), transform var(--transition);
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.blue    { background: var(--info-bg);    color: var(--info); }
.stat-icon.green   { background: var(--success-bg); color: var(--success); }
.stat-icon.amber   { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple  { background: #ede9fe;            color: #7c3aed; }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--gray-800); line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 0.8rem; color: var(--gray-500); font-weight: 500; }

/* Commission stat card */
.stat-card.commission-card {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
}
.stat-card.commission-card .stat-value { color: var(--success); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-accent {
    background: var(--accent);
    color: #fff;
}
.btn-accent:hover { background: var(--accent-dark); color: #fff; }

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover { background: #059669; color: #fff; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-outline-gray {
    background: transparent;
    color: var(--gray-600);
    border: 1.5px solid var(--gray-300);
}
.btn-outline-gray:hover { background: var(--gray-100); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 10px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-block { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--gray-800);
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,168,232,.15);
}

.form-control.error { border-color: var(--danger); }
.form-control.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.15); }

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-text { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 4px; display: none; }
.form-error.show { display: block; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
}

/* ── Step Indicator ── */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 36px;
    gap: 0;
}

.step-item {
    display: flex;
    align-items: center;
}

.step-bubble {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.step-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 6px;
    font-weight: 500;
    text-align: center;
    transition: color 0.3s ease;
}

.step-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.step-connector {
    height: 2px;
    width: 80px;
    background: var(--gray-200);
    margin: 0 -1px;
    margin-bottom: 24px;
    transition: background 0.3s ease;
}

.step-item.active .step-bubble {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(0,168,232,.2);
}

.step-item.active .step-label { color: var(--accent); font-weight: 600; }

.step-item.completed .step-bubble {
    background: var(--success);
    color: #fff;
}

.step-item.completed .step-label { color: var(--success); }

.step-item.completed + .step-connector,
.step-connector.completed {
    background: var(--success);
}

/* ── Step Forms ── */
.step-section { display: none; }
.step-section.active { display: block; }

/* ── Product Selection Cards ── */
.kit-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.kit-card {
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    background: #fff;
}

.kit-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,168,232,.1);
}

.kit-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.kit-card.selected {
    border-color: var(--accent);
    background: rgba(0,168,232,.04);
    box-shadow: 0 0 0 3px rgba(0,168,232,.15);
}

.kit-card-check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    background: #fff;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: transparent;
}

.kit-card.selected .kit-card-check {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.kit-icon { font-size: 2rem; margin-bottom: 10px; display: block; }

.kit-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.kit-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 12px;
    line-height: 1.4;
}

.kit-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.kit-price-note {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 400;
}

/* ── Quote Preview ── */
.quote-preview {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
}

.quote-preview h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.preview-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9rem;
}

.preview-line:last-child { border-bottom: none; }
.preview-line .item-name { color: var(--gray-700); }
.preview-line .item-price { font-weight: 600; color: var(--gray-800); }

.preview-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 8px;
    margin-top: 8px;
    border-top: 2px solid var(--gray-300);
}

.preview-total .total-label { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.preview-total .total-amount { font-size: 1.25rem; font-weight: 800; color: var(--primary); }

.commission-preview {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.commission-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--success);
}

.commission-label small {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: #059669;
    opacity: .8;
}

.commission-amount {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--success);
}

/* Downpayment preview */
.downpayment-preview {
    background: var(--info-bg);
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.875rem;
}

.downpayment-preview .dp-label { color: var(--info); font-weight: 600; }
.downpayment-preview .dp-amount { font-size: 1.1rem; font-weight: 700; color: var(--info); }

/* ── Status Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

.status-active  { background: var(--info-bg);    color: var(--info); }
.status-sent    { background: #ede9fe;            color: #7c3aed; }
.status-signed  { background: var(--success-bg); color: var(--success); }
.status-lost    { background: var(--danger-bg);  color: var(--danger); }

/* ── Tables ── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: var(--gray-50);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition);
    cursor: pointer;
}

tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child { border-bottom: none; }

tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    color: var(--gray-700);
}

tbody td.td-bold { font-weight: 600; color: var(--gray-800); }
tbody td.td-money { font-weight: 700; color: var(--gray-800); }
tbody td.td-commission { font-weight: 700; color: var(--success); }

/* ── Filter Tabs ── */
.filter-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.filter-tab:hover { color: var(--primary); }

.filter-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ── Search ── */
.search-wrap {
    position: relative;
    max-width: 320px;
}

.search-wrap input {
    padding-left: 38px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    font-size: 0.9rem;
}

/* ── Alert / Flash Messages ── */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: var(--info-bg);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* ── Deal Detail ── */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.detail-section { margin-bottom: 24px; }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item { }
.info-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-400);
    margin-bottom: 3px;
}
.info-value {
    font-size: 0.9rem;
    color: var(--gray-700);
    font-weight: 500;
}

/* Timeline */
.timeline { list-style: none; }
.timeline li {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.tl-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.tl-dot.done     { background: var(--success-bg); color: var(--success); }
.tl-dot.pending  { background: var(--gray-100);   color: var(--gray-400); }
.tl-dot.current  { background: var(--info-bg);    color: var(--info); }

.tl-content { }
.tl-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
}
.tl-sub {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* Commission box in detail */
.commission-box {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
    border-radius: 12px;
    padding: 20px 24px;
    text-align: center;
    margin-bottom: 16px;
}

.commission-box .cb-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #059669;
    margin-bottom: 8px;
}

.commission-box .cb-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--success);
    line-height: 1;
    margin-bottom: 4px;
}

.commission-box .cb-note {
    font-size: 0.8rem;
    color: #065f46;
    opacity: .8;
}

/* Products table in detail */
.products-table tfoot td {
    padding: 12px 16px;
    font-weight: 700;
    border-top: 2px solid var(--gray-200);
}

/* Review step summary */
.review-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.review-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-500);
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.review-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding: 4px 0;
    color: var(--gray-700);
}

.review-row .rv-label { color: var(--gray-500); }
.review-row .rv-value { font-weight: 600; color: var(--gray-800); }

/* ── Loading ── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

.loading-overlay.show { display: flex; }

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin-bottom: 16px;
}

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

.loading-text {
    font-size: 0.9rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* ── Required subscription amount ── */
.subscription-toggle {
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: default;
    transition: all var(--transition);
    background: #fff;
    margin-bottom: 8px;
}

.subscription-toggle:hover { border-color: var(--accent); }
.subscription-toggle.active {
    border-color: var(--success);
    background: rgba(16,185,129,.04);
}
.subscription-toggle.subscription-required:hover { border-color: var(--success); }

.sub-info { }
.sub-name { font-weight: 600; font-size: 0.9rem; color: var(--gray-800); }
.sub-desc { font-size: 0.8rem; color: var(--gray-500); margin-top: 2px; }

.sub-price {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--success);
    white-space: nowrap;
}

/* ── Checkbox ── */
.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-wrap input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--success);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: .4;
}

.empty-state h3 {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 20px;
}

/* ── Divider ── */
.divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 20px 0;
}

/* ── Misc ── */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mb-32  { margin-bottom: 32px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }

.mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--gray-100);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--gray-600);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    :root { --sidebar-w: 0px; }

    .sidebar {
        transform: translateX(-240px);
        width: 240px;
    }

    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }

    .main-content { margin-left: 0; }

    .mobile-toggle { display: flex; }

    .detail-grid { grid-template-columns: 1fr; }

    .form-row, .form-row-3 { grid-template-columns: 1fr; }

    .kit-options { grid-template-columns: 1fr; }

    .step-connector { width: 40px; }
}

@media (max-width: 600px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    h1 { font-size: 1.5rem; }
    .login-card { padding: 32px 24px; }
}

@media (max-width: 400px) {
    .stat-grid { grid-template-columns: 1fr; }
}

/* ── Print styles ── */
/* ── Super Admin Sidebar ────────────────────────────────────────── */
.sidebar-admin {
    background: linear-gradient(180deg, #0d1117 0%, #161b22 40%, #1a1f2e 100%) !important;
    border-right: 1px solid rgba(251,191,36,.15);
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
}
.sidebar-admin .sidebar-brand {
    border-bottom-color: rgba(251,191,36,.2);
    background: linear-gradient(135deg, rgba(251,191,36,.08), transparent);
}
.sidebar-admin .nav-item {
    color: rgba(255,255,255,.7);
}
.sidebar-admin .nav-item:hover {
    background: rgba(251,191,36,.1);
    color: #fbbf24;
}
.sidebar-admin .nav-item.active {
    background: linear-gradient(90deg, rgba(251,191,36,.18), rgba(251,191,36,.06));
    color: #fbbf24;
    border-left: 3px solid #f59e0b;
}
.sidebar-admin .sidebar-footer {
    border-top-color: rgba(251,191,36,.15);
}
.sidebar-admin .sidebar-footer a {
    color: rgba(255,255,255,.5);
}
.sidebar-admin .sidebar-footer a:hover {
    color: #fbbf24;
}
/* Topbar dorado para admin */
body:has(.sidebar-admin) .topbar {
    border-bottom: 2px solid rgba(245,158,11,.3);
    background: linear-gradient(90deg, #fff 0%, #fffbeb 100%);
}
body:has(.sidebar-admin) .topbar-title {
    background: linear-gradient(135deg, #92400e, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}
/* Cards con acento sutil en admin */
body:has(.sidebar-admin) .card {
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, #f59e0b33, transparent) 1;
}

@media print {
    .sidebar, .topbar, .btn, .breadcrumb-nav, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    body { background: #fff !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd; }
    .commission-box, .commission-preview { background: #f0fff4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a[href]::after { content: none !important; }
}

/* ── Pipeline Steps (dashboard) ─────────────────────────────── */
.pipeline-steps {
    display: flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
}
.pipe-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.65rem;
    line-height: 1.1;
    opacity: 0.3;
    min-width: 44px;
}
.pipe-step.done   { opacity: 0.55; }
.pipe-step.active { opacity: 1; }
.pipe-icon { font-size: 1rem; }
.pipe-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-align: center;
    color: #374151;
    line-height: 1;
}
.pipe-step.done .pipe-label   { color: #6b7280; }
.pipe-step.active .pipe-icon  { filter: drop-shadow(0 0 3px rgba(79,70,229,.5)); }
.pipe-step.active .pipe-label { color: #4f46e5; }
.pipe-step[title="Pagado"].active .pipe-label { color: #16a34a; }
.pipe-step[title="Pagado"].active .pipe-icon  { filter: drop-shadow(0 0 3px rgba(22,163,74,.5)); }
.pipe-connector {
    width: 16px;
    height: 2px;
    background: #e5e7eb;
    flex-shrink: 0;
    margin-bottom: 12px;
}
.pipe-connector.done { background: #a5b4fc; }

/* ── Commission badge ─────────────────────────────────────── */
.commission-badge {
    display: inline-block;
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
td.td-commission { white-space: nowrap; }

/* ── Pipeline current label (below steps) ────────────────── */
.pipe-current-label {
    font-size: 0.58rem;
    color: #6b7280;
    margin-top: 3px;
    text-align: center;
    white-space: nowrap;
}

/* ── Pipeline filter buttons ─────────────────────────────── */
.pipe-filter-group {
    display: flex;
    gap: 4px;
    align-items: center;
}
.pipe-filter-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    color: #64748b;
    font-weight: 600;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.pipe-filter-btn:hover {
    background: #e0e7ff;
    color: #4f46e5;
    border-color: #a5b4fc;
}
.pipe-filter-btn.active {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

/* ── Admin-clickable pipeline steps ─────────────────────────── */
.pipe-step.admin-clickable {
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}
.pipe-step.admin-clickable:hover {
    transform: scale(1.18);
    opacity: 1 !important;
}
.pipe-step.admin-clickable:hover .pipe-icon {
    filter: drop-shadow(0 0 4px rgba(79,70,229,.7));
}
.pipe-step.admin-clickable.pending:hover .pipe-icon {
    filter: drop-shadow(0 0 4px rgba(100,116,139,.5));
}

/* Shared sale pipeline: two fixed payment milestones, any installment count. */
.sale-pipeline {min-width:260px;text-align:left;}
.sale-pipeline-milestones {display:flex;align-items:center;gap:3px;white-space:nowrap;}
.sale-milestone {display:inline-flex;align-items:center;justify-content:center;gap:4px;font-size:.65rem;line-height:1.2;}
.process-milestone {flex-direction:column;color:#64748b;font-size:.57rem;min-width:36px;}
.process-milestone > span:first-child {font-size:1rem;}
.process-milestone.is-pending {opacity:.5;}
.process-milestone.is-active {color:#4338ca;font-weight:700;}
.payment-milestone {padding:5px 6px;border:1px solid #cbd5e1;border-radius:6px;background:#f8fafc;color:#475569;font-weight:600;}
.payment-milestone > span:first-child {font-size:1rem;}
.payment-milestone:not(.is-done) > span:first-child {filter:grayscale(1);opacity:.65;}
.payment-milestone.is-done {border-color:#86efac;background:#f0fdf4;color:#166534;}
.payment-milestone.is-review {border-style:dashed;}
.sale-pipeline-connector {height:2px;width:8px;flex-shrink:0;background:#e2e8f0;}
.sale-pipeline-connector.is-done {background:#a5b4fc;}
.sale-payment-summary {margin-top:7px;color:#475569;font-size:.7rem;line-height:1.6;}
.sale-payment-summary a {text-decoration:underline;text-underline-offset:2px;}
.sale-payment-detail {font-weight:700;}
.sale-payment-next {color:#475569;}
.sale-payment-next.is-overdue {color:#b91c1c;font-weight:700;}
.sale-payment-review {color:#92400e;}
.sale-payment-settled {color:#166534;font-weight:600;}
.sale-payment-checked {color:#64748b;font-size:.6rem;}
.pipe-filter-group {flex-wrap:wrap;}
