/* =========================================================
   ZotalCRM (based on NexusCRM) – RTL theme on top of Bootstrap 5.3 (bootstrap.rtl)
   ========================================================= */
:root {
    --nx-topbar-h: 3.5rem;
    --nx-sidebar-w: 15rem;
    --nx-topbar-bg: #2b303a;
    --nx-sidebar-bg: #151a26;
    --nx-sidebar-hover: #1f2636;
    --nx-sidebar-text: #c3c9d6;
    --nx-accent: #f5a524;
    --nx-page-bg: #f4f6f9;
    --nx-panel-head: #f7f7f8;
    --nx-border: #e3e6ea;
    /* gray text – darkened by the dark-text display setting (html.a11y-dark-text, end of file) */
    --nx-muted: #6c757d;
    --nx-label: #495057;
    --nx-label-strong: #343a40;
    --nx-faint: #8a93a2;
    --nx-placeholder: #b3b9c2;
    --nx-disabled: #adb5bd;
    --nx-sidebar-muted: #7d8597;
    --nx-topbar-text: #e9ecf1;
    --nx-chart-text: #5c6370;
    /* status colours of the site's own rules (Bootstrap's --bs-success / --bs-danger stay as they are) */
    --nx-success: #1f9d55;
    --nx-danger: #e03131;
    --nx-warning: #f0b429;
    /* smallest text: 0 = as designed; a larger text size raises it (end of file) */
    --nx-min-text: 0rem;
    /* keyboard focus ring (light surfaces; the dark top bar / sidebar use a yellow one) */
    --nx-focus: #0b5ed7;
    --bs-primary: #1673e6;
    --bs-primary-rgb: 22, 115, 230;
    --bs-body-font-family: "Segoe UI", "Assistant", "Rubik", Arial, sans-serif;
    --bs-link-color: #1673e6;
    --bs-link-color-rgb: 22, 115, 230;
}

/* env(safe-area-inset-*) = the notch / home bar of a phone (0 elsewhere) – the CRM can run full-screen from the home screen */
body.app { background: var(--nx-page-bg); padding-top: calc(var(--nx-topbar-h) + env(safe-area-inset-top)); min-height: 100vh; }
/* buttons follow the theme colours (Bootstrap writes fixed colours into them) – hover / pressed = a little darker */
.btn-primary, .btn-success, .btn-danger {
    --bs-btn-bg: var(--nx-btn); --bs-btn-border-color: var(--nx-btn);
    --bs-btn-hover-bg: color-mix(in srgb, var(--nx-btn) 85%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--nx-btn) 85%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--nx-btn) 78%, #000); --bs-btn-active-border-color: color-mix(in srgb, var(--nx-btn) 78%, #000);
    --bs-btn-disabled-bg: var(--nx-btn); --bs-btn-disabled-border-color: var(--nx-btn);
}
.btn-outline-primary, .btn-outline-success, .btn-outline-danger {
    --bs-btn-color: var(--nx-btn); --bs-btn-border-color: var(--nx-btn);
    --bs-btn-hover-bg: var(--nx-btn); --bs-btn-hover-border-color: var(--nx-btn);
    --bs-btn-active-bg: var(--nx-btn); --bs-btn-active-border-color: var(--nx-btn);
    --bs-btn-disabled-color: var(--nx-btn); --bs-btn-disabled-border-color: var(--nx-btn);
}
.btn-primary, .btn-outline-primary { --nx-btn: var(--bs-primary); }
.btn-success, .btn-outline-success { --nx-btn: var(--nx-success); }
.btn-danger, .btn-outline-danger { --nx-btn: var(--bs-danger); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }

/* ---------- Top bar ---------- */
.topbar {
    position: fixed; inset: 0 0 auto 0; height: calc(var(--nx-topbar-h) + env(safe-area-inset-top)); z-index: 1040;
    display: flex; align-items: center; justify-content: space-between;
    padding: env(safe-area-inset-top) max(.75rem, env(safe-area-inset-right)) 0 max(.75rem, env(safe-area-inset-left));
    background: var(--nx-topbar-bg); color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-size: 1.2rem; letter-spacing: .3px; }
.brand b { color: var(--nx-accent); }
.brand:hover { color: #fff; }
.btn-icon { padding: .25rem .5rem; line-height: 1; }
.btn-topbar { color: var(--nx-topbar-text); border: 0; display: flex; align-items: center; gap: .4rem; padding: .35rem .6rem; font-size: .92rem; }
.btn-topbar:hover, .btn-topbar.show { color: #fff; background: rgba(255, 255, 255, .1); }
.btn-topbar .bi { font-size: 1.1rem; }
.topbar .dropdown-menu { min-width: 230px; }
.topbar .dropdown-item.active { background: var(--bs-primary); }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--nx-sidebar-bg); color: var(--nx-sidebar-text); }
@media (min-width: 992px) {
    /* Bootstrap makes .offcanvas-lg transparent on desktop – keep the dark sidebar like on mobile */
    .sidebar.offcanvas-lg { background-color: var(--nx-sidebar-bg) !important; }
    .sidebar {
        position: fixed; top: var(--nx-topbar-h); bottom: 0; right: 0; width: var(--nx-sidebar-w);
        display: flex; flex-direction: column; overflow-y: auto; z-index: 1030;
        transition: transform .2s ease;
    }
    .content { margin-right: var(--nx-sidebar-w); transition: margin .2s ease; }
    body.sidebar-collapsed .sidebar { transform: translateX(100%); }
    body.sidebar-collapsed .content { margin-right: 0; }
}
@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg { --bs-offcanvas-width: 17rem; --bs-offcanvas-bg: var(--nx-sidebar-bg); color: var(--nx-sidebar-text); }
    .sidebar .offcanvas-header { border-bottom: 1px solid rgba(255, 255, 255, .08); color: #fff; }
}
.sidebar-nav { padding: .75rem 0; flex: 1; width: 100%; }
.sidebar .nav-link, .nav-group-toggle {
    display: flex; align-items: center; gap: .65rem; width: 100%;
    padding: .7rem 1.1rem; color: var(--nx-sidebar-text); text-decoration: none;
    border: 0; background: none; font-size: .97rem; text-align: right;
}
.sidebar .nav-link .bi, .nav-group-toggle .bi { font-size: 1.1rem; }
.sidebar .nav-link:hover, .nav-group-toggle:hover { background: var(--nx-sidebar-hover); color: #fff; }
.sidebar .nav-link.active { color: #4fb3ff; background: var(--nx-sidebar-hover); box-shadow: inset -3px 0 0 #4fb3ff; }
.nav-group-toggle { color: var(--nx-accent); font-weight: 600; }
.nav-group-toggle .chevron { margin-right: auto; font-size: max(var(--nx-min-text), .8rem); transition: transform .2s; }
.nav-group-toggle.collapsed .chevron { transform: rotate(90deg); }
.nav-group-items { margin: .25rem .75rem .5rem; background: #fff; border-radius: .4rem; padding: .3rem 0; }
.nav-group-items .nav-link { color: #2b303a; padding: .5rem 1rem; font-size: .93rem; }
.nav-group-items .nav-link:hover { background: #f1f4f8; color: #000; }
.nav-group-items .nav-link.active { color: var(--bs-primary); background: #eaf2fd; box-shadow: inset -3px 0 0 var(--bs-primary); }
/* a sub-menu inside a group (e.g. Management → Targets) */
.nav-group-items .nav-sub-toggle { cursor: pointer; }
.nav-group-items .nav-sub-toggle .chevron { margin-right: auto; font-size: max(var(--nx-min-text), .75rem); transition: transform .2s; }
.nav-group-items .nav-sub-toggle.collapsed .chevron { transform: rotate(90deg); }
.nav-sub-items { margin: 0 .6rem .25rem 0; border-right: 2px solid #e3e8ef; }
.nav-sub-items .nav-link { padding: .4rem .9rem; font-size: .9rem; }
.sidebar-footer { padding: .75rem 1.1rem; font-size: max(var(--nx-min-text), .8rem); color: var(--nx-sidebar-muted); border-top: 1px solid rgba(255, 255, 255, .06); }

/* ---------- Content ---------- */
.content { padding: 1.25rem 1.25rem 3rem; }
.page-header {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
    border-bottom: 1px solid var(--nx-border); padding-bottom: .6rem; margin-bottom: 1rem;
}
.page-title { font-size: 2rem; font-weight: 400; margin: 0; color: #1f2329; }
.crumbs { background: #e9ecef; border-radius: .3rem; padding: .7rem 1rem; margin-bottom: 1rem; }
.crumbs .breadcrumb-item + .breadcrumb-item::before { float: right; padding-left: .5rem; padding-right: 0; }

.panel { border: 1px solid var(--nx-border); border-radius: .35rem; box-shadow: 0 1px 3px rgba(16, 24, 40, .04); }
.panel > .card-header { background: var(--nx-panel-head); font-weight: 500; padding: .8rem 1rem; display: flex; align-items: center; gap: .5rem; }
.chart-box { position: relative; height: 300px; }

/* KPI tiles */
.kpi { display: flex; align-items: center; gap: .85rem; background: #fff; border: 1px solid var(--nx-border); border-radius: .5rem; padding: 1rem; height: 100%; }
.kpi-icon { width: 46px; height: 46px; flex: 0 0 46px; border-radius: .6rem; display: grid; place-items: center; font-size: 1.35rem; }
.kpi-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.kpi-label { color: var(--nx-muted); font-size: .85rem; }
.kpi-body { min-width: 0; }
@media (max-width: 575.98px) {
    /* phone: two tiles a row – smaller figures, the icon gives way */
    .kpi { padding: .7rem; gap: .55rem; }
    .kpi-icon { width: 36px; height: 36px; flex-basis: 36px; font-size: 1.05rem; }
    .kpi-value { font-size: 1rem; }
    .kpi-label { font-size: max(var(--nx-min-text), .78rem); }
}
.kpi-blue .kpi-icon { background: color-mix(in srgb, var(--bs-primary) 11%, #fff); color: var(--bs-primary); }
.kpi-orange .kpi-icon { background: #fff3e0; color: #f08c00; }
.kpi-green .kpi-icon { background: color-mix(in srgb, var(--nx-success) 12%, #fff); color: var(--nx-success); }
.kpi-purple .kpi-icon { background: #f1eafd; color: #7048e8; }
.kpi-teal .kpi-icon { background: #e3f8f6; color: #0ca678; }
.kpi-red .kpi-icon { background: color-mix(in srgb, var(--nx-danger) 11%, #fff); color: var(--nx-danger); }
.rank { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #eef1f5; font-size: max(var(--nx-min-text), .8rem); font-weight: 600; }

/* Toolbar above tables */
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; }
.search-box { max-width: 460px; }
.search-box-sm { width: 210px; }
.status-filter { width: auto; min-width: 140px; }
.status-filter.has-value { border-color: var(--bs-primary); background-color: #f2f7fe; color: var(--bs-primary); font-weight: 500; }

.table > thead th { font-weight: 600; font-size: .9rem; white-space: nowrap; border-bottom-width: 2px; }
.clickable-rows tbody tr[data-href] { cursor: pointer; }

/* Customer form – mirrors the SAP-style layout: 6 columns on wide screens */
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .9rem 1.6rem; }
.form-grid .form-label { margin-bottom: .3rem; color: var(--nx-label-strong); }
.form-grid .form-control[readonly], .form-grid .form-select:disabled { background: #e9ecef; }
.form-grid-notes { grid-row: span 2; grid-column: 6; display: flex; flex-direction: column; }
.form-grid-notes textarea { flex: 1; }
.form-control.num { direction: ltr; text-align: right; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1.25rem; }
@media (max-width: 1399.98px) { .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .form-grid-notes { grid-column: auto; grid-row: auto; } }
@media (max-width: 767.98px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid-notes { grid-column: 1 / -1; } }
@media (max-width: 479.98px) { .form-grid { grid-template-columns: 1fr; } }

/* Tabs */
.crm-tabs { border-bottom: 0; padding: .5rem .75rem 0; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.crm-tabs .nav-link { color: var(--bs-primary); white-space: nowrap; border-radius: .35rem .35rem 0 0; padding: .65rem 1rem; }
.crm-tabs .nav-link.active { color: #212529; font-weight: 500; }
.tabs-panel > .card-header { background: var(--nx-panel-head); }
.tabs-panel .tab-content { min-height: 180px; }
.tab-loading { display: grid; place-items: center; min-height: 150px; }

.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state > .bi { font-size: 3rem; display: block; margin-bottom: .75rem; }
.empty-state h2 { font-size: 1.4rem; }

/* ---------- Mobile: tables become cards (uses data-label on each td) ---------- */
@media (max-width: 767.98px) {
    .content { padding: 1rem 1rem 3rem; }
    .page-title { font-size: 1.5rem; }
    .search-box, .search-box-sm { width: 100%; max-width: none; }
    .toolbar > * { flex: 1 1 100%; }
    .toolbar > .btn { flex: 0 0 auto; }
    .table-filters .status-filter { flex: 0 0 auto; min-width: 0; }
    .table-filters .search-box-sm { flex: 1 1 auto; width: auto; }

    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr { border: 1px solid var(--nx-border); border-radius: .5rem; margin-bottom: .75rem; padding: .35rem .75rem; background: #fff; }
    .table-cards td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 0; padding: .35rem 0 !important; text-align: left !important; }
    .table-cards td[dir=ltr] { flex-direction: row-reverse; } /* keep label on the right for LTR values (phones) */
    .table-cards td::before { content: attr(data-label); font-weight: 600; color: var(--nx-muted); text-align: right; flex: 0 0 auto; }
    .table-cards td:not([data-label])::before { content: none; }
    .table-cards tr.empty-row td { justify-content: center; }
    .table-cards tr.empty-row td::before { content: none; }
    .card-body.p-0 .table-cards { padding: .75rem; }
}

/* ---------- Login / 2FA ---------- */
body.auth {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: radial-gradient(circle at 80% 10%, #2f4a7a 0, transparent 45%), linear-gradient(160deg, #151a26 0%, #2b303a 100%);
    padding: 1.5rem 1rem;
}
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: .9rem; padding: 2rem 1.75rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.auth-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.auth-brand-name { font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.auth-brand-name b { color: var(--nx-accent); }
.auth-brand-sub { color: var(--nx-muted); font-size: .85rem; }
.auth-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 1rem; }
.auth-footer { color: rgba(255, 255, 255, .5); font-size: max(var(--nx-min-text), .8rem); margin-top: 1rem; }
.otp-input { text-align: center; letter-spacing: .5em; font-size: 1.6rem; font-family: Consolas, monospace; }
.qr-img { border: 1px solid var(--nx-border); border-radius: .5rem; padding: .4rem; background: #fff; image-rendering: pixelated; }
.manual-key { font-family: Consolas, monospace; font-size: 1.05rem; background: #f1f3f5; padding: .5rem .75rem; border-radius: .4rem; text-align: center; user-select: all; }
.setup-steps { padding-right: 1.2rem; margin-bottom: .5rem; }
.setup-steps li { margin-bottom: .35rem; }

/* Wide tables scroll horizontally inside their panel on desktop (mobile uses the card layout above). */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (min-width: 768px) { .table-scroll td { white-space: nowrap; } }
.content { min-width: 0; }

/* Read-only customer card (values from SAP) */
.readonly-card .form-control { background: #eef0f3; min-height: 38px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readonly-card .form-control.notes { white-space: pre-wrap; height: 100%; min-height: 86px; }
.readonly-card .form-control a { text-decoration: none; }

.widget-message { color: var(--nx-muted); text-align: center; padding: 2rem 1rem; background: #fff; border: 1px dashed var(--nx-border); border-radius: .5rem; }
.sap-result { font-size: .85rem; }
.sap-result th, .sap-result td { text-align: left; }
.form-grid-notes .notes { flex: 1; }

/* ---------- Buttons: always a gap between icon and text ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn > .bi { line-height: 1; }
.dropdown-item { display: flex; align-items: center; gap: .55rem; }

/* ---------- Customers grid ---------- */
.grid-scroll { max-height: calc(100vh - 330px); min-height: 320px; overflow: auto; border: 1px solid var(--nx-border); border-radius: .35rem; }
.customers-grid { font-size: .88rem; }
/* The whole header (titles + filters) is one sticky block, so the filter row never floats away from the titles. */
.customers-grid { border-collapse: separate; border-spacing: 0; }
.customers-grid thead { position: sticky; top: 0; z-index: 3; }
.customers-grid thead th { background: #f7f8fa; white-space: nowrap; vertical-align: middle; border-bottom: 0; }
.customers-grid thead tr.grid-titles th { padding-top: .55rem; padding-bottom: .35rem; }
.customers-grid thead tr.grid-filters th { padding-top: 0; padding-bottom: .5rem; font-weight: 400; box-shadow: inset 0 -2px 0 var(--nx-border); }
.customers-grid .grid-filters .form-control, .customers-grid .grid-filters .form-select {
    min-width: 90px; font-size: max(var(--nx-min-text), .8rem); background-color: #fff; border-color: #dfe3e8; border-radius: .3rem;
}
.customers-grid .grid-filters .form-control::placeholder { color: var(--nx-placeholder); }
.customers-grid .grid-filters .form-control:not(:placeholder-shown), .customers-grid .grid-filters .form-select.has-value {
    border-color: var(--bs-primary); background-color: #f2f7fe;
}
.customers-grid td { white-space: nowrap; }
.customers-grid td.cell-clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.customers-grid td { border-bottom: 1px solid var(--nx-border); }
.customers-grid .sticky-col { position: sticky; right: 0; background: #fff; z-index: 1; box-shadow: -1px 0 0 var(--nx-border); }
.customers-grid thead .sticky-col { z-index: 4; background: #f7f8fa; }
/* the filter cell of the frozen column needs both lines: the filter row's bottom line and the column's side line */
.customers-grid thead tr.grid-filters th.sticky-col { box-shadow: inset 0 -2px 0 var(--nx-border), -1px 0 0 var(--nx-border); }
.customers-grid tbody tr:hover .sticky-col { background: #f2f4f7; }
.customers-grid tbody tr { cursor: pointer; }
.sort-btn { border: 0; background: none; padding: 0; font-weight: 600; color: inherit; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.sort-btn .bi { font-size: max(var(--nx-min-text), .75rem); color: var(--nx-disabled); }
.sort-btn.active, .sort-btn.active .bi { color: var(--bs-primary); }
form.loading .customers-grid tbody { opacity: .45; transition: opacity .15s; }
td.num, .num { font-variant-numeric: tabular-nums; }

/* ---------- Customer 360 ---------- */
.c360-header {
    display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 1px; background: var(--nx-border);
    border: 1px solid var(--nx-border); border-radius: .5rem; overflow: hidden;
}
.c360-header > div { background: #fff; padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.c360-header a { text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c360-identity { flex-direction: row !important; align-items: center; gap: .9rem !important; }
.c360-avatar { width: 54px; height: 54px; flex: 0 0 54px; border-radius: .8rem; background: linear-gradient(135deg, color-mix(in srgb, var(--bs-primary) 60%, #fff), var(--bs-primary)); color: #fff; display: grid; place-items: center; font-size: 1.6rem; }
.c360-name { font-size: 1.35rem; font-weight: 700; margin: 0 0 .35rem; }
.c360-meta { display: flex; flex-wrap: wrap; gap: .3rem; }
.c360-label { font-size: max(var(--nx-min-text), .8rem); color: var(--nx-muted); display: flex; align-items: center; gap: .35rem; margin-bottom: .15rem; }
.c360-balance-value { font-size: 1.6rem; font-weight: 700; text-align: right; color: var(--nx-success); }
.c360-balance.owes .c360-balance-value { color: var(--nx-danger); }
@media (max-width: 1199.98px) { .c360-header { grid-template-columns: 1fr 1fr; } }
@media (max-width: 575.98px) { .c360-header { grid-template-columns: 1fr; } }

.chart-box-sm { height: 240px; }
.share-bar { display: inline-block; width: 60px; height: 6px; background: #eef1f5; border-radius: 3px; vertical-align: middle; margin-left: .4rem; overflow: hidden; }
.share-bar span { display: block; height: 100%; background: var(--bs-primary); border-radius: 3px; }

.activity-stats { display: flex; flex-direction: column; gap: 1rem; }
.activity-stat { display: flex; align-items: center; gap: .85rem; }
.activity-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.activity-label { color: var(--nx-muted); font-size: .9rem; }
.kpi-icon.kpi-purple-bg { background: #f1eafd; color: #7048e8; }
.kpi-icon.kpi-orange-bg { background: #fff3e0; color: #f08c00; }
.kpi-icon { width: 46px; height: 46px; flex: 0 0 46px; border-radius: .6rem; display: grid; place-items: center; font-size: 1.35rem; }

.satisfaction-score { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.satisfaction-score span { font-size: 1rem; color: var(--nx-muted); font-weight: 400; }
.satisfaction-stars { color: #f5a524; font-size: 1.2rem; margin: .35rem 0; letter-spacing: .15rem; }

/* Contact popup */
.contact-modal .modal-header { gap: .75rem; border-bottom: 0; padding-bottom: .25rem; }
.contact-modal-avatar { width: 44px; height: 44px; border-radius: 50%; background: #eaf2fd; color: var(--bs-primary); display: grid; place-items: center; font-size: 1.3rem; }
.contact-modal .modal-footer { border-top: 0; }
.contact-modal .active-switch { background: #f7f8fa; border-radius: .4rem; padding: .6rem .6rem .6rem 0; padding-right: 2.9rem; }
#contactsTable tbody tr[data-contact-row]:not([data-contact-row=""]) { cursor: pointer; }

/* Mobile: grid shows the main columns only (all columns are still filterable on desktop) */
@media (max-width: 767.98px) {
    .grid-scroll { max-height: none; border: 0; overflow: visible; }
    .table-cards td.mobile-hide { display: none; }
    .customers-grid .sticky-col { position: static; box-shadow: none; }
}

/* ---------- Modals: the X always sits on the far left (RTL) ---------- */
.modal-header { gap: .75rem; }
.modal-header .btn-close { margin: 0 auto 0 0 !important; margin-right: auto !important; margin-left: 0 !important; }
.crm-modal .modal-header { border-bottom: 0; padding-bottom: .25rem; }
.crm-modal .modal-footer { border-top: 0; }
.crm-modal-avatar, .doc-modal-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; background: #eaf2fd; color: var(--bs-primary); display: grid; place-items: center; font-size: 1.3rem; }
.contact-modal-avatar { flex: 0 0 44px; }

/* the customer's name as a link to the customer card – the same on every screen (CustomerLinks) */
.customer-link { color: var(--bs-primary); font-weight: 600; text-decoration: none; }
.customer-link:hover, .customer-link:focus-visible { text-decoration: underline; }

/* ---------- Customer page header ---------- */
.customer-card { background: #fff; border: 1px solid var(--nx-border); border-radius: .6rem; overflow: hidden; box-shadow: 0 1px 3px rgba(16, 24, 40, .05); }
.customer-card .c360-header { border: 0; border-radius: 0; border-bottom: 1px solid var(--nx-border); }
.customer-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .1rem 1rem; margin: 0; padding: .85rem 1.15rem; background: #fafbfc; }
.customer-facts > div { padding: .3rem 0; min-width: 0; }
.customer-facts > div.wide { grid-column: span 2; }
.customer-facts > div.full { grid-column: 1 / -1; }
.customer-facts dd.notes-text { white-space: pre-wrap; overflow: visible; text-overflow: clip; font-weight: 400; line-height: 1.55; overflow-wrap: anywhere; }
.customer-facts dt { font-weight: 400; font-size: max(var(--nx-min-text), .76rem); color: var(--nx-muted); margin-bottom: .1rem; }
.customer-facts dd { margin: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-facts a { text-decoration: none; }
.doc-facts { border: 1px solid var(--nx-border); border-radius: .5rem; }
@media (max-width: 575.98px) { .customer-facts > div.wide { grid-column: auto; } }

/* ---------- Pickers (customer / item) ---------- */
.customer-picker, .item-picker { position: relative; }
/* a locked customer hides "clear" – the card button is then the last one and gets the field's rounded corner (as everywhere) */
.customer-picker .input-group.has-validation > .btn.btn:has(+ .btn.d-none),
.customer-picker .input-group > .btn.btn:has(+ .btn.d-none) { border-start-end-radius: var(--bs-border-radius); border-end-end-radius: var(--bs-border-radius); }
.picker-results { position: absolute; inset: calc(100% + 2px) 0 auto 0; z-index: 1060; max-height: 280px; overflow-y: auto; display: none; }
.picker-results.show { display: block; }
[data-picker-inline] .picker-results { position: static; display: block; max-height: 360px; }
[data-customer-field].locked .form-control { background: #f1f3f5; }

.activity-type-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.activity-type { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.activity-type .bi { color: var(--bs-primary); }
.filter-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ---------- Documents ---------- */
.doc-totals { margin-top: 1rem; margin-right: auto; max-width: 340px; display: flex; flex-direction: column; gap: .35rem; }
.doc-totals > div { display: flex; justify-content: space-between; gap: 1rem; }
.doc-totals > div.grand { border-top: 2px solid var(--nx-border); padding-top: .4rem; font-size: 1.1rem; }
.doc-lines td { white-space: nowrap; }

/* ---------- Quotation editor ---------- */
.quote-head { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.quote-customer { display: flex; align-items: center; gap: .9rem; }
.quote-fields { display: flex; gap: 1rem; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.quote-fields > div { min-width: 150px; }
.quote-fields .quote-comments { flex: 1; min-width: 220px; max-width: 420px; }
.quote-lines-wrap { overflow: visible; }
.quote-lines td { vertical-align: middle; }
@media (max-width: 991.98px) { .quote-lines-wrap { overflow-x: auto; } }

/* ---------- Column chooser ---------- */
.column-chooser { width: 280px; padding: 0; }
.column-chooser-head, .column-chooser-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .85rem; }
.column-chooser-head { border-bottom: 1px solid var(--nx-border); }
.column-chooser-foot { border-top: 1px solid var(--nx-border); }
.column-chooser-list { max-height: 340px; overflow-y: auto; padding: .4rem .85rem; columns: 2; column-gap: .75rem; }
.column-chooser-list .form-check { display: flex; gap: .4rem; align-items: center; padding: .15rem 0; margin: 0; break-inside: avoid; cursor: pointer; font-size: .88rem; }
.column-chooser-list .form-check-input { margin: 0; float: none; }

tr[data-doc-url], tr[data-activity-id] { cursor: pointer; }

.contact-flags { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; background: #f7f8fa; border-radius: .4rem; padding: .6rem .9rem; }
.contact-flags .form-check { margin: 0; }

/* ---------- Logo (white NEXUS mark – always on a dark background) ---------- */
.brand-logo { object-fit: contain; }
.logo-badge { display: grid; place-items: center; width: 58px; height: 58px; flex: 0 0 58px; border-radius: .8rem; background: var(--nx-topbar-bg); }
.logo-badge img { object-fit: contain; }
.alert-text { white-space: pre-line; }

/* ---------- Client-side grids ---------- */
.data-grid .col-hidden { display: none !important; }
.data-grid thead th { white-space: nowrap; }
.data-grid td.cell-clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Quotation editor: 3 columns (right: customer · center: terms + totals · left: document) ---------- */
.q-head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem 2rem; }
.q-col { display: flex; flex-direction: column; gap: .55rem; min-width: 0; }
.q-col + .q-col { border-right: 1px solid var(--nx-border); padding-right: 2rem; }
.q-col-title { font-weight: 600; color: var(--bs-primary); display: flex; align-items: center; gap: .4rem; padding-bottom: .35rem; margin-bottom: .2rem; border-bottom: 2px solid #eaf2fd; }
.q-field { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: .65rem; }
.q-field > label { margin: 0; color: var(--nx-label); font-size: .9rem; }
.q-field-top { align-items: start; }
.q-field-top > label { padding-top: .4rem; }
.q-ro { background: #f3f5f8; border-color: #e6e9ee; min-height: 38px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-totals { margin-top: .35rem; background: #f8fafc; border: 1px solid var(--nx-border); border-radius: .5rem; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .45rem; }
.q-totals > div { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.q-totals > div.q-field-inline { display: grid; grid-template-columns: 112px 110px 1fr; }
.q-totals > div.q-field-inline b { text-align: left; }
.q-totals .q-discount { width: 110px; }
.q-totals > div.grand { border-top: 2px solid var(--nx-border); padding-top: .5rem; font-size: 1.15rem; }
.q-totals > div.grand b { color: var(--bs-primary); }
.quote-lines .item-picker .picker-results { min-width: 520px; }
/* rental row under a line: days / months × devices + dates */
.quote-lines tr.has-rent > td { border-bottom: 0; }
.quote-lines tr.q-rent-row > td { padding-top: 0; }
.q-rent { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem .75rem; background: #f8fafc; border: 1px dashed var(--nx-border); border-radius: .4rem; padding: .45rem .7rem; }
.q-rent-title { align-self: center; font-size: .85rem; font-weight: 600; color: var(--bs-primary); white-space: nowrap; }
.q-rent-field { display: flex; flex-direction: column; gap: .15rem; margin: 0; font-size: max(var(--nx-min-text), .78rem); color: var(--nx-muted); }
.q-rent-field input[type=number] { width: 95px; }
.q-rent-field input[type=date] { width: 140px; }
.item-option { display: grid !important; grid-template-columns: minmax(0, 1fr) auto auto; gap: .9rem; align-items: center; }
.item-option-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-option-stock { font-size: max(var(--nx-min-text), .82rem); white-space: nowrap; }
.item-option-price { white-space: nowrap; min-width: 90px; text-align: left; }
@media (max-width: 1199.98px) {
    .q-head { grid-template-columns: 1fr 1fr; }
    .q-col:nth-child(3) { border-right: 0; padding-right: 0; }
}
@media (max-width: 767.98px) {
    .q-head { grid-template-columns: 1fr; }
    .q-col + .q-col { border-right: 0; padding-right: 0; border-top: 1px solid var(--nx-border); padding-top: 1rem; }
    .quote-lines .item-picker .picker-results { min-width: 0; }
}

/* ---------- Document grids (orders / deliveries / invoices / quotations) ---------- */
.doc-grid-scroll { max-height: calc(100vh - 300px); }
.doc-grid { font-size: .88rem; border-collapse: separate; border-spacing: 0; }
.doc-grid thead { position: sticky; top: 0; z-index: 3; }
.doc-grid thead th { background: #f7f8fa; border-bottom: 0; vertical-align: middle; }
.doc-grid thead tr.grid-titles th { padding-top: .55rem; padding-bottom: .35rem; }
.doc-grid thead tr.grid-filters th { padding-top: 0; padding-bottom: .5rem; font-weight: 400; box-shadow: inset 0 -2px 0 var(--nx-border); }
.doc-grid .grid-filters .form-control, .doc-grid .grid-filters .form-select { min-width: 80px; font-size: max(var(--nx-min-text), .8rem); background-color: #fff; border-color: #dfe3e8; }
.doc-grid .grid-filters .form-control:not(:placeholder-shown), .doc-grid .grid-filters .form-select.has-value { border-color: var(--bs-primary); background-color: #f2f7fe; }
.doc-grid td { border-bottom: 1px solid var(--nx-border); white-space: nowrap; }
.file-frame { width: 100%; height: 78vh; border: 0; display: block; background: #525659; }
@media (max-width: 767.98px) { .doc-grid-scroll { max-height: none; overflow: visible; border: 0; } .file-frame { height: calc(100vh - 70px); } }

.cal-action { width: auto; min-width: 150px; }

/* activities toolbar: one row – actions + status | count + filters */
.act-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap;
               padding: .65rem .75rem; background: var(--bs-tertiary-bg); border: 1px solid var(--nx-border); border-radius: .6rem; }
.act-toolbar-main, .act-toolbar-filters, .act-status-form { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.act-toolbar-filters { margin-inline-start: auto; }
.act-status .btn { white-space: nowrap; }
.act-search { width: 220px; }
.act-search-wide { width: 380px; }
.act-search .input-group-text { background: var(--bs-body-bg); color: var(--bs-secondary-color); }
.act-search .form-control { border-inline-start: 0; }
.act-count { font-size: max(var(--nx-min-text), .8rem); color: var(--bs-secondary-color); white-space: nowrap; }
@media (max-width: 767.98px) {
    /* phone: actions + status (a dropdown) on top, filters underneath */
    .act-toolbar { padding: .55rem; }
    .act-toolbar-main { width: 100%; }
    .act-toolbar-main > .btn, .act-toolbar-main > a.btn { flex: 1 1 auto; }
    .act-status-form { width: 100%; flex-wrap: nowrap; }
    .act-status-select { flex: 1 1 auto; }
    .act-toolbar-main > .status-filter { flex: 1 1 auto; min-width: 0; }
    .act-toolbar-filters { margin-inline-start: 0; width: 100%; }
    .act-toolbar-filters > .status-filter { flex: 1 1 100%; min-width: 0; }
    .act-search { flex: 1 1 0; width: auto; min-width: 0; }
    .act-count { display: none; }
}

/* ---------- Role dashboards (main screen) ---------- */
.view-as { min-width: 260px; }
.dash-presets .btn { white-space: nowrap; }
.dash-presets .btn.active { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.dash-period-panel { width: 340px; padding: 0; }
.dash-panel-section { padding: .75rem .9rem .6rem; }
.dash-panel-section + .dash-panel-section { border-top: 1px solid var(--nx-border); }
.dash-panel-title { font-size: max(var(--nx-min-text), .8rem); font-weight: 600; color: var(--bs-secondary-color); margin-bottom: .45rem; }
.dash-panel-title span { font-weight: 400; }
.dash-panel-grid { display: grid; gap: .35rem; }
.dash-grid-4 { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.dash-grid-3 { grid-template-columns: repeat(3, 1fr); }
.dash-opt { border: 1px solid var(--nx-border); background: var(--bs-body-bg); border-radius: .4rem; padding: .35rem .3rem; font-size: .85rem; color: var(--bs-body-color); }
.dash-opt:hover { border-color: var(--bs-primary); color: var(--bs-primary); }
.dash-opt.active { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.dash-panel-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .9rem; border-top: 1px solid var(--nx-border); background: var(--bs-tertiary-bg); }
.dash-period-summary { display: inline-flex; align-items: center; gap: .35rem; background: var(--bs-body-bg); border: 1px solid var(--nx-border);
                       border-radius: 999px; padding: .3rem .8rem; font-size: .88rem; white-space: nowrap; }
.dash-active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: -.25rem 0 .75rem; }
.dash-active-filters:empty { display: none; }
.dash-filter-chip { border: 1px solid var(--bs-primary-border-subtle); background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis);
                    border-radius: 999px; padding: .2rem .7rem; font-size: .85rem; }
.dash-title { font-weight: 600; font-size: 1.05rem; margin-bottom: .75rem; color: var(--bs-primary); }
.dash-section-title { font-weight: 600; font-size: 1rem; margin: .5rem 0 .75rem; padding-top: .75rem; border-top: 2px solid var(--nx-border); color: #c92a2a; }
.dash-body.loading { opacity: .55; pointer-events: none; transition: opacity .15s; }
.dash-kpi { width: 100%; text-align: start; position: relative; }
.dash-kpi:disabled { opacity: 1; color: inherit; }
.dash-kpi.is-action { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.dash-kpi.is-action:hover { box-shadow: 0 .4rem 1rem rgba(15, 23, 42, .1); transform: translateY(-1px); }
/* phone: the KPI cards in a two-column grid that fills its holes (dense) – a wide card (a long amount) takes the whole line
   and the short cards after it move up beside each other, so no empty square is left; cards of one line are of one height */
@media (max-width: 767.98px) {
    .row.dash-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: .75rem; margin: 0 0 1rem; }
    .row.dash-kpis > * { width: auto; max-width: none; margin: 0; padding: 0; }
    .row.dash-kpis > .col-12 { grid-column: 1 / -1; }
    .row.dash-kpis .dash-kpi { height: 100%; }
}
.kpi-sub { font-size: max(var(--nx-min-text), .75rem); color: var(--bs-secondary-color); }
/* target against actual (dashboard.js, Card.Tone): the figure green when the target was met, red below it – with an icon */
.kpi-tone-good .kpi-value { color: var(--nx-success); }
.kpi-tone-bad .kpi-value { color: var(--nx-danger); }
.kpi-tone-icon { font-size: .8em; margin-inline-start: .35rem; vertical-align: .05em; }

/* Audit log → who entered in the last week (a mark per user and day) */
.login-week th, .login-week td { white-space: nowrap; }
.login-week thead th { font-weight: 600; }
.login-week .login-date { font-size: max(var(--nx-min-text), .75rem); font-weight: 400; color: var(--nx-muted); }
.login-week th.is-today { background: color-mix(in srgb, var(--bs-primary) 10%, #fff); }
.login-week th.is-today .login-date { color: var(--bs-primary); font-weight: 600; }
.login-week .is-weekend { background: #fafbfc; }
.login-week .login-yes { color: var(--nx-success); font-size: 1.2rem; }
.login-week .login-no { color: var(--nx-disabled); font-size: 1.2rem; }
.login-week tr.login-none > td:first-child { box-shadow: inset -3px 0 0 var(--nx-danger); }
.login-week .login-days { font-weight: 600; }
.login-week .login-days.is-none { color: var(--nx-danger); }
.kpi-open { position: absolute; top: .5rem; left: .6rem; font-size: max(var(--nx-min-text), .8rem); color: var(--bs-secondary-color); }
/* one header height for every chart / table card: the title is clamped to two lines, the badges never wrap under it */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; height: 4rem; padding-block: .5rem; }
.dash-head-title { flex: 1; min-width: 0; font-weight: 600; font-size: .95rem; line-height: 1.35;
                   display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dash-badges { display: inline-flex; flex-direction: column; align-items: flex-end; gap: .25rem; flex: none; }
.dash-badges .badge, .dash-period-badge { white-space: nowrap; }
.dash-empty { height: 260px; display: flex; align-items: center; justify-content: center; gap: .5rem; color: var(--bs-secondary-color);
              border: 1px dashed var(--nx-border); border-radius: .5rem; background: var(--bs-tertiary-bg); }
.dash-period-badge { font-size: max(var(--nx-min-text), .72rem); background: #fff8e1; border: 1px solid #f0d58c; color: #8a6d1a; border-radius: 999px; padding: .1rem .5rem; }
.dash-chart-box { height: 260px; }
.dash-hint { font-size: max(var(--nx-min-text), .72rem); color: var(--bs-secondary-color); margin-top: .35rem; min-height: 1.1rem; }
.dash-table.is-filter tbody tr { cursor: pointer; }
.dash-table tbody tr.is-selected td { background: var(--bs-primary-bg-subtle); font-weight: 600; }
.dash-table th { white-space: nowrap; background: var(--bs-tertiary-bg); }
@media (max-width: 767.98px) {
    /* phone: the four quick periods on one row, the custom choice under them */
    .dash-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; width: 100%; }
    .dash-presets > .btn, .dash-presets > .btn-group > .btn { border-radius: .4rem !important; margin: 0 !important; padding-inline: .3rem; font-size: .85rem; }
    .dash-presets > .btn-group { grid-column: 1 / -1; display: flex; }
    .dash-presets > .btn-group > .btn { flex: 1; }
    .dash-period-summary { white-space: normal; }
    .dash-period-panel { width: min(340px, 92vw); }
    .view-as { min-width: 0; width: 100%; }
}

/* ---------- Targets ---------- */
.targets-warning .warning-chip { cursor: pointer; font-weight: 500; }
.targets-warning .warning-chip:hover { background: #fff8e1 !important; border-color: #f0b429 !important; }
.targets-table th, .targets-table td { white-space: nowrap; padding: .45rem .75rem; }
.targets-table tfoot th { background: var(--bs-tertiary-bg); }
.targets-grid { min-width: 1250px; }
.targets-grid-office { min-width: 820px; }
.targets-grid th { font-size: max(var(--nx-min-text), .82rem); white-space: nowrap; background: var(--bs-tertiary-bg); }
.targets-grid .tg-user { min-width: 170px; position: sticky; right: 0; background: var(--bs-body-bg); z-index: 1; }
.targets-grid thead .tg-user, .targets-grid tfoot th:first-child { background: var(--bs-tertiary-bg); }
.targets-grid .tg-cell { padding: .3rem .2rem; min-width: 80px; }
.targets-grid .tg-cell input { padding-inline: .35rem; }
.targets-grid .tg-cell.has-issue input { border-color: var(--nx-warning); background: color-mix(in srgb, var(--nx-warning) 12%, #fff); }
/* not by colour alone: a "!" on the cell whose split is wrong */
.targets-grid .tg-cell.has-issue { position: relative; }
.targets-grid .tg-cell.has-issue::after { content: "!"; position: absolute; top: .15rem; right: .45rem; z-index: 2; pointer-events: none;
                                         font-weight: 700; font-size: max(var(--nx-min-text), .8rem); color: #b7791f; }
.targets-grid .tg-actions { white-space: nowrap; width: 90px; }
.targets-grid tfoot th { font-size: max(var(--nx-min-text), .82rem); }
.add-users-list { display: flex; flex-direction: column; border: 1px solid var(--nx-border); border-radius: .5rem; max-height: 50vh; overflow-y: auto; }
.add-user { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; margin: 0; cursor: pointer; }
.add-user + .add-user { border-top: 1px solid var(--nx-border); }
.add-user:hover { background: var(--bs-tertiary-bg); }
.split-months { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem; margin-bottom: 1rem; }
.split-month { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .4rem; border: 1px solid var(--nx-border); border-radius: .5rem;
               background: var(--bs-body-bg); font-size: max(var(--nx-min-text), .8rem); position: relative; }
.split-month b { font-size: .85rem; }
.split-month.active { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); box-shadow: 0 0 0 2px var(--bs-primary-border-subtle); }
.split-month.has-issue::after, .split-month.is-ok::after { position: absolute; top: 4px; left: 4px; width: 1.1rem; height: 1.1rem; border-radius: 50%;
                                                       display: grid; place-items: center; font-size: max(var(--nx-min-text), .7rem); font-weight: 700; line-height: 1; }
.split-month.has-issue::after { content: "!"; background: var(--nx-warning); color: #000; }
.split-month.is-ok::after { content: "✓"; background: var(--nx-success); color: #fff; }
.split-target { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.split-panel { border: 1px solid var(--nx-border); border-radius: .75rem; padding: .85rem; height: 100%; display: flex; flex-direction: column; }
.split-panel.is-ok { border-color: #a3d9b1; }
.split-panel.is-issue { border-color: #f0b429; background: #fffbea; }
.split-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.split-state { font-size: .85rem; font-weight: 600; }
.is-ok .split-state { color: var(--nx-success); }
.is-issue .split-state { color: #b7791f; }
.split-progress { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.split-progress .progress { flex: 1; height: .45rem; }
.is-issue .progress-bar { background: #f0b429; }
.is-ok .progress-bar { background: var(--nx-success); }
.split-list { flex: 1; max-height: 340px; overflow-y: auto; border: 1px solid var(--nx-border); border-radius: .5rem; background: var(--bs-body-bg); }
.split-row { display: flex; align-items: center; gap: .5rem; padding: .3rem .6rem; margin: 0; }
.split-row + .split-row { border-top: 1px solid var(--nx-border); }
.split-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.split-row input { width: 120px; flex: none; }
.split-row.has-value span { font-weight: 600; }
@media (max-width: 575.98px) { .split-months { grid-template-columns: repeat(4, minmax(0, 1fr)); } .split-row input { width: 100px; } }

/* ---------- Teams (Management) ---------- */
.scope-note ul { padding-inline-start: 1.2rem; }
.scope-note li + li { margin-top: .25rem; }
.team-chip { margin: .1rem 0 .1rem .25rem; display: inline-flex; align-items: center; padding: .15rem .55rem; border-radius: 999px; font-size: max(var(--nx-min-text), .8rem);
             background: var(--bs-secondary-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); }
.team-chip.is-peer { background: var(--bs-primary-bg-subtle); border-color: var(--bs-primary-border-subtle); color: var(--bs-primary-text-emphasis); }

/* dual list: [available] [buttons] [managers / members] – available spans both rows */
.dual-list { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-rows: auto auto; gap: .75rem 1rem; }
.dual-available { grid-column: 1; grid-row: 1 / span 2; display: flex; flex-direction: column; }
.dual-actions-peer { grid-column: 2; grid-row: 1; }
.dual-peer { grid-column: 3; grid-row: 1; }
.dual-actions-member { grid-column: 2; grid-row: 2; }
.dual-member { grid-column: 3; grid-row: 2; }
.dual-box { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.dual-title { font-weight: 600; }
.dual-hint { font-weight: 400; color: var(--bs-secondary-color); font-size: .85rem; }
.dual-count { font-size: max(var(--nx-min-text), .78rem); color: var(--bs-secondary-color); }
.dual-select { background-image: none; padding: .25rem; min-height: 9.5rem; }
.dual-available .dual-select { flex: 1; min-height: 21rem; }
.dual-select option { padding: .3rem .5rem; border-radius: .25rem; }
.dual-peer .dual-select { border-color: var(--bs-primary-border-subtle); }
.dual-actions { display: flex; flex-direction: column; justify-content: center; gap: .35rem; }
.dual-actions .btn { width: 2.75rem; }
@media (max-width: 767.98px) {
    .dual-list { grid-template-columns: 1fr; grid-template-rows: none; }
    .dual-available, .dual-actions-peer, .dual-peer, .dual-actions-member, .dual-member { grid-column: 1; grid-row: auto; }
    .dual-available .dual-select { min-height: 12rem; }
    .dual-actions { flex-direction: row; justify-content: center; }
    .dual-actions .bi-chevron-left::before, .dual-actions .bi-chevron-double-left::before { display: inline-block; transform: rotate(-90deg); }
    .dual-actions .bi-chevron-right::before, .dual-actions .bi-chevron-double-right::before { display: inline-block; transform: rotate(-90deg); }
}

/* ---------- Sales opportunity ---------- */
.op-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; background: #f8fafc; border: 1px solid var(--nx-border);
           border-radius: .5rem; padding: .6rem .75rem; }
.op-kpis > div { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.op-kpis span { font-size: max(var(--nx-min-text), .75rem); color: var(--bs-secondary-color); }
.op-kpis b { font-size: 1.05rem; color: var(--bs-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* stages timeline: dots on a line, a card under each; the last stage is the current one */
.op-timeline { display: flex; gap: 0; overflow-x: auto; padding: .75rem .5rem 1rem; scroll-snap-type: x proximity; }
.op-stage { --stage-color: var(--bs-primary); position: relative; flex: 0 0 230px; display: flex; flex-direction: column; align-items: center;
            gap: .6rem; padding: 0 .5rem; border: 0; background: none; text-align: start; scroll-snap-align: start; color: inherit; }
.op-stage::before { content: ""; position: absolute; top: 19px; right: 0; left: 0; height: 3px; background: var(--nx-border); z-index: 0; }
.op-stage:first-child::before { right: 50%; }
.op-stage-add::before { left: 50%; }
.op-stage-dot { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
                font-weight: 700; color: #fff; background: var(--stage-color); box-shadow: 0 0 0 4px var(--bs-body-bg), 0 2px 6px rgba(15, 23, 42, .2); }
.op-stage.is-current .op-stage-dot { box-shadow: 0 0 0 4px var(--bs-body-bg), 0 0 0 7px color-mix(in srgb, var(--stage-color) 30%, transparent); }
.op-stage.is-locked .op-stage-card { background: var(--bs-tertiary-bg); }
.op-stage-lock { font-size: max(var(--nx-min-text), .75rem); color: var(--bs-secondary-color); }
.op-stage-card { width: 100%; display: flex; flex-direction: column; gap: .3rem; padding: .7rem .8rem; border-radius: .75rem;
                 background: var(--bs-body-bg); border: 1px solid var(--nx-border); border-top: 4px solid var(--stage-color);
                 box-shadow: 0 1px 2px rgba(15, 23, 42, .05); transition: box-shadow .15s, transform .15s; font-size: .85rem; }
.op-stage:hover .op-stage-card { box-shadow: 0 .4rem 1rem rgba(15, 23, 42, .1); transform: translateY(-2px); }
.op-stage.is-current .op-stage-card { background: color-mix(in srgb, var(--stage-color) 6%, var(--bs-body-bg)); }
.op-stage.is-closed .op-stage-dot::after { content: "✓"; position: absolute; bottom: -4px; left: -4px; width: 18px; height: 18px; border-radius: 50%;
                                            background: #16a34a; color: #fff; font-size: max(var(--nx-min-text), .7rem); display: grid; place-items: center; }
.op-stage-head { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.op-stage-now { font-size: max(var(--nx-min-text), .7rem); font-weight: 600; color: var(--stage-color); text-transform: uppercase; }
.op-stage-figures { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin: .15rem 0; }
.op-stage-figures > span { display: flex; flex-direction: column; background: var(--bs-tertiary-bg); border-radius: .4rem; padding: .3rem .45rem; }
.op-stage-figures small { font-size: max(var(--nx-min-text), .7rem); color: var(--bs-secondary-color); }
.op-stage-figures b { font-size: 1rem; }
.op-stage-line { display: flex; align-items: center; gap: .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-stage-notes { color: var(--bs-secondary-color); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.op-stage-user { font-size: max(var(--nx-min-text), .72rem); color: var(--bs-secondary-color); align-self: flex-end; }
.op-stage-add { flex-basis: 150px; }
.op-stage-add .op-stage-dot { background: var(--bs-secondary-bg); color: var(--bs-primary); border: 2px dashed var(--bs-primary); box-shadow: 0 0 0 4px var(--bs-body-bg); }
.op-stage-card-add { align-items: center; justify-content: center; min-height: 80px; color: var(--bs-primary); font-weight: 600;
                     border-style: dashed; border-top: 1px dashed var(--bs-primary); border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
@media (max-width: 575.98px) {
    /* phone: a vertical timeline */
    .op-timeline { flex-direction: column; overflow: visible; padding-bottom: .25rem; }
    .op-stage { flex: none; flex-direction: row; align-items: flex-start; padding: 0 0 .9rem; }
    .op-stage::before { top: 0; bottom: 0; right: 19px; left: auto; width: 3px; height: auto; }
    .op-stage:first-child::before { right: 19px; top: 20px; }
    .op-stage-add::before { bottom: auto; height: 20px; }
}

.list-editor { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; max-height: 420px; overflow-y: auto; }
.list-editor li { display: flex; align-items: center; gap: .4rem; }
.list-editor li.dragging { opacity: .5; }
.list-editor li.inactive input[name=items] { color: var(--bs-secondary-color); text-decoration: line-through; background: #f6f7f9; }
.list-grip { cursor: grab; color: var(--bs-secondary-color); }

/* ---------- Attached files ---------- */
#attachmentsModal.stacked, #whatsAppModal.stacked, #emailModal.stacked { z-index: 1085; }
.modal-backdrop.stacked-backdrop { z-index: 1080; }
.drop-zone { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: 1.25rem 1rem; margin: 0;
             border: 2px dashed var(--bs-border-color); border-radius: .75rem; background: var(--bs-tertiary-bg);
             color: var(--bs-secondary-color); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop-zone:hover, .drop-zone.is-over { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.drop-zone.is-busy { pointer-events: none; opacity: .8; }
.drop-zone > .bi { font-size: 1.9rem; color: var(--bs-primary); }
.drop-zone-title { font-weight: 600; color: var(--bs-body-color); }
.drop-zone-hint { font-size: max(var(--nx-min-text), .8rem); }
.drop-zone-progress { font-size: .85rem; color: var(--bs-primary-text-emphasis); }
.attachment-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--bs-border-color); border-radius: .75rem; overflow: hidden; }
.attachment-item { display: flex; align-items: center; gap: .75rem; padding: .6rem .85rem; background: var(--bs-body-bg); }
.attachment-item + .attachment-item { border-top: 1px solid var(--bs-border-color); }
.attachment-item:hover { background: var(--bs-tertiary-bg); }
.attachment-icon { font-size: 1.6rem; flex: none; }
.attachment-main { flex: 1; min-width: 0; }
.attachment-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.attachment-name:hover { text-decoration: underline; }
.attachment-meta { font-size: max(var(--nx-min-text), .78rem); color: var(--bs-secondary-color); }
.attachment-actions { display: flex; gap: .3rem; flex: none; }

/* ---------- Activity popup ---------- */
/* the document popup opened from inside another popup (e.g. the activity's linked document) sits on top of it */
#documentModal.stacked { z-index: 1070; }
#documentModal.stacked ~ .modal-backdrop:last-of-type, .modal-backdrop + .modal-backdrop { z-index: 1065; }
.act-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.75rem; }
.act-section { display: flex; flex-direction: column; min-width: 0; }
.act-section-wide { grid-column: 1 / -1; }
.act-section .form-label { margin-bottom: .2rem; font-size: .88rem; color: var(--nx-label); }
@media (max-width: 767.98px) { .act-grid { grid-template-columns: 1fr; } }

/* ---------- Activities calendar ---------- */
.cal-card { overflow: hidden; }
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--nx-border); background: var(--nx-panel-head); }
.cal-title { font-size: 1.2rem; font-weight: 600; margin: 0 .5rem 0 0; }
.cal-user { width: 230px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; padding: .5rem 1rem; font-size: max(var(--nx-min-text), .8rem); border-bottom: 1px solid var(--nx-border); }
.cal-legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.cal-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--cal-c); }
.cal-dot-done { background: #ced4da; }
.cal-body { max-height: calc(100vh - 290px); min-height: 420px; overflow: auto; position: relative; }
.cal-body.loading { opacity: .5; transition: opacity .15s; }

/* activity colours by SAP action */
.act-C { --cal-c: #1673e6; --cal-bg: #e7f0fd; }
.act-M { --cal-c: #7048e8; --cal-bg: #f1eafd; }
.act-T { --cal-c: #f08c00; --cal-bg: #fff3e0; }
.act-N { --cal-c: #5c677d; --cal-bg: #eef1f5; }
.act-P { --cal-c: #0ca678; --cal-bg: #e3f8f6; }
.act-E { --cal-c: #c2255c; --cal-bg: #fdeef3; }

/* day / week grid */
.cal-grid { display: grid; grid-template-columns: 58px repeat(var(--cal-days), minmax(110px, 1fr)); min-width: min-content; }
.cal-corner, .cal-dayhead { position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 2px solid var(--nx-border); }
.cal-dayhead { text-align: center; padding: .45rem .25rem; border-right: 1px solid var(--nx-border); display: flex; flex-direction: column; line-height: 1.15; }
.cal-dayhead span { font-size: max(var(--nx-min-text), .78rem); color: var(--nx-muted); }
.cal-dayhead b { font-size: 1.25rem; font-weight: 600; }
.cal-dayhead.is-today b { color: #fff; background: var(--bs-primary); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; margin: 2px auto 0; }
.cal-hours { grid-column: 1; }
.cal-hour { height: var(--cal-hour); position: relative; font-size: max(var(--nx-min-text), .72rem); color: var(--nx-faint); }
.cal-hour span { position: absolute; top: -.55rem; right: .45rem; background: #fff; padding: 0 .15rem; }
.cal-hour:first-child span { display: none; }
.cal-day { position: relative; border-right: 1px solid var(--nx-border); }
.cal-day.is-today { background: #fbfdff; }
.cal-slot { height: var(--cal-hour); border-bottom: 1px solid #eef0f3; cursor: pointer; }
.cal-slot:hover { background: #f2f7fe; }
.cal-event {
    position: absolute; border: 0; text-align: right; overflow: hidden; z-index: 1;
    background: var(--cal-bg); color: #1f2329; border-right: 3px solid var(--cal-c); border-radius: .35rem;
    padding: .15rem .35rem; font-size: max(var(--nx-min-text), .76rem); line-height: 1.25; box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
    display: flex; flex-direction: column; gap: 1px;
}
.cal-event:hover { z-index: 2; box-shadow: 0 3px 10px rgba(16, 24, 40, .18); }
.cal-event .bi { color: var(--cal-c); }
.cal-event-time { font-weight: 600; color: var(--cal-c); font-variant-numeric: tabular-nums; }
.cal-event-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.cal-event-sub { color: var(--nx-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.is-done { background: #f3f4f6; border-right-color: #ced4da; opacity: .75; }
.cal-event.is-done .cal-event-title { text-decoration: line-through; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--nx-danger); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; right: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--nx-danger); }

/* month */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-month-head { position: sticky; top: 0; z-index: 2; background: #fff; text-align: center; font-size: max(var(--nx-min-text), .82rem); color: var(--nx-muted); padding: .4rem; border-bottom: 2px solid var(--nx-border); }
.cal-month-day { min-height: 110px; border-bottom: 1px solid var(--nx-border); border-right: 1px solid var(--nx-border); padding: .25rem; display: flex; flex-direction: column; gap: 2px; }
.cal-month-day.is-other { background: #fafbfc; }
.cal-month-day.is-other .cal-month-num { color: var(--nx-disabled); }
.cal-month-num { border: 0; background: none; font-weight: 600; font-size: .85rem; align-self: flex-start; padding: 0 .25rem; border-radius: .3rem; }
.cal-month-day.is-today .cal-month-num { background: var(--bs-primary); color: #fff; }
.cal-chip { position: static; flex-direction: row; gap: .3rem; white-space: nowrap; text-overflow: ellipsis; display: block; }
.cal-more { border: 0; background: none; font-size: max(var(--nx-min-text), .75rem); color: var(--bs-primary); text-align: right; padding: 0 .25rem; }
@media (max-width: 767.98px) {
    .cal-user { width: 100%; }
    .cal-month-day { min-height: 72px; }
    .cal-chip .cal-event-time { display: none; }
}
.cal-event.is-short { flex-direction: row; align-items: center; gap: .35rem; padding-top: 0; padding-bottom: 0; }
.cal-event.is-short .cal-event-time { flex: 0 0 auto; }

/* Dashboards: one flowing grid per block – the items of every row grow to fill it (no empty gaps).
   --basis = the preferred width on a wide screen (a third / a half). */
.dash-grid { display: flex; flex-wrap: wrap; gap: 1rem; }
.dash-grid:empty { display: none; }
.dash-col { flex: 1 1 100%; min-width: 0; }
@media (min-width: 992px) { .dash-col { flex-basis: calc(50% - 1rem); } }
@media (min-width: 1200px) { .dash-col { flex-basis: calc(var(--basis, 33.333%) - 1rem); } }

/* ---------- WhatsApp (quotations) ---------- */
.wa-icon { background: #e7f8ee; color: #1a9b50; }
.doc-context-menu { position: fixed; z-index: 1085; min-width: 230px; }
.doc-context-menu .dropdown-header { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-context-menu .dropdown-item i { width: 1.25rem; display: inline-block; }
body.wa-no-approval [data-wa-open="approval"], body.wa-no-approval .wa-approval-only { display: none !important; }

/* Document popup buttons: one size and shape */
.doc-actions { justify-content: flex-start; gap: .5rem; }
.doc-actions > * { margin: 0; }
.doc-actions .btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 38px; white-space: nowrap; }
.doc-actions .btn-group > .btn { gap: .4rem; }
.doc-actions .btn-group > .dropdown-toggle-split { padding-inline: .6rem; }
/* without "send for approval" the split arrow is hidden – the WhatsApp button stands alone, fully rounded */
body.wa-no-approval .btn-group:has(> .wa-approval-only) > .btn:first-child { border-radius: var(--bs-btn-border-radius); }

/* ---------- Activity relationship map (right-click on an activity → מפת קשרים) ---------- */
.act-map { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: #fff; border-radius: inherit; }
.act-map-header { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.15rem; border-bottom: 1px solid var(--nx-border); }
.act-map-header > .bi { font-size: 1.4rem; color: var(--bs-primary); }
.act-map-body { flex: 1; overflow: auto; padding: 1rem 1.15rem 1.5rem; background: #fafbfc; }
/* the tree: each level indented, joined by lines on the start side (right in Hebrew) */
.act-map-tree { list-style: none; margin: 0; padding: 0; }
.act-map-tree .act-map-tree { padding-inline-start: 2rem; }
.act-map-tree li { position: relative; padding-top: .6rem; }
.act-map-tree .act-map-tree > li::before { content: ""; position: absolute; inset-inline-start: -1.25rem; top: 0; bottom: 0; border-inline-start: 2px solid #cfd8e3; }
.act-map-tree .act-map-tree > li:last-child::before { bottom: auto; height: 2.1rem; }
.act-map-tree .act-map-tree > li::after { content: ""; position: absolute; inset-inline-start: -1.25rem; top: 2.1rem; width: 1.25rem; border-top: 2px solid #cfd8e3; }
.act-map-node { max-width: 560px; background: #fff; border: 1px solid var(--nx-border); border-radius: var(--bs-border-radius-lg); padding: .55rem .8rem; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.act-map-node:hover, .act-map-node:focus-visible { border-color: var(--bs-primary); }
.act-map-node.current { border: 2px solid var(--bs-primary); background: #f3f8ff; cursor: default; }
.act-map-node.locked { cursor: default; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); }
.act-map-head { display: flex; align-items: center; gap: .35rem; }
.act-map-head .bi { color: var(--bs-primary); }
.act-map-title { font-weight: 600; margin-top: .15rem; }
.act-map-meta { font-size: max(var(--nx-min-text), .8rem); color: var(--bs-secondary-color); }
.act-map-links { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.act-map-link { display: inline-flex; align-items: center; gap: .3rem; font-size: max(var(--nx-min-text), .8rem); padding: .1rem .55rem; border: 1px solid #cfe0f7; border-radius: 999px; background: #eef5ff; color: var(--bs-primary); text-decoration: none; }
.act-map-link:hover { background: #dceaff; }
.act-map-section { font-weight: 700; color: #344054; margin-bottom: .25rem; display: flex; align-items: center; gap: .4rem; }
.act-map-section .bi { color: var(--bs-primary); }
/* document flow: columns right → left (quotation → order → delivery → invoice), arrows in an SVG layer under the cards */
.act-flow { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2.25rem; align-items: start; padding: .5rem .25rem 1rem; }
.act-flow-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.act-flow-lines path.link { fill: none; stroke: #5b8fd6; stroke-width: 2; }
.act-flow-lines marker path { fill: #5b8fd6; }
.act-flow-col { position: relative; display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.act-flow-doc .act-map-head { flex-wrap: wrap; row-gap: .15rem; }
.act-flow-col-title { font-size: max(var(--nx-min-text), .78rem); font-weight: 600; color: var(--bs-secondary-color); text-align: center; border-bottom: 2px solid #e4e9f0; padding-bottom: .2rem; }
.act-flow-doc { position: relative; background: #fff; border: 1px solid var(--nx-border); border-top: 3px solid #8fb3e3; border-radius: var(--bs-border-radius-lg); padding: .45rem .65rem; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.act-flow-doc:hover, .act-flow-doc:focus-visible { border-color: var(--bs-primary); }
.act-flow-doc.linked { border-top-color: var(--bs-primary); background: #f3f8ff; }
.act-flow-doc.locked { cursor: default; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); }
.act-flow-acts { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; font-size: max(var(--nx-min-text), .75rem); color: var(--bs-primary); }
/* phone: the columns stack, top to bottom in the flow's order (no room for the arrows) */
@media (max-width: 575.98px) {
    .act-flow { grid-auto-flow: row; gap: 1rem; }
    .act-flow-lines { display: none; }
}

/* Company settings → printed quotation: image previews */
.print-image-preview { min-height: 90px; display: flex; align-items: center; justify-content: center; padding: .5rem; border: 1px dashed var(--nx-border); border-radius: var(--bs-border-radius); background: #fafbfc; }
.print-image-preview img { max-width: 100%; max-height: 120px; object-fit: contain; }

/* Management → Audit log */
.audit-dl dt { color: var(--nx-muted); font-weight: 500; padding-bottom: .35rem; }
.audit-dl dd { padding-bottom: .35rem; margin-bottom: 0; }
.audit-changes .audit-added { background: #f1faf4; }
.audit-changes .audit-removed { background: #fdf3f3; }
.audit-changes .audit-before { color: #c92a2a; }
.audit-changes .audit-after { color: #2b8a3e; font-weight: 500; }
.audit-changes .audit-removed .audit-before { text-decoration: line-through; }
.audit-changes td { white-space: pre-wrap; word-break: break-word; }

/* ---------- Display settings / accessibility (per user: Profile → תצוגה ונגישות, DisplaySettings) ----------
   _Layout puts the signed-in user's choice on <html>: data-font="115|130|150", a class per setting that is on
   (a11y-dark-text, a11y-dark-borders, a11y-focus, a11y-bold, a11y-spacious, a11y-sticky-messages) and the user's colours. */
/* text size: every font size here and in Bootstrap is in rem, so the root size scales the whole system */
html[data-font="115"] { font-size: 115%; }
html[data-font="130"] { font-size: 130%; }
html[data-font="150"] { font-size: 150%; }

/* dark text: black instead of gray (also the menus and the charts) */
html.a11y-dark-text {
    --bs-body-color: #000; --bs-body-color-rgb: 0, 0, 0;
    --bs-emphasis-color: #000; --bs-emphasis-color-rgb: 0, 0, 0;
    --bs-secondary-color: #1f2329; --bs-tertiary-color: #343a40;
    --nx-muted: #1f2329; --nx-label: #000; --nx-label-strong: #000; --nx-faint: #343a40;
    --nx-placeholder: #5c6370; --nx-disabled: #5c6370;
    --nx-sidebar-text: #fff; --nx-sidebar-muted: #dfe3ea; --nx-topbar-text: #fff;
    --nx-chart-text: #000;
}
html.a11y-dark-text .text-secondary { color: var(--nx-muted) !important; }
html.a11y-dark-text .dropdown-menu { --bs-dropdown-header-color: #000; }
html.a11y-dark-text .btn-outline-secondary { --bs-btn-color: #343a40; }
html.a11y-dark-text .form-control::placeholder { color: var(--nx-placeholder); }
html.a11y-dark-text .btn-close { opacity: .8; }

/* dark borders: table lines, frames and form fields darker */
html.a11y-dark-borders { --bs-border-color: #8c959f; --nx-border: #9aa3ad; }
html.a11y-dark-borders :is(.form-control, .form-select) { border-color: #8c959f; }
html.a11y-dark-borders .btn-outline-secondary { --bs-btn-border-color: #495057; }

/* the settings card in "My account" (Profile#display – not hidden under the fixed top bar) */
#display { scroll-margin-top: calc(var(--nx-topbar-h) + 1rem); }
.display-colors .form-control-color { width: 4rem; }
.display-option { display: flex; flex-direction: column; align-items: center; gap: .1rem; min-width: 6.5rem; }
.display-sample { font-weight: 600; line-height: 1.2; }

/* larger text: nothing smaller than .85rem (badges, grid filters, calendar hours…) */
html:is([data-font="115"], [data-font="130"], [data-font="150"]) { --nx-min-text: .85rem; }
html:is([data-font="115"], [data-font="130"], [data-font="150"]) .badge { font-size: max(.75em, var(--nx-min-text)); }

/* bold text: everything semi-bold, headings and bold text bold (icons keep their own font) */
html.a11y-bold body, html.a11y-bold body *:not(b, strong, h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .fw-bold, .bi) { font-weight: 600; }
html.a11y-bold :is(b, strong, h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .fw-bold) { font-weight: 700; }
html.a11y-bold .btn { --bs-btn-font-weight: 600; }

/* comfortable spacing: taller rows, larger buttons, fields and check boxes – easier to hit */
html.a11y-spacious body { line-height: 1.65; }
html.a11y-spacious .table > :not(caption) > * > * { padding: .8rem .75rem; }
html.a11y-spacious .table-sm > :not(caption) > * > * { padding: .5rem .5rem; }
html.a11y-spacious .btn { --bs-btn-padding-y: .55rem; --bs-btn-padding-x: 1rem; }
html.a11y-spacious .btn-sm { --bs-btn-padding-y: .4rem; --bs-btn-padding-x: .75rem; }
html.a11y-spacious :is(.form-control, .form-select) { padding-top: .6rem; padding-bottom: .6rem; }
html.a11y-spacious :is(.form-control-sm, .form-select-sm) { padding-top: .4rem; padding-bottom: .4rem; }
html.a11y-spacious .form-check { min-height: 2rem; padding-right: 2em; margin-bottom: .5rem; }
html.a11y-spacious .form-check .form-check-input { width: 1.4em; height: 1.4em; margin-top: .05em; margin-right: -2em; }
html.a11y-spacious .form-switch { padding-right: 3.25em; }
html.a11y-spacious .form-switch .form-check-input { width: 2.6em; margin-right: -3.25em; }
html.a11y-spacious .dropdown-item { padding-top: .6rem; padding-bottom: .6rem; }
html.a11y-spacious :is(.sidebar .nav-link, .nav-group-toggle) { padding-top: .9rem; padding-bottom: .9rem; }
html.a11y-spacious .nav-group-items .nav-link { padding-top: .7rem; padding-bottom: .7rem; }
html.a11y-spacious .list-group-item { padding-top: .9rem; padding-bottom: .9rem; }
html.a11y-spacious .page-link { padding: .6rem .9rem; }

/* focus highlight (a11y-focus): a clear ring around the field / button in use – yellow on the dark bars */
.topbar, .sidebar { --nx-focus: #ffd43b; }
.topbar .dropdown-menu, .nav-group-items { --nx-focus: #0b5ed7; }
html:is(.a11y-dark-text, .a11y-dark-borders) { --nx-focus: #000; }
html:is(.a11y-dark-text, .a11y-dark-borders) :is(.topbar, .sidebar) { --nx-focus: #ffd43b; }
html:is(.a11y-dark-text, .a11y-dark-borders) :is(.topbar .dropdown-menu, .nav-group-items) { --nx-focus: #000; }
html.a11y-focus :focus-visible { outline: 3px solid var(--nx-focus) !important; outline-offset: 2px; }
html.a11y-focus :is(.form-control, .form-select):focus-visible { outline-offset: 0; }

/* =========================================================
   The phone interface lives in mobile.css (loaded by _Layout unless this device chose "תצוגה קלאסית").
   Its parts are hidden here, so the classic view (and every wider screen) never shows them.
   ========================================================= */
.mobile-tabbar { display: none; }
.q-cards, .q-mobilebar, .q-col-sum { display: none; }
.customer-facts-toggle { display: none; }
.act-durations, .act-status-pick, .act-more-toggle, .act-more-actions { display: none !important; }
@media (min-width: 768px) { .act-call { display: none !important; } }
.cal-view-phone, .cal-filter-toggle, .cal-dots { display: none !important; }
.customer-quick, [data-q-add], .act-summary, .act-title-chips { display: none; }
/* "תצוגה קלאסית" on a phone (cookie nx.view=classic): the bar that leads back to the phone interface */
.desktop-view-bar { display: flex; align-items: center; justify-content: center; gap: .75rem; flex-wrap: wrap; margin: -.25rem 0 1rem; padding: .5rem .75rem;
                    background: color-mix(in srgb, var(--bs-primary) 8%, #fff); border: 1px solid color-mix(in srgb, var(--bs-primary) 25%, #fff);
                    border-radius: .6rem; color: var(--bs-primary-text-emphasis); font-size: 1.05rem; }
/* the targets grids are card tables on a phone in both views – no desktop width / frozen column there; totals = the KPIs */
@media (max-width: 767.98px) { .targets-grid.table-cards { min-width: 0; } .targets-grid.table-cards .tg-user { position: static; } .table-cards tfoot { display: none; } }
/* customer card tabs: the number of items, a light grey pill (crm.js; nothing when there are none) */
.tab-count { display: inline-block; margin-inline-start: .4rem; padding: 0 .45rem; border-radius: 999px; background: var(--bs-secondary-bg);
             color: var(--nx-muted); font-size: max(var(--nx-min-text), .75rem); font-weight: 500; line-height: 1.5; vertical-align: .05em; }
.tab-count:empty { display: none; }


/* ===== Zotal: delivery status of an order's lines (spec 2.4, 8.3) – a colour and, for a partial line, the tag ===== */
:root { --zotal-delivered-bg: #e7f6ec; --zotal-partial-bg: #fff4dc; }
.doc-lines tr.line-delivered > td { background: var(--zotal-delivered-bg); }
.doc-lines tr.line-partial > td { background: var(--zotal-partial-bg); }
.badge.delivery-full { background: #1e7b44; color: #fff; }
.badge.delivery-partial { background: #b45f06; color: #fff; }
/* ===== Zotal: the customer card's contact view (Customers/Details) – choice / who / reach / actions ===== */
.contact-focus.border-primary { border-width: 2px; }
.contact-focus > .card-body { display: flex; flex-direction: column; gap: .75rem; padding: .65rem 1rem; }
.contact-focus-pick { display: flex; align-items: center; gap: .75rem; }
.contact-focus-pick .form-select { width: auto; max-width: 22rem; }
.contact-focus-body { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; border-top: 1px solid var(--nx-border); padding-top: .75rem; }
.contact-focus-who { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.contact-focus-who .contact-modal-avatar { flex: 0 0 44px; }
.contact-focus-note { font-size: max(var(--nx-min-text), .75rem); color: var(--bs-primary); display: flex; align-items: center; gap: .3rem; }
.contact-focus-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; min-width: 0; }
.contact-focus-links a { display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; min-width: 0; max-width: 100%; }
.contact-focus-links a > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-focus-body > *, .contact-focus-who > div { min-width: 0; max-width: 100%; }
.contact-focus-who .small { overflow-wrap: anywhere; }
.contact-focus-actions { display: flex; gap: .5rem; margin-inline-start: auto; }
.min-w-0 { min-width: 0; }
@media (max-width: 767.98px) {
    .contact-focus-pick { flex-wrap: wrap; gap: .4rem .5rem; }
    .contact-focus-pick label, .contact-focus-pick > .fw-semibold { flex: 1 0 100%; }
    .contact-focus-pick .form-select { flex: 1 1 0; min-width: 0; max-width: none; font-size: 1rem; padding-top: .45rem; padding-bottom: .45rem; }
    .contact-focus-body { flex-direction: column; align-items: stretch; gap: .65rem; }
    .contact-focus-links { flex-direction: column; gap: .15rem; }
    .contact-focus-links a { padding: .3rem 0; }
    .contact-focus-actions { margin-inline-start: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
    .contact-focus-actions .btn { padding-top: .5rem; padding-bottom: .5rem; }
}

/* quotation editor: the secondary contact – a quiet "add" link, then a small card of its own under the customer */
.q-contact2 { margin-top: .35rem; }
.q-contact2-add {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .6rem .75rem;
    border: 1px dashed color-mix(in srgb, var(--bs-primary) 45%, #fff); border-radius: .5rem; background: #f7faff;
    color: var(--bs-primary); font-weight: 500; font-size: .9rem; transition: background .15s, border-color .15s;
}
.q-contact2-add:hover { background: #eaf2fd; border-color: var(--bs-primary); }
.q-contact2-card { border: 1px solid #dfe7f3; border-radius: .6rem; background: #fbfcfe; padding: .75rem .85rem .85rem; }
.q-contact2-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .65rem; }
.q-contact2-icon { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; display: grid; place-items: center; background: #eaf2fd; color: var(--bs-primary); }
.q-contact2-title { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.q-contact2-title b { font-weight: 600; font-size: .92rem; }
.q-contact2-title small { color: var(--nx-muted); font-size: max(var(--nx-min-text), .75rem); }
.q-contact2-clear { color: var(--nx-muted); padding: .2rem .45rem; border-radius: 50%; }
.q-contact2-clear:hover { color: var(--bs-danger); background: #fdecee; }
.q-contact2-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem .65rem; }
.q-mini { display: flex; flex-direction: column; gap: .2rem; margin: 0; min-width: 0; }
.q-mini > span { font-size: max(var(--nx-min-text), .78rem); color: var(--nx-label); }
.q-mini > .form-control { background: #fff; }
@media (max-width: 479.98px) { .q-contact2-grid { grid-template-columns: minmax(0, 1fr); } }

/* document popup: the document's contacts – the main one and the secondary one, side by side */
.doc-contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; margin-top: 1rem; }
.doc-contact { display: flex; align-items: flex-start; gap: .75rem; padding: .8rem .95rem; border: 1px solid var(--nx-border); border-radius: .65rem; background: #fff; min-width: 0; }
.doc-contact + .doc-contact .doc-contact-avatar { background: #f1ecf9; color: #6b42a8; }
.doc-contact-avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.15rem; background: #eaf2fd; color: var(--bs-primary); }
.doc-contact-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.doc-contact-role { font-size: max(var(--nx-min-text), .75rem); color: var(--nx-muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.doc-contact-note { padding: 0 .4rem; border-radius: 999px; background: #eef1f6; color: #5b6472; }
.doc-contact-name { font-weight: 600; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-contact-links { display: flex; flex-wrap: wrap; gap: .15rem 1rem; margin-top: .2rem; font-size: .9rem; min-width: 0; }
.doc-contact-links a { display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; min-width: 0; max-width: 100%; }
.doc-contact-links a > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.doc-contacts-none { margin-top: .75rem; display: flex; align-items: center; gap: .4rem; }
@media (max-width: 575.98px) { .doc-contacts { grid-template-columns: minmax(0, 1fr); } .doc-contact-links { flex-direction: column; } }

/* item search: an Abcam catalog product (made in SAP when added) – its own colour instead of a tag */
:root { --zotal-abcam: #7a3fb3; }
.item-option-name .item-code, .q-result-main small .item-code { color: var(--nx-muted); }
.item-abcam, .item-abcam b, .item-abcam .fw-semibold { color: var(--zotal-abcam); }
.item-abcam .item-code, .q-result-main.item-abcam small { color: color-mix(in srgb, var(--zotal-abcam) 70%, #fff); }

/* the contacts tab: View + Edit side by side */
.contact-row-actions { display: inline-flex; gap: .4rem; }

/* the contacts screen: the search is the screen – one full, rounded row; two quiet filter pills under it */
.contacts-search { display: flex; flex-direction: column; gap: .65rem; margin-bottom: 1.1rem; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field input {
    width: 100%; height: 48px; padding: 0 2.9rem 0 2.6rem; border: 1px solid var(--nx-border); border-radius: 999px;
    background: #fff; font-size: 1rem; color: var(--bs-body-color); outline: none;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04); transition: border-color .15s, box-shadow .15s;
}
.search-field input::placeholder { color: #9aa3af; }
.search-field input:focus { border-color: color-mix(in srgb, var(--bs-primary) 55%, #fff); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bs-primary) 13%, transparent); }
.search-field-icon { position: absolute; inset-inline-start: 1.1rem; color: #8a94a3; font-size: 1.05rem; pointer-events: none; }
.search-field-busy { position: absolute; inset-inline-end: 1.1rem; color: var(--bs-primary); opacity: 0; transition: opacity .15s; }
.is-busy .search-field-busy { opacity: 1; }
.is-busy .search-field-icon { color: var(--bs-primary); }
.contacts-filters { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.filter-pill {
    display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: 0 .35rem 0 .85rem; height: 36px;
    border-radius: 999px; background: #f1f4f8; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s;
}
.filter-pill:hover { background: #e9eef5; }
.filter-pill:focus-within { border-color: color-mix(in srgb, var(--bs-primary) 45%, #fff); background: #fff; }
.filter-pill > span { font-size: .8rem; color: var(--nx-muted); white-space: nowrap; }
.filter-pill select {
    appearance: none; border: 0; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 16 16'%3E%3Cpath fill='%236c757d' d='M1.6 4.6a.75.75 0 0 1 1.06 0L8 9.94l5.34-5.34a.75.75 0 1 1 1.06 1.06L8.53 11.53a.75.75 0 0 1-1.06 0L1.6 5.66a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E") no-repeat left .6rem center;
    padding: 0 .55rem 0 1.6rem; height: 34px; font-size: .9rem; font-weight: 600; color: var(--bs-body-color); cursor: pointer; outline: none;
}
.filter-pill.is-off { opacity: .5; cursor: default; }
.filter-pill.is-off select { cursor: default; }
.contacts-count { margin-inline-start: auto; font-size: .82rem; color: var(--nx-muted); white-space: nowrap; }
@media (max-width: 575.98px) {
    .filter-pill { flex: 1 1 0; min-width: 0; justify-content: space-between; }
    .filter-pill select { min-width: 0; text-overflow: ellipsis; }
    .contacts-count { flex-basis: 100%; margin: 0; text-align: center; }
}

/* a list that waits for a search (the contacts screen) */
.list-empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; padding: 3rem 1rem; color: var(--nx-muted); }
.list-empty-state b { color: var(--bs-body-color); font-size: 1.05rem; }
.list-empty-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; margin-bottom: .4rem;
    background: #eaf2fd; color: var(--bs-primary); }

.doc-contact-row:not([data-href]) { cursor: default; }   /* the contacts screen's rows open the card; the customer tab's do not */
/* a secondary contact – typography, not chips: the word "משני" in the accent after a hairline, a thin accent line on the
   row's edge, and where they come from as one quiet line (Crm/_SecondaryOrigin) */
:root { --c2-accent: #6a4fd8; }
.c2-badge {
    display: inline-flex; align-items: center; gap: .4rem; vertical-align: baseline; white-space: nowrap;
    font-size: max(var(--nx-min-text), .72rem); font-weight: 600; letter-spacing: .01em; color: var(--c2-accent);
}
.c2-badge::before { content: ""; width: 1px; height: .9em; background: currentColor; opacity: .35; }
.table > tbody > tr.doc-contact-row > td { background: transparent; }
.table > tbody > tr.doc-contact-row > td:first-child { border-inline-start: 2px solid var(--c2-accent); }
.c2-origin {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem 0; margin-top: .15rem;
    font-size: max(var(--nx-min-text), .78rem); font-weight: 400; color: var(--nx-muted, #6c757d);
}
.c2-origin > span { white-space: nowrap; }
.c2-origin > span + span:not(.c2-main)::before { content: "·"; margin: 0 .45rem; opacity: .6; }
/* the main contact: a line of its own, so a wrapped line never starts with a separator */
.c2-origin > .c2-main { flex-basis: 100%; }
.c2-origin b { font-weight: 500; color: var(--bs-body-color, #212529); }
.c2-doc {
    color: var(--bs-body-color, #212529); font-weight: 500; text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 25%, transparent); text-underline-offset: .2em;
}
.c2-doc:hover { color: var(--bs-primary); text-decoration-color: currentColor; }
.c2-date { font-variant-numeric: tabular-nums; }

/* the customer card's contact picker: one search field (the chosen contact is its text, "כל הלקוח" clears it, in the same
   row), and a list under it – SAP contacts + secondary contacts */
.contact-picker { position: relative; width: 30rem; max-width: 100%; }
.contact-picker-field {
    display: flex; align-items: center; gap: .5rem; min-height: 2.5rem; padding: .25rem .35rem .25rem .75rem;
    background: var(--bs-body-bg, #fff); border: 1px solid var(--nx-border, #dee2e6); border-radius: .6rem;
    transition: border-color .15s, box-shadow .15s;
}
.contact-picker-field:focus-within, .contact-picker.is-open .contact-picker-field {
    border-color: color-mix(in srgb, var(--bs-primary) 55%, #fff); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--bs-primary) 15%, transparent);
}
.contact-picker-icon { color: var(--nx-muted, #6c757d); flex: 0 0 auto; }
.contact-picker-field.is-set .contact-picker-icon { color: var(--bs-primary); }
.contact-picker-field input {
    flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; padding: .2rem 0; font-size: .95rem; color: inherit;
}
.contact-picker-field input::-webkit-search-cancel-button { display: none; }
.contact-picker-field input::placeholder { color: var(--nx-muted, #6c757d); opacity: 1; }
/* the chosen contact reads as the field's value until something is typed */
.contact-picker-field.is-set input::placeholder { color: var(--bs-body-color, #212529); font-weight: 600; }
.contact-picker-field .c2-badge { flex: 0 0 auto; }
.contact-picker-clear {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .6rem; border-radius: .45rem;
    font-size: .8rem; font-weight: 500; white-space: nowrap; text-decoration: none; color: #5b6472; background: #eef1f6;
}
.contact-picker-clear:hover { color: var(--bs-primary); background: #e3edfb; }
.contact-picker-menu {
    position: absolute; inset-inline: 0; top: calc(100% + .3rem); z-index: 1050;
    background: var(--bs-body-bg, #fff); border: 1px solid var(--nx-border, #dee2e6); border-radius: .6rem;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .12); padding: .35rem;
}
.contact-picker-list { max-height: min(24rem, 55vh); overflow-y: auto; overscroll-behavior: contain; }
.contact-picker-group {
    display: flex; align-items: center; gap: .4rem; padding: .55rem .5rem .2rem;
    font-size: max(var(--nx-min-text), .72rem); font-weight: 600; color: var(--nx-muted, #6c757d);
}
.contact-picker-item { display: block; padding: .45rem .5rem; border-radius: .4rem; color: inherit; text-decoration: none; }
.contact-picker-item small { display: block; color: var(--nx-muted, #6c757d); overflow-wrap: anywhere; }
.contact-picker-item:hover, .contact-picker-item:focus { background: #f2f7fe; outline: none; }
.contact-picker-item.active { background: #eaf2fd; font-weight: 600; }
.contact-picker-hint, .contact-picker-empty { padding: .6rem .5rem; color: var(--nx-muted, #6c757d); font-size: max(var(--nx-min-text), .8rem); }
.contact-picker-empty { text-align: center; }
@media (max-width: 767.98px) {
    .contact-picker { width: 100%; }
    .contact-picker-field { min-height: 2.9rem; }
    .contact-picker-field input { font-size: 1rem; } /* 16px: iOS does not zoom into the field */
    .contact-picker-item { padding: .65rem .5rem; }
}
}

/* =====================================================================================================================
   Motion – the system answers the moment the user acts (site.js: nav-progress, NX.reveal, NX.skeleton)
   ===================================================================================================================== */
/* a thin bar at the top while the next page is on its way; it grows quickly, then slows, and never "finishes" by itself */
.nav-progress {
    position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 3000; pointer-events: none;
    transform-origin: right center; transform: scaleX(0); opacity: 0;
    background: linear-gradient(270deg, color-mix(in srgb, var(--bs-primary) 45%, #fff), var(--bs-primary));
    box-shadow: 0 0 10px color-mix(in srgb, var(--bs-primary) 45%, transparent);
}
.nav-progress.active { opacity: 1; animation: nx-progress 9s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes nx-progress { 0% { transform: scaleX(0); } 6% { transform: scaleX(.3); } 30% { transform: scaleX(.65); } 100% { transform: scaleX(.94); } }
/* a slow page: what is on screen dims a little (after a moment, so a quick page does not flicker) */
.is-navigating main.content { opacity: .55; transition: opacity .25s ease .3s; }

/* the page arrives: a short fade-up of the content (the sidebar and the bottom bar stay put) */
main.content { animation: nx-page-in .28s cubic-bezier(.2, .7, .3, 1) backwards; } /* backwards: nothing is left on main afterwards (a transform would trap its fixed popups) */
@keyframes nx-page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* content that comes later (a tab, a popup, search results) */
.nx-reveal { animation: nx-fade-in .22s ease-out backwards; }
@keyframes nx-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* skeleton rows while a tab / popup loads */
.nx-skeleton { display: flex; flex-direction: column; gap: .65rem; padding: .75rem .25rem; }
.nx-sk-row { display: flex; align-items: center; gap: 1rem; padding: .7rem .9rem; border: 1px solid var(--nx-border); border-radius: .6rem; background: #fff;
    animation: nx-fade-in .3s ease-out backwards; animation-delay: calc(var(--i, 0) * 60ms); }
.nx-sk { display: block; height: 11px; border-radius: 6px;
    background: linear-gradient(90deg, #eef1f5 0%, #f7f9fb 40%, #eef1f5 80%); background-size: 300% 100%; animation: nx-shimmer 1.3s linear infinite; }
.nx-sk-a { width: 28%; height: 13px; }
.nx-sk-b { width: 38%; }
.nx-sk-c { width: 14%; margin-inline-start: auto; }
@keyframes nx-shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }

/* a press is felt at once */
.btn, .list-group-item-action, .quick-action, .q-card, .q-result, .filter-pill, .q-contact2-add { transition: transform .08s ease, background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:active:not(:disabled), .quick-action:active, .q-card:active, .q-result:active, .q-contact2-add:active, .filter-pill:active { transform: scale(.97); }
.list-group-item-action:active { transform: scale(.99); }
.clickable-rows tbody tr, tr[data-href], tr[data-doc-url] { transition: background-color .12s; }
.clickable-rows tbody tr:active > td, tr[data-href]:active > td, tr[data-doc-url]:active > td { background-color: #eef4fd; }

/* the customer picker: the search icon turns into a spinner while the answer is on its way */
.customer-picker .input-group-text { position: relative; }
.customer-picker.is-searching .input-group-text .bi { visibility: hidden; }
.customer-picker.is-searching .input-group-text::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid currentColor; border-inline-end-color: transparent; color: var(--bs-primary); animation: nx-spin .7s linear infinite;
}
@keyframes nx-spin { to { transform: rotate(360deg); } }

/* whoever asked the system for less motion gets none of it */
@media (prefers-reduced-motion: reduce) {
    main.content, .nx-reveal, .nx-sk-row, .nx-sk, .nav-progress.active { animation: none !important; }
    .nav-progress.active { transform: scaleX(.6); }
    .btn:active, .quick-action:active, .q-card:active, .q-result:active, .list-group-item-action:active, .filter-pill:active { transform: none !important; }
}

/* a list that always fits the screen's width (contacts): the text wraps instead of the table growing sideways;
   long e-mails break anywhere; the buttons stay on one line */
.table-fit { width: 100%; }
@media (min-width: 768px) {
    .table-scroll .table-fit td { white-space: normal; overflow-wrap: anywhere; }
    .table-scroll .table-fit td.text-nowrap { white-space: nowrap; overflow-wrap: normal; }
    .table-fit th { white-space: nowrap; }
}

/* the document popup's print menu: the SAP layouts, SAP's default marked */
.print-layouts { min-width: 300px; max-height: 60vh; overflow-y: auto; }
.print-layouts .dropdown-item { white-space: normal; }
.print-layouts .badge { font-weight: 500; font-size: .7rem; }

/* the document popup's actions: what only the phone shows (mobile.css turns them into tiles) */
.doc-tile-face, .lbl-short { display: none; }

/* print: a long press opens the layouts – no text selection / iOS link menu on the button */
[data-print-default] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
[data-print-default].is-pressing { transform: scale(.95); transition: transform .45s ease; }
