/* =============================================================
   Cotizador Pro — app.css
   Fuente: DM Sans | Diseño: Corporativo Limpio
   ============================================================= */
:root {
    --cz-primary:    #1e3a5f;
    --cz-primary-h:  #162d4a;
    --cz-accent:     #3b82f6;
    --cz-accent-l:   #eff6ff;
    --cz-sidebar-w:  248px;
    --cz-topbar-h:   58px;
    --cz-radius:     8px;
    --cz-radius-lg:  12px;
    --cz-shadow:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --cz-shadow-md:  0 4px 16px rgba(0,0,0,.08);
    --cz-bg:         #f1f5f9;
    --cz-surface:    #ffffff;
    --cz-border:     #e2e8f0;
    --cz-text:       #0f172a;
    --cz-text-2:     #64748b;
    --cz-text-3:     #94a3b8;
    --cz-sidebar-bg: #0f172a;
    --cz-sidebar-fg: rgba(255,255,255,.6);
    --cz-sidebar-act:#3b82f6;
}

* { box-sizing: border-box; }
body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--cz-bg);
    color: var(--cz-text);
    margin: 0;
    font-size: .9375rem;
    line-height: 1.6;
}

/* ── Layout ─────────────────────────────────────────────── */
.cz-sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--cz-sidebar-w); height: 100vh;
    background: var(--cz-sidebar-bg);
    display: flex; flex-direction: column;
    z-index: 200; overflow: hidden;
}
.cz-main {
    margin-left: var(--cz-sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
}
.cz-content { flex: 1; padding: 1.5rem 2rem 3rem; }

/* ── Brand ──────────────────────────────────────────────── */
.cz-brand {
    display: flex; align-items: center; gap: .625rem;
    padding: 1.125rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.cz-brand-icon {
    width: 32px; height: 32px; background: var(--cz-accent);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8125rem; color: #fff; letter-spacing: -.5px; flex-shrink: 0;
}
.cz-brand-logo { max-height: 32px; max-width: 120px; object-fit: contain; }
.cz-brand-name { font-weight: 700; font-size: 1rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Nav ────────────────────────────────────────────────── */
.cz-nav { padding: .875rem .75rem; flex: 1; overflow-y: auto; }
.cz-nav-group { margin-bottom: 1.25rem; }
.cz-nav-label {
    font-size: .6875rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .08em; color: rgba(255,255,255,.3);
    padding: 0 .625rem; display: block; margin-bottom: .3rem;
}
.cz-nav-link {
    display: flex; align-items: center; gap: .625rem;
    padding: .5rem .75rem; border-radius: 7px;
    color: var(--cz-sidebar-fg); text-decoration: none;
    font-size: .875rem; font-weight: 500;
    transition: background .14s, color .14s; margin-bottom: 2px;
}
.cz-nav-link i { font-size: 1rem; width: 18px; text-align: center; }
.cz-nav-link:hover  { background: rgba(255,255,255,.07); color: #fff; }
.cz-nav-link.active { background: rgba(59,130,246,.18); color: #fff; }

/* ── Sidebar footer ─────────────────────────────────────── */
.cz-sidebar-footer { padding: .75rem; border-top: 1px solid rgba(255,255,255,.07); }
.cz-user-card {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .625rem; border-radius: 7px;
    background: rgba(255,255,255,.05);
}
.cz-user-info { flex: 1; min-width: 0; }
.cz-user-name  { font-size: .8125rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cz-user-role  { font-size: .6875rem; color: rgba(255,255,255,.4); }
.cz-logout-btn { color: rgba(255,255,255,.3); text-decoration: none; font-size: 1.125rem; transition: color .14s; }
.cz-logout-btn:hover { color: #fff; }

/* ── Topbar ─────────────────────────────────────────────── */
.cz-topbar {
    height: var(--cz-topbar-h); background: var(--cz-surface);
    border-bottom: 1px solid var(--cz-border);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 2rem; position: sticky; top: 0; z-index: 90;
}
.cz-topbar-title  { font-weight: 600; font-size: .9375rem; flex: 1; }
.cz-topbar-right  { display: flex; align-items: center; gap: .75rem; }
.cz-menu-btn { background: none; border: none; font-size: 1.375rem; color: var(--cz-text-2); cursor: pointer; padding: 4px; }
.cz-flash { margin: .75rem 1.5rem 0; }

/* ── Page header ────────────────────────────────────────── */
.cz-page-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem;
}
.cz-page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; margin: 0; }
.cz-page-sub   { color: var(--cz-text-2); font-size: .875rem; margin: 0; }

/* ── Cards ──────────────────────────────────────────────── */
.cz-card {
    background: var(--cz-surface); border: 1px solid var(--cz-border);
    border-radius: var(--cz-radius-lg); overflow: hidden;
    box-shadow: var(--cz-shadow);
}
.cz-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem .875rem; border-bottom: 1px solid var(--cz-border);
}
.cz-card-title  { font-size: .9375rem; font-weight: 600; margin: 0; }
.cz-card-body   { padding: 1.25rem; }
.cz-card-warning { border-color: #fef08a; background: #fefce8; }
.cz-card-warning .cz-card-header { background: #fef9c3; border-color: #fde047; }

/* ── Stat cards ─────────────────────────────────────────── */
.cz-stat-card {
    background: var(--cz-surface); border: 1px solid var(--cz-border);
    border-radius: var(--cz-radius-lg); padding: 1.25rem;
    box-shadow: var(--cz-shadow); display: flex; flex-direction: column; gap: .375rem;
}
.cz-stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 1.125rem;
    margin-bottom: .375rem;
}
.cz-stat-val   { font-size: 1.875rem; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.cz-stat-label { font-size: .8125rem; color: var(--cz-text-2); }

.cz-revenue-card {
    background: var(--cz-surface); border: 1px solid var(--cz-border);
    border-left: 4px solid var(--accent, #10b981);
    border-radius: var(--cz-radius-lg); padding: 1.25rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: var(--cz-shadow);
}
.cz-revenue-label { font-size: .8125rem; color: var(--cz-text-2); margin-bottom: .25rem; }
.cz-revenue-val   { font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; }
.cz-revenue-icon  { font-size: 2rem; color: var(--accent, #10b981); opacity: .25; }

/* ── Tabla ──────────────────────────────────────────────── */
.cz-table { color: var(--cz-text); }
.cz-table thead th {
    font-size: .6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--cz-text-2);
    border-color: var(--cz-border); padding: .75rem 1rem;
    background: #f8fafc; white-space: nowrap;
}
.cz-table tbody td { border-color: var(--cz-border); padding: .875rem 1rem; vertical-align: middle; }
.cz-table tbody tr:hover { background: #f8fafc; }
.cz-tr-hover { cursor: pointer; }

/* ── Formularios ────────────────────────────────────────── */
.cz-input, .cz-select {
    border-color: var(--cz-border) !important;
    border-radius: var(--cz-radius) !important;
    font-size: .875rem;
    transition: border-color .15s, box-shadow .15s;
}
.cz-input:focus {
    border-color: var(--cz-accent) !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,.12) !important;
}
.cz-input-sm { font-size: .8125rem !important; padding: .3rem .6rem !important; }
.cz-label    { font-size: .8125rem; font-weight: 600; color: var(--cz-text-2); margin-bottom: .375rem; }
.input-group-text {
    background: #f8fafc; border-color: var(--cz-border) !important;
    font-size: .875rem; color: var(--cz-text-2);
}

/* ── Botones ────────────────────────────────────────────── */
.cz-btn-primary {
    background: var(--cz-primary) !important;
    color: #fff !important; border: none;
    border-radius: 8px; font-weight: 600; font-size: .875rem;
    transition: background .15s, transform .1s;
}
.cz-btn-primary:hover  { background: var(--cz-primary-h) !important; }
.cz-btn-primary:active { transform: scale(.98); }
.cz-btn-outline {
    background: transparent; border: 1px solid var(--cz-border);
    color: var(--cz-text); border-radius: 8px;
    font-size: .875rem; font-weight: 500; transition: background .15s;
}
.cz-btn-outline:hover { background: var(--cz-bg); }
.cz-btn-outline.active { background: var(--cz-primary); color:#fff; border-color:var(--cz-primary); }
.cz-btn-ghost { background: none; border: none; color: var(--cz-text-2); border-radius: 8px; font-size: .875rem; transition: background .15s; }
.cz-btn-ghost:hover { background: var(--cz-bg); color: var(--cz-text); }
.cz-icon-btn {
    background: none; border: none; width: 30px; height: 30px;
    border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
    color: var(--cz-text-2); cursor: pointer; transition: background .14s; font-size: .9375rem;
}
.cz-icon-btn:hover { background: var(--cz-bg); color: var(--cz-text); }

/* ── Badges ─────────────────────────────────────────────── */
.cz-badge {
    font-size: .6875rem; font-weight: 600;
    padding: 3px 9px; border-radius: 20px; display: inline-block;
    text-transform: capitalize; white-space: nowrap;
}
.cz-badge-sm   { font-size: .625rem; padding: 2px 7px; }
.cz-badge-gray   { background: #f1f5f9; color: #475569; }
.cz-badge-blue   { background: #dbeafe; color: #1d4ed8; }
.cz-badge-indigo { background: #e0e7ff; color: #4338ca; }
.cz-badge-green  { background: #dcfce7; color: #15803d; }
.cz-badge-red    { background: #fee2e2; color: #dc2626; }
.cz-badge-amber  { background: #fef3c7; color: #d97706; }
.cz-badge-dark   { background: #1e293b; color: #94a3b8; }

/* ── Avatares ───────────────────────────────────────────── */
.cz-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--cz-accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.cz-avatar-sm { width: 28px; height: 28px; font-size: .6875rem; }

/* ── Filtros / search ───────────────────────────────────── */
.cz-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.cz-search-wrap { position: relative; flex: 1; min-width: 200px; }
.cz-search-icon  { position: absolute; left: .875rem; top: 50%; transform: translateY(-50%); color: var(--cz-text-2); font-size: .9375rem; }
.cz-search-input { padding-left: 2.5rem !important; }
.cz-select       { width: auto; font-size: .875rem; border-radius: 8px; border: 1px solid var(--cz-border); padding: .4rem .75rem; background: var(--cz-surface); color: var(--cz-text); }

/* ── Autocomplete ───────────────────────────────────────── */
.cz-autocomplete-wrap { position: relative; }
.cz-suggestions {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--cz-surface); border: 1px solid var(--cz-border);
    border-radius: var(--cz-radius); box-shadow: var(--cz-shadow-md);
    z-index: 50; max-height: 260px; overflow-y: auto;
}
.cz-suggest-item {
    padding: .625rem .875rem; cursor: pointer; font-size: .875rem;
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    transition: background .12s; border-bottom: 1px solid var(--cz-border);
}
.cz-suggest-item:last-child { border-bottom: none; }
.cz-suggest-item:hover { background: var(--cz-bg); }

/* ── Items de cotización ────────────────────────────────── */
.cz-items-header {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem 1rem; background: #f8fafc;
    font-size: .6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; color: var(--cz-text-2);
    border-bottom: 1px solid var(--cz-border);
}
.cz-item-row {
    display: flex; align-items: center; gap: .5rem;
    padding: .625rem 1rem; border-bottom: 1px solid var(--cz-border);
}
.cz-item-row:last-child { border-bottom: none; }
.cz-item-col-desc  { flex: 1 1 240px; min-width: 0; }
.cz-item-col-unit  { flex: 0 0 80px; }
.cz-item-col-qty   { flex: 0 0 80px; }
.cz-item-col-price { flex: 0 0 110px; }
.cz-item-col-disc  { flex: 0 0 80px; }
.cz-item-col-tax { display:none }
.cz-item-col-total { flex: 0 0 100px; text-align: right; }
.cz-item-col-del   { flex: 0 0 36px; }
.cz-item-total     { font-size: .875rem; }

/* ── Totales ────────────────────────────────────────────── */
.cz-total-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: .5rem 0; border-bottom: 1px solid var(--cz-border);
    font-size: .9375rem;
}
.cz-total-row:last-child { border-bottom: none; }
.cz-total-final {
    font-size: 1.125rem; font-weight: 700; padding: .75rem .875rem;
    background: var(--cz-primary); color: #fff;
    border-radius: var(--cz-radius); margin-top: .5rem;
}

/* ── Vista cotización ───────────────────────────────────── */
.cz-quote-preview { overflow: hidden; }
.cz-quote-top {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 1.5rem 1.75rem; color: #fff; gap: 1rem;
}
.cz-quote-company-name  { font-size: 1.375rem; font-weight: 700; margin-bottom: .375rem; }
.cz-quote-logo          { max-height: 52px; max-width: 180px; object-fit: contain; margin-bottom: .375rem; }
.cz-quote-company-data  { display: flex; flex-direction: column; gap: 2px; font-size: .8125rem; opacity: .8; }
.cz-quote-folio-box     { background: rgba(255,255,255,.15); padding: .625rem 1rem; border-radius: 8px; text-align: center; }
.cz-quote-folio         { font-size: 1.25rem; font-weight: 700; letter-spacing: .02em; }
.cz-quote-folio-label   { font-size: .6875rem; opacity: .75; letter-spacing: .12em; }
.cz-quote-dates         { display: flex; flex-direction: column; gap: 3px; font-size: .75rem; opacity: .8; margin-top: .5rem; text-align: right; }
.cz-quote-client        { padding: 1rem 1.75rem; background: #f8fafc; border-bottom: 1px solid var(--cz-border); }
.cz-quote-client-label  { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--cz-text-2); margin-bottom: .25rem; }
.cz-quote-client-name   { font-size: 1.0625rem; font-weight: 700; color: var(--cz-text); }
.cz-quote-client-data   { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; margin-top: .25rem; font-size: .8125rem; color: var(--cz-text-2); }
.cz-quote-concept       { padding: .875rem 1.75rem; font-size: .9375rem; border-bottom: 1px solid var(--cz-border); }
.cz-quote-table thead tr { background: var(--cz-primary) !important; color: #fff; }
.cz-quote-table thead th { color: #fff !important; background: transparent !important; border: none; padding: .75rem 1rem; }
.cz-quote-table tbody td { padding: .6875rem 1rem; }
.cz-quote-totals-wrap {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 1.25rem 1.75rem; gap: 1.5rem; border-top: 1px solid var(--cz-border);
}
.cz-quote-notes        { flex: 1; font-size: .875rem; color: var(--cz-text-2); }
.cz-quote-notes-title  { font-weight: 600; color: var(--cz-text); margin-bottom: .375rem; }
.cz-quote-totals-box   { min-width: 260px; }
.cz-quote-total-row    { display: flex; justify-content: space-between; padding: .375rem 0; font-size: .9rem; border-bottom: 1px solid var(--cz-border); }
.cz-quote-total-final  { font-size: 1.0625rem; font-weight: 700; color: #fff; padding: .75rem; border-radius: 6px; }
.cz-quote-footer-text  { padding: 1rem 1.75rem; font-size: .8125rem; color: var(--cz-text-2); border-top: 1px solid var(--cz-border); font-style: italic; }

/* ── Info list ──────────────────────────────────────────── */
.cz-info-list { display: grid; grid-template-columns: auto 1fr; gap: .3rem .875rem; font-size: .875rem; margin: 0; }
.cz-info-list dt { color: var(--cz-text-2); font-weight: normal; white-space: nowrap; }
.cz-info-list dd { margin: 0; color: var(--cz-text); font-weight: 500; }

/* ── Info box ───────────────────────────────────────────── */
.cz-info-box {
    background: var(--cz-accent-l); border: 1px solid #bfdbfe;
    border-radius: 8px; padding: .625rem .875rem;
    font-size: .8125rem; color: #1d4ed8;
}

/* ── Form errors ────────────────────────────────────────── */
.cz-form-errors {
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: 8px; padding: .625rem .875rem;
    font-size: .8125rem; color: #dc2626;
}

/* ── Modal ──────────────────────────────────────────────── */
.cz-modal { border: none; border-radius: 14px; overflow: hidden; box-shadow: var(--cz-shadow-md); }
.cz-modal .modal-header { border-bottom: 1px solid var(--cz-border); background: #f8fafc; }
.cz-modal .modal-footer { border-top: 1px solid var(--cz-border); background: #f8fafc; }
.cz-modal .modal-title  { font-size: .9375rem; font-weight: 700; }

/* ── Auth ───────────────────────────────────────────────── */
.cz-auth-body { background: #0f172a; }
.cz-auth-wrap { display: flex; min-height: 100vh; }
.cz-auth-panel {
    width: 420px; background: var(--cz-primary);
    display: flex; align-items: center;
    padding: 3rem 2.5rem; position: relative; overflow: hidden; flex-shrink: 0;
}
.cz-auth-panel::before {
    content: ''; position: absolute;
    top: -80px; right: -80px;
    width: 360px; height: 360px;
    background: rgba(59,130,246,.15); border-radius: 50%;
}
.cz-auth-panel::after {
    content: ''; position: absolute;
    bottom: -100px; left: -60px;
    width: 280px; height: 280px;
    background: rgba(59,130,246,.08); border-radius: 50%;
}
.cz-auth-panel-inner { position: relative; z-index: 1; }
.cz-auth-logo        { display: flex; align-items: center; gap: .625rem; margin-bottom: 2.5rem; }
.cz-auth-headline    { color: #fff; font-size: 2rem; font-weight: 700; letter-spacing: -.04em; line-height: 1.2; margin-bottom: 1rem; }
.cz-auth-sub         { color: rgba(255,255,255,.55); font-size: .9375rem; line-height: 1.6; margin-bottom: 1.75rem; }
.cz-auth-features    { display: flex; flex-direction: column; gap: .5rem; }
.cz-auth-feat        { color: rgba(255,255,255,.7); font-size: .875rem; font-weight: 500; }
.cz-auth-form-side   { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.cz-auth-form-box    { width: 100%; max-width: 380px; }
.cz-auth-title       { font-size: 1.875rem; font-weight: 700; letter-spacing: -.03em; margin-bottom: .25rem; }
.cz-auth-hint        { color: var(--cz-text-2); margin-bottom: 2rem; }
.cz-pw-toggle        { background: #f8fafc !important; border-left: none !important; cursor: pointer; }
.cz-demo-box {
    font-size: .75rem; color: var(--cz-text-2);
    background: #f8fafc; border: 1px dashed var(--cz-border);
    border-radius: 8px; padding: .625rem .875rem; text-align: center;
}

/* ── Misc ───────────────────────────────────────────────── */
.cz-muted    { color: var(--cz-text-2) !important; }
.cz-mono     { font-family: 'DM Mono', monospace; }
.cz-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cz-folio-link { font-weight: 700; color: var(--cz-primary); text-decoration: none; font-family: 'DM Mono', monospace; font-size: .875rem; }
.cz-folio-link:hover { color: var(--cz-accent); }
.cz-link     { color: var(--cz-accent); text-decoration: none; }
.cz-link:hover { text-decoration: underline; }
.cz-link-sm  { font-size: .8125rem; color: var(--cz-accent); text-decoration: none; }
.cz-action-btn { color: var(--cz-text-2); font-size: 1rem; text-decoration: none; }
.cz-empty    { text-align: center; padding: 3rem 1.5rem; color: var(--cz-text-2); }
.cz-empty i  { font-size: 2.5rem; display: block; margin-bottom: .75rem; opacity: .3; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fs-xs  { font-size: .75rem !important; }
.cz-totals-card .cz-card-body { padding: 1.25rem; }

/* ── Toast ──────────────────────────────────────────────── */
#cz-toast-container {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
    display: flex; flex-direction: column; gap: .5rem; align-items: flex-end;
}
.cz-toast {
    padding: .75rem 1.25rem; border-radius: 10px;
    font-size: .875rem; font-weight: 500; color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    animation: slideIn .2s ease; max-width: 340px;
}
@keyframes slideIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
.cz-toast-success { background: #15803d; }
.cz-toast-danger  { background: #dc2626; }
.cz-toast-info    { background: #1d4ed8; }

/* ── Mobile ─────────────────────────────────────────────── */
.cz-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:150; }
.cz-overlay.open { display:block; }

@media (max-width: 991.98px) {
    .cz-main    { margin-left: 0; }
    .cz-content { padding: 1rem; }
    .cz-topbar  { padding: 0 1rem; }
    .cz-sidebar { transform: translateX(-100%); transition: transform .25s; }
    .cz-sidebar.open { transform: translateX(0); }
    .cz-auth-panel { display: none; }
    .cz-item-row { flex-wrap: wrap; }
    .cz-items-header { display: none; }
    .cz-quote-totals-wrap { flex-direction: column; }
}
@media (max-width: 575.98px) {
    .cz-page-title { font-size: 1.25rem; }
    .cz-stat-val   { font-size: 1.5rem; }
    .cz-quote-top  { flex-direction: column; }
}
