:root {
    --sidebar-width: 260px;
}

body { background: #f4f7f8; color: var(--text, #535454); margin: 0; }

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

.guest-dev-link {
    color: #c8fafb;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid rgba(200, 250, 251, .35);
    transition: opacity .2s ease, border-color .2s ease;
}

.guest-dev-link:hover {
    color: #fff;
    opacity: 1;
    border-bottom-color: #fff;
}

.public-footer a[href*="lifesoftw"],
.public-footer .guest-dev-link {
    color: #1ed0d5;
}

.sidebar-dev-credit {
    margin-top: auto;
    padding: .85rem 1.25rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: .68rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, .5);
    text-align: center;
}

.sidebar-dev-credit a {
    color: rgba(30, 208, 213, .85);
    text-decoration: none;
}

.sidebar-dev-credit a:hover {
    color: #1ed0d5;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a3a42 0%, #0f2429 100%);
    color: #fff;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    list-style: none;
    padding: .75rem 0;
    margin: 0;
    flex: 1 1 auto;
}
.sidebar-nav li a {
    display: flex; align-items: center; gap: .6rem;
    padding: .65rem 1.25rem; color: rgba(255,255,255,.85); text-decoration: none;
}
.sidebar-nav li a:hover, .sidebar-nav li a.active { background: rgba(255,255,255,.08); color: #fff; }
.nav-section { padding: .75rem 1.25rem .25rem; font-size: .7rem; text-transform: uppercase; opacity: .5; }

@media (min-width: 768px) {
    .sidebar { transform: none; }
    .main-content { margin-left: var(--sidebar-width); }
}

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

.sidebar-brand { padding: 1.25rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-brand h2 { font-size: 1.1rem; margin: 0; }
.sidebar-brand small { opacity: .75; }
.sidebar-logo { max-height: 42px; max-width: 100%; }

.main-content { flex: 1; min-width: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid #e5ecec;
    padding: .75rem 1rem; display: flex; align-items: center;
    position: sticky; top: 0; z-index: 100;
}

.topbar-user-chip {
    display: flex;
    align-items: center;
    gap: .65rem;
    max-width: min(100%, 320px);
    padding: .35rem .65rem .35rem .4rem;
    border: 1px solid #e5ecec;
    border-radius: 999px;
    background: #f8fbfb;
}

.topbar-user-avatar,
.dashboard-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    flex-shrink: 0;
}

.dashboard-user-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.15rem;
}

.topbar-user-info {
    min-width: 0;
    line-height: 1.2;
}

.topbar-user-name {
    display: block;
    font-size: .84rem;
    font-weight: 600;
    color: #1a3a42;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-user-meta {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    color: #7a8787;
    min-width: 0;
}

.topbar-meta-sep {
    opacity: .55;
}

.topbar-agency {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-role-badge,
.dashboard-role-badge,
.dashboard-scope-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.2;
}

.topbar-role-badge {
    padding: .12rem .45rem;
    font-size: .68rem;
}

.dashboard-scope-badge {
    background: #eef8f8;
    color: #1a5c63;
    border: 1px solid #d4ecec;
}

.role-badge-admin {
    background: rgba(83, 84, 84, .12);
    color: #535454;
}

.role-badge-owner {
    background: rgba(7, 173, 173, .14);
    color: #0d7070;
}

.role-badge-cashier {
    background: rgba(30, 208, 213, .16);
    color: #0a8f93;
}

.role-badge-waiter {
    background: rgba(243, 156, 18, .16);
    color: #b8750a;
}

.role-badge-default {
    background: #eef3f3;
    color: #5a6868;
}

.dashboard-user-card {
    border-left: 4px solid var(--primary);
    overflow: hidden;
}

.dashboard-user-greeting {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #7a8787;
    margin: 0;
}

.dashboard-user-name {
    margin: 0;
    color: #1a3a42;
    font-weight: 700;
}

.dashboard-user-details {
    font-size: .82rem;
    color: #5a6868;
    display: grid;
    gap: .35rem;
}

.dashboard-user-details i {
    color: var(--primary);
    margin-right: .35rem;
}

.dashboard-session-active {
    font-size: .75rem;
    color: #1a9a55;
    font-weight: 600;
}

.dashboard-session-active i {
    font-size: .45rem;
    vertical-align: middle;
    margin-right: .25rem;
    color: #1a9a55;
}

@media (max-width: 575.98px) {
    .topbar-user-chip {
        max-width: calc(100vw - 7rem);
    }

    .topbar-agency {
        display: none;
    }

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

    .dashboard-user-details {
        margin-top: .25rem;
        padding-top: .75rem;
        border-top: 1px dashed #e5ecec;
    }
}

.card-custom { border: none; border-radius: 14px; box-shadow: 0 4px 18px rgba(0,0,0,.05); }
.card-custom .card-header { background: #fff; font-weight: 600; border-bottom: 1px solid #eef3f3; }

.kpi-card {
    background: #fff; border-radius: 14px; padding: 1.25rem;
    box-shadow: 0 4px 18px rgba(0,0,0,.05);
    border-left: 4px solid var(--primary);
}
.kpi-card small { color: #7a8787; text-transform: uppercase; font-size: .72rem; }
.kpi-card h3 { margin: .25rem 0 0; font-size: 1.75rem; color: #1a3a42; }

.guest-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #535454 0%, #1a3a42 40%, #0d5660 70%, var(--secondary, #07ADAD) 100%);
    padding: 1.5rem 1rem 2rem;
    position: relative;
    overflow: hidden;
}

.guest-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.guest-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .4;
    animation: guestOrbFloat 14s ease-in-out infinite;
}

.guest-orb-1 {
    width: 340px;
    height: 340px;
    background: var(--primary, #1ed0d5);
    top: -100px;
    right: 8%;
}

.guest-orb-2 {
    width: 260px;
    height: 260px;
    background: #fff;
    bottom: -80px;
    left: 6%;
    opacity: .12;
    animation-delay: -5s;
}

.guest-orb-3 {
    width: 200px;
    height: 200px;
    background: var(--secondary, #07ADAD);
    top: 45%;
    left: 42%;
    animation-delay: -9s;
}

@keyframes guestOrbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -24px) scale(1.08); }
}

.guest-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: radial-gradient(ellipse at center, #000 0%, transparent 75%);
    animation: guestGridDrift 22s linear infinite;
}

@keyframes guestGridDrift {
    from { transform: translate(0, 0); }
    to { transform: translate(52px, 52px); }
}

.guest-shell {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.guest-card {
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(12px);
    border-radius: 22px;
    padding: 0;
    width: 100%;
    box-shadow: 0 28px 64px rgba(0, 0, 0, .22);
    border: 1px solid rgba(255, 255, 255, .35);
    overflow: hidden;
    opacity: 0;
    transform: translateY(28px) scale(.97);
    transition: opacity .65s cubic-bezier(.22, 1, .36, 1), transform .65s cubic-bezier(.22, 1, .36, 1);
}

.guest-card.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.guest-brand {
    padding: 2rem 2rem 1.25rem;
    background: linear-gradient(180deg, rgba(30, 208, 213, .08) 0%, transparent 100%);
    border-bottom: 1px solid rgba(7, 173, 173, .12);
}

.guest-logo-wrap {
    margin-bottom: 1rem;
    animation: guestLogoIn .7s cubic-bezier(.22, 1, .36, 1) .15s both;
}

@keyframes guestLogoIn {
    from { opacity: 0; transform: scale(.85) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.guest-logo {
    max-height: 72px;
    max-width: min(220px, 80vw);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(26, 58, 66, .12);
}

.guest-logo-fallback {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 18px;
    background: var(--brand-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 8px 24px rgba(30, 208, 213, .35);
}

.guest-company-name {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1a3a42;
    margin: 0 0 .35rem;
    line-height: 1.2;
    animation: guestFadeUp .6s ease .22s both;
}

.guest-tagline {
    font-size: .88rem;
    color: #64748b;
    margin: 0 0 .85rem;
    animation: guestFadeUp .6s ease .28s both;
}

.guest-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    animation: guestFadeUp .6s ease .34s both;
}

.guest-system-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .75rem;
    border-radius: 999px;
    background: rgba(26, 58, 66, .08);
    color: #1a3a42;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.guest-panel-label {
    font-size: .78rem;
    color: #94a3b8;
    font-weight: 600;
}

@keyframes guestFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.guest-card-body {
    padding: 1.35rem 2rem 1.75rem;
    animation: guestFadeUp .6s ease .4s both;
}

.guest-login-form .form-label {
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: .35rem;
}

.guest-input-wrap {
    position: relative;
}

.guest-input-icon {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: .95rem;
    pointer-events: none;
    transition: color .2s ease;
}

.guest-input {
    padding-left: 2.45rem;
    border-radius: 12px;
    border: 1px solid rgba(7, 173, 173, .22);
    transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}

.guest-input:focus {
    border-color: var(--primary, #1ed0d5);
    box-shadow: 0 0 0 3px rgba(30, 208, 213, .18);
}

.guest-input-wrap:focus-within .guest-input-icon {
    color: var(--secondary, #07ADAD);
}

.guest-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    border-radius: 12px;
    padding: .75rem 1rem;
    font-weight: 700;
    font-size: .95rem;
    transition: transform .2s ease, box-shadow .2s ease;
    box-shadow: 0 10px 28px rgba(30, 208, 213, .32);
}

.guest-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(30, 208, 213, .4);
}

.guest-submit-btn:active {
    transform: translateY(0);
}

.guest-submit-btn i {
    font-size: 1.35rem;
    transition: transform .2s ease;
}

.guest-submit-btn:hover i {
    transform: translateX(3px);
}

.guest-auth-head {
    text-align: center;
}

.guest-auth-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1a3a42;
    margin: 0 0 .5rem;
}

.guest-auth-lead {
    font-size: .84rem;
    color: #64748b;
    line-height: 1.5;
}

.guest-forgot-wrap {
    margin-top: -.25rem;
}

.guest-forgot-link,
.guest-link-back {
    font-size: .82rem;
    font-weight: 600;
    color: var(--secondary, #07ADAD);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    transition: color .2s ease;
}

.guest-forgot-link:hover,
.guest-link-back:hover {
    color: #0d5660;
    text-decoration: underline;
}

.guest-input-wrap-toggle .guest-input-with-toggle {
    padding-right: 2.75rem;
}

.guest-toggle-pwd {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #94a3b8;
    padding: .35rem .45rem;
    border-radius: 8px;
    line-height: 1;
    cursor: pointer;
    transition: color .2s ease, background .2s ease;
}

.guest-toggle-pwd:hover,
.guest-toggle-pwd:focus {
    color: var(--secondary, #07ADAD);
    background: rgba(30, 208, 213, .1);
    outline: none;
}

.guest-pwd-strength {
    margin-top: .5rem;
}

.guest-pwd-strength-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: .25rem;
}

.guest-pwd-strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width .25s ease, background .25s ease;
    background: #cbd5e1;
}

.guest-pwd-strength-bar span.weak { background: #ef4444; }
.guest-pwd-strength-bar span.fair { background: #f59e0b; }
.guest-pwd-strength-bar span.good { background: #3b82f6; }
.guest-pwd-strength-bar span.strong { background: #10b981; }

.guest-pwd-strength-label {
    font-size: .72rem;
}

.guest-match-hint {
    display: block;
    font-size: .72rem;
    margin-top: .35rem;
}

.guest-policy-box {
    background: #f8fafc;
    border: 1px solid rgba(7, 173, 173, .15);
    border-radius: 12px;
    padding: .85rem 1rem;
}

.guest-policy-title {
    font-size: .78rem;
    font-weight: 700;
    color: #475569;
    margin: 0;
    display: flex;
    align-items: center;
    gap: .35rem;
}

.guest-policy-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.guest-policy-list li {
    font-size: .75rem;
    color: #64748b;
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    line-height: 1.35;
}

.guest-policy-list li i {
    flex-shrink: 0;
    margin-top: .1rem;
    font-size: .85rem;
    color: #cbd5e1;
}

.guest-policy-list li.is-ok {
    color: #059669;
}

.guest-policy-list li.is-ok i {
    color: #10b981;
}

.guest-policy-list li.is-fail {
    color: #dc2626;
}

.guest-policy-list li.is-fail i {
    color: #ef4444;
}

.guest-shell--wide {
    width: min(480px, 100%);
}

.guest-footer {
    text-align: center;
    color: rgba(255, 255, 255, .88);
    font-size: .78rem;
    line-height: 1.5;
    animation: guestFadeUp .6s ease .5s both;
}

.guest-rights strong {
    color: #fff;
    font-weight: 700;
}

.guest-powered {
    font-size: .72rem;
    opacity: .75;
}

.guest-powered strong {
    color: #c8fafb;
}

.guest-card-body .alert {
    border-radius: 12px;
    font-size: .85rem;
    animation: guestShake .45s ease;
}

@keyframes guestShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
    .guest-orb, .guest-grid, .guest-card, .guest-logo-wrap,
    .guest-company-name, .guest-tagline, .guest-meta, .guest-card-body, .guest-footer {
        animation: none !important;
        transition: none !important;
    }
    .guest-card { opacity: 1; transform: none; }
    .guest-pwd-strength-bar span { transition: none; }
}

@media (max-width: 575.98px) {
    .guest-page {
        padding: 1rem .75rem 1.5rem;
        align-items: flex-start;
        padding-top: max(1rem, env(safe-area-inset-top, 0));
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0));
    }

    .guest-shell,
    .guest-shell--wide {
        width: 100%;
        margin-top: .5rem;
    }

    .guest-brand {
        padding: 1.5rem 1.25rem 1rem;
    }

    .guest-card-body {
        padding: 1.15rem 1.25rem 1.5rem;
    }

    .guest-company-name {
        font-size: 1.2rem;
    }

    .guest-input,
    .guest-input-with-toggle {
        font-size: 16px;
        min-height: 48px;
    }

    .guest-submit-btn {
        min-height: 48px;
        font-size: 1rem;
    }

    .guest-toggle-pwd {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .guest-policy-box {
        padding: .75rem .85rem;
    }
}

@media (max-width: 380px) {
    .guest-logo,
    .guest-logo-fallback {
        max-height: 60px;
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

.btn-primary {
    background: var(--brand-gradient);
    border: none;
}
.btn-primary:hover { filter: brightness(.95); }

.object-fit-cover { object-fit: cover; }

/* Modo oscuro */
[data-theme="dark"] {
    --surface: #1e2a2e;
    --surface-elevated: #253338;
    --border-soft: #334045;
    --text-muted: #9eb0b5;
}

[data-theme="dark"] body {
    background: #141c1f;
    color: #e8eef0;
}

[data-theme="dark"] .topbar,
[data-theme="dark"] .card-custom,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .card-custom .card-header,
[data-theme="dark"] .card-footer {
    background: var(--surface-elevated);
    color: #e8eef0;
    border-color: var(--border-soft);
}

[data-theme="dark"] .topbar-user-chip {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-soft);
}

[data-theme="dark"] .topbar-user-name,
[data-theme="dark"] .dashboard-user-name {
    color: #f0f6f8;
}

[data-theme="dark"] .dashboard-scope-badge {
    background: rgba(30, 208, 213, 0.1);
    color: #9deef0;
    border-color: rgba(30, 208, 213, 0.25);
}

[data-theme="dark"] .dashboard-user-details {
    color: var(--text-muted);
}

.topbar-prefs-menu {
    width: min(92vw, 320px);
}

.topbar-prefs-form .form-label {
    color: #5a6868;
}

.pref-timezone-select {
    max-height: 160px;
}

.topbar-prefs-toggle.dropdown-toggle::after {
    margin-left: .35rem;
}

@media (max-width: 575.98px) {
    .topbar-prefs-toggle span {
        display: none !important;
    }
}

[data-theme="dark"] .card-custom .card-header {
    border-bottom-color: var(--border-soft);
}

[data-theme="dark"] .kpi-card h3,
[data-theme="dark"] .card-title {
    color: #f0f6f8;
}

[data-theme="dark"] .kpi-card small,
[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #e8eef0;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(30, 208, 213, 0.08);
}

[data-theme="dark"] .table-light {
    --bs-table-bg: #2a383d;
    --bs-table-color: #e8eef0;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: #1a2428;
    border-color: var(--border-soft);
    color: #e8eef0;
}

[data-theme="dark"] .alert-warning {
    background: #3d3420;
    border-color: #5c4d1f;
    color: #ffe8a3;
}

[data-theme="dark"] .alert-success {
    background: #1e3328;
    border-color: #2d5a42;
    color: #b8f0cf;
}

[data-theme="dark"] .btn-outline-secondary {
    border-color: var(--border-soft);
    color: #d0dde0;
}

[data-theme="dark"] .badge.text-bg-light {
    background: #334045 !important;
    color: #e8eef0 !important;
}

[data-theme="dark"] .report-card {
    border-color: var(--border-soft);
}
