:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --line: #dfe3e8;
    --text: #1f2933;
    --muted: #667085;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b42318;
    --warning: #b54708;
    --app-width: 1920px;
    --app-height: 1080px;
    --topbar-height: 64px;
}

* {
    box-sizing: border-box;
}

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

body:not(.mobile) {
    min-height: var(--app-height);
    min-width: var(--app-width);
    width: var(--app-width);
}

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

.topbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 18px;
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    padding: 0 24px;
}

body:not(.mobile) .topbar {
    width: var(--app-width);
}

.store-identity {
    align-items: center;
    border-right: 1px solid var(--line);
    color: var(--text);
    display: inline-flex;
    font-size: 17px;
    font-weight: 800;
    min-height: 40px;
    max-width: 220px;
    padding-right: 18px;
}

.store-identity span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-identity img {
    display: block;
    max-height: 42px;
    max-width: 180px;
    object-fit: contain;
}

.brand {
    color: var(--text);
    font-size: 20px;
    font-weight: 800;
    white-space: nowrap;
}

.quick-register {
    align-items: center;
    background: var(--primary);
    border-radius: 6px;
    color: #ffffff;
    display: inline-flex;
    font-weight: 800;
    min-height: 42px;
    padding: 10px 14px;
    white-space: nowrap;
}

.quick-register:hover {
    background: var(--primary-dark);
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.main-nav a,
.nav-group summary {
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    list-style: none;
    min-height: 42px;
    align-items: center;
    padding: 10px 12px;
}

.main-nav a:hover,
.nav-group summary:hover {
    background: #eef6f5;
}

.nav-home {
    background: #f8fafc;
}

.nav-exit {
    background: #fff1f3;
    color: var(--danger) !important;
}

.nav-exit:hover {
    background: #ffe4e8 !important;
}

.nav-group {
    position: relative;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary::after {
    color: var(--muted);
    content: "▼";
    font-size: 10px;
    margin-left: 7px;
}

.nav-group[open] summary {
    background: #e6f2f1;
    color: var(--primary-dark);
}

.nav-menu {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    display: grid;
    gap: 4px;
    min-width: 190px;
    padding: 8px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
}

.nav-menu a {
    justify-content: flex-start;
    min-height: 44px;
    white-space: nowrap;
}

.container {
    margin: 0 auto;
    max-width: 1200px;
    padding: 24px;
}

.login-shell {
    align-items: center;
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.login-panel {
    display: grid;
    gap: 16px;
    width: 420px;
}

.login-panel h1 {
    margin: 0;
}

body:not(.mobile) .container {
    height: calc(var(--app-height) - var(--topbar-height));
    max-width: none;
    overflow: auto;
    width: var(--app-width);
}

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

.page-title h1 {
    font-size: 28px;
    margin: 0;
}

.grid {
    display: grid;
    gap: 16px;
}

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

.panel,
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.metric {
    font-size: 30px;
    font-weight: 800;
    margin-top: 8px;
}

.muted {
    color: var(--muted);
}

.btn {
    align-items: center;
    background: var(--primary);
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
}

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

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.touch-pressed {
    filter: brightness(0.94);
    transform: translateY(1px);
}

.btn.secondary {
    background: #e6f2f1;
    color: var(--primary-dark);
}

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

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

.filter-bar {
    align-items: end;
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
    padding-bottom: 14px;
}

.filter-bar label {
    min-width: 220px;
}

.pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 18px;
}

.page-link,
.page-gap {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    display: inline-flex;
    justify-content: center;
    min-height: 38px;
    min-width: 38px;
    padding: 8px 10px;
}

.page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    font-weight: 800;
}

.page-link.disabled {
    color: var(--muted);
    pointer-events: none;
}

.page-gap {
    border-color: transparent;
    color: var(--muted);
}

.category-edit-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(180px, 1fr) 110px 110px auto;
}

.exit-panel {
    margin: 120px auto 0;
    max-width: 560px;
    text-align: center;
}

.exit-panel .actions {
    justify-content: center;
    margin-top: 18px;
}

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

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

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

input,
select {
    border: 1px solid #cfd6dd;
    border-radius: 6px;
    font: inherit;
    min-height: 42px;
    padding: 9px 10px;
    width: 100%;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.field-title {
    font-weight: 700;
    margin-bottom: 8px;
}

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

.option-cards label {
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    gap: 6px;
    padding: 12px;
}

.option-cards input {
    min-height: auto;
    width: auto;
}

.option-cards span {
    color: var(--muted);
    font-weight: 400;
}

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

.span-2 {
    grid-column: span 2;
}

.alert {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    color: var(--warning);
    padding: 12px;
}

.alert.success {
    background: #ecfdf3;
    border-color: #abefc6;
    color: #067647;
    margin-bottom: 16px;
}

.alert.info {
    background: #eff8ff;
    border-color: #b2ddff;
    color: #175cd3;
    margin-bottom: 16px;
}

.logo-preview {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 18px;
    padding-top: 18px;
}

.logo-preview img {
    background: #ffffff;
    border: 1px solid var(--line);
    max-height: 80px;
    max-width: 220px;
    padding: 8px;
}

.checkbox-label {
    align-items: center;
    display: flex;
    gap: 8px;
}

.checkbox-label input {
    min-height: auto;
    width: auto;
}

.barcode-preview {
    background: #fff;
    border: 1px dashed #cfd6dd;
    display: inline-block;
    padding: 12px;
}

.product-thumb {
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 6px;
    height: 54px;
    object-fit: cover;
    width: 54px;
}

.product-image-preview {
    align-items: center;
    display: flex;
    gap: 16px;
}

.product-image-preview img {
    border: 1px solid var(--line);
    border-radius: 8px;
    height: 120px;
    object-fit: cover;
    width: 120px;
}

.checkbox-label {
    align-items: center;
    display: inline-flex;
    gap: 8px;
    font-weight: 700;
}

.checkbox-label input {
    min-height: auto;
    width: auto;
}

.cart-list {
    display: grid;
    gap: 10px;
}

.cart-row {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto;
    padding-bottom: 10px;
}

.qty-controls {
    display: flex;
    gap: 6px;
}

.qty-controls button {
    min-height: 40px;
    min-width: 40px;
}

@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px;
    }

    .store-identity {
        border-right: 0;
        max-width: 100%;
        padding-right: 0;
    }

    .main-nav {
        margin-left: 0;
        width: 100%;
    }

    .nav-group {
        width: 100%;
    }

    .nav-home,
    .nav-group summary {
        width: 100%;
    }

    .nav-menu {
        box-shadow: none;
        position: static;
        width: 100%;
    }

    .container {
        padding: 14px;
    }

    .grid-3,
    .form-grid,
    .option-cards {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }
}
