:root {
    --ink:      #1C1C1C;
    --ink-mid:  #4A4A4A;
    --ink-faint:#8A8A8A;
    --rule:     #E2E2DF;
    --surface:  #F7F6F3;
    --page:     #FAFAF8;
    --white:    #FFFFFF;
    --accent:   #1B4FBF;
    --accent-lt:#EBF1FF;
    --accent-md:#5C87E8;
    --amber:    #D97B10;
    --amber-lt: #FEF3E2;
    --red:      #C0392B;
    --green:    #1E7A52;
    --green-lt: #E6F4EE;
    --mont: 'Montserrat', sans-serif;
    --mono: 'DM Mono', monospace;
}

/********* BODY */
body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background-color: #ecf0f1;
    display: flex;
    flex-wrap: wrap;
    overflow-x: hidden;
    font-family: var(--mont);
}

::-webkit-scrollbar {
    display: none;
}

body::-webkit-scrollbar:vertical {
    display: block;
    width: 8px;
}

body::-webkit-scrollbar-track:vertical {
    background: #929292;
}

body::-webkit-scrollbar-thumb:vertical {
    background: #474747;
}

.shell { 
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/**** SIDEBAR */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--ink);
    display: flex;
    flex-direction: column;
    padding: 0;
    border-right: 1px solid #2A2A2A;
    position: relative;
}

.sidebar-power {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 17px;
    color: #fff;
    cursor: pointer;
}

.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid #2A2A2A;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 30px; height: 30px;
    background: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon svg { 
    width: 16px; height: 16px; 
}

.brand-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .02em;
}

.brand-version {
    font-size: 12px;
    color: #666;
    margin-top: 1px;
    font-family: var(--mono);
}

.sidebar-ops {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.sidebar-section {
    padding: 16px 12px 8px;
}

.sidebar-label {
    font-size: 11px;
    font-family: var(--mono);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #555;
    padding: 0 8px;
    margin-bottom: 6px;
}

.sidebar-op {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 15px;
    color: #999;
    cursor: pointer;
    transition: all .15s;
    margin-bottom: 1px;
    -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    -ms-border-radius: 6px;
    -o-border-radius: 6px;
}

.sidebar-op i { 
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: .7;
}

.sidebar-op:hover { 
    background: #242424; color: #ddd; 
}

.sidebar-op.active { 
    background: #232B3E; 
    color: var(--accent-md); 
}

.sidebar-op.active i { 
    opacity: 1; 
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 12px;
    border-top: 1px solid #2A2A2A;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    -ms-border-radius: 6px;
    -o-border-radius: 6px;
}
.user-chip:hover {
    background: #222;
}

.avatar {
    width: 32px;
    height: 32px; 
    border-radius: 50%;
    background: #2B3A5C;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-md);
}
.user-info .name { 
    font-size: 14px; 
    color: #ccc; 
    font-weight: 500; 
}

/**** MATERIAL GENERAL */
.main { 
    flex: 1; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* TOPBAR */
.topbar {
    height: 52px;
    background: var(--white);
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    flex-direction: column;
}

.topbar-title {
    font-size: 16px; 
    font-weight: 600;
    color: var(--ink);
}

.topbar-sub {
    font-size: 13px;
    font-family: var(--mono);
    color: var(--ink-faint);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 6px;
    font-family: var(--mont);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--rule);
    background: var(--white);
    color: var(--ink-mid);
    transition: all .15s;
}

.btn svg {
    width: 13px;
    height: 13px;
}

.btn:hover {
    background: var(--surface);
    border-color: #D0D0CC;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: #163FA0;
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
}

.btn-ghost:hover {
    background: var(--surface);
    border-color: var(--rule);
}

/* BODY */
  .body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* STAT CARDS */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 16px 18px;
}

.stat-label {
    font-size: 12px;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--ink-faint);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--ink);
    font-family: var(--mono);
}

.stat-sub {
    font-size: 13px;
    color: var(--ink-faint);
    margin-top: 4px;
}

.stat-up {
    color: var(--green);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.stat-down {
    color: var(--red);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* FILTERS BAR */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 10px 14px;
}

.search-wrap {
    flex: 1;
    position: relative;
    max-width: 280px;
}

.search-wrap svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 13px;
    height: 13px;
    color: var(--ink-faint);
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 7px 10px 7px 30px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    font-family: var(--mont);
    font-size: 14px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-md);
    background: var(--white);
}

/* .divider-v {
    width: 1px;
    height: 20px;
    background: var(--rule);
} */

.pill-group {
    display:
    flex; gap: 5px;
}

.pill {
    padding: 5px 12px;
    border: 1px solid var(--rule);
    border-radius: 20px;
    font-size: 12px;
    font-family: var(--mono);
    color: var(--ink-faint);
    background: var(--white);
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}

.pill.active {
    background: var(--ink);
    color: #fff; 
    border-color: var(--ink);
}

.pill:hover:not(.active) {
    border-color: #C0C0BC;
    color: var(--ink-mid);
}

.filter-select {
    padding: 6px 10px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-mid);
    background: var(--white);
    outline: none;
    cursor: pointer;
}

.results-count {
    font-size: 12px;
    font-family: var(--mono);
    color: var(--ink-faint);
    white-space: nowrap;
}

/* ── FORM SECTION ── */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title {
    font-size: 11px;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--ink-faint);
}

.card {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: 10px;
    overflow: hidden;
}
.card-body {
    padding: 18px 20px;
}

/* CLIENT FORM */
.form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 14px;
}

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

.form-group label {
    font-size: 13px;
    color: var(--ink-faint);
    letter-spacing: .02em;
}

.form-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 8px 11px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    font-family: var(--mont);
    font-size: 15px;
    color: var(--ink);
    background: var(--white);
    outline: none;
    transition: border .15s;
}

.form-input:focus {
    border-color: var(--accent-md);
    box-shadow: 0 0 0 3px #EBF1FF;
}

.form-input.filled {
    border-color: #D0D0CC;
    color: var(--ink);
}

.form-input::placeholder {
    color: #C8C8C4;
}

/* PRODUCT SEARCH */
.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--rule);
    background: var(--surface);
}

.search-input-wrap {
    flex: 1;
    position: relative;
}

.search-input-wrap svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--ink-faint);
}

.search-input {
    width: 100%; padding: 8px 11px 8px 32px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    font-family: var(--mont);
    font-size: 13px;
    background: var(--white);
    color: var(--ink);
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-md);
}

.filter-pills {
    display: flex;
    gap: 6px;
}

.pill {
    padding: 5px 12px;
    border: 1px solid var(--rule);
    border-radius: 20px;
    font-size: 11px; font-family: var(--mono);
    color: var(--ink-faint);
    background: var(--white);
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.pill.active {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.pill:hover:not(.active) {
    border-color: #C0C0BC;
    color: var(--ink-mid);
}

/* PRODUCT GRID */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

.product-tile {
    padding: 14px 16px;
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
    transition: background .12s;
    position: relative;
}

.product-tile:nth-child(4n) {
    border-right: none;
}

.product-tile:hover {
    background: var(--surface);
}

.product-tile:hover .tile-add {
    opacity: 1;
}

.tile-cat {
    font-size: 9px;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--ink-faint);
    margin-bottom: 5px;
}

.tile-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.3;
}

.tile-sku {
    font-size: 10px;
    font-family: var(--mono);
    color: var(--ink-faint);
    margin-top: 3px;
}

.tile-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-top: 10px;
    font-family: var(--mono);
}

.tile-add {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s;
}
.tile-add svg {
    width: 11px;
    height: 11px;
    color: #fff;
}

/**** LOADING OVERLAY */

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--magenta);
    border-right-color: var(--azul-neon);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.loader-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--blanco);
    letter-spacing: 1px;
}

/* --- Alertas de Notificación --- */
.alert-box {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    display: none; /* Oculto por defecto */
    text-align: left;
}

.alert-error {
    background-color: rgba(229, 0, 127, 0.1);
    border: 1px solid rgba(229, 0, 127, 0.3);
    color: #ff4d94;
}

.alert-success {
    background-color: rgba(0, 200, 83, 0.1);
    border: 1px solid rgba(0, 200, 83, 0.3);
    color: #00c853;
}