:root {
    --bg: #f5f7f8;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #64748b;
    --line: #d9e0e7;
    --primary: #0f766e;
    --primary-strong: #0b5f59;
    --danger: #b42318;
    --warning: #b45309;
}

* {
    box-sizing: border-box;
}

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

a {
    color: inherit;
    text-decoration: none;
}

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

.sidebar {
    background: #17212b;
    color: #eef4f4;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 22px;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    border-radius: 8px;
    color: #cbd5e1;
    padding: 10px 12px;
}

.nav a.active,
.nav a:hover {
    background: #243241;
    color: #ffffff;
}

.admin-notice {
    align-items: center;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    color: #92400e;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.admin-notice div {
    display: grid;
    gap: 3px;
}

.user-box {
    border-top: 1px solid #334155;
    display: grid;
    gap: 5px;
    margin-top: auto;
    padding-top: 16px;
}

.user-box span,
.user-box a {
    color: #cbd5e1;
    font-size: 13px;
}

.user-box a {
    text-decoration: underline;
}

.main {
    padding: 24px;
}

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

.title {
    font-size: 26px;
    line-height: 1.2;
    margin: 0;
}

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

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
}

.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

label {
    color: var(--muted);
    display: block;
    font-size: 13px;
    margin-bottom: 5px;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    font: inherit;
    min-height: 40px;
    padding: 9px 10px;
    width: 100%;
}

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

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

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

.btn.secondary {
    background: #334155;
}

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

.btn.small {
    min-height: 34px;
    padding: 7px 12px;
}

.btn[disabled],
.product-card[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
}

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

.actions form {
    margin: 0;
}

.form-actions {
    align-items: end;
    display: flex;
    gap: 8px;
}

.compact-form {
    align-items: end;
}

.cancel-form {
    display: grid;
    gap: 6px;
    min-width: 210px;
}

.cancel-form input {
    min-height: 34px;
    padding: 7px 9px;
}

.cancel-form .btn,
.actions .btn {
    min-height: 34px;
    padding: 7px 10px;
}

.report-filter select[multiple] {
    min-height: 142px;
}

.report-filter input[type="search"] {
    margin-bottom: 8px;
}

.report-groups {
    display: grid;
    gap: 20px;
}

.report-groups > section > h2 {
    margin: 22px 0 12px;
}

.table-wrap {
    overflow-x: auto;
}

.table-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
}

.table-summary {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.pagination a {
    border: 1px solid var(--line);
    border-radius: 6px;
    min-width: 34px;
    padding: 7px 10px;
    text-align: center;
}

.pagination a.active,
.pagination a:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.pagination.compact {
    align-items: center;
}

.pagination.compact span {
    color: var(--muted);
    padding: 7px 4px;
}

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

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

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

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

.stat-link {
    display: block;
}

.stat-link:hover {
    border-color: var(--warning);
}

.stat strong {
    display: block;
    font-size: 24px;
    margin-top: 6px;
}

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

.low-stock {
    color: var(--warning);
    font-weight: 700;
}

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

.pos-workspace {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.pos-searchbar {
    align-items: center;
    background: #0f6bcb;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 24px 1fr;
    min-height: 48px;
    padding: 5px 6px;
    position: relative;
    width: 100%;
}

.pos-searchbar .search-icon {
    align-items: center;
    color: #ffffff;
    display: flex;
    font-size: 18px;
    justify-content: center;
}

.pos-searchbar input {
    border: 0;
    border-radius: 8px;
    height: 36px;
    min-height: 36px;
    padding: 7px 10px;
    width: 100%;
}

.pos-suggestions {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
    left: 6px;
    max-height: 360px;
    overflow-y: auto;
    position: absolute;
    right: 6px;
    top: 48px;
    z-index: 20;
}

.pos-suggestions:empty {
    display: none;
}

.pos-suggestion {
    align-items: center;
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    text-align: left;
    width: 100%;
}

.pos-suggestion:hover {
    background: #eef6ff;
}

.pos-suggestion:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.pos-suggestion small {
    color: var(--muted);
    display: block;
    margin-top: 3px;
}

.pos-order-area {
    align-items: stretch;
    display: grid;
    min-height: 360px;
}

.empty-cart {
    align-self: center;
    color: var(--muted);
    justify-self: center;
    text-align: center;
}

.empty-icon {
    color: #d5dde7;
    font-size: 70px;
    line-height: 1;
    margin-bottom: 12px;
}

.section-title {
    font-weight: 700;
    margin-bottom: 12px;
}

.pos-payment-panel {
    align-self: start;
    position: sticky;
    top: 18px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}

.product-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    min-height: 112px;
    padding: 12px;
    text-align: left;
}

.product-card:hover {
    border-color: var(--primary);
}

.product-card strong {
    display: block;
    margin-bottom: 8px;
}

.cart-row {
    display: grid;
    grid-template-columns: 1fr 72px 90px 34px;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.cart-row.editable-price {
    grid-template-columns: minmax(180px, 1fr) 72px 96px 34px;
}

.cart-row [data-price] {
    margin-top: 6px;
    min-height: 34px;
    padding: 6px 8px;
}

.cart-row button {
    min-height: 34px;
    padding: 0;
}

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

.totals div {
    display: flex;
    justify-content: space-between;
}

.flash {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    color: #065f46;
    margin-bottom: 18px;
    padding: 12px;
}

.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.auth-body {
    align-items: center;
    background: #eef2f6;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    max-width: 440px;
    padding: 24px;
    width: 100%;
}

.auth-card h1 {
    margin: 0 0 8px;
}

.check {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    display: flex;
    gap: 8px;
    min-height: 40px;
    padding: 9px 10px;
}

.check input {
    min-height: auto;
    width: auto;
}

.check-list {
    display: grid;
    gap: 6px;
}

.quick-form {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.quick-form summary {
    cursor: pointer;
    font-weight: 700;
}

.quick-form-body {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.quick-customer-box details {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
}

.quick-customer-box summary {
    cursor: pointer;
    font-weight: 700;
}

.quick-customer-grid {
    margin-top: 10px;
}

.stock-lines {
    display: grid;
    gap: 8px;
}

.stock-voucher-toolbar {
    align-items: center;
    display: flex;
    justify-content: flex-start;
}

.stock-voucher-panel {
    border: 2px solid var(--primary);
}

.danger-zone {
    border-color: #fecaca;
}

.stock-add-button {
    background: #0f766e;
    min-width: 230px;
}

.stock-add-button:hover {
    background: #0b5f59;
}

.stock-line {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(260px, 1fr) 180px 210px 44px;
}

.stock-line-head {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stock-line .btn {
    min-height: 40px;
    padding: 0;
}

.stepper {
    display: grid;
    grid-template-columns: 38px 1fr 38px;
    gap: 6px;
}

.stepper input {
    text-align: right;
}

@media (max-width: 980px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .nav {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }

    .pos-layout {
        grid-template-columns: 1fr;
    }

    .stock-line {
        grid-template-columns: 1fr;
    }

    .stock-line-head {
        display: none;
    }

    .admin-notice,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .col-3,
    .col-4,
    .col-6,
    .col-8 {
        grid-column: span 12;
    }
}
