/* ==========================================================
   MK Accounts — Design System v2.0
   Modern, Premium SaaS UI inspired by Linear / Vercel / Notion
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── 1. DESIGN TOKENS ─────────────────────────────────────── */
:root {
    /* Brand */
    --ds-primary: #6366f1;
    --ds-primary-dark: #4f46e5;
    --ds-primary-hover: #4338ca;
    --ds-primary-50: #eef2ff;
    --ds-primary-100: #e0e7ff;
    --ds-primary-200: #c7d2fe;
    --ds-primary-500: #6366f1;
    --ds-primary-600: #4f46e5;
    --ds-primary-700: #4338ca;

    /* Status */
    --ds-success: #10b981;
    --ds-success-bg: #ecfdf5;
    --ds-success-text: #065f46;
    --ds-success-border: #a7f3d0;

    --ds-warning: #f59e0b;
    --ds-warning-bg: #fffbeb;
    --ds-warning-text: #92400e;
    --ds-warning-border: #fde68a;

    --ds-danger: #ef4444;
    --ds-danger-bg: #fef2f2;
    --ds-danger-text: #991b1b;
    --ds-danger-border: #fecaca;

    --ds-info: #3b82f6;
    --ds-info-bg: #eff6ff;
    --ds-info-text: #1e40af;
    --ds-info-border: #bfdbfe;

    /* Neutrals — Slate scale */
    --ds-white: #ffffff;
    --ds-gray-50: #f8fafc;
    --ds-gray-100: #f1f5f9;
    --ds-gray-200: #e2e8f0;
    --ds-gray-300: #cbd5e1;
    --ds-gray-400: #94a3b8;
    --ds-gray-500: #64748b;
    --ds-gray-600: #475569;
    --ds-gray-700: #334155;
    --ds-gray-800: #1e293b;
    --ds-gray-900: #0f172a;

    /* Layout */
    --ds-sidebar-w: 240px;
    --ds-topbar-h: 60px;
    --ds-sidebar-bg: #0f172a;
    --ds-content-bg: #f1f5f9;

    /* Typography */
    --ds-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Radius */
    --ds-r-xs: 4px;
    --ds-r-sm: 6px;
    --ds-r: 8px;
    --ds-r-md: 10px;
    --ds-r-lg: 12px;
    --ds-r-xl: 16px;
    --ds-r-2xl: 24px;
    --ds-r-full: 9999px;

    /* Shadows */
    --ds-shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
    --ds-shadow: 0 1px 3px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .04);
    --ds-shadow-md: 0 4px 8px rgba(0, 0, 0, .07), 0 2px 4px rgba(0, 0, 0, .04);
    --ds-shadow-lg: 0 12px 24px rgba(0, 0, 0, .09), 0 4px 8px rgba(0, 0, 0, .05);
    --ds-shadow-xl: 0 24px 48px rgba(0, 0, 0, .1), 0 8px 16px rgba(0, 0, 0, .06);
    --ds-shadow-primary: 0 4px 12px rgba(99, 102, 241, .35);

    /* Transitions */
    --ds-t: 200ms cubic-bezier(.4, 0, .2, 1);
    --ds-t-fast: 120ms cubic-bezier(.4, 0, .2, 1);
    --ds-t-slow: 300ms cubic-bezier(.4, 0, .2, 1);
}

/* ── 2. BASE ──────────────────────────────────────────────── */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--ds-font);
    font-size: .9375rem;
    line-height: 1.6;
    color: var(--ds-gray-800);
    background: var(--ds-content-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--ds-primary);
    text-decoration: none;
}

a:hover {
    color: var(--ds-primary-dark);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--ds-font);
    font-weight: 700;
    color: var(--ds-gray-900);
    line-height: 1.3;
    letter-spacing: -.02em;
    margin-top: 0;
}

/* ── 3. APP LAYOUT ────────────────────────────────────────── */
.ds-app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.ds-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--ds-sidebar-w);
    background: var(--ds-sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--ds-t-slow);
    overflow: hidden;
    flex-shrink: 0;
}

/* Main Area */
.ds-main {
    margin-left: var(--ds-sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    transition: margin-left var(--ds-t-slow);
}

/* Topbar */
.ds-topbar {
    position: sticky;
    top: 0;
    height: var(--ds-topbar-h);
    background: var(--ds-white);
    border-bottom: 1px solid var(--ds-gray-200);
    display: flex;
    align-items: center;
    padding: 0 24px;
    justify-content: space-between;
    z-index: 900;
    gap: 16px;
}

/* Content */
.ds-content {
    padding: 24px;
    flex: 1;
}

/* Mobile overlay */
.ds-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.ds-overlay.open {
    display: block;
}

/* ── 4. SIDEBAR HEADER ────────────────────────────────────── */
.ds-sidebar-header {
    padding: 18px 16px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ds-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.ds-logo-mark {
    width: 34px;
    height: 34px;
    background: var(--ds-primary);
    color: white;
    border-radius: var(--ds-r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8125rem;
    font-weight: 700;
    letter-spacing: .03em;
    flex-shrink: 0;
    box-shadow: var(--ds-shadow-primary);
}

.ds-logo-text {
    color: white;
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* ── 5. SIDEBAR NAV ───────────────────────────────────────── */
.ds-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0 16px;
}

.ds-nav::-webkit-scrollbar {
    width: 4px;
}

.ds-nav::-webkit-scrollbar-track {
    background: transparent;
}

.ds-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .12);
    border-radius: var(--ds-r-full);
}

.ds-nav-section {
    padding: 0 10px;
    margin-bottom: 2px;
}

.ds-nav-section+.ds-nav-section {
    margin-top: 6px;
}

.ds-nav-section-label {
    display: block;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, .28);
    padding: 10px 8px 4px;
}

.ds-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--ds-r-md);
    color: rgba(255, 255, 255, .5);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--ds-t-fast), color var(--ds-t-fast);
    margin-bottom: 1px;
    position: relative;
}

.ds-nav-item:hover {
    color: rgba(255, 255, 255, .9);
    background: rgba(255, 255, 255, .07);
    text-decoration: none;
}

.ds-nav-item.active {
    color: #fff;
    background: rgba(99, 102, 241, .22);
}

.ds-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--ds-primary);
    border-radius: 0 3px 3px 0;
}

.ds-nav-icon {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
    flex-shrink: 0;
    color: inherit;
    opacity: .8;
}

.ds-nav-item.active .ds-nav-icon {
    color: #a5b4fc;
    opacity: 1;
}

.ds-nav-text {
    flex: 1;
}

/* Danger nav item */
.ds-nav-item.ds-nav-danger {
    color: rgba(252, 165, 165, .7);
}

.ds-nav-item.ds-nav-danger:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, .1);
}

/* ── 6. SIDEBAR FOOTER ────────────────────────────────────── */
.ds-sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    flex-shrink: 0;
}

.ds-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--ds-r-md);
}

.ds-sidebar-user-avatar {
    width: 32px;
    height: 32px;
    background: var(--ds-primary);
    color: white;
    border-radius: var(--ds-r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8125rem;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
}

.ds-sidebar-user-info {
    min-width: 0;
    flex: 1;
}

.ds-sidebar-user-name {
    color: rgba(255, 255, 255, .85);
    font-size: .8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-sidebar-user-role {
    color: rgba(255, 255, 255, .32);
    font-size: .6875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── 7. TOPBAR ELEMENTS ───────────────────────────────────── */
.ds-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.ds-topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ds-menu-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--ds-r);
    color: var(--ds-gray-500);
    cursor: pointer;
    transition: background var(--ds-t-fast), color var(--ds-t-fast);
    flex-shrink: 0;
}

.ds-menu-btn:hover {
    background: var(--ds-gray-100);
    color: var(--ds-gray-800);
}

.ds-topbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--ds-r);
    color: var(--ds-gray-500);
    cursor: pointer;
    transition: background var(--ds-t-fast), color var(--ds-t-fast);
    position: relative;
}

.ds-topbar-btn:hover {
    background: var(--ds-gray-100);
    color: var(--ds-gray-800);
}

/* User dropdown button */
.ds-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--ds-r-full);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: background var(--ds-t-fast), border-color var(--ds-t-fast);
}

.ds-user-btn:hover {
    background: var(--ds-gray-100);
    border-color: var(--ds-gray-200);
}

.ds-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--ds-r-full);
    background: var(--ds-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8125rem;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
}

.ds-user-info {
    text-align: left;
    display: none;
}

@media (min-width: 576px) {
    .ds-user-info {
        display: block;
    }
}

.ds-user-name {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--ds-gray-800);
    line-height: 1.2;
}

.ds-user-role {
    font-size: .6875rem;
    color: var(--ds-gray-500);
    line-height: 1.2;
}

/* Dropdown */
.ds-dropdown {
    position: relative;
}

.ds-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: var(--ds-r-lg);
    box-shadow: var(--ds-shadow-lg);
    border: 1px solid var(--ds-gray-200);
    min-width: 196px;
    padding: 6px;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(.98);
    transform-origin: top right;
    transition: opacity var(--ds-t-fast), visibility var(--ds-t-fast), transform var(--ds-t-fast);
}

.ds-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ds-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--ds-r);
    color: var(--ds-gray-700);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--ds-t-fast), color var(--ds-t-fast);
    width: 100%;
    border: none;
    background: none;
    text-align: left;
}

.ds-dropdown-item:hover {
    background: var(--ds-gray-50);
    color: var(--ds-gray-900);
    text-decoration: none;
}

.ds-dropdown-item.danger {
    color: var(--ds-danger);
}

.ds-dropdown-item.danger:hover {
    background: var(--ds-danger-bg);
    color: var(--ds-danger-text);
}

.ds-dropdown-item .di-icon {
    width: 16px;
    text-align: center;
    color: var(--ds-gray-400);
    flex-shrink: 0;
}

.ds-dropdown-item:hover .di-icon {
    color: inherit;
}

.ds-dropdown-item.danger .di-icon {
    color: var(--ds-danger);
}

.ds-dropdown-divider {
    height: 1px;
    background: var(--ds-gray-100);
    margin: 4px -6px;
}

.ds-dropdown-header {
    padding: 6px 10px 4px;
    font-size: .75rem;
    font-weight: 600;
    color: var(--ds-gray-400);
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ── 8. PAGE LAYOUT ───────────────────────────────────────── */
.ds-page-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--ds-gray-900);
    letter-spacing: -.025em;
    margin: 0 0 3px;
    line-height: 1.25;
}

.page-subtitle {
    font-size: .875rem;
    color: var(--ds-gray-500);
    margin: 0;
    font-weight: 400;
}

.ds-page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Breadcrumb */
.ds-breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .8125rem;
    color: var(--ds-gray-400);
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.ds-breadcrumb a {
    color: var(--ds-gray-400);
    text-decoration: none;
    transition: color var(--ds-t-fast);
}

.ds-breadcrumb a:hover {
    color: var(--ds-primary);
}

.ds-breadcrumb-sep {
    font-size: .7rem;
    color: var(--ds-gray-300);
}

.ds-breadcrumb-current {
    color: var(--ds-gray-600);
    font-weight: 500;
}

/* ── 9. CARDS ─────────────────────────────────────────────── */
.ds-card {
    background: var(--ds-white);
    border-radius: var(--ds-r-lg);
    box-shadow: var(--ds-shadow);
    border: 1px solid var(--ds-gray-200);
    overflow: hidden;
}

.ds-card-header {
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--ds-gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ds-card-title {
    font-size: .9375rem;
    font-weight: 700;
    color: var(--ds-gray-900);
    margin: 0;
    line-height: 1.3;
}

.ds-card-subtitle {
    font-size: .8125rem;
    color: var(--ds-gray-500);
    margin: 3px 0 0;
    font-weight: 400;
}

.ds-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ds-card-body {
    padding: 20px;
}

.ds-card-body--sm {
    padding: 16px;
}

.ds-card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--ds-gray-100);
    background: var(--ds-gray-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── 10. STAT CARDS ───────────────────────────────────────── */
.ds-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.ds-stat-card {
    background: var(--ds-white);
    border-radius: var(--ds-r-lg);
    padding: 20px;
    box-shadow: var(--ds-shadow);
    border: 1px solid var(--ds-gray-200);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow var(--ds-t), transform var(--ds-t);
}

.ds-stat-card:hover {
    box-shadow: var(--ds-shadow-md);
    transform: translateY(-1px);
}

.ds-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--ds-r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.ds-stat-icon--primary {
    background: var(--ds-primary-50);
    color: var(--ds-primary);
}

.ds-stat-icon--success {
    background: var(--ds-success-bg);
    color: var(--ds-success);
}

.ds-stat-icon--warning {
    background: var(--ds-warning-bg);
    color: var(--ds-warning);
}

.ds-stat-icon--danger {
    background: var(--ds-danger-bg);
    color: var(--ds-danger);
}

.ds-stat-icon--info {
    background: var(--ds-info-bg);
    color: var(--ds-info);
}

.ds-stat-icon--gray {
    background: var(--ds-gray-100);
    color: var(--ds-gray-500);
}

.ds-stat-body {
    flex: 1;
    min-width: 0;
}

.ds-stat-value {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--ds-gray-900);
    line-height: 1.15;
    letter-spacing: -.03em;
}

.ds-stat-label {
    font-size: .8125rem;
    color: var(--ds-gray-500);
    font-weight: 500;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .75rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--ds-r-full);
    margin-top: 4px;
}

.ds-stat-trend--up {
    background: var(--ds-success-bg);
    color: var(--ds-success-text);
}

.ds-stat-trend--down {
    background: var(--ds-danger-bg);
    color: var(--ds-danger-text);
}

.ds-stat-trend--flat {
    background: var(--ds-gray-100);
    color: var(--ds-gray-600);
}

/* ── 11. BUTTONS ──────────────────────────────────────────── */
/* Extend Bootstrap buttons: font, flex layout, transition */
.btn {
    font-family: var(--ds-font);
    font-weight: 500;
    border-radius: var(--ds-r);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all var(--ds-t-fast);
}

.btn-sm {
    border-radius: var(--ds-r-sm);
}

/* Brand color overrides — Bootstrap defaults to blue, we use indigo */
.btn-primary,
.btn-primary:focus {
    background-color: var(--ds-primary);
    border-color: var(--ds-primary);
}

.btn-primary:hover,
.btn-primary:active {
    background-color: var(--ds-primary-dark);
    border-color: var(--ds-primary-dark);
    box-shadow: var(--ds-shadow-primary);
    color: white;
}

.btn-outline-primary {
    color: var(--ds-primary);
    border-color: var(--ds-primary-200);
}

.btn-outline-primary:hover {
    background-color: var(--ds-primary-50);
    color: var(--ds-primary-dark);
    border-color: var(--ds-primary);
}

/* Secondary: white + border (Bootstrap's default is filled gray) */
.btn-secondary {
    background-color: white;
    color: var(--ds-gray-700);
    border-color: var(--ds-gray-300);
    box-shadow: var(--ds-shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--ds-gray-50);
    color: var(--ds-gray-900);
    border-color: var(--ds-gray-400);
}

.btn-outline-secondary {
    background-color: white;
    color: var(--ds-gray-600);
    border-color: var(--ds-gray-200);
}

.btn-outline-secondary:hover {
    background-color: var(--ds-gray-50);
    color: var(--ds-gray-800);
    border-color: var(--ds-gray-300);
}

/* Button size scale — Bootstrap only ships sm/lg, we fill the gaps.
   xs → dense table actions · md → standard table actions / toolbars · xl → hero CTAs */
.btn-xs {
    padding: 3px 8px;
    font-size: .75rem;
    border-radius: var(--ds-r-sm);
    gap: 4px;
}

.btn-md {
    padding: 5px 11px;
    font-size: .8125rem;
    border-radius: var(--ds-r-sm);
}

.btn-xl {
    padding: 14px 28px;
    font-size: 1.0625rem;
    border-radius: var(--ds-r-md);
    font-weight: 600;
}

/* Status colour overrides — align Bootstrap's defaults to the DS palette */
.btn-success,
.btn-success:focus {
    background-color: var(--ds-success);
    border-color: var(--ds-success);
    color: #fff;
}

.btn-success:hover,
.btn-success:active {
    background-color: #0e9f6e;
    border-color: #0e9f6e;
    color: #fff;
}

.btn-danger,
.btn-danger:focus {
    background-color: var(--ds-danger);
    border-color: var(--ds-danger);
    color: #fff;
}

.btn-danger:hover,
.btn-danger:active {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.btn-warning,
.btn-warning:focus {
    background-color: var(--ds-warning);
    border-color: var(--ds-warning);
    color: #fff;
}

.btn-warning:hover,
.btn-warning:active {
    background-color: #d97706;
    border-color: #d97706;
    color: #fff;
}

.btn-outline-danger {
    color: var(--ds-danger);
    border-color: var(--ds-danger-border);
}

.btn-outline-danger:hover {
    background-color: var(--ds-danger-bg);
    color: var(--ds-danger-text);
    border-color: var(--ds-danger);
}

.btn-outline-success {
    color: var(--ds-success);
    border-color: var(--ds-success-border);
}

.btn-outline-success:hover {
    background-color: var(--ds-success-bg);
    color: var(--ds-success-text);
    border-color: var(--ds-success);
}


/* ── 12. FORMS ────────────────────────────────────────────── */
.ds-form-group {
    margin-bottom: 18px;
}

.ds-form-group:last-child {
    margin-bottom: 0;
}

.ds-label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    color: var(--ds-gray-700);
    margin-bottom: 6px;
}

.ds-label .req {
    color: var(--ds-danger);
    margin-left: 2px;
}

.ds-hint {
    font-size: .8125rem;
    color: var(--ds-gray-500);
    margin-top: 5px;
}

.ds-error-msg {
    font-size: .8125rem;
    color: var(--ds-danger);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Inputs use Bootstrap's .form-control / .form-select — styled in §27.
   Invalid state is handled by the shared .is-invalid rule in §18. */

/* Search Input */
.ds-search-wrap {
    position: relative;
}

.ds-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ds-gray-400);
    font-size: .875rem;
    pointer-events: none;
    z-index: 1;
}

/* (.ds-search-input lives in §27 alongside the .form-control styles) */

/* Switch */
.ds-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.ds-switch input[type="checkbox"] {
    width: 36px;
    height: 20px;
    appearance: none;
    background: var(--ds-gray-300);
    border-radius: var(--ds-r-full);
    cursor: pointer;
    position: relative;
    transition: background var(--ds-t-fast);
    flex-shrink: 0;
}

.ds-switch input[type="checkbox"]:checked {
    background: var(--ds-primary);
}

.ds-switch input[type="checkbox"]::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: var(--ds-r-full);
    top: 3px;
    left: 3px;
    transition: transform var(--ds-t-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.ds-switch input[type="checkbox"]:checked::after {
    transform: translateX(16px);
}

.ds-switch-label {
    font-size: .875rem;
    color: var(--ds-gray-700);
    cursor: pointer;
}

/* Checkbox + radio */
.ds-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
    padding: 2px 0;
}

.ds-check input[type="checkbox"],
.ds-check input[type="radio"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--ds-primary);
    cursor: pointer;
}

.ds-check-label {
    font-size: .875rem;
    color: var(--ds-gray-700);
    cursor: pointer;
    line-height: 1.5;
}

/* Form section heading */
.ds-form-section {
    margin-bottom: 28px;
}

.ds-form-section-title {
    font-size: .8125rem;
    font-weight: 700;
    color: var(--ds-gray-400);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ds-gray-100);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Password input with toggle */
.ds-password-wrap {
    position: relative;
}

.ds-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--ds-gray-400);
    cursor: pointer;
    padding: 4px;
    transition: color var(--ds-t-fast);
    z-index: 1;
}

.ds-password-toggle:hover {
    color: var(--ds-gray-700);
}

/* ── 13. TABLES ───────────────────────────────────────────── */
/* Tables use Bootstrap's .table / .table-responsive — styled in §27. */

/* ── 14. TOOLBAR ──────────────────────────────────────────── */
.ds-toolbar {
    padding: 14px 20px;
    border-bottom: 1px solid var(--ds-gray-100);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--ds-gray-50);
}

.ds-toolbar-search {
    flex: 1;
    min-width: 180px;
    max-width: 300px;
}

.ds-toolbar-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ds-toolbar-end {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toolbar filters use .form-select.form-select-sm; keep them auto-width
   (Bootstrap selects are full-width block by default) */
.ds-toolbar-filters .form-select {
    width: auto;
    min-width: 130px;
}

/* ── 15. BADGES ───────────────────────────────────────────── */
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--ds-r-full);
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.ds-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--ds-r-full);
    flex-shrink: 0;
}

.ds-badge--success {
    background: var(--ds-success-bg);
    color: var(--ds-success-text);
}

.ds-badge--success .ds-badge-dot {
    background: var(--ds-success);
}

.ds-badge--warning {
    background: var(--ds-warning-bg);
    color: var(--ds-warning-text);
}

.ds-badge--warning .ds-badge-dot {
    background: var(--ds-warning);
}

.ds-badge--danger {
    background: var(--ds-danger-bg);
    color: var(--ds-danger-text);
}

.ds-badge--danger .ds-badge-dot {
    background: var(--ds-danger);
}

.ds-badge--info {
    background: var(--ds-info-bg);
    color: var(--ds-info-text);
}

.ds-badge--info .ds-badge-dot {
    background: var(--ds-info);
}

.ds-badge--gray {
    background: var(--ds-gray-100);
    color: var(--ds-gray-600);
}

.ds-badge--gray .ds-badge-dot {
    background: var(--ds-gray-400);
}

.ds-badge--primary {
    background: var(--ds-primary-50);
    color: var(--ds-primary-dark);
}

.ds-badge--primary .ds-badge-dot {
    background: var(--ds-primary);
}

/* Role color badge */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--ds-r-full);
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── 16. EMPTY STATE ──────────────────────────────────────── */
.ds-empty {
    text-align: center;
    padding: 52px 24px;
}

.ds-empty-icon {
    width: 64px;
    height: 64px;
    background: var(--ds-gray-100);
    border-radius: var(--ds-r-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
    color: var(--ds-gray-400);
}

.ds-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ds-gray-800);
    margin-bottom: 6px;
}

.ds-empty-text {
    font-size: .875rem;
    color: var(--ds-gray-500);
    margin-bottom: 20px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

/* ── 17. AVATARS ──────────────────────────────────────────── */
.ds-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--ds-r-full);
    background: var(--ds-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8125rem;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
}

.ds-avatar--sm {
    width: 28px;
    height: 28px;
    font-size: .6875rem;
}

.ds-avatar--md {
    width: 40px;
    height: 40px;
    font-size: .9375rem;
}

.ds-avatar--lg {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.ds-avatar--xl {
    width: 72px;
    height: 72px;
    font-size: 1.5rem;
    border-radius: var(--ds-r-xl);
}

.ds-avatar--2xl {
    width: 96px;
    height: 96px;
    font-size: 2rem;
    border-radius: var(--ds-r-xl);
}

.ds-avatar--primary {
    background: var(--ds-primary);
}

.ds-avatar--success {
    background: var(--ds-success);
}

.ds-avatar--warning {
    background: var(--ds-warning);
}

.ds-avatar--danger {
    background: var(--ds-danger);
}

.ds-avatar--gray {
    background: var(--ds-gray-400);
}

.ds-avatar--purple {
    background: #8b5cf6;
}

.ds-avatar--teal {
    background: #14b8a6;
}

/* User Cell */
.ds-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ds-user-cell-info {
    min-width: 0;
}

.ds-user-cell-name {
    font-weight: 600;
    color: var(--ds-gray-900);
    font-size: .875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.ds-user-cell-meta {
    font-size: .75rem;
    color: var(--ds-gray-500);
    line-height: 1.3;
}

/* ── 18. ALERTS ───────────────────────────────────────────── */
.ds-alert {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--ds-r);
    border: 1px solid;
    font-size: .875rem;
    margin-bottom: 14px;
    align-items: flex-start;
}

.ds-alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.ds-alert--success {
    background: var(--ds-success-bg);
    border-color: var(--ds-success-border);
    color: var(--ds-success-text);
}

.ds-alert--danger {
    background: var(--ds-danger-bg);
    border-color: var(--ds-danger-border);
    color: var(--ds-danger-text);
}

.ds-alert--warning {
    background: var(--ds-warning-bg);
    border-color: var(--ds-warning-border);
    color: var(--ds-warning-text);
}

.ds-alert--info {
    background: var(--ds-info-bg);
    border-color: var(--ds-info-border);
    color: var(--ds-info-text);
}


.invalid-feedback {
    font-size: .8125rem;
    color: var(--ds-danger);
    margin-top: 4px;
    display: block;
}

.is-invalid {
    border-color: var(--ds-danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .1) !important;
}

/* ── 19. PERMISSION MODULE ────────────────────────────────── */
.perm-module {
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-r-lg);
    overflow: hidden;
    margin-bottom: 8px;
    transition: box-shadow var(--ds-t-fast);
}

.perm-module:hover {
    box-shadow: var(--ds-shadow-sm);
}

.perm-module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: var(--ds-gray-50);
    border-bottom: 1px solid var(--ds-gray-200);
    cursor: default;
}

.perm-module-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: .875rem;
    color: var(--ds-gray-800);
}

.perm-module-body {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 8px;
}

.perm-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 10px;
    border-radius: var(--ds-r);
    border: 1px solid var(--ds-gray-200);
    background: var(--ds-white);
    cursor: pointer;
    transition: all var(--ds-t-fast);
    user-select: none;
}

.perm-item:hover {
    border-color: var(--ds-primary-200);
    background: var(--ds-primary-50);
}

.perm-item.checked {
    border-color: var(--ds-primary-200);
    background: var(--ds-primary-50);
}

.perm-item input[type="checkbox"] {
    accent-color: var(--ds-primary);
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    width: 15px;
    height: 15px;
}

.perm-item-label {
    font-size: .8125rem;
    cursor: pointer;
}

.perm-item-code {
    font-weight: 600;
    color: var(--ds-gray-800);
    display: block;
}

.perm-item-name {
    color: var(--ds-gray-500);
    font-size: .75rem;
}

/* ── 20. DASHBOARD ────────────────────────────────────────── */
.ds-chart-card {
    background: var(--ds-white);
    border-radius: var(--ds-r-lg);
    padding: 20px;
    box-shadow: var(--ds-shadow);
    border: 1px solid var(--ds-gray-200);
    height: 100%;
}

.ds-chart-title {
    font-size: .9375rem;
    font-weight: 700;
    color: var(--ds-gray-900);
    margin-bottom: 4px;
}

.ds-chart-subtitle {
    font-size: .8125rem;
    color: var(--ds-gray-500);
    margin-bottom: 16px;
}

/* Activity Feed */
.ds-activity {
    display: flex;
    flex-direction: column;
}

.ds-activity-item {
    display: flex;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--ds-gray-100);
    align-items: flex-start;
}

.ds-activity-item:last-child {
    border-bottom: none;
}

.ds-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--ds-r-full);
    flex-shrink: 0;
    margin-top: 5px;
}

.ds-activity-dot--primary {
    background: var(--ds-primary);
}

.ds-activity-dot--success {
    background: var(--ds-success);
}

.ds-activity-dot--warning {
    background: var(--ds-warning);
}

.ds-activity-dot--danger {
    background: var(--ds-danger);
}

.ds-activity-dot--gray {
    background: var(--ds-gray-300);
}

.ds-activity-body {
    flex: 1;
    min-width: 0;
}

.ds-activity-text {
    font-size: .875rem;
    color: var(--ds-gray-700);
    line-height: 1.4;
    margin-bottom: 2px;
}

.ds-activity-time {
    font-size: .75rem;
    color: var(--ds-gray-400);
}

/* Quick Actions */
.ds-quick-actions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.ds-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: var(--ds-r-lg);
    background: var(--ds-gray-50);
    border: 1px solid var(--ds-gray-200);
    cursor: pointer;
    text-decoration: none;
    color: var(--ds-gray-700);
    font-size: .8125rem;
    font-weight: 500;
    transition: all var(--ds-t-fast);
    text-align: center;
}

.ds-quick-action:hover {
    background: var(--ds-primary-50);
    border-color: var(--ds-primary-200);
    color: var(--ds-primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--ds-shadow-sm);
}

.ds-quick-action-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--ds-r-md);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: var(--ds-shadow-sm);
    color: var(--ds-primary);
}

/* ── 21. AUTH LAYOUT ──────────────────────────────────────── */
body.auth-page {
    font-family: var(--ds-font);
    background: #0f172a;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* Background glow blobs */
body.auth-page::before {
    content: '';
    position: fixed;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(99, 102, 241, .12) 0%, transparent 65%);
    top: -200px;
    left: -150px;
    pointer-events: none;
}

body.auth-page::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 70, 229, .1) 0%, transparent 65%);
    bottom: -160px;
    right: -120px;
    pointer-events: none;
}

/* Card */
.auth-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 24px 64px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .15);
    padding: 48px 44px 40px;
    width: 100%;
    max-width: 540px;
    position: relative;
    z-index: 1;
}

/* Logo block */
.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

.auth-logo-mark {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 800;
    color: white;
    letter-spacing: -.01em;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, .35), 0 2px 8px rgba(99, 102, 241, .2);
}

.auth-logo-name {
    font-size: .9375rem;
    font-weight: 700;
    color: var(--ds-gray-800);
    letter-spacing: -.01em;
}

/* Heading */
.auth-heading {
    text-align: center;
    margin-bottom: 28px;
}

.auth-heading-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ds-gray-900);
    letter-spacing: -.03em;
    margin-bottom: 6px;
    line-height: 1.2;
}

.auth-heading-sub {
    font-size: .875rem;
    color: var(--ds-gray-500);
    line-height: 1.5;
}

/* Divider */
.auth-divider {
    border: none;
    border-top: 1px solid var(--ds-gray-100);
    margin: 0 0 24px;
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--ds-gray-100);
    font-size: .8rem;
    color: var(--ds-gray-400);
    line-height: 1.5;
}

/* ── 22. TABS ─────────────────────────────────────────────── */
.ds-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--ds-gray-200);
    margin-bottom: 0;
    overflow-x: auto;
}

.ds-tab {
    padding: 10px 16px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--ds-gray-500);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color var(--ds-t-fast), border-color var(--ds-t-fast);
}

.ds-tab:hover {
    color: var(--ds-gray-800);
}

.ds-tab.active {
    color: var(--ds-primary);
    border-bottom-color: var(--ds-primary);
    font-weight: 600;
}

.ds-tab-content>div {
    display: none;
}

.ds-tab-content>div.active {
    display: block;
}

/* ── 23. SWEETALERT2 OVERRIDES ────────────────────────────── */
.ds-swal-popup {
    font-family: var(--ds-font) !important;
    border-radius: var(--ds-r-lg) !important;
    padding: 2rem 2rem 1.75rem !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .12), 0 4px 16px rgba(0, 0, 0, .06) !important;
    border: 1px solid var(--ds-gray-100) !important;
}

.ds-swal-title {
    font-family: var(--ds-font) !important;
    font-size: 1.0625rem !important;
    font-weight: 700 !important;
    color: var(--ds-gray-900) !important;
    margin-bottom: .5rem !important;
}

.ds-swal-body {
    font-family: var(--ds-font) !important;
    font-size: .875rem !important;
    color: var(--ds-gray-600) !important;
    line-height: 1.55 !important;
}

.ds-swal-actions {
    gap: 8px !important;
    margin-top: 1.5rem !important;
}

.ds-swal-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 18px !important;
    border-radius: var(--ds-r-sm) !important;
    font-family: var(--ds-font) !important;
    font-size: .875rem !important;
    font-weight: 600 !important;
    border: 1px solid transparent !important;
    cursor: pointer !important;
    transition: all var(--ds-t-fast) !important;
    line-height: 1 !important;
}

.ds-swal-btn--primary {
    background: var(--ds-primary) !important;
    color: #fff !important;
    border-color: var(--ds-primary) !important;
}

.ds-swal-btn--primary:hover {
    background: #4f46e5 !important;
    border-color: #4f46e5 !important;
}

.ds-swal-btn--danger {
    background: #dc2626 !important;
    color: #fff !important;
    border-color: #dc2626 !important;
}

.ds-swal-btn--danger:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
}

.ds-swal-btn--warning {
    background: #d97706 !important;
    color: #fff !important;
    border-color: #d97706 !important;
}

.ds-swal-btn--warning:hover {
    background: #b45309 !important;
    border-color: #b45309 !important;
}

.ds-swal-btn--ghost {
    background: #fff !important;
    color: var(--ds-gray-700) !important;
    border-color: var(--ds-gray-200) !important;
}

.ds-swal-btn--ghost:hover {
    background: var(--ds-gray-50) !important;
}

/* Toast */
.ds-swal-toast {
    font-family: var(--ds-font) !important;
    font-size: .875rem !important;
    border-radius: var(--ds-r) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .1) !important;
    border: 1px solid var(--ds-gray-100) !important;
    padding: .5rem .75rem !important;
}

/* ── 25. PAGINATION ───────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 3px;
    margin: 0;
    flex-wrap: wrap;
}

.pagination .page-link {
    padding: 5px 10px;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--ds-gray-600);
    background: white;
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-r) !important;
    transition: all var(--ds-t-fast);
    line-height: 1.4;
}

.pagination .page-link:hover {
    background: var(--ds-gray-50);
    color: var(--ds-primary);
    border-color: var(--ds-gray-300);
    z-index: 1;
}

.pagination .page-item.active .page-link {
    background: var(--ds-primary);
    border-color: var(--ds-primary);
    color: white;
}

.pagination .page-item.disabled .page-link {
    opacity: .4;
    color: var(--ds-gray-400);
}

/* ── 24. UTILITIES ────────────────────────────────────────── */
/* Color overrides — Bootstrap uses blue primary, we use indigo */
.text-primary {
    color: var(--ds-primary) !important;
}

.font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: .875em;
}

/* Separator */
.ds-sep {
    height: 1px;
    background: var(--ds-gray-100);
    margin: 16px 0;
}

/* Table cell text helpers (replace repeated inline styles) */
.ds-cell-meta {
    color: var(--ds-gray-500);
    font-size: .8125rem;
}

/* dates, timestamps */
.ds-cell-muted {
    color: var(--ds-gray-600);
    font-size: .875rem;
}

/* secondary values, phone */

/* Definition list — key/value rows used on show/edit detail panes */
.ds-field-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ds-gray-400);
    margin-bottom: 4px;
}

.ds-field-value {
    font-size: .9375rem;
    color: var(--ds-gray-800);
}

.ds-dl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    font-size: .875rem;
    border-bottom: 1px solid var(--ds-gray-100);
}

.ds-dl-row:last-child {
    border-bottom: none;
}

.ds-dl-row .ds-dl-key {
    color: var(--ds-gray-500);
}

.ds-dl-row .ds-dl-val {
    color: var(--ds-gray-800);
    font-weight: 500;
    text-align: right;
}

/* Native checkbox tinting (replaces inline accent-color) */
.ds-checkbox {
    accent-color: var(--ds-primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* ── BULK ACTION BAR ──────────────────────────────────────── */
.ds-bulkbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--ds-primary-50);
    border-bottom: 1px solid var(--ds-primary-100);
    flex-wrap: wrap;
}

.ds-bulkbar-count {
    font-size: .875rem;
    font-weight: 600;
    color: var(--ds-primary-dark);
}

.ds-bulkbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
}

/* ── SKELETON LOADERS ─────────────────────────────────────── */
.ds-skeleton {
    background: linear-gradient(90deg, var(--ds-gray-100) 25%, var(--ds-gray-200) 37%, var(--ds-gray-100) 63%);
    background-size: 400% 100%;
    border-radius: var(--ds-r-sm);
    animation: ds-shimmer 1.4s ease infinite;
}

.ds-skeleton-line {
    height: 12px;
    margin-bottom: 8px;
}

.ds-skeleton-line:last-child {
    margin-bottom: 0;
}

.ds-skeleton-circle {
    border-radius: var(--ds-r-full);
}

@keyframes ds-shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

/* Info box */
.ds-infobox {
    background: var(--ds-info-bg);
    border: 1px solid var(--ds-info-border);
    border-radius: var(--ds-r);
    padding: 12px 14px;
    font-size: .875rem;
    color: var(--ds-info-text);
}

.ds-warnbox {
    background: var(--ds-warning-bg);
    border: 1px solid var(--ds-warning-border);
    border-radius: var(--ds-r);
    padding: 12px 14px;
    font-size: .875rem;
    color: var(--ds-warning-text);
}

/* Code inline */
code {
    font-size: .85em;
    background: var(--ds-gray-100);
    color: var(--ds-primary-dark);
    padding: 1px 5px;
    border-radius: var(--ds-r-xs);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── 25. ANIMATIONS ───────────────────────────────────────── */
@keyframes ds-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ds-slide-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes ds-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.ds-content>* {
    animation: ds-fade-in .2s ease;
}

.fa-spin {
    animation: ds-spin .8s linear infinite;
}

/* ── 26. RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1024px) {
    .ds-sidebar {
        transform: translateX(-100%);
        z-index: 1050;
    }

    .ds-sidebar.open {
        transform: translateX(0);
    }

    .ds-main {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .ds-content {
        padding: 16px;
    }

    .ds-topbar {
        padding: 0 16px;
    }

    .ds-toolbar {
        gap: 8px;
    }

    .ds-toolbar-search {
        max-width: none;
    }

    .ds-toolbar-end {
        margin-left: 0;
        width: 100%;
    }

    .ds-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ds-page-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .perm-module-body {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 576px) {
    .ds-stat-grid {
        grid-template-columns: 1fr;
    }

    .perm-module-body {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 36px 24px 32px;
        border-radius: 16px;
    }
}

/* ── 27. BOOTSTRAP COMPAT / OVERRIDES ─────────────────────── */
/* Inputs — the canonical input system. Self-sufficient so it works even on
   pages that don't load Bootstrap's CSS (e.g. the auth screens). */
.alert-dismissible .btn-close {
    padding: .8rem 0.5rem;
}

.alert-success,
.alert-danger,
.alert-warning,
.alert-info {
    font-size: 14px;
    padding: 8px 40px 8px 10px;
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-family: var(--ds-font);
    font-size: .9375rem;
    line-height: 1.5;
    color: var(--ds-gray-900);
    background-color: #fff;
    border: 1px solid var(--ds-gray-300);
    border-radius: var(--ds-r);
    transition: border-color var(--ds-t-fast), box-shadow var(--ds-t-fast);
    appearance: none;
}

.form-control::placeholder {
    color: var(--ds-gray-400);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--ds-gray-400);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ds-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
    outline: none;
}

/* Compact variant (toolbars / inline filters) */
.form-control-sm,
.form-select-sm {
    /* height: 34px; */
    padding: 7px 10px;
    font-size: .875rem;
}

/* Select caret (matches the DS slate chevron) */
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 34px;
    cursor: pointer;
}

.form-select-sm {
    background-position: right 8px center;
    background-size: 14px;
    padding-right: 28px;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
    line-height: 1.5;
}

/* Search input sits on top of .form-control, leaving room for the icon */
.ds-search-input {
    padding-left: 32px;
}

/* We surface validation via .ds-error-msg text, not Bootstrap's field icon */
.form-control.is-invalid,
.form-select.is-invalid {
    background-image: none;
    padding-right: 12px;
}

.form-select.is-invalid {
    padding-right: 34px;
}

.form-label {
    font-size: .875rem;
    font-weight: 500;
    color: var(--ds-gray-700);
    margin-bottom: 6px;
}

.form-text {
    font-size: .8125rem;
    color: var(--ds-gray-500);
}

.form-check-input[type=radio] {
    border: 2px solid #ccc;
}

.form-check-input:checked {
    background-color: var(--ds-primary);
    border-color: var(--ds-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.badge {
    font-family: var(--ds-font);
    font-size: .75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--ds-r-full);
}

.badge.bg-primary {
    background-color: var(--ds-primary) !important;
}

.badge.bg-success {
    background-color: var(--ds-success) !important;
}

.badge.bg-danger {
    background-color: var(--ds-danger) !important;
}

.badge.bg-warning {
    background-color: var(--ds-warning) !important;
}

.badge.bg-secondary {
    background-color: var(--ds-gray-400) !important;
}

/* Tables — the canonical table system. Resets Bootstrap's box-shadow cell
   model so DS borders/hover render predictably. Pair with .table-hover. */
.table {
    font-family: var(--ds-font);
    font-size: .875rem;
    width: 100%;
    margin-bottom: 0;
    color: var(--ds-gray-700);
    --bs-table-bg: transparent;
    border-collapse: collapse;
}

/* Neutralise Bootstrap's inset box-shadow + per-cell borders */
.table> :not(caption)>*>* {
    padding: 13px 14px;
    background: transparent;
    box-shadow: none;
    border: none;
    vertical-align: middle;
}

.table>thead>tr {
    border-bottom: 1px solid var(--ds-gray-200);
}

.table>thead>tr>th {
    padding: 10px 14px;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ds-gray-400);
    text-align: left;
    white-space: nowrap;
}

.table>thead>tr>th:last-child {
    text-align: right;
}

.table>tbody>tr {
    border-bottom: 1px solid var(--ds-gray-100);
    transition: background var(--ds-t-fast);
}

.table>tbody>tr:last-child {
    border-bottom: none;
}

.table-hover>tbody>tr:hover>* {
    background: var(--ds-gray-50);
}

/* Right-aligned action cell (used in list tables) */
.td-actions {
    text-align: right;
    white-space: nowrap;
    padding-right: 16px !important;
}

/* Card */
.card {
    border-radius: var(--ds-r-lg);
    border: 1px solid var(--ds-gray-200);
    box-shadow: var(--ds-shadow);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--ds-gray-100);
    padding: 16px 20px;
    border-radius: var(--ds-r-lg) var(--ds-r-lg) 0 0 !important;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: var(--ds-gray-50);
    border-top: 1px solid var(--ds-gray-100);
    padding: 12px 20px;
}

/* Ensure dropdowns from Bootstrap work too */
.dropdown-menu {
    border-radius: var(--ds-r-lg);
    box-shadow: var(--ds-shadow-lg);
    border: 1px solid var(--ds-gray-200);
    font-family: var(--ds-font);
    font-size: .875rem;
    padding: 6px;
}

.dropdown-item {
    border-radius: var(--ds-r);
    font-size: .875rem;
    font-weight: 500;
    padding: 7px 10px;
    color: var(--ds-gray-700);
    transition: background var(--ds-t-fast), color var(--ds-t-fast);
}

.dropdown-item:hover {
    background: var(--ds-gray-50);
    color: var(--ds-gray-900);
}

.dropdown-item.text-danger:hover {
    background: var(--ds-danger-bg);
}

.dropdown-divider {
    margin: 4px 0;
    border-top-color: var(--ds-gray-100);
}

/* Notyf */
.notyf__toast {
    font-family: var(--ds-font);
    font-size: .875rem;
    border-radius: var(--ds-r-md) !important;
}
