/*
 * Design tokens for the admin panel.
 *
 * Structure and rules come from /DESIGN.md (calm layout, hairline borders, 8px spacing,
 * 8px buttons/inputs, sentence-case labels, one primary action per view).
 * COLORS come from the Sneat admin theme (purple #696cff, cool gray canvas) so every
 * screen matches the sidebar and the rest of the panel.
 *
 * Use these variables and .ds-* classes for all admin UI.
 * Do not hardcode hex colors in Blade or page CSS — reference var(--ds-*).
 */
:root {
    /* Brand — Sneat primary (same as the active sidebar item) */
    --ds-primary: #696cff;
    --ds-primary-hover: #5f61e6;
    --ds-primary-soft: #e7e7ff;      /* active menu background, primary badges */
    --ds-primary-tint: #f4f4ff;      /* info panels, row hover */
    --ds-primary-shadow: 0 2px 4px 0 rgba(105, 108, 255, 0.4);
    --ds-on-primary: #ffffff;
    --ds-viewer-bg: rgba(25, 32, 41, 0.94);         /* full-screen photo / video viewer */
    --ds-viewer-control: rgba(255, 255, 255, 0.12);
    --ds-viewer-control-hover: rgba(255, 255, 255, 0.22);
    --ds-viewer-ink-muted: rgba(255, 255, 255, 0.7);
    --ds-check-idle: rgba(0, 0, 0, 0.25);           /* unselected check on a photo */

    /* Text — Sneat slate */
    --ds-ink: #566a7f;               /* headings, labels */
    --ds-ink-body: #697a8d;          /* body text */
    --ds-ink-muted: #8592a3;         /* secondary text */
    --ds-ink-subtle: #a1acb8;        /* captions, hints */
    --ds-ink-tertiary: #b4bdc6;      /* disabled */

    /* Surfaces */
    --ds-canvas: #f5f5f9;            /* page background */
    --ds-surface-1: #ffffff;         /* cards */
    --ds-surface-2: #f8f8fb;         /* table header, subtle fills */
    --ds-hairline: #d9dee3;          /* borders */
    --ds-hairline-soft: #eceef1;     /* row dividers */
    --ds-card-shadow: 0 2px 6px 0 rgba(67, 89, 113, 0.12);

    /* Status — Sneat label colors */
    --ds-success: #71dd37;
    --ds-success-text: #56ac28;
    --ds-success-soft: #e8fadf;
    --ds-error: #ff3e1d;
    --ds-error-hover: #e6381a;
    --ds-error-soft: #ffe0db;
    --ds-error-border: #ffc5ba;
    --ds-warning: #ffab00;
    --ds-warning-soft: #fff2d6;
    /* Platform logos (brand colours, used only for the Messenger / WhatsApp marks) */
    --ds-messenger-1: #0a7cff;
    --ds-messenger-2: #00b2ff;
    --ds-whatsapp: #25d366;
    --ds-neutral-soft: #ebeef0;

    /* AI accent — Sneat info (AI features only) */
    --ds-accent: #03c3ec;
    --ds-accent-hover: #03b0d4;
    --ds-accent-soft: #d7f5fc;

    /* Charts */
    --ds-chart-blue: #03c3ec;
    --ds-chart-pink: #ff3e1d;
    --ds-chart-lime: #71dd37;
    --ds-chart-cyan: #696cff;

    /* Typography */
    --ds-font: "Public Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
    --ds-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

    /* Radius */
    --ds-radius-xs: 4px;
    --ds-radius-sm: 6px;
    --ds-radius-md: 8px;             /* buttons, inputs, cards (matches Sneat .card) */
    --ds-radius-lg: 12px;
    --ds-radius-xl: 16px;
    --ds-radius-pill: 9999px;

    /* Spacing (8px base) */
    --ds-space-xxs: 4px;
    --ds-space-xs: 8px;
    --ds-space-sm: 12px;
    --ds-space-md: 16px;
    --ds-space-lg: 24px;
    --ds-space-xl: 32px;
    --ds-space-xxl: 48px;

    /* Tables */
    --ds-row-hover: var(--ds-primary-tint);
    --ds-row-alt: #fafafc;
}

/* ---------- Surfaces ---------- */
.ds-canvas { background: var(--ds-canvas); }

/* Same look as Sneat .card so new and old screens match */
.ds-card {
    background: var(--ds-surface-1);
    border: 0;
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-lg);
    box-shadow: var(--ds-card-shadow);
    overflow: hidden;
}

/* Info panel / hint — soft theme tint with a primary accent line */
.ds-card-muted {
    background: var(--ds-primary-tint);
    border: 1px solid var(--ds-primary-soft);
    border-left: 3px solid var(--ds-primary);
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-md) var(--ds-space-lg);
    color: var(--ds-ink-body);
}
.ds-card-muted > .d-flex > .bx:first-child,
.ds-card-muted .ds-hint-icon { color: var(--ds-primary); }

.ds-divider { border-top: 1px solid var(--ds-hairline-soft); }

/* ---------- Type ---------- */
.ds-font { font-family: var(--ds-font); }
.ds-headline { font-size: 26px; font-weight: 500; line-height: 1.25; letter-spacing: -0.4px; color: var(--ds-ink); }
.ds-card-title { font-size: 18px; font-weight: 500; line-height: 1.3; letter-spacing: -0.2px; color: var(--ds-ink); }
.ds-subhead { font-size: 18px; font-weight: 400; line-height: 1.4; color: var(--ds-ink); }
.ds-body { font-size: 15px; line-height: 1.5; color: var(--ds-ink-body); }
.ds-body-sm { font-size: 14px; line-height: 1.5; color: var(--ds-ink-muted); }
.ds-caption { font-size: 12px; line-height: 1.4; color: var(--ds-ink-muted); }
.ds-eyebrow { font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--ds-ink-muted); }
.ds-mono { font-family: var(--ds-font-mono); font-size: 12px; }

/* ---------- Buttons (radius 8px, never pill) ---------- */
.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-xs);
    min-height: 40px;
    padding: 9px 18px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    border-radius: var(--ds-radius-md);
    border: 1px solid transparent;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
    text-decoration: none;
    cursor: pointer;
}
.ds-btn-sm { min-height: 32px; padding: 6px 12px; font-size: 13px; }

/* Primary = theme purple, like the sidebar active item and Sneat buttons */
.ds-btn-primary { background: var(--ds-primary); color: var(--ds-on-primary); box-shadow: var(--ds-primary-shadow); }
.ds-btn-primary:hover,
.ds-btn-primary:focus { background: var(--ds-primary-hover); color: var(--ds-on-primary); }

.ds-btn-secondary { background: var(--ds-surface-1); color: var(--ds-primary); border-color: var(--ds-primary); }
.ds-btn-secondary:hover,
.ds-btn-secondary:focus { background: var(--ds-primary-soft); color: var(--ds-primary); }

.ds-btn-tertiary { background: var(--ds-surface-1); color: var(--ds-ink-body); border-color: var(--ds-hairline); }
.ds-btn-tertiary:hover,
.ds-btn-tertiary:focus { background: var(--ds-primary-tint); color: var(--ds-primary); border-color: var(--ds-primary); }

.ds-btn-ai { background: var(--ds-accent); color: var(--ds-on-primary); }
.ds-btn-ai:hover,
.ds-btn-ai:focus { background: var(--ds-accent-hover); color: var(--ds-on-primary); }

.ds-btn-danger { background: var(--ds-surface-1); color: var(--ds-error); border-color: var(--ds-error); }
.ds-btn-danger:hover,
.ds-btn-danger:focus { background: var(--ds-error-soft); color: var(--ds-error); }

.ds-btn:disabled,
.ds-btn.disabled { opacity: .5; pointer-events: none; box-shadow: none; }

/* ---------- Icon buttons (table row actions) ---------- */
.ds-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-xs);
}

.ds-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    color: var(--ds-ink-muted);
    background: var(--ds-surface-1);
    border: 1px solid var(--ds-hairline);
    border-radius: var(--ds-radius-md);
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
    text-decoration: none;
    cursor: pointer;
}
.ds-icon-btn:hover,
.ds-icon-btn:focus {
    color: var(--ds-primary);
    background: var(--ds-primary-soft);
    border-color: var(--ds-primary-soft);
}
.ds-icon-btn:focus-visible { outline: 2px solid var(--ds-primary); outline-offset: 1px; }

.ds-icon-btn-danger { color: var(--ds-error); }
.ds-icon-btn-danger:hover,
.ds-icon-btn-danger:focus { color: var(--ds-error); background: var(--ds-error-soft); border-color: var(--ds-error-soft); }

/* ---------- Inputs ---------- */
.ds-input {
    min-height: 42px;
    padding: 9px 14px;
    font-size: 15px;
    color: var(--ds-ink-body);
    background-color: var(--ds-surface-1); /* not "background": keeps the select arrow */
    border: 1px solid var(--ds-hairline);
    border-radius: var(--ds-radius-md);
    box-shadow: none;
}
.form-select.ds-input { padding-right: 36px; background-position: right 12px center; }
.ds-input:focus { border-color: var(--ds-primary); outline: none; box-shadow: 0 0 0.25rem 0.05rem rgba(105, 108, 255, 0.1); }
.ds-input[readonly] { background: var(--ds-surface-2); color: var(--ds-ink-muted); }

/* ---------- Badges / status (Sneat "label" style) ---------- */
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-xxs);
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--ds-radius-xs);
    background: var(--ds-neutral-soft);
    color: var(--ds-ink-muted);
}
.ds-badge-primary { background: var(--ds-primary-soft); color: var(--ds-primary); }
.ds-badge-success { background: var(--ds-success-soft); color: var(--ds-success-text); }
.ds-badge-warning { background: var(--ds-warning-soft); color: var(--ds-warning); }
.ds-badge-error { background: var(--ds-error-soft); color: var(--ds-error); }
.ds-badge-ai { background: var(--ds-accent-soft); color: var(--ds-accent-hover); }

/* ---------- Step number (lists of actions) ---------- */
.ds-step {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-primary-soft);
    color: var(--ds-primary);
}

/* =====================================================================
 * Tables (global) — applies to every .table in the admin panel.
 * Desktop: calm sentence-case header, hairline rows, soft purple hover.
 * When a table does not fit its container (any screen size), each row becomes
 * a vertical "label · value" block.
 * Labels come from <thead> and are added by assets/admin/js/responsive-table.js.
 * Opt out on a table with class .table-no-stack.
 * ===================================================================== */
.table > :not(caption) > * > * {
    padding: var(--ds-space-sm) var(--ds-space-md);
    border-bottom-color: var(--ds-hairline-soft);
    vertical-align: middle;
}

.table thead th,
.table:not(.table-dark) th {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ds-ink);
}

.table thead th {
    background: var(--ds-surface-2);
    border-bottom: 1px solid var(--ds-hairline-soft);
}

.table tbody td { color: var(--ds-ink-body); }
.table tbody tr { transition: background-color .15s ease; }
.table-hover > tbody > tr:hover > *,
.table tbody tr:hover > * { --bs-table-accent-bg: var(--ds-row-hover); background-color: var(--ds-row-hover); }

/* Stacked mode: added by responsive-table.js whenever a table does not fit its container. */
.ds-table-wrap-stacked { overflow-x: visible !important; }

.ds-table-stack.is-stacked { border: 0; background: transparent; }

.ds-table-stack.is-stacked thead { display: none; }

.ds-table-stack.is-stacked,
.ds-table-stack.is-stacked tbody,
.ds-table-stack.is-stacked tr,
.ds-table-stack.is-stacked td {
    display: block;
    width: 100%;
}

/* One card per record, with space between records. */
.ds-table-stack.is-stacked tbody { display: flex; flex-direction: column; gap: var(--ds-space-sm); padding: var(--ds-space-sm); }
.ds-table-stack.is-stacked tbody tr { border: 1px solid var(--ds-hairline-soft); border-radius: var(--ds-radius-md); overflow: hidden; background: var(--ds-surface-1); }
.ds-table-stack.is-stacked tbody tr:hover > * { background-color: inherit; }

.ds-table-stack.is-stacked.table > :not(caption) > * > *,
.ds-table-stack.is-stacked td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-md);
    min-height: 44px;
    padding: var(--ds-space-sm);
    text-align: right !important;
    white-space: normal;
    word-break: break-word;
    border-bottom: 1px solid var(--ds-hairline-soft);
}

.ds-table-stack.is-stacked td:last-child { border-bottom: 0; }

.ds-table-stack.is-stacked td::before {
    content: attr(data-label);
    flex-shrink: 0;
    max-width: 45%;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    color: var(--ds-ink);
}

.ds-table-stack.is-stacked td:not([data-label])::before,
.ds-table-stack.is-stacked td[data-label=""]::before { content: none; }
.ds-table-stack.is-stacked td:not([data-label]),
.ds-table-stack.is-stacked td[data-label=""] { justify-content: flex-end; }

/* Empty-state / full-width rows */
.ds-table-stack.is-stacked td[colspan] { justify-content: center; text-align: center !important; }
.ds-table-stack.is-stacked td[colspan]::before { content: none; }
/* Cells with a title + caption (or other blocks): label on its own line, content full width and left-aligned. */
.ds-table-stack.is-stacked td:has(> div, > p, > ul, > dl, > .d-block) { display: block; text-align: left !important; }
.ds-table-stack.is-stacked td:has(> div, > p, > ul, > dl, > .d-block)::before { display: block; max-width: none; margin-bottom: var(--ds-space-xxs); }
.ds-table-stack.is-stacked td:has(> .ds-actions) { display: flex; }

/* ---------- Confirmation modal (components/confirmation-modal.blade.php) ---------- */
.ds-confirm-modal .modal-dialog { max-width: 420px; }

.ds-confirm-modal .modal-content {
    position: relative;
    border: 0;
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-card-shadow);
    overflow: hidden;
}

.ds-confirm-close {
    position: absolute;
    top: var(--ds-space-sm);
    right: var(--ds-space-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 20px;
    color: var(--ds-ink-muted);
    background: transparent;
    border: 0;
    border-radius: var(--ds-radius-md);
    transition: background-color .15s ease, color .15s ease;
}
.ds-confirm-close:hover,
.ds-confirm-close:focus { color: var(--ds-ink); background: var(--ds-surface-2); }

.ds-confirm-body {
    padding: var(--ds-space-xl) var(--ds-space-lg) var(--ds-space-md);
    text-align: center;
}

.ds-confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: var(--ds-space-md);
    font-size: 30px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-error-soft);
    color: var(--ds-error);
}

.ds-confirm-title {
    margin-bottom: var(--ds-space-xs);
    font-size: 20px;
    font-weight: 500;
    color: var(--ds-ink);
}

.ds-confirm-question {
    margin-bottom: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ds-ink-body);
    word-break: break-word;
}

.ds-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--ds-space-sm);
    padding: var(--ds-space-md) var(--ds-space-lg) var(--ds-space-lg);
}
.ds-confirm-actions .ds-btn { width: 100%; }

/* Neutral secondary (Cancel) and the confirm button, which follows the modal type */
.ds-btn-secondary-neutral { background: var(--ds-surface-1); color: var(--ds-ink-body); border-color: var(--ds-hairline); }
.ds-btn-secondary-neutral:hover,
.ds-btn-secondary-neutral:focus { background: var(--ds-surface-2); color: var(--ds-ink); }

.ds-confirm-modal.is-danger .ds-btn-confirm { background: var(--ds-error); color: var(--ds-on-primary); }
.ds-confirm-modal.is-danger .ds-btn-confirm:hover,
.ds-confirm-modal.is-danger .ds-btn-confirm:focus { background: var(--ds-error-hover); color: var(--ds-on-primary); }

.ds-confirm-modal.is-primary .ds-confirm-icon { background: var(--ds-primary-soft); color: var(--ds-primary); }
.ds-confirm-modal.is-primary .ds-btn-confirm { background: var(--ds-primary); color: var(--ds-on-primary); box-shadow: var(--ds-primary-shadow); }
.ds-confirm-modal.is-primary .ds-btn-confirm:hover,
.ds-confirm-modal.is-primary .ds-btn-confirm:focus { background: var(--ds-primary-hover); color: var(--ds-on-primary); }

@media (max-width: 479.98px) {
    .ds-confirm-actions { grid-template-columns: 1fr; }
    .ds-confirm-actions .ds-btn-confirm { order: -1; }
}

/* ---------- Page tabs (underline, no pills) ---------- */
.ds-tabs {
    display: flex;
    gap: var(--ds-space-lg);
    border-bottom: 1px solid var(--ds-hairline);
    margin-bottom: var(--ds-space-lg);
    overflow-x: auto;
    overflow-y: hidden;
}
.ds-tab {
    padding: var(--ds-space-sm) 0;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--ds-ink-muted);
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
}
.ds-tab:hover { color: var(--ds-ink); }
.ds-tab.active { color: var(--ds-primary); border-bottom-color: var(--ds-primary); }

/* ---------- Stat tile ---------- */
.ds-stat-value { font-size: 26px; font-weight: 500; line-height: 1.2; color: var(--ds-ink); }
.ds-stat-label { font-size: 14px; color: var(--ds-ink-muted); }

/* ---------- Learning proposal ---------- */
.ds-proposal-content {
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-hairline-soft);
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-sm) var(--ds-space-md);
    color: var(--ds-ink-body);
    white-space: pre-line;
}
.ds-quote {
    border-left: 3px solid var(--ds-hairline);
    padding-left: var(--ds-space-sm);
    color: var(--ds-ink-body);
}

/* ---------- Status dot (top bar cron icon) ---------- */
.ds-status-dot {
    position: absolute;
    top: 8px;
    right: 6px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid var(--ds-surface-1);
    background: var(--ds-warning);
}
.ds-status-dot-running { background: var(--ds-success); }
.ds-status-dot-stopped { background: var(--ds-error); }
.ds-status-dot-never { background: var(--ds-warning); }
.ds-details > summary { cursor: pointer; color: var(--ds-ink); }

/* ---------- Business (brand) mark + top bar switcher ---------- */
.ds-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--ds-radius-md);
    background: var(--ds-primary-soft);
    color: var(--ds-primary);
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
}
.ds-brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.ds-brand-mark-sm { width: 28px; height: 28px; font-size: 11px; border-radius: var(--ds-radius-sm); }
.ds-brand-switch { display: flex; align-items: center; gap: var(--ds-space-xs); color: var(--ds-ink); font-weight: 500; }
.ds-brand-switch-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-brand-switch-menu .dropdown-item { display: flex; align-items: center; gap: var(--ds-space-xs); }
.ds-brand-switch-menu .dropdown-item.active { background: var(--ds-primary-tint); color: var(--ds-primary); }

/* ---------- Filter bar (lists): search + selects that apply on change ---------- */
.ds-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-xs); margin-bottom: var(--ds-space-md); }
.ds-filters > * { flex: 1 1 180px; max-width: 240px; }
.ds-filter-search { position: relative; }
.ds-filters .ds-filter-search { flex: 2 1 260px; max-width: 360px; }
.ds-filter-search > i { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--ds-ink-subtle); font-size: 18px; pointer-events: none; }
.ds-filter-search .ds-input { width: 100%; padding-left: 38px; }
.ds-filters .ds-filter-clear { flex: 0 0 auto; max-width: none; }
.ds-filters-end { margin-left: auto; }
@media (max-width: 575.98px) {
    .ds-filters > *, .ds-filters .ds-filter-search { flex-basis: 100%; max-width: none; }
}

/* ---------- Detail lists (label / value rows) ---------- */
.ds-dl { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: var(--ds-space-xs) var(--ds-space-md); margin: 0; }
.ds-dl dt { font-weight: 400; font-size: 14px; color: var(--ds-ink-muted); }
.ds-dl dd { margin: 0; font-size: 14px; color: var(--ds-ink); word-break: break-word; }
.ds-code { font-family: var(--ds-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 13px; color: var(--ds-ink-body); background: var(--ds-surface-2); border: 1px solid var(--ds-hairline-soft); border-radius: var(--ds-radius-sm); padding: 2px 6px; word-break: break-all; }
.ds-empty { padding: var(--ds-space-xl) var(--ds-space-md); text-align: center; color: var(--ds-ink-muted); }
.ds-empty > i { display: block; margin-bottom: var(--ds-space-xs); font-size: 32px; color: var(--ds-ink-subtle); }
.ds-tabs-filter { flex: 0 0 220px; margin-bottom: var(--ds-space-sm); }

/* ---------- Page headers: actions stay on the right even when they wrap to a new line ---------- */
.ds-page-head > :last-child:not(:first-child) { margin-left: auto; }
.ds-page-head > .d-flex:last-child:not(:first-child) { flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
.ds-btn { white-space: nowrap; }
.ds-badge { white-space: nowrap; }
.table thead th { white-space: nowrap; }
@media (max-width: 575.98px) {
    .ds-headline { font-size: 20px; line-height: 1.3; }
    .ds-page-head { gap: var(--ds-space-sm) !important; }
}

/* ---------- Filter bars on tablets: fill the rows evenly instead of leaving one select alone ---------- */
@media (max-width: 1199.98px) {
    .ds-filters > * { flex: 1 1 200px; max-width: none; }
    .ds-filters .ds-filter-clear { flex: 0 0 auto; }
}
/* Main text column of a table (title + description): keeps a readable width; other columns stay compact. */
.table td.ds-col-main { min-width: 240px; }
.ds-table-stack.is-stacked td.ds-col-main { min-width: 0; }

/* ---------- Copy fields: an input with a button attached (cron, webhook, settings) ---------- */
.input-group > .ds-btn {
    margin-left: -1px;
    border-color: var(--ds-hairline);
    background: var(--ds-surface-2);
    color: var(--ds-primary);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.input-group > .ds-btn:hover, .input-group > .ds-btn:focus { background: var(--ds-primary-soft); border-color: var(--ds-primary); color: var(--ds-primary); }
.input-group > .ds-input { min-height: 42px; }
@media (max-width: 575.98px) {
    /* Phones: the value gets the full width, the button sits below it. */
    .input-group:has(> .ds-btn) { flex-wrap: wrap; gap: var(--ds-space-xs); }
    .input-group:has(> .ds-btn) > .form-control { flex: 1 1 100%; width: 100%; border-radius: var(--ds-radius-md) !important; }
    .input-group:has(> .ds-btn) > .ds-btn { flex: 1 1 100%; margin-left: 0; border-radius: var(--ds-radius-md) !important; }
    .modal-dialog { margin: var(--ds-space-sm); }
    .modal-footer { flex-wrap: nowrap; }
    /* #7 detail lists: label above value on phones */
    .ds-dl { grid-template-columns: 1fr; gap: 2px; }
    .ds-dl dd { margin-bottom: var(--ds-space-xs); }
}

/* ---------- Modal footer: even spacing above and below the buttons ---------- */
.modal-footer { gap: var(--ds-space-xs); padding: var(--ds-space-md) var(--ds-space-lg); }
.modal-footer > * { margin: 0; }

/* ---------- Platform logos (partials/channel_logo.blade.php) ---------- */
.ds-channel-logo { display: inline-block; width: 16px; height: 16px; flex-shrink: 0; vertical-align: middle; }
.ds-channel-logo-sm { width: 14px; height: 14px; }
.ds-messenger-stop-1 { stop-color: var(--ds-messenger-1); }
.ds-messenger-stop-2 { stop-color: var(--ds-messenger-2); }
.ds-channel-logo-mark { fill: var(--ds-surface-1); }
.ds-channel-logo-whatsapp .ds-channel-logo-bg { fill: var(--ds-whatsapp); }

/* ---------- Counts and attention dots (left menu, tabs) ---------- */
.ds-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px; font-size: 11px; font-weight: 600;
    background: var(--ds-primary); color: var(--ds-on-primary);
}
.ds-menu-dot { display: inline-block; flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--ds-warning); }
.menu-link .ds-count { flex-shrink: 0; }

/* ---------- Report rows (Reports → Today) ---------- */
.ds-report-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--ds-space-md); padding: var(--ds-space-sm) var(--ds-space-lg); border-top: 1px solid var(--ds-hairline-soft); color: var(--ds-ink-body); }
a.ds-report-row:hover { background: var(--ds-primary-tint); color: var(--ds-ink-body); }
.ds-report-row-main { flex: 1; min-width: 0; }
.ds-report-next { display: flex; gap: var(--ds-space-xxs); align-items: flex-start; margin-top: 2px; font-size: 13px; color: var(--ds-ink); }
.ds-report-next .bx { color: var(--ds-warning); margin-top: 2px; }
@media (max-width: 575.98px) {
    .ds-report-row { flex-direction: column; gap: var(--ds-space-xs); padding: var(--ds-space-sm) var(--ds-space-md); }
}

/* ---------- Business hours (Businesses → Hours and alerts) ---------- */
.ds-hours-row { display: grid; grid-template-columns: minmax(130px, 1fr) 1fr 1fr; gap: var(--ds-space-sm); align-items: center; padding: var(--ds-space-sm) 0; border-bottom: 1px solid var(--ds-hairline-soft); }
.ds-hours-row:last-child { border-bottom: 0; }
.ds-hours-row .form-check-label { color: var(--ds-ink); }
.ds-hours-closed { display: none; grid-column: 2 / 4; }
.ds-hours-row:has([data-day-toggle]:not(:checked)) input[type="time"] { display: none; }
.ds-hours-row:has([data-day-toggle]:not(:checked)) .ds-hours-closed { display: block; }
.ds-hours.is-off { opacity: .5; }
@media (max-width: 480px) {
    .ds-hours-row { grid-template-columns: 1fr 1fr; }
    .ds-hours-row .form-check { grid-column: 1 / -1; }
    .ds-hours-closed { grid-column: 1 / -1; }
}

/* ---------- Media library (Bot → Media library) ---------- */
.ds-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: var(--ds-space-lg); }
.ds-media-card { display: flex; flex-direction: column; min-width: 0; background: var(--ds-surface-1); border-radius: var(--ds-radius-md); box-shadow: var(--ds-card-shadow); overflow: hidden; }
.ds-media-thumb { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 10; background: var(--ds-surface-2); overflow: hidden; }
.ds-media-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.ds-media-thumb:hover img { transform: scale(1.03); }
.ds-media-thumb-file, .ds-media-thumb-audio, .ds-media-thumb-video { background: var(--ds-primary-tint); }
.ds-media-thumb-icon { display: flex; flex-direction: column; align-items: center; gap: var(--ds-space-xxs); color: var(--ds-primary); }
.ds-media-thumb-icon i { font-size: 40px; }
.ds-media-thumb-icon span { font-size: 12px; font-weight: 500; color: var(--ds-ink-muted); }
.ds-media-kind { position: absolute; top: var(--ds-space-xs); left: var(--ds-space-xs); display: inline-flex; align-items: center; gap: var(--ds-space-xxs); padding: 2px var(--ds-space-xs); border-radius: var(--ds-radius-sm); background: var(--ds-surface-1); color: var(--ds-ink); font-size: 12px; font-weight: 500; }
.ds-media-play { position: absolute; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ds-surface-1); color: var(--ds-primary); font-size: 28px; box-shadow: var(--ds-card-shadow); }
.ds-media-card-body { flex: 1; padding: var(--ds-space-md) var(--ds-space-md) var(--ds-space-sm); min-width: 0; }
.ds-media-title { margin: 0 0 2px; font-size: 15px; font-weight: 500; color: var(--ds-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-media-desc { margin: var(--ds-space-xs) 0 0; font-size: 13px; line-height: 1.45; color: var(--ds-ink-body); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.ds-media-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-xs); padding: var(--ds-space-sm) var(--ds-space-md); border-top: 1px solid var(--ds-hairline-soft); }
.ds-media-card-foot .ds-badge i { margin-right: 2px; }
@media (max-width: 575.98px) {
    .ds-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-space-sm); }
    .ds-media-card-body { padding: var(--ds-space-sm); }
    .ds-media-desc { display: none; }
    .ds-media-card-foot { flex-wrap: wrap; padding: var(--ds-space-xs) var(--ds-space-sm); }
}

/* ---------- Full-screen photo / video viewer ---------- */
body.ds-viewer-open { overflow: hidden; }
.ds-viewer { position: fixed; inset: 0; z-index: 2000; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--ds-viewer-bg); color: var(--ds-on-primary); }
.ds-viewer[hidden] { display: none; }
.ds-viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-md); padding: var(--ds-space-sm) var(--ds-space-md); }
.ds-viewer-heading { min-width: 0; }
.ds-viewer-title { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-viewer-count { font-size: 13px; color: var(--ds-viewer-ink-muted); }
.ds-viewer-tools { display: flex; gap: var(--ds-space-xs); flex: 0 0 auto; }
.ds-viewer-btn, .ds-viewer-nav { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: var(--ds-radius-md); background: var(--ds-viewer-control); color: var(--ds-on-primary); font-size: 22px; transition: background .15s; }
.ds-viewer-btn:hover, .ds-viewer-nav:hover, .ds-viewer-btn:focus-visible, .ds-viewer-nav:focus-visible { background: var(--ds-viewer-control-hover); color: var(--ds-on-primary); }
.ds-viewer-stage { display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 72px var(--ds-space-lg); }
.ds-viewer-stage img, .ds-viewer-stage video { max-width: 100%; max-height: 100%; border-radius: var(--ds-radius-md); object-fit: contain; }
.ds-viewer-nav { position: absolute; top: 50%; width: 48px; height: 48px; font-size: 30px; transform: translateY(-50%); display: none; }
.ds-viewer.has-many .ds-viewer-nav { display: inline-flex; }
.ds-viewer-prev { left: var(--ds-space-md); }
.ds-viewer-next { right: var(--ds-space-md); }
@media (max-width: 575.98px) {
    .ds-viewer-stage { padding: 0 var(--ds-space-xs) 72px; }
    .ds-viewer-nav { top: auto; bottom: var(--ds-space-md); transform: none; }
}

/* Storage and backups: space used list, card heading row */
.ds-card-head { padding: var(--ds-space-md) var(--ds-space-lg); border-bottom: 1px solid var(--ds-hairline-soft); }
.ds-usage { list-style: none; margin: 0; padding: 0; }
.ds-usage-row { display: flex; justify-content: space-between; gap: var(--ds-space-md); padding: var(--ds-space-xs) 0; border-top: 1px solid var(--ds-hairline-soft); font-size: 14px; color: var(--ds-ink-body); }
.ds-usage-row:first-child { border-top: 0; }
.ds-usage-size { flex: 0 0 auto; color: var(--ds-ink); font-weight: 500; }

/* Review mode: On / Off tag in the menu + popup */
.ds-menu-state { padding: 0 6px; border-radius: var(--ds-radius-xs); background: var(--ds-surface-2); color: var(--ds-ink-muted); font-size: 11px; font-weight: 500; line-height: 18px; }
.ds-menu-state.is-on { background: var(--ds-accent-soft); color: var(--ds-accent-hover); }
.ds-review-steps { margin: 0 0 var(--ds-space-lg); padding-left: var(--ds-space-lg); line-height: 1.5; padding-left: var(--ds-space-lg); font-size: 14px; color: var(--ds-ink-body); }
.ds-review-steps li { margin-bottom: var(--ds-space-xs); }
.ds-review-steps strong { font-weight: 500; color: var(--ds-ink); }
.ds-review-brand { padding: var(--ds-space-md); border: 1px solid var(--ds-hairline); border-radius: var(--ds-radius-md); transition: border-color .15s, background .15s; }
.ds-review-brand.is-on { border-color: var(--ds-accent); background: var(--ds-surface-2); }
.ds-review-brand-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; margin: 0; cursor: pointer; }
.ds-review-toggle { padding-left: 0; }
.ds-review-toggle .form-check-input { width: 44px; height: 24px; margin: 0; float: none; cursor: pointer; }
.ds-review-toggle .form-check-input:checked { background-color: var(--ds-accent); border-color: var(--ds-accent); }
.ds-review-toggle .form-check-input:focus { box-shadow: 0 0 0 3px var(--ds-primary-tint); }
.ds-review-brand + .ds-review-brand { margin-top: var(--ds-space-sm); }
.ds-review-brand-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--ds-space-sm); }
.ds-review-brand-name { font-size: 15px; font-weight: 500; color: var(--ds-ink); }
.ds-review-stats { display: flex; flex-wrap: wrap; gap: var(--ds-space-xs) var(--ds-space-md); margin-top: var(--ds-space-sm); font-size: 13px; color: var(--ds-ink-muted); }
.ds-review-stats strong { font-weight: 500; color: var(--ds-ink); }
.ds-review-verdict { display: flex; align-items: center; gap: var(--ds-space-xs); margin-top: var(--ds-space-sm); padding: var(--ds-space-xs) var(--ds-space-sm); border-radius: var(--ds-radius-sm); background: var(--ds-surface-2); font-size: 13px; color: var(--ds-ink-body); }
.ds-review-verdict.is-ready { background: var(--ds-success-soft); color: var(--ds-ink); }
.ds-review-verdict.is-ready > .bx { color: var(--ds-success); }

/* Settings pages: rows with a switch, numbered sections, save bar */
.min-w-0 { min-width: 0; }
.ds-section-head { display: flex; align-items: flex-start; gap: var(--ds-space-sm); margin-bottom: var(--ds-space-md); }
.ds-section-head .ds-step { flex: 0 0 auto; margin-top: 2px; }
.ds-setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-md); padding: var(--ds-space-sm) 0; }
.ds-setting-row + .ds-setting-row { border-top: 1px solid var(--ds-hairline-soft); }
.ds-setting-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; margin: 0; cursor: pointer; }
.ds-setting-title { font-size: 15px; font-weight: 500; color: var(--ds-ink); }
.ds-setting-note { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ds-space-xs); margin-top: var(--ds-space-xs); padding-top: var(--ds-space-sm); border-top: 1px solid var(--ds-hairline-soft); font-size: 13px; color: var(--ds-ink-body); }
.ds-setting-note > .bx { font-size: 18px; color: var(--ds-accent); }
.ds-switch-lg .form-check-input { width: 48px; height: 26px; margin: 0; float: none; cursor: pointer; }
.form-switch .form-check-input[role="switch"] { cursor: pointer; }
.ds-prompt { min-height: 240px; font-size: 14px; line-height: 1.6; }
.ds-prompt-help { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-xs); margin-top: var(--ds-space-sm); }
.ds-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px var(--ds-space-xs); border: 1px solid var(--ds-hairline); border-radius: var(--ds-radius-sm); font-size: 12px; color: var(--ds-ink-body); }
.ds-chip > .bx { font-size: 14px; color: var(--ds-ink-muted); }
.ds-range { margin-top: var(--ds-space-xs); }
.ds-range::-webkit-slider-thumb { background: var(--ds-primary); }
.ds-range::-moz-range-thumb { background: var(--ds-primary); }
.ds-range-value { font-weight: 500; color: var(--ds-primary); }
.ds-range-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--ds-ink-muted); }
.ds-save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--ds-space-sm); padding: var(--ds-space-sm) var(--ds-space-lg); border: 1px solid var(--ds-hairline); border-radius: var(--ds-radius-md); background: var(--ds-surface-1); box-shadow: var(--ds-card-shadow); }
.ds-save-bar .is-dirty { color: var(--ds-ink); font-weight: 500; }
@media (min-width: 1200px) { .ds-sticky-card { position: sticky; top: var(--ds-space-lg); } }
.ds-test-result { margin-top: var(--ds-space-sm); padding: var(--ds-space-sm); border-left: 3px solid var(--ds-accent); border-radius: var(--ds-radius-sm); background: var(--ds-surface-2); white-space: pre-wrap; }
.ds-test-result.is-error { border-left-color: var(--ds-error); }
.ds-channel-ai { display: flex; align-items: center; gap: var(--ds-space-sm); padding: var(--ds-space-xs) 0; }
.ds-channel-ai + .ds-channel-ai { border-top: 1px solid var(--ds-hairline-soft); }
.ds-channel-ai > .min-w-0 { flex: 1; }

/* Chatbot settings: section menu, checklist, sub-steps */
.ds-anchor { scroll-margin-top: var(--ds-space-lg); }
.ds-settings-nav { display: flex; flex-direction: column; gap: 2px; padding: var(--ds-space-xs); border-radius: var(--ds-radius-md); background: var(--ds-surface-1); box-shadow: var(--ds-card-shadow); }
@media (min-width: 992px) { .ds-settings-nav { position: sticky; top: var(--ds-space-lg); } }
.ds-settings-nav-link { display: flex; align-items: center; gap: var(--ds-space-xs); padding: var(--ds-space-xs) var(--ds-space-sm); border-radius: var(--ds-radius-sm); font-size: 14px; color: var(--ds-ink-body); }
.ds-settings-nav-link > .bx { font-size: 18px; color: var(--ds-ink-muted); }
.ds-settings-nav-link:hover, .ds-settings-nav-link.active { background: var(--ds-primary-tint); color: var(--ds-primary); }
.ds-settings-nav-link.active > .bx, .ds-settings-nav-link:hover > .bx { color: var(--ds-primary); }
@media (max-width: 991.98px) {
    .ds-settings-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
    .ds-settings-nav::-webkit-scrollbar { display: none; }
    .ds-settings-nav-link { flex: 0 0 auto; white-space: nowrap; }
}
.ds-checklist { list-style: none; margin: 0; padding: 0; }
.ds-checklist li { display: flex; align-items: center; gap: var(--ds-space-xs); padding: var(--ds-space-xs) 0; font-size: 14px; color: var(--ds-ink); }
.ds-checklist li + li { border-top: 1px solid var(--ds-hairline-soft); }
.ds-checklist li > .bx { font-size: 20px; color: var(--ds-warning); }
.ds-checklist li.is-done { color: var(--ds-ink-body); }
.ds-checklist li.is-done > .bx { color: var(--ds-success); }
.ds-substep { display: flex; gap: var(--ds-space-sm); padding-bottom: var(--ds-space-lg); }
.ds-substep + .ds-substep { padding-top: var(--ds-space-lg); border-top: 1px solid var(--ds-hairline-soft); }
.ds-substep > .ds-step { margin-top: 2px; }
.ds-substep-icon { flex: 0 0 auto; font-size: 22px; color: var(--ds-primary); }
.ds-inline-alert { display: flex; align-items: flex-start; gap: var(--ds-space-xs); padding: var(--ds-space-xs) var(--ds-space-sm); border-radius: var(--ds-radius-sm); background: var(--ds-warning-soft); font-size: 13px; color: var(--ds-ink); }
.ds-inline-alert > .bx { font-size: 18px; color: var(--ds-warning); }
.ds-form-foot { display: flex; justify-content: flex-end; margin-top: var(--ds-space-lg); padding-top: var(--ds-space-md); border-top: 1px solid var(--ds-hairline-soft); }
.ds-option { padding: var(--ds-space-md); border: 1px solid var(--ds-hairline); border-radius: var(--ds-radius-md); }
.ds-option + .ds-option { margin-top: var(--ds-space-sm); }
.ds-divider-line { height: 1px; margin: var(--ds-space-lg) 0; background: var(--ds-hairline-soft); }

/* AI providers: steps strip and service cards */
.ds-steps-strip { display: flex; flex-wrap: wrap; gap: var(--ds-space-xs) var(--ds-space-lg); padding: var(--ds-space-sm) var(--ds-space-md); border-radius: var(--ds-radius-md); background: var(--ds-surface-1); box-shadow: var(--ds-card-shadow); }
.ds-steps-strip-item { display: inline-flex; align-items: center; gap: var(--ds-space-xs); font-size: 14px; color: var(--ds-ink-body); }
.ds-steps-strip-item.is-done { color: var(--ds-ink-muted); }
.ds-steps-strip-item.is-done .ds-step { background: var(--ds-success-soft); color: var(--ds-success-text); }
.ds-provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--ds-space-md); }
.ds-provider-card { display: flex; flex-direction: column; gap: var(--ds-space-md); padding: var(--ds-space-lg); border: 1px solid transparent; border-radius: var(--ds-radius-md); background: var(--ds-surface-1); box-shadow: var(--ds-card-shadow); }
.ds-provider-card.is-ready { border-color: var(--ds-success); }
.ds-provider-mark { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--ds-radius-md); background: var(--ds-primary-soft); color: var(--ds-primary); font-size: 18px; font-weight: 500; }
.ds-provider-name { font-size: 16px; font-weight: 500; color: var(--ds-ink); }
.ds-provider-name:hover { color: var(--ds-primary); }
.ds-provider-state { display: flex; align-items: center; gap: var(--ds-space-xs); font-size: 14px; color: var(--ds-ink-muted); }
.ds-provider-state > .bx { font-size: 18px; }
.ds-provider-card.is-ready .ds-provider-state { color: var(--ds-ink); }
.ds-provider-card.is-ready .ds-provider-state > .bx { color: var(--ds-success); }
.ds-provider-card.is-warning .ds-provider-state > .bx { color: var(--ds-warning); }
.ds-provider-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: var(--ds-space-sm); border-top: 1px solid var(--ds-hairline-soft); }

/* Voice calls: the call popup (every admin page) */
.ds-call { position: fixed; right: var(--ds-space-lg); bottom: var(--ds-space-lg); z-index: 1090; width: 320px; max-width: calc(100vw - 32px); padding: var(--ds-space-md); border: 1px solid var(--ds-hairline); border-radius: var(--ds-radius-lg, 12px); background: var(--ds-surface-1); box-shadow: var(--ds-card-shadow); }
.ds-call.is-ringing { border-color: var(--ds-primary); animation: ds-call-pulse 1.6s ease-in-out infinite; }
.ds-call.is-active { border-color: var(--ds-success); }
@keyframes ds-call-pulse { 0%, 100% { box-shadow: var(--ds-card-shadow), 0 0 0 0 var(--ds-primary-soft); } 50% { box-shadow: var(--ds-card-shadow), 0 0 0 8px var(--ds-primary-soft); } }
.ds-call-head { display: flex; align-items: center; gap: var(--ds-space-sm); }
.ds-call-avatar { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: var(--ds-primary-soft); color: var(--ds-primary); font-weight: 500; }
.ds-call-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ds-call-name { font-size: 16px; font-weight: 500; color: var(--ds-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-call-sub { font-size: 13px; color: var(--ds-ink-muted); }
.ds-call-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--ds-space-xs); margin-top: var(--ds-space-md); }
.ds-call-actions:empty { display: none; }
.ds-call-actions .is-muted { border-color: var(--ds-warning); color: var(--ds-warning); }
.ds-call-help { margin-top: var(--ds-space-sm); padding-top: var(--ds-space-sm); border-top: 1px solid var(--ds-hairline-soft); }
.ds-call-help summary { font-size: 13px; color: var(--ds-primary); cursor: pointer; }
.ds-call-help ul { margin-top: var(--ds-space-xs); padding-left: var(--ds-space-md); }
@media (prefers-reduced-motion: reduce) { .ds-call.is-ringing { animation: none; } }

/* Voice calls: the "On call" bar on every page */
.ds-call.is-bar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ds-space-sm); width: auto; max-width: min(640px, calc(100vw - 32px)); padding: var(--ds-space-sm) var(--ds-space-md); }
.ds-call.is-bar .ds-call-avatar { width: 36px; height: 36px; font-size: 13px; }
.ds-call.is-bar .ds-call-head { flex: 1 1 auto; min-width: 0; }
.ds-call.is-bar .ds-call-name { font-size: 14px; }
.ds-call.is-bar .ds-call-sub { color: var(--ds-success-text); font-variant-numeric: tabular-nums; }
.ds-call.is-bar .ds-call-actions { margin-top: 0; }
@media (max-width: 575.98px) { .ds-call.is-bar .ds-call-actions { width: 100%; } }
/* The bar can be dragged away from what it covers (e.g. the Send button) */
.ds-call-grip { display: none; }
.ds-call.is-bar { cursor: grab; touch-action: none; user-select: none; }
.ds-call.is-bar.is-dragging { cursor: grabbing; }
.ds-call.is-bar .ds-call-grip { display: inline-flex; flex: 0 0 auto; margin-left: calc(-1 * var(--ds-space-xxs)); color: var(--ds-ink-subtle); font-size: 18px; }
.ds-call.is-bar .ds-call-actions .ds-btn { cursor: pointer; }

/* Voice calls: the call window */
.ds-call-window { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: var(--ds-space-md); background: var(--ds-canvas); }
.ds-call-window-card { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 360px; padding: var(--ds-space-xl) var(--ds-space-lg); border-radius: var(--ds-radius-md); background: var(--ds-surface-1); box-shadow: var(--ds-card-shadow); text-align: center; }
.ds-call-window-avatar { display: inline-flex; align-items: center; justify-content: center; width: 96px; height: 96px; margin-bottom: var(--ds-space-md); border-radius: 50%; overflow: hidden; background: var(--ds-primary-soft); color: var(--ds-primary); font-size: 32px; font-weight: 500; }
.ds-call-window-avatar img { width: 100%; height: 100%; object-fit: cover; }
#callApp[data-state="calling"] .ds-call-window-avatar, #callApp[data-state="connecting"] .ds-call-window-avatar { animation: ds-call-pulse 1.6s ease-in-out infinite; }
.ds-call-window-name { font-size: 22px; font-weight: 500; color: var(--ds-ink); }
.ds-call-window-platform { font-size: 13px; color: var(--ds-ink-muted); }
.ds-call-window-status { min-height: 24px; margin: var(--ds-space-md) 0 var(--ds-space-lg); font-size: 15px; color: var(--ds-ink-body); font-variant-numeric: tabular-nums; }
#callApp[data-state="active"] .ds-call-window-status { color: var(--ds-success-text); font-weight: 500; }
.ds-call-window-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--ds-space-xs); }
.ds-call-window-actions .is-muted { border-color: var(--ds-warning); color: var(--ds-warning); }
.ds-call-window-hint { margin: var(--ds-space-lg) 0 0; font-size: 12px; color: var(--ds-ink-subtle); }
@media (prefers-reduced-motion: reduce) { #callApp .ds-call-window-avatar { animation: none !important; } }

/* New customer message alert (every page except the Inbox) */
.ds-msg-alerts { position: fixed; right: var(--ds-space-lg); bottom: var(--ds-space-lg); z-index: 1085; display: flex; flex-direction: column; gap: var(--ds-space-xs); width: 320px; max-width: calc(100vw - 32px); pointer-events: none; }
body:has(.ds-call:not([hidden])) .ds-msg-alerts { bottom: calc(var(--ds-space-lg) + 160px); }
.ds-msg-alert { display: flex; align-items: center; gap: var(--ds-space-sm); padding: var(--ds-space-sm); border: 1px solid var(--ds-hairline); border-left: 3px solid var(--ds-primary); border-radius: var(--ds-radius-md); background: var(--ds-surface-1); box-shadow: var(--ds-card-shadow); color: var(--ds-ink); text-decoration: none; pointer-events: auto; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.ds-msg-alert.is-in { opacity: 1; transform: none; }
.ds-msg-alert:hover { border-color: var(--ds-primary); color: var(--ds-ink); }
.ds-msg-alert-avatar { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ds-primary-soft); color: var(--ds-primary); font-size: 14px; font-weight: 500; }
.ds-msg-alert-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ds-msg-alert-platform { position: absolute; right: -2px; bottom: -2px; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 2px solid var(--ds-surface-1); border-radius: 50%; background: var(--ds-primary); color: var(--ds-surface-1); font-size: 11px; }
.ds-msg-alert-platform.is-whatsapp { background: var(--ds-success); }
.ds-msg-alert-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ds-msg-alert-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-msg-alert-text { font-size: 13px; color: var(--ds-ink-body); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ds-msg-alert-more { font-size: 12px; color: var(--ds-primary); }
@media (prefers-reduced-motion: reduce) { .ds-msg-alert { transition: none; } }

/* Panel assistant (AI): top bar button + chat panel */
.ds-assistant-launcher { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--ds-accent-soft); border-radius: 50%; background: var(--ds-accent-soft); color: var(--ds-accent); font-size: 22px; overflow: hidden; cursor: pointer; transition: border-color .15s; }
.ds-assistant-launcher:hover, .ds-assistant-launcher:focus-visible { border-color: var(--ds-accent); }
.ds-assistant-launcher img { width: 100%; height: 100%; object-fit: cover; }
.ds-assistant.offcanvas { width: 420px; max-width: 100vw; display: flex; flex-direction: column; background: var(--ds-canvas); }
.ds-assistant-head { display: flex; align-items: center; gap: var(--ds-space-sm); padding: var(--ds-space-md); border-bottom: 1px solid var(--ds-hairline); background: var(--ds-surface-1); }
.ds-assistant-name { font-size: 16px; font-weight: 500; color: var(--ds-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-assistant-face { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--ds-accent-soft); color: var(--ds-accent); font-size: 22px; }
.ds-assistant-face img { width: 100%; height: 100%; object-fit: cover; }
.ds-assistant-face.is-sm { width: 32px; height: 32px; font-size: 16px; }
.ds-assistant-setup { padding: var(--ds-space-lg) var(--ds-space-md); overflow-y: auto; }
.ds-assistant-avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--ds-space-sm); }
.ds-assistant-avatar-option { position: relative; cursor: pointer; }
.ds-assistant-avatar-option input { position: absolute; opacity: 0; }
.ds-assistant-avatar-option img { display: block; width: 100%; aspect-ratio: 1; border: 2px solid transparent; border-radius: 50%; transition: border-color .15s, transform .15s; }
.ds-assistant-avatar-option:hover img { transform: scale(1.04); }
.ds-assistant-avatar-option input:checked + img { border-color: var(--ds-accent); }
.ds-assistant-avatar-option input:focus-visible + img { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.ds-assistant-chat { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.ds-assistant-messages { flex: 1 1 auto; overflow-y: auto; padding: var(--ds-space-md); display: flex; flex-direction: column; gap: var(--ds-space-sm); }
.ds-assistant-msg { display: flex; align-items: flex-end; gap: var(--ds-space-xs); max-width: 92%; }
.ds-assistant-msg.is-user { align-self: flex-end; }
.ds-assistant-bubble { min-width: 0; padding: var(--ds-space-sm) var(--ds-space-md); border-radius: var(--ds-radius-lg); background: var(--ds-surface-1); border: 1px solid var(--ds-hairline-soft); color: var(--ds-ink-body); font-size: 14px; line-height: 1.5; }
.ds-assistant-msg.is-user .ds-assistant-bubble { background: var(--ds-primary-tint); border-color: var(--ds-primary-soft); color: var(--ds-ink); }
.ds-assistant-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ds-assistant-time { margin-top: var(--ds-space-xxs); font-size: 11px; color: var(--ds-ink-subtle); }
.ds-assistant-thinking .ds-assistant-bubble { color: var(--ds-ink-muted); }
.ds-assistant-links { display: flex; flex-wrap: wrap; gap: var(--ds-space-xs); margin-top: var(--ds-space-sm); }
.ds-assistant-card { margin-top: var(--ds-space-sm); padding: var(--ds-space-sm); border: 1px solid var(--ds-accent-soft); border-left: 3px solid var(--ds-accent); border-radius: var(--ds-radius-md); background: var(--ds-surface-1); }
.ds-assistant-card-title { margin-bottom: var(--ds-space-xs); font-weight: 500; color: var(--ds-ink); }
.ds-assistant-card-actions { display: flex; justify-content: flex-end; gap: var(--ds-space-xs); margin-top: var(--ds-space-sm); }
.ds-assistant-secret .ds-caption { margin-top: var(--ds-space-xxs); }
.ds-assistant-composer { display: flex; align-items: flex-end; gap: var(--ds-space-xs); padding: var(--ds-space-sm) var(--ds-space-md) var(--ds-space-md); border-top: 1px solid var(--ds-hairline); background: var(--ds-surface-1); }
.ds-assistant-composer textarea { min-height: 44px; max-height: 160px; resize: none; }
.ds-assistant-send { flex: 0 0 auto; min-width: 44px; height: 44px; padding: 0; justify-content: center; font-size: 18px; }
@media (prefers-reduced-motion: reduce) { .ds-assistant-avatar-option img { transition: none; } }

/* Orders: details list in the orders table */
.ds-order-details { display: grid; grid-template-columns: max-content 1fr; gap: var(--ds-space-xxs) var(--ds-space-sm); font-size: 13px; }
.ds-order-details dt { font-weight: 500; color: var(--ds-ink-muted); }
.ds-order-details dd { margin: 0; color: var(--ds-ink-body); overflow-wrap: anywhere; }

/* Reports: period picker, charts, share lists */
.ds-period { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-xs); }
.ds-period .form-select, .ds-period .form-control { width: auto; min-width: 160px; }
.ds-chart { min-height: 280px; }
.ds-chart-sm { min-height: 220px; }
.ds-stat-change { font-size: 13px; color: var(--ds-ink-muted); }
.ds-stat-change.is-up { color: var(--ds-success); }
.ds-stat-change.is-down { color: var(--ds-error); }
.ds-share { display: block; width: 100%; height: 6px; margin-top: var(--ds-space-xxs); border: 0; border-radius: var(--ds-radius-xs, 4px); background: var(--ds-hairline-soft); appearance: none; overflow: hidden; }
.ds-share::-webkit-progress-bar { background: var(--ds-hairline-soft); }
.ds-share::-webkit-progress-value { background: var(--ds-primary); }
.ds-share::-moz-progress-bar { background: var(--ds-primary); }
.ds-dash-link { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-md); padding: var(--ds-space-sm) var(--ds-space-lg); border-top: 1px solid var(--ds-hairline-soft); color: var(--ds-ink-body); }
.ds-dash-link:hover { background: var(--ds-primary-tint); color: var(--ds-ink-body); }
.ds-dash-link .ds-stat-value { font-size: 20px; }

/* Web installer */
.ds-install { background: var(--ds-canvas); }
.ds-install-wrap { max-width: 560px; margin: 0 auto; padding: var(--ds-space-xxl) var(--ds-space-md); }
.ds-install-brand { display: flex; align-items: center; gap: var(--ds-space-xs); margin-bottom: var(--ds-space-lg); font-size: 22px; font-weight: 500; color: var(--ds-ink); }
.ds-install-brand .bx { color: var(--ds-primary); font-size: 28px; }
.ds-install-steps { display: flex; flex-wrap: wrap; gap: var(--ds-space-xs) var(--ds-space-md); margin: 0 0 var(--ds-space-md); padding: 0; list-style: none; font-size: 13px; color: var(--ds-ink-subtle); }
.ds-install-steps .is-done { color: var(--ds-ink-muted); }
.ds-install-steps .is-current { color: var(--ds-primary); font-weight: 500; }
.ds-install-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--ds-space-xs) var(--ds-space-md); margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--ds-ink-body); }
.ds-install-checks li { display: flex; align-items: center; gap: var(--ds-space-xs); }
.ds-install-checks .is-ok .bx { color: var(--ds-success); }
.ds-install-checks .is-fail { color: var(--ds-error); }
