/**
 * Denoma CRM — shared UI components (badges, pills, data tables)
 * Depends on tokens.css. Load after brutal-design-clean.css so soft badges win.
 */

/* ═══════════════════════════════════════════
   Status / soft badges (единый вид по всей системе)
   ═══════════════════════════════════════════ */

.status-badge,
.dn-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.7rem;
    border-radius: var(--badge-radius, 8px);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
    user-select: none;
    white-space: nowrap;
    vertical-align: middle;
}

.status-badge .bi-chevron-down,
.dn-badge .bi-chevron-down {
    font-size: 0.62rem;
    opacity: 0.75;
}

/* Soft semantic variants — text color MUST beat brutal white !important */
.status-badge,
.status-badge *,
.dn-badge,
.dn-badge *,
.status-pending, .status-pending *,
.status-processing, .status-processing *,
.status-completed, .status-completed *,
.status-confirmed, .status-confirmed *,
.status-paid, .status-paid *,
.status-cancelled, .status-cancelled *,
.status-on-hold, .status-on-hold *,
.status-hold, .status-hold *,
.pill-on-hold, .pill-on-hold *,
.pill-hold, .pill-hold *,
.status-refunded, .status-refunded *,
.status-failed, .status-failed *,
.status-trash, .status-trash *,
.status-draft, .status-draft *,
.status-open, .status-open *,
.status-closed, .status-closed *,
.status-enabled, .status-enabled *,
.status-disabled, .status-disabled *,
.status-active, .status-active *,
.status-inactive, .status-inactive *,
.status-new, .status-new *,
.status-shipping, .status-shipping *,
.badge-open, .badge-open *,
.badge-closed, .badge-closed * {
    color: inherit !important;
}

.status-pending,
.status-draft {
    background: var(--status-pending-bg);
    color: var(--status-pending-fg) !important;
    border-color: var(--status-pending-border);
}

.status-processing,
.status-active,
.status-enabled,
.status-shipping {
    background: var(--status-processing-bg);
    color: var(--status-processing-fg) !important;
    border-color: var(--status-processing-border);
}

.status-completed,
.status-confirmed,
.status-open,
.status-paid,
.badge-open {
    background: var(--status-completed-bg);
    color: var(--status-completed-fg) !important;
    border-color: var(--status-completed-border);
}

.status-cancelled,
.status-failed,
.status-disabled {
    background: var(--status-cancelled-bg);
    color: var(--status-cancelled-fg) !important;
    border-color: var(--status-cancelled-border);
}

.status-on-hold,
.status-hold,
.status-closed,
.status-inactive,
.status-trash,
.badge-closed,
.stat-pill.pill-on-hold,
.stat-pill.pill-hold,
.dn-pill.pill-on-hold,
.dn-pill.pill-hold,
a.stat-pill.status-on-hold,
a.stat-pill.status-hold {
    background: var(--status-hold-bg) !important;
    color: var(--status-hold-fg) !important;
    border-color: var(--status-hold-border) !important;
}

.status-refunded,
.status-new,
.status-transfer {
    background: var(--status-refunded-bg);
    color: var(--status-refunded-fg) !important;
    border-color: var(--status-refunded-border);
}

/* Warehouse transfer modifiers: status-badge.draft / .pending / .in_transit */
.status-badge.draft {
    background: var(--status-pending-bg);
    color: var(--status-pending-fg) !important;
    border-color: var(--status-pending-border);
}
.status-badge.pending {
    background: var(--status-processing-bg);
    color: var(--status-processing-fg) !important;
    border-color: var(--status-processing-border);
}
.status-badge.in_transit {
    background: var(--status-refunded-bg);
    color: var(--status-refunded-fg) !important;
    border-color: var(--status-refunded-border);
}
.status-badge.completed {
    background: var(--status-completed-bg);
    color: var(--status-completed-fg) !important;
    border-color: var(--status-completed-border);
}
.status-badge.cancelled {
    background: var(--status-cancelled-bg);
    color: var(--status-cancelled-fg) !important;
    border-color: var(--status-cancelled-border);
}

/* Compact source / meta tags */
.source-tag,
.dn-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--badge-radius, 8px);
    margin-left: 0.25rem;
    vertical-align: middle;
    background: var(--status-processing-bg);
    color: var(--status-processing-fg) !important;
}

.source-tag.manual,
.dn-tag.manual {
    background: var(--status-completed-bg);
    color: var(--status-completed-fg) !important;
}

.dn-tag.soon {
    background: var(--status-hold-bg);
    color: var(--status-hold-fg) !important;
}

/* ═══════════════════════════════════════════
   Filter pills (stat filters)
   ═══════════════════════════════════════════ */

.stat-pills,
.dn-pills {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.stat-pill,
.dn-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.7rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    color: inherit;
}

.stat-pill:hover,
.dn-pill:hover {
    opacity: 0.9;
    text-decoration: none;
}

.stat-pill strong,
.dn-pill strong {
    font-weight: 700;
}

.pill-all { background: #e5e7eb; color: #374151; border-color: #d1d5db; }
.pill-all.active { background: var(--color-shell); color: #fff !important; border-color: var(--color-shell); }

.pill-pending { background: var(--status-pending-bg); color: var(--status-pending-fg); border-color: var(--status-pending-border); }
.pill-pending.active { background: #d97706; color: #fff !important; border-color: #d97706; }

.pill-processing { background: var(--status-processing-bg); color: var(--status-processing-fg); border-color: var(--status-processing-border); }
.pill-processing.active { background: #2563eb; color: #fff !important; border-color: #2563eb; }

.pill-completed { background: var(--status-completed-bg); color: var(--status-completed-fg); border-color: var(--status-completed-border); }
.pill-completed.active { background: var(--accent-success-strong); color: #fff !important; border-color: var(--accent-success-strong); }

.pill-cancelled { background: var(--status-cancelled-bg); color: var(--status-cancelled-fg); border-color: var(--status-cancelled-border); }
.pill-cancelled.active { background: var(--accent-danger-strong); color: #fff !important; border-color: var(--accent-danger-strong); }

.pill-paid { background: var(--status-completed-bg); color: var(--status-completed-fg); border-color: var(--status-completed-border); }
.pill-paid.active { background: var(--accent-success-strong); color: #fff !important; border-color: var(--accent-success-strong); }

.pill-on-hold,
.pill-hold { background: var(--status-hold-bg) !important; color: var(--status-hold-fg) !important; border-color: var(--status-hold-border) !important; }
.pill-on-hold.active,
.pill-hold.active { background: var(--status-hold-fg) !important; color: #fff !important; border-color: var(--status-hold-fg) !important; }

.pill-refunded { background: var(--status-refunded-bg); color: var(--status-refunded-fg); border-color: var(--status-refunded-border); }
.pill-refunded.active { background: var(--status-refunded-fg); color: #fff !important; border-color: var(--status-refunded-fg); }

.pill-failed { background: var(--status-cancelled-bg); color: var(--status-cancelled-fg); border-color: var(--status-cancelled-border); }
.pill-failed.active { background: var(--accent-danger-strong); color: #fff !important; border-color: var(--accent-danger-strong); }

.pill-new { background: var(--status-refunded-bg); color: var(--status-refunded-fg); border-color: var(--status-refunded-border); }
.pill-new.active { background: #7c3aed; color: #fff !important; border-color: #7c3aed; }

.pill-all.active *,
.pill-pending.active *,
.pill-processing.active *,
.pill-completed.active *,
.pill-cancelled.active *,
.pill-paid.active *,
.pill-on-hold.active *,
.pill-hold.active *,
.pill-refunded.active *,
.pill-failed.active *,
.pill-new.active * {
    color: #fff !important;
}

/* ═══════════════════════════════════════════
   Data table (list pages)
   ═══════════════════════════════════════════ */

.dn-table,
.orders-table {
    background: var(--bg-card);
    border: 1px solid var(--border-table, #dde3e2);
    border-radius: var(--radius-lg, 12px);
    overflow: visible;
}

.dn-table table,
.orders-table table {
    margin: 0;
    width: 100%;
}

.dn-table thead th,
.orders-table thead th {
    background: var(--bg-table-head, #f1f5f4);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-table-head, #5a7270);
    padding: 0.55rem 0.85rem;
    border-bottom: 2px solid var(--border-table-strong, #d0d9d8);
    font-weight: 700;
}

.dn-table td,
.orders-table td {
    padding: 0.5rem 0.85rem;
    vertical-align: middle;
    font-size: 0.86rem;
    border-bottom: 1px solid var(--border-table-row, #eef1f0);
    color: var(--text-primary);
}

.dn-table tr:last-child td,
.orders-table tr:last-child td {
    border-bottom: none;
}

.dn-table tbody tr:hover td,
.orders-table tbody tr:hover td {
    background: var(--bg-table-hover, #f6faf9);
}

/* ═══════════════════════════════════════════
   Page content surface
   ═══════════════════════════════════════════ */

.dn-page-body,
.orders-body {
    padding: 0.85rem 1rem;
    background: var(--bg-page-soft, #f1f5f4);
    min-height: calc(100vh - var(--page-header-height));
}

.dn-filters-row,
.filters-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.45rem 0.65rem;
    background: var(--bg-card);
    border: 1px solid var(--border-table, #dde3e2);
    margin-bottom: 0.5rem;
}

/* Colored status <select> in sidebars */
select.status-pending { background: var(--status-pending-bg); color: var(--status-pending-fg) !important; font-weight: 700; }
select.status-processing { background: var(--status-processing-bg); color: var(--status-processing-fg) !important; font-weight: 700; }
select.status-completed { background: var(--status-completed-bg); color: var(--status-completed-fg) !important; font-weight: 700; }
select.status-cancelled { background: var(--status-cancelled-bg); color: var(--status-cancelled-fg) !important; font-weight: 700; }
select.status-on-hold { background: var(--status-hold-bg); color: var(--status-hold-fg) !important; font-weight: 700; }
select.status-refunded { background: var(--status-refunded-bg); color: var(--status-refunded-fg) !important; font-weight: 700; }

/* ═══════════════════════════════════════════
   Shared right sidebars (orders + settings offcanvas)
   ═══════════════════════════════════════════ */

.dn-sidebar,
.settings-sidebar,
.settings-sidebar-wide,
.user-edit-sidebar,
.order-sidebar {
    --dn-sidebar-width: 640px;
}

.settings-sidebar-wide {
    --dn-sidebar-width: min(900px, 92vw);
}

.order-sidebar.order-sidebar-wide {
    --dn-sidebar-width: 60%;
}

.settings-sidebar,
.settings-sidebar-wide,
.user-edit-sidebar {
    --bs-offcanvas-width: var(--dn-sidebar-width);
    width: var(--dn-sidebar-width) !important;
    max-width: 100vw !important;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    border-left: none;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}

.order-sidebar {
    width: var(--dn-sidebar-width);
    max-width: 100vw;
}

.dn-sidebar-head,
.order-sidebar-head,
.psb-head,
.crm-panel-header {
    background: linear-gradient(90deg, var(--color-shell) 0%, var(--color-shell-mid) 100%) !important;
    color: var(--color-on-brand) !important;
    padding: 0.85rem 1.25rem !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: none !important;
    gap: 0.75rem;
    min-height: var(--page-header-height, 50px);
    box-sizing: border-box;
}

.settings-sidebar .offcanvas-header,
.settings-sidebar-wide .offcanvas-header,
.user-edit-sidebar .offcanvas-header {
    background: linear-gradient(90deg, var(--color-shell) 0%, var(--color-shell-mid) 100%) !important;
    color: var(--color-on-brand) !important;
    padding: 0.85rem 1.25rem !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: none !important;
    gap: 0.75rem;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

.dn-sidebar-head *,
.order-sidebar-head *,
.crm-panel-header *,
.settings-sidebar .offcanvas-header *,
.settings-sidebar-wide .offcanvas-header *,
.user-edit-sidebar .offcanvas-header *,
.dn-sidebar-head h5,
.order-sidebar-head h5,
.settings-sidebar .offcanvas-title,
.settings-sidebar-wide .offcanvas-title,
.user-edit-sidebar .offcanvas-title {
    color: var(--color-on-brand) !important;
}

.dn-sidebar-head h5,
.order-sidebar-head h5,
.settings-sidebar .offcanvas-title,
.settings-sidebar-wide .offcanvas-title,
.user-edit-sidebar .offcanvas-title {
    margin: 0;
    font-weight: 700;
    font-size: 0.97rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.settings-sidebar .offcanvas-header .btn-close,
.settings-sidebar-wide .offcanvas-header .btn-close,
.user-edit-sidebar .offcanvas-header .btn-close {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    opacity: 1 !important;
    filter: invert(1) grayscale(100%) brightness(200%);
}

.settings-sidebar .offcanvas-header .ds-btn-close,
.settings-sidebar-wide .offcanvas-header .ds-btn-close,
.user-edit-sidebar .offcanvas-header .ds-btn-close {
    margin-left: 0.35rem;
}

/* List-row icon actions (edit / delete / toggle) — light panels */
.dn-sb-icon,
.settings-sidebar .btn-sm.btn-outline-primary,
.settings-sidebar-wide .btn-sm.btn-outline-primary,
.settings-sidebar .btn-sm.btn-outline-danger,
.settings-sidebar-wide .btn-sm.btn-outline-danger,
.settings-sidebar .btn-sm.btn-outline-warning,
.settings-sidebar-wide .btn-sm.btn-outline-warning,
.settings-sidebar .btn-sm.btn-outline-success,
.settings-sidebar-wide .btn-sm.btn-outline-success,
.settings-sidebar .btn-group-sm > .btn.btn-outline-primary,
.settings-sidebar-wide .btn-group-sm > .btn.btn-outline-primary,
.settings-sidebar .btn-group-sm > .btn.btn-outline-danger,
.settings-sidebar-wide .btn-group-sm > .btn.btn-outline-danger,
.user-edit-sidebar .btn-sm.btn-outline-primary,
.user-edit-sidebar .btn-sm.btn-outline-danger {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-size: 0.9rem !important;
    line-height: 1 !important;
}

.settings-sidebar .btn-sm.btn-outline-primary,
.settings-sidebar-wide .btn-sm.btn-outline-primary,
.settings-sidebar .btn-group-sm > .btn.btn-outline-primary,
.settings-sidebar-wide .btn-group-sm > .btn.btn-outline-primary,
.user-edit-sidebar .btn-sm.btn-outline-primary {
    background: #fff !important;
    border: 1px solid var(--color-shell, #0f172a) !important;
    color: var(--color-shell, #0f172a) !important;
}

.settings-sidebar .btn-sm.btn-outline-primary:hover,
.settings-sidebar-wide .btn-sm.btn-outline-primary:hover,
.settings-sidebar .btn-group-sm > .btn.btn-outline-primary:hover,
.settings-sidebar-wide .btn-group-sm > .btn.btn-outline-primary:hover,
.user-edit-sidebar .btn-sm.btn-outline-primary:hover {
    background: var(--color-shell, #0f172a) !important;
    color: #fff !important;
}

.settings-sidebar .btn-sm.btn-outline-danger,
.settings-sidebar-wide .btn-sm.btn-outline-danger,
.settings-sidebar .btn-group-sm > .btn.btn-outline-danger,
.settings-sidebar-wide .btn-group-sm > .btn.btn-outline-danger,
.user-edit-sidebar .btn-sm.btn-outline-danger {
    background: rgba(220, 38, 38, 0.1) !important;
    border: 1px solid rgba(220, 38, 38, 0.45) !important;
    color: #b91c1c !important;
}

.settings-sidebar .btn-sm.btn-outline-danger:hover,
.settings-sidebar-wide .btn-sm.btn-outline-danger:hover,
.settings-sidebar .btn-group-sm > .btn.btn-outline-danger:hover,
.settings-sidebar-wide .btn-group-sm > .btn.btn-outline-danger:hover {
    background: rgba(220, 38, 38, 0.85) !important;
    color: #fff !important;
}

.settings-sidebar .btn-sm.btn-outline-warning,
.settings-sidebar-wide .btn-sm.btn-outline-warning {
    background: var(--status-pending-bg, #fef3c7) !important;
    border: 1px solid var(--status-pending-border, #fcd34d) !important;
    color: var(--status-pending-fg, #92400e) !important;
}

.settings-sidebar .btn-sm.btn-outline-warning:hover,
.settings-sidebar-wide .btn-sm.btn-outline-warning:hover {
    background: #f59e0b !important;
    color: #fff !important;
}

.settings-sidebar .btn-sm.btn-outline-success,
.settings-sidebar-wide .btn-sm.btn-outline-success {
    background: var(--status-completed-bg, #dcfce7) !important;
    border: 1px solid var(--status-completed-border, #86efac) !important;
    color: var(--status-completed-fg, #15803d) !important;
}

.settings-sidebar .btn-sm.btn-outline-success:hover,
.settings-sidebar-wide .btn-sm.btn-outline-success:hover {
    background: var(--accent-success, #16a34a) !important;
    color: #fff !important;
}

.settings-sidebar .btn-sm.btn-outline-primary i,
.settings-sidebar-wide .btn-sm.btn-outline-primary i,
.settings-sidebar .btn-sm.btn-outline-danger i,
.settings-sidebar-wide .btn-sm.btn-outline-danger i,
.settings-sidebar .btn-sm.btn-outline-warning i,
.settings-sidebar-wide .btn-sm.btn-outline-warning i,
.settings-sidebar .btn-sm.btn-outline-success i,
.settings-sidebar-wide .btn-sm.btn-outline-success i {
    color: inherit !important;
    font-size: 0.95rem !important;
}

/* Product edit sidebar footer uses .sb-btn-* already; scope save override for #sbSaveBtn */
#editProductSidebar .sb-btn-save,
#editProductSidebar .sb-btn-cancel {
    min-height: 36px;
}

.dn-sidebar-body,
.order-sidebar-body,
.settings-sidebar .offcanvas-body,
.settings-sidebar-wide .offcanvas-body,
.user-edit-sidebar .offcanvas-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding: 1.25rem;
    background: #fff;
}

.settings-sidebar .offcanvas-body.p-0,
.settings-sidebar-wide .offcanvas-body.p-0 {
    padding: 0 !important;
}

.dn-sidebar-foot,
.order-sidebar-foot,
.settings-sidebar-footer,
.user-edit-sidebar-footer,
.crm-panel-footer {
    flex-shrink: 0;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
}

#moneyDocSidebar .settings-sidebar-footer {
    flex-wrap: nowrap;
    justify-content: flex-end;
}
#moneyDocSidebar .settings-sidebar-footer .dn-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.dn-profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 1079;
    background: rgba(15, 23, 42, 0.45);
}
.dn-profile-overlay[hidden] {
    display: none !important;
}

.dn-sidebar.dn-profile,
.dn-sidebar.dn-ai-chat {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1080;
    width: var(--dn-sidebar-width, 640px);
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-card, #fff);
    color: var(--text-primary);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}
.dn-sidebar.dn-profile[hidden],
.dn-sidebar.dn-ai-chat[hidden] {
    display: none !important;
}

.dn-sidebar.dn-ai-chat .dn-ai-chat-log {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    background: var(--bg-subtle);
}
.dn-ai-msg {
    max-width: 92%;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
.dn-ai-msg.is-bot {
    align-self: flex-start;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.dn-ai-msg.is-user {
    align-self: flex-end;
    background: var(--color-shell);
    color: var(--color-on-brand);
}
.dn-ai-msg.is-wait {
    color: var(--text-muted);
}
.dn-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    max-width: 100%;
}
.dn-sidebar.dn-ai-chat .dn-ai-chat-foot {
    align-items: flex-end;
    justify-content: stretch;
    flex-wrap: nowrap;
}
.dn-sidebar.dn-ai-chat .dn-ai-chat-foot textarea {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    min-height: 44px;
    max-height: 120px;
    margin: 0;
    padding: 0.55rem 0.7rem;
    resize: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    background: #fff;
}
.dn-sidebar.dn-ai-chat .dn-ai-chat-foot .dn-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.dn-profile-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.dn-profile-photo-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.dn-profile-photo-btn {
    width: 72px;
    height: 72px;
    padding: 0;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-shell);
    color: var(--color-on-brand);
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dn-profile-photo-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.dn-profile-photo-fallback {
    font-weight: 700;
    font-size: 1.35rem;
    line-height: 1;
    color: var(--color-on-brand);
}
.dn-profile-photo-acts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}
.dn-profile-photo-hint,
.dn-profile-login {
    width: 100%;
    margin: 0.15rem 0 0;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.dn-profile .dn-sidebar-body .form-label {
    display: block;
    margin: 0.85rem 0 0.3rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}
.dn-profile .dn-sidebar-body .form-control {
    color: var(--text-primary);
    background: #fff;
}
.dn-profile-error {
    margin-top: 0.85rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-danger-strong, #b91c1c);
}

.dn-sidebar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    background: var(--bg-page-soft, #f1f5f4);
    border-bottom: 1px solid var(--border-table, #dde3e2);
    flex-shrink: 0;
}

.dn-sidebar-toolbar .toolbar-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-table-head, #5a7270);
}

.dn-list-row {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-table-row, #eef1f0);
    background: #fff;
}

.dn-list-row:hover {
    background: var(--bg-table-hover, #f6faf9);
}

.dn-list-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    background: var(--color-brand-dark);
}

.dn-list-main {
    flex: 1 1 auto;
    min-width: 0;
}

.dn-list-title {
    font-weight: 600;
    color: var(--text-primary);
}

.dn-list-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dn-list-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.dn-list-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
}

.settings-sidebar-list {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.sb-card {
    background: #f8fafc;
    border: 1px solid #e0e6e5;
    border-radius: 0;
    padding: 0.85rem 1rem;
}

.sb-card-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 0.6rem;
}

/* ═══════════════════════════════════════════
   Shared sidebar buttons (documents / clients / settings)
   Header (on brand): ghost white · Footer: primary / cancel
   ═══════════════════════════════════════════ */

.dn-sb-btn,
.ds-btn-hdr,
.btn-ph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-sm, 4px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-on-brand, #fff) !important;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.dn-sb-btn i,
.ds-btn-hdr i,
.btn-ph i,
.dn-sb-btn *,
.ds-btn-hdr *,
.btn-ph * {
    color: inherit !important;
}

.dn-sb-btn:hover,
.ds-btn-hdr:hover,
.btn-ph:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.55);
    color: var(--color-on-brand, #fff) !important;
}

.dn-sb-btn:active,
.ds-btn-hdr:active,
.btn-ph:active {
    transform: scale(0.97);
}

.dn-sb-btn--danger,
.ds-btn-hdr--danger {
    background: rgba(220, 38, 38, 0.45) !important;
    border-color: rgba(254, 202, 202, 0.55) !important;
}

.dn-sb-btn--danger:hover,
.ds-btn-hdr--danger:hover {
    background: rgba(220, 38, 38, 0.65) !important;
}

.dn-sb-btn--save,
.ds-btn-hdr--save {
    background: var(--ds-save, var(--accent-success, #16a34a)) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #fff !important;
}

.dn-sb-btn--save:hover,
.ds-btn-hdr--save:hover {
    background: var(--ds-save-hover, #15803d) !important;
    color: #fff !important;
}

.dn-sb-btn--save:disabled,
.ds-btn-hdr--save:disabled {
    opacity: 0.7;
    cursor: wait;
}

.dn-sb-btn--close,
.ds-btn-close,
.ttn-sidebar-close,
.drawer-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    color: var(--color-on-brand, #fff) !important;
    opacity: 1 !important;
    font-size: 1.15rem !important;
    line-height: 1 !important;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    transition: background 0.15s ease;
}

.dn-sb-btn--close i,
.ds-btn-close i,
.ttn-sidebar-close i,
.drawer-close i {
    font-size: 1.15rem !important;
    line-height: 1 !important;
    color: inherit !important;
}

.dn-sb-btn--close:hover,
.ds-btn-close:hover,
.ttn-sidebar-close:hover,
.drawer-close:hover {
    background: rgba(255, 255, 255, 0.28) !important;
}

.dn-sb-btn--close:active,
.ds-btn-close:active,
.ttn-sidebar-close:active,
.drawer-close:active {
    transform: scale(0.95);
}

.ds-hdr-actions,
.crm-panel-acts {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* iOS switch — той самий, що на документах складу / Telegram (компактний 36×20). */
.toggle-switch {
    display: inline-block;
    width: 36px;
    height: 20px;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    vertical-align: middle;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--text-muted);
    border-radius: 20px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
    background: var(--bg-white);
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

/* Footer button colors live in dn-buttons.css (navy primary / white secondary). */

@media (max-width: 768px) {
    .settings-sidebar,
    .settings-sidebar-wide,
    .user-edit-sidebar {
        --dn-sidebar-width: 100vw;
        width: 100vw !important;
        max-width: 100vw !important;
    }
    .order-sidebar.order-sidebar-wide {
        --dn-sidebar-width: 100vw;
    }
    .dn-sidebar.dn-profile,
    .dn-sidebar.dn-ai-chat {
        width: 100vw;
        max-width: 100vw;
    }
}

