body {
    font-family: Arial, sans-serif;
    background: #f6f8fa;
    color: #111827;
    margin: 0;
    padding: 0;
}

.page {
    max-width: 1100px;
    /* margin: 24px auto; */
    margin-left: 0px;
    padding: 0 10px 0px;
}

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

.page > .header {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

h1 {
    margin: 0;
    font-size: 22px;
}

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

.actions button {
    background: #2563eb;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.actions button:hover {
    background: #1d4ed8;
}

/* .api-toggle-bar {
    margin: 8px 0 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-start;
} */

.api-toggle-bar .api-toggle-btn {
    background: #2563eb;
    color: white;
    border: 1px solid #1d4ed8;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: inline-block;
}

.api-toggle-bar .api-toggle-btn:hover {
    opacity: 0.9;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.balances {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.balance-pill {
    background: #f3f4f6;
    border-radius: 999px;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 600
}

.api-toggle-btn.api-on {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
    height: 30px;
    width: 160px;
}
.api-toggle-btn.api-off {
    background: #dc2626;
    border-color: #b91c1c;
    color: #fff;
}

.api-toggle-btn.api-inline {
    margin-top: 0px;
    padding: 2px 10px;
    font-size: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    height: 24px;
    width: 75px;
}

.margin-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
}

.margin-btn:hover {
    background: #f3f4f6;
}

.limit-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    cursor: pointer;
    min-width: 70px;
}

.limit-btn:hover {
    background: #e0e7ff;
}

.toggle-enabled {
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
}
.toggle-enabled input {
    transform: scale(1.1);
}

#stock-refresh-btn {
    background: #16a34a;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

#stock-refresh-btn:hover {
    background: #15803d;
}

#last-updated {
    font-size: 12px;
    color: #6b7280;
}

.table-wrap {
    overflow-x: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.table-wrap,
.stock-wrap,
.rbs-stock-wrap,
.margins-wrap {
    display: inline-block;
    width: 100%;
    max-width: 800px;
}
/*
.margins-wrap {
    float: left;
    margin-left: 65px;
    margin-right: 0;
    margin-bottom: 40px;
    clear: both;
} */

.pending-wrap,
.compl-wrap {
    display: block;
    width: 860px;
    max-width: 100%;
}

table.status-table {
    border-collapse: collapse;
    /* width: 100%; */
    font-size: 13px;
    table-layout: fixed; /* allow explicit widths to take effect */
}

.status-wrap .status-table,
.stock-wrap .status-table {
    width: auto;
    min-width: 0;
}

.pending-wrap .status-table,
.compl-wrap .status-table,
.rbs-stock-wrap .status-table {
    width: auto;
    min-width: 0;
}

table.status-table th,
table.status-table td {
    border: 1px solid #e5e7eb;
    border-color: gray;
    padding: 4px 8px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.status-table.status-main th {
  padding: 2px 4px;
  font-size: 12px;
  color: #4b5563;
  /* width: 120px; */ /* optional, can also set per-column below */
}
.status-table.status-main td {
  padding: 2px 4px;
  font-size: 12px;
  color: #111827;
  /* width: 120px; */
}

table.status-table th {
    background: #f3f4f6;
    font-weight: 700;
}

table.status-table tr.on-row {
    background-color: #d4edda;
}

table.status-table tr:hover {
    background: #eef2ff;
}

.complaint-resolved {
    background: #d4edda;
}

.zone-ap td:nth-child(2),
.zone-ap td:nth-child(4) {
    font-weight: 700;
    color: red;
}

/* .zone-ap td {
    background: #ffe0e0 !important;
    color: #b91c1c !important;
    font-weight: 600;
} */
.complaint-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 6px 8px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #312e81;
}

.complaint-btn:hover {
    background: #c7d2fe;
}

.complaint-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.complaint-modal.active {
    display: flex;
}

.complaint-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.complaint-modal-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    width: min(900px, 95%);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    z-index: 1;
}

.complaint-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #111827;
}

.complaint-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
}

.complaint-modal-header h3 {
    margin: 0;
}

.complaint-modal-meta {
    font-size: 12px;
    color: #6b7280;
}

.complaint-modal-body {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}

.complaint-modal-body section {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
}

.complaint-modal-body h4 {
    margin: 0 0 8px;
    font-size: 14px;
}

.kv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.kv-table th,
.kv-table td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
    background: #fff;
}

.kv-table th {
    width: 35%;
    background: #f3f4f6;
    color: #374151;
}

.complaint-modal-actions {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.complaint-modal-actions label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #374151;
    gap: 4px;
}

.complaint-modal-actions input,
.complaint-modal-actions textarea {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    width: 100%;
}

.complaint-action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.complaint-action-btn {
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
}

.complaint-action-btn.accept {
    background: #10b981;
}

.complaint-action-btn.decline {
    background: #ef4444;
}

.complaint-action-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.complaint-action-status {
    min-height: 18px;
    font-size: 12px;
    color: #374151;
}

.muted {
    color: #6b7280;
    font-size: 12px;
}

.type-all td {
    background: #ffe4e1;
    /* background: #fef9c3 !important; */
    /* color: #92400e !important; */
    /* font-weight: 600; */

}

.status-enabled {
    color: #2563eb;
    font-weight: 700;
}

.status-disabled {
    color: #dc2626;
    font-weight: 700;
}

.seller-off {
    color: #dc2626;
    font-weight: 700;
}

.table-wrap.resources {
    margin-top: 16px;
}

.page { max-width: 800px; }           /* make the whole page wider */
.status-wrap { width: 100%; max-width: 800px; }  /* or set a larger max */

.stock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.stock-header h2 {
    margin: 0;
    padding: 0;
    font-size: 1.6rem;
    line-height: 1.2;
}

.stock-header.meta {
    display: flex;
    gap: 6px;
    row-gap: 4px;
    align-items: center;
    /* justify-content: flex-end; */
    margin-left: auto;
    font-size: 0.9rem;
    color: #4b5563;
    flex-wrap: wrap;
    line-height: 1.1;
}

.stock-header.meta span {
    white-space: nowrap;
}

.stock-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.snapshot-filter-row {
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.snapshot-filter-row .filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.snapshot-filter-row .filter-checkboxes label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.6rem;
    font-size: 0.85rem;
}
.snapshot-filter-row .filter-checkboxes {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}
.snapshot-filter-row .filter-checkboxes input {
    width: 16px;
    height: 16px;
}

.stock-table td.zone-ap,
.top-margins td.zone-ap {
    color: red;
    font-weight: 700;
}

.stock-actions .denom-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.stock-actions .denom-control input {
    width: 35px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}

#pdrs-combined-denom-input {
    width: 50px;
}

.stock-actions .zone-control select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    background: #fff;
}

.rows-per-type-control input {
    width: 40px;
}

.small-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-weight: 600;
}

.small-btn:hover {
    background: #1d4ed8;
}

.combined-reex-row {
    background-color: #ffe5e7;
}

.combined-pdrs-row {
    background-color: #8cecac;
}

.combined-rbs-row {
    background-color: #e0f2ff;
}

.combined-zone-ap td {
    font-weight: 700;
    color: #b91c1c;
}

#operator-filters label {
    margin-right: 8px;
    white-space: nowrap;
}

.stock-filter-bar {
    margin-top: 8px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.stock-filter-bar label {
    font-size: 12px;
    background: #eef2ff;
    border-radius: 999px;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 0px;
}
.stock-filter-bar input {
    margin: 0;
}

.stock-filter-row {
    margin-top: 0px;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    align-items: center;
}
.stock-filter-row .stock-filter-bar {
    margin-top: 0;
}
.stock-filter-row .filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.stock-updated {
    margin-left: auto;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.stock-updated .meta {
    font-size: 16px;
    color: #6b7280;
}

/* Status table column widths */
.status-table.status-main {
    width: 100%;
    max-width: 800px;
    table-layout: fixed;
    display: inline-table;
}
.status-table.status-main tr {
  height: 30px;
}

.status-table.status-main th:nth-child(1),
.status-table.status-main td:nth-child(1) { width: 50px; }
.status-table.status-main th:nth-child(2),
.status-table.status-main td:nth-child(2) { width: 90px; }
.status-table.status-main th:nth-child(3),
.status-table.status-main td:nth-child(3) { width: 46px; }
.status-table.status-main th:nth-child(4),
.status-table.status-main td:nth-child(4) { width: 60px; }  /* Status */
.status-table.status-main th:nth-child(5),
.status-table.status-main td:nth-child(5) { width: 40px; }   /* Margin */
.status-table.status-main th:nth-child(6),
.status-table.status-main td:nth-child(6) { width: 50px; }   /* Ava Limit */
.status-table.status-main th:nth-child(7),
.status-table.status-main td:nth-child(7) { width: 50px; }
.status-table.status-main th:nth-child(8),
.status-table.status-main td:nth-child(8) { width: 50px; }
.status-table.status-main th:nth-child(9),
.status-table.status-main td:nth-child(9) { width: 50px; }
.status-table.status-main th:nth-child(10),
.status-table.status-main td:nth-child(10) { width: 70px; }


/* Status table column widths */
.status-table.stock-table {
    width: auto;
    max-width: 100%;
    table-layout: fixed;
    display: inline-table;
}

.status-table.stock-table th:nth-child(1),
.status-table.stock-table td:nth-child(1) { width: 140px; }   /* CurrentTime */
.status-table.stock-table th:nth-child(2),
.status-table.stock-table td:nth-child(2) { width: 60px; }    /* Zone */
.status-table.stock-table th:nth-child(3),
.status-table.stock-table td:nth-child(3) { width: 60px; }    /* Type */
.status-table.stock-table th:nth-child(4),
.status-table.stock-table td:nth-child(4) { width: 80px; }    /* Margin */
.status-table.stock-table th:nth-child(5),
.status-table.stock-table td:nth-child(5) { width: 110px; }   /* Amount */
.status-table.stock-table th:nth-child(6),
.status-table.stock-table td:nth-child(6) { width: 90px; }    /* AvaLimit */
.status-table.stock-table th:nth-child(7),
.status-table.stock-table td:nth-child(7) { width: 100px; }   /* API Name */
.status-table.stock-table th:nth-child(8),
.status-table.stock-table td:nth-child(8) { width: 110px; }   /* Operator */
.status-table.stock-table .amount { max-width: 250px; }       /* Amount cells truncated */

/* status-pending */
.status-table.status-pending th:nth-child(1),
.status-table.status-pending td:nth-child(1) { width: 30px; }
.status-table.status-pending th:nth-child(2),
.status-table.status-pending td:nth-child(2) { width: 50px; }
.status-table.status-pending th:nth-child(3),
.status-table.status-pending td:nth-child(3) { width: 35px; }
.status-table.status-pending th:nth-child(4),
.status-table.status-pending td:nth-child(4) { width: 25px; }
.status-table.status-pending th:nth-child(5),
.status-table.status-pending td:nth-child(5) { width: 50px; }
.status-table.status-pending th:nth-child(6),
.status-table.status-pending td:nth-child(6) { width: 15px; }
.status-table.status-pending th:nth-child(7),
.status-table.status-pending td:nth-child(7) { width: 55px; }
.status-table.status-pending tbody td { color: #8B4513; }

/* status compliants */
.status-table.status-compl th:nth-child(1),
.status-table.status-compl td:nth-child(1) { width: 30px; }
.status-table.status-compl th:nth-child(2),
.status-table.status-compl td:nth-child(2) { width: 30px; }
.status-table.status-compl th:nth-child(3),
.status-table.status-compl td:nth-child(3) { width: 35px; }
.status-table.status-compl th:nth-child(4),
.status-table.status-compl td:nth-child(4) { width: 25px; }
.status-table.status-compl th:nth-child(5),
.status-table.status-compl td:nth-child(5) { width: 50px; }
.status-table.status-compl th:nth-child(6),
.status-table.status-compl td:nth-child(6) { width: 15px; }
.status-table.status-compl th:nth-child(7),
.status-table.status-compl td:nth-child(7) { width: 55px; }
.status-table.status-compl tbody td { color: #B71C1C; }

.status-table.rbs-stock-table th,
.status-table.rbs-stock-table td,
.status-table.rbs-table th,
.status-table.rbs-table td {
    width: calc(100% / 9);
}

/* status rbs tables apall */
.status-table.rbs-stock-table th:nth-child(1),
.status-table.rbs-stock-table td:nth-child(1),
.status-table.rbs-table th:nth-child(1),
.status-table.rbs-table td:nth-child(1) { width: 140px; }
.status-table.rbs-stock-table th:nth-child(2),
.status-table.rbs-stock-table td:nth-child(2),
.status-table.rbs-table th:nth-child(2),
.status-table.rbs-table td:nth-child(2) { width: 40px; }
.status-table.rbs-stock-table th:nth-child(3),
.status-table.rbs-stock-table td:nth-child(3),
.status-table.rbs-table th:nth-child(3),
.status-table.rbs-table td:nth-child(3) { width: 50px; }
.status-table.rbs-stock-table th:nth-child(4),
.status-table.rbs-stock-table td:nth-child(4),
.status-table.rbs-table th:nth-child(4),
.status-table.rbs-table td:nth-child(4) { width: 50px; }
.status-table.rbs-stock-table th:nth-child(5),
.status-table.rbs-stock-table td:nth-child(5),
.status-table.rbs-table th:nth-child(5),
.status-table.rbs-table td:nth-child(5) { width: 110px; }
.status-table.rbs-stock-table th:nth-child(6),
.status-table.rbs-stock-table td:nth-child(6),
.status-table.rbs-table th:nth-child(6),
.status-table.rbs-table td:nth-child(6) { width: 55px; }
.status-table.rbs-stock-table th:nth-child(7),
.status-table.rbs-stock-table td:nth-child(7),
.status-table.rbs-table th:nth-child(7),
.status-table.rbs-table td:nth-child(7) { width: 50px; }
.status-table.rbs-stock-table th:nth-child(8),
.status-table.rbs-stock-table td:nth-child(8),
.status-table.rbs-table th:nth-child(8),
.status-table.rbs-table td:nth-child(8) { width: 50px; }
.status-table.rbs-stock-table th:nth-child(9),
.status-table.rbs-stock-table td:nth-child(9),
.status-table.rbs-table th:nth-child(9),
.status-table.rbs-table td:nth-child(9) { width: 55px; }

.self-stock-row td {
  background-color: #0d47a1;
  color: #fff;
  font-weight: 600;
}

/* top margins */
.status-table.top-margins th:nth-child(1),
.status-table.top-margins td:nth-child(1) { width: 60px; }   /* CurrentTime */
.status-table.top-margins th:nth-child(2),
.status-table.top-margins td:nth-child(2) { width: 140px; }    /* Zone */
.status-table.top-margins th:nth-child(3),
.status-table.top-margins td:nth-child(3) { width: 45px; }    /* Type */
.status-table.top-margins th:nth-child(4),
.status-table.top-margins td:nth-child(4) { width: 55px; }    /* Margin */
.status-table.top-margins th:nth-child(5),
.status-table.top-margins td:nth-child(5) { width: 50px; }   /* Amount */
.status-table.top-margins th:nth-child(6),
.status-table.top-margins td:nth-child(6) { width: 160px; }    /* AvaLimit */
.status-table.top-margins th:nth-child(7),
.status-table.top-margins td:nth-child(7) { width: 90px; }   /* API Name */
.status-table.top-margins th:nth-child(8),
.status-table.top-margins td:nth-child(8) { width: 60px; }   /* Operator */
.status-table.top-margins .amount { max-width: 250px; }       /* Amount cells truncated */

.ap-zone-highlight {
    color: #b91c1c;
    font-weight: 600;
}

.ap-category-all {
    background-color: #e0ffff;
}
