:root{
    --primary:#0b3a78;
    --secondary:#1fbf6b;
    --accent:#f59e0b;
    --bg:#f5f7fb;
    --card:#ffffff;
    --text:#142033;
    --muted:#6b7280;
    --border:#dbe3ef;
    --danger:#c62828;
    --shadow:0 18px 45px rgba(11,58,120,.12);
    --radius:22px;
    --radius-sm:14px;
}

*{
    box-sizing:border-box;
}

html, body{
    margin:0;
    padding:0;
    min-height:100%;
    font-family:Arial, Helvetica, sans-serif;
    color:var(--text);
    background:linear-gradient(135deg, #eef4ff 0%, #f8fbff 50%, #eefbf4 100%);
}

body{
    min-height:100vh;
}

a{
    color:var(--primary);
    text-decoration:none;
}

/* =========================
   LOGIN
========================= */

.login-shell{
    min-height:100vh;
    display:grid;
    grid-template-columns:1.1fr .9fr;
}

.login-brand{
    background:
        radial-gradient(circle at top left, rgba(31,191,107,.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(11,58,120,.22), transparent 35%),
        linear-gradient(135deg, #0b3a78 0%, #0d4a95 60%, #1661b8 100%);
    color:#fff;
    padding:48px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
}

.brand-top{
    max-width:520px;
}

.brand-badge{
    display:inline-flex;
    align-items:center;
    gap:8px;
    background:rgba(255,255,255,.12);
    border:1px solid rgba(255,255,255,.18);
    color:#fff;
    padding:10px 14px;
    border-radius:999px;
    font-size:13px;
    font-weight:700;
}

.brand-title{
    margin:22px 0 14px;
    font-size:48px;
    line-height:1.02;
    font-weight:800;
}

.brand-text{
    margin:0;
    font-size:18px;
    line-height:1.6;
    color:rgba(255,255,255,.88);
}

.brand-footer{
    display:grid;
    grid-template-columns:repeat(3, minmax(0,1fr));
    gap:14px;
    margin-top:32px;
}

.brand-metric{
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.12);
    border-radius:18px;
    padding:18px;
}

.brand-metric strong{
    display:block;
    font-size:24px;
    margin-bottom:6px;
}

.brand-metric span{
    font-size:13px;
    color:rgba(255,255,255,.82);
}

.login-panel{
    display:flex;
    align-items:center;
    justify-content:center;
    padding:32px;
}

.login-card{
    width:100%;
    max-width:460px;
    background:var(--card);
    border:1px solid rgba(11,58,120,.08);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    padding:34px;
}

.login-logo{
    width:70px;
    height:70px;
    border-radius:18px;
    background:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    margin-bottom:18px;
    border:1px solid rgba(11,58,120,.12);
}

.login-logo img{
    max-width:48px;
    height:auto;
}

.login-card h1{
    margin:0 0 8px;
    font-size:30px;
    line-height:1.1;
}

.login-subtitle{
    margin:0 0 26px;
    color:var(--muted);
    line-height:1.5;
}

.form-group{
    margin-bottom:16px;
}

.form-label{
    display:block;
    margin-bottom:8px;
    font-size:14px;
    font-weight:700;
    color:var(--text);
}

.form-control{
    width:100%;
    height:50px;
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    padding:0 14px;
    font-size:15px;
    outline:none;
    transition:.2s ease;
    background:#fff;
    color:var(--text);
}

.form-control:focus{
    border-color:rgba(11,58,120,.45);
    box-shadow:0 0 0 4px rgba(11,58,120,.10);
}

.form-error{
    background:#fff4f4;
    border:1px solid #f0c9c9;
    color:var(--danger);
    padding:14px 16px;
    border-radius:14px;
    margin-bottom:18px;
    font-size:14px;
}

.btn{
    border:none;
    border-radius:16px;
    padding:14px 18px;
    font-size:15px;
    font-weight:700;
    cursor:pointer;
    transition:.2s ease;
}

.btn-primary{
    width:100%;
    background:linear-gradient(135deg, var(--primary), #145db3);
    color:#fff;
    box-shadow:0 10px 24px rgba(11,58,120,.20);
}

.btn-primary:hover{
    transform:translateY(-1px);
}

.login-help{
    margin-top:18px;
    text-align:center;
    color:var(--muted);
    font-size:13px;
}

/* =========================
   APP LAYOUT
========================= */

.app-shell{
    min-height:100vh;
    display:flex;
    background:var(--bg);
}

.app-sidebar{
    width:280px;
    min-width:280px;
    background:linear-gradient(180deg, #0b3a78 0%, #0c3266 100%);
    color:#fff;
    padding:22px 18px;
    display:flex;
    flex-direction:column;
    gap:24px;
    box-shadow:8px 0 30px rgba(11,58,120,.08);
    position:relative;
    z-index:20;
}

.sidebar-brand{
    display:flex;
    align-items:center;
    gap:14px;
    padding:8px 8px 18px;
    border-bottom:1px solid rgba(255,255,255,.10);
}

.sidebar-brand-logo{
    width:48px;
    height:48px;
    border-radius:12px;
    background:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
}

.sidebar-brand-logo img{
    max-width:32px;
    height:auto;
}

.sidebar-brand-title{
    font-size:18px;
    font-weight:800;
    line-height:1.1;
}

.sidebar-brand-subtitle{
    font-size:12px;
    color:rgba(255,255,255,.75);
    margin-top:4px;
}

.sidebar-nav{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.sidebar-link{
    display:flex;
    align-items:center;
    gap:12px;
    padding:13px 14px;
    border-radius:14px;
    color:#fff;
    text-decoration:none;
    transition:.2s ease;
    font-weight:600;
}

.sidebar-link:hover{
    background:rgba(255,255,255,.10);
    transform:translateX(2px);
}

.app-main{
    flex:1;
    display:flex;
    flex-direction:column;
    min-width:0;
}

.app-topbar{
    height:78px;
    background:#fff;
    border-bottom:1px solid rgba(11,58,120,.08);
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 24px;
    gap:16px;
}

.topbar-left{
    display:flex;
    align-items:center;
    gap:14px;
    min-width:0;
}

.sidebar-toggle{
    width:42px;
    height:42px;
    border-radius:12px;
    border:1px solid var(--border);
    background:#fff;
    cursor:pointer;
    font-size:18px;
    display:none;
}

.topbar-title{
    font-size:18px;
    font-weight:800;
    color:var(--text);
}

.topbar-subtitle{
    font-size:13px;
    color:var(--muted);
    margin-top:2px;
}

.topbar-right{
    display:flex;
    align-items:center;
    gap:14px;
}

.topbar-user{
    display:flex;
    align-items:center;
    gap:10px;
}

.topbar-user-avatar{
    width:42px;
    height:42px;
    border-radius:50%;
    background:linear-gradient(135deg, var(--primary), #145db3);
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:800;
}

.topbar-user-meta{
    display:flex;
    flex-direction:column;
    line-height:1.15;
}

.topbar-user-meta strong{
    font-size:14px;
    color:var(--text);
}

.topbar-user-meta span{
    font-size:12px;
    color:var(--muted);
}

.topbar-logout{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:11px 14px;
    border-radius:12px;
    background:#f4f7fb;
    color:var(--text);
    font-weight:700;
    border:1px solid var(--border);
}

.app-content{
    padding:28px;
}

.page-header{
    margin-bottom:22px;
}

.page-title{
    margin:0 0 6px;
    font-size:30px;
    line-height:1.1;
}

.page-subtitle{
    margin:0;
    color:var(--muted);
}

.stats-grid{
    display:grid;
    grid-template-columns:repeat(4, minmax(0,1fr));
    gap:18px;
    margin-bottom:24px;
}

.stat-card{
    background:#fff;
    border:1px solid rgba(11,58,120,.08);
    border-radius:20px;
    padding:22px;
    box-shadow:0 10px 28px rgba(11,58,120,.06);
}

.stat-label{
    font-size:13px;
    color:var(--muted);
    margin-bottom:8px;
    font-weight:700;
}

.stat-value{
    font-size:34px;
    font-weight:800;
    color:var(--primary);
    line-height:1;
    margin-bottom:10px;
}

.stat-foot{
    font-size:13px;
    color:var(--muted);
}

.content-grid{
    display:grid;
    grid-template-columns:1.3fr .9fr;
    gap:18px;
}

.panel-card{
    background:#fff;
    border:1px solid rgba(11,58,120,.08);
    border-radius:20px;
    overflow:hidden;
    box-shadow:0 10px 28px rgba(11,58,120,.06);
}

.panel-card-header{
    padding:18px 22px;
    border-bottom:1px solid rgba(11,58,120,.08);
}

.panel-card-header h2{
    margin:0;
    font-size:18px;
}

.panel-card-body{
    padding:22px;
}

.info-box{
    margin-top:16px;
    padding:18px 20px;
    border-radius:14px;
    background:#f4f8ff;
    border:1px solid #d9e6ff;
    color:var(--text);
}

.clean-list{
    margin:0;
    padding-left:18px;
}

.clean-list li{
    margin-bottom:10px;
    color:var(--text);
}

.detail-grid{
    display:grid;
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:18px;
}

.transition-grid{
    display:flex;
    flex-wrap:wrap;
    gap:12px;
}

.transition-btn{
    min-width:180px;
}

.table-wrap{
    width:100%;
    overflow-x:auto;
    border:1px solid rgba(11,58,120,.08);
    border-radius:18px;
    background:#fff;
}

.table-ui{
    width:100%;
    min-width:1100px;
    border-collapse:separate;
    border-spacing:0;
    table-layout:auto;
}

.table-ui thead th{
    position:sticky;
    top:0;
    background:#f7faff;
    color:#4b5b70;
    font-size:13px;
    font-weight:800;
    text-align:left;
    padding:16px 18px;
    border-bottom:1px solid rgba(11,58,120,.10);
    white-space:nowrap;
}

.table-ui tbody td{
    padding:18px;
    border-bottom:1px solid rgba(11,58,120,.08);
    font-size:14px;
    color:var(--text);
    vertical-align:middle;
    white-space:nowrap;
}

.table-ui tbody tr:last-child td{
    border-bottom:none;
}

.table-ui tbody tr:hover{
    background:#f9fbff;
}

.table-empty{
    text-align:center;
    color:var(--muted);
    padding:28px !important;
    font-weight:600;
}

.table-link{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:72px;
    padding:8px 12px;
    border-radius:10px;
    background:#eef4ff;
    color:var(--primary);
    font-weight:700;
    border:1px solid #d8e5ff;
}

.table-link:hover{
    background:#e6f0ff;
}

.badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:7px 11px;
    border-radius:999px;
    font-size:12px;
    font-weight:800;
    line-height:1;
}

.badge-success{
    background:#e9f8ef;
    color:#1a6f40;
}

.badge-muted{
    background:#eef2f7;
    color:#5f6c7b;
}

.col-id{ min-width:70px; }
.col-titulo{ min-width:240px; }
.col-cliente{ min-width:220px; }
.col-estado{ min-width:160px; }
.col-responsable{ min-width:180px; }
.col-probabilidad{ min-width:140px; }
.col-monto{ min-width:150px; }
.col-fecha{ min-width:180px; }
.col-acciones{ min-width:120px; }

.cell-title{
    font-weight:700;
    color:#10243f;
}

.cell-muted{
    color:var(--muted);
}

.opportunity-form-shell{
    display:flex;
    flex-direction:column;
    gap:18px;
}

.form-section-card{
    background:#fff;
    border:1px solid rgba(11,58,120,.08);
    border-radius:22px;
    box-shadow:0 10px 28px rgba(11,58,120,.06);
    overflow:hidden;
}

.form-section-header{
    padding:18px 22px;
    border-bottom:1px solid rgba(11,58,120,.08);
    background:linear-gradient(180deg, #fbfdff 0%, #f7faff 100%);
}

.form-section-header h2{
    margin:0 0 6px;
    font-size:18px;
    color:var(--text);
}

.form-section-header p{
    margin:0;
    color:var(--muted);
    font-size:13px;
    line-height:1.5;
}

.form-section-card .form-grid{
    padding:22px;
}

.form-grid-2{
    grid-template-columns:repeat(2, minmax(0,1fr));
}

.form-textarea-lg{
    min-height:150px;
}

.form-control::placeholder{
    color:#9aa6b2;
}

.form-actions-sticky{
    position:sticky;
    bottom:0;
    background:rgba(245,247,251,.92);
    backdrop-filter:blur(8px);
    padding:14px 0 2px;
    z-index:10;
}

textarea.form-control{
    height:auto;
    min-height:120px;
    padding:14px;
    line-height:1.5;
}

.detail-item{
    background:#fbfdff;
    border:1px solid rgba(11,58,120,.08);
    border-radius:16px;
    padding:16px;
    display:flex;
    flex-direction:column;
    gap:6px;
}

.detail-label{
    font-size:12px;
    font-weight:800;
    color:var(--muted);
    text-transform:uppercase;
    letter-spacing:.3px;
}

.detail-item strong{
    font-size:15px;
    color:var(--text);
    line-height:1.4;
}

.detail-item small{
    font-size:12px;
    color:var(--muted);
}

.state-current-wrap{
    margin-top:4px;
}

.state-current-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:10px 14px;
    border-radius:999px;
    background:linear-gradient(135deg, #e7f0ff, #f3f8ff);
    color:var(--primary);
    font-size:13px;
    font-weight:800;
    border:1px solid #d7e4ff;
}

.transition-intro{
    margin-bottom:16px;
    color:var(--muted);
    font-size:14px;
    line-height:1.5;
}

.transition-grid{
    display:grid;
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:14px;
}

.transition-action-btn{
    text-align:left;
    border:1px solid rgba(11,58,120,.10);
    background:linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
    border-radius:18px;
    padding:18px;
    cursor:pointer;
    transition:.2s ease;
    box-shadow:0 8px 22px rgba(11,58,120,.05);
    display:flex;
    flex-direction:column;
    gap:8px;
}

.transition-action-btn:hover{
    transform:translateY(-1px);
    border-color:rgba(11,58,120,.22);
    box-shadow:0 12px 28px rgba(11,58,120,.10);
}

.transition-action-title{
    font-size:15px;
    font-weight:800;
    color:var(--text);
}

.transition-action-subtitle{
    font-size:13px;
    color:var(--muted);
}

.transition-action-note{
    display:inline-flex;
    align-self:flex-start;
    padding:6px 10px;
    border-radius:999px;
    background:#fff3e6;
    color:#a15a00;
    font-size:12px;
    font-weight:800;
    border:1px solid #ffd8ad;
}

.form-textarea-md{
    min-height:110px;
}

.empty-state-box{
    padding:16px 18px;
    border-radius:16px;
    background:#f7f9fc;
    border:1px solid rgba(11,58,120,.08);
    color:var(--muted);
    font-weight:600;
}

.timeline-list{
    display:flex;
    flex-direction:column;
    gap:16px;
}

.timeline-item{
    display:flex;
    align-items:flex-start;
    gap:14px;
}

.timeline-dot{
    width:14px;
    height:14px;
    border-radius:50%;
    background:var(--primary);
    margin-top:18px;
    flex:0 0 auto;
    box-shadow:0 0 0 5px rgba(11,58,120,.10);
}

.timeline-card{
    flex:1;
    background:#fbfdff;
    border:1px solid rgba(11,58,120,.08);
    border-radius:18px;
    padding:16px;
}

.timeline-top{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    margin-bottom:10px;
}

.timeline-title{
    display:block;
    font-size:15px;
    color:var(--text);
    margin-bottom:4px;
}

.timeline-meta{
    font-size:12px;
    color:var(--muted);
}

.timeline-body{
    font-size:14px;
    color:var(--text);
    line-height:1.6;
}

.timeline-next{
    margin-top:12px;
    padding-top:12px;
    border-top:1px dashed rgba(11,58,120,.12);
    font-size:13px;
    color:var(--muted);
}

.panel-card-header-flex{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:16px;
}

.panel-card-subtitle{
    margin:6px 0 0;
    color:var(--muted);
    font-size:13px;
    line-height:1.5;
}

.collapsible-box{
    margin-bottom:20px;
    padding:18px;
    border:1px solid rgba(11,58,120,.08);
    border-radius:18px;
    background:linear-gradient(180deg, #fbfdff 0%, #f8fbff 100%);
}

.pedido-table .form-control{
    min-width:90px;
}

.pedido-money{
    font-weight:700;
    color:var(--text);
    white-space:nowrap;
}

.pedido-money-strong{
    color:var(--primary);
}

.pedido-summary{
    display:flex;
    justify-content:flex-end;
    margin-top:20px;
}

.pedido-summary-card{
    width:100%;
    max-width:360px;
    background:linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
    border:1px solid rgba(11,58,120,.10);
    border-radius:18px;
    padding:18px;
    box-shadow:0 8px 22px rgba(11,58,120,.05);
}

.pedido-summary-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    padding:8px 0;
    color:var(--text);
}

.pedido-summary-row span{
    color:var(--muted);
    font-weight:700;
}

.pedido-summary-row strong{
    font-size:15px;
}

.pedido-summary-total{
    margin-top:6px;
    padding-top:14px;
    border-top:1px solid rgba(11,58,120,.10);
}

.pedido-summary-total span{
    color:var(--text);
}

.pedido-summary-total strong{
    font-size:22px;
    color:var(--primary);
}

.timeline-actions{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}

.timeline-delete-form{
    margin:0;
}

.btn-danger-soft{
    background:#fff4f4;
    color:#b42318;
    border:1px solid #f1c7c7;
}

.btn-danger-soft:hover{
    background:#ffecec;
}

.btn-xs{
    min-width:auto;
    padding:8px 10px;
    font-size:12px;
    font-weight:800;
    border-radius:10px;
}

.timeline-title-wrap{
    margin-bottom:4px;
}

.badge-activity{
    font-size:12px;
    font-weight:800;
    padding:6px 10px;
    border-radius:999px;
}

/* Colores por tipo */

.badge-activity-call{
    background:#e8f0ff;
    color:#1d4ed8;
}

.badge-activity-visit{
    background:#e6fffa;
    color:#0f766e;
}

.badge-activity-email{
    background:#f3e8ff;
    color:#7c3aed;
}

.badge-activity-chat{
    background:#e0f2fe;
    color:#0369a1;
}

.badge-activity-meeting{
    background:#fff7ed;
    color:#c2410c;
}

.badge-activity-task{
    background:#fef9c3;
    color:#a16207;
}

.badge-activity-note{
    background:#f1f5f9;
    color:#475569;
}

.badge-activity-default{
    background:#eef2f7;
    color:#5f6c7b;
}

/* Próxima acción destacada */

.timeline-next-highlight{
    margin-top:12px;
    padding:12px;
    border-radius:12px;
    background:#f5f9ff;
    border:1px solid rgba(11,58,120,.08);
}

.next-action-box{
    display:flex;
    flex-direction:column;
    gap:4px;
    padding:10px 12px;
    border-radius:12px;
    min-width:140px;
    border:1px solid transparent;
}

.next-action-status{
    font-size:12px;
    font-weight:800;
    line-height:1;
}

.next-action-date{
    font-size:12px;
    color:var(--text);
    line-height:1.4;
}

.alert-date-overdue{
    background:#fff1f1;
    border-color:#f3c2c2;
}

.alert-date-overdue .next-action-status{
    color:#b42318;
}

.alert-date-today{
    background:#fff7ed;
    border-color:#ffd6a8;
}

.alert-date-today .next-action-status{
    color:#c2410c;
}

.alert-date-future{
    background:#eefbf3;
    border-color:#ccefd9;
}

.alert-date-future .next-action-status{
    color:#166534;
}

.alert-date-neutral{
    background:#f5f7fa;
    border-color:#dde3ea;
}

.alert-date-neutral .next-action-status{
    color:#667085;
}

.form-grid-4{
    grid-template-columns:repeat(4, minmax(0,1fr));
}

/* ===== FILTROS COMPACTOS ===== */

.form-group-compact{
    display:flex;
    flex-direction:column;
    gap:4px;
}

.form-label-compact{
    font-size:11px;
    font-weight:700;
    color:var(--muted);
    line-height:1;
}

.form-control-compact{
    height:34px;
    padding:6px 10px;
    font-size:13px;
    border-radius:10px;
}

/* Botones en línea */
.form-actions-inline{
    display:flex;
    justify-content:flex-end;
    gap:10px;
    align-items:center;
    margin-top:6px;
}

/* Compactar panel de filtros */
.panel-card-body .form-grid{
    gap:10px;
}

/* Reduce padding del panel SOLO en filtros */
.panel-card-body{
    padding:16px;
}

.filters-bar{
    display:grid;
    grid-template-columns: 1.2fr 1.2fr 1fr 1fr auto;
    gap:12px;
    align-items:end;
}

.filter-item{
    display:flex;
    flex-direction:column;
    gap:5px;
    min-width:0;
}

.filter-label{
    font-size:11px;
    font-weight:700;
    color:var(--muted);
    line-height:1;
    margin:0;
}

.filter-control{
    height:38px;
    padding:8px 10px;
    font-size:13px;
    border-radius:10px;
}

.filters-actions{
    display:flex;
    gap:8px;
    align-items:end;
    justify-content:flex-end;
    height:100%;
}

.btn-filter{
    height:38px;
    padding:0 14px;
    min-width:auto;
    white-space:nowrap;
}

.product-picker{
    position:relative;
}

.product-search-bar{
    display:flex;
    gap:12px;
    align-items:end;
}

.product-search-input-wrap{
    flex:1;
    margin-bottom:0;
}

.product-search-results{
    position:absolute;
    top:100%;
    left:0;
    right:0;
    z-index:30;
    background:#fff;
    border:1px solid rgba(11,58,120,.10);
    border-radius:16px;
    box-shadow:0 16px 40px rgba(11,58,120,.12);
    margin-top:8px;
    max-height:360px;
    overflow:auto;
    padding:8px;
}

.product-result-item{
    width:100%;
    border:none;
    background:#fff;
    text-align:left;
    padding:12px 14px;
    border-radius:12px;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
}

.product-result-item:hover{
    background:#f7fbff;
}

.product-result-main{
    display:flex;
    flex-direction:column;
    gap:4px;
}

.product-result-main strong{
    font-size:14px;
    color:var(--text);
}

.product-result-main span{
    font-size:12px;
    color:var(--muted);
}

.product-result-meta{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    align-items:center;
    justify-content:flex-end;
    font-size:12px;
    color:var(--muted);
}

.product-result-meta strong{
    color:var(--primary);
    font-size:13px;
}

.product-search-empty{
    padding:14px;
    color:var(--muted);
    font-weight:600;
}
/* ===== TABLA PEDIDO COMPACTA ===== */

.pedido-table{
    font-size:12px;
}

.pedido-table th,
.pedido-table td{
    padding:6px 8px;
    vertical-align:middle;
    white-space:nowrap;
}

/* Columnas más compactas */
.pedido-table .col-id{
    width:70px;
}

.pedido-table .col-monto{
    width:90px;
}

.pedido-table .col-acciones{
    width:70px;
}

/* Texto largo se corta */
.pedido-table .cell-title{
    max-width:180px;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* Inputs compactos */
.pedido-table .form-control{
    height:30px;
    padding:4px 6px;
    font-size:12px;
    min-width:60px;
    border-radius:8px;
}

/* Cantidad más pequeña */
.pedido-table .js-cantidad{
    max-width:60px;
}

/* Precio */
.pedido-table .js-precio{
    max-width:80px;
}

/* Descuento e impuesto */
.pedido-table .js-descuento,
.pedido-table .js-impuesto{
    max-width:60px;
}

/* Totales más compactos */
.pedido-money{
    font-size:12px;
}

.pedido-money-strong{
    font-size:13px;
}

/* Botón quitar más pequeño */
.btn-xs{
    padding:4px 6px;
    font-size:11px;
}

.table-wrap{
    overflow-x:auto;
}

/* Columna remove fija y ultra compacta */
.pedido-table{
    table-layout: fixed;
}

.pedido-table .col-remove{
    width:28px;
    min-width:28px;
    max-width:28px;
    padding:0;
}

.pedido-table th:first-child,
.pedido-table td:first-child{
    width:28px;
    min-width:28px;
    max-width:28px;
    padding:2px;
    text-align:center;
    overflow:hidden;
}

.btn-icon-remove{
    width:18px;
    height:18px;
    min-width:18px;
    max-width:18px;
    border-radius:50%;
    border:none;
    background:#fff1f1;
    color:#b42318;
    font-weight:900;
    font-size:13px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    transition:all .15s ease;
    padding:0;
    line-height:1;
    margin:0 auto;
}

.btn-icon-remove:hover{
    background:#ffdede;
    transform:scale(1.05);
}

/* ===== CONTROL DE ANCHOS EN PEDIDO ===== */

/* SKU fijo */
.pedido-table .col-id{
    width:80px;
    max-width:80px;
}

/* Producto domina */
.pedido-table .col-titulo{
    width:220px;
    max-width:220px;
}

/* Marca y categoría comprimidas */
.pedido-table .col-estado{
    width:110px;
    max-width:110px;
}

/* Truncar texto largo */
.pedido-table td:nth-child(4),
.pedido-table td:nth-child(5){
    overflow:hidden;
    text-overflow:ellipsis;
}

/* Producto también truncado */
.pedido-table .cell-title{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* ===== LISTADO PEDIDOS COMPACTO ===== */

.pedidos-table{
    table-layout:fixed;
    width:100%;
}

.pedidos-table th,
.pedidos-table td{
    padding:8px 10px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    vertical-align:middle;
    font-size:13px;
}

.pedidos-table .col-id{
    width:70px;
    max-width:70px;
}

.pedidos-table .col-cliente{
    width:200px;
    max-width:200px;
}

.pedidos-table .col-titulo{
    width:200px;
    max-width:200px;
}

.pedidos-table .col-responsable{
    width:150px;
    max-width:150px;
}

.pedidos-table .col-fecha{
    width:130px;
    max-width:130px;
}

.pedidos-table .col-monto{
    width:120px;
    max-width:120px;
}

.pedidos-table .col-estado{
    width:110px;
    max-width:110px;
}

.cell-code{
    font-weight:700;
    color:var(--primary);
}

.cell-truncate{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.cell-money{
    font-weight:700;
    color:var(--text);
}

.filters-bar-pedidos{
    grid-template-columns: 1fr 1.3fr 1fr auto;
}

.pedidos-table .cell-code{
    font-weight:800;
    color:var(--primary);
}

/* ===== MOBILE SIDEBAR ===== */

.menu-toggle{
    display:none;
    background:none;
    border:none;
    font-size:22px;
    cursor:pointer;
}

/* overlay oscuro */
.sidebar-overlay{
    position:fixed;
    top:0;
    left:0;
    right:0;
    bottom:0;
    background:rgba(0,0,0,0.4);
    z-index:40;
    display:none;
}

/* botón cerrar */
.menu-close{
    display:none;
    position:absolute;
    top:10px;
    right:10px;
    background:none;
    border:none;
    font-size:22px;
    cursor:pointer;
}
.sidebar-close{
    display:none;
}

.sidebar-overlay{
    display:none;
}

.table-actions-inline{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}
/* ===== LISTADO PRODUCTOS: priorizar SKU ===== */

.col-sku{
    width:120px !important;
    max-width:120px !important;
}

.col-product-name{
    width:220px !important;
    max-width:220px !important;
}

.col-small-col{
    width:90px !important;
    max-width:90px !important;
}

.cell-sku{
    white-space:nowrap;
    overflow:visible;
    text-overflow:clip;
    font-weight:800;
    color:var(--primary);
}

.cell-product-name{
    max-width:220px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.cell-small{
    max-width:90px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

@media (max-width: 860px){
    .sidebar-close{
        position:absolute;
        top:12px;
        right:12px;
        width:34px;
        height:34px;
        border:none;
        border-radius:10px;
        background:rgba(255,255,255,.12);
        color:#fff;
        font-size:22px;
        line-height:1;
        cursor:pointer;
        display:flex;
        align-items:center;
        justify-content:center;
        z-index:25;
    }

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

    .sidebar-overlay.is-active{
        display:block;
    }

    .app-sidebar{
        z-index:20;
    }
}

/* ===== MOBILE ===== */

@media (max-width: 900px){

    .menu-toggle{
        display:block;
    }

    .sidebar{
        position:fixed;
        top:0;
        left:-260px;
        width:260px;
        height:100%;
        z-index:50;
        transition:left .3s ease;
    }

    .sidebar.active{
        left:0;
    }

    .sidebar-overlay.active{
        display:block;
    }

    .menu-close{
        display:block;
    }
}

@media (max-width: 1200px){
    .filters-bar-pedidos{
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px){
    .product-result-item{
        flex-direction:column;
        align-items:flex-start;
    }

    .product-result-meta{
        justify-content:flex-start;
    }
}

@media (max-width: 1200px){
    .filters-bar{
        grid-template-columns: 1fr 1fr;
    }

    .filters-actions{
        grid-column: 1 / -1;
        justify-content:flex-end;
    }
}

@media (max-width: 768px){
    .filters-bar{
        grid-template-columns: 1fr;
    }

    .filters-actions{
        grid-column:auto;
        justify-content:stretch;
        flex-direction:column;
    }

    .btn-filter{
        width:100%;
    }
}

@media (max-width: 1100px){
    .form-grid-4{
        grid-template-columns:repeat(2, minmax(0,1fr));
    }
}

@media (max-width: 768px){
    .form-grid-4{
        grid-template-columns:1fr;
    }
}

@media (max-width: 768px){
    .panel-card-header-flex{
        flex-direction:column;
        align-items:flex-start;
    }
}

@media (max-width: 768px){
    .timeline-top{
        flex-direction:column;
        align-items:flex-start;
    }
    
    .transition-grid{
        grid-template-columns:1fr;
    }
    
    .form-grid-2{
        grid-template-columns:1fr;
    }

    .form-section-header{
        padding:16px 18px;
    }

    .form-section-card .form-grid{
        padding:18px;
    }

    .form-actions-sticky{
        padding-top:10px;
    }

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

    .transition-grid{
        flex-direction:column;
    }
}

@media (max-width: 1100px){
    .stats-grid{
        grid-template-columns:repeat(2, minmax(0,1fr));
    }

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

@media (max-width: 980px){
    .login-shell{
        grid-template-columns:1fr;
    }

    .login-brand{
        display:none;
    }

    .login-panel{
        padding:20px;
    }

    .login-card{
        max-width:100%;
        padding:26px;
    }
}

@media (max-width: 860px){
    .sidebar-toggle{
        display:inline-flex;
        align-items:center;
        justify-content:center;
    }

    .app-sidebar{
        position:fixed;
        top:0;
        left:-290px;
        height:100vh;
        transition:.25s ease;
    }

    .app-sidebar.is-open{
        left:0;
    }

    .app-content{
        padding:20px;
    }

    .topbar-user-meta{
        display:none;
    }
}

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

    .app-topbar{
        padding:0 14px;
    }

    .app-content{
        padding:16px;
    }

    .page-title{
        font-size:25px;
    }
}