@charset  "utf-8";

:root {
    --primary: #ffb6c1;
    --primary-dark: #ff9eb0;
    --bg: #fff8fa;
    --card: #ffffff;
    --text: #333333;
    --border: #ececec;
    --shadow: 0 10px 30px rgba(0,0,0,.08);
    --radius: 24px;
}

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    padding: 20px;
}

.login-wrapper {
    min-height: calc(100vh - 40px);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: 32px;
    padding: 40px 32px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.qr-scan-back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    text-decoration: none;
}

.qr-scan-back-btn:hover {
    color: var(--primary-dark);
}

.logo-box {
    text-align: center;
    margin-bottom: 16px;
}

.logo-svg {
    width: 64px;
    height: 64px;
    fill: var(--primary);
}

.login-card h1 {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
}

.subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
    font-size: 15px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.input-group input, .input {
    width: 100%;
    height: 54px;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0 16px;
    background: #fff;
    outline: none;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus, .input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 182, 193, 0.3);
}

.date-input {
    padding: 0 10px;
    font-size: 14px;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
}

.date-input::-webkit-datetime-edit {
    padding: 0;
}

.date-input::-webkit-calendar-picker-indicator {
    margin-left: 2px;
    padding: 4px;
}

@media  (max-width: 360px) {
    .date-input {
        font-size: 13px;
        padding: 0 6px;
    }
}

.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 50px !important;
}

.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    user-select: none;
    width: 24px;
    height: 24px;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--primary-dark);
}

.toggle-password svg {
    width: 22px;
    height: 22px;
}

.remember-device-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
}

.remember-device-row input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary-dark, #d9748c);
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    height: 54px;
    border: none;
    border-radius: 16px;
    background: var(--primary);
    color: #000;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

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

.btn-primary:active {
    transform: scale(.98);
}

.forgot-link {
    text-align: center;
    margin-top: 20px;
}

.forgot-link a {
    color: #888;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-link a:hover {
    color: var(--primary-dark);
}

.error-box {
    background: #ffe5e5;
    color: #d8000c;
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.success-box {
    background: #e8fff1;
    color: #1d7a3d;
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.version {
    text-align: center;
    color: #bbb;
    font-size: 13px;
    margin-top: 24px;
}

.qr-scan-card {
    max-width: 440px;
}

.qr-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg);
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 20px;
}

.qr-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #888;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.qr-tab-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.qr-tab.active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.qr-panel {
    margin-bottom: 6px;
}

.qr-reader-frame {
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
}

.qr-reader-frame #reader {
    width: 100%;
}

.qr-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
    color: #888;
    font-size: 13px;
}

.qr-hint-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.qr-upload-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    border: 2px dashed var(--border);
    border-radius: 20px;
    padding: 36px 20px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.qr-upload-drop:hover {
    border-color: var(--primary);
    background: rgba(255, 182, 193, 0.08);
}

.qr-upload-icon {
    width: 40px;
    height: 40px;
    color: var(--primary-dark);
}

.qr-upload-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.qr-upload-hint {
    font-size: 13px;
    color: #999;
}

.qr-upload-preview {
    text-align: center;
}

.qr-upload-preview img {
    width: 220px;
    max-width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    margin-bottom: 14px;
}

.qr-upload-clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: var(--bg);
    color: #888;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
}

.qr-upload-clear:hover {
    color: var(--primary-dark);
}

.qr-upload-clear svg {
    width: 14px;
    height: 14px;
}

.qr-page-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
}

.qr-status-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.qr-page-status-loading {
    background: rgba(0,0,0,.06);
    color: #555;
}

.qr-page-status-success {
    background: #e8fff1;
    color: #1d7a3d;
}

.qr-page-status-error {
    background: #ffe5e5;
    color: #d8000c;
}

@keyframes  qr-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: qr-spin 0.9s linear infinite;
}

.page {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.top-card {
    background: white;
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.welcome {
    color: #888;
    font-size: 14px;
}

.user-name {
    font-size: 22px;
    font-weight: 700;
    margin-top: 4px;
}

.role-badge {
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.staff-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}

.staff-status-badge.is-online {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.staff-status-badge.is-offline {
    background: rgba(148, 163, 184, 0.15);
    color: #64748b;
}

.staff-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.menu-card {
    background: white;
    text-decoration: none;
    color: var(--text);
    border-radius: 24px;
    padding: 24px 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.menu-card:active {
    transform: scale(.97);
}

.menu-icon {
    width: 34px;
    height: 34px;
    fill: var(--primary-dark);
    margin-bottom: 10px;
}

.menu-card span {
    display: block;
    font-weight: 600;
}

.placeholder-card {
    background: white;
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.placeholder-card h2 {
    margin-bottom: 10px;
    font-size: 20px;
}

.placeholder-card p {
    color: #777;
    line-height: 1.5;
}

.logout-btn {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    background: #ff6b6b;
    color: white;
    padding: 16px;
    border-radius: 18px;
    font-weight: 600;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #ff5252;
}

.logout-btn.btn-primary-style {
    background: var(--primary);
    color: #000;
}
.logout-btn.btn-primary-style:hover {
    background: var(--primary-dark);
}

.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: var(--card);
    border-radius: 24px;
    padding: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.nav-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    border-radius: 16px;
    text-decoration: none;
    overflow: hidden;
    transition: background 0.2s ease, transform 0.1s ease;
}

button.nav-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.nav-btn svg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    max-width: 24px;
    flex-shrink: 0;
    fill: none;
    stroke: #000000;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s ease;
}

.nav-btn:hover {
    background: #fdf1f4;
}

.nav-btn:active {
    transform: scale(.94);
}

.nav-btn.active {
    background: var(--primary);
}

.nav-btn.active svg {
    stroke: #ffffff;
}

.nav-btn.nav-logout svg {
    stroke: #ff6b6b;
}

.nav-btn.nav-logout:hover {
    background: #ffe5e5;
}

.card-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: var(--primary-dark);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -5px;
    margin-right: 8px;
    flex-shrink: 0;
}

.card-icon-sm {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #ff6b6b;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -4px;
    margin-right: 6px;
    flex-shrink: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px 10px;
    text-align: center;
    box-shadow: var(--shadow);
    min-width: 0;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
    white-space: nowrap;
}

.stat-card .stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
    line-height: 1.2;
}

.search-wrap {
    position: relative;
    margin-bottom: 20px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 4px 4px 4px 16px;
    gap: 8px;
}

.search-bar svg {
    width: 20px;
    height: 20px;
    stroke: #999;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    height: 48px;
    padding: 0 10px;
    font-size: 15px;
    background: transparent;
}

.search-scan-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 14px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.search-scan-btn svg {
    stroke: #fff;
    width: 20px;
    height: 20px;
}

#btnOrderVoucherScan,
#btnReturnVoucherScan,
#btnShipVoucherScan {
    display: none;
}

.search-scan-btn.date-filter-btn {
    background: #fff;
    border: 1px solid #e5e7eb;
}

.search-scan-btn.date-filter-btn svg {
    stroke: #6b7280;
}

.search-bar:has(#btnReturnDateFilter) {
    padding-right: 6px;
}

.search-bar:has(.cat-filter-wrap) {
    padding-right: 6px;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    z-index: 20;
    display: none;
    overflow: hidden;
}

.search-suggestions.show {
    display: block;
}

.suggestions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: #999;
}

.suggestions-header button {
    border: none;
    background: #f4f4f4;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #777;
}

.suggestions-body {
    max-height: 360px;
    overflow-y: auto;
}

.suggestion-group {
    border-bottom: 1px solid var(--border);
}

.suggestion-group:last-child {
    border-bottom: none;
}

.suggestion-group-title {
    font-weight: 700;
    font-size: 13px;
    padding: 10px 14px 4px;
    color: var(--text);
}

.suggestion-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
}

.suggestion-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.suggestion-size {
    font-size: 13px;
    font-weight: 600;
}

.suggestion-code {
    font-size: 11px;
    color: #999;
}

.suggestion-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.suggestion-source-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eaf2ff;
    color: #4f7fe0;
    margin-bottom: 2px;
}
.suggestion-source-badge.is-return {
    background: #fff0f4;
    color: #d6316b;
}
.suggestion-source-badge.is-merged {
    background: #eef7f0;
    color: #1e8a4c;
}

.qty-stepper-sm {
    height: 30px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.qty-stepper-sm button {
    width: 26px;
    height: 28px;
    font-size: 14px;
    border: none;
    background: #f4f4f4;
    cursor: pointer;
    border-radius: 6px;
}

.qty-stepper-sm .sg-qty {
    width: 30px;
    display: inline-block;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.qty-stepper-sm .sg-qty-input {
    width: 34px;
    border: none;
    background: transparent;
    padding: 2px 0;
    border-radius: 6px;
    font-family: inherit;
    color: inherit;
    -moz-appearance: textfield;
}

.qty-stepper-sm .sg-qty-input::-webkit-outer-spin-button,
.qty-stepper-sm .sg-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-stepper-sm .sg-qty-input:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 1.5px var(--primary, #d9748c);
}

.sg-print, .sg-edit, .sg-delete {
    width: 28px;
    height: 28px;
    padding: 0;
    box-sizing: border-box;
    border: none;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.sg-print {
    background: #fdf1f4;
    color: var(--primary-dark);
}

.sg-edit {
    background: #eaf2ff;
    color: #4f7fe0;
}

.sg-delete {
    background: #ffe5e5;
    color: #ff6b6b;
}

.edit-modal-title {
    font-size: 16px;
    margin: 0 0 12px;
}

.edit-modal-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 14px;
}

.edit-modal-message {
    font-size: 13px;
    padding: 9px 12px;
    border-radius: 10px;
    margin-top: 6px;
}

.edit-modal-error {
    background: #ffecec;
    color: #c0392b;
}

.edit-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.edit-btn-cancel,
.edit-btn-save {
    flex: 1 1 0;
    min-width: 0;
    height: 48px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 0 6px;
}

.edit-btn-cancel {
    border: 1.5px solid var(--primary);
    background: #fff;
    color: var(--primary-dark);
}

.edit-btn-save {
    border: none;
    background: var(--primary);
    color: #fff;
}

.edit-btn-cancel:disabled,
.edit-btn-save:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.suggestion-empty {
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

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

.price-input-wrap input {
    padding-right: 40px !important;
}

.price-unit-badge {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 14px;
    pointer-events: none;
}

.price-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

.size-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0;
}

.size-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
}

.size-row .size-picker-wrap {
    flex: 1 1 56px;
    min-width: 48px;
    position: relative;
}

.row-size-input {
    width: 100%;
    box-sizing: border-box;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 6px;
    font-size: 13px;
    background: #fff;
    outline: none;
}

.size-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
}

.size-picker-dropdown.show { display: block; }

.size-picker-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 7px 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    color: #111827;
    text-align: left;
    cursor: pointer;
}

.size-picker-item:hover { background: #f3f4f6; }

.size-picker-empty { padding: 8px; font-size: 12.5px; color: #9ca3af; }

.qty-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    flex: 1;
}

.size-row .qty-stepper {
    flex: 0 0 96px;
    min-width: 96px;
}

.qty-stepper button {
    width: 28px;
    height: 44px;
    border: none;
    background: #f7f7f7;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
    cursor: pointer;
    flex-shrink: 0;
}

.qty-stepper input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 44px;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    padding: 0;
}

.size-row-delete {
    width: 38px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: #ffe5e5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 38px;
    flex-shrink: 0;
}

.size-row-delete svg {
    width: 16px;
    height: 16px;
    stroke: #ff6b6b;
    fill: none;
    stroke-width: 2;
}

.add-row-btn {
    width: 100%;
    height: 46px;
    border: 1.5px dashed var(--primary);
    border-radius: 14px;
    background: #fff;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

.category-panel {
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.category-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    cursor: pointer;
    user-select: none;
}

.category-toggle h2 {
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-toggle .chevron {
    width: 18px;
    height: 18px;
    stroke: #999;
    fill: none;
    stroke-width: 2.5;
    transition: transform 0.3s ease;
}

.category-panel.collapsed .chevron {
    transform: rotate(-90deg);
}

.category-content {
    max-height: 1000px;
    transition: max-height 0.3s ease-in-out;
    border-top: 1px solid var(--border);
    padding: 16px;
}

.category-panel.collapsed .category-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top-color: transparent;
}

.category-add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.category-add-row input {
    flex: 1;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    font-size: 14px;
    outline: none;
}

.category-add-row button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.category-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}

.category-list-item input {
    flex: 1;
    height: 40px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0 10px;
    font-size: 14px;
    background: transparent;
}

.category-list-item input:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
}

.cat-icon-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.cat-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: var(--text);
    fill: none;
    stroke-width: 2;
}

.cat-icon-btn.danger svg {
    stroke: #ff6b6b;
}

.held-orders-row {
    display: none;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    margin-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}
.held-orders-row.show { display: flex; }
.held-order-chip {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 8px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
}
.held-order-chip.active {
    border-color: var(--primary);
    background: #fff0f3;
}
.held-order-chip-info { display: flex; flex-direction: column; line-height: 1.25; }
.held-order-chip-label { font-weight: 700; font-size: 13px; color: var(--text); }
.held-order-chip-meta { font-size: 11.5px; color: #888; }
.held-order-chip-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    color: #888;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.held-order-chip-close:hover { background: #ffe0e0; color: #d33; }

.btn-outline {
    flex: 1;
    height: 52px;
    border: 1.5px solid var(--primary);
    border-radius: 16px;
    background: #fff;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-solid {
    flex: 1;
    height: 52px;
    border: none;
    border-radius: 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-solid-light {
    flex: 0 1 auto;
    height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 14px;
    background: #ffe3e8;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-outline:disabled,
.btn-solid:disabled,
.btn-solid-light:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    margin-top: 16px;
}

.form-label:first-child {
    margin-top: 0;
}

.qr-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.qr-modal.show {
    display: flex;
}

.qr-modal-card {
    background: #fff;
    border-radius: 20px;
    padding: 16px;
    width: 90%;
    max-width: 360px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.qr-modal-close-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: #ffecec;
    color: #ff6b6b;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.qr-modal-close-icon:hover,
.qr-modal-close-icon:active {
    background: #ffd9d9;
}

.qr-modal-close-icon svg {
    width: 14px;
    height: 14px;
}

.qr-modal-close {
    width: 100%;
    height: 44px;
    border: 1.5px solid var(--primary);
    border-radius: 12px;
    background: #fdf1f4;
    color: var(--primary-dark);
    font-weight: 700;
    margin-top: 12px;
    cursor: pointer;
}

.qr-modal-close:hover {
    background: #ffe3e8;
}

.qr-modal-close:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.qr-reader-box-wrap {
    position: relative;
}

.qr-scan-status {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    max-width: 92%;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: #fff;
    background: rgba(0,0,0,.75);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qr-scan-status.show {
    opacity: 1;
}

.qr-scan-status.qr-status-success {
    background: rgba(46,204,113,.92);
}

.qr-scan-status.qr-status-error {
    background: rgba(255,107,107,.92);
}

.qr-scan-status.qr-status-info {
    background: rgba(0,0,0,.65);
}

.qr-scan-counter {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-top: 10px;
}

@media  (max-width: 480px) {
    .nav-bar {
        padding: 8px;
        gap: 4px;
    }

    .nav-btn {
        height: 46px;
    }

    .nav-btn svg {
        width: 22px;
        height: 22px;
    }

    .stats-grid {
        gap: 6px;
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-card {
        padding: 8px 2px;
        border-radius: 14px;
    }

    .stat-card .stat-label {
        font-size: 10px;
        white-space: normal;
    }

    .stat-card .stat-value {
        font-size: 12px;
    }
}

.pos-topbar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--card);
    border-radius: 24px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.pos-topbar-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pos-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.pos-user-name {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-user-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.pos-user-settings-btn {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: #fdf1f4;
    color: #000;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.pos-user-settings-btn:active {
    background: #f5dbe2;
}

.pos-logout-btn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #ffe5e5;
    color: #ff4d4d;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    text-decoration: none;
}

.pos-logout-btn:active {
    background: #ffd0d0;
}

.pos-topbar-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.pos-nav-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.pos-page-actions {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-shrink: 0;
    margin-left: auto;
}

.pos-page-actions .pos-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 15px;
}

.pos-page-actions .pos-icon-btn svg {
    width: 22px;
    height: 22px;
}

/* Biến thể của .pos-page-actions dùng cho staff: đặt cùng hàng với tên nhân viên
   (thay vì hàng riêng bên dưới), nút to hơn và giãn cách rộng hơn để hiện label. */
.pos-page-actions-top {
    gap: 26px;
    margin-left: 0;
    flex-shrink: 0;
}

.pos-page-actions-top .pos-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 15px;
}

.pos-page-actions-top .pos-icon-btn svg {
    width: 22px;
    height: 22px;
}

.pos-page-actions-top .pos-icon-label {
    font-size: 11.5px;
}

.pos-icon-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.pos-icon-label {
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
    text-align: center;
    transition: transform 0.2s ease;
}

.pos-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: #fdf1f4;
    color: #000000;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.pos-icon-logout {
    background: #ffe5e5;
    color: #ff6b6b;
}

.pos-icon-alert {
    background: #fff0f0;
    color: #ff6b6b;
    position: relative;
}

.pos-icon-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ff6b6b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
}

.pos-icon-kho {
    background: #ffe3c2;
    color: #f2872f;
}

.pos-icon-btn.is-active {
    transform: scale(1.2);
    --pa-glow: rgba(0, 0, 0, 0.25);
    animation: posIconGlow 1.6s ease-in-out infinite;
}

.pos-icon-btn.is-active + .pos-icon-label {
    transform: translateY(4px);
}

.pos-icon-kho.is-active {
    --pa-glow: rgba(242, 135, 47, 0.35);
}

.pos-icon-pos {
    background: #dceeff;
    color: #2b7dff;
}

.pos-icon-pos.is-active {
    --pa-glow: rgba(43, 125, 255, 0.35);
}

.pos-icon-settings {
    background: #ece6fa;
    color: #7c4dff;
}

.pos-icon-settings.is-active {
    --pa-glow: rgba(124, 77, 255, 0.35);
}

.pos-icon-history {
    background: #d9f5f0;
    color: #12a894;
}

.pos-icon-history.is-active {
    --pa-glow: rgba(18, 168, 148, 0.35);
}

@keyframes posIconGlow {
    0%, 100% {
        box-shadow: 0 0 5px 1px var(--pa-glow);
    }
    50% {
        box-shadow: 0 0 12px 4px var(--pa-glow);
    }
}

@media (max-width: 480px) {
    .pos-topbar {
        padding: 16px 14px;
    }

    .pos-topbar-actions {
        flex-wrap: nowrap;
        gap: 10px;
    }

    .pos-nav-group {
        gap: 16px;
    }

    .pos-page-actions {
        gap: 14px;
    }

    .pos-page-actions .pos-icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 14px;
    }

    .pos-page-actions .pos-icon-btn svg {
        width: 20px;
        height: 20px;
    }

    .pos-nav-group + .pos-page-actions {
        margin-left: 0;
    }

    .pos-icon-btn {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .pos-icon-btn svg {
        width: 18px;
        height: 18px;
    }

    .pos-icon-btn.is-active {
        transform: scale(1.1667);
    }

    .pos-icon-btn.is-active + .pos-icon-label {
        transform: translateY(3px);
    }

    .pos-icon-label {
        font-size: 9.5px;
    }

    .pos-page-actions .pos-icon-label {
        display: none;
    }

    .pos-page-actions-top {
        gap: 18px;
    }

    .pos-page-actions-top .pos-icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 14px;
    }

    .pos-page-actions-top .pos-icon-btn svg {
        width: 20px;
        height: 20px;
    }

    .pos-page-actions-top .pos-icon-label {
        display: block;
        font-size: 10px;
    }

    .pos-icon-btn.pos-icon-kho,
    .pos-icon-btn.pos-icon-pos {
        width: 40px;
        height: 40px;
    }

    .pos-icon-btn.pos-icon-kho svg,
    .pos-icon-btn.pos-icon-pos svg {
        width: 20px;
        height: 20px;
    }

    .pos-icon-btn.pos-icon-kho.is-active,
    .pos-icon-btn.pos-icon-pos.is-active {
        transform: scale(1.2);
    }

    .pos-icon-btn.pos-icon-kho.is-active + .pos-icon-label,
    .pos-icon-btn.pos-icon-pos.is-active + .pos-icon-label {
        transform: translateY(4px);
    }
}

@media (max-width: 360px) {
    .pos-topbar {
        padding: 14px 10px;
    }

    .pos-topbar-actions {
        gap: 8px;
    }

    .pos-nav-group {
        gap: 12px;
    }

    .pos-page-actions {
        gap: 10px;
    }

    .pos-page-actions .pos-icon-btn {
        width: 36px;
        height: 36px;
    }

    .pos-page-actions .pos-icon-btn svg {
        width: 18px;
        height: 18px;
    }

    .pos-page-actions-top {
        gap: 12px;
    }

    .pos-page-actions-top .pos-icon-btn {
        width: 36px;
        height: 36px;
    }

    .pos-page-actions-top .pos-icon-btn svg {
        width: 18px;
        height: 18px;
    }

    .pos-page-actions-top .pos-icon-label {
        font-size: 8.5px;
    }

    .pos-icon-btn {
        width: 33px;
        height: 33px;
    }

    .pos-icon-btn svg {
        width: 16px;
        height: 16px;
    }

    .pos-icon-btn.is-active {
        transform: scale(1.1818);
    }

    .pos-icon-btn.is-active + .pos-icon-label {
        transform: translateY(3px);
    }

    .pos-icon-label {
        font-size: 9px;
    }

    .pos-icon-btn.pos-icon-kho,
    .pos-icon-btn.pos-icon-pos {
        width: 40px;
        height: 40px;
    }

    .pos-icon-btn.pos-icon-kho svg,
    .pos-icon-btn.pos-icon-pos svg {
        width: 20px;
        height: 20px;
    }

    .pos-icon-btn.pos-icon-kho.is-active,
    .pos-icon-btn.pos-icon-pos.is-active {
        transform: scale(1.2);
    }

    .pos-icon-btn.pos-icon-kho.is-active + .pos-icon-label,
    .pos-icon-btn.pos-icon-pos.is-active + .pos-icon-label {
        transform: translateY(4px);
    }
}

.quick-check-panel {
    display: none;
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 16px;
}

.quick-check-panel.show {
    display: block;
}

.quick-check-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-check-top .search-bar {
    flex: 1;
    min-width: 0;
}

.qc-close-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    border-radius: 14px;
    background: #f4f4f4;
    color: #000;
    font-size: 16px;
    cursor: pointer;
}

.qc-table-wrap {
    max-height: 320px;
    overflow-y: auto;
    margin-top: 10px;
}

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

.qc-table thead th {
    position: sticky;
    top: 0;
    background: var(--card);
    text-align: left;
    font-size: 11px;
    color: #999;
    font-weight: 600;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border);
}

.qc-table thead th:not(:first-child),
.qc-table td:not(:first-child) {
    text-align: center;
}

.qc-table tbody td {
    padding: 8px 4px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.qc-name-cell {
    text-align: left !important;
}

.qc-name {
    font-weight: 600;
    line-height: 1.3;
}

.qc-code {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.qc-empty {
    text-align: center !important;
    color: #999;
    padding: 16px 0 !important;
}

.pos-tabs {
    display: flex;
    background: transparent;
    border-radius: 16px;
    padding: 0;
    margin-bottom: 18px;
    gap: 8px;
}

.pos-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1.5px solid #e6e6e6;
    background: var(--card);
    padding: 10.5px 6px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    color: #999;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}

.pos-tab-btn svg {
    flex-shrink: 0;
    opacity: .8;
}

.pos-tab-btn.active {
    border-color: #ff5c8a;
    background: #fff0f4;
    color: #d6316b;
    box-shadow: 0 4px 12px rgba(255,92,138,.18);
}

.pos-tab-btn.active svg {
    opacity: 1;
}

.pos-tabpanel {
    display: none;
}

.pos-tabpanel.active {
    display: block;
}

.cart-empty {
    text-align: center;
    color: #999;
    padding: 20px;
    background: var(--card);
    border-radius: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.voucher-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 4px 4px 4px 16px;
    margin-bottom: 8px;
}

.voucher-box svg {
    color: #999;
    flex-shrink: 0;
}

.voucher-box input {
    flex: 1;
    border: none;
    outline: none;
    height: 44px;
    font-size: 14px;
    background: transparent;
}

.voucher-result {
    font-size: 13px;
    margin-bottom: 16px;
    padding: 0 6px;
}

.voucher-ok {
    color: #2ecc71;
    font-weight: 600;
}

.voucher-fail {
    color: #ff6b6b;
    font-weight: 600;

}

.summary-card {
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
    padding: 6px 0;
}

.summary-total {
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.cash-row-label {
    font-size: 13px;
    color: #999;
    margin-top: 16px;
    margin-bottom: 8px;
}

.cash-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.cash-chip {
    border: 1px solid var(--border);
    background: #fafafa;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
    box-sizing: border-box;
    text-align: center;
}

.cash-chip:active {
    background: var(--primary);
    color: #000;
}

.smart-cash-chip {
    flex: 0 0 calc((100% - 16px) / 3);
}

.cash-chip-transfer {
    flex: 0 0 100%;
    order: 1;
    margin-top: 4px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.smart-cash-chip {
    border-color: #e6a8c2;

    background: #fdf1f6;
    color: #a44b76;
    font-weight: 600;
    padding: 7px 4px;
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-cash-chip:active {
    background: #e6a8c2;
    color: #fff;
}

.cash-chip[data-amount="100000"] {
    border-color: #1f9d55;
    background: #e6f7ec;
    color: #146c39;
    font-weight: 600;
}
.cash-chip[data-amount="100000"]:active {
    background: #1f9d55;
    color: #fff;
}

.cash-chip[data-amount="200000"] {
    border-color: #b55a34;
    background: #fbece3;
    color: #8a3f22;
    font-weight: 600;
}
.cash-chip[data-amount="200000"]:active {
    background: #b55a34;
    color: #fff;
}

.cash-chip[data-amount="300000"] {
    border-color: #b23e82;
    background: #fbe9f2;
    color: #85235d;
    font-weight: 600;
}
.cash-chip[data-amount="300000"]:active {
    background: #b23e82;
    color: #fff;
}

.cash-chip[data-amount="400000"] {
    border-color: #2f7fd6;
    background: #e8f2fd;
    color: #1c5aa0;
    font-weight: 600;
}
.cash-chip[data-amount="400000"]:active {
    background: #2f7fd6;
    color: #fff;
}

.cash-chip[data-amount="500000"] {
    border-color: #3d4f8f;
    background: #eaedf7;
    color: #2b3868;
    font-weight: 600;
}
.cash-chip[data-amount="500000"]:active {
    background: #3d4f8f;
    color: #fff;
}

.cash-chip[data-amount="1000000"] {
    border-color: #b8860b;
    background: #fdf6e0;
    color: #8a6508;
    font-weight: 600;
}
.cash-chip[data-amount="1000000"]:active {
    background: #b8860b;
    color: #fff;
}

.cash-input {
    width: 100%;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 14px;
    font-size: 15px;
    text-align: right;
    font-weight: 600;
}

.cash-input-bordered {
    border: 1.5px solid var(--primary-dark);
}

.cash-input-bordered:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 2px rgba(255, 158, 176, 0.25);
}

.change-row {
    margin-top: 12px;
    text-align: right;
    font-weight: 700;
    font-size: 15px;
}

.change-positive {
    color: #2ecc71;
}

.change-negative {
    color: #ff6b6b;
}

.pos-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.pos-action-row .btn-outline,
.pos-action-row .btn-solid {
    flex: 1;
    height: 52px;
}

.cash-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 10px;
}

.cash-input-row .cash-row-label {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.cash-input-row .cash-input-inline-wrap {
    flex: 0 1 170px;
    min-width: 120px;
}

.cash-input-row .cash-input-inline-wrap .cash-input {
    width: 100%;
    height: 42px;
    margin: 0;
    font-size: 15px;
}

/* Hàng "Chuyển khoản" + ô nhập tiền, 2 khối tương đồng nhau */
.cash-input-row-paired {
    justify-content: stretch;
}
.cash-input-row-paired .cash-chip-transfer {
    flex: 1 1 0;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    margin: 0;
    white-space: nowrap;
}
.cash-input-row-paired .cash-input-inline-wrap {
    flex: 1 1 0;
    min-width: 0;
}

#orderCashChipRow,
#returnCashChipRow,
#shipCashChipRow {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 0;
}

#orderCashChipRow .smart-cash-chip,
#returnCashChipRow .smart-cash-chip,
#shipCashChipRow .smart-cash-chip {
    flex: 1 1 0;
    width: auto;
    height: 40px;
    padding: 0 4px;
}

#orderChangeRow,
#returnChangeRow,
#shipChangeRow {
    margin-top: 8px;
}

.pos-btn-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.pos-btn-grid2 > button,
.pos-btn-grid2 > a {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-sizing: border-box;
}

.pos-btn-grid2 .icon-btn-square {
    border-radius: 12px;
    border: 1px solid #f3d3dd;
    background: #fdf1f4;
    color: var(--primary-dark);
}

.pos-btn-grid2 .icon-btn-square:hover {
    background: #f8dee6;
}

.pos-btn-grid2 .icon-btn-square:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.pos-btn-grid2-checkout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.pos-btn-grid2-checkout > button {
    width: 100%;
    height: 48px;
    margin: 0;
    flex: none;
}

.pos-btn-grid2-checkout > button:only-child {
    grid-column: 1 / -1;
}

.pos-btn-grid2-checkout .btn-checkout-print {
    background: #fdf1f4;
    color: #ff4d6d;
    border: 2px solid #ff4d6d;
}

.pos-btn-grid2-checkout .btn-checkout-noprint {
    font-size: 12.5px;
}

/* Giống pos-btn-grid2 nhưng có thêm nút vuông "Cài đặt máy in" (cột đầu, rộng cố định 44px)
   đứng trước nút in/tạo phiếu - dùng ở cả 3 tab Tạo đơn / Đổi hoàn / Ship. */
.pos-btn-grid3 {
    display: grid;
    grid-template-columns: 44px 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.pos-btn-grid3 > button,
.pos-btn-grid3 > a {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-sizing: border-box;
}

.pos-btn-grid3 .icon-btn-square {
    border-radius: 12px;
    border: 1px solid #f3d3dd;
    background: #fdf1f4;
    color: var(--primary-dark);
}

.pos-btn-grid3 .icon-btn-square:hover {
    background: #f8dee6;
}

.pos-btn-grid3 .icon-btn-square:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.pos-btn-grid3 .icon-btn-square-gear {
    padding: 0;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
}

.pos-btn-grid3 .icon-btn-square-gear:hover {
    background: #f3f4f6;
}

.pos-btn-grid3 .icon-btn-square-gear:active {
    background: #e5e7eb;
}

.section-title {
    font-weight: 700;
    font-size: 14px;
    margin: 18px 4px 10px;
    color: var(--text);
}

.invoice-info-card {
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 14px 16px;
    margin-bottom: 6px;
}

.invoice-info-code {
    font-weight: 700;
    font-size: 15px;
}

.invoice-info-meta {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.invoice-info-card-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.invoice-info-reset-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #ffecec;
    color: #ff6b6b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
}

.invoice-info-reset-btn:hover,
.invoice-info-reset-btn:active {
    background: #ffd9d9;
}

.return-item-row {
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 12px 14px;
    margin-bottom: 10px;
}

.return-item-disabled {
    opacity: .5;
}

.return-item-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.return-item-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-dark);
    flex-shrink: 0;
}

.return-item-name {
    font-weight: 600;

    font-size: 14px;
}

.return-item-meta {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    margin-left: 28px;
}

.return-item-qty {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    margin-left: 28px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.return-item-amount {
    font-weight: 700;
    color: var(--primary-dark);
}

.diff-banner {
    margin-top: 10px;
    padding: 12px;
    border-radius: 14px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    background: #f7f7f7;
    color: #999;
}

.diff-refund {
    background: #e8fbf0;
    color: #2ecc71;
}

.diff-collect {
    background: #ffecec;
    color: #ff6b6b;
}

.diff-zero {
    background: #f7f7f7;
    color: #999;
}

.recipient-card {
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
}

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

.input-clear-wrap input {
    padding-right: 40px;
}

.input-clear-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: #ffecec;
    color: #ff6b6b;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.input-clear-btn:hover,
.input-clear-btn:active {
    background: #ffd9d9;
}

.input-clear-btn svg {
    width: 11px;
    height: 11px;
    stroke: #ff3b30;
    color: #ff3b30;
}

.input-clear-wrap .input-clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    min-height: 0;
    flex: none;
    padding: 0;
    font-weight: 400;
    white-space: normal;
    border-radius: 50%;
    box-sizing: border-box;
}

.input-clear-wrap input:not(:placeholder-shown) ~ .input-clear-btn {
    display: flex;
}

.search-bar input:not(:placeholder-shown) ~ .input-clear-btn,
.voucher-box input:not(:placeholder-shown) ~ .input-clear-btn {
    display: flex;
}

.report-range-tabs a.pos-tab-btn {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-range-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.custom-range-form .input {
    flex: 1;
    min-width: 120px;
}

.custom-range-form .btn-solid {
    flex-shrink: 0;
    width: auto;
    padding: 0 18px;
}

.report-range-label {
    font-size: 13px;
    color: #999;
    margin-bottom: 16px;
    text-align: center;
}

.report-note {
    font-size: 12px;
    color: #aaa;
    margin: -10px 4px 20px;
}

.value-green {
    color: #2ecc71 !important;
}

.value-red {
    color: #ff6b6b !important;
}

.report-card {
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}

.report-card h2 {
    font-size: 15px;
    margin: 0 0 14px;
}

.report-empty {
    color: #999;
    font-size: 13px;
    text-align: center;
    padding: 10px 0;
}

.report-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.report-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.report-row-rank {
    font-weight: 700;
    color: var(--primary-dark);
    width: 26px;
    flex-shrink: 0;
}

.report-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.report-row-title {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-row-sub {
    font-size: 12px;
    color: #999;
}

.report-row-value {
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    text-align: right;
}

.order-type-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}

.tag-store {
    background: #eef4ff;
    color: #5b8def;
}

.tag-ship {
    background: #fff2e0;
    color: #ff9f43;
}

.order-type-tag.tag-return {
    background: #fde8e8;
    color: #c0392b;
}

.chart-scroll {
    overflow-x: auto;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 140px;
    min-width: min-content;
    padding-top: 10px;
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 26px;
    height: 100%;
    flex-shrink: 0;
}

.bar-fill {
    width: 14px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 6px 6px 0 0;
    min-height: 3px;
}

.bar-label {
    font-size: 9px;
    color: #999;
    margin-top: 6px;
    white-space: nowrap;
}

.report-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 4px 12px;
}

.report-section-header h2 {
    font-size: 16px;
    margin: 0;
}

.btn-add-customer {
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
}

.customer-panel .customer-view p {
    margin: 6px 0;
    font-size: 14px;
}

.customer-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.btn-delete-customer {
    color: #ff6b6b;
    font-size: 14px;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: 600;
}

.sr-table-wrap {
    max-height: 320px;
    overflow-y: auto;
    margin-top: 4px;
}

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

.sr-table thead th {
    position: sticky;
    top: 0;
    background: var(--card);
    text-align: left;
    font-size: 11px;
    color: #999;
    font-weight: 600;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border);
}

.sr-table thead th:not(:first-child),
.sr-table td:not(:first-child) {
    text-align: center;
}

.sr-table tbody td {
    padding: 8px 4px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.sr-name {
    text-align: left !important;
    font-weight: 600;
}

.sr-code {
    font-weight: 400;
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

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

.sr-out {
    color: #ff6b6b;
    font-weight: 700;
}

.sr-add-btn {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sr-add-btn:disabled {
    background: #eee;
    color: #bbb;
    cursor: not-allowed;
}

.sr-empty {
    text-align: center !important;
    color: #999;
    padding: 16px 0 !important;
}

.cart-table-wrap {
    position: relative;
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 34px 6px 4px;
    margin-bottom: 16px;
}

.btn-hold-order-mini {
    position: absolute;
    top: 6px;
    right: 6px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 10px 0 8px;
    border: 1px solid #f3d3dd;
    border-radius: 8px;
    background: #fdf1f4;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    z-index: 2;
}
.btn-hold-order-mini svg { flex-shrink: 0; }

.btn-hold-order-mini:hover { background: #f8dee6; }
.btn-hold-order-mini:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.cart-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.cart-table thead th:nth-child(1) { width: 42%; }
.cart-table thead th:nth-child(2) { width: 20%; }
.cart-table thead th:nth-child(3) { width: 20%; }
.cart-table thead th:nth-child(4) { width: 12%; }
.cart-table thead th:nth-child(5) { width: 6%; }

.cart-table thead th {
    text-align: center;
    font-size: 10px;
    color: #999;
    font-weight: 600;
    padding: 6px 2px;
    border-bottom: 1px solid var(--border);
}

.cart-table thead th:nth-child(1) {
    text-align: left;
}

.cart-table tbody td {
    padding: 6px 2px;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: center;
    word-break: break-word;
}

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

.ct-name {
    text-align: left !important;
}

.ct-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ct-name-col {
    min-width: 0;
}

.ct-pname {
    font-weight: 600;
    font-size: 12px;
    line-height: 1.25;
}

.ct-pcode {
    font-size: 10px;
    color: #999;
    margin-top: 1px;
}

.ct-pmeta {
    font-size: 10px;
    color: #888;
    margin-top: 1px;
}

.ct-total {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 12px;
}

.ct-discount-cell {
    position: relative;
    overflow: visible;
}

.discount-picker-wrap {
    position: relative;
}

.discount-picker-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 3px;
    font-size: 11px;
    text-align: center;
    background: #fafafa;
    outline: none;
}

.discount-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    width: 118px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
}

.discount-picker-dropdown.show { display: block; }

.discount-picker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 7px 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 12.5px;
    color: #111827;
    text-align: center;
    cursor: pointer;
}

.discount-picker-item:hover { background: #f3f4f6; }

.discount-picker-custom {
    margin-top: 4px;
    padding-top: 9px;
    border-top: 1px solid var(--border);
    color: var(--primary-dark);
    font-weight: 600;
}

.cart-line-delete,
.cart-qty-minus, .cart-qty-plus,
.return-cart-delete,
.return-cart-qty-minus, .return-cart-qty-plus,
.ship-cart-delete,
.ship-qty-minus, .ship-qty-plus,
.tip-cart-delete,
.tip-cart-qty-minus, .tip-cart-qty-plus {
    cursor: pointer;
}

button.cart-line-delete,
button.return-cart-delete,
button.ship-cart-delete,
button.tip-cart-delete {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 7px;
    background: #ffe5e5;
    color: #ff6b6b;
    font-size: 12px;
    padding: 0;
}

.cart-table .qty-stepper-sm {
    justify-content: center;
    gap: 2px;
}

.cart-table .qty-stepper-sm button {
    width: 20px;
    height: 20px;
    font-size: 12px;
    padding: 0;
}

.cart-table .qty-stepper-sm .sg-qty {
    min-width: 16px;
    font-size: 12px;
}

.cart-table .qty-stepper-sm .sg-qty-input {
    min-width: 16px;
    width: 28px;
    font-size: 12px;
    text-align: center;
}

.cash-chip-transfer {
    background: #eaf2ff;
    border-color: #cfe0ff;
    color: #4f7fe0;
    font-weight: 600;
}

.cash-chip-transfer:active {
    background: #4f7fe0;
    color: #fff;
}

.smart-cash-exact {
    border-color: var(--primary-dark);
    background: #fff0f4;
    color: #d6316b;
    font-weight: 600;
}

#btnOrderVoucherScan,
#btnOrderCategoryFilter {
    background: #eaf2ff;
    border-color: #cfe0ff;
    color: #4f7fe0;
}
#btnOrderVoucherScan svg,
#btnOrderCategoryFilter svg {
    stroke: #4f7fe0;
}
#btnOrderVoucherScan:active,
#btnOrderCategoryFilter:active {
    background: #4f7fe0;
    border-color: #4f7fe0;
}
#btnOrderVoucherScan:active svg,
#btnOrderCategoryFilter:active svg {
    stroke: #fff;
}

#btnOrderCategoryFilter.active {
    background: #111827;
    border-color: #111827;
    color: #fff;
}
#btnOrderCategoryFilter.active svg {
    stroke: #fff;
}

.smart-cash-exact:active {
    background: var(--primary-dark);
    color: #fff;
}

.bank-qr-tabs {
    display: flex;
    background: #f2f2f2;
    border-radius: 12px;
    padding: 3px;
    gap: 3px;
}

.bank-qr-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 9px 6px;
    border-radius: 9px;
    font-weight: 600;
    font-size: 13px;
    color: #888;
    cursor: pointer;
}

.bank-qr-tab.active {
    background: #fff;
    color: #4f7fe0;
    box-shadow: var(--shadow);
}

.recipient-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.recipient-card-header .section-title {
    margin-bottom: 0;
}

.btn-customer-list {
    flex-shrink: 0;
    width: auto;
    padding: 7px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.phone-duplicate-notice {
    background: #fff8e1;
    color: #8a6d00;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    margin-top: 8px;
}

.customer-list-card {
    max-width: 340px;
    display: flex;
    flex-direction: column;
}

.customer-list-body {
    max-height: 340px;
    overflow-y: auto;
    margin-top: 10px;
    margin-bottom: 12px;
}

.customer-list-row {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.customer-list-row:active {
    background: #fdf1f4;
}

.customer-list-name {
    font-weight: 600;
    font-size: 14px;
}

.customer-list-meta {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.low-stock-count {
    display: inline-block;
    background: #ff6b6b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 999px;
    padding: 0 5px;
    margin-left: 6px;
    vertical-align: middle;
}

.overview-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.overview-stat-card {
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.overview-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.overview-stat-text {
    min-width: 0;
}

.overview-stat-label {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.overview-stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-revenue { background: #fdf1f4; color: var(--primary-dark); }
.icon-profit { background: #e8fbf0; color: #2ecc71; }
.icon-invoice { background: #eaf2ff; color: #4f7fe0; }
.icon-avg { background: #fff4e0; color: #e0900a; }
.icon-store { background: #f3ecff; color: #8a5cf5; }
.icon-ship { background: #fff2e0; color: #ff9f43; }
.icon-return { background: #e6f9fb; color: #17a2b8; }
.icon-diff { background: #ffecec; color: #ff6b6b; }

@media  (max-width: 360px) {
    .overview-stats-grid {
        grid-template-columns: 1fr;
    }
}

.kho-search-panel {
    display: none;
    margin-bottom: 16px;
}

.kho-search-panel.show {
    display: block;
}

.category-select-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.category-select-row select {
    flex: 1;
    min-width: 0;
}

.category-manage-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: none;
    border-radius: 12px;
    background: #eaf2ff;
    color: #4f7fe0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sg-add-size {
    display: flex;
    align-items: center;
    gap: 6px;
    width: calc(100% - 28px);
    margin: 2px 14px 10px;
    border: 1px dashed var(--primary);
    background: #fdf1f4;
    color: var(--primary-dark);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.add-size-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 14px 10px;
    flex-wrap: wrap;
}

.add-size-form select,
.add-size-form input {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 7px 6px;
    font-size: 13px;
    min-width: 0;
}

.add-size-select {
    flex: 1 1 58px;
    min-width: 50px;
}

.add-size-custom {
    flex-basis: 100%;
}

.add-size-qty {
    flex: 0 0 46px;
    width: 46px;
    text-align: center;
    padding: 7px 4px;
}

.add-size-save {
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;

    flex-shrink: 0;
}

.product-image-preview img {
    width: 140px;
    height: 140px;
    object-fit: cover;
}

.product-image-size-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
}

.upload-thumb-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 6px;
}

.suggestion-group-thumb,
.report-row-thumb,
.sr-thumb,
.qc-thumb,
.invoice-detail-item-thumb,
.return-item-thumb,
.ct-thumb {
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f3f4f6;
    border: 1px solid var(--border);
}

.suggestion-group-thumb-empty,
.report-row-thumb-empty,
.sr-thumb-empty,
.qc-thumb-empty,
.ct-thumb-empty {
    background: #f3f4f6;
}

.ct-thumb {
    width: 34px;
    height: 34px;
}

.invoice-detail-item-thumb {
    width: 34px;
    height: 34px;
}

.return-item-thumb {
    width: 32px;
    height: 32px;
}

.zoomable-thumb {
    cursor: pointer;
}

.suggestion-group-thumb-empty[data-style-id],
.report-row-thumb-empty[data-style-id],
.sr-thumb-empty[data-style-id],
.qc-thumb-empty[data-style-id],
.ct-thumb-empty[data-style-id] {
    cursor: pointer;
    position: relative;
}

.suggestion-group-thumb-empty[data-style-id]::after,
.report-row-thumb-empty[data-style-id]::after,
.sr-thumb-empty[data-style-id]::after,
.qc-thumb-empty[data-style-id]::after,
.ct-thumb-empty[data-style-id]::after {
    content: "+";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 16px;
    font-weight: 600;
}

#imagePreviewModal {
    z-index: 1200;
}

#uploadThumbModal {
    z-index: 1200;
}

.image-preview-modal-card {
    padding: 10px;
    width: auto;
    max-width: 92vw;
}

.image-preview-modal-card img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    border-radius: 14px;
    margin: 0 auto;
}

.upload-thumb-modal-card {
    width: 74%;
    max-width: 352px;
}

.upload-thumb-actions .qr-upload-clear,
.upload-thumb-actions .btn-solid {
    flex: 1 1 0;
    min-width: 0;
    width: 50%;
    height: 52px;
    padding: 0 12px;
    border-radius: 16px;
    font-size: 15px;
    box-sizing: border-box;
    justify-content: center;
}

#uploadThumbPreviewImg {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
}

.suggestion-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 4px;
}

.suggestion-group-thumb {
    width: 34px;
    height: 34px;
}

.suggestion-group-head .suggestion-group-title {
    padding: 0;
}

.report-row-thumb {
    width: 42px;
    height: 42px;
}

.sr-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sr-thumb {
    width: 36px;
    height: 36px;
}

.sr-name-col {
    min-width: 0;
}

.sr-name-text {
    font-weight: 600;
}

.qc-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qc-thumb {
    width: 30px;
    height: 30px;
}

.qc-name-col {
    min-width: 0;
}

.icon-btn-square {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
    cursor: pointer;
}
.icon-btn-square:hover { background: #f3f4f6; }

.price-row { display: flex; gap: 12px; margin-top: 16px; }
.price-row .price-col { flex: 1; min-width: 0; }
.price-row .form-label { margin-top: 0; }
.price-row .price-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; font-size: 13.5px; color: #374151; cursor: pointer; user-select: none; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 auto; cursor: pointer; accent-color: var(--primary); }
.row-size-locked { background: #f3f4f6 !important; color: #9ca3af !important; cursor: not-allowed !important; }
.quick-size-box { margin-top: 6px; padding: 12px; border: 1px solid #e5e7eb; border-radius: 12px; background: #f9fafb; }
.quick-size-fields { display: flex; gap: 8px; margin-bottom: 10px; }
.quick-size-field { flex: 1 1 0; min-width: 0; }
.quick-size-field-count { flex: 0 0 84px; }
.quick-size-label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.quick-size-fields .input { width: 100%; box-sizing: border-box; }
.quick-size-hint { font-size: 12px; color: #9ca3af; margin: 6px 2px 0; min-height: 16px; }
.quick-size-hint.error { color: #dc2626; }
.quick-size-hint.ok { color: #16a34a; }

.color-picker-wrap { position: relative; }
.size-row .color-picker-wrap { flex: 1 1 38px; min-width: 34px; }
.add-size-form .color-picker-wrap { flex: 1 1 58px; min-width: 50px; }
.row-color {
    width: 100%;
    box-sizing: border-box;
    height: 42px;
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 0 6px;
    font-size: 12px;
    outline: none;
}
.add-size-color, .edit-color-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 13px;
    color: #111827;
    background: #fff;
}
.row-color::placeholder, .add-size-color::placeholder, .edit-color-input::placeholder { color: #9ca3af; }
.color-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 40;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
}
.color-picker-dropdown.show { display: block; }
.color-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    color: #111827;
    text-align: left;
    cursor: pointer;
}
.color-picker-item:hover { background: #f3f4f6; }
.color-picker-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    flex: 0 0 auto;
}
.color-picker-empty { padding: 8px; font-size: 12.5px; color: #9ca3af; }
.suggestion-color {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 2px 7px;
}
.suggestion-size-line {
    display: flex;
    align-items: center;
    gap: 6px;
}
.lp-modal-card { text-align: left; }
.lp-tabs { display: flex; gap: 6px; margin: 10px 0 14px; }
.printer-tab-btn {
    flex: 1;
    padding: 8px 6px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
}
.printer-tab-btn.active { background: #111827; color: #fff; border-color: #111827; }
.printer-tab-panel { display: none; }
.printer-tab-panel.active { display: block; }
.lp-hint { color: #9ca3af; font-size: 13px; margin: 8px 0; }
.lp-found-list, .lp-printer-list { list-style: none; padding: 0; margin: 8px 0 0; max-height: 220px; overflow-y: auto; }
.lp-found-list li, .lp-printer-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}
.lp-printer-list li.active { border-color: #111827; background: #f9fafb; }
.lp-empty { color: #9ca3af; justify-content: center !important; }
.lp-row-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.lp-row-name { font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-row-addr { color: #9ca3af; font-size: 12px; }
.lp-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.lp-row-actions button {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 6px;
    font-size: 12px;
    padding: 5px 8px;
    cursor: pointer;
    white-space: nowrap;
}
.lp-row-actions button.danger { color: #dc2626; border-color: #fecaca; }
.lp-row-actions button.primary { color: #fff; background: #111827; border-color: #111827; }
.lp-list-title { font-size: 14px; margin: 16px 0 6px; color: #374151; }

.cat-filter-wrap { position: relative; flex-shrink: 0; }
.cat-filter-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
}
.cat-filter-btn.active { background: #111827; color: #fff; border-color: #111827; }
.cat-filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 40;
    min-width: 180px;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px;
}
.cat-filter-dropdown.show { display: block; }
.cat-filter-item {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
}
.cat-filter-item:hover { background: #f3f4f6; }
.cat-filter-item.active { background: #111827; color: #fff; }

.stat-card-clickable { cursor: pointer; transition: transform .1s ease, box-shadow .1s ease; }
.stat-card-clickable:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.stat-card-clickable:active { transform: scale(0.98); }

.stat-card-alert { background: #fff0f0; }
.stat-card-alert .stat-label,
.stat-card-alert .stat-value { color: #ff6b6b; }

.btn-link-icon {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-size: 14px;
    color: #3b7dd8;
    text-decoration: underline;
    cursor: pointer;
}
.btn-link-icon:hover { color: var(--primary-dark); }
.btn-link-icon:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    text-decoration: none;
}

.voucher-suggestions {
    display: none;
    margin-top: 6px;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
    max-height: 260px;
    overflow-y: auto;
    position: relative;
    z-index: 30;
}
.voucher-suggestions.show {
    display: block;
}
.voucher-suggest-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.voucher-suggest-item:last-child {
    border-bottom: none;
}
.voucher-suggest-item:hover, .voucher-suggest-item.active {
    background: #f7f7f7;
}
.voucher-suggest-code {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 14px;
}
.voucher-suggest-desc {
    font-size: 12.5px;
    color: #666;
    margin-top: 2px;
}
.voucher-suggest-expire {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}
.voucher-suggest-empty {
    padding: 14px;
    text-align: center;
    color: #999;
    font-size: 14px;
}
.voucher-suggest-close-row {
    display: flex;
    justify-content: flex-end;
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: #fff;
}
.voucher-suggest-close {
    border: none;
    background: #f4f4f4;
    color: #888;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
}
.voucher-suggest-close:active {
    background: #e6e6e6;
}
.date-filter-popup {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.date-filter-popup.show {
    display: flex;
}
.date-filter-popup input[type="date"] {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}
.date-filter-popup .btn-outline {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
}
.invoice-suggestion-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.invoice-suggestion-print {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    font-size: 15px;
}
.invoice-suggestion-print:hover {
    background: #f0f0f0;
}
.invoice-suggestion-print:disabled {
    opacity: .5;
    cursor: default;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.settings-tile {
    background: #fff;
    border: none;
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 22px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-family: inherit;
    min-height: 108px;
}
.settings-tile:active {
    transform: scale(0.97);
}
.settings-tile svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}
.settings-tile span {
    font-size: 13.5px;
    font-weight: 600;
    color: #333;
    text-align: center;
    line-height: 1.3;
}
.settings-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.settings-modal-overlay.show {
    display: flex;
}
.settings-modal {
    background: #fff;
    border-radius: 20px;
    padding: 22px;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}
.settings-modal h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    margin: 0 0 16px 0;
    padding-right: 30px;
}
.settings-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}

.recovery-desc {
    font-size: 13.5px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0 0 18px;
}

.recovery-code-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 18px;
    text-align: center;
}

.recovery-code-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
}

.recovery-code-value {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: .03em;
    word-break: break-all;
    line-height: 1.6;
    margin-bottom: 14px;
}

.recovery-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1e293b;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.recovery-copy-btn:active {
    transform: scale(0.97);
}

.recovery-hint {
    font-size: 12.5px;
    color: #dc2626;
    background: #fef2f2;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 16px 0 0;
    line-height: 1.5;
}

.recovery-email-form {
    margin-top: 16px;
}

.recovery-email-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.recovery-email-save {
    width: 100%;
    margin-top: 10px;
}

.recovery-resend-form {
    margin-top: 10px;
    text-align: center;
}

.recovery-resend-btn {
    background: none;
    border: none;
    color: #5b8def;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.history-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 0;
    background: #fff;
    border: none;
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    margin: 14px 0 18px;
}
.history-btn:active {
    transform: scale(0.98);
}
.history-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.history-btn-label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-btn-count {
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    flex-shrink: 0;
}
.history-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -8px 0 14px;
}
.invoice-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -6px 0 14px;
}
.invoice-filter-bar input[type="date"] {
    flex: 1;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 12px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    box-sizing: border-box;
}
.invoice-filter-bar input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-dark);
}
.invoice-filter-title {
    font-size: 12.5px;
    color: #999;
    margin: -8px 0 10px;
}
.invoice-row {
    border-bottom: 1px solid var(--border);
}
.invoice-row:last-child {
    border-bottom: none;
}
.invoice-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    cursor: pointer;
}
.invoice-row-main:active {
    opacity: .7;
}
.invoice-row-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: #bbb;
    fill: none;
    stroke-width: 2.5;
    transition: transform .25s ease;
}
.invoice-row.open .invoice-row-chevron {
    transform: rotate(90deg);
}
.invoice-row-print {
    flex-shrink: 0;
}
.invoice-row-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease-in-out;
}
.invoice-row.open .invoice-row-detail {
    max-height: 600px;
    overflow-y: auto;
}
.invoice-row-detail-inner {
    padding: 4px 0 16px;
}
.invoice-detail-loading {
    font-size: 12.5px;
    color: #999;
    padding: 6px 0;
}
.invoice-detail-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px dashed var(--border);
}
.invoice-detail-item:last-of-type {
    border-bottom: none;
}
.invoice-detail-item-name {
    color: var(--text);
    flex: 1;
}
.invoice-detail-item-qty {
    color: #999;
    font-size: 12px;
    display: block;
    margin-top: 2px;
}
.invoice-detail-item-code {
    color: #b3b3b3;
    font-size: 11.5px;
    display: block;
    margin-top: 2px;
    font-family: monospace;
}
.invoice-detail-item-total {
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}
.invoice-detail-summary {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.invoice-detail-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 3px 0;
    color: #666;
}
.invoice-detail-summary-row.grand-total {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
    margin-top: 4px;
}
.invoice-detail-recipient {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    font-size: 12.5px;
    color: #777;
    line-height: 1.6;
}

.d-none {
    display:none;
}
.u-inline-2 {
    vertical-align:-4px;
    margin-right:5px;
}
.u-inline-3 {
    margin-top:0;
}
.u-inline-4 {
    max-height: 420px;
    overflow-y: auto;
}
.u-inline-5 {
    margin-bottom:12px;
}
.u-inline-6 {
    margin-top:14px;
}
.u-inline-7 {
    margin-top:0;
    font-size:16px;
}
.u-inline-8 {
    display:none;
    color:#ff6b6b;
    font-size:13px;
    margin-top:10px;
}
.u-inline-9 {
    width:100%;
    margin-top:16px;
}
.u-inline-10 {
    width:100%;
    border-radius:12px;
    display:block;
    margin-top:10px;
}
.u-inline-11 {
    background:#fff;
    border-radius:20px;
    padding:20px;
    text-align:center;
    margin-top:15px;
}
.u-inline-12 {
    width:280px;
    max-width:100%;
}
.u-inline-13 {
    margin-top:15px;
    font-size:14px;
    color:#666;
}
.u-inline-14 {
    margin-top:15px;
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
}
.u-inline-15 {
    display:block;
    font-size:22px;
    font-weight:bold;
    word-break:break-word;
    margin-top:10px;
}
.u-inline-16 {
    padding:10px 0;
}
.u-inline-17 {
    font-size:16px;
}
.u-inline-18 {
    text-transform:uppercase;
}
.u-inline-19 {
    color:#999;
}
.u-inline-20 {
    color:#ff6b6b;
    font-size:12px;
    font-weight:600;
}
.u-inline-21 {
    color:#1d7a3d;
    font-size:12px;
    font-weight:600;
}
.u-inline-22 {
    width:100%;
}
.u-inline-23 {
    width:100%;
    margin-top:10px;
}
.u-inline-24 {
    flex:1 1 auto;
}
.u-inline-25 {
    text-align:center;
    margin-top:15px;
}
.u-inline-26 {
    text-decoration: none;
    color: #888;
}

:root {
    --pa-bg: #f4f6f9;
    --pa-card-bg: #ffffff;
    --pa-text: #1f2937;
    --pa-text-muted: #6b7280;
    --pa-border: #e5e7eb;
    --pa-primary: #2563eb;
    --pa-primary-hover: #1d4ed8;
    --pa-success: #16a34a;
    --pa-error: #dc2626;
    --pa-warning: #d97706;
    --pa-radius: 14px;
    --pa-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pa-page * { box-sizing: border-box; }

body.pa-page {
    margin: 0;
    background: var(--pa-bg);
    color: var(--pa-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.pa-page .app-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

.pa-page .app-header {
    text-align: center;
    margin-bottom: 24px;
}
.pa-page .app-header h1 { margin: 0 0 4px; font-size: 24px; }
.pa-page .subtitle { margin: 0; color: var(--pa-text-muted); font-size: 13px; }

.pa-page .card {
    background: var(--pa-card-bg);
    border-radius: var(--pa-radius);
    box-shadow: var(--pa-shadow);
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--pa-border);
}
.pa-page .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--pa-border);
}
.pa-page .card-header h2 { margin: 0; font-size: 16px; }
.pa-page .card-body { padding: 16px 18px 20px; }

/* Thu gọn/mở rộng mục 1 (Server) và mục 2 (Print Agent) — mặc định đóng */
.pa-page .card.pa-collapsible .card-header { cursor: pointer; user-select: none; }
.pa-page .card.pa-collapsible .card-body {
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    transition: max-height 0.25s ease, padding 0.25s ease;
}
.pa-page .card.pa-collapsible.open .card-body {
    max-height: 260px;
    padding-top: 16px;
    padding-bottom: 20px;
}
.pa-page .pa-header-right { display: flex; align-items: center; gap: 10px; }
.pa-page .pa-chevron {
    width: 16px;
    height: 16px;
    color: var(--pa-text-muted);
    flex-shrink: 0;
    transition: transform 0.25s ease;
}
.pa-page .card.pa-collapsible.open .pa-chevron { transform: rotate(180deg); }

/* Icon inline (wifi/bluetooth) thay cho emoji trong danh sách máy in */
.pa-page .pa-inline-icon {
    width: 13px;
    height: 13px;
    vertical-align: -2px;
    margin-right: 2px;
}

/* Modal "Sửa thông tin máy in" — thay cho 2 prompt() liên tiếp trước đây */
.pa-edit-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.pa-edit-overlay.show { display: flex; }
.pa-edit-card {
    background: var(--pa-card-bg);
    border-radius: var(--pa-radius);
    box-shadow: var(--pa-shadow);
    padding: 20px;
    width: 100%;
    max-width: 360px;
}
.pa-edit-card h3 { margin: 0 0 14px; font-size: 16px; color: var(--pa-text); }
.pa-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.pa-page .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--pa-text-muted);
}
.pa-page .badge .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #9ca3af;
}
.pa-page .badge.online { background: #dcfce7; color: #15803d; }
.pa-page .badge.online .dot { background: var(--pa-success); }
.pa-page .badge.offline { background: #fee2e2; color: #b91c1c; }
.pa-page .badge.offline .dot { background: var(--pa-error); }

.pa-page .kv {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--pa-border);
    font-size: 14px;
}
.pa-page .kv:last-child { border-bottom: none; }
.pa-page .kv .k { color: var(--pa-text-muted); }
.pa-page .kv .v { font-weight: 600; text-align: right; }

.pa-page .tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.pa-page .tab-btn {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    border: 1px solid var(--pa-border);
    background: #f9fafb;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--pa-text-muted);
    cursor: pointer;
    transition: 0.15s;
}
.pa-page .tab-btn.active {
    background: var(--pa-primary);
    color: #fff;
    border-color: var(--pa-primary);
}
.pa-page .tab-panel { display: none; }
.pa-page .tab-panel.active { display: block; }

.pa-page .hint { font-size: 13px; color: var(--pa-text-muted); margin: 4px 0 12px; }

.pa-page .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
}
.pa-page .btn:active { transform: scale(0.97); }
.pa-page .btn:disabled { opacity: 0.6; cursor: not-allowed; }
.pa-page .btn-primary { background: var(--pa-primary); color: #fff; }
.pa-page .btn-primary:hover { background: var(--pa-primary-hover); }
.pa-page .btn-secondary { background: #eef2ff; color: var(--pa-primary); }
.pa-page .btn-success { background: var(--pa-success); color: #fff; }
.pa-page .btn-danger { background: var(--pa-error); color: #fff; }

.pa-page .form-row { margin-bottom: 12px; }
.pa-page .form-row label { display: block; font-size: 13px; color: var(--pa-text-muted); margin-bottom: 4px; }
.pa-page .form-row input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--pa-border);
    border-radius: 10px;
    font-size: 14px;
}
.pa-page .form-row input:focus { outline: 2px solid var(--pa-primary); border-color: var(--pa-primary); }

.pa-page .progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}
.pa-page .progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}
.pa-page .progress-fill {
    height: 100%;
    width: 0%;
    background: var(--pa-primary);
    transition: width 0.2s;
}
.pa-page #scan-progress-text { font-size: 12px; color: var(--pa-text-muted); min-width: 36px; text-align: right; }

.pa-page .printer-list { list-style: none; margin: 14px 0 0; padding: 0; }
.pa-page .printer-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--pa-border);
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}
.pa-page .printer-list li.empty { color: var(--pa-text-muted); border: none; justify-content: center; }
.pa-page .printer-list .p-info { display: flex; flex-direction: column; gap: 2px; }
.pa-page .printer-list .p-name { font-weight: 600; }
.pa-page .printer-list .p-addr { color: var(--pa-text-muted); font-size: 12px; }
.pa-page .printer-list .select-btn {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
    border: 1px solid var(--pa-primary);
    background: #fff;
    color: var(--pa-primary);
    cursor: pointer;
}
.pa-page .printer-list .select-btn.selected { background: var(--pa-primary); color: #fff; }
.pa-page .printer-list .select-btn.danger { border-color: var(--pa-error); color: var(--pa-error); }
.pa-page .printer-list .select-btn.danger:hover { background: var(--pa-error); color: #fff; }
.pa-page .printer-list .icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pa-page .printer-list .icon-btn svg { width: 15px; height: 15px; }

.pa-page .current-printer {
    margin-top: 16px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 10px;
    font-size: 13px;
}

.pa-page .result-text { margin-top: 12px; font-size: 13px; white-space: pre-line; }
.pa-page .result-text.success { color: var(--pa-success); font-weight: 600; }
.pa-page .result-text.error { color: var(--pa-error); font-weight: 600; }

.pa-page .log-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.pa-page .log-list li {
    display: flex;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--pa-border);
    font-size: 13px;
}
.pa-page .log-list li.empty { justify-content: center; color: var(--pa-text-muted); border: none; }
.pa-page .log-list .log-time { color: var(--pa-text-muted); min-width: 68px; font-variant-numeric: tabular-nums; }
.pa-page .log-list .log-msg.success { color: var(--pa-success); }
.pa-page .log-list .log-msg.error { color: var(--pa-error); }
.pa-page .log-list .log-msg.info { color: var(--pa-text); }

.pa-page .app-footer {
    text-align: center;
    color: var(--pa-text-muted);
    font-size: 12px;
    margin-top: 24px;
}

@media   (max-width: 480px) {
    .pa-page .card-header h2 { font-size: 14px; }
    .pa-page .btn { width: 100%; justify-content: center; }
}

/* ===================================================================
   KHỐI: LỊCH SỬ HÓA ĐƠN IN TẠM (cuối trang POS)
   =================================================================== */
.tip-block {
    margin-top: 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.tip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.tip-header-left { display: flex; align-items: center; gap: 10px; }
.tip-title { font-size: 15px; font-weight: 700; color: var(--text); }
.tip-badge {
    background: var(--primary);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
    margin-left: 4px;
}
.tip-subtitle { font-size: 11.5px; color: #999; margin-top: 2px; }

.tip-list { max-height: 420px; overflow-y: auto; }
.tip-empty { padding: 40px 20px; text-align: center; color: #bbb; font-size: 13.5px; }

.tip-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.tip-row:last-child { border-bottom: none; }
.tip-row.is-checked { background: #fff5f7; }
.tip-row.is-paid { opacity: 1; }

.tip-row-line1 { display: flex; align-items: center; gap: 8px; }
.tip-row-line2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tip-check { width: 19px; height: 19px; flex: none; accent-color: var(--primary-dark, #d9748c); cursor: pointer; }
.tip-code { font-weight: 700; font-size: 13.5px; }
.tip-time { font-size: 11.5px; color: #aaa; }
.tip-row-bottom {
    flex: 1;
    min-width: 0;
    font-size: 12px; color: #888;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tip-amount { font-weight: 700; font-size: 14px; color: var(--primary-dark); white-space: nowrap; margin-left: auto; }
.tip-icon-actions { display: flex; gap: 6px; flex: none; }
.tip-icon-btn {
    width: 30px; height: 30px; flex: none;
    display: flex; align-items: center; justify-content: center;
    border-radius: 9px; border: 1px solid var(--border);
    background: #fff; color: #666; cursor: pointer;
}
.tip-icon-btn:hover { background: #f5f5f5; }
.tip-icon-btn.danger { color: #e05263; border-color: #ffd7dc; }
.tip-icon-btn.danger:hover { background: #fff0f2; }
.tip-icon-btn.pay { background: var(--primary); color: #fff; border-color: var(--primary); }
.tip-icon-btn.pay:hover { background: var(--primary-dark); }
.tip-icon-btn.pay.paid { background: #c7f0d8; color: #1e8a4c; border-color: #b3e8c9; cursor: default; }
.tip-icon-btn.disabled { opacity: .4; cursor: not-allowed; }
.tip-icon-btn.disabled:hover { background: #fff; }

.tip-selection-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    background: #fff0f3;
    border-top: 1px solid #ffd9e0;
    flex-wrap: wrap;
}
.tip-selection-bar.show { display: flex; }
.tip-selection-text { font-size: 12.5px; color: var(--primary-dark); font-weight: 600; }
.tip-selection-actions { display: flex; gap: 8px; }
.tip-btn-merge {
    border: none; background: var(--primary-dark); color: #fff; font-size: 12.5px; font-weight: 700;
    padding: 9px 16px; border-radius: 12px; cursor: pointer;
}
.tip-btn-merge:hover { background: #ff8aa0; }
.tip-btn-cancel-sel {
    border: 1px solid #ffd0d9; background: #fff; color: #c96b7a; font-size: 12.5px;
    padding: 9px 14px; border-radius: 12px; cursor: pointer;
}
.tip-footnote { padding: 9px 20px; font-size: 11px; color: #bbb; text-align: center; border-top: 1px solid var(--border); }

.merged-item-row {
    display: flex; justify-content: space-between; font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--border);
}

/* Modal SỬA hóa đơn tạm */
.tip-edit-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.tip-edit-item-info { flex: 1; min-width: 0; }
.tip-edit-item-name { font-size: 13px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-edit-item-price { font-size: 11.5px; color: #999; margin-top: 1px; }
.tip-edit-qty-stepper {
    display: flex; align-items: center; gap: 6px; flex: none;
}
.tip-qty-btn {
    width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border);
    background: #fff; color: #666; cursor: pointer; font-size: 15px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.tip-qty-btn:hover { background: #f5f5f5; }
.tip-qty-val { min-width: 20px; text-align: center; font-size: 13px; font-weight: 600; }
.tip-edit-item-total { font-size: 13px; font-weight: 700; color: var(--primary-dark); flex: none; width: 74px; text-align: right; }
.tip-edit-remove-btn {
    width: 26px; height: 26px; border-radius: 8px; border: none; background: none;
    color: #ccc; cursor: pointer; font-size: 15px; flex: none;
}
.tip-edit-remove-btn:hover { color: #e05263; }

.tip-edit-search-empty { padding: 12px; text-align: center; font-size: 12px; color: #bbb; }

/* Modal SỬA hóa đơn tạm: to hơn modal QR mặc định để chứa giỏ hàng đầy đủ */
#tipEditModal .qr-modal-card {
    max-width: 480px;
    width: 94%;
    max-height: 92vh;
}
