/* ─── Root tokens ─── */
:root {
    --csh-border: rgba(255, 255, 255, 0.12);
    --csh-bg-card: var(--bs-surface-2-bg, #1b222b);
    --csh-main-light: rgba(238, 97, 25, 0.15);
    --csh-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --csh-drawer-width: 44vw;
}

/* ─── Config container ─── */
.menu-create-page.setting-page:has(.cashier-setting-config:not(.dis-none)) {
    grid-template-rows: min-content 1fr;
}

.cashier-setting-config {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.csh-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0 var(--px-24) var(--px-12) var(--px-24);
    color: var(--bs-text);
}

/* ─── Toolbar ─── */
.csh-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--px-12);
    padding: var(--px-8) 0 var(--px-12) 0;
    flex-shrink: 0;
}

.csh-search-wrapper {
    display: flex;
    align-items: center;
    gap: var(--px-8);
    flex: 1;
    max-width: 360px;
    background: #1e2632;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--px-8);
    padding: var(--px-8) var(--px-12);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.csh-search-wrapper:focus-within {
    border-color: var(--bs-main, #ee6119);
    background-color: #243040;
    box-shadow: 0 0 0 3px rgba(238, 97, 25, 0.25);
}

.csh-search-wrapper i {
    color: #94a3b8;
    font-size: 14px;
    flex-shrink: 0;
}

.csh-search-input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    font-size: var(--s-14);
    color: #ffffff;
    min-width: 0;
}

.csh-search-input::placeholder {
    color: #94a3b8;
}

.csh-search-input:focus {
    border: none;
}

.csh-search-input::placeholder {
    color: var(--bs-text-muted);
}

.csh-actions-right {
    display: flex;
    align-items: center;
    gap: var(--px-8);
    flex-shrink: 0;
}

/* ─── Buttons ─── */
.csh-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--px-6);
    padding: var(--px-8) var(--px-16);
    border-radius: var(--px-8);
    border: 1px solid transparent;
    cursor: pointer;
    font: normal normal 500 var(--s-14);
    transition: all 0.2s;
    white-space: nowrap;
}

.csh-btn-primary {
    background-color: var(--bs-main);
    color: #fff;
    border-color: var(--bs-main);
}

.csh-btn-primary:hover {
    filter: brightness(1.1);
}

.csh-btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.csh-btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* ─── Main layout ─── */
.csh-main-layout {
    display: flex;
    gap: var(--px-24);
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.csh-list-container {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--csh-bg-card);
    border-radius: var(--px-12);
    box-shadow: var(--csh-shadow);
    overflow: hidden;
    border: 1px solid var(--csh-border);
    position: relative;
}

.csh-table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
    width: 100%;
}

/* ─── Table ─── */
.csh-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font: normal normal 500 var(--s-14);
}

.csh-table th {
    padding: var(--px-12) var(--px-16);
    background-color: #1e2632;
    color: var(--bs-text-muted);
    border-bottom: 1px solid var(--csh-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.csh-table td {
    padding: var(--px-10) var(--px-16);
    border-bottom: 1px solid var(--csh-border);
    transition: background-color 0.15s;
    white-space: nowrap;
    vertical-align: middle;
    color: #ffffff;
}

.csh-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.csh-row-disabled td {
    color: var(--bs-text-muted);
    opacity: 0.65;
}

/* Action buttons */
.csh-btn-edit-row,
.csh-btn-delete-row {
    background: none;
    border: none;
    padding: var(--px-6) var(--px-10);
    border-radius: var(--px-6);
    cursor: pointer;
    color: var(--bs-text-muted);
    transition: all 0.2s;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: auto;
}

.csh-btn-edit-row:hover {
    background-color: var(--csh-main-light);
    color: var(--bs-main);
}

.csh-btn-delete-row:hover {
    background-color: #fef2f2;
    color: #ef4444;
}

/* Enable / Disable toggle button */
.csh-btn-toggle {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    margin-right: 4px;
}

.csh-btn-enable {
    background-color: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

.csh-btn-enable:hover {
    background-color: #dcfce7;
}

.csh-btn-disable {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.csh-btn-disable:hover {
    background-color: #fee2e2;
}

/* Loading overlay */
.csh-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font: normal normal 500 var(--s-14);
    color: var(--bs-text);
    z-index: 100;
}

/* ─── Drawer ─── */
.csh-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.csh-drawer-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.csh-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--csh-drawer-width);
    height: 100%;
    background: var(--bs-surface-bg, #151a20);
    color: #ffffff;
    box-shadow: -4px 0 24px rgb(0 0 0 / 0.4);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.csh-drawer.active {
    transform: translateX(0);
}

.csh-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Form inside drawer must also be a flex column to allow body scrolling */
#csh-drawer-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.csh-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--px-16) var(--px-20);
    border-bottom: 1px solid var(--csh-border);
    flex-shrink: 0;
    background: var(--bs-surface-bg, #151a20);
}

.csh-drawer-header h3 {
    margin: 0;
    font-size: var(--s-16);
    font-weight: 600;
    color: #ffffff;
}

.csh-drawer-close {
    background: none;
    border: none;
    font: normal normal 500 var(--s-20);
    cursor: pointer;
    color: var(--bs-text-muted);
    padding: var(--px-4) var(--px-8);
    border-radius: var(--px-4);
    transition: all 0.2s;
    line-height: 1;
    min-width: auto;
}

.csh-drawer-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.csh-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--px-20);
}

.csh-drawer-footer {
    display: flex;
    align-items: center;
    gap: var(--px-8);
    padding: var(--px-16) var(--px-20);
    border-top: 1px solid var(--csh-border);
    flex-shrink: 0;
    background: var(--bs-surface-bg, #151a20);
}

/* ─── Drawer Form ─── */
.csh-section-title {
    font: normal normal 600 var(--s-14);
    color: #ffffff;
    margin-bottom: var(--px-12);
    padding-bottom: var(--px-6);
    border-bottom: 1px solid var(--csh-border);
}

.csh-form-row {
    display: flex;
    align-items: center;
    gap: var(--px-12);
    margin-bottom: var(--px-10);
}

.csh-form-label {
    width: 110px;
    flex-shrink: 0;
    font-size: var(--s-14);
    color: #ffffff;
    font-weight: 500;
}

.csh-form-control {
    flex: 1;
    padding: var(--px-8) var(--px-10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--px-6);
    font: normal normal 500 var(--s-14);
    color: #ffffff;
    background: #1e2632;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

.csh-form-control:focus {
    border-color: var(--bs-main, #ee6119);
    background: #243040;
    box-shadow: 0 0 0 3px rgba(238, 97, 25, 0.25);
}

.csh-form-control:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--bs-text-muted);
    cursor: not-allowed;
}

.csh-form-control.is-invalid {
    border-color: #ef4444;
}

.csh-form-row-split {
    gap: var(--px-12);
    align-items: flex-start;
}

.csh-form-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--px-4);
    min-width: 0;
}

.csh-form-col .csh-form-label {
    width: auto;
    font-size: var(--s-13, 13px);
}

.csh-form-col .csh-form-control {
    width: 100%;
}

/* ─── Location table ─── */
.csh-location-table-wrapper {
    border: 1px solid var(--csh-border);
    border-radius: var(--px-6);
    overflow: auto;
    max-height: 240px;
}

.csh-location-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--s-14);
}

.csh-location-table th {
    padding: var(--px-8) var(--px-12);
    background: #1e2632;
    color: var(--bs-text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    position: sticky;
    top: 0;
    z-index: 2;
    font-weight: 600;
    white-space: nowrap;
}

.csh-location-table td {
    padding: var(--px-6) var(--px-12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    vertical-align: middle;
    white-space: nowrap;
}

.csh-location-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* ─── Reusable Checkbox Component (.csh-chk-*) ─── */
.csh-chk-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.csh-chk-wrap input[type="checkbox"] {
    display: none;
}

.csh-chk-mark {
    width: 16px;
    height: 16px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    background: #1e2632;
    transition: all 0.15s;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;      /* clip ::after so it never affects outer layout */
}

.csh-chk-wrap input[type="checkbox"]:checked + .csh-chk-mark {
    background: var(--bs-main);
    border-color: var(--bs-main);
}

.csh-chk-wrap input[type="checkbox"]:checked + .csh-chk-mark::after {
    content: '';
    display: block;
    width: 4px;
    height: 7px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
}

/* Legacy alias – keep backward-compatible if anything still uses csh-loc-checkbox */
.csh-loc-checkbox { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.csh-loc-checkbox input[type="checkbox"] { display: none; }
.csh-loc-checkmark { width:16px; height:16px; border:1.5px solid rgba(255, 255, 255, 0.25); border-radius:3px; background:#1e2632; transition:all 0.15s; flex-shrink:0; display:inline-flex; align-items:center; justify-content:center; }
.csh-loc-checkbox input[type="checkbox"]:checked+.csh-loc-checkmark { background:var(--bs-main); border-color:var(--bs-main); }
.csh-loc-checkbox input[type="checkbox"]:checked+.csh-loc-checkmark::after { content:''; display:block; width:4px; height:7px; border:2px solid #fff; border-top:none; border-left:none; transform:rotate(45deg) translate(-1px,-1px); }

/* ─── Function Permission Modal ─── */
.csh-fp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.csh-fp-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.csh-fp-panel {
    background: #151a20;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--px-12);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 480px;
    max-width: 94vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.94) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.csh-fp-overlay.active .csh-fp-panel {
    transform: scale(1) translateY(0);
}

.csh-fp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--px-14, 14px) var(--px-20);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: #18202a;
    flex-shrink: 0;
}

.csh-fp-header h4 {
    margin: 0;
    font-size: var(--s-15, 15px);
    font-weight: 600;
    color: #ffffff;
}

.csh-fp-meta {
    display: flex;
    gap: var(--px-16);
    padding: var(--px-10, 10px) var(--px-20);
    border-bottom: 1px solid var(--csh-border);
    font-size: var(--s-13, 13px);
    color: var(--bs-text-muted);
    background: #fafbfc;
    flex-shrink: 0;
}

.csh-fp-meta span strong {
    color: var(--bs-text);
    font-weight: 600;
}

.csh-fp-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--px-8) 0;
}

/* Parent row */
.csh-fp-parent {
    display: flex;
    align-items: center;
    gap: var(--px-8);
    padding: var(--px-8) var(--px-20);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    font-size: var(--s-14);
    font-weight: 600;
    color: var(--bs-text);
}

.csh-fp-parent:hover {
    background: rgba(255, 255, 255, 0.04);
}

.csh-fp-arrow {
    font-size: 11px;
    color: var(--bs-text-muted);
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.csh-fp-parent.expanded .csh-fp-arrow {
    transform: rotate(90deg);
}

/* Children container */
.csh-fp-children {
    display: none;
    background: #10141a;
}

.csh-fp-children.open {
    display: block;
}

/* Child row */
.csh-fp-child {
    display: flex;
    align-items: center;
    gap: var(--px-8);
    padding: var(--px-6) var(--px-20) var(--px-6) 52px;
    font-size: var(--s-14);
    color: var(--bs-text);
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.csh-fp-child:last-child {
    border-bottom: none;
}

.csh-fp-child:hover {
    background: rgba(255, 255, 255, 0.04);
}

.csh-fp-child-label {
    flex: 1;
    font-size: var(--s-13, 13px);
    color: var(--bs-text-muted);
}

.csh-fp-parent-label {
    flex: 1;
}

/* Empty state */
.csh-fp-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--bs-text-muted);
    font-size: var(--s-14);
}

/* Footer */
.csh-fp-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--px-8);
    padding: var(--px-14, 14px) var(--px-20);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: #18202a;
    flex-shrink: 0;
}

/* Loading spinner inside modal body */
.csh-fp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    font-size: var(--s-14);
    color: var(--bs-text-muted);
}

/* ─── Report Security Modal ─── */
.csh-rs-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.csh-rs-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.csh-rs-panel {
    background: #151a20;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--px-12);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 860px;
    max-width: 96vw;
    height: 80vh;
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.94) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.csh-rs-overlay.active .csh-rs-panel {
    transform: scale(1) translateY(0);
}

/* Header */
.csh-rs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--px-14, 14px) var(--px-20);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: #18202a;
    flex-shrink: 0;
}

.csh-rs-header h4 {
    margin: 0;
    font: normal normal 600 var(--s-15, 15px);
    color: #ffffff;
}

/* Body: two-column layout */
.csh-rs-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left column – Group list */
.csh-rs-group-col {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--csh-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.csh-rs-col-title {
    padding: var(--px-10) var(--px-14);
    font: normal normal 600 var(--s-13, 13px);
    color: var(--bs-main, #ee6119);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: #18202a;
    flex-shrink: 0;
}

.csh-rs-group-list {
    flex: 1;
    overflow-y: auto;
}

.csh-rs-group-item {
    padding: var(--px-8) var(--px-14);
    font: normal normal 500 var(--s-13);
    color: var(--bs-text);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.csh-rs-group-item:hover {
    background: rgba(238, 97, 25, 0.12);
    color: var(--bs-main, #ee6119);
}

.csh-rs-group-item.active {
    background: var(--bs-main, #ee6119);
    color: #fff;
}

/* Right column – Report list */
.csh-rs-report-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.csh-rs-report-table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.csh-rs-report-table {
    width: 100%;
    border-collapse: collapse;
    font: normal normal 500 var(--s-13);
}

.csh-rs-report-table th {
    padding: var(--px-8) var(--px-12);
    background: #1e2632;
    color: var(--bs-text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    position: sticky;
    top: 0;
    z-index: 2;
    font-weight: 600;
    white-space: nowrap;
}

.csh-rs-report-table td {
    padding: var(--px-8) var(--px-12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
    color: var(--bs-text);
    height: 38px;          /* lock row height — prevents shift when checkbox toggles */
    box-sizing: border-box;
}

.csh-rs-report-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.csh-rs-report-table th:last-child,
.csh-rs-report-table td:last-child {
    width: 80px;
    text-align: center;
}

/* Empty state */
.csh-rs-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 20px;
    font: normal normal 500 var(--s-13);
    color: var(--bs-text-muted);
    gap: 8px;
}

/* Footer */
.csh-rs-footer {
    display: flex;
    align-items: center;
    gap: var(--px-8);
    padding: var(--px-12) var(--px-20);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: #18202a;
    flex-shrink: 0;
}

.csh-rs-footer-spacer {
    flex: 1;
}

/* Action buttons in footer */
.csh-rs-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--px-6);
    padding: var(--px-8) var(--px-14);
    border-radius: var(--px-6);
    border: 1px solid rgba(255, 255, 255, 0.18);
    cursor: pointer;
    font: normal normal 500 var(--s-13);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transition: all 0.18s;
    white-space: nowrap;
}

.csh-rs-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
}

.csh-rs-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.csh-rs-btn-grant {
    background: rgba(238, 97, 25, 0.15);
    color: var(--bs-main, #ee6119);
    border-color: rgba(238, 97, 25, 0.3);
}

.csh-rs-btn-grant:hover {
    background: rgba(238, 97, 25, 0.25);
}

.csh-rs-btn-remove {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.csh-rs-btn-remove:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Loading row */
.csh-rs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 20px;
    font: normal normal 500 var(--s-13);
    color: var(--bs-text-muted);
}

/* ─── Validation ─── */
.csh-required {
    color: #ef4444;
}

.csh-error-message {
    color: #ef4444;
    font-size: var(--s-12, 12px);
    margin-top: 2px;
    flex-basis: 100%;
    padding-left: 122px;
}

/* ─── Responsive ─── */

/* ── Medium screens (≤ 1024px): tighten up slightly ── */
@media (max-width: 1024px) {
    .csh-rs-panel {
        width: 96vw;
    }
}

/* ── Tablet (≤ 900px): shrink group column, keep two-column layout ── */
@media (max-width: 900px) {
    .csh-rs-panel {
        width: 98vw;
        height: 85vh;
        max-height: 90vh;
    }

    .csh-rs-group-col {
        width: 160px;
    }

    /* Function Permission modal */
    .csh-fp-panel {
        width: 96vw;
    }
}

/* ── Small tablet / large mobile (≤ 768px) ── */
@media (max-width: 768px) {
    :root {
        --csh-drawer-width: 100vw;
    }

    /* Main table */
    .csh-container {
        padding: var(--px-16) var(--px-16) 0;
    }

    .csh-table td,
    .csh-table th {
        padding: var(--px-10) var(--px-10);
    }

    /* Report Security: body switches to vertical stack */
    .csh-rs-panel {
        width: 100vw;
        max-width: 100vw;
        height: 92vh;
        max-height: 95vh;
        border-radius: var(--px-8) var(--px-8) 0 0;
        align-self: flex-end;   /* slides up from bottom */
    }

    /* Overlay aligns to bottom on mobile */
    .csh-rs-overlay {
        align-items: flex-end;
    }

    /* Stack group list above report list */
    .csh-rs-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .csh-rs-group-col {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--csh-border);
        max-height: 140px;   /* compact horizontal-scroll row on mobile */
        flex-shrink: 0;
    }

    .csh-rs-group-list {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .csh-rs-group-item {
        flex-shrink: 0;
        border-bottom: none;
        border-right: 1px solid #f1f5f9;
        padding: var(--px-8) var(--px-12);
    }

    .csh-rs-report-col {
        flex: 1;
        min-height: 0;
    }

    /* Footer buttons wrap */
    .csh-rs-footer {
        flex-wrap: wrap;
        gap: var(--px-6);
        padding: var(--px-10) var(--px-12);
    }

    .csh-rs-footer-spacer {
        display: none;   /* no spacer when wrapping */
    }

    .csh-rs-btn,
    .csh-rs-footer .csh-btn {
        flex: 1 1 auto;
        justify-content: center;
        min-width: 120px;
    }

    /* Function Permission modal */
    .csh-fp-panel {
        width: 100vw;
        max-width: 100vw;
        max-height: 92vh;
        border-radius: var(--px-8) var(--px-8) 0 0;
        align-self: flex-end;
    }

    .csh-fp-overlay {
        align-items: flex-end;
    }
}

/* ── Mobile (≤ 480px): further compact ── */
@media (max-width: 480px) {
    .csh-rs-panel {
        height: 95vh;
    }

    .csh-rs-header h4 {
        font-size: var(--s-13, 13px);
    }

    .csh-rs-btn,
    .csh-rs-footer .csh-btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .csh-rs-report-table th,
    .csh-rs-report-table td {
        padding: 6px 8px;
        font-size: 12px;
    }

    .csh-rs-group-item {
        font-size: 12px;
        padding: 6px 10px;
    }
}