/* Master list template styles — used by Branches and future CRUD pages.
   Prefer logical properties for RTL readiness. */

.ui-icon { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
.ui-icon.tight { margin-inline-start: -10px; }

/* ---- Page header ---- */
.list-page-header { margin-bottom: 18px; }
.list-breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    font-size: 12.5px; color: var(--muted); margin-bottom: 10px;
}
.list-breadcrumb a { color: var(--muted); }
.list-breadcrumb a:hover { color: var(--primary); }
.list-breadcrumb-sep { opacity: .55; }
.list-page-header-row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.list-page-title { font-size: 24px; margin: 0; }
.list-page-desc { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.list-page-actions { display: flex; gap: 8px; align-items: center; }

/* ---- Summary cards ---- */
.summary-cards {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px;
}
.summary-card {
    text-align: start; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
    color: var(--text);
}
.summary-card.is-clickable { cursor: pointer; }
.summary-card.is-clickable:hover { border-color: #fda4af; background: var(--primary-soft); }
.summary-card.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.summary-card:disabled { cursor: default; opacity: 1; color: var(--text); }
.summary-card-label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.summary-card-value {
    display: block; margin-top: 6px; font-size: 22px; font-weight: 700;
    letter-spacing: -.02em; color: var(--text);
}

/* ---- Toolbar ---- */
.list-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow);
}
.list-search {
    position: relative; flex: 1 1 220px; min-width: 180px;
}
.list-search input {
    width: 100%; border: 1px solid var(--border); border-radius: 9px;
    padding: 9px 34px 9px 34px; font-size: 14px; background: var(--input-bg); color: var(--text);
}
.list-search .search-ico {
    position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--muted);
}
.list-search .clear-ico {
    position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
}
.list-toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toolbar-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
    border-radius: 9px; padding: 8px 12px; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.toolbar-btn:hover { background: var(--table-head); }
.toolbar-btn.is-open { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.toolbar-menu {
    position: absolute; z-index: 40; inset-inline-end: 0; top: calc(100% + 6px);
    min-width: 220px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.12); padding: 10px;
    color: var(--text);
}
.toolbar-menu.wide { min-width: 280px; }
.toolbar-pop { position: relative; }
.toolbar-menu label.menu-check {
    display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 13.5px;
    cursor: pointer; color: var(--text);
}
.toolbar-menu .menu-item {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: start;
    border: 0; background: transparent; color: var(--text);
    padding: 8px 10px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
}
.toolbar-menu .menu-item .ui-icon { color: inherit; flex-shrink: 0; }
.toolbar-menu .menu-item:hover:not(:disabled) {
    background: var(--table-head); color: var(--text);
}
.toolbar-menu .menu-item:disabled {
    color: var(--muted); opacity: 0.7; cursor: not-allowed;
}
.toolbar-menu .menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.toolbar-menu .filter-form .field label,
.toolbar-menu .filter-form select,
.toolbar-menu .filter-form input {
    color: var(--text);
}
.toolbar-menu .filter-form select,
.toolbar-menu .filter-form input {
    background: var(--input-bg); border-color: var(--border);
}

.filter-form { display: grid; gap: 10px; }
.filter-form .field label { font-size: 12.5px; }
.filter-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--border); background: var(--table-head); border-radius: 999px;
    padding: 5px 10px; font-size: 12.5px; cursor: pointer; color: var(--text);
}
.filter-chip:hover { background: var(--primary-soft); border-color: #fda4af; }
.chip-x { width: 12px; height: 12px; }
.link-btn {
    border: 0; background: transparent; color: var(--primary); font-weight: 600;
    font-size: 13px; cursor: pointer; padding: 4px 6px;
}

/* ---- Bulk bar ---- */
.bulk-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    margin-bottom: 12px; padding: 10px 14px; border-radius: var(--radius);
    background: #0f172a; color: #e2e8f0;
}
.bulk-bar .btn { padding: 7px 12px; font-size: 13px; }
.bulk-bar .btn.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }

/* ---- Table ---- */
.list-table-wrap {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow-x: auto; overflow-y: visible; box-shadow: var(--shadow);
}
.list-table-scroll {
    max-height: min(70vh, 720px); overflow: auto; border-radius: inherit;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.45) transparent;
}
.list-table-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.list-table-scroll::-webkit-scrollbar-track { background: transparent; }
.list-table-scroll::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border-radius: 999px;
}
.list-table-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.55);
}
[data-theme="dark"] .list-table-scroll {
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}
[data-theme="dark"] .list-table-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.28);
}
[data-theme="dark"] .list-table-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}
table.list-table {
    width: 100%; border-collapse: collapse; font-size: 13.5px;
    table-layout: auto;
}
table.list-table thead th {
    position: sticky; top: 0; z-index: 2;
    text-align: start; padding: 10px 12px; background: var(--table-head); color: var(--muted);
    font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
/* Beat thead th { text-align: start } so numeric headers line up with .num cells. */
table.list-table thead th.num {
    text-align: end;
}
table.list-table td {
    padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.list-table tbody tr:hover { background: var(--row-hover); }
table.list-table tbody tr.is-selected { background: var(--primary-soft); }
table.list-table tbody tr.is-low-stock td { box-shadow: inset 3px 0 0 var(--primary); }
table.list-table tbody tr.is-low-stock.is-selected td { background: var(--primary-soft); }
.branch-card.is-low-stock { box-shadow: inset 3px 0 0 var(--primary); }
.num.neg, .neg { color: var(--primary); font-weight: 600; }
table.list-table .sortable { cursor: pointer; user-select: none; }
table.list-table .sortable:hover { color: var(--text); }
table.list-table .sort-mark { margin-inline-start: 4px; opacity: .55; font-size: 11px; }
.col-check { width: 40px; }
.col-actions {
    width: 1%; white-space: nowrap; text-align: end;
    padding-inline-end: 8px !important;
}
.cell-truncate {
    max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-truncate-sm { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link {
    border: 0; background: transparent; color: var(--primary); font-weight: 600;
    cursor: pointer; padding: 0; font-size: inherit;
    max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: inline-block; vertical-align: bottom;
}
.row-link:hover { text-decoration: underline; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent;
    background: transparent; color: var(--muted); cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: var(--table-head); color: var(--text); border-color: var(--border); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.danger:hover { background: var(--primary-soft); color: var(--primary-dark); }

.row-actions {
    display: inline-flex; gap: 1px; align-items: center; justify-content: flex-end;
}
.row-menu-backdrop {
    position: fixed; inset: 0; z-index: 90; background: transparent;
}
.row-menu {
    min-width: 168px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 10px 28px rgba(15,23,42,.18); padding: 6px;
}
.row-menu-fixed {
    position: fixed; z-index: 95;
}
.row-menu button {
    display: block; width: 100%; text-align: start; border: 0; background: transparent;
    padding: 8px 10px; border-radius: 7px; font-size: 13.5px; cursor: pointer; color: var(--text);
}
.row-menu button:hover { background: var(--table-head); }
.row-menu button.danger { color: var(--primary-dark); }

.badge.soft-green,
.badge.ok { background: var(--success-soft); color: var(--success-text); }
.badge.soft-gray { background: #e2e8f0; color: #475569; }
[data-theme="dark"] .badge.soft-gray { background: #1f2a3d; color: #cbd5e1; }
.badge .badge-ico { display: none; }

/* ---- Cards (mobile) ---- */
.branch-cards { display: none; gap: 10px; }
.branch-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; box-shadow: var(--shadow);
}
.branch-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.branch-card-title { font-weight: 700; }
.branch-card-code { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.branch-card-meta { margin-top: 10px; font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.branch-card-actions { display: flex; gap: 6px; margin-top: 12px; }

/* ---- Pagination ---- */
.list-pagination {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
    margin-top: 14px; font-size: 13.5px; color: var(--muted);
}
.list-pagination-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.page-size { display: inline-flex; align-items: center; gap: 8px; }
.page-size select {
    border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: var(--input-bg); color: var(--text);
}
.page-buttons { display: inline-flex; gap: 4px; align-items: center; }
.page-num {
    min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--input-bg); color: var(--text); cursor: pointer; font-size: 13px;
}
.page-num.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.page-ellipsis { padding: 0 4px; }

/* ---- States / skeleton ---- */
.list-state {
    text-align: center; padding: 48px 20px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.list-state h3 { margin-bottom: 6px; }
.list-state p { color: var(--muted); margin: 0 0 16px; }
.list-state-error { border-color: #fecdd3; background: var(--primary-soft); }
.skeleton-line {
    height: 12px; border-radius: 6px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%; animation: shimmer 1.2s infinite;
}
.skeleton-line.lg { height: 22px; margin-top: 10px; }
.skeleton-line.w-24 { width: 24%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-card { pointer-events: none; }
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skel-row td { padding: 14px; }
.skel-row .skeleton-line { height: 10px; width: 70%; }

/* ---- Slide panel / modal ---- */
.slide-backdrop, .modal-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .42); z-index: 80;
}
.slide-panel {
    position: fixed; inset-block: 0; inset-inline-end: 0; width: min(480px, 100vw);
    background: var(--surface); z-index: 90; display: flex; flex-direction: column;
    box-shadow: -12px 0 40px rgba(15,23,42,.18);
}
.slide-panel-head {
    display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
    padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.slide-panel-head h2 { font-size: 18px; margin: 0; }
.slide-panel-body { padding: 18px 20px; overflow: auto; flex: 1; }
.slide-panel-foot {
    padding: 14px 20px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; justify-content: flex-end;
}
.modal-dialog {
    position: fixed; z-index: 95; inset-inline-start: 50%; top: 18%;
    transform: translateX(-50%); width: min(420px, calc(100vw - 32px));
    background: var(--surface); border-radius: 14px; padding: 22px 22px 16px;
    box-shadow: 0 24px 60px rgba(15,23,42,.28); color: var(--text);
}
.modal-dialog h3 { margin: 0 0 8px; font-size: 18px; }
.modal-body { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn.danger { background: var(--primary); }
.btn.danger:hover { background: var(--primary-dark); }

.detail-grid { display: grid; gap: 14px; }
.detail-row { display: grid; grid-template-columns: 140px 1fr; gap: 8px; font-size: 14px; }
.detail-row dt { color: var(--muted); font-weight: 600; }
.detail-row dd { margin: 0; }
.detail-list { margin: 12px 0 0; padding-inline-start: 18px; display: grid; gap: 6px; font-size: 14px; }
.panel-section { margin: 18px 0 10px; font-size: 14px; font-weight: 700; }
.link-list { display: grid; gap: 6px; max-height: 220px; overflow: auto; padding: 8px 0; }
.option-row { margin-bottom: 10px; }

/* ---- Toasts ---- */
.toast-host {
    position: fixed; inset-inline-end: 18px; bottom: 18px; z-index: 120;
    display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 24px));
}
.toast {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
    padding: 12px 14px; border-radius: 10px; box-shadow: 0 10px 28px rgba(15,23,42,.18);
    font-size: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.toast-success { border-color: #86efac; background: var(--success-soft); color: var(--success-text); }
.toast-error { border-color: #fda4af; background: var(--primary-soft); color: var(--primary-dark); }
.toast-info { border-color: #93c5fd; background: #eff6ff; color: #1e40af; }
[data-theme="dark"] .toast-info { background: rgba(59,130,246,.16); color: #93c5fd; }
.toast-dismiss { border: 0; background: transparent; cursor: pointer; color: inherit; padding: 2px; }

/* ---- Category color ---- */
.color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    vertical-align: middle;
    margin-inline-end: 8px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    flex-shrink: 0;
}
.color-swatch.lg { width: 28px; height: 28px; border-radius: 8px; margin: 0; }
.color-field {
    display: flex;
    align-items: center;
    gap: 10px;
}
.color-field input[type="color"] {
    width: 42px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}
.color-field input[type="text"],
.color-field .form-control {
    flex: 1;
}

/* ---- Print ---- */
@media print {
    .app-sidebar, .app-topbar, .no-print-hide, .toast-host, .slide-backdrop, .slide-panel,
    .modal-backdrop, .modal-dialog { display: none !important; }
    .app-shell { display: block; }
    .app-main, .app-content { padding: 0; }
    .list-table-wrap { box-shadow: none; max-height: none; overflow: visible; border: 0; }
    table.list-table thead th { position: static; }
    .print-only { display: block !important; }
}
.print-only { display: none; }
.print-report-title { font-size: 20px; margin-bottom: 4px; }
.print-report-meta { color: #64748b; font-size: 12px; margin-bottom: 16px; }

/* ---- Responsive ---- */
@media (max-width: 1200px) {
    .col-hide-lg { display: none !important; }
    .row-actions .icon-btn.action-secondary { display: none; }
    .cell-truncate { max-width: 140px; }
}
@media (max-width: 1100px) {
    .summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
    .col-hide-md { display: none !important; }
}
@media (max-width: 800px) {
    .list-table-wrap { display: none; }
    .branch-cards { display: grid; }
    .summary-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
    .summary-cards { grid-template-columns: 1fr; }
    .list-page-header-row { flex-direction: column; }
}

/* ---- Roles (permission matrix) ---- */
.roles-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
.roles-sidebar {
    display: grid;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: var(--shadow);
    max-height: min(70vh, 720px);
    overflow: auto;
}
.roles-role-item {
    display: block; width: 100%; text-align: start;
    border: 1px solid transparent; background: transparent; color: var(--text);
    border-radius: 10px; padding: 10px 12px; cursor: pointer;
}
.roles-role-item:hover { background: var(--table-head); }
.roles-role-item.is-active {
    border-color: var(--primary); background: var(--primary-soft);
    box-shadow: 0 0 0 2px var(--primary-soft);
}

.page-tabs {
    display: flex; gap: 6px; margin: 0 0 14px;
    padding: 4px; width: fit-content; max-width: 100%;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow);
}
.page-tab {
    border: 1px solid transparent; background: transparent; color: var(--muted);
    border-radius: 9px; padding: 8px 14px; font-size: 13.5px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.page-tab:hover { color: var(--text); background: var(--table-head); }
.page-tab.is-active {
    color: var(--primary-dark); background: var(--primary-soft);
    border-color: color-mix(in srgb, var(--primary) 35%, transparent);
}
.roles-role-top {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.roles-role-name { font-weight: 700; font-size: 14px; }
.roles-role-meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); }

.roles-main {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 360px;
}
.roles-main-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 16px 18px 0;
}
.roles-main-title { margin: 0; font-size: 18px; }
.roles-main-desc { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.roles-matrix-toolbar {
    margin: 14px 14px 0; box-shadow: none;
}
.roles-dirty-chip {
    display: inline-flex; align-items: center;
    border: 1px solid #fda4af; background: var(--primary-soft); color: var(--primary-dark);
    border-radius: 999px; padding: 5px 10px; font-size: 12.5px; font-weight: 600;
    white-space: nowrap;
}
.roles-main-body {
    padding: 14px 18px 18px;
    flex: 1;
}
.roles-module { margin-top: 8px; }
.roles-module + .roles-module { margin-top: 18px; }
.roles-module-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
    margin-bottom: 8px; flex-wrap: wrap;
}
.roles-module-count { font-size: 12px; color: var(--muted); margin-top: 2px; }
.roles-module-actions { display: flex; gap: 4px; }
.roles-perm-name { display: block; line-height: 1.25; }
.roles-save-bar {
    position: sticky; bottom: 0; z-index: 3;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(6px);
}
.roles-save-meta { font-size: 13px; color: var(--text); }
.roles-save-actions { display: flex; gap: 8px; }

.rpt-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.rpt-tab {
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.rpt-tab.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }
.rpt-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.rpt-filters .field { min-width: 140px; margin: 0; }
.rpt-chart-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 16px 8px; margin-bottom: 16px;
}
.rpt-chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.rpt-leg.pred::before, .rpt-leg.act::before {
    content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px;
}
.rpt-leg.pred::before { background: var(--primary); }
.rpt-leg.act::before { background: #64748b; }
.rpt-bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.rpt-bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; height: 100%; }
.rpt-bar {
    width: 100%; max-width: 28px; background: var(--primary); border-radius: 4px 4px 0 0; margin-top: auto;
}
.rpt-bar.pred { background: var(--primary); }
.rpt-bar.act { background: #64748b; }
.rpt-dual { display: flex; align-items: flex-end; gap: 2px; width: 100%; justify-content: center; flex: 1; }
.rpt-dual .rpt-bar { max-width: 12px; }
.rpt-bar-label { font-size: 10px; color: var(--muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.rpt-section { font-size: 15px; margin: 18px 0 10px; }
.rpt-note { margin: 0 0 12px; }
.rpt-heat {
    display: grid;
    grid-template-columns: 48px repeat(24, minmax(10px, 1fr));
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    overflow-x: auto;
}
.rpt-heat-corner { }
.rpt-heat-h, .rpt-heat-d { font-size: 10px; color: var(--muted); text-align: center; }
.rpt-heat-d { text-align: start; }
.rpt-heat-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    background: color-mix(in srgb, var(--primary) calc(var(--p) * 100%), #e2e8f0);
}
[data-theme="dark"] .rpt-heat-cell {
    background: color-mix(in srgb, var(--primary) calc(var(--p) * 100%), #1f2a3d);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.media-card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 8px;
    text-align: start;
}
.media-card.is-selected { border-color: var(--primary); }
.media-card-body {
    display: flex; flex-direction: column; gap: 6px; width: 100%;
    border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; text-align: start;
}
.media-card-thumb, .media-picker-thumb, .media-row-thumb, .media-details-preview, .media-thumb-empty {
    width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: #e2e8f0;
}
.media-row-thumb { width: 40px; height: 40px; aspect-ratio: auto; }
.media-thumb-empty { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.media-thumb-loading { animation: pulse 1.2s ease-in-out infinite; }
.media-thumb-placeholder-ico { width: 18px; height: 18px; opacity: 0.55; }
.list-table th.col-thumb,
.list-table td.col-thumb {
    width: 52px;
    min-width: 52px;
    padding-inline: 8px;
    vertical-align: middle;
}
.product-list-thumb {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: #e8edf3;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.media-card-name, .media-upload-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card-check { position: absolute; top: 10px; inset-inline-start: 10px; z-index: 1; }
.media-view-toggle { display: flex; gap: 6px; margin: 8px 0 12px; }
.media-upload { border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.media-upload-input { display: block; margin-bottom: 8px; }
.media-upload-guide { margin: 4px 0 0; font-size: 12px; line-height: 1.4; }
.media-upload-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.media-upload-item { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; align-items: baseline; }
.media-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.media-picker-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.media-picker-card.is-primary { border-color: var(--primary); }
.media-picker-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.media-picker-toolbar { margin-bottom: 10px; }
.media-picker-panel { z-index: 60; }
.media-details-preview { max-width: 320px; margin-bottom: 12px; }
.media-variant-list { list-style: none; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.linkish { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; text-decoration: underline; }
.list-pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; }
.btn-danger { background: #b91c1c; color: #fff; border-color: #b91c1c; }

@media (max-width: 900px) {
    .roles-layout { grid-template-columns: 1fr; }
    .roles-sidebar {
        max-height: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(160px, 1fr);
        overflow-x: auto;
        overflow-y: hidden;
    }
    .roles-role-item { min-width: 160px; }
}
