:root {
    --bg-main: #f4f6fb;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-soft: #16213a;
    --primary: #1e40af;
    --primary-soft: #dbeafe;
    --accent: #0f766e;
    --text-main: #111827;
    --text-muted: #64748b;
    --border: #d8e0ec;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg-main);
    color: var(--text-main);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.btn,
.card,
.form-control,
.form-select,
.modal-content,
.dropdown-menu,
.alert,
.table,
.input-group-text,
.badge {
    border-radius: 0 !important;
}

.btn {
    font-weight: 700;
    min-height: 38px;
    border-width: 1px;
}

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

.btn-primary:hover {
    background: #172554;
    border-color: #172554;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.form-control,
.form-select {
    border: 1px solid var(--border);
    min-height: 40px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}

.auth-body {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 64, 175, 0.9)),
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.25), transparent 28%);
}

.auth-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: var(--shadow);
    padding: 28px;
}

.auth-card.compact {
    text-align: center;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-box h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
}

.brand-box p {
    margin: 2px 0 0;
    color: var(--text-muted);
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #ffffff;
    font-weight: 900;
    letter-spacing: -0.05em;
    border: 1px solid rgba(255,255,255,0.3);
}

.demo-access {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 258px;
    min-height: 100vh;
    background: var(--bg-sidebar);
    color: #ffffff;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    border-right: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    height: 70px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand strong {
    display: block;
    line-height: 1.1;
}

.sidebar-brand small {
    display: block;
    color: #94a3b8;
    margin-top: 3px;
}

.sidebar-menu {
    padding: 14px 10px;
}

.menu-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-left: 3px solid transparent;
    font-weight: 650;
}

.menu-link:hover,
.menu-link.active {
    color: #ffffff;
    background: var(--bg-sidebar-soft);
    border-left-color: #60a5fa;
}

.app-main {
    flex: 1;
    margin-left: 258px;
    min-width: 0;
}

.topbar {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.btn-menu {
    display: none;
}

.topbar-search {
    flex: 1;
    max-width: 520px;
}

.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-weight: 650;
}

.content-area {
    padding: 22px;
}

.page-head {
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.compact-head h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 850;
}

.compact-head p {
    margin: 4px 0 0;
    color: var(--text-muted);
}

.head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

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

.stat-card,
.panel-card,
.module-tile,
.quick-action {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 18px;
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card span {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.86rem;
}

.stat-card strong {
    font-size: 1.7rem;
    letter-spacing: -0.04em;
}

.panel-card {
    padding: 16px;
}

.panel-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-card-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.table {
    color: var(--text-main);
}

.table thead th {
    background: #f8fafc;
    color: #334155;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

.table td,
.table th {
    padding: 12px;
    border-color: var(--border);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    font-size: 0.76rem;
    font-weight: 800;
    border: 1px solid var(--border);
    text-transform: capitalize;
}

.status-activo {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.status-pendiente {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.status-suspendido,
.status-cancelado {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.quick-actions,
.module-grid {
    display: grid;
    gap: 10px;
}

.quick-action,
.module-tile {
    display: block;
    text-decoration: none;
    color: var(--text-main);
    padding: 14px;
    border-left: 4px solid var(--primary);
}

.quick-action:hover,
.module-tile:hover {
    background: #f8fafc;
    color: var(--primary);
}

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

.module-tile strong,
.module-tile span {
    display: block;
}

.module-tile span {
    color: var(--text-muted);
    margin-top: 4px;
}

.business-state {
    display: grid;
    gap: 12px;
}

.business-state div {
    padding: 12px;
    border: 1px solid var(--border);
    background: #f8fafc;
}

.business-state span,
.business-state strong {
    display: block;
}

.business-state span {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.business-state strong {
    margin-top: 3px;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }

    .btn-menu {
        display: inline-flex;
    }

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

@media (max-width: 575.98px) {
    .content-area {
        padding: 14px;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .head-actions .btn {
        width: 100%;
    }

    .stats-grid,
    .module-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 14px;
    }

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

.app-table-wrap {
    border: 1px solid var(--border);
}

.product-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
}

.product-thumb {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border: 1px solid var(--border);
    background: #f8fafc;
    display: grid;
    place-items: center;
    overflow: hidden;
    font-weight: 850;
    color: var(--primary);
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-cell strong,
.product-cell small {
    display: block;
}

.product-cell small {
    color: var(--text-muted);
    margin-top: 3px;
    max-width: 360px;
}

.action-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    color: var(--text-muted);
    font-weight: 700;
}

.product-form-card {
    padding: 16px;
}

.form-section {
    border: 1px solid var(--border);
    background: #ffffff;
    padding: 16px;
}

.form-section h2 {
    margin: 0 0 14px;
    font-size: 1rem;
    font-weight: 850;
}

.check-panel {
    min-height: 40px;
    border: 1px solid var(--border);
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    font-weight: 700;
}

.check-panel input {
    width: 16px;
    height: 16px;
}

.image-preview-box {
    min-height: 210px;
    border: 1px solid var(--border);
    background: #f8fafc;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-weight: 750;
    overflow: hidden;
}

.image-preview-box img {
    width: 100%;
    height: 210px;
    object-fit: contain;
    background: #ffffff;
}

.help-text {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding-top: 16px;
}

@media (max-width: 575.98px) {
    .pagination-bar,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .form-actions .btn,
    .pagination-bar .btn {
        width: 100%;
    }
}

.client-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
}

.client-mark {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border: 1px solid var(--border);
    background: #eff6ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 900;
}

.client-cell strong,
.client-cell small,
.client-meta strong,
.client-meta span {
    display: block;
}

.client-cell small,
.client-meta span {
    color: var(--text-muted);
    margin-top: 3px;
}

.client-meta {
    min-width: 190px;
}

.muted-check {
    background: #f1f5f9;
    color: var(--text-muted);
}

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 16px;
    align-items: start;
}

.pos-products-panel,
.pos-cart-panel {
    min-width: 0;
}

.pos-cart-panel {
    position: sticky;
    top: 86px;
}

.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.pos-product-card {
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 12px;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.pos-product-card .btn {
    grid-column: 1 / -1;
}

.pos-product-card.is-disabled {
    opacity: 0.62;
}

.pos-product-thumb {
    width: 72px;
    height: 72px;
    border: 1px solid var(--border);
    background: #f8fafc;
    display: grid;
    place-items: center;
    overflow: hidden;
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--primary);
}

.pos-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pos-product-info {
    min-width: 0;
}

.pos-product-info strong,
.pos-product-info small {
    display: block;
}

.pos-product-info strong {
    font-size: 0.95rem;
    line-height: 1.2;
}

.pos-product-info small {
    color: var(--text-muted);
    margin-top: 4px;
}

.pos-product-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.82rem;
    font-weight: 800;
}

.pos-product-meta span:first-child {
    color: var(--primary);
}

.pos-product-meta span:last-child {
    color: var(--text-muted);
}

.pos-cart-card {
    padding: 14px;
}

.pos-cart-lines {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
    padding-right: 2px;
}

.empty-cart {
    border: 1px dashed var(--border);
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 750;
    text-align: center;
    padding: 18px;
}

.pos-cart-line {
    border: 1px solid var(--border);
    background: #ffffff;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.pos-cart-line-info strong,
.pos-cart-line-info small {
    display: block;
}

.pos-cart-line-info small {
    color: var(--text-muted);
    margin-top: 3px;
}

.pos-cart-line-actions {
    display: grid;
    grid-template-columns: 38px minmax(70px, 1fr) 38px auto;
    gap: 6px;
    align-items: center;
}

.pos-cart-line-actions .btn,
.pos-cart-line-actions .form-control {
    min-height: 34px;
}

.pos-totals {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding-top: 12px;
}

.pos-totals > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pos-totals span {
    color: var(--text-muted);
    font-weight: 750;
}

.pos-totals strong {
    font-size: 1rem;
}

.pos-totals input {
    max-width: 150px;
    text-align: right;
}

.pos-totals .total-row {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.pos-totals .total-row strong {
    font-size: 1.5rem;
    color: var(--primary);
}

.ticket-shell {
    display: flex;
    justify-content: center;
}

.ticket-card {
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 18px;
}

.ticket-head {
    text-align: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.ticket-head strong,
.ticket-head span {
    display: block;
}

.ticket-head strong {
    font-size: 1.1rem;
}

.ticket-head span {
    color: var(--text-muted);
    margin-top: 2px;
}

.ticket-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.ticket-info div {
    border: 1px solid var(--border);
    background: #f8fafc;
    padding: 9px;
}

.ticket-info span,
.ticket-info strong {
    display: block;
}

.ticket-info span {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.ticket-info strong {
    margin-top: 3px;
    font-size: 0.9rem;
}

.ticket-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.ticket-table th,
.ticket-table td {
    border-bottom: 1px solid var(--border);
    padding: 8px 4px;
    vertical-align: top;
}

.ticket-table th {
    color: #334155;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ticket-totals {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}

.ticket-totals div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.ticket-total {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    font-size: 1.2rem;
}

.ticket-footer {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    color: var(--text-muted);
    text-align: center;
    font-weight: 700;
}

@media (max-width: 1199.98px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }

    .pos-cart-panel {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .pos-product-grid {
        grid-template-columns: 1fr;
    }

    .pos-cart-line-actions {
        grid-template-columns: 36px minmax(60px, 1fr) 36px;
    }

    .pos-cart-line-actions [data-pos-remove] {
        grid-column: 1 / -1;
    }

    .ticket-info {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 1399.98px) {
    .pos-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media print {
    body {
        background: #ffffff;
    }

    .no-print,
    .sidebar,
    .topbar {
        display: none !important;
    }

    .app-main,
    .content-area {
        margin: 0 !important;
        padding: 0 !important;
    }

    .ticket-card {
        box-shadow: none;
        border: none;
        max-width: 80mm;
        padding: 0;
        font-size: 12px;
    }
}

.logo-preview-box {
    min-height: 82px;
    border: 1px dashed var(--border);
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.logo-preview-box img {
    max-width: 180px;
    max-height: 72px;
    object-fit: contain;
}

.logo-preview-box span {
    color: var(--text-muted);
    font-weight: 700;
}

.square-color {
    width: 100%;
    height: 42px;
    padding: 4px;
}

.settings-checks {
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    background: #f8fafc;
    padding: 10px;
}

.settings-checks label,
.switch-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #334155;
    font-weight: 700;
    font-size: 0.88rem;
}

.switch-line.compact {
    white-space: nowrap;
}

.payment-inline-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    padding: 5px 9px;
    border: 1px solid transparent;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge.ok {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.status-badge.off {
    color: #64748b;
    background: #f1f5f9;
    border-color: #e2e8f0;
}

@media (max-width: 767.98px) {
    .payment-inline-form {
        grid-template-columns: 1fr;
    }
}

.topbar-profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 750;
}

.topbar-profile:hover {
    color: var(--primary);
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid var(--border);
    background: #eff6ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 900;
    overflow: hidden;
}

.topbar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-summary {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 8px;
}

.profile-summary strong,
.profile-summary span {
    display: block;
}

.profile-summary strong {
    font-size: 1.08rem;
    font-weight: 850;
}

.profile-summary span {
    color: var(--text-muted);
    font-weight: 700;
    word-break: break-word;
}

.profile-avatar-lg {
    width: 104px;
    height: 104px;
    border: 1px solid var(--border);
    background: #eff6ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    overflow: hidden;
    font-size: 2.2rem;
    font-weight: 950;
}

.profile-avatar-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 575.98px) {
    .topbar-profile > span:last-child {
        display: none;
    }
}
