/* =====================================================================
   VentaExpress – Sistema de diseño
   ===================================================================== */
:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;
    --border: #e3e8ef;
    --border-strong: #cfd7e3;
    --text: #0f172a;
    --text-2: #475569;
    --muted: #8391a7;

    --primary: #2563eb;
    --primary-600: #1d4ed8;
    --primary-soft: #e8efff;
    --primary-text: #1e40af;

    --success: #16a34a;  --success-soft: #e7f7ec;
    --warning: #d97706;  --warning-soft: #fff4e0;
    --danger:  #dc2626;  --danger-soft:  #fdecec;
    --info:    #0284c7;  --info-soft:    #e3f3fc;
    --violet:  #7c3aed;  --violet-soft:  #f0eafd;

    --sidebar: #0b1220;
    --sidebar-2: #131c2e;
    --sidebar-text: #94a3b8;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0b1120;
    --surface: #111a2b;
    --surface-2: #0f1727;
    --surface-3: #1a2539;
    --border: #22304a;
    --border-strong: #2f3f5e;
    --text: #e6ecf5;
    --text-2: #a9b6ca;
    --muted: #71819b;
    --primary: #3b82f6;
    --primary-600: #2563eb;
    --primary-soft: #172a4d;
    --primary-text: #93b8ff;
    --success-soft: #0f2e1d;
    --warning-soft: #33240b;
    --danger-soft: #3a1416;
    --info-soft: #0c2a3d;
    --violet-soft: #251a43;
    --sidebar: #070c17;
    --sidebar-2: #111a2b;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
    color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.hidden { display: none !important; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------------
   LOGIN
   --------------------------------------------------------------------- */
.login-wrapper {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}
.login-brand {
    background: radial-gradient(circle at 20% 20%, #3b82f6 0%, transparent 45%),
                radial-gradient(circle at 80% 80%, #06b6d4 0%, transparent 40%),
                linear-gradient(135deg, #0b1220 0%, #12305f 100%);
    color: #fff;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.login-brand h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.03em; margin: 24px 0 12px; max-width: 440px; }
.login-brand p { color: #c7d6f2; max-width: 420px; font-size: 15px; }
.login-brand .brand-row { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; }
.brand-logo {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    background: #2563eb;
    color: #fff; box-shadow: 0 6px 20px rgba(37, 99, 235, .45);
}
.brand-logo svg { width: 26px; height: 26px; }
.login-features { display: grid; gap: 14px; margin-top: 32px; }
.login-features div { display: flex; gap: 12px; align-items: center; color: #dbe6fb; }
.login-features svg { color: #67e8f9; }
.login-panel { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; letter-spacing: -.02em; }
.login-card .sub { color: var(--muted); margin: 6px 0 28px; }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------------------------------------------------------------------
   LAYOUT
   --------------------------------------------------------------------- */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 252px;
    flex-shrink: 0;
    background: var(--sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width .2s ease, transform .25s ease;
    z-index: 60;
}
.logo-area { display: flex; align-items: center; gap: 10px; padding: 4px 6px 22px; }
.logo-text h2 { font-size: 17px; letter-spacing: -.01em; }
.logo-text small { color: #67e8f9; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.menu { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.menu-label { font-size: 10.5px; color: #4f5d75; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; padding: 14px 12px 6px; }
.menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.menu a:hover { background: var(--sidebar-2); color: #e2e8f0; }
.menu a.active { background: linear-gradient(90deg, #2563eb, #3b82f6); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .35); }
.menu a .count {
    margin-left: auto; background: #f59e0b; color: #1f1300;
    font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px;
}
.sidebar-footer { border-top: 1px solid #1c2638; padding-top: 14px; margin-top: 10px; }
.btn-collapse {
    width: 100%; display: flex; align-items: center; gap: 12px;
    background: none; border: 0; color: var(--sidebar-text); cursor: pointer;
    padding: 10px 12px; border-radius: 10px;
}
.btn-collapse:hover { background: var(--sidebar-2); color: #fff; }

.sidebar.cerrada { width: 76px; }
.sidebar.cerrada .logo-text, .sidebar.cerrada .menu a span, .sidebar.cerrada .menu-label,
.sidebar.cerrada .btn-collapse span, .sidebar.cerrada .menu a .count { display: none; }
.sidebar.cerrada .menu a, .sidebar.cerrada .btn-collapse { justify-content: center; }
.sidebar.cerrada .logo-area { justify-content: center; }
.sidebar.cerrada .btn-collapse svg { transform: rotate(180deg); }

.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 14px;
    padding: 14px 28px;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; letter-spacing: -.02em; }
.topbar .fecha { color: var(--muted); font-size: 12.5px; }
.topbar-title { flex: 1; min-width: 0; }
.topbar .btn-menu-mobile { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 4px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary-text);
    font-weight: 700; font-size: 13px;
}
.user-chip .info { line-height: 1.2; }
.user-chip .info strong { display: block; font-size: 13px; }
.user-chip .info small { color: var(--muted); font-size: 11.5px; text-transform: capitalize; }

.page { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head p { color: var(--muted); }

/* ---------------------------------------------------------------------
   COMPONENTES
   --------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.card-head h3 svg { color: var(--muted); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 16px 20px 0; }

.grid { display: grid; gap: 20px; }
.grid-dash { grid-template-columns: 2fr 1fr; }
.grid-2 { grid-template-columns: 1fr 1fr; }

/* Métricas */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.metric { display: flex; gap: 14px; align-items: flex-start; }
.metric .icon {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
    background: var(--primary-soft); color: var(--primary);
}
.metric .icon.green { background: var(--success-soft); color: var(--success); }
.metric .icon.amber { background: var(--warning-soft); color: var(--warning); }
.metric .icon.violet { background: var(--violet-soft); color: var(--violet); }
.metric .icon.red { background: var(--danger-soft); color: var(--danger); }
.metric h4 { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.metric > div:last-child { min-width: 0; }
.metric .number { font-size: clamp(19px, 1.9vw, 24px); font-weight: 700; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; }
.metric .delta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }

/* Formularios */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.input, .form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
textarea { resize: vertical; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.input-icon .input { padding-left: 34px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.help { font-size: 12px; color: var(--muted); }

/* Botones */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 600; font-size: 13.5px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .05s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-600); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.95); }
.btn-success { background: var(--success); color: #fff; }
.btn-lg { padding: 13px 18px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon {
    width: 34px; height: 34px; padding: 0;
    display: inline-grid; place-items: center;
    border-radius: 9px; border: 1px solid transparent;
    background: transparent; color: var(--text-2); cursor: pointer;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-icon svg { width: 17px; height: 17px; }
.actions { display: inline-flex; gap: 2px; justify-content: flex-end; }

/* Segmentado (método de pago) */
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.segmented button {
    padding: 9px 6px; border-radius: 10px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border-strong);
    font-weight: 600; font-size: 12.5px; color: var(--text-2);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.segmented button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }

/* Chips de filtro */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    padding: 6px 12px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border-strong); background: var(--surface);
    font-weight: 600; font-size: 12.5px; color: var(--text-2);
}
.chip[data-cat] { text-transform: capitalize; }
.chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 600;
    padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td .sub { display: block; font-size: 12px; color: var(--muted); }
td.num, td .badge, td .estado-select { white-space: nowrap; }
tfoot td { font-weight: 700; background: var(--surface-2); }
.empty { text-align: center; color: var(--muted); padding: 36px 16px !important; }
.empty svg { width: 32px; height: 32px; display: block; margin: 0 auto 8px; opacity: .6; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
    background: var(--surface-3); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.no-dot::before { display: none; }
.badge.pendiente, .badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.en_ruta, .badge.info { background: var(--info-soft); color: var(--info); }
.badge.entregado, .badge.success { background: var(--success-soft); color: var(--success); }
.badge.cancelado, .badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.primary { background: var(--primary-soft); color: var(--primary-text); }

select.estado-select {
    border: 0; border-radius: 999px; padding: 5px 26px 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 9px center;
}
select.estado-select.pendiente { background-color: var(--warning-soft); color: var(--warning); }
select.estado-select.en_ruta { background-color: var(--info-soft); color: var(--info); }
select.estado-select.entregado { background-color: var(--success-soft); color: var(--success); }
select.estado-select.cancelado { background-color: var(--danger-soft); color: var(--danger); }

/* Barra de stock */
.stock-bar { width: 90px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 5px; }
.stock-bar span { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.stock-bar span.low { background: var(--warning); }
.stock-bar span.out { background: var(--danger); }

/* Categoría (punto de color) */
.cat { display: inline-flex; align-items: center; gap: 6px; text-transform: capitalize; font-weight: 500; }
.cat i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.cat-agua i { background: #3b82f6; }
.cat-gas i { background: #f97316; }
.cat-hielo i { background: #06b6d4; }

/* Lista de alertas / top */
.list { list-style: none; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow strong { display: block; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .grow small { color: var(--muted); font-size: 12px; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); font-weight: 700; font-size: 12px; color: var(--text-2); }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }

/* ---------------------------------------------------------------------
   PUNTO DE VENTA
   --------------------------------------------------------------------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.pos-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.pos-toolbar .input-icon { flex: 1; min-width: 200px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.product-card {
    text-align: left; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: 14px; display: flex; flex-direction: column; gap: 10px;
    transition: border-color .15s, box-shadow .15s, transform .1s;
    position: relative;
}
.product-card:hover:not(:disabled) { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.product-card:disabled { opacity: .5; cursor: not-allowed; }
.product-card .p-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.product-card.cat-agua .p-icon { background: #e0edff; color: #2563eb; }
.product-card.cat-gas .p-icon { background: #ffeddc; color: #ea580c; }
.product-card.cat-hielo .p-icon { background: #dcf6fb; color: #0891b2; }
:root[data-theme="dark"] .product-card.cat-agua .p-icon { background: #172a4d; }
:root[data-theme="dark"] .product-card.cat-gas .p-icon { background: #3a2210; }
:root[data-theme="dark"] .product-card.cat-hielo .p-icon { background: #0d2f38; }
.product-card .p-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.product-card .p-foot { display: flex; justify-content: space-between; align-items: end; margin-top: auto; }
.product-card .p-price { font-weight: 700; font-size: 16px; }
.product-card .p-stock { font-size: 11.5px; color: var(--muted); }
.product-card .in-cart {
    position: absolute; top: 10px; right: 10px;
    background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
    min-width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px;
}

.order-panel { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 0; padding: 0; }
.order-panel .block { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.order-panel .block:last-child { border-bottom: 0; }
.order-panel h3 { font-size: 15px; }
.block-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; display: flex; justify-content: space-between; }
.cart-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.cart-item { display: flex; align-items: center; gap: 10px; }
.cart-item .grow { flex: 1; min-width: 0; }
.cart-item .grow strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item .grow small { color: var(--muted); font-size: 12px; }
.qty { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.qty button { width: 28px; height: 28px; border: 0; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; }
.qty button:hover { background: var(--surface-3); }
.qty button svg { width: 14px; height: 14px; }
.qty input { width: 38px; text-align: center; border: 0; background: transparent; outline: none; font-weight: 600; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.cart-item .line-total { font-weight: 700; min-width: 70px; text-align: right; }
.cart-empty { text-align: center; color: var(--muted); padding: 18px 0; }
.cart-empty svg { width: 30px; height: 30px; opacity: .5; display: block; margin: 0 auto 6px; }
.order-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.order-total span { color: var(--muted); font-weight: 600; }
.order-total strong { font-size: 28px; letter-spacing: -.02em; }
.client-found { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 8px 10px; border-radius: 9px; background: var(--success-soft); color: var(--success); margin-bottom: 12px; }
.client-found.nuevo { background: var(--info-soft); color: var(--info); }

/* ---------------------------------------------------------------------
   MIS ENTREGAS (repartidor)
   --------------------------------------------------------------------- */
.entregas-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.entregas-resumen .card { padding: 12px 14px; }
.entregas-resumen small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.entregas-resumen strong { font-size: 20px; }
.entregas-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.entrega { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-left: 4px solid var(--warning); }
.entrega.en_ruta { border-left-color: var(--info); box-shadow: 0 0 0 1px var(--info-soft), var(--shadow); }
.entrega.entregado { border-left-color: var(--success); opacity: .75; }
.entrega-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.entrega-top strong { font-size: 15px; }
.entrega h3 { font-size: 17px; letter-spacing: -.01em; }
.entrega .dir { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-weight: 500; }
.entrega .dir svg { color: var(--danger); margin-top: 2px; }
.entrega .ref { color: var(--muted); font-size: 12.5px; margin: 2px 0 0 26px; }
.entrega .items { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; display: grid; gap: 3px; }
.entrega .cobro { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.entrega .cobro .monto { font-size: 20px; font-weight: 700; }
.entrega .contacto { display: flex; gap: 8px; }
.entrega .contacto .btn { flex: 1; }
.entrega .acciones { display: flex; gap: 8px; }
.entrega .acciones .btn { flex: 1; }
.check-linea { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.check-linea input { width: 17px; height: 17px; flex-shrink: 0; }
.opciones-cobro { display: grid; gap: 8px; margin-bottom: 14px; }
.opciones-cobro label {
    display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; cursor: pointer;
    border: 1px solid var(--border-strong); border-radius: 10px; font-weight: 500;
}
.opciones-cobro label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.opciones-cobro small { display: block; color: var(--muted); font-weight: 400; }
.fila-cierre { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.fila-cierre.total { border-top: 1px solid var(--border-strong); margin-top: 4px; padding-top: 8px; font-size: 15px; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { filter: brightness(.95); }

/* ---------------------------------------------------------------------
   NOTIFICACIONES
   --------------------------------------------------------------------- */
.notif-wrap { position: relative; }
.notif-count {
    position: absolute; top: 2px; right: 2px;
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
    background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
    display: grid; place-items: center; pointer-events: none;
}
.notif-wrap.sonando .btn-icon svg { animation: campana .6s ease 2; color: var(--warning); }
@keyframes campana { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(18deg); } 75% { transform: rotate(-18deg); } }
.notif-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 80;
    width: 360px; max-width: calc(100vw - 24px);
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
    overflow: hidden; animation: pop .15s ease;
}
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-head strong { font-size: 14px; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.nueva { background: var(--primary-soft); }
.notif-item .n-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--text-2); }
.notif-item .n-icon.en_ruta { background: var(--info-soft); color: var(--info); }
.notif-item .n-icon.entregado { background: var(--success-soft); color: var(--success); }
.notif-item .n-icon.asignado, .notif-item .n-icon.pago_verificar { background: var(--warning-soft); color: var(--warning); }
.notif-item .n-icon.pago_pendiente { background: var(--danger-soft); color: var(--danger); }
.notif-item strong { display: block; font-size: 13px; font-weight: 600; }
.notif-item small { display: block; color: var(--muted); font-size: 12px; }
.notif-foot { padding: 10px 14px; text-align: center; }
.toast.info svg { color: #60a5fa; }

/* ---------------------------------------------------------------------
   MODAL / TOAST
   --------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(8, 13, 25, .55);
    backdrop-filter: blur(3px);
    display: grid; place-items: center; padding: 20px;
    animation: fade .15s ease;
}
.modal {
    background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 520px; max-height: calc(100vh - 40px);
    display: flex; flex-direction: column;
    animation: pop .18s ease;
}
.modal.lg { max-width: 720px; }
.modal.sm { max-width: 420px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 17px; letter-spacing: -.01em; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.confirm-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); margin-bottom: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 20px; margin-bottom: 16px; }
.detail-grid div small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.detail-grid div span { font-weight: 500; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 10px;
    min-width: 260px; max-width: 380px;
    padding: 12px 14px; border-radius: 12px;
    background: var(--text); color: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: pop .2s ease;
    font-weight: 500;
}
.toast.success svg { color: #4ade80; }
.toast.error svg { color: #f87171; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.warning { background: var(--warning-soft); color: var(--warning); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert span { color: var(--text); }

/* Contraseñas */
.pw-meter { margin: -6px 0 10px; }
.pw-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-bottom: 4px; }
.pw-bar span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .2s, background .2s; }
.pw-reqs { list-style: none; display: grid; gap: 4px; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.pw-reqs li { display: flex; align-items: center; gap: 6px; }
.pw-reqs li svg { width: 14px; height: 14px; }
.pw-reqs li.ok { color: var(--success); }
.pw-ver { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
/* Acceso bloqueado y aviso de suscripción */
.bloqueo { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.bloqueo-card { width: 100%; max-width: 440px; text-align: center; padding: 32px 24px; }
.bloqueo-card h2 { font-size: 22px; letter-spacing: -.02em; margin-bottom: 8px; }
.bloqueo-card p { color: var(--text-2); }
.bloqueo-soporte { margin-top: 12px; font-weight: 600; }
.bloqueo-acciones { display: grid; gap: 8px; margin-top: 22px; }
.aviso-suscripcion { margin: 16px 24px 0; }

/* Panel del dueño */
.panel-app { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; }
.panel-top { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.panel-top h1 { font-size: 20px; letter-spacing: -.02em; flex: 1; min-width: 0; }
.panel-login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.panel-estado { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.panel-datos small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.panel-datos strong { font-size: 15px; overflow-wrap: anywhere; }
.panel-acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-app .card { margin-bottom: 20px; }

.temporal {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 20px; font-weight: 700; letter-spacing: .08em;
    padding: 14px 16px; border-radius: 12px; background: var(--surface-3); border: 1px dashed var(--border-strong); margin: 12px 0;
}

/* ---------------------------------------------------------------------
   TICKET / COMPROBANTE
   --------------------------------------------------------------------- */
/* El ticket se dibuja e imprime en su propio documento (ver js/modules/ticket.js);
   aquí solo se presenta la vista previa como un trozo de papel. */
.ticket-preview {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    background: var(--surface-3); border-radius: 12px; padding: 18px 12px;
}
.ticket-preview iframe {
    display: block; border: 0; background: #fff; min-height: 200px; max-width: 100%;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .15);
}
.ticket-preview small { color: var(--muted); font-size: 11.5px; }

/* ---------------------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .pos { grid-template-columns: minmax(0, 1fr) 360px; }
    .hide-md { display: none; }
}
@media (max-width: 1024px) {
    .grid-dash, .grid-2, .pos { grid-template-columns: 1fr; }
    .order-panel { position: static; }
}
@media (max-width: 860px) {
    .login-wrapper { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); width: 260px !important; }
    .sidebar.abierta { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar.cerrada .logo-text, .sidebar.cerrada .menu a span, .sidebar.cerrada .menu-label { display: revert; }
    .sidebar-overlay { position: fixed; inset: 0; background: rgba(8, 13, 25, .5); z-index: 55; }
    .btn-collapse { display: none; }
    .topbar .btn-menu-mobile { display: inline-grid; }
    .topbar { padding: 12px 16px; gap: 6px; }
    .topbar h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .product-card { padding: 12px; }
    .page { padding: 16px 16px 32px; }
    .user-chip .info, .topbar .fecha { display: none; }
    .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .segmented { grid-template-columns: repeat(2, 1fr); }
    .entregas-resumen { grid-template-columns: repeat(2, 1fr); }
    .entregas-lista { grid-template-columns: 1fr; }
    .notif-panel { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; }
    .hide-sm { display: none; }
    .toasts { left: 16px; right: 16px; }
    .toast { min-width: 0; max-width: none; }
}
