:root {
    --sidebar-w: 260px;
    --bg: #f0f3f7;
    --sidebar: #1a2332;
    --sidebar-hover: #243044;
    --accent: #0d9488;
    --accent-dark: #0f766e;
    --text: #1e293b;
    --muted: #64748b;
    --card: #ffffff;
    --border: #e2e8f0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand i {
    font-size: 1.75rem;
    color: var(--accent);
}

.sidebar-brand strong {
    display: block;
    color: #fff;
    font-size: .95rem;
    line-height: 1.2;
}

.sidebar-brand small {
    color: #94a3b8;
    font-size: .75rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: .75rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem 1.1rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: .9rem;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.sidebar-nav a.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--accent);
}

.sidebar-nav a i { font-size: 1.05rem; width: 1.25rem; text-align: center; }

.nav-section {
    padding: 1rem 1.1rem .35rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .75rem;
    font-size: .85rem;
    color: #e2e8f0;
}

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
}

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: .85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
}

.topbar-meta {
    color: var(--muted);
    font-size: .85rem;
}

.content-body {
    padding: 1.5rem;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: .75rem;
    padding: 1.15rem 1.25rem;
    height: 100%;
}

.stat-card .stat-label {
    color: var(--muted);
    font-size: .8rem;
    margin-bottom: .25rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-icon.teal { background: #ccfbf1; color: #0f766e; }
.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.amber { background: #fef3c7; color: #b45309; }
.stat-icon.rose { background: #ffe4e6; color: #be123c; }
.stat-icon.green { background: #dcfce7; color: #15803d; }

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: .75rem;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.placa {
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: .05em;
    background: #fef9c3;
    border: 2px solid #eab308;
    padding: .15rem .5rem;
    border-radius: .35rem;
    display: inline-block;
}

.table-sm td, .table-sm th { vertical-align: middle; }

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-accent:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 20% 20%, #ccfbf1 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, #dbeafe 0%, transparent 50%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(15, 23, 42, .08);
}

.login-card h1 {
    font-size: 1.4rem;
    margin-bottom: .25rem;
}

.login-card .subtitle {
    color: var(--muted);
    margin-bottom: 1.5rem;
    font-size: .9rem;
}

.quick-actions .btn {
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}

.quick-actions .btn i { font-size: 1.5rem; }

.ticket {
    background: #fff;
    border: 1px dashed #94a3b8;
    border-radius: .5rem;
    padding: 1.25rem;
    max-width: 320px;
    margin: 0 auto;
    font-family: 'Consolas', monospace;
    font-size: .9rem;
}

.ticket h3 {
    text-align: center;
    font-size: 1rem;
    margin-bottom: .75rem;
}

.ticket .row-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: .35rem;
}

.ticket .total {
    border-top: 1px dashed #94a3b8;
    margin-top: .75rem;
    padding-top: .75rem;
    font-weight: 700;
    font-size: 1.1rem;
}

/* —— Punto de venta —— */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1rem;
    align-items: start;
}

.pos-toolbar { margin-bottom: 1rem; }

.pos-cats {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .65rem;
}

.pos-cat {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 999px;
    padding: .25rem .75rem;
    font-size: .8rem;
    color: var(--muted);
    cursor: pointer;
}

.pos-cat.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pos-cat-title {
    color: var(--muted);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: .75rem 0 .5rem;
}

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .65rem;
}

.pos-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .75rem;
    padding: .65rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    min-height: 160px;
    transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.pos-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(13, 148, 136, .12);
}

.pos-card.pulse { transform: scale(.96); }

.pos-card-img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: .5rem;
    overflow: hidden;
    background: #f1f5f9;
}

.pos-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pos-card-name {
    font-weight: 600;
    font-size: .88rem;
    line-height: 1.25;
    color: var(--text);
}

.pos-card-price {
    margin-top: auto;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.prod-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: .4rem;
    background: #f1f5f9;
}

.prod-thumb-lg {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: .5rem;
    background: #f1f5f9;
    border: 1px solid var(--border);
}

/* Plan resumen (selector limpio) */
.plan-summary {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    color: #fff;
    border-radius: .85rem;
    padding: 1.1rem 1.25rem;
    text-align: center;
}

.plan-summary-label {
    font-size: .8rem;
    opacity: .9;
    margin-bottom: .15rem;
}

.plan-summary-price {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.02em;
}

.plan-summary-meta {
    font-size: .85rem;
    opacity: .95;
    margin-top: .35rem;
}

.alerta-icon {
    font-size: 1.75rem;
    line-height: 1;
    flex-shrink: 0;
}

/* Modales propios (sin confirm/alert del navegador) */
.app-modal .modal-content {
    border: none;
    border-radius: 1.1rem;
    padding: 1.75rem 1.5rem 1.5rem;
    text-align: center;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
    position: relative;
}

.app-modal-close {
    position: absolute;
    top: .85rem;
    right: .85rem;
}

.app-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto .85rem;
    border-radius: 50%;
    background: #f0fdfa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    color: #0d9488;
}

.app-modal-icon.text-warning {
    background: #fffbeb;
    color: #d97706;
}

.app-modal-icon.text-danger {
    background: #fff1f2;
    color: #e11d48;
}

.app-modal-icon.text-success {
    background: #ecfdf5;
    color: #059669;
}

.app-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: .4rem;
    color: #0f172a;
}

.app-modal-text {
    color: #64748b;
    font-size: .95rem;
    margin: 0 auto 1.25rem;
    max-width: 340px;
    line-height: 1.45;
}

.app-modal-actions {
    display: flex;
    gap: .65rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Planes de tiempo legacy (por si quedan en alguna vista) */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .6rem;
}

.pos-cart {
    position: sticky;
    top: 80px;
    margin-bottom: 0;
}

.pos-cart-lines {
    max-height: 38vh;
    overflow-y: auto;
    margin-bottom: .75rem;
}

.pos-line {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: .4rem;
    align-items: center;
    padding: .55rem 0;
    border-bottom: 1px solid var(--border);
}

.pos-line-info { min-width: 0; }
.pos-line-info strong {
    display: block;
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pos-line-info small { color: var(--muted); font-size: .7rem; }

.pos-line-qty {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.pos-line-qty button {
    width: 26px;
    height: 26px;
    border-radius: .35rem;
    border: 1px solid var(--border);
    background: #f8fafc;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.pos-line-qty span {
    min-width: 1.25rem;
    text-align: center;
    font-weight: 600;
    font-size: .9rem;
}

.pos-line-sub {
    font-weight: 600;
    font-size: .85rem;
    min-width: 4rem;
    text-align: right;
}

.pos-line-del {
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .2rem;
}

.pos-line-del:hover { color: #be123c; }

.pos-total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f766e;
    color: #fff;
    border-radius: .6rem;
    padding: .85rem 1rem;
    margin-bottom: .75rem;
}

.pos-total-box strong {
    font-size: 1.5rem;
}

.pos-checkout #btnCobrar:disabled {
    opacity: .55;
}

.badge-rol {
    font-size: .65rem;
    font-weight: 600;
    padding: .15rem .4rem;
    border-radius: .25rem;
    background: rgba(13,148,136,.2);
    color: #5eead4;
}

/* Autocomplete de placas */
.placa-autocomplete {
    position: relative;
}

.placa-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
    z-index: 1050;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    max-height: 260px;
    overflow-y: auto;
}

.placa-sug-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .1rem;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: .65rem .85rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

.placa-sug-item:last-child { border-bottom: none; }

.placa-sug-item:hover,
.placa-sug-item:focus {
    background: #f0fdfa;
    outline: none;
}

.placa-sug-placa {
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--text);
}

.placa-sug-meta {
    font-size: .75rem;
    color: var(--muted);
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .pos-layout { grid-template-columns: 1fr; }
    .pos-cart { position: static; }
}

.caja-resultado {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    padding: 1rem;
}
.caja-monto {
    font-size: 1.35rem;
    font-weight: 700;
}
@media (max-width: 767.98px) {
    .caja-resultado { grid-template-columns: 1fr; }
}

@media print {
    .sidebar, .topbar, .no-print, .pos-layout { display: none !important; }
    .main-content { margin-left: 0; }
    .content-body { padding: 0; }
    .ticket.d-none { display: block !important; }
}
