:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Zone Colors */
    --blue-zone: #0284c7;
    --blue-bg: rgba(2, 132, 199, 0.12);
    --yellow-zone: #d97706;
    --yellow-bg: rgba(217, 119, 6, 0.12);
    --green-zone: #059669;
    --green-bg: rgba(5, 150, 105, 0.12);
    --purple-zone: #7c3aed;
    --purple-bg: rgba(124, 58, 237, 0.12);

    --success: #10b981;
    --danger: #ef4444;
    --primary: #3b82f6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 24px;
}

.app-container {
    max-width: 1750px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 18px 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    font-size: 28px;
    background: rgba(59, 130, 246, 0.15);
    padding: 8px 12px;
    border-radius: 10px;
}

/* Logo kiểu terminal ">_" + nút Home (bấm về tab Price tool) */
.brand-home {
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    padding: 2px 8px 2px 2px;
    margin: -2px -8px -2px -2px;
    transition: background 0.15s ease;
}
.brand-home:hover { background: rgba(34, 197, 94, 0.06); }
.brand-home:focus-visible { outline: 2px solid #22c55e; outline-offset: 2px; }

.logo-terminal {
    font-family: ui-monospace, Consolas, 'Courier New', monospace;
    font-weight: 700;
    font-size: 24px;
    line-height: 1;
    color: #22c55e;
    background: #0b1222;
    border: 1px solid rgba(34, 197, 94, 0.45);
    padding: 10px 12px;
    min-width: 54px;
    text-align: left;
    letter-spacing: 1px;
    text-shadow: 0 0 6px rgba(34, 197, 94, 0.75);
    box-shadow: inset 0 0 12px rgba(34, 197, 94, 0.12);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.brand-home:hover .logo-terminal {
    border-color: #22c55e;
    box-shadow: inset 0 0 12px rgba(34, 197, 94, 0.2), 0 0 12px rgba(34, 197, 94, 0.35);
}
.logo-cursor { animation: logo-blink 1.1s steps(1) infinite; }
@keyframes logo-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .logo-cursor { animation: none; } }

.brand h1 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-badges {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.quota-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.env-picker-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid #3b82f6;
    border-radius: 8px;
    padding: 2px 8px 2px 10px;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.env-picker-container:hover {
    border-color: #60a5fa;
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.3);
}

.env-picker-icon {
    font-size: 14px;
}

.env-select {
    background: transparent;
    color: #f8fafc;
    border: none;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 6px 6px 2px;
    cursor: pointer;
    outline: none;
}

.env-select option {
    background: #1e293b;
    color: #f8fafc;
    padding: 8px;
}


.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #2563eb;
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.btn-success {
    background-color: #059669;
    color: #fff;
}
.btn-success:hover:not(:disabled) {
    background-color: #047857;
}

.btn-secondary {
    background-color: #334155;
    color: #f1f5f9;
    border-color: #475569;
}
.btn-secondary:hover:not(:disabled) {
    background-color: #475569;
}

.btn-outline {
    background-color: transparent;
    color: #38bdf8;
    border-color: #0284c7;
}
.btn-outline:hover:not(:disabled) {
    background-color: rgba(2, 132, 199, 0.15);
}

.btn-danger-outline {
    background-color: transparent;
    color: #f87171;
    border-color: #ef4444;
}
.btn-danger-outline:hover:not(:disabled) {
    background-color: rgba(239, 68, 68, 0.15);
}

.badge-custom-active {
    background: rgba(217, 119, 6, 0.2);
    color: #f59e0b;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(217, 119, 6, 0.4);
}

/* Dedicated Fixed Error / Status Panel */
.error-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    font-size: 11px;
    min-height: 46px;
    transition: all 0.2s ease;
}

.error-panel.error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.panel-icon {
    font-size: 16px;
    line-height: 1;
}

.panel-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.panel-title {
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.panel-detail {
    font-size: 10px;
    opacity: 0.9;
    word-break: break-word;
}

/* Grid Card */
.grid-card {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.grid-scroll {
    /* 'hidden' cat mat cac cot ben phai (Grand Total) tren man hinh hep ma khong
       keo toi duoc. 'auto' chi hien thanh cuon khi that su thieu cho, man hinh rong
       van khong co scrollbar thua. */
    overflow-x: auto;
    max-width: 100%;
}

.pricing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    text-align: left;
    white-space: nowrap;
    table-layout: auto;
}

.pricing-table th, .pricing-table td {
    padding: 4px 6px;
    border: 1px solid #2d3748;
    font-size: 10px;
    line-height: 1.3;
}

.pricing-table th {
    font-weight: 700;
    text-align: center;
}

.zone-header {
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    padding: 5px 6px;
}

.zone-blue {
    background-color: var(--blue-zone);
    color: #fff;
}
.zone-yellow {
    background-color: var(--yellow-zone);
    color: #fff;
}
.zone-green {
    background-color: var(--green-zone);
    color: #fff;
}
.zone-purple {
    background-color: var(--purple-zone);
    color: #fff;
}

.sub-header th {
    font-size: 10px;
    font-weight: 600;
    background-color: #1e293b;
    border-bottom: 2px solid #475569;
    padding: 4px 6px;
}

.col-seq {
    width: 26px;
    max-width: 30px;
    background: #0f172a;
    color: var(--text-secondary);
    line-height: 24px;
}

.col-country {
    width: 60px;
    max-width: 65px;
}

.col-country .cell-select {
    padding: 2px 2px;
    font-size: 10px;
    font-weight: 600;
}

.col-group {
    width: 78px;
    max-width: 82px;
}

.col-group .cell-select {
    padding: 2px 2px;
    font-size: 10px;
}

.col-sku {
    width: 205px;
    max-width: 230px;
}

.col-qty {
    width: 35px;
    max-width: 38px;
}

.cell-input.input-qty {
    width: 100% !important;
    padding: 2px 0px;
    text-align: center;
    font-size: 10px;
    -moz-appearance: textfield;
}

.cell-input.input-qty::-webkit-outer-spin-button,
.cell-input.input-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.col-coupon {
    width: 75px;
    max-width: 80px;
}

.cell-input.input-coupon {
    width: 100% !important;
    font-size: 10px;
}

.col-rule {
    width: 65px;
    max-width: 70px;
}

.cell-input.input-rule {
    width: 100% !important;
    text-align: center;
    color: #facc15;
    font-weight: 600;
    font-size: 10px;
}

.col-action {
    width: 95px;
    min-width: 95px;
    background: #0f172a;
}

/* Row Loading & Disabled States */
tr.row-loading {
    background-color: rgba(56, 189, 248, 0.08) !important;
}

.cell-input:disabled, .cell-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #1e293b;
    border-color: #334155;
}

.spinner-icon {
    display: inline-block;
    animation: spin 0.8s linear infinite;
    font-size: 13px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Row Styling */
/* Row Styling */
.pricing-table tbody tr {
    min-height: 44px;
    height: 44px;
    transition: background-color 0.15s ease, height 0.15s ease;
}

.pricing-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.pricing-table td {
    vertical-align: middle;
    padding: 4px 6px;
}

/* Entire row shifts to top when row has error */
.pricing-table tbody tr.row-has-error {
    min-height: 58px;
    height: 58px;
}

.pricing-table tbody tr.row-has-error td {
    vertical-align: top;
    padding-top: 8px;
}

.pricing-table tbody tr.row-has-error .td-center,
.pricing-table tbody tr.row-has-error .td-right,
.pricing-table tbody tr.row-has-error .col-seq {
    line-height: 24px;
}

.td-center {
    text-align: center;
}

.td-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.td-grand {
    font-weight: 700;
    font-size: 11px;
    color: #34d399;
}

/* Input Fields inside Cells */
.cell-input, .cell-select {
    width: 100%;
    padding: 2px 4px;
    height: 24px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #fff;
    font-size: 10px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
    margin: 0;
}

.cell-input:focus, .cell-select:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.cell-input.sku-input {
    width: 100%;
    font-weight: 600;
    color: #38bdf8;
    font-size: 10px;
}

/* Auto-size Badges and Price columns */
.col-badge {
    white-space: nowrap;
    text-align: center;
    padding: 4px 6px !important;
}

.pricing-table tbody tr.row-has-error .col-badge {
    padding-top: 8px !important;
}

.badge-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    height: 22px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
}

.pricing-table tbody tr.row-has-error .badge-state {
    margin-top: 1px;
}

.badge-yes {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-no {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.col-price {
    white-space: nowrap;
    padding: 4px 6px;
}

.col-rate {
    white-space: nowrap;
    padding: 4px 6px;
}

.pricing-table tbody tr.row-has-error .col-price,
.pricing-table tbody tr.row-has-error .col-rate {
    padding-top: 8px;
}

.row-error-container:empty {
    display: none;
}

.row-error-container {
    margin-top: 3px;
    display: flex;
    align-items: center;
}

.row-error-hint {
    color: #f87171;
    font-size: 9px;
    line-height: 1.25;
    display: block;
    white-space: normal;
    word-break: break-word;
}

/* Action Buttons inside Rows */
.row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    gap: 4px;
    white-space: nowrap;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.footer-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.grid-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-card {
    background: var(--bg-card);
    width: 650px;
    max-width: 95vw;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: zoomIn 0.2s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label, .form-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-control {
    padding: 8px 12px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.form-control:focus {
    border-color: #38bdf8;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* Interactive Hover Tooltip & Popover */
.pricing-table td[data-tooltip="true"] {
    cursor: help;
    transition: background-color 0.15s ease;
    position: relative;
}

.pricing-table td[data-tooltip="true"]:hover {
    background-color: rgba(56, 189, 248, 0.12) !important;
}

#pricingTooltip {
    position: fixed;
    z-index: 10000;
    max-width: 400px;
    min-width: 280px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 9px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(56, 189, 248, 0.15);
    padding: 12px 14px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    font-size: 11px;
    line-height: 1.45;
    color: #f1f5f9;
}

/* Tooltip co phan "Dien giai tung buoc" (gia PDP, WEEE) can rong hon de khong xuong dong vun */
#pricingTooltip.tooltip-wide {
    max-width: 560px;
    min-width: 440px;
}

.tooltip-breakdown {
    font-size: 10px;
    line-height: 1.4;
}

#pricingTooltip.tooltip-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding-bottom: 7px;
    margin-bottom: 8px;
}

.tooltip-title {
    font-weight: 700;
    font-size: 12px;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tooltip-value-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    font-family: 'Consolas', 'Courier New', monospace;
}

.tooltip-section {
    margin-top: 7px;
}

.tooltip-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tooltip-source-box {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 5px;
    padding: 5px 8px;
    color: #cbd5e1;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 10.5px;
}

.tooltip-calc-box {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-left: 3px solid #38bdf8;
    border-radius: 4px;
    padding: 6px 8px;
    color: #e2e8f0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 10.5px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Canada Region Selector in Country Cell */
.country-cell-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sel-region {
    background: #0f172a;
    border: 1px solid #38bdf8;
    color: #38bdf8;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 9.5px;
    font-weight: 700;
    outline: none;
    cursor: pointer;
}

.sel-region:focus {
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

/* Trace Log Modal */
.trace-modal-card {
    max-width: 680px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.trace-desc {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.trace-step-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 52vh;
    padding-right: 6px;
}

.trace-step-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 6px;
    padding: 8px 12px;
    transition: all 0.15s ease;
}

.trace-step-item:hover {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(15, 23, 42, 0.95);
}

.trace-step-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    font-weight: 700;
    font-size: 10.5px;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    font-family: 'Consolas', 'Courier New', monospace;
}

.trace-step-text {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    color: #cbd5e1;
    word-break: break-word;
    flex: 1;
}



/* ===== So sanh nguon cau hinh (YAML <-> DB moi truong) ===== */
.cell-grand-total.cfg-differs {
    box-shadow: inset 3px 0 0 #f59e0b;
}

.cfg-diff-badge {
    color: #f59e0b;
    font-weight: 700;
    cursor: help;
}

.tooltip-compare {
    border-left-color: #64748b;
}

.tooltip-compare.is-diff {
    border-left-color: #f59e0b;
}

.config-modal-card {
    width: min(1100px, 96vw);
    max-width: 96vw;
}

.config-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.config-controls label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: #94a3b8;
}

.config-controls label.cfg-check {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
}

.config-table-wrap {
    max-height: 60vh;
    overflow: auto;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
}

.config-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.config-table th {
    position: sticky;
    top: 0;
    background: #1e293b;
    color: #cbd5e1;
    text-align: left;
    padding: 6px 8px;
    font-weight: 600;
    z-index: 1;
}

.config-table td {
    padding: 6px 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    vertical-align: top;
    color: #e2e8f0;
}

.config-table code {
    font-size: 10.5px;
    color: #7dd3fc;
    word-break: break-all;
}

.cfg-row.cfg-diff td {
    background: rgba(245, 158, 11, 0.07);
}

.cfg-label {
    font-weight: 600;
}

.cfg-note {
    color: #94a3b8;
    font-size: 10px;
    margin-top: 2px;
}

.cfg-muted {
    color: #64748b;
}

.cfg-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.cfg-status-match { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.cfg-status-diff { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.cfg-status-yaml_only,
.cfg-status-db_only,
.cfg-status-info { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }

/* Thanh cong cu co them bo chon nguon cau hinh + nut so sanh: cho xuong dong tren man hinh hep */
.toolbar-left {
    flex-wrap: wrap;
}

/* =====================================================================
   Khung giao diện chung (header + 3 tab) - QC Tools
   ===================================================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-top: 3px solid var(--env-color, var(--primary));
}

.app-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-main);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.app-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.app-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.app-tab.active {
    color: #fff;
    background: var(--primary);
}

.app-tab:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.tab-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tab-panel[hidden] {
    display: none;
}

.toolbar-sep {
    width: 1px;
    align-self: stretch;
    background: var(--border-color);
    margin: 4px 2px;
}

.toolbar-right {
    flex-wrap: wrap;
}

/* Màu theo môi trường: viền trên header + khung chọn env */
body[data-env="stg"]  { --env-color: #3b82f6; }
body[data-env="stg2"] { --env-color: #a855f7; }
body[data-env="stg3"] { --env-color: #14b8a6; }

.env-global {
    border-color: var(--env-color, #3b82f6);
    box-shadow: 0 0 10px color-mix(in srgb, var(--env-color, #3b82f6) 25%, transparent);
}

/* Tab đang phát triển */
.coming-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.coming-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.coming-head h2 {
    font-size: 18px;
    font-weight: 700;
}

.coming-head p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 2px;
}

.coming-icon {
    font-size: 24px;
    background: rgba(59, 130, 246, 0.15);
    padding: 8px 12px;
    border-radius: 10px;
}

.coming-badge {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: #fbbf24;
    background: rgba(217, 119, 6, 0.12);
    border: 1px solid rgba(217, 119, 6, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.coming-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.coming-item {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
}

.coming-item-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.coming-item-desc {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.coming-steps {
    list-style: none;
    counter-reset: step;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.coming-steps li {
    counter-increment: step;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.coming-steps li::before {
    content: counter(step);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.coming-steps li span {
    color: var(--text-secondary);
    font-size: 12px;
}

@media (max-width: 900px) {
    body { padding: 12px; }
    .app-header { padding: 10px 12px; }
    .app-tabs { order: 3; width: 100%; overflow-x: auto; }
    .brand .subtitle { display: none; }
}

/* =====================================================================
   Tab Update order status
   ===================================================================== */
.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-link {
    background: none;
    border: none;
    color: #60a5fa;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}
.btn-link:hover { text-decoration: underline; }

.os-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.os-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.os-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.os-card-head h2 { font-size: 16px; font-weight: 700; }

.os-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 6px;
}
.os-label-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.os-muted { color: var(--text-muted); font-weight: 400; font-size: 12px; }

.os-input-row { display: flex; align-items: center; gap: 10px; }
.os-input, .os-select {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 9px 12px;
    font: inherit;
    font-size: 14px;
    outline: none;
}
.os-input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.3px; }
.os-input:focus, .os-select:focus { border-color: var(--primary); }
.os-select { width: 100%; font-size: 13px; }
.os-select:disabled { opacity: 0.5; }

.os-lookup-state { font-size: 12px; white-space: nowrap; color: var(--text-secondary); }
.os-lookup-state.ok { color: var(--success); }
.os-lookup-state.error { color: #f87171; white-space: normal; }
.os-lookup-state.loading { color: #fbbf24; }

.os-hint { font-size: 12px; color: var(--text-secondary); }
.os-hint:empty { display: none; }
.os-hint.ok { color: var(--success); }
.os-hint.error { color: #f87171; }

.os-order-info {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
}
.os-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px 16px;
}
.os-info-grid div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.os-info-grid span { font-size: 11px; color: var(--text-muted); }
.os-info-grid b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.os-status-pill { color: #60a5fa; }

.os-radio, .os-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}
.os-radio { margin: 2px 0; }

.os-status-list {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}
.os-status {
    display: grid;
    grid-template-columns: 18px minmax(150px, 0.9fr) minmax(0, 1.4fr);
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 13px;
}
.os-status:last-child { border-bottom: none; }
.os-status:hover { background: var(--bg-hover); }
.os-status-hold { background: rgba(217, 119, 6, 0.06); }
.os-status-na { opacity: 0.45; }
.os-status-name { font-weight: 600; }
.os-status-codes { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.os-code { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--text-secondary); }
.os-code b { color: var(--text-primary); font-family: inherit; margin-right: 2px; }

.os-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    vertical-align: middle;
}
.os-tag-hold { background: rgba(217, 119, 6, 0.18); color: #fbbf24; }
.os-tag-done { background: rgba(16, 185, 129, 0.15); color: #34d399; }

/* Hệ ERP của đơn: GERP xanh lá, NERP cam (js/erp.js) */
.erp-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 6px;
    vertical-align: middle;
    white-space: nowrap;
}
.erp-gerp { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.55); }
.erp-nerp { background: rgba(249, 115, 22, 0.18); color: #fb923c; border: 1px solid rgba(251, 146, 60, 0.6); }
.erp-unknown { background: var(--bg-hover); color: var(--text-secondary); border: 1px dashed var(--text-muted); }
.os-job-main .erp-badge { font-size: 10px; padding: 1px 6px; }
.erp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; font-size: 12px; }
.erp-row-pick { padding: 8px 10px; border-radius: 8px; border: 1px dashed rgba(251, 146, 60, 0.5); background: rgba(249, 115, 22, 0.06); }
.erp-warn { color: #fbbf24; }
.erp-pick { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.erp-choice { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 700; }
.erp-choice-gerp { color: #34d399; }
.erp-choice-nerp { color: #fb923c; }

.os-options { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.os-run { justify-content: center; padding: 11px 16px; font-size: 14px; margin-top: 4px; }

.os-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.os-job-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.os-empty { color: var(--text-muted); font-size: 13px; padding: 12px 0; }
.os-job {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    background: var(--bg-main);
}
.os-job:hover { border-color: var(--text-muted); }
.os-job.selected { border-color: var(--primary); }
/* Job do chính máy này vừa chạy (chỉ khi đang chờ / đang chạy) */
.os-job.mine-active {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.7);
}
.os-job.mine-active:hover { background: rgba(59, 130, 246, 0.22); }
.os-tag-mine { background: rgba(59, 130, 246, 0.3); color: #bfdbfe; }
.os-job-main { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.os-job-main .os-state { margin-left: auto; }
.os-job-id { color: var(--text-muted); font-family: ui-monospace, Consolas, monospace; }
.os-job-sub { font-size: 12px; color: var(--text-secondary); margin-top: 3px; overflow-wrap: anywhere; }

.os-env-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    text-transform: uppercase;
}
.os-env-tag.env-stg2 { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.os-env-tag.env-stg3 { background: rgba(20, 184, 166, 0.2); color: #5eead4; }

.os-state {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.os-state-queued { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.os-state-running { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.os-state-done { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.os-state-failed { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.os-state-interrupted { background: rgba(249, 115, 22, 0.18); color: #fdba74; }
.os-state-cancelled, .os-state-skipped { background: rgba(217, 119, 6, 0.15); color: #fbbf24; }
.os-state-pending { background: transparent; color: var(--text-muted); border: 1px solid var(--border-color); }

.os-job-detail {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.os-job-detail[hidden] { display: none; }
.os-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.os-steps { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.os-step {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 0;
    background: var(--bg-main);
    border-left: 3px solid var(--border-color);
}
.os-step-running { border-left-color: #3b82f6; }
.os-step-done { border-left-color: #10b981; }
.os-step-failed { border-left-color: #ef4444; }
.os-step-skipped, .os-step-cancelled { border-left-color: #d97706; }
.os-step-name { font-weight: 600; min-width: 170px; }
.os-step-note { width: 100%; font-size: 12px; color: var(--text-secondary); }

.os-log summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); }
.os-log pre {
    margin-top: 6px;
    max-height: 260px;
    overflow: auto;
    background: #0b1222;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    font-size: 11.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

#osItemsBox[hidden], .os-order-info[hidden], .os-error[hidden] { display: none; }

@media (max-width: 1100px) {
    .os-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
    .os-status { grid-template-columns: 18px minmax(0, 1fr); }
    .os-status-codes { grid-column: 2; }
}

/* =====================================================================
   Tab Return refund + nhãn loại job trong hàng đợi chung
   ===================================================================== */
.os-type-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}
.os-type-tag.type-rma { background: rgba(236, 72, 153, 0.18); color: #f9a8d4; }
.os-rma { font-size: 12px; color: #f9a8d4; font-family: ui-monospace, Consolas, monospace; }

.rr-rma-list, .rr-item-list {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}
.rr-rma {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    cursor: pointer;
}
.rr-rma:last-child { border-bottom: none; }
.rr-rma:hover { background: var(--bg-hover); }
.rr-rma input { margin-top: 3px; }
.rr-rma-items { font-size: 11px; margin-top: 2px; font-family: ui-monospace, Consolas, monospace; }

.rr-item-list { padding: 6px 12px; max-height: 180px; overflow-y: auto; }
.rr-item-list .os-radio { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.rr-child { padding-left: 18px; }

.rr-create { display: flex; flex-direction: column; gap: 8px; }
.rr-create[hidden] { display: none; }
.rr-create-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}
.rr-create-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}
.rr-create-grid .os-input { font-size: 13px; padding: 7px 10px; }

.rr-kind {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    margin-left: 4px;
    vertical-align: middle;
}
.rr-kind-api { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.rr-kind-admin { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.rr-kind-cron { background: rgba(217, 119, 6, 0.18); color: #fbbf24; }
.rr-kind-ecss { background: rgba(16, 185, 129, 0.15); color: #34d399; }

.rr-warn {
    margin-top: 10px;
    font-size: 12px;
    color: #fbbf24;
    background: rgba(217, 119, 6, 0.1);
    border: 1px solid rgba(217, 119, 6, 0.3);
    border-radius: 8px;
    padding: 6px 10px;
}
#rrRmaBox[hidden], #rrOrderInfo[hidden], #rrCustomerBox[hidden] { display: none; }

.rr-code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.rr-code-grid .os-label { display: flex; flex-direction: column; gap: 6px; margin-top: 0; }
.rr-code-grid .os-input { width: 100%; }

/* Thong bao co ban giao dien moi sau khi deploy */
.app-update-banner {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100% - 32px);
    background: #0b1222;
    color: var(--text-primary);
    border: 1px solid rgba(34, 197, 94, 0.6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 12px rgba(34, 197, 94, 0.25);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
}

.app-update-banner .btn, .app-update-banner .btn-link { white-space: nowrap; flex-shrink: 0; }

/* =====================================================================
   Tab Cron + hàng đợi dạng gọn
   ===================================================================== */
.os-type-tag.type-cron { background: rgba(217, 119, 6, 0.18); color: #fbbf24; }

.cron-toolbar { display: flex; gap: 8px; align-items: center; }
.cron-toolbar .os-input { flex: 1; min-width: 0; }
.cron-list {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    max-height: 460px;
    overflow-y: auto;
}
.cron-group + .cron-group { border-top: 1px solid var(--border-color); }
.cron-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    background: var(--bg-hover);
    position: sticky;
    top: 0;
    z-index: 1;
}
.cron-col-head { margin-left: auto; font-size: 11px; color: var(--text-muted); cursor: help; border-bottom: 1px dotted var(--text-muted); }
.cron-item {
    display: grid;
    grid-template-columns: 18px auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: 12.5px;
    cursor: pointer;
}
.cron-item:hover { background: var(--bg-hover); }
.cron-name { font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.cron-kind {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    text-transform: uppercase;
}
.cron-kind-cron { background: rgba(217, 119, 6, 0.18); color: #fbbf24; }
.cron-kind-queue { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.cron-last { font-size: 11px; white-space: nowrap; }
.cron-last-ok { color: #34d399; }
.cron-last-err { color: #fca5a5; }
.cron-last-run { color: #93c5fd; }

.cron-custom { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.cron-custom-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cron-custom-list:empty { display: none; }
.cron-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: ui-monospace, Consolas, monospace;
    padding: 3px 4px 3px 6px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
}
.cron-chip-warn { border-color: rgba(251, 191, 36, 0.6); }

/* Hàng đợi gọn: mỗi job 1 dòng */
.os-job-list-compact { gap: 3px; max-height: 420px; }
.os-job-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
}
.os-job-compact .os-job-what { font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.os-job-compact .os-job-when { font-size: 11px; }
.os-job-compact .os-state { font-size: 10px; padding: 1px 6px; }
.os-steps-compact { display: flex; flex-wrap: wrap; gap: 4px; }
.os-step-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: ui-monospace, Consolas, monospace;
    padding: 2px 4px 2px 8px;
    border-radius: 6px;
    background: var(--bg-main);
    border-left: 3px solid var(--border-color);
}
.os-step-chip .os-state { font-family: Inter, sans-serif; font-size: 10px; padding: 1px 6px; }

@media (max-width: 600px) {
    .cron-item { grid-template-columns: 18px auto minmax(0, 1fr); }
    .cron-last { grid-column: 3; }
    .cron-custom { grid-template-columns: minmax(0, 1fr) auto; }
    .cron-custom select { grid-column: 1 / -1; }
    .os-job-compact .os-job-when { display: none; }
}

/* Số lệnh đã chọn (tab Cron) */
.cron-summary { font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cron-summary-on { color: var(--text-primary); font-weight: 600; }
.cron-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
}
.cron-count-cron { background: rgba(217, 119, 6, 0.22); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.55); }
.cron-count-queue { background: rgba(99, 102, 241, 0.22); color: #a5b4fc; border: 1px solid rgba(165, 180, 252, 0.55); }

/* Log job: nút copy góc trên bên phải, tô màu từng khối lệnh */
.os-log-body { position: relative; }
.os-log-copy {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 1;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
}
.os-log-copy:hover { color: var(--text-primary); border-color: var(--text-muted); }
.os-log pre .log-head {
    display: inline-block;
    margin-top: 6px;
    font-weight: 700;
    color: #fbbf24;
}
.os-log pre .log-cmd { color: #93c5fd; }
.os-log pre .log-out { color: var(--text-secondary); }
.os-log pre .log-warn { color: #d4a72c; }
.os-log pre .log-ok { color: #34d399; font-weight: 600; }
.os-log pre .log-err { color: #fca5a5; font-weight: 600; }

/* ===================== Version + lịch sử cập nhật (js/changelog.js) ===================== */
.version-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.version-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.version-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.version-dot {
    display: none;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 2px var(--bg-main);
}
.version-btn.has-unseen .version-dot { display: block; }

.changelog-dialog {
    margin: auto;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    width: min(640px, calc(100vw - 32px));
    max-height: min(80vh, 720px);
    overflow: hidden; /* chi phan noi dung (.cl-body) cuon */
}
.changelog-dialog::backdrop { background: rgba(2, 6, 23, 0.6); }
.cl-panel { display: flex; flex-direction: column; max-height: calc(min(80vh, 720px) - 2px); }
.cl-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}
.cl-top h2 { font-size: 16px; }
.cl-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.cl-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.cl-body { overflow-y: auto; padding: 6px 18px 16px; }
.cl-entry { padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.cl-entry:last-child { border-bottom: none; }
.cl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.cl-head b { font-size: 15px; }
.cl-date { color: var(--text-muted); font-size: 12px; }
.cl-tag { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.cl-tag-current { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.cl-tag-unseen { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.cl-entry ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.cl-entry li { font-size: 13px; line-height: 1.5; color: var(--text-secondary); display: flex; gap: 8px; align-items: baseline; }
.cl-type {
    flex: none;
    min-width: 64px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 6px;
}
.cl-type-new { background: var(--blue-bg); color: #38bdf8; }
.cl-type-improve { background: var(--purple-bg); color: #a78bfa; }
.cl-type-fix { background: var(--yellow-bg); color: #fbbf24; }
.cl-empty { color: var(--text-muted); padding: 12px 0; }

/* ===================== Tab Cancel order ===================== */
.os-type-tag.type-cancel { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
#coAccountBox[hidden], #coOrderInfo[hidden] { display: none; }
#coAccountBox { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.co-account-head { display: flex; align-items: center; gap: 8px; }
.co-account-head .os-label { margin: 0; }
.co-account-type {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}
.co-account-type.guest { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.co-account-type.customer { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.co-account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    align-items: end;
}
.co-account-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}
.co-account-grid .co-span2 { grid-column: 1 / -1; }
.co-account-grid .os-input { font-size: 13px; padding: 7px 10px; width: 100%; box-sizing: border-box; }
.co-account-grid .os-input[readonly] { opacity: 0.75; cursor: not-allowed; }
.co-account-grid .os-input:disabled { opacity: 0.4; cursor: not-allowed; }
.co-account-grid .os-input.co-required { border-color: rgba(251, 191, 36, 0.6); }
.co-note {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 8px;
    padding: 8px 10px;
}
.co-select { font-size: 12px; padding: 4px 8px; margin-left: 6px; width: auto; }
.co-items { margin-top: 8px; font-size: 12px; color: var(--text-secondary); }

/* ===================== Đăng nhập (login.html) + menu user trên header (js/shell.js) ===================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.login-brand { gap: 12px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.login-form .os-input {
    width: 100%;
    font-size: 14px;
    padding: 9px 12px;
    background: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
}
.login-form .os-input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
.login-btn { justify-content: center; padding: 10px 16px; font-size: 14px; }
.login-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
}
.login-note { font-size: 12px; color: var(--text-muted); text-align: center; }

.user-menu { position: relative; }
.user-menu[hidden] { display: none; }
.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 50;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.user-dropdown[hidden] { display: none; }
.user-dropdown-role { font-size: 12px; color: var(--text-muted); padding: 6px 10px; }
.user-dropdown button {
    text-align: left;
    background: none;
    border: 0;
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.user-dropdown button:hover, .user-dropdown button:focus-visible { background: var(--bg-hover); outline: none; }
.user-dropdown button[hidden] { display: none; }

.locks-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.locks-table th, .locks-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border-color); }
.locks-table th { color: var(--text-secondary); font-weight: 600; }
