:root {
    --bg: #f6f7fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #667085;
    --line: #d9deea;
    --brand: #0f766e;
    --brand-strong: #115e59;
    --accent: #f59e0b;
    --danger: #b42318;
    --info: #2563eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

a {
    color: var(--brand-strong);
    text-decoration: none;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 520px) 1fr;
}

.auth-panel, .content-panel {
    background: var(--panel);
    padding: 36px;
}

.auth-art {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px;
    background: linear-gradient(135deg, #063d3a, #0f766e 52%, #f59e0b);
    color: #fff;
}

.auth-art h1, .page-title h1 {
    margin: 0 0 12px;
    font-size: 34px;
    letter-spacing: 0;
}

.auth-art p, .muted {
    color: var(--muted);
}

.auth-art p {
    color: rgba(255, 255, 255, 0.86);
    max-width: 520px;
    line-height: 1.6;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 700;
    margin-bottom: 28px;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

label {
    font-size: 14px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 13px;
    font-size: 15px;
    background: #fff;
    color: var(--ink);
}

textarea {
    min-height: 96px;
    resize: vertical;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 10px 0 18px;
}

.check-row input {
    width: 17px;
    height: 17px;
}

.btn {
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-strong);
}

.btn-secondary {
    background: #edf3f2;
    color: var(--brand-strong);
}

.btn-danger {
    background: #fee4e2;
    color: var(--danger);
}

.full {
    width: 100%;
}

.error {
    color: var(--danger);
    font-size: 13px;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    background: #ecfdf3;
    color: #027a48;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr;
}

.sidebar {
    background: #111827;
    color: #fff;
    padding: 24px;
}

.sidebar a {
    display: block;
    color: #d1d5db;
    padding: 11px 12px;
    border-radius: 8px;
    margin-top: 6px;
}

.sidebar a:hover, .sidebar a.active {
    background: #263244;
    color: #fff;
}

.main {
    padding: 28px;
}

.topbar, .table-wrap, .form-wrap, .stat-grid > div, .dash-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    margin-bottom: 22px;
}

.page-title {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}

.table-wrap, .form-wrap {
    padding: 18px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 13px;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    background: #eef4ff;
    color: #3538cd;
}

.badge.active {
    background: #ecfdf3;
    color: #027a48;
}

.badge.suspended {
    background: #fee4e2;
    color: var(--danger);
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.stat-grid, .dashboard-grid {
    display: grid;
    gap: 16px;
}

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

.dashboard-grid {
    grid-template-columns: 1.5fr 1fr;
    margin-top: 16px;
}

.stat-grid > div {
    padding: 18px;
}

.stat-grid strong {
    display: block;
    margin-top: 10px;
    font-size: 26px;
}

.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.dash-card {
    padding: 18px;
}

.dash-card h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.list-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.metric {
    font-weight: 700;
}

.bar-chart {
    display: grid;
    gap: 10px;
}

.bar-row {
    display: grid;
    grid-template-columns: 96px 1fr 86px;
    gap: 10px;
    align-items: center;
}

.bar-track {
    height: 12px;
    border-radius: 999px;
    background: #eef2f6;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
}

.bar-fill.info {
    background: var(--info);
}

.bar-fill.accent {
    background: var(--accent);
}

.mini-chart {
    display: flex;
    align-items: end;
    gap: 8px;
    min-height: 180px;
    padding-top: 10px;
}

.mini-bar {
    flex: 1;
    min-width: 22px;
    display: grid;
    gap: 7px;
    align-items: end;
}

.mini-bar span:first-child {
    display: block;
    min-height: 8px;
    border-radius: 6px 6px 0 0;
    background: var(--brand);
}

.mini-bar span:last-child {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.billing-shell {
    display: grid;
    grid-template-columns: minmax(280px, 0.95fr) minmax(420px, 1.35fr) minmax(310px, 0.9fr);
    gap: 14px;
    align-items: start;
}

.billing-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.billing-panel h2 {
    margin: 0 0 12px;
    font-size: 17px;
}

.category-strip, .payment-grid, .counter-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
}

.chip.active {
    border-color: var(--brand);
    background: #edf3f2;
    color: var(--brand-strong);
    font-weight: 700;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-height: 520px;
    overflow: auto;
}

.product-tile {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    text-align: left;
    cursor: pointer;
}

.product-image {
    min-height: 92px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #edf3f2, #fff7ed);
    color: var(--brand-strong);
    font-weight: 800;
    font-size: 24px;
}

.product-info {
    padding: 10px;
}

.product-info strong, .cart-name {
    display: block;
}

.cart-list {
    display: grid;
    gap: 10px;
    max-height: 520px;
    overflow: auto;
}

.cart-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.cart-row {
    display: grid;
    grid-template-columns: 1fr 84px 92px 92px;
    gap: 8px;
    align-items: center;
}

.cart-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-control button {
    width: 34px;
    height: 34px;
    padding: 0;
}

.summary-box {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.summary-total {
    font-size: 24px;
    font-weight: 800;
    color: var(--brand-strong);
}

.preview-box {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    background: #fbfcfe;
}

.display-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
    background: #08111f;
    color: #fff;
}

.display-card {
    width: min(900px, 100%);
    background: #101b2d;
    border: 1px solid #263244;
    border-radius: 8px;
    padding: 28px;
}

.display-card table td, .display-card table th {
    border-color: #263244;
}

.display-total {
    font-size: 44px;
    color: #5eead4;
}

.print-only {
    display: none;
}

.receipt {
    width: 80mm;
    max-width: 100%;
    background: #fff;
    color: #000;
    font-family: "Courier New", monospace;
    font-size: 12px;
    line-height: 1.25;
    padding: 8px;
}

.receipt-58 {
    width: 58mm;
    font-size: 11px;
}

.receipt-a4 {
    width: 190mm;
    font-size: 13px;
}

.receipt-preview {
    display: block;
    border: 1px solid var(--line);
    margin: 0 auto;
}

.receipt-center {
    text-align: center;
}

.receipt-logo {
    width: 46px;
    height: 46px;
    border: 1px solid #000;
    display: grid;
    place-items: center;
    margin: 0 auto 6px;
    font-weight: 700;
}

.receipt-rule {
    border-top: 1px dashed #000;
    margin: 7px 0;
}

.receipt-line {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.receipt-line span:last-child {
    text-align: right;
}

.receipt-total {
    font-size: 15px;
    font-weight: 800;
}

.receipt-items {
    width: 100%;
    border-collapse: collapse;
}

.receipt-items th,
.receipt-items td {
    border: 0;
    padding: 3px 0;
    color: #000;
}

.receipt-items th {
    font-size: 11px;
    color: #000;
}

.receipt-items th:first-child,
.receipt-items td:first-child {
    text-align: left;
}

.receipt-items th:nth-child(2),
.receipt-items td:nth-child(2) {
    text-align: center;
    width: 26px;
}

.receipt-items th:last-child,
.receipt-items td:last-child {
    text-align: right;
    width: 72px;
}

.receipt-items span {
    font-size: 10px;
}

.receipt-qr {
    border: 1px solid #000;
    min-height: 44px;
    display: grid;
    place-items: center;
    margin: 8px auto;
    padding: 8px;
    text-align: center;
}

@page {
    size: 80mm auto;
    margin: 0;
}

@media print {
    html,
    body {
        width: 80mm;
        margin: 0;
        padding: 0;
        background: #fff;
        color: #000;
    }

    body * {
        visibility: hidden;
    }

    .app-shell,
    .main {
        display: block;
        min-height: auto;
        padding: 0;
        margin: 0;
    }

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

    #printReceipt,
    #printReceipt * {
        visibility: visible;
    }

    #printReceipt {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        padding: 2mm;
        margin: 0;
        border: 0;
        box-shadow: none;
    }

    #printReceipt.receipt-58 {
        width: 58mm;
    }

    #printReceipt.receipt-a4 {
        width: 190mm;
    }

    .receipt-items th,
    .receipt-items td {
        border-bottom: 0;
    }
}

@media (max-width: 860px) {
    .auth-shell, .app-shell, .grid-2, .stat-grid, .dashboard-grid, .quick-actions, .billing-shell {
        grid-template-columns: 1fr;
    }

    .auth-art {
        display: none;
    }

    .sidebar {
        position: static;
    }

    .page-title, .topbar, .search-row {
        align-items: stretch;
        flex-direction: column;
    }

    .cart-row, .cart-controls {
        grid-template-columns: 1fr;
    }
}
