/* RaboTeb panel on Vuexy (RTL build, recoloured to the logo's green #208D44).
   Vuexy provides the shell, buttons, cards, forms, tables, badges, alerts and pagination; this file only adds the
   panel's own pieces and their phone layouts, using Vuexy's variables so everything stays in one palette. */

:root {
    --primary: var(--bs-primary, #208d44);
    --primary-rgb: var(--bs-primary-rgb, 32, 141, 68);
    --soft: rgba(var(--primary-rgb), .08);
    --border: var(--bs-border-color, #dbdade);
    --muted: var(--bs-secondary-color, #a5a3ae);
    --heading: var(--bs-heading-color, #5d596c);
    --surface: #fff;
    --radius: .375rem;
    --shadow: 0 .25rem 1.125rem rgba(75, 70, 92, .1);
}

h1:focus, h4:focus { outline: 0; }
a { text-decoration: none; }
.min-w-0 { min-width: 0; }

/* ── Shell details Vuexy leaves to the app ───────────────── */
.boot-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
/* The logo is a wordmark: its slot takes the logo's width instead of Vuexy's 34px square (which showed only a sliver of it). */
.layout-menu .app-brand-logo.demo { width: auto; height: auto; overflow: visible; }
.app-brand-logo img { height: 34px; width: auto; max-width: 168px; object-fit: contain; display: block; }
.layout-menu-collapsed:not(.layout-menu-hover) .layout-menu .app-brand-logo.demo { width: 34px; overflow: hidden; }
.layout-menu-collapsed:not(.layout-menu-hover) .app-brand-logo img { width: 34px; object-fit: cover; object-position: left center; }
.layout-menu .menu-inner { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; }
.page-search { max-width: 420px; }
.page-search-results { position: absolute; top: 100%; inset-inline-start: 0; max-width: 420px; z-index: 1080; }
.layout-navbar .dropdown-menu.show { position: absolute; inset-inline-end: 0; inset-inline-start: auto; top: 100%; }
.dropdown-notifications .dropdown-menu { width: min(380px, 92vw); }
.dropdown-notifications-list { max-height: 420px; overflow-y: auto; }
.badge-notifications { position: absolute; top: .25rem; inset-inline-end: 0; font-size: .625rem; padding: .2rem .35rem; }
.app-credit a { color: inherit; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; inset-inline: 0; z-index: 2000; border-radius: 0; }
#blazor-error-ui .dismiss { cursor: pointer; float: left; }

/* ── Page header (ActionBar) ─────────────────────────────── */
.action-bar h4 { color: var(--heading); }
.action-bar .breadcrumb { font-size: .8125rem; }

/* ── Forms: the panel wraps inputs in their labels; Vuexy styles the controls ── */
.field-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; align-items: end; }
.field-row > label, label.block { display: flex; flex-direction: column; gap: .3rem; font-size: .8125rem; color: var(--heading); font-weight: 500; margin: 0; }
.field-row > .grow { grid-column: span 2; }
.field-row > label.inline, label.inline { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; white-space: nowrap; }
label.block { margin-top: 1rem; }
.form-check-input { flex-shrink: 0; margin-top: 0; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
.form-layout > * { margin-bottom: 0; }
.color-field { display: flex; gap: .5rem; align-items: center; }
input[dir="ltr"] { text-align: left; }
input[dir="ltr"]::placeholder { text-align: right; direction: rtl; }
input[type="number"], input[inputmode="numeric"], input[inputmode="decimal"], input[type="tel"], .num { font-variant-numeric: tabular-nums; }
.form-control:disabled, .form-select:disabled { background-color: var(--bs-gray-50, #f8f7fa); }
.required::after { content: " *"; color: var(--bs-danger); }
.sheet h3, .card h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 .75rem; color: var(--heading); }
.sheet > h3:first-child, .card > h3:first-child { margin-top: 0; }
.card h2 { font-size: 1.0625rem; font-weight: 600; margin-bottom: 1rem; color: var(--heading); }
.card + .card { margin-top: 1.5rem; }
.sheet .action-bar-buttons, .card .action-bar-buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.hint-text { color: var(--muted); }
.loading, .empty-state { color: var(--muted); padding: 2rem 1rem; text-align: center; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters > label { display: inline-flex; align-items: center; gap: .4rem; color: var(--heading); font-size: .8125rem; }
.filters > label > .form-control, .filters > label > .form-select { width: auto; }
.filter-search { max-width: 280px; margin-inline-start: auto; }
.list-toolbar .spacer { flex: 1; }
.list-toolbar .filters { margin: 0; }
.list-toolbar .filters.advanced > label { display: block; }
.list-toolbar-toggle { display: none; }

/* ── Tables ──────────────────────────────────────────────── */
.table .num, th.num { text-align: end; }
.table tr.clickable { cursor: pointer; }
.table tr.selected > td, .table tr.picked > td { background: var(--soft); }
.table tr.uncounted > td, .table tr.warn-row > td, .table tr.needs-approval > td { background: rgba(var(--bs-warning-rgb), .08); }
.table tr.muted-row > td { color: var(--muted); }
.table td.negative { color: var(--bs-danger); }
.table.lines .form-control, .table.lines .form-select { min-width: 96px; }
.table tr.level-1 td { font-weight: 600; background: var(--bs-gray-50, #f8f7fa); }
.table tr.level-2 td { font-weight: 500; }
.indent-2 { padding-inline-start: 1.5rem !important; }
.indent-3 { padding-inline-start: 2.75rem !important; }
.indent-4 { padding-inline-start: 4rem !important; }
.text-danger { font-weight: 600; }
.qty-cell { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.form-control.qty { width: 6rem; }
.select-all { margin-bottom: .5rem; color: var(--muted); }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
.table-scroll { overflow-x: auto; }
.access-grid td.center { text-align: center; }
.access-grid .access-module-row th { text-align: start; background: var(--bs-gray-50, #f8f7fa); }
.list-footer { color: var(--muted); padding: .75rem 0; }

/* DataTable (Vuexy datatable card) */
.data-table-wrap { margin-bottom: 1.5rem; }
.card .data-table-wrap, .sheet .data-table-wrap { box-shadow: none; border: 1px solid var(--border); }
.dt-toolbar .dt-search { flex: 1 1 220px; max-width: 320px; margin-inline-start: auto; }
.dt-sort-mobile { display: none; align-items: center; gap: .5rem; }
.dt-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem 1rem; align-items: end; }
.dt-filter { display: flex; flex-direction: column; min-width: 0; }
.dt-range { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.dt-clear { justify-self: start; }
.data-table th { white-space: nowrap; }
.dt-sort { display: inline-flex; align-items: center; gap: .3rem; padding: 0; border: 0; background: none; font: inherit; color: inherit;
           text-transform: inherit; letter-spacing: inherit; cursor: pointer; white-space: nowrap; }
.dt-sort-icon { opacity: .35; font-size: .95rem; }
.dt-sort-icon.on { opacity: 1; color: var(--primary); }
.data-table tr.clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.data-table tfoot td { background: var(--bs-gray-50, #f8f7fa); font-weight: 600; }
.dt-pages .page-link { min-width: 2rem; justify-content: center; }

/* Status colours (document states) on Vuexy label badges */
.status-pill { background: rgba(var(--bs-secondary-rgb), .16); color: var(--bs-secondary); }
.status-inreview, .po-inreview, .so-inreview, .ff-atwarehouse, .ff-shipmentrequested, .rt-approved, .shop-paid, .tag.warn
    { background: rgba(var(--bs-warning-rgb), .16) !important; color: var(--bs-warning) !important; }
.status-intransit, .po-approved, .so-approved, .ff-picking, .ff-packed, .rt-received, .shop-shipped, .tag.move-transfer, .ff-new, .rt-requested
    { background: rgba(var(--bs-info-rgb), .16) !important; color: var(--bs-info) !important; }
.status-approved, .status-posted, .po-received, .so-delivered, .ff-shipped, .ff-delivered, .rt-refunded, .shop-delivered, .tag.move-receipt
    { background: rgba(var(--bs-success-rgb), .16) !important; color: var(--bs-success) !important; }
.status-rejected, .status-cancelled, .po-rejected, .po-cancelled, .so-rejected, .so-cancelled, .ff-cancelled, .rt-rejected, .shop-expired, .shop-cancelled
    { background: rgba(var(--bs-danger-rgb), .16) !important; color: var(--bs-danger) !important; }
.po-partiallyreceived { background: rgba(var(--primary-rgb), .16) !important; color: var(--primary) !important; }
.tag.move-issue { background: rgba(var(--bs-warning-rgb), .16) !important; color: var(--bs-warning) !important; }
.badge.muted { background: rgba(var(--bs-secondary-rgb), .16); color: var(--bs-secondary); }

/* ── Document status steps (StateBar / StatusFlow) ───────── */
.status-steps-card .card-body { overflow-x: auto; }
.status-flow { display: flex; align-items: center; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.5rem; flex-wrap: nowrap; }
.status-steps-card .status-flow { margin: 0; }
.status-flow li { display: flex; align-items: center; gap: .5rem; color: var(--muted); white-space: nowrap; flex: 0 0 auto; }
.status-flow li + li::before { content: ""; width: 2.25rem; height: 2px; background: var(--border); border-radius: 2px; margin-inline-end: .25rem; }
.status-flow li.done + li::before, .status-flow li.current::before { background: var(--primary); }
.status-flow .step-icon { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: .375rem;
    background: rgba(var(--bs-secondary-rgb), .12); font-weight: 600; font-size: .8125rem; }
.status-flow li.done { color: var(--heading); }
.status-flow li.done .step-icon { background: rgba(var(--primary-rgb), .16); color: var(--primary); }
.status-flow li.current { color: var(--heading); font-weight: 600; }
.status-flow li.current .step-icon { background: var(--primary); color: #fff; box-shadow: 0 .125rem .375rem rgba(var(--primary-rgb), .4); }
.status-flow li.off-path .step-icon { background: var(--bs-danger); }
/* StatusFlow (simple list) renders plain items: give them the same look. */
.status-flow:not(.status-steps-card *) li { padding: .375rem .75rem; border-radius: 50rem; background: rgba(var(--bs-secondary-rgb), .08); }
.status-flow:not(.status-steps-card *) li + li::before { display: none; }
.status-flow:not(.status-steps-card *) li.current { background: var(--primary); color: #fff; }
.status-flow:not(.status-steps-card *) li.off-path { background: var(--bs-danger); }

/* ── Smart buttons (related records on a form) ───────────── */
.smart-buttons { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.smart-buttons.standalone { padding: 1rem 1.5rem; margin-bottom: 1.5rem; border: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.smart-button { color: inherit; }
.smart-button:hover .smart-value { color: var(--primary); }

/* ── Chatter & approvals ─────────────────────────────────── */
.chatter { display: flex; flex-direction: column; gap: 1rem; }
.chatter-compose { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
.chatter-feed, .chatter-approvals ul { list-style: none; margin: 0; padding: 0; }
.chatter-feed li { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.chatter-feed li:last-child { border-bottom: 0; }
.chatter-feed .meta { display: flex; gap: .4rem; align-items: center; font-size: .8125rem; }
.chatter-feed .dot { color: var(--primary); font-size: .6rem; }
.chatter-feed .system .dot { color: var(--muted); }
.chatter-feed .system .body { color: var(--muted); font-style: italic; }
.chatter-feed .body { margin-top: .25rem; white-space: pre-wrap; }
.chatter .when { color: var(--muted); font-size: .75rem; }
.chatter-approvals { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; }
.decision { padding: .3rem 0; font-size: .875rem; }
.decision-approved strong { color: var(--bs-success); }
.decision-rejected strong { color: var(--bs-danger); }
.decision .comment, .decision .stage { color: var(--muted); }

/* ── Kanban ──────────────────────────────────────────────── */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-column { background: rgba(var(--bs-secondary-rgb), .06); border-radius: var(--radius); padding: .75rem; min-height: 220px; }
.kanban-column header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: var(--heading); padding-bottom: .5rem; }
.kanban-total { color: var(--muted); font-size: .75rem; padding-bottom: .5rem; font-variant-numeric: tabular-nums; }
.kanban-cards { display: flex; flex-direction: column; gap: .75rem; }
.kanban-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem 1rem; cursor: pointer;
               display: flex; flex-direction: column; gap: .35rem; border: 1px solid transparent; }
.kanban-card:hover, .kanban-card:focus { border-color: var(--primary); outline: none; }
.card-head, .card-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

/* ── Dashboard ───────────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.stat { display: flex; flex-direction: column; gap: .35rem; padding: 1.5rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: .375rem; margin-bottom: .5rem;
             color: var(--tone); background: color-mix(in srgb, var(--tone) 16%, transparent); }
.stat-icon.emerald { --tone: #208d44; }
.stat-icon.teal { --tone: #00bad1; }
.stat-icon.amber { --tone: #ff9f43; }
.stat-icon.rust { --tone: #ea5455; }
.stat-value { font-size: 1.375rem; font-weight: 600; color: var(--heading); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-label { color: var(--muted); font-size: .8125rem; }
.stat-trend { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); font-size: .75rem; }
.stat-trend.up { color: var(--bs-success); }
.stat-trend.down { color: var(--bs-danger); }
.dashboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.dashboard > .card { margin: 0; }
.dashboard + .dashboard { margin-top: 1.5rem; }
.card.wide { grid-column: 1 / -1; }
.work-list { list-style: none; margin: 0; padding: 0; }
.work-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.work-list li:last-child { border-bottom: 0; }
.work-list .badge, .card h2 .badge { background: rgba(var(--primary-rgb), .16); color: var(--primary); }
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; }
.quick-links a { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem .5rem; text-align: center;
                 border-radius: var(--radius); background: var(--soft); color: var(--heading); font-size: .8125rem; transition: all .15s ease; }
.quick-links a:hover { background: var(--primary); color: #fff; }
.quick-links .icon { color: var(--primary); }
.quick-links a:hover .icon { color: #fff; }
.widget-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.widget-list li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem;
                  border: 1px solid var(--border); border-radius: var(--radius); }
.widget-list li.selected { border-color: rgba(var(--primary-rgb), .5); background: var(--soft); }
.widget-list label { display: flex; align-items: flex-start; gap: .75rem; min-width: 0; }
.widget-list label > span { display: flex; flex-direction: column; gap: .1rem; }
.widget-order { display: flex; gap: .25rem; flex-shrink: 0; }

/* Bar chart: one hue, quiet grid, LTR time axis */
.bar-chart { margin: 0; }
.bar-chart figcaption { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.chart-title { font-weight: 600; color: var(--heading); }
.chart-area { position: relative; direction: ltr; }
.chart-area svg { width: 100%; height: 200px; display: block; }
.grid-line { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.baseline { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bar .hit { fill: transparent; }
.bar-fill { fill: var(--primary); }
.bar.hover .bar-fill { fill: #1d7f3d; }
.chart-tooltip { position: absolute; top: 0; transform: translateX(-50%); background: #2f2b3d; color: #fff; padding: .3rem .6rem; border-radius: .25rem;
                 font-size: .75rem; pointer-events: none; white-space: nowrap; direction: rtl; }
.axis-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; margin-top: .25rem; }
.axis-max { color: var(--muted); font-size: .75rem; }

/* ── Other panel pieces ──────────────────────────────────── */
.sub-nav { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; scrollbar-width: none; }
.sub-nav a { padding: .6rem 1rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.sub-nav a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.scan-box { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; color: var(--heading); }
.scan-box .form-control { font-size: 1.125rem; padding: .75rem 1rem; border: 2px solid var(--primary); }
.serials { display: flex; flex-wrap: wrap; gap: .35rem; }
.new-record { margin-top: 1.5rem; }
.secret-box code { user-select: all; word-break: break-all; }
.payment-row { font-size: .8125rem; color: var(--muted); padding: .2rem 0; }
.lesson-editor { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.option-row { align-items: center; margin-top: .5rem; }
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; margin: 0 0 1rem; }
dl.details dt { color: var(--muted); font-weight: 400; }
dl.details dd { margin: 0; color: var(--heading); }
.alert .trace-id { display: block; opacity: .7; font-size: .75rem; margin-top: .25rem; }
.inline-field { display: inline-flex; align-items: center; gap: .5rem; font-size: .875rem; }
.inline-field .form-select { min-width: 10rem; }
.shop-switcher { display: inline-flex; align-items: center; gap: .35rem; }
.shop-switcher .form-select { max-width: 200px; }

/* Users and access: the role tree */
.role-tree { display: grid; gap: .75rem; }
.role-node { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .85rem 1.1rem;
             margin-inline-start: calc(min(var(--depth, 0), 6) * 1.5rem); display: grid; gap: .5rem; border-inline-start: 3px solid var(--primary); }
.role-node.muted-row { opacity: .6; border-inline-start-color: var(--border); }
.role-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.role-profiles { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.role-node .row-actions { justify-content: flex-start; align-items: center; }
.badge-remove { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 .15rem; font-size: 1rem; line-height: 1; }
.access-modules { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-bottom: 1rem; }

/* Invoice print view and the template designer */
.print-frame { display: block; width: 100%; height: calc(100vh - 14rem); min-height: 480px; border: 1px solid var(--border); border-radius: var(--radius); background: #f1f0f2; }
.template-designer { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 1.5rem; align-items: start; }
.template-designer .print-frame { height: calc(100vh - 12rem); position: sticky; top: 6rem; }
.template-designer fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem 1rem; margin: 0 0 1rem; display: grid; gap: .5rem; }
.template-designer legend { font-weight: 600; font-size: .9375rem; padding: 0 .35rem; float: none; width: auto; margin: 0; }
.template-designer .check { display: flex; align-items: center; gap: .5rem; font-size: .875rem; }
.template-designer .columns-editor { display: grid; gap: .4rem; }
.template-designer .column-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: .4rem; align-items: center; }
.template-list { display: grid; gap: .5rem; margin-bottom: 1rem; }
.template-list .template-item { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); }

/* Company letterhead of printed documents */
.print-header { display: none; }

/* ── Tablets ─────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .form-layout { grid-template-columns: minmax(0, 1fr); }
    .template-designer { grid-template-columns: minmax(0, 1fr); }
    .template-designer .print-frame { position: static; height: 70vh; }
}

/* ── Phones: every list reads as cards, actions stay reachable ── */
@media (max-width: 767.98px) {
    /* 16px stops iOS from zooming into a focused field. */
    .form-control, .form-select, textarea { font-size: 16px; }
    .container-p-y { padding-top: 1rem !important; padding-bottom: 5rem !important; }
    .layout-navbar.navbar-detached { margin-inline: .75rem !important; width: auto !important; }
    .content-wrapper > .container-xxl { padding-inline: .75rem !important; }
    .page-search { max-width: none; }

    .action-bar { position: sticky; top: 4.75rem; z-index: 9; margin: -.25rem -.75rem 1rem !important; padding: .6rem .75rem;
                  background: var(--bs-body-bg, #f8f7fa); gap: .5rem !important; }
    .action-bar h4 { font-size: 1.0625rem; }
    .action-bar .breadcrumb { display: none; }
    .action-bar-buttons { flex: 1 1 100%; flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .action-bar-buttons::-webkit-scrollbar { display: none; }
    .action-bar-buttons > * { flex: none; }

    .field-row { grid-template-columns: minmax(0, 1fr); gap: .85rem; }
    .field-row > .grow { grid-column: auto; }
    .card-body, .sheet { padding: 1rem; }
    .smart-buttons { gap: .75rem 1rem; }
    .smart-button { flex: 1 1 40%; }
    dl.details { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
    dl.details dd { margin-bottom: .6rem; }
    .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .filters::-webkit-scrollbar { display: none; }
    .filters > * { flex: none; }
    .filters.advanced, .filters.wrap, .list-toolbar .filters.saved { flex-wrap: wrap; overflow: visible; }
    .filter-search { max-width: none; margin-inline-start: 0; flex: 1 0 12rem; }
    .list-toolbar-toggle { display: inline-flex; }
    .list-toolbar .filters.advanced:not(.open) { display: none !important; }
    .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .stat { padding: 1rem; }
    .stat-value { font-size: 1.125rem; }
    .dashboard { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .kanban { grid-auto-columns: minmax(80vw, 1fr); scroll-snap-type: x mandatory; }
    .kanban-column { scroll-snap-align: start; }
    .role-node { margin-inline-start: calc(min(var(--depth, 0), 6) * .5rem); }
    .form-layout > aside.sheet:not(.keep-order) { order: -1; }
    /* Save/submit buttons of a sheet stay reachable at the bottom while scrolling a long form. */
    .sheet > .action-bar-buttons, .card > .action-bar-buttons {
        position: sticky; bottom: 0; z-index: 5; background: var(--surface); padding: .75rem 0; margin-top: .75rem;
        border-top: 1px solid var(--border); flex-wrap: wrap; overflow: visible;
    }
    /* Line editors and reports scroll sideways inside their own box. */
    .table.grid:not(.data-table) { display: block; overflow-x: auto; white-space: nowrap; }

    /* DataTable rows become cards: the column title on the start side, the value on the end side. */
    .dt-toolbar .dt-search { max-width: none; margin-inline-start: 0; flex: 1 1 100%; }
    .dt-sort-mobile { display: flex; flex: 1 1 100%; }
    .dt-sort-mobile .form-select { flex: 1; }
    .dt-filters { grid-template-columns: minmax(0, 1fr); }
    .data-table-wrap .table-responsive { overflow: visible; }
    .table.data-table { display: block; white-space: normal; }
    .data-table thead { display: none; }
    .data-table tbody, .data-table tfoot { display: flex; flex-direction: column; gap: .75rem; padding: .75rem; }
    .data-table tr { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .35rem 0; }
    .data-table td { display: flex; justify-content: space-between; align-items: center; gap: .75rem; min-height: 2.4rem;
                     padding: .4rem 1rem !important; border-bottom: 1px dashed var(--border) !important; text-align: end; overflow-wrap: anywhere; white-space: normal; }
    .data-table td:last-child { border-bottom: 0 !important; }
    .data-table td::before { content: attr(data-label); flex: none; max-width: 45%; color: var(--muted); font-size: .8125rem; text-align: start; }
    .data-table td[data-label=""]::before, .data-table tr.dt-detail td::before, .data-table td.dt-foot-count::before { content: none; }
    .data-table td[data-label=""] { justify-content: flex-end; }
    .data-table td:empty, .data-table td.dt-hide-mobile, .data-table td.dt-foot-empty { display: none; }
    .data-table td.dt-primary { order: -1; font-weight: 600; font-size: .9375rem; color: var(--heading); border-bottom: 1px solid var(--border) !important; }
    .data-table tr.dt-detail td { display: block; }
    .data-table tr.clickable:active { background: var(--soft); }
    .data-table tfoot tr { background: var(--soft); border-color: transparent; }
    .data-table tfoot td { background: none; }
    .data-table td .btn { min-height: 2.5rem; }
    .dt-pager { justify-content: center !important; }
    .dt-pager .dt-count { flex: 1 1 100%; text-align: center; }
}

/* Touch screens: 44px targets. */
@media (pointer: coarse) {
    .btn:not(.btn-sm):not(.btn-xs), .form-control, .form-select, .page-link { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .form-check-input { width: 1.375rem; height: 1.375rem; }
    .layout-menu .menu-link { min-height: 44px; }
}

@media print {
    .layout-menu, .layout-navbar, .content-footer, .action-bar-buttons, .chatter, .filters, .list-toolbar, .no-print,
    .dt-toolbar, .dt-pager, .layout-overlay { display: none !important; }
    .layout-page, .content-wrapper, .container-xxl { padding: 0 !important; margin: 0 !important; }
    html.layout-menu-fixed .layout-page { padding-inline-start: 0 !important; }
    .card, .sheet { box-shadow: none !important; border: 0 !important; }
    .form-layout { grid-template-columns: 1fr; }
    .table.lines .form-control { border: 0; border-bottom: 1px solid #999; border-radius: 0; }
    .print-header { display: block; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #999; font-size: .85rem; }
    .print-header strong { font-size: 1.1rem; }
    .print-header-details { display: flex; flex-wrap: wrap; gap: 4px 16px; }
    .app-credit { display: none !important; }
}

/* ── Reports hub, analytics and marketing ───────────────────────── */
.report-search { position: relative; max-width: 420px; margin-bottom: 1.25rem; }
.report-search .ti { position: absolute; inset-inline-start: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.report-search input { padding-inline-start: 2.4rem; }
.report-group { display: flex; align-items: center; gap: .4rem; margin: 1.5rem 0 .75rem; color: var(--heading); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.report-card { color: inherit; text-decoration: none; transition: transform .2s ease, box-shadow .2s ease; height: 100%; }
.report-card:hover { transform: translateY(-3px); box-shadow: 0 .5rem 1.25rem rgba(var(--primary-rgb), .18); }
.report-card .card-body { display: flex; gap: .9rem; align-items: flex-start; }
.report-card h6 { margin: 0 0 .25rem; color: var(--heading); }
.report-card p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.7; }
.report-icon, .kpi-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex: none; font-size: 1.35rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-grid.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.kpi-grid.compact .card-body { padding: .8rem; }
.kpi-grid.compact .kpi-icon { width: 32px; height: 32px; font-size: 1.05rem; }
.kpi-grid.compact .kpi-value { font-size: 1.05rem; }
.kpi-card { height: 100%; }
.kpi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.kpi-value { margin: 0 0 .15rem; font-weight: 700; color: var(--heading); direction: ltr; text-align: end; unicode-bidi: plaintext; }
.kpi-title { color: var(--muted); font-size: .85rem; }

.report-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 1.25rem; margin: 1.5rem 0; }
.report-columns > .card { margin: 0; }
.share-bar + .share-bar { margin-top: .85rem; }
.share-bar-head { display: flex; justify-content: space-between; gap: .75rem; margin-bottom: .3rem; font-size: .875rem; }
.share-bar-label { color: var(--heading); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-bar-value { white-space: nowrap; }

.campaign-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; color: inherit; text-decoration: none; }
.campaign-row + .campaign-row { border-top: 1px solid var(--border); }
.campaign-row .avatar-initial { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-size: 1.15rem; }
.campaign-row .grow { flex: 1; min-width: 0; }
.campaign-layout { grid-template-columns: minmax(0, 1fr) 460px; }
.campaign-tabs { gap: .25rem; margin: .75rem 0 1rem; flex-wrap: wrap; }
.campaign-tabs .nav-link { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .75rem; font-size: .85rem; }
.sms-status { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.sms-preview { white-space: pre-line; margin: .75rem 0; padding: .75rem 1rem; border-inline-start: 3px solid var(--primary); background: rgba(var(--primary-rgb), .06); border-radius: .375rem; }
.marketing-steps { margin: 0; padding-inline-start: 1.25rem; line-height: 2.1; }
.lead-contact { display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0; }
.lead-fields { display: grid; grid-template-columns: minmax(90px, 35%) 1fr; gap: .4rem .75rem; margin: 0; }
.lead-fields dt { color: var(--muted); font-weight: 500; }
.lead-fields dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }

@media (max-width: 1199.98px) {
    .campaign-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 575.98px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .kpi-grid .card-body { padding: .85rem; }
    .kpi-value { font-size: 1.05rem; }
    .report-grid { grid-template-columns: minmax(0, 1fr); }
    .lead-fields { grid-template-columns: minmax(0, 1fr); }
    .lead-fields dd { margin-bottom: .4rem; }
}

/* DataTable: filter row under the headers, resizable columns, column chooser. */
.data-table thead th { position: relative; }
.dt-resizer { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: 8px; cursor: col-resize; z-index: 2; touch-action: none; }
.dt-resizer::after { content: ""; position: absolute; top: 28%; bottom: 28%; inset-inline-end: 3px; width: 1px; background: var(--border); }
.dt-resizer:hover::after, body.dt-resizing .dt-resizer::after { top: 10%; bottom: 10%; width: 2px; background: var(--primary); }
body.dt-resizing { cursor: col-resize; user-select: none; }
.data-table.dt-fixed th, .data-table.dt-fixed td { overflow: hidden; text-overflow: ellipsis; }
.data-table.dt-fixed td .btn, .data-table.dt-fixed td .badge { max-width: 100%; }
.data-table thead tr.dt-filter-row th { padding: .35rem .5rem; background: var(--surface, #fff); font-weight: 400; text-transform: none; letter-spacing: 0; vertical-align: top; }
.dt-filter-row .form-control, .dt-filter-row .form-select { width: 100%; min-width: 0; font-size: .8125rem; padding-inline: .5rem; }
.dt-filter-row .form-select { padding-inline-end: 1.75rem; background-position: left .4rem center; }
.dt-filter-row .dt-range { grid-template-columns: 1fr; gap: .25rem; }
.data-table.dt-compact > :not(caption) > * > * { padding-top: .3rem; padding-bottom: .3rem; }
.dt-columns { position: relative; }
.dt-columns-backdrop { position: fixed; inset: 0; z-index: 1049; }
.dt-columns-menu { position: absolute; inset-inline-end: 0; inset-inline-start: auto; top: calc(100% + .25rem); min-width: 15rem; max-height: 60vh; overflow: auto; z-index: 1050; }
.dt-columns-menu .dropdown-item { cursor: pointer; white-space: normal; }
@media (min-width: 768px) { .dt-mobile-only, .dt-filters-panel { display: none !important; } }
@media (max-width: 767.98px) { .dt-desktop-only { display: none !important; } }

/* Store product editor (shop/products) */
.thumb-col { width: 64px; }
.list-thumb { width: 44px; height: 44px; object-fit: contain; border-radius: .5rem; background: #fff; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; }
.list-thumb.empty { color: var(--muted); background: var(--soft, #f8f7fa); }
.listing-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.listing-image-box { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; border: 1px dashed var(--border); border-radius: .75rem; background: #fff; }
.listing-image-box img { width: 100%; height: 100%; object-fit: contain; }
.listing-desc { font-size: .875rem; line-height: 1.9; }
@media (max-width: 767.98px) { .listing-grid { grid-template-columns: 1fr; } .listing-image { max-width: 260px; } }

/* Settings hub: one card per area, each setting a row (icon, name, one line about it). */
.settings-search { position: relative; max-width: 520px; margin-bottom: 1.5rem; }
.settings-search .ti { position: absolute; inset-inline-start: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.1rem; }
.settings-search .form-control { height: 44px; padding-inline-start: 2.6rem; }
.settings-groups { display: grid; gap: 1.5rem; }
.settings-group { padding: 0; overflow: hidden; }
.settings-group-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.settings-group-head h2 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--heading); }
.settings-group-icon { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: .5rem; background: rgba(var(--primary-rgb), .1); color: var(--primary); font-size: 1.15rem; }
.settings-count { margin-inline-start: auto; min-width: 1.6rem; padding: .1rem .5rem; border-radius: 999px; background: var(--soft, #f8f7fa); color: var(--muted); font-size: .75rem; text-align: center; }
.settings-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-item { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.25rem; color: inherit; text-decoration: none; border-bottom: 1px solid var(--border); transition: background .15s; }
.settings-items > .settings-item:nth-child(odd) { border-inline-end: 1px solid var(--border); }
.settings-items > .settings-item:nth-last-child(-n+2):nth-child(odd), .settings-items > .settings-item:last-child { border-bottom: 0; }
.settings-item:hover, .settings-item:focus-visible { background: rgba(var(--primary-rgb), .05); }
.settings-item-icon { flex: none; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.settings-item-text { display: flex; flex-direction: column; gap: .2rem; min-width: 0; flex: 1; }
.settings-item-text strong { color: var(--heading); font-weight: 600; font-size: .9375rem; }
.settings-item-text small { color: var(--muted); font-size: .8125rem; line-height: 1.7; }
.settings-item-go { flex: none; color: var(--muted); transition: transform .15s, color .15s; }
.settings-item:hover .settings-item-go { color: var(--primary); transform: translateX(-3px); }
@media (max-width: 991.98px) {
    .settings-items { grid-template-columns: 1fr; }
    .settings-items > .settings-item:nth-child(odd) { border-inline-end: 0; }
    .settings-items > .settings-item:nth-last-child(-n+2):nth-child(odd) { border-bottom: 1px solid var(--border); }
    .settings-items > .settings-item:last-child { border-bottom: 0; }
}

/* DataTable: free text wraps within limits instead of stretching the table (see CellClass). */
.data-table td.dt-wrap { white-space: normal; min-width: 7rem; max-width: 24rem; overflow-wrap: anywhere; line-height: 1.7; }
.data-table td.dt-primary.dt-wrap { min-width: 11rem; max-width: 28rem; }
.data-table.dt-fixed td.dt-wrap { max-width: none; min-width: 0; }
/* Warehouse photos of online orders and the advisor's review queue. */
.fulfillment-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.fulfillment-photo { margin: 0; border: 1px solid var(--border); border-radius: .6rem; overflow: hidden; background: #fff; }
.fulfillment-photo img, .fulfillment-photo .photo-loading { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: flex; align-items: center; justify-content: center; }
.fulfillment-photo figcaption { display: flex; flex-direction: column; gap: .2rem; padding: .5rem .6rem; font-size: .8125rem; }
.fulfillment-photo.rejected { border-color: var(--bs-danger, #ea5455); }
.fulfillment-photo.approved { border-color: var(--bs-success, #28c76f); }
.photo-review-list { display: grid; gap: 1rem; }
.photo-review { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; overflow: hidden; }
.photo-review-image { background: #111; display: flex; align-items: center; justify-content: center; min-height: 260px; }
.photo-review-image img { width: 100%; max-height: 460px; object-fit: contain; display: block; }
.photo-review-image .photo-loading { color: #fff; }
.photo-review-body { padding: 1.1rem 1.25rem; }
.photo-review-body h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
@media (max-width: 767.98px) { .photo-review { grid-template-columns: 1fr; } }

/* ── Callback requests (مشاوره فوری) in the sales desk ── */
.callback-pill { background: rgba(var(--bs-warning-rgb), .18); color: var(--bs-warning); }
.callback-pill .ti { font-size: .8rem; }
.callback-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 .75rem; padding: .7rem .9rem; border-radius: var(--bs-border-radius-lg, .5rem); background: rgba(var(--bs-warning-rgb), .1); border: 1px solid rgba(var(--bs-warning-rgb), .35); }
.callback-bar-info { display: flex; align-items: center; gap: .65rem; }
.callback-bar-info > .ti { font-size: 1.5rem; color: var(--bs-warning); }
.callback-bar-info > div { display: flex; flex-direction: column; line-height: 1.6; }
.callback-bar-info a { font-weight: 600; }
.callback-outcomes { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.callback-outcomes .btn.active { box-shadow: inset 0 0 0 2px currentColor; }

/* ── Customer / order-history import ── */
.import-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
@media (max-width: 991.98px) { .import-grid { grid-template-columns: 1fr; } }
.import-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }
.import-kind { display: flex; align-items: center; gap: .65rem; padding: .7rem .8rem; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius-lg, .5rem); cursor: pointer; }
.import-kind input { position: absolute; opacity: 0; pointer-events: none; }
.import-kind > .ti { font-size: 1.5rem; color: var(--bs-secondary); }
.import-kind > span { display: flex; flex-direction: column; line-height: 1.6; }
.import-kind small { color: var(--bs-secondary-color); font-size: .78rem; }
.import-kind.active { border-color: var(--bs-primary); background: rgba(var(--bs-primary-rgb), .06); }
.import-kind.active > .ti { color: var(--bs-primary); }
.import-kind:focus-within { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.import-help ul { padding-inline-start: 1.1rem; margin-bottom: .5rem; line-height: 1.9; font-size: .88rem; }
.import-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: .75rem; }
.import-stats > div { display: flex; flex-direction: column; gap: .15rem; padding: .65rem .8rem; border-radius: var(--bs-border-radius, .375rem); background: rgba(var(--bs-secondary-rgb), .08); }
.import-stats span { font-size: .8rem; color: var(--bs-secondary-color); }
.import-stats strong { font-size: 1.25rem; }
.import-stats .ok strong { color: var(--bs-success); }
.import-stats .bad strong { color: var(--bs-danger); }
.import-errors { max-height: 360px; overflow: auto; }

/* ── Cheque plans, cheque desk and customer credit ── */
.plan-form .plan-example { padding: .5rem .75rem; border-radius: var(--bs-border-radius, .375rem); background: rgba(var(--bs-primary-rgb), .07); font-size: .85rem; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.plan-card { display: flex; flex-direction: column; }
.plan-card header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.plan-card ul { padding-inline-start: 1.1rem; margin-bottom: .5rem; font-size: .88rem; line-height: 1.9; }
.plan-card.inactive { opacity: .7; }
.cheque-case-card { margin-bottom: 1rem; }
.cheque-case-card.focused { box-shadow: 0 0 0 2px var(--bs-primary); }
.cheque-case-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.cheque-case-top > div { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; }
.cheque-case-meta { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: .5rem 0 .75rem; font-size: .85rem; color: var(--bs-secondary-color); }
.cheque-table td { vertical-align: top; }
.cheque-table .cheque-actions { display: flex; flex-wrap: wrap; gap: .35rem; min-width: 180px; }
.cheque-table tr.row-bad td, .table tr.row-bad td { background: rgba(var(--bs-danger-rgb), .06); }
.cheque-table tr.row-done td { color: var(--bs-secondary-color); }
.cheque-history summary { cursor: pointer; font-size: .85rem; color: var(--bs-secondary-color); }
.cheque-history ul { margin: .5rem 0 0; padding-inline-start: 1.1rem; font-size: .8rem; line-height: 1.8; }
.photo-lightbox { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 1rem; background: rgba(0, 0, 0, .75); cursor: zoom-out; }
.photo-lightbox img { max-width: 100%; max-height: 100%; border-radius: .5rem; background: #fff; }
.credit-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin: .75rem 0; }
.credit-figures > div { display: flex; flex-direction: column; padding: .55rem .75rem; border-radius: var(--bs-border-radius, .375rem); background: rgba(var(--bs-secondary-rgb), .08); }
.credit-figures span { font-size: .78rem; color: var(--bs-secondary-color); }
.credit-figures .bad strong { color: var(--bs-danger); }

/* Phase 4: workspace calendar, staff picker, task thread. */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; }
@media (max-width: 991px) { .week-grid { grid-template-columns: 1fr; } }
.week-day { background: var(--bs-body-bg, #f8f7fa); border-radius: .5rem; padding: .5rem; min-height: 120px; display: flex; flex-direction: column; gap: .3rem; }
.week-day.today { outline: 2px solid var(--bs-primary); }
.week-entry { background: #fff; border-radius: .375rem; padding: .25rem .4rem; font-size: .8rem; border-inline-start: 3px solid var(--bs-info); display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; }
.week-entry.meeting { border-inline-start-color: var(--bs-primary); }
.week-entry span { flex: 1; min-width: 0; }
.btn-xs { padding: .05rem .3rem; font-size: .75rem; }
.user-picker { position: relative; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; min-width: 220px; }
.user-picker-list { position: absolute; top: 100%; inset-inline-start: 0; z-index: 20; min-width: 240px; max-height: 240px; overflow-y: auto; box-shadow: 0 .25rem 1rem rgba(0,0,0,.12); cursor: pointer; }
.task-thread li { padding: .4rem 0; border-bottom: 1px solid var(--bs-border-color, #eee); }
.timeline-list li { padding: .5rem 0; border-bottom: 1px solid var(--bs-border-color, #eee); }
tr.clickable { cursor: pointer; }

/* ── Report builder ──────────────────────────────────────── */
.report-builder { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 1rem; align-items: start; }
@media (max-width: 991.98px) { .report-builder { grid-template-columns: 1fr; } }
.report-design .card-body > section + section { border-top: 1px solid var(--border); margin-top: .9rem; padding-top: .9rem; }
.report-design h3 { font-size: .85rem; font-weight: 600; color: var(--heading); margin-bottom: .5rem; }
.report-design .pick-list { display: flex; flex-direction: column; gap: .15rem; max-height: 260px; overflow-y: auto; }
.report-design .pick-list label { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.report-design .chip-row { display: flex; gap: .35rem; align-items: center; margin-bottom: .35rem; }
.report-design .chip-row > .form-select, .report-design .chip-row > .form-control { min-width: 0; }
.report-result .table td.num, .report-result .table th.num { text-align: end; white-space: nowrap; direction: ltr; }
.report-result tr.group-row > td { background: var(--soft); font-weight: 600; }
.report-result tr.subtotal-row > td { font-weight: 600; border-top: 1px solid var(--border); }
.report-result tr.total-row > td { font-weight: 700; border-top: 2px solid var(--muted); }
.report-result tr.level-1 > td:first-child { padding-inline-start: 1.5rem; }
.report-meta { color: var(--muted); font-size: .8rem; display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.report-pie { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.report-pie svg { width: 220px; height: 220px; flex-shrink: 0; }
.report-pie .slice { stroke: var(--bs-body-bg, #fff); stroke-width: 1.5; }
.report-pie .slice.hover { opacity: .8; }
.report-pie .pie-hole { fill: var(--bs-body-bg, #fff); }
.report-pie .pie-total { font-size: 15px; font-weight: 700; fill: var(--heading); }
.report-pie .pie-caption { font-size: 10px; fill: var(--muted); }
.chart-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; }
.chart-legend.inline { flex-direction: row; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .5rem; }
.chart-legend li { display: flex; align-items: center; gap: .4rem; }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.saved-reports .folder { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 1rem 0 .4rem; }
@media print { .report-builder { display: block; } .report-design { display: none !important; } }

/* ── PDF maker ───────────────────────────────────────────── */
.print-doc-frame { width: 100%; height: calc(100vh - 210px); min-height: 480px; border: 1px solid var(--border); border-radius: .375rem; background: #e9e9ef; }
.pd-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; gap: .75rem; align-items: start; }
@media (max-width: 1199.98px) { .pd-layout { grid-template-columns: 1fr; } }
.pd-panel { position: sticky; top: 5rem; max-height: calc(100vh - 6rem); overflow-y: auto; }
.pd-panel h3 { font-size: .8rem; font-weight: 600; color: var(--heading); margin: .75rem 0 .4rem; }
.pd-panel label { display: block; font-size: .8rem; margin-bottom: .35rem; }
.pd-panel .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.pd-panel .row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; }
.pd-tools { display: flex; flex-wrap: wrap; gap: .3rem; }
.pd-tools button { flex: 1 1 45%; font-size: .78rem; }
.pd-fields { font-size: .78rem; max-height: 280px; overflow-y: auto; }
.pd-fields button { display: block; width: 100%; text-align: start; border: 0; background: none; padding: .15rem .3rem; border-radius: .25rem; color: inherit; }
.pd-fields button:hover { background: var(--soft); }
.pd-fields .child { padding-inline-start: 1rem; color: var(--muted); }
.pd-canvas-wrap { overflow: auto; background: #e9e9ef; border-radius: .375rem; padding: 12px; }
.pd-sheet { position: relative; background: #fff; margin: 0 auto; box-shadow: 0 2px 8px rgba(0,0,0,.15); direction: rtl; user-select: none; }
.pd-band { position: relative; border-bottom: 1px dashed #b8b8c8; }
.pd-band.selected { background: rgba(32, 141, 68, .04); }
.pd-band-label { position: absolute; top: 0; left: -2px; transform: translateX(-100%); font-size: 10px; color: #777; white-space: nowrap; padding-inline-end: 4px; cursor: pointer; }
.pd-band-grip { position: absolute; left: 0; right: 0; bottom: -4px; height: 8px; cursor: ns-resize; z-index: 3; }
.pd-el { position: absolute; box-sizing: border-box; overflow: hidden; outline: 1px dotted #c9c9d6; cursor: move; font-size: 10px; line-height: 1.35; white-space: pre-wrap; color: #333; }
.pd-el.selected { outline: 2px solid var(--primary); z-index: 2; }
.pd-el .pd-kind { position: absolute; top: 0; left: 0; font-size: 8px; background: rgba(0,0,0,.45); color: #fff; padding: 0 2px; }
.pd-el .pd-resize { position: absolute; left: -1px; bottom: -1px; width: 9px; height: 9px; background: var(--primary); cursor: nesw-resize; }
.pd-el.table-el { background: repeating-linear-gradient(0deg, #fafafa, #fafafa 14px, #f0f0f4 14px, #f0f0f4 15px); }
.pd-preview { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: .375rem; background: #e9e9ef; }
.pd-cols td { padding: .15rem; }
.pd-cols input { font-size: .75rem; }

/* ── Order desk (میز کار سفارش‌ها) ─────────────────────────────────────────────────────────────── */
.od-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: 1rem; }
.od-rules { display: flex; flex-wrap: wrap; gap: .35rem .75rem; font-size: .78rem; color: var(--muted); }
.od-rule.on { color: var(--bs-success); }
.od-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.od-search { width: 220px; }
.od-notice { position: sticky; top: .5rem; z-index: 5; }
.od-journey { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; counter-reset: od; }
.od-journey li { display: flex; align-items: center; gap: .35rem; background: var(--surface); border-radius: 999px; padding: .3rem .8rem; box-shadow: var(--shadow); font-size: .85rem; }
.od-journey li + li::before { content: "←"; color: var(--muted); margin-inline-end: .35rem; }
.od-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.od-col { background: rgba(var(--bs-secondary-rgb), .06); border-radius: var(--radius); padding: .75rem; min-height: 260px; }
.od-col > header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: var(--heading); padding-bottom: .6rem; }
.od-cards { display: flex; flex-direction: column; gap: .65rem; max-height: calc(100vh - 260px); overflow-y: auto; }
.od-empty { color: var(--muted); font-size: .85rem; text-align: center; padding: 1.5rem .5rem; margin: 0; }
.od-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .7rem .85rem; border: 1px solid transparent; cursor: pointer; }
.od-card:hover, .od-card:focus { border-color: var(--primary); outline: none; }
.od-card.od-alert { border-color: rgba(var(--bs-danger-rgb), .55); }
.od-card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.od-num { font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; }
.od-customer { font-size: .9rem; margin-top: .15rem; }
.od-amount { font-weight: 700; font-size: 1.05rem; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.od-meta { display: flex; flex-wrap: wrap; gap: .2rem .7rem; color: var(--muted); font-size: .75rem; margin-top: .3rem; }
.od-warning { color: var(--bs-danger); font-size: .78rem; margin-top: .35rem; }
.od-hint { color: var(--bs-warning); font-size: .78rem; margin-top: .35rem; }
.od-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.od-actions:empty { display: none; }
.od-stars { color: #f0a500; letter-spacing: .05em; margin-top: .25rem; }
.od-stars.low { color: var(--bs-danger); }
.od-comment { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.od-hold, .od-new { background: rgba(var(--bs-danger-rgb), .14); color: var(--bs-danger); }
.od-new { background: rgba(var(--bs-info-rgb), .14); color: var(--bs-info); }
.od-wait { background: rgba(var(--bs-warning-rgb), .16); color: var(--bs-warning); }
.od-picking { background: rgba(var(--bs-primary-rgb), .14); color: var(--bs-primary); }
.od-packed, .od-done { background: rgba(var(--bs-success-rgb), .14); color: var(--bs-success); }
.od-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 1090; }
.od-drawer { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(480px, 100vw); background: var(--surface); z-index: 1091;
    box-shadow: var(--shadow); display: flex; flex-direction: column; }
.od-drawer > header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .9rem 1rem; border-bottom: 1px solid var(--border, rgba(0,0,0,.08)); }
.od-drawer > header .badge { margin-inline-start: .4rem; }
.od-drawer-body { overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.od-drawer h6 { margin-bottom: .5rem; }
.od-receipt img { max-width: 100%; max-height: calc(100vh - 80px); margin: auto; display: block; padding: .5rem; }
.od-who { display: flex; flex-direction: column; gap: .25rem; }
.od-who a { margin-inline-start: .4rem; }
.od-timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 2px solid rgba(var(--bs-secondary-rgb), .25); }
.od-timeline li { position: relative; padding: .1rem 1rem .6rem; display: flex; flex-wrap: wrap; gap: .1rem .6rem; color: var(--muted); font-size: .85rem; }
.od-timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: .35rem; width: 12px; height: 12px; border-radius: 50%;
    background: var(--surface); border: 2px solid rgba(var(--bs-secondary-rgb), .4); }
.od-timeline li.done { color: var(--heading); }
.od-timeline li.done::before { background: var(--bs-success); border-color: var(--bs-success); }
.od-step-title { font-weight: 600; min-width: 8rem; }
.od-step-time { font-variant-numeric: tabular-nums; }
.od-step-note { width: 100%; font-size: .78rem; color: var(--muted); }
.od-survey { background: rgba(240, 165, 0, .08); border-radius: var(--radius); padding: .6rem .8rem; font-size: .85rem; }
.od-survey.low { background: rgba(var(--bs-danger-rgb), .08); }
.od-survey b { color: #f0a500; }
.od-survey blockquote { margin: .4rem 0 0; color: var(--heading); }
.od-lines { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.od-lines li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem; padding: .35rem .5rem; border-radius: 6px; background: rgba(var(--bs-secondary-rgb), .05); }
.od-lines li.done { background: rgba(var(--bs-success-rgb), .08); }
.od-qty { font-variant-numeric: tabular-nums; color: var(--muted); }
.od-form { border-top: 1px dashed rgba(var(--bs-secondary-rgb), .3); padding-top: .75rem; }
.od-drawer-foot { display: flex; flex-wrap: wrap; gap: .5rem; border-top: 1px solid var(--border, rgba(0,0,0,.08)); padding-top: .75rem; }
.od-done-list { display: flex; flex-direction: column; }
.od-done-row { display: grid; grid-template-columns: 8rem 1fr auto 7rem 9rem; gap: .75rem; align-items: center; padding: .6rem 1rem; border: 0;
    border-bottom: 1px solid rgba(var(--bs-secondary-rgb), .12); background: none; text-align: start; }
.od-done-row:hover { background: rgba(var(--bs-primary-rgb), .05); }
@media (max-width: 768px) {
    .od-board { grid-auto-columns: minmax(85vw, 1fr); scroll-snap-type: x mandatory; }
    .od-col { scroll-snap-align: start; }
    .od-cards { max-height: none; }
    .od-search { width: 100%; }
    .od-done-row { grid-template-columns: 1fr auto; }
}

/* ── The panel's own confirm / prompt / alert (js/dialogs.js) ──────────────────────────────────── */
.alb-dialog-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, .4); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.alb-dialog { width: min(440px, 100%); padding: 1.25rem; box-shadow: 0 .5rem 2rem rgba(0, 0, 0, .25); }
.alb-dialog-text { margin: 0 0 .9rem; white-space: pre-line; color: var(--heading); line-height: 1.8; }
.alb-dialog-input { margin-bottom: .9rem; }
.alb-dialog-actions { display: flex; gap: .5rem; justify-content: flex-start; }
.od-pay-amount { display: flex; flex-direction: column; align-items: flex-start; background: rgba(var(--bs-primary-rgb), .07); border-radius: var(--radius); padding: .75rem 1rem; }
.od-pay-amount strong { font-size: 1.6rem; color: var(--heading); font-variant-numeric: tabular-nums; }
.od-facts { width: 100%; font-size: .88rem; border-collapse: collapse; }
.od-facts th { font-weight: 500; color: var(--muted); padding: .35rem 0 .35rem .75rem; width: 45%; vertical-align: top; }
.od-facts td { padding: .35rem 0; color: var(--heading); border-bottom: 1px dashed rgba(var(--bs-secondary-rgb), .2); }
.od-ref { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; letter-spacing: .03em; }
.od-receipt-img { max-width: 100%; max-height: 60vh; border-radius: 6px; border: 1px solid rgba(var(--bs-secondary-rgb), .2); display: block; }

/* ── Users and access (vTiger model): roles tree, profiles matrix, groups, sharing, user profile ── */
.acl-nav { display: flex; gap: .25rem; overflow-x: auto; margin-bottom: 1.25rem; padding: .3rem; background: var(--bs-paper-bg, var(--surface));
           border-radius: calc(var(--radius) * 2); box-shadow: var(--shadow); scrollbar-width: thin; }
.acl-nav-item { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .5rem .9rem; border-radius: var(--radius); color: var(--heading); font-size: .9rem; }
.acl-nav-item:hover { background: var(--soft); color: var(--primary); }
.acl-nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(var(--primary-rgb), .35); }
.acl-tabs .nav-link { display: inline-flex; align-items: center; }

.acl-split { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.acl-split-wide { grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); }
.acl-panel { overflow: hidden; }
.acl-panel-head { display: flex; gap: .5rem; align-items: center; padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.acl-panel-body { padding: .5rem; max-height: calc(100vh - 16rem); min-height: 320px; overflow: auto; }
.acl-details { padding: 1.25rem 1.4rem; overflow: visible; }
.acl-details-head { display: flex; gap: .9rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1rem; }
.acl-search { position: relative; flex: 1; min-width: 0; }
.acl-search > i { position: absolute; inset-inline-start: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.acl-search > .form-control { padding-inline-start: 2.1rem; }
.acl-search-sm > i { inset-inline-start: .55rem; }
.acl-search-sm > .form-control { padding-inline-start: 1.8rem; min-width: 180px; }
.acl-search-page { max-width: 420px; }
.acl-hint { color: var(--muted); font-size: .82rem; margin: .25rem 0 .6rem; }
.acl-hint > i { margin-inline-end: .25rem; }
.acl-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.acl-empty { padding: 1.5rem; text-align: center; color: var(--muted); }
.acl-empty-big { display: grid; place-items: center; gap: .5rem; padding: 3rem 1rem; text-align: center; color: var(--muted); }
.acl-empty-big > i { font-size: 3rem; color: rgba(var(--primary-rgb), .35); }
.acl-empty-big p { max-width: 420px; margin: 0; }
.acl-avatar { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem;
              color: var(--t, var(--primary)); background: color-mix(in srgb, var(--t, var(--primary)) 13%, transparent); }
.acl-code { font-size: .75rem; padding: .1rem .35rem; border-radius: .25rem; background: rgba(var(--bs-secondary-rgb, 168, 170, 174), .12); color: var(--heading); }
.acl-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .82rem; color: var(--muted); }
.acl-crumbs .btn-link { font-size: .82rem; color: var(--primary); text-decoration: none; }
.acl-section { padding-top: 1rem; margin-top: 1rem; border-top: 1px dashed var(--border); }
.acl-section h3, .acl-card-title { font-size: .95rem; font-weight: 600; color: var(--heading); display: flex; align-items: center; gap: .4rem; margin: 0 0 .5rem; }
.acl-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .25rem; }
.acl-section-head h3 { margin: 0; }
.acl-legend { font-size: .85rem; font-weight: 600; color: var(--heading); margin-bottom: .4rem; }
.acl-pill { display: inline-flex; align-items: center; gap: .2rem; font-size: .75rem; color: var(--muted); padding: .05rem .4rem; border-radius: 999px;
            background: rgba(var(--bs-secondary-rgb, 168, 170, 174), .1); }

/* Tree */
.acl-tree { font-size: .9rem; }
.acl-tree-children { margin-inline-start: 1.05rem; padding-inline-start: .55rem; border-inline-start: 1px dashed var(--border); }
.acl-tree-row { display: flex; align-items: center; gap: .4rem; padding: .35rem .45rem; border-radius: var(--radius); cursor: pointer; user-select: none;
                border: 1px solid transparent; transition: background .12s, border-color .12s; }
.acl-tree-row:hover { background: var(--soft); }
.acl-tree-row.is-selected { background: rgba(var(--primary-rgb), .12); border-color: rgba(var(--primary-rgb), .35); }
.acl-tree-row.is-selected .acl-tree-name { color: var(--primary); font-weight: 600; }
.acl-tree-row.is-inactive { opacity: .55; }
.acl-tree-row.is-disabled { opacity: .4; cursor: not-allowed; }
.acl-tree-row.is-drop { background: rgba(var(--primary-rgb), .18); border: 1px dashed var(--primary); }
.acl-tree-row.is-match .acl-tree-name { background: rgba(255, 196, 0, .3); border-radius: .2rem; padding: 0 .15rem; }
.acl-tree-row[draggable="true"] { cursor: grab; }
.acl-twisty { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: .25rem; padding: 0; }
.acl-twisty:hover { background: rgba(var(--primary-rgb), .12); color: var(--primary); }
.acl-leaf::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--border); }
.acl-tree-icon { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--primary); background: var(--soft); }
.acl-tree-icon.is-root { color: #fff; background: var(--primary); }
.acl-tree-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--heading); }
.acl-tree-meta { margin-inline-start: auto; display: inline-flex; gap: .25rem; align-items: center; }
.acl-tree-meta .badge { font-size: .65rem; }
.acl-grip { color: var(--muted); opacity: 0; }
.acl-tree-row:hover .acl-grip { opacity: 1; }
.acl-tree-compact .acl-tree-row { padding: .25rem .35rem; }
.acl-picker { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: .35rem; }

/* Chips, options, segmented controls */
.acl-chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.acl-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .6rem; border-radius: 999px; font-size: .82rem; color: var(--heading);
            background: var(--soft); border: 1px solid rgba(var(--primary-rgb), .18); }
.acl-chip > i { color: var(--primary); }
.acl-chip small { color: var(--muted); font-size: .7rem; }
.acl-chip-sm { padding: .1rem .5rem; font-size: .76rem; }
.acl-chip-link { cursor: pointer; }
.acl-chip-link:hover { background: rgba(var(--primary-rgb), .16); }
.acl-chip-x { border: 0; background: none; color: var(--muted); padding: 0; line-height: 1; display: inline-grid; place-items: center; }
.acl-chip-x:hover { color: var(--bs-danger, #ea5455); }
.acl-chip.member-role { background: rgba(14, 165, 233, .1); border-color: rgba(14, 165, 233, .25); }
.acl-chip.member-role > i { color: #0ea5e9; }
.acl-chip.member-roleandsubordinates { background: rgba(124, 58, 237, .09); border-color: rgba(124, 58, 237, .25); }
.acl-chip.member-roleandsubordinates > i { color: #7c3aed; }
.acl-options { display: grid; gap: .5rem; }
.acl-options-row { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.acl-option { display: flex; gap: .65rem; align-items: flex-start; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.5); cursor: pointer; margin: 0; }
.acl-option .form-check-input { margin-top: .2rem; flex: none; }
.acl-option strong { display: block; color: var(--heading); font-size: .9rem; }
.acl-option small { display: block; color: var(--muted); font-size: .78rem; }
.acl-option.is-on { border-color: var(--primary); background: var(--soft); }
.acl-option.is-on.is-danger { border-color: var(--bs-danger, #ea5455); background: rgba(234, 84, 85, .07); }
.acl-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .35rem .75rem; }
.acl-checklist label { display: flex; gap: .4rem; align-items: center; margin: 0; font-size: .88rem; }
.acl-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bs-paper-bg, var(--surface)); }
.acl-seg-btn { border: 0; background: none; padding: .3rem .7rem; font-size: .8rem; color: var(--heading); display: inline-flex; align-items: center; gap: .25rem; }
.acl-seg-btn + .acl-seg-btn { border-inline-start: 1px solid var(--border); }
.acl-seg-btn:hover:not(:disabled) { background: var(--soft); }
.acl-seg-btn.is-on { background: var(--primary); color: #fff; }
.acl-seg-btn.is-on.lv-readonly, .acl-seg-btn.is-on.lv-read { background: #0ea5e9; }
.acl-seg-btn.is-on.lv-hidden, .acl-seg-btn.is-on.lv-private { background: #6b7280; }
.acl-seg-btn.is-on.lv-write { background: #f59e0b; }
.acl-seg-btn:disabled { opacity: .6; cursor: not-allowed; }
.acl-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: #6b7280; vertical-align: middle; }
.acl-dot.lv-read { background: #0ea5e9; }
.acl-dot.lv-write { background: #f59e0b; }

/* Lists and people */
.acl-list { display: grid; gap: .25rem; align-content: start; }
.acl-list-item { display: flex; align-items: center; gap: .65rem; text-align: start; width: 100%; padding: .55rem .6rem; border: 1px solid transparent;
                 border-radius: var(--radius); background: none; color: var(--heading); }
.acl-list-item:hover { background: var(--soft); }
.acl-list-item.is-selected { background: rgba(var(--primary-rgb), .1); border-color: rgba(var(--primary-rgb), .3); }
.acl-list-item .acl-avatar { width: 36px; height: 36px; font-size: 1.1rem; border-radius: 10px; }
.acl-list-item strong { display: block; font-size: .9rem; }
.acl-list-item small { display: block; color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acl-people { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.acl-people li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.acl-people li.is-inactive { opacity: .55; }
.acl-initials { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 600; color: var(--primary); background: var(--soft); }

/* Profile matrix */
.acl-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.acl-module { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: .88rem; }
.acl-module > i { color: var(--muted); font-size: 1.15rem; }
.acl-module.is-on { border-color: rgba(var(--primary-rgb), .45); background: var(--soft); }
.acl-module.is-on > i { color: var(--primary); }
.acl-matrix-wrap { max-height: 70vh; border: 1px solid var(--border); border-radius: var(--radius); }
.acl-matrix { margin: 0; font-size: .85rem; }
.acl-matrix th, .acl-matrix td { text-align: center; vertical-align: middle; padding: .4rem .5rem; white-space: nowrap; }
.acl-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--bs-paper-bg, var(--surface)); font-size: .78rem; color: var(--heading); }
.acl-matrix thead tr.acl-col-select th { top: 2.1rem; background: color-mix(in srgb, var(--primary) 5%, var(--bs-paper-bg, #fff)); }
.acl-matrix .acl-col-name { text-align: start; white-space: normal; min-width: 210px; }
.acl-matrix .acl-col-name small { display: block; color: var(--muted); font-size: .7rem; }
.acl-matrix .acl-col-all { background: rgba(var(--primary-rgb), .04); }
.acl-matrix .acl-col-tool { background: rgba(14, 165, 233, .04); }
.acl-matrix .acl-module-row th { background: color-mix(in srgb, var(--primary) 7%, var(--bs-paper-bg, #fff)); text-align: start; }
.acl-matrix .acl-module-row th:not(:first-child) { text-align: center; }
.acl-matrix tr.is-muted td { opacity: .5; }
.acl-matrix tr.is-granted .acl-col-name span { font-weight: 600; color: var(--heading); }
.acl-matrix .acl-act:checked.acl-act-delete { background-color: var(--bs-danger, #ea5455); border-color: var(--bs-danger, #ea5455); }
.acl-matrix .acl-act:checked.acl-act-create { background-color: #16a34a; border-color: #16a34a; }
.acl-matrix .acl-act:checked.acl-act-edit { background-color: #f59e0b; border-color: #f59e0b; }
.acl-fields-row > td { background: rgba(var(--bs-secondary-rgb, 168, 170, 174), .06); text-align: start !important; white-space: normal !important; }
.acl-fields { display: grid; gap: .45rem; padding: .25rem .5rem; }
.acl-field { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.acl-field-name { min-width: 180px; color: var(--heading); }
.acl-field-name small { color: var(--muted); margin-inline-start: .3rem; }
.acl-field-new .form-control { max-width: 260px; }
.acl-savebar { position: sticky; bottom: 1rem; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1rem; padding: .7rem 1rem;
               border-radius: calc(var(--radius) * 2); background: var(--heading); color: #fff; box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .2); }
.acl-savebar > span { margin-inline-end: auto; display: inline-flex; gap: .4rem; align-items: center; }

/* Groups, sharing, rules */
.acl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.acl-card { padding: 1rem 1.1rem; display: grid; gap: .75rem; }
.acl-card header { display: flex; gap: .7rem; align-items: flex-start; }
.acl-card footer { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); border-top: 1px dashed var(--border); padding-top: .6rem; }
.acl-member-add { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin-bottom: .25rem; }
.acl-member-add .grow { flex: 1; min-width: 200px; position: relative; }
.acl-member-list { min-height: 2.5rem; padding: .5rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.acl-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.acl-legend-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .5rem 1rem; padding: .85rem 1rem; margin-bottom: .75rem;
                  border-radius: var(--radius); background: var(--soft); font-size: .82rem; }
.acl-legend-box strong { margin-inline: .3rem; color: var(--heading); }
.acl-sharing td, .acl-rules td { vertical-align: middle; }
.acl-rule-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: center; }
.acl-rule-arrow { font-size: 1.4rem; color: var(--primary); padding-top: 1.5rem; }

/* User profile */
.acl-hero { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; padding: 1.25rem 1.5rem;
            background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 9%, var(--bs-paper-bg, #fff)), var(--bs-paper-bg, #fff) 60%); }
.acl-hero-avatar { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; color: #fff;
                   background: var(--primary); box-shadow: 0 6px 16px rgba(var(--primary-rgb), .35); }
.acl-hero-facts { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0; margin-inline-start: auto; }
.acl-hero-facts dt { font-weight: 400; color: var(--muted); font-size: .78rem; }
.acl-hero-facts dd { margin: 0; color: var(--heading); font-size: .9rem; }
.acl-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.acl-effective tbody tr:not(.acl-why) { cursor: pointer; }
.acl-effective tr.is-muted td { opacity: .55; }
.acl-why > td { background: var(--soft); font-size: .83rem; }
.acl-why > td > div { padding: .15rem 0; }
.acl-why i, .acl-why-list i { color: var(--primary); margin-inline-end: .3rem; }
.acl-why-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; font-size: .85rem; }
.acl-ua { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 991.98px) {
    .acl-split, .acl-split-wide { grid-template-columns: 1fr; }
    .acl-panel-body { max-height: 50vh; min-height: 0; }
    .acl-hero-facts { margin-inline-start: 0; }
}
@media (max-width: 575.98px) {
    .acl-details { padding: 1rem; }
    .acl-rule-grid { grid-template-columns: 1fr; }
    .acl-rule-arrow { padding: 0; transform: rotate(-90deg); justify-self: center; }
    .acl-tree-meta .acl-pill { display: none; }
}
