/* ===========================
   ClikSell Dashboard System
   Graphify-inspired desktop/tablet skin
   Canonical: ds-*
   Compatibility: dash-*
   =========================== */

:root {
    --ds-bg: #e9ebf4;
    --ds-bg-soft: #f4f5fa;
    --ds-shell: #eef0f8;
    --ds-surface: #ffffff;
    --ds-surface-2: #f7f8fc;
    --ds-dark: #111019;
    --ds-dark-2: #1b1924;
    --ds-dark-3: #2a2733;
    --ds-text: #17151f;
    --ds-muted: #858996;
    --ds-muted-strong: #626674;
    --ds-border: rgba(23,21,31,.08);
    --ds-border-strong: rgba(23,21,31,.16);
    --ds-shadow-sm: 0 12px 30px rgba(31,34,46,.08);
    --ds-shadow-md: 0 22px 55px rgba(31,34,46,.12);
    --ds-shadow-dark: 0 24px 48px rgba(17,16,25,.24);
    --ds-radius: 18px;
    --ds-radius-sm: 14px;
    --ds-radius-xs: 12px;
    --ds-pad: 16px;
    --ds-pad-lg: 18px;
    --ds-gap: 14px;
    --ds-h1: 30px;
    --ds-h2: 18px;
    --ds-kpi: 26px;
    --ds-primary: #111019;
    --ds-success: #22c55e;
    --ds-warning: #f59e0b;
    --ds-danger: #ef4444;
    --ds-info: #38bdf8;
    --ds-violet: #8b5cf6;
    --ds-teal: #14b8a6;
}

/* --------------------------------
   Page + container
--------------------------------- */
.ds-page,
.dash {
    min-height: 100vh;
    width: 100%;
    color: var(--ds-text);
    background:
        radial-gradient(circle at 12% 5%, rgba(255,255,255,.95) 0, rgba(255,255,255,0) 22rem),
        linear-gradient(135deg, #dde1ec 0%, #f6f7fb 52%, #dfe3ef 100%);
    font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ds-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px 28px 36px;
}

/* --------------------------------
   Header
--------------------------------- */
.ds-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 18px;
}

.ds-title,
.dash-title {
    margin: 0;
    color: var(--ds-text);
    font-size: var(--ds-h1);
    font-weight: 950;
    line-height: 1.05;
    letter-spacing: 0;
}

.ds-subtitle {
    margin: 8px 0 0;
    color: var(--ds-muted-strong);
    font-size: 14px;
    font-weight: 600;
}

.ds-meta {
    margin-top: 8px;
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 700;
}

.ds-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ds-actions .rz-button,
.ds-header .rz-button {
    border-radius: 999px !important;
    min-height: 38px;
    box-shadow: none !important;
    border: 1px solid var(--ds-border) !important;
    font-weight: 850 !important;
}

.ds-actions .rz-button.rz-primary,
.ds-header .rz-button.rz-primary,
.rz-button.rz-primary {
    background: var(--ds-dark) !important;
    border-color: var(--ds-dark) !important;
    color: #fff !important;
}

/* --------------------------------
   Cards + panels
--------------------------------- */
.ds-card,
.dash-card {
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(255,255,255,.82);
    border-radius: var(--ds-radius);
    box-shadow: var(--ds-shadow-sm);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.ds-card:hover,
.dash-card:hover {
    border-color: rgba(17,16,25,.12);
    box-shadow: var(--ds-shadow-md);
    transform: translateY(-2px);
}

.ds-card-pad,
.dash-card {
    padding: var(--ds-pad-lg);
}

.ds-card-header,
.dash-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.ds-card-title,
.dash-card__title {
    margin: 0;
    color: var(--ds-text);
    font-size: var(--ds-h2);
    font-weight: 950;
    line-height: 1.15;
    letter-spacing: 0;
}

.ds-card .rz-chart,
.ds-card .rz-chart-container,
.ds-card .rz-chart-wrapper {
    border-radius: var(--ds-radius-sm);
}

/* --------------------------------
   Section titles
--------------------------------- */
.ds-section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 22px 0 14px;
}

.ds-section-title h2 {
    margin: 0;
    color: var(--ds-text);
    font-size: 20px;
    font-weight: 950;
    line-height: 1.15;
    letter-spacing: 0;
}

.ds-section-title .hint {
    margin: 0;
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 700;
}

/* --------------------------------
   KPI grid + KPI cards
--------------------------------- */
.ds-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    gap: var(--ds-gap);
    margin-bottom: 18px;
}

/* Shown while a project plan is open: the KPIs below are scoped to it. */
.ds-kpi-scope {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--ds-surface, #fff);
    border: 1px solid var(--ds-border-strong, rgba(23,21,31,.16));
    font-size: 12px;
    font-weight: 700;
    color: var(--ds-text, #17151f);
}

.ds-kpi-scope__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ds-success, #22c55e);
}

.kpi-row {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    gap: var(--ds-gap);
    width: 100%;
}

.kpi-row .ds-kpi-card {
    min-width: 0;
}

.ds-kpi-card,
.dash-kpi {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(42px, 1fr) auto;
    align-items: center;
    min-height: 108px;
    padding: 16px 18px;
    border-radius: var(--ds-radius-sm);
    background: #fff;
    border: 1px solid rgba(255,255,255,.86);
    box-shadow: var(--ds-shadow-sm);
    cursor: pointer;
    overflow: hidden;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.ds-kpi-grid > .ds-kpi-card {
    grid-column: auto;
}

.ds-kpi-card::before {
    content: none;
}

.ds-kpi-card::after {
    content: none;
}

.ds-kpi-card:hover,
.dash-kpi:hover {
    transform: translateY(-3px);
    box-shadow: var(--ds-shadow-md);
}

.ds-kpi-card.ds-kpi-active {
    border-color: rgba(17,16,25,.42);
    box-shadow: inset 0 0 0 2px rgba(17,16,25,.12), var(--ds-shadow-sm);
}

/* A card hosting a .kpi-info popover must not clip it — the base .ds-kpi-card/.dash-kpi rule
   sets overflow:hidden, which would cut the popover off instead of letting it float above. */
.ds-kpi-card.has-kpi-info,
.dash-kpi.has-kpi-info {
    overflow: visible;
}

/* ── KPI hover info: formula + explanation + exact number ── */
.kpi-info {
    position: relative;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    color: var(--ds-muted);
    cursor: help;
    vertical-align: middle;
}

.kpi-info-icon {
    font-size: 12px;
}

.kpi-info-popover {
    position: absolute;
    z-index: 40;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: 240px;
    max-width: 62vw;
    padding: 10px 12px;
    border-radius: 10px;
    background: #14131c;
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
    box-shadow: 0 14px 36px rgba(17,16,25,.32);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    white-space: normal;
    transition: opacity 140ms ease, transform 140ms ease;
}

.kpi-info-popover::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #14131c;
}

.kpi-info:hover .kpi-info-popover,
.kpi-info:focus .kpi-info-popover,
.kpi-info:focus-within .kpi-info-popover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.kpi-info-exact {
    font-weight: 800;
    margin-bottom: 4px;
    color: #fff;
}

.kpi-info-formula {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    color: #cbd5e1;
    margin-bottom: 4px;
}

.kpi-info-explain {
    color: #cbd5e1;
}

.ds-kpi-card .label,
.dash-kpi__label {
    position: relative;
    margin: 0 0 8px 0;
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    text-align: center;
}

.ds-kpi-card .value,
.dash-kpi__value {
    position: relative;
    align-self: center;
    justify-self: center;
    width: 100%;
    margin: 0;
    color: var(--ds-text);
    font-size: var(--ds-kpi);
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
}

.ds-kpi-card .sub,
.dash-kpi__sub {
    position: relative;
    margin: 8px 0 0;
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

/* --------------------------------
   KPI donut (target progress)
   Replaces the "actual / target" number pair on cards that have a target.
   Colour comes from --ds-donut-color, set per card from the KPI accent palette.
--------------------------------- */
.ds-kpi-donut {
    position: relative;
    align-self: center;
    justify-self: center;
    width: 78px;
    height: 78px;
}

.ds-kpi-donut__svg {
    width: 100%;
    height: 100%;
    display: block;
    /* start the arc at 12 o'clock instead of 3 o'clock */
    transform: rotate(-90deg);
}

.ds-kpi-donut__track,
.ds-kpi-donut__fill {
    fill: none;
    stroke-width: 4.2;
}

.ds-kpi-donut__track {
    stroke: rgba(17,16,25,.09);
}

.ds-kpi-donut__fill {
    stroke: var(--ds-donut-color, #3b82f6);
    stroke-linecap: round;
    transition: stroke-dasharray .45s ease;
}

.ds-kpi-donut__center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-kpi-donut__pct {
    font-size: 19px;
    font-weight: 950;
    line-height: 1;
    letter-spacing: -.02em;
    color: var(--ds-text);
}

.ds-kpi-donut__caption {
    font-variant-numeric: tabular-nums;
}

.ds-kpi-donut__note {
    margin-top: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    color: var(--ds-muted);
    opacity: .8;
}

/* Marks a card whose number is a balance as of today, not activity in the range. */
.ds-kpi-asof {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(17,16,25,.07);
    color: var(--ds-muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

/* The donut is squarer than a number, so give those cards a little more room. */
.ds-kpi-card:has(.ds-kpi-donut) {
    min-height: 150px;
}

.ds-kpi-primary {
    color: var(--ds-text);
}

.ds-kpi-success {
    color: var(--ds-text);
}

.ds-kpi-success::before {
    background: transparent;
}

.ds-kpi-warning {
    color: var(--ds-text);
}

.ds-kpi-warning::before {
    background: transparent;
}

.ds-kpi-danger {
    color: var(--ds-text);
}

.ds-kpi-danger::before {
    background: transparent;
}

.ds-kpi-info {
    color: var(--ds-text);
}

.ds-kpi-info::before {
    background: transparent;
}

/* --------------------------------
   Filters / forms
--------------------------------- */
.ds-filters {
    margin-bottom: 20px;
    border-radius: var(--ds-radius);
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(255,255,255,.82);
    box-shadow: var(--ds-shadow-sm);
    overflow: hidden;
}

.ds-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    background: transparent;
    border-bottom: 1px solid var(--ds-border);
    cursor: pointer;
    user-select: none;
}

.ds-filters-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 950;
}

.ds-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    padding: 22px;
}

.ds-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ds-field label {
    color: var(--ds-muted-strong);
    font-size: 12px;
    font-weight: 850;
}

.ds-input,
.ds-select,
.ds-select-sm,
.ds-search input {
    width: 100%;
    min-height: 42px;
    padding: 10px 14px;
    color: var(--ds-text);
    border: 1px solid rgba(17,16,25,.10);
    border-radius: 999px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
    font-size: 13px;
    font-weight: 700;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.ds-input:focus,
.ds-select:focus,
.ds-select-sm:focus,
.ds-search input:focus {
    outline: none;
    border-color: var(--ds-dark);
    box-shadow: 0 0 0 4px rgba(17,16,25,.08);
}

.ds-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.ds-checkboxes label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ds-muted-strong);
    font-weight: 750;
}

.ds-checkboxes input {
    width: 16px;
    height: 16px;
    accent-color: var(--ds-dark);
}

.ds-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ds-range span {
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 700;
}

.ds-filter-actions {
    display: flex;
    align-items: flex-end;
}

.ds-filter-trigger-count {
    display: inline-grid;
    min-width: 20px;
    height: 20px;
    margin-left: 8px;
    padding: 0 6px;
    place-items: center;
    border-radius: 999px;
    background: var(--ds-dark);
    color: #fff;
    font-size: 11px;
    font-weight: 950;
    line-height: 1;
}

.ds-actions .ds-filter-button {
    margin-left: auto;
}

.ds-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(17,16,25,.42);
    backdrop-filter: blur(10px);
}

.ds-filter-modal {
    width: min(980px, 100%);
    max-height: min(760px, calc(100vh - 56px));
    overflow: auto;
    border-radius: var(--ds-radius);
    background: #fff;
    border: 1px solid rgba(255,255,255,.82);
    box-shadow: 0 32px 90px rgba(17,16,25,.28);
}

.ds-filter-modal__header,
.ds-filter-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
}

.ds-filter-modal__header {
    border-bottom: 1px solid var(--ds-border);
}

.ds-filter-modal__footer {
    border-top: 1px solid var(--ds-border);
}

.ds-filter-modal__title {
    margin: 0;
    color: var(--ds-text);
    font-size: 18px;
    font-weight: 950;
}

.ds-filter-modal__body {
    padding: 20px;
}

.ds-filter-modal .ds-filter-grid {
    padding: 0 !important;
}

/* --------------------------------
   Buttons
--------------------------------- */
.ds-btn {
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(17,16,25,.10);
    background: #fff;
    color: var(--ds-text);
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.ds-btn:hover {
    border-color: rgba(17,16,25,.18);
    box-shadow: var(--ds-shadow-sm);
    transform: translateY(-1px);
}

.ds-btn-primary {
    background: var(--ds-dark);
    border-color: var(--ds-dark);
    color: #fff;
    box-shadow: 0 14px 28px rgba(17,16,25,.18);
}

/* --------------------------------
   Search row
--------------------------------- */
.ds-search-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.ds-search {
    position: relative;
    flex: 1;
    max-width: 540px;
}

.ds-search input {
    padding-left: 42px;
}

.ds-search .icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    opacity: .62;
    pointer-events: none;
}

.ds-results {
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

/* --------------------------------
   Tables
--------------------------------- */
.ds-table-wrap {
    border-radius: var(--ds-radius);
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(255,255,255,.84);
    box-shadow: var(--ds-shadow-sm);
    overflow: hidden;
}

.ds-table-scroll {
    overflow-x: auto;
}

.ds-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ds-table thead {
    background: var(--ds-dark);
}

.ds-table th {
    padding: 15px 16px;
    color: rgba(255,255,255,.72);
    font-size: 12px;
    font-weight: 900;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.ds-table td {
    padding: 15px 16px;
    color: var(--ds-text);
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1px solid var(--ds-border);
}

.ds-table tr:hover td,
.dash-row-clickable:hover {
    background: rgba(17,16,25,.035);
}

/* Pills */
.ds-pill,
.dash-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 26px;
    min-width: 110px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: var(--ds-surface-2);
    color: var(--ds-text);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-align: center;
}

.ds-pill-success,
.dash-pill--success {
    background: rgba(34,197,94,.10);
    color: #22a35e;
}

.ds-pill-warning,
.dash-pill--warning {
    background: rgba(245,158,11,.14);
    color: #b45309;
}

.ds-pill-danger,
.dash-pill--danger {
    background: rgba(239,68,68,.12);
    color: #b91c1c;
}

.ds-pill-info,
.dash-pill--info {
    background: rgba(56,189,248,.14);
    color: #0369a1;
}

.dash-pill--muted {
    background: rgba(17,16,25,.06);
    color: var(--ds-muted-strong);
}

/* --------------------------------
   Pagination
--------------------------------- */
.ds-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-top: 1px solid var(--ds-border);
    background: rgba(247,248,252,.88);
}

.ds-page-info {
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 800;
}

.ds-select-sm {
    width: auto;
}

/* --------------------------------
   Charts + switchers
--------------------------------- */
.ds-page .row.g-3 {
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--ds-gap);
    margin-left: 0;
    margin-right: 0;
}

.ds-page .row.g-3 > [class*="col-"] {
    width: auto;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    grid-column: span 6;
}

.ds-page .row.g-3 > .col-lg-8 {
    grid-column: span 8;
}

.ds-page .row.g-3 > .col-lg-4 {
    grid-column: span 4;
}

.ds-page .row.g-3 > .col-12:not(.col-lg-4):not(.col-lg-6):not(.col-lg-8) {
    grid-column: span 12;
}

.dash-rel {
    position: relative;
}

.dash-chart-switch {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 1000;
    display: flex;
    gap: 4px;
    padding: 5px;
    border-radius: 999px;
    border: 1px solid rgba(17,16,25,.08);
    background: rgba(255,255,255,.9);
    box-shadow: 0 10px 24px rgba(31,34,46,.10);
    pointer-events: none;
}

[dir="rtl"] .dash-chart-switch {
    right: auto;
    left: 18px;
}

.dash-chart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ds-muted-strong);
    cursor: pointer;
    pointer-events: auto;
}

.dash-chart-btn:hover {
    background: rgba(17,16,25,.06);
    color: var(--ds-dark);
}

.dash-chart-btn.active {
    background: var(--ds-dark);
    color: #fff;
}

.ds-card.dash-rel,
.ds-card.dash-rel .rz-chart,
.ds-card.dash-rel .rz-chart-container,
.ds-card.dash-rel .rz-chart-wrapper {
    overflow: visible !important;
}

.ds-card.dash-rel {
    min-height: 100%;
}

.ds-card.dash-rel .rz-chart {
    min-height: 300px;
}

.ds-card.dash-rel .rz-series path,
.ds-card.dash-rel .rz-series rect {
    transition: opacity 140ms ease, filter 140ms ease;
}

.ds-card.dash-rel .rz-series:hover path,
.ds-card.dash-rel .rz-series:hover rect {
    filter: saturate(1.08);
}

.rz-chart-tooltip,
.rz-tooltip {
    z-index: 99999 !important;
    pointer-events: none;
}

.rz-chart svg {
    pointer-events: auto;
}

/* --------------------------------
   Activity/list items
--------------------------------- */
.dash-loading {
    min-height: 250px;
    display: grid;
    place-items: center;
    padding: 2rem;
}

.dash-search-icon {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: .55;
    pointer-events: none;
}

.dash-row-clickable {
    cursor: pointer;
}

.dash-sort {
    user-select: none;
    white-space: nowrap;
}

.dash-sort:hover {
    color: #fff;
    text-decoration: none;
}

.dash-stat {
    min-height: 300px;
    display: grid;
    place-content: center;
    text-align: center;
    padding: .5rem;
}

.dash-stat__value {
    color: var(--ds-text);
    font-size: 3rem;
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0;
}

.dash-stat__unit {
    margin-top: .35rem;
    color: var(--ds-muted);
    font-weight: 700;
}

.dash-stat__divider {
    width: 110px;
    margin: 1rem auto;
    opacity: .14;
}

.dash-activity-card,
.dash-list-item {
    border: 1px solid rgba(17,16,25,.08);
    border-radius: var(--ds-radius-sm);
    padding: 15px 16px;
    background: rgba(247,248,252,.86);
    cursor: pointer;
    outline: none;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.dash-activity-card:hover,
.dash-list-item:hover {
    transform: translateY(-2px);
    border-color: rgba(17,16,25,.14);
    background: #fff;
    box-shadow: var(--ds-shadow-sm);
}

.dash-activity-card:focus-visible,
.dash-list-item:focus-visible {
    box-shadow: 0 0 0 4px rgba(17,16,25,.10), var(--ds-shadow-sm);
}

/* Inventory aging */
.days-warning {
    background: rgba(239,68,68,.12) !important;
    border-color: rgba(239,68,68,.30) !important;
    color: #b91c1c !important;
}

.days-caution {
    background: rgba(245,158,11,.14) !important;
    border-color: rgba(245,158,11,.30) !important;
    color: #b45309 !important;
}

/* --------------------------------
   Customizer Toggle Chips
--------------------------------- */
.ds-customizer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.ds-toggle-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(17,16,25,.10);
    background: #fff;
    color: var(--ds-muted-strong);
    cursor: pointer;
    user-select: none;
    font-weight: 800;
    transition: transform 120ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

.ds-toggle-chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--ds-shadow-sm);
    border-color: rgba(17,16,25,.18);
}

.ds-toggle-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ds-toggle-chip::before {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1.6px solid rgba(17,16,25,.22);
    background: white;
    flex: 0 0 auto;
}

.ds-toggle-chip.active {
    background: rgba(17,16,25,.94);
    border-color: var(--ds-dark);
    color: #fff;
}

.ds-toggle-chip.active::before {
    border-color: #fff;
    background: var(--ds-success);
    box-shadow: inset 0 0 0 4px #fff;
}

.ds-toggle-chip:focus-within {
    outline: none;
    box-shadow: 0 0 0 4px rgba(17,16,25,.12), var(--ds-shadow-sm);
}

.affiliate-property-cell {
    min-width: 220px;
    white-space: normal;
}

.affiliate-property-name {
    color: var(--ds-ink);
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.25;
}

/* --------------------------------
   Responsive: desktop/tablet first
--------------------------------- */
@media (max-width: 1240px) {
    .ds-kpi-grid,
    .kpi-row {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }
}

@media (max-width: 980px) {
    .ds-container {
        width: 100%;
        padding: 20px 20px 32px;
    }

    .ds-header {
        align-items: stretch;
        flex-direction: column;
    }

    .ds-actions {
        justify-content: flex-start;
    }

    .ds-kpi-grid,
    .kpi-row {
        grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    }

    .ds-page .row.g-3 > [class*="col-"],
    .ds-page .row.g-3 > .col-lg-8,
    .ds-page .row.g-3 > .col-lg-4 {
        grid-column: span 12;
    }

    .ds-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .ds-filter-actions {
        justify-content: flex-start !important;
    }
}

@media (max-width: 640px) {
    .ds-container {
        width: 100%;
        padding: 18px 14px 26px;
    }

    .ds-title {
        font-size: 26px;
    }

    .ds-kpi-grid > .ds-kpi-card {
        grid-column: auto;
    }

    .ds-filter-grid {
        grid-template-columns: 1fr !important;
    }

    .ds-search-row,
    .ds-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .ds-search {
        max-width: 100%;
    }
}

/* --------------------------------
   Print (A4 dashboard snapshot) — triggered by the "Download PDF" button via
   window.clikSellPrintDashboard, which just opens the browser's native print dialog.
   Every major browser's print dialog offers "Save as PDF", so no server-side renderer
   is needed here; this only has to make the on-screen dashboard fit A4 cleanly.
--------------------------------- */
@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    #mainNavbar,
    .ds-actions,
    .ds-filter-drawer,
    .ds-pagination,
    .dash-chart-switch,
    .ds-search-row {
        display: none !important;
    }

    body, .ds-page, .ds-container {
        background: #fff !important;
    }

    .ds-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }

    .ds-kpi-grid {
        break-inside: avoid;
    }
}
