:root{
    --bg:#020617;
    --surface:#0f172a;
    --surface-2:#111827;
    --card:#111827;
    --card-2:#1e293b;
    --text:#e5eefb;
    --muted:#94a3b8;
    --primary:#2563eb;
    --primary-2:#4f46e5;
    --success:#22c55e;
    --warning:#f59e0b;
    --danger:#ef4444;
    --border:rgba(148,163,184,.16);
    --shadow:0 18px 40px rgba(2,6,23,.28);
    --radius:22px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0;width:100%;overflow-x:hidden}
body{
    font-family:Inter,Segoe UI,Arial,sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.18), transparent 30%),
        radial-gradient(circle at right center, rgba(79,70,229,.18), transparent 28%),
        linear-gradient(180deg,#020617 0%,#0b1120 100%);
    color:var(--text);
    min-height:100vh;
    overflow-x:hidden;
}
a{color:inherit;text-decoration:none}
img{max-width:100%}
code{font-family:Consolas,Monaco,monospace}
button,input,select,textarea{
    font:inherit;
}
input,select,textarea{
    width:100%;
    border:1px solid var(--border);
    background:rgba(15,23,42,.7);
    color:var(--text);
    border-radius:16px;
    padding:14px 16px;
    outline:none;
}
textarea{resize:vertical}
input::placeholder,textarea::placeholder{color:#7c8aa3}
label{
    display:flex;
    flex-direction:column;
    gap:8px;
    color:var(--muted);
    font-size:.94rem;
}
button{
    cursor:pointer;
    border:none;
}
small,.muted{color:var(--muted)}

.app-shell{
    display:flex;
    min-height:100vh;
    width:100%;
    position:relative;
    overflow-x:hidden;
}

.sidebar{
    width:285px;
    max-width:100%;
    background:rgba(2,6,23,.88);
    border-right:1px solid var(--border);
    backdrop-filter:blur(16px);
    padding:28px 20px;
    position:fixed;
    top:0;
    left:0;
    height:100vh;
    display:flex;
    flex-direction:column;
    gap:24px;
    z-index:60;
    overflow-y:auto;
    overflow-x:hidden;
}
.sidebar,
.sidebar *{
    box-sizing:border-box;
}

.brand-row{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}
.brand{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:14px;
    padding:6px 4px 18px;
    border-bottom:1px solid var(--border);
    flex:1;
    min-width:0;
}
.brand-logo{
    max-width:180px;
    width:100%;
    height:auto;
    display:block;
    object-fit:contain;
}
.sidebar-close{
    display:none !important;
    appearance:none !important;
    -webkit-appearance:none !important;
    background:transparent !important;
    border:0 !important;
    color:var(--text) !important;
    width:42px;
    height:42px;
    border-radius:14px;
    flex:0 0 auto;
    align-items:center;
    justify-content:center;
    padding:0;
    margin:0;
    line-height:1;
    font-size:24px;
    font-weight:700;
    box-shadow:none !important;
    outline:none;
}
.sidebar-close::before,
.sidebar-close::after{
    content:none !important;
    display:none !important;
}
.sidebar-close:hover{
    background:rgba(255,255,255,.08);
}
.sidebar-close:focus{
    outline:none;
    box-shadow:0 0 0 2px rgba(59,130,246,.35);
}
.sidebar-overlay{
    display:none;
}
.brand strong{display:block;font-size:1rem}
.brand small{display:block;color:var(--muted);margin-top:4px}
.brand-badge{
    width:48px;
    height:48px;
    border-radius:16px;
    display:grid;
    place-items:center;
    font-weight:800;
    background:linear-gradient(135deg,var(--primary),var(--primary-2));
    box-shadow:0 10px 24px rgba(37,99,235,.3);
    flex:0 0 48px;
}
.sidebar-nav{
    display:flex;
    flex-direction:column;
    gap:8px;
    width:100%;
}
.nav-link{
    display:flex;
    align-items:center;
    gap:12px;
    padding:14px 16px;
    border-radius:16px;
    color:#cbd5e1;
    transition:.18s ease;
    width:100%;
    max-width:100%;
}
.nav-link:hover,.nav-link.active{
    background:linear-gradient(135deg,rgba(37,99,235,.18),rgba(79,70,229,.18));
    color:#fff;
    transform:translateX(2px);
}
.nav-icon{
    width:28px;
    min-width:28px;
    text-align:center;
    opacity:.9;
}
.sidebar-footer{
    margin-top:auto;
    display:flex;
    flex-direction:column;
    gap:14px;
}
.user-card{
    display:flex;
    gap:12px;
    align-items:center;
    padding:14px;
    background:rgba(15,23,42,.74);
    border-radius:18px;
    border:1px solid var(--border);
    min-width:0;
}
.user-avatar{
    width:42px;
    height:42px;
    border-radius:14px;
    background:linear-gradient(135deg,#0ea5e9,#2563eb);
    display:grid;
    place-items:center;
    font-weight:700;
    flex:0 0 42px;
}
.logout-link{
    padding:12px 14px;
    border-radius:14px;
    background:rgba(239,68,68,.08);
    color:#fecaca;
    text-align:center;
    border:1px solid rgba(239,68,68,.18);
}

.main-content{
    flex:1;
    min-width:0;
    width:100%;
    overflow-x:hidden;
    margin-left:285px;
}

.topbar{
    padding:28px 32px 10px;
    display:flex;
    justify-content:space-between;
    gap:20px;
    align-items:flex-start;
}
.topbar-left{
    display:flex;
    gap:16px;
    align-items:flex-start;
}
.topbar h1{
    margin:0;
    font-size:1.85rem;
}
.topbar p{
    margin:6px 0 0;
    color:var(--muted);
}
.topbar-right{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
    justify-content:flex-end;
}
.sidebar-toggle{
    display:none;
    width:48px;
    height:48px;
    border-radius:14px;
    background:rgba(15,23,42,.8);
    border:1px solid var(--border);
    color:var(--text);
}
.pill{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:10px 14px;
    border-radius:999px;
    background:rgba(15,23,42,.74);
    border:1px solid var(--border);
    color:#cbd5e1;
    font-size:.92rem;
}
.pill-soft{opacity:.82}

.page-content{
    padding:18px 32px 40px;
    width:100%;
    overflow-x:hidden;
}
.grid-cards{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:18px;
    margin-bottom:18px;
}
.stat-card{
    border-radius:var(--radius);
    padding:22px;
    border:1px solid rgba(255,255,255,.08);
    box-shadow:var(--shadow);
    min-height:164px;
    display:flex;
    flex-direction:column;
    gap:10px;
}
.gradient-1{background:linear-gradient(135deg,rgba(37,99,235,.9),rgba(14,165,233,.72))}
.gradient-2{background:linear-gradient(135deg,rgba(79,70,229,.9),rgba(59,130,246,.72))}
.gradient-3{background:linear-gradient(135deg,rgba(34,197,94,.86),rgba(22,163,74,.72))}
.gradient-4{background:linear-gradient(135deg,rgba(234,88,12,.86),rgba(245,158,11,.72))}
.stat-label{
    text-transform:uppercase;
    letter-spacing:.08em;
    font-size:.75rem;
    opacity:.82;
}
.stat-card strong{
    font-size:2rem;
    line-height:1.05;
}
.stat-card small{
    color:rgba(255,255,255,.8);
}
.grid-two{
    display:grid;
    grid-template-columns:1.35fr 1fr;
    gap:18px;
    margin-bottom:18px;
}
.card{
    background:rgba(15,23,42,.8);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:24px;
    box-shadow:var(--shadow);
}
.card-header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:16px;
    margin-bottom:18px;
}
.card-header h2{
    margin:0;
    font-size:1.2rem;
}
.card-header p{
    margin:6px 0 0;
    color:var(--muted);
}
.quick-actions{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:14px;
}
.action-tile{
    padding:18px;
    border:1px solid var(--border);
    border-radius:18px;
    background:linear-gradient(135deg,rgba(37,99,235,.08),rgba(79,70,229,.08));
}
.action-tile strong{display:block;margin-bottom:6px}
.action-tile span{color:var(--muted);font-size:.92rem}
.info-card{
    padding:18px;
    border-radius:18px;
    background:rgba(30,41,59,.72);
    border:1px solid var(--border);
    margin-top:14px;
}
.info-card p{margin:8px 0 0;color:var(--muted)}
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    border-radius:16px;
    padding:13px 18px;
    font-weight:700;
    transition:.2s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn-primary{
    background:linear-gradient(135deg,var(--primary),var(--primary-2));
    color:#fff;
}
.btn-secondary{
    background:rgba(148,163,184,.12);
    color:#f8fafc;
    border:1px solid var(--border);
}
.btn-ghost{
    background:transparent;
    border:1px solid var(--border);
    color:#cbd5e1;
}
.btn-danger{
    background:rgba(239,68,68,.12);
    color:#fff;
    border:1px solid rgba(239,68,68,.28);
}
.btn-block{width:100%}
.button-row{display:flex;gap:10px;flex-wrap:wrap}
.stack-lg{display:flex;flex-direction:column;gap:16px}
.stack-md{display:flex;flex-direction:column;gap:14px}
.inline-filter,.inline-form{
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:wrap;
    margin-bottom:16px;
}
.inline-filter select,.inline-form select{width:auto;min-width:180px}
.checkbox-inline{
    display:flex;
    flex-direction:row;
    gap:12px;
    align-items:center;
}
.checkbox-inline input{
    width:18px;
    height:18px;
}
.grid-form{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:14px;
}
.flash-stack{
    display:flex;
    flex-direction:column;
    gap:10px;
    margin-bottom:18px;
}
.flash{
    padding:14px 16px;
    border-radius:16px;
    border:1px solid var(--border);
}
.flash-success{
    background:rgba(34,197,94,.12);
    border-color:rgba(34,197,94,.3);
    color:#bbf7d0;
}
.flash-danger{
    background:rgba(239,68,68,.12);
    border-color:rgba(239,68,68,.3);
    color:#fecaca;
}
.flash-warning{
    background:rgba(245,158,11,.12);
    border-color:rgba(245,158,11,.28);
    color:#fde68a;
}
.flash-neutral{
    background:rgba(148,163,184,.1);
    color:#cbd5e1;
}
.table-wrap{
    overflow:auto;
    border:1px solid var(--border);
    border-radius:18px;
}
.table{
    width:100%;
    border-collapse:collapse;
    min-width:860px;
}
.table th,.table td{
    padding:14px 16px;
    border-bottom:1px solid var(--border);
    text-align:left;
    vertical-align:top;
}
.table th{
    color:#cbd5e1;
    font-size:.85rem;
    letter-spacing:.03em;
    background:rgba(2,6,23,.25);
}
.table tbody tr:hover{background:rgba(30,41,59,.46)}
.empty-cell{
    text-align:center;
    padding:28px;
    color:var(--muted);
}
.badge{
    display:inline-flex;
    align-items:center;
    padding:7px 10px;
    border-radius:999px;
    font-size:.82rem;
    font-weight:700;
    border:1px solid transparent;
    text-transform:capitalize;
}
.badge-success{background:rgba(34,197,94,.12);color:#bbf7d0;border-color:rgba(34,197,94,.25)}
.badge-warning{background:rgba(245,158,11,.12);color:#fde68a;border-color:rgba(245,158,11,.25)}
.badge-danger{background:rgba(239,68,68,.12);color:#fecaca;border-color:rgba(239,68,68,.25)}
.badge-neutral{background:rgba(148,163,184,.1);color:#dbeafe;border-color:rgba(148,163,184,.18)}

.product-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:16px;
    margin-top:8px;
}
.product-card{
    border:1px solid rgba(148,163,184,.14);
    background:linear-gradient(180deg,#172033 0%, #0f172a 100%);
    border-radius:22px;
    padding:0;
    overflow:hidden;
    text-align:left;
    transition:.2s ease;
    box-shadow:0 10px 24px rgba(2,6,23,.22);
    min-height:168px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
}
.product-card:hover{
    transform:translateY(-2px);
    border-color:rgba(59,130,246,.38);
    box-shadow:0 16px 34px rgba(37,99,235,.18);
}
.product-card-top{
    padding:14px 16px 0;
}
.product-card-body{
    padding:12px 16px 18px;
    display:flex;
    flex-direction:column;
    gap:8px;
    align-items:flex-start;
}
.product-card strong{
    display:block;
    font-size:1.38rem;
    margin:6px 0;
}
.product-operator{
    display:inline-flex;
    align-items:center;
    padding:7px 12px;
    background:rgba(37,99,235,.14);
    color:#bfdbfe;
    border:1px solid rgba(59,130,246,.22);
    border-radius:999px;
    font-size:.80rem;
    font-weight:700;
    letter-spacing:.02em;
}
.product-amount{
    display:block;
    font-size:1.9rem;
    line-height:1;
    font-weight:800;
    color:#ffffff;
    margin:6px 0 2px;
}
.product-price-label{
    font-size:.84rem;
    color:#ffffff;
}
.product-price{
    margin-top:12px;
    font-weight:700;
    color:#a7f3d0;
}
.product-price-value{
    font-size:1.08rem;
    font-weight:800;
    color:#ffffff;
    line-height:1.1;
}
.order-tile{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:16px;
    padding:16px 18px;
    border:1px solid var(--border);
    border-radius:18px;
    background:rgba(15,23,42,.55);
}
.align-right{
    text-align:right;
    display:flex;
    flex-direction:column;
    gap:8px;
}
.pix-card{
    border:1px solid var(--border);
    border-radius:20px;
    background:rgba(15,23,42,.58);
    padding:18px;
}
.pix-top{
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:flex-start;
    margin-bottom:12px;
}
.pix-top strong{display:block}
.pix-body{
    display:flex;
    gap:18px;
    align-items:flex-start;
}
.pix-qr{
    width:150px;
    height:150px;
    object-fit:contain;
    border-radius:18px;
    background:#fff;
    padding:10px;
}
.pix-copy{
    flex:1;
    display:flex;
    flex-direction:column;
    gap:10px;
}
.pix-copy textarea{
    min-height:110px;
}
.empty-state{
    border:1px dashed rgba(148,163,184,.24);
    border-radius:20px;
    padding:24px;
    text-align:center;
    color:var(--muted);
}
.empty-state h3{
    margin-top:0;
    color:var(--text);
}
.actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}
.actions form{display:inline}
.code-block{
    padding:16px;
    border-radius:18px;
    background:rgba(2,6,23,.8);
    border:1px solid var(--border);
    overflow:auto;
    color:#cbd5e1;
}
.guest-body{
    overflow-x:hidden;
}
.guest-wrap{
    min-height:100vh;
    padding:30px;
    display:flex;
    align-items:center;
    justify-content:center;
}
.auth-hero{
    width:min(1250px,100%);
    display:grid;
    grid-template-columns:1.08fr .92fr;
    gap:28px;
    align-items:center;
}
.auth-copy{
    padding:30px 6px;
}
.auth-copy h1{
    font-size:clamp(2rem,4vw,3.5rem);
    line-height:1.06;
    margin:0 0 18px;
}
.auth-copy p{
    color:var(--muted);
    font-size:1.05rem;
    max-width:720px;
}
.hero-badge{
    display:inline-flex;
    padding:10px 14px;
    border-radius:999px;
    background:rgba(37,99,235,.14);
    color:#bfdbfe;
    margin-bottom:18px;
    border:1px solid rgba(37,99,235,.28);
}
.feature-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:14px;
    margin-top:24px;
}
.feature-card{
    padding:18px;
    border-radius:18px;
    border:1px solid var(--border);
    background:rgba(15,23,42,.68);
}
.feature-card strong{display:block;margin-bottom:8px}
.feature-card small{color:var(--muted)}
.auth-panel{
    display:flex;
    justify-content:center;
}
.auth-card{
    width:min(460px,100%);
    background:rgba(15,23,42,.86);
    border:1px solid var(--border);
    border-radius:28px;
    padding:28px;
    box-shadow:var(--shadow);
}
.auth-card h2{
    margin:0;
}
.auth-card p{
    color:var(--muted);
    margin:8px 0 18px;
}
.auth-links{
    display:flex;
    justify-content:space-between;
    gap:12px;
    margin-top:18px;
    color:#bfdbfe;
    flex-wrap:wrap;
}
.demo-credentials{
    margin-top:24px;
    padding:18px;
    border-radius:20px;
    background:rgba(15,23,42,.62);
    border:1px solid var(--border);
}
.demo-credentials h3{margin-top:0}
.demo-credentials ul{padding-left:18px;color:#cbd5e1}
.line-chart{
    width:100%;
    border-radius:18px;
    background:rgba(2,6,23,.18);
}
.receipt-body{
    padding:24px;
}
.receipt-card{
    max-width:860px;
    margin:0 auto;
    background:rgba(15,23,42,.94);
    border:1px solid var(--border);
    border-radius:28px;
    padding:28px;
    box-shadow:var(--shadow);
}
.receipt-header{
    display:flex;
    justify-content:space-between;
    gap:16px;
    align-items:flex-start;
    margin-bottom:22px;
}
.receipt-header h1{margin:0}
.receipt-header p{margin:6px 0 0;color:var(--muted)}
.receipt-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:16px;
    margin-bottom:22px;
}
.receipt-grid div{
    background:rgba(30,41,59,.62);
    border:1px solid var(--border);
    border-radius:18px;
    padding:16px;
}
.receipt-grid span{
    display:block;
    color:var(--muted);
    margin-bottom:8px;
}
.receipt-actions{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
}

@media (max-width:1180px){
    .grid-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
    .product-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .auth-hero{grid-template-columns:1fr}
}

@media (max-width:980px){
    body.sidebar-open{overflow:hidden}

    .sidebar{
        position:fixed;
        left:0;
        top:0;
        bottom:0;
        width:min(84vw,320px);
        max-width:84vw;
        height:100vh;
        transform:translateX(-100%);
        transition:transform .25s ease;
        z-index:70;
        box-shadow:0 24px 64px rgba(2,6,23,.46);
        border-right:1px solid var(--border);
        overflow-y:auto;
        overflow-x:hidden;
    }

    .main-content{
        margin-left:0;
    }

    .sidebar.open{
        transform:translateX(0);
    }

    .sidebar-toggle{
        display:inline-grid;
        place-items:center;
        flex:0 0 auto;
    }

    .sidebar-close{
        display:inline-flex !important;
        border:1px solid var(--border) !important;
        background:transparent !important;
    }

    .sidebar-overlay{
        display:block;
        position:fixed;
        inset:0;
        opacity:0;
        pointer-events:none;
        background:rgba(2,6,23,.58);
        border:none;
        z-index:65;
        transition:opacity .2s ease;
    }

    body.sidebar-open .sidebar-overlay{
        opacity:1;
        pointer-events:auto;
    }

    .topbar{
        padding:22px 18px 8px;
        flex-direction:column;
    }

    .topbar-right{
        justify-content:flex-start;
    }

    .page-content{
        padding:16px 18px 32px;
    }

    .grid-two{
        grid-template-columns:1fr;
    }
}

@media (max-width:760px){
    .grid-form,
    .grid-cards,
    .feature-grid,
    .quick-actions,
    .product-grid,
    .receipt-grid{
        grid-template-columns:1fr;
    }

    .topbar h1{
        font-size:1.45rem;
    }

    .topbar-left,
    .topbar-right{
        width:100%;
    }

    .card{
        padding:18px;
    }

    .pill{
        width:100%;
        justify-content:center;
    }

    .pix-body{
        flex-direction:column;
    }

    .pix-qr{
        width:100%;
        max-width:210px;
        height:auto;
    }

    .auth-card{
        padding:22px;
    }

    .guest-wrap{
        padding:16px;
    }

    .product-card{
        min-height:150px;
    }

    .product-amount{
        font-size:1.7rem;
    }
}

@media print{
    .receipt-actions{display:none}
    body{background:#fff;color:#111}
    .receipt-card{
        box-shadow:none;
        border:1px solid #ddd;
        color:#111;
    }
}