/* =====================================================================================================
   components.css: styles for the shared Blade components (resources/views/components). Tokens only
   (public/css/design-system.css): no hex or rgb colors here.
   Panel chrome (topbar, sidebar, account menu) is scoped to body.ds-app, so panels that are not
   migrated yet keep their old look. The ds-* page components work anywhere.
   ===================================================================================================== */

/* ------------------------------------------------------------------------------- Topbar */
.ds-app .ds-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 0 var(--space-4) 0 var(--space-3);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.ds-app .ds-topbar__start,
.ds-app .ds-topbar__end {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}
.ds-app .ds-topbar__end { gap: var(--space-3); }
.ds-app .ds-topbar__brand { display: inline-flex; align-items: center; min-width: 0; text-decoration: none; }
.ds-app .ds-topbar__brand .ds-logo__img { height: 36px; width: auto; max-width: 180px; object-fit: contain; }
.ds-app .ds-topbar__brand .ds-logo__name { color: var(--color-text); }
/* Headers outside <x-topbar> (super admin): same logo size as the shared topbar. */
.ds-app header.navbar .navbar-brand .ds-logo__img { height: 36px; width: auto; max-width: 180px; object-fit: contain; }
@media (max-width: 575.98px) {
    .ds-app header.navbar .navbar-brand .ds-logo__img { height: 32px; max-width: 140px; }
}

.ds-app .ds-topbar .sidebar-toggle { margin: 0; }

/* Notification bell (each area keeps its own list markup and script; ids unchanged) */
.ds-app .ds-bell { position: relative; }
.ds-app .ds-topbar__count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--color-danger);
    color: var(--color-on-primary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    line-height: 18px;
    text-align: center;
    border: 2px solid var(--color-surface);
    box-sizing: content-box;
}
.ds-app .ds-notify.dropdown-menu {
    width: min(360px, calc(100vw - 1.5rem));
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-pop);
}
.ds-app .ds-notify__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-2);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}
.ds-app .ds-notify__head h6 { margin: 0; font-weight: var(--font-weight-bold); }
.ds-app .ds-notify__list { max-height: 380px; overflow-y: auto; }
.ds-app .ds-notify__foot {
    display: flex;
    justify-content: space-around;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
}
.ds-app .ds-notify__foot a { text-decoration: none; font-weight: var(--font-weight-semibold); }
.ds-app .ds-notify__empty { padding: var(--space-5) var(--space-4); text-align: center; color: var(--color-text-muted); }

/* One notification row, the same in every area (public/js/notify-bell.js draws it) */
.ds-app .ds-notify__item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    white-space: normal;
}
.ds-app .ds-notify__item:last-child { border-bottom: 0; }
.ds-app .ds-notify__item:hover,
.ds-app .ds-notify__item:focus-visible { background: var(--color-surface-2); color: var(--color-text); }
.ds-app .ds-notify__item.is-unread { background: var(--color-primary-soft); }
.ds-app .ds-notify__item.is-unread:hover { background: var(--color-surface-2); }
.ds-app .ds-notify__icon,
.ds-app .ds-note__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-pill);
    background: var(--ds-tone-soft, var(--color-surface-2));
    color: var(--ds-tone, var(--color-text-muted));
    font-size: var(--font-size-sm);
}
.ds-app .ds-notify__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.ds-app .ds-notify__title { font-weight: var(--font-weight-semibold); font-size: var(--font-size-sm); overflow-wrap: anywhere; }
.ds-app .ds-notify__title .ds-badge { margin-left: var(--space-1); vertical-align: middle; }
.ds-app .ds-notify__text { font-size: var(--font-size-sm); color: var(--color-text-muted); overflow-wrap: anywhere; }
.ds-app .ds-notify__meta,
.ds-app .ds-note__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}
.ds-app .ds-notify__meta i,
.ds-app .ds-note__meta i { margin-right: 2px; }

/* "View all" page (partials/notifications/page) */
.ds-app a.ds-tab { text-decoration: none; }
.ds-app .ds-notes { display: flex; flex-direction: column; }
.ds-app .ds-note {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    border-left: 3px solid transparent;
}
.ds-app .ds-note:last-child { border-bottom: 0; }
.ds-app .ds-note.is-unread { border-left-color: var(--color-primary); background: var(--color-primary-soft); }
.ds-app .ds-note__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.ds-app .ds-note__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ds-app .ds-note__title { font-weight: var(--font-weight-semibold); color: var(--color-text); text-decoration: none; overflow-wrap: anywhere; }
.ds-app a.ds-note__title:hover { color: var(--color-primary-hover); text-decoration: underline; }
.ds-app .ds-note__text { margin: 0; color: var(--color-text); white-space: pre-line; overflow-wrap: anywhere; }
.ds-app .ds-note__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-2); flex: 0 0 auto; }
@media (max-width: 575.98px) {
    .ds-app .ds-note { flex-wrap: wrap; }
    .ds-app .ds-note__actions { width: 100%; padding-left: calc(34px + var(--space-3)); }
}

.ds-app .ds-toasts { position: fixed; top: calc(var(--header-height) + var(--space-3)); right: var(--space-4); z-index: 1090; }

/* ------------------------------------------------------------------------------- Icon button */
.ds-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1.05rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s, color .15s, border-color .15s;
}
.ds-icon-btn:hover,
.ds-icon-btn[aria-expanded="true"] { background: var(--color-surface-2); color: var(--color-primary); }
.ds-icon-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ds-icon-btn--bordered { border-color: var(--color-border); background: var(--color-surface); width: 34px; height: 34px; border-radius: var(--radius-sm); font-size: .9rem; }
.ds-icon-btn--bordered:hover { border-color: var(--color-primary); }
.ds-icon-btn--danger:hover { color: var(--color-danger); border-color: var(--color-danger); }

/* ------------------------------------------------------------------------------- Light / dark toggle */
.ds-app .ds-mode__menu { min-width: 170px; padding: 6px; border-radius: var(--radius-control); }
.ds-app .ds-mode__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px; color: var(--color-text); }
.ds-app .ds-mode__item > i:first-child { width: 16px; text-align: center; color: var(--color-text-muted); }
.ds-app .ds-mode__item:hover,
.ds-app .ds-mode__item:focus-visible { background: var(--color-surface-2); color: var(--color-text); }
.ds-app .ds-mode__item.active { background: var(--color-primary-soft); color: var(--color-primary-ink); }
.ds-app .ds-mode__item.active > i:first-child { color: var(--color-primary); }
.ds-app .ds-mode__check { margin-left: auto; visibility: hidden; color: var(--color-primary); font-size: 12px; }
.ds-app .ds-mode__item.active .ds-mode__check { visibility: visible; }

/* ------------------------------------------------------------------------------- Account menu (.um-*) */
.ds-app .um-trigger {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .28rem .6rem .28rem .28rem;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-text);
    text-align: left;
    transition: background-color .15s ease, border-color .15s ease;
}
.ds-app .um-trigger:hover,
.ds-app .um-trigger.show { background: var(--color-surface-2); border-color: var(--color-border); }
.ds-app .um-trigger:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ds-app .um-trigger-text { flex-direction: column; line-height: 1.2; max-width: 180px; }
.ds-app .um-name { font-size: .875rem; font-weight: var(--font-weight-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-app .um-role { font-size: .72rem; color: var(--color-text-muted); }
.ds-app .um-chevron { font-size: .68rem; color: var(--color-text-muted); transition: transform .2s ease; }
.ds-app .um-trigger.show .um-chevron { transform: rotate(180deg); }
.ds-app .um-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-size: .82rem;
    font-weight: var(--font-weight-semibold);
    letter-spacing: .02em;
    box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 3.5px var(--color-primary-soft);
}
.ds-app .um-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ds-app .um-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--color-success);
    border: 2px solid var(--color-surface);
}
.ds-app .um-avatar-lg { width: 54px; height: 54px; font-size: 1.05rem; }
.ds-app .dropdown-menu.um-menu {
    width: 310px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-card);
    background: var(--color-surface);
    box-shadow: var(--shadow-pop);
}
.ds-app .dropdown-menu.um-menu.show { animation: dsMenuIn .16s ease-out; }
@keyframes dsMenuIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ds-app .um-menu::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 26px;
    width: 14px;
    height: 14px;
    background: var(--color-primary-soft);
    border-radius: 3px 0 0 0;
    transform: rotate(45deg);
}
.ds-app .um-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1.1rem 1.1rem 1rem;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    background: var(--color-primary-soft);
}
.ds-app .um-head-text { min-width: 0; }
.ds-app .um-head-name { font-size: .98rem; font-weight: var(--font-weight-semibold); line-height: 1.25; color: var(--color-text); overflow-wrap: anywhere; }
.ds-app .um-head-mail { margin-top: .1rem; font-size: .78rem; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-app .um-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: .5rem;
    padding: .12rem .55rem;
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: .72rem;
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
}
.ds-app .um-chip i { color: var(--color-primary); font-size: .7rem; }
.ds-app .um-body { padding: .55rem; }
.ds-app .um-item,
.ds-app .um-signout {
    display: flex;
    align-items: center;
    gap: .8rem;
    width: 100%;
    padding: .6rem .65rem;
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text);
    text-decoration: none;
    text-align: left;
    transition: background-color .15s ease;
}
.ds-app .um-item:hover,
.ds-app .um-item:focus-visible { background: var(--color-surface-2); color: var(--color-text); outline: none; }
.ds-app .um-item.is-active { background: var(--color-primary-soft); }
.ds-app .um-item.is-active .um-item-title { color: var(--color-primary); }
.ds-app .um-item.is-active .um-item-icon { background: var(--color-primary); color: var(--color-on-primary); }
.ds-app .um-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-control);
    font-size: .95rem;
}
.ds-app .um-tone-primary { background: var(--color-primary-soft); color: var(--color-primary); }
.ds-app .um-tone-amber { background: var(--color-warning-soft); color: var(--color-warning); }
.ds-app .um-tone-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.ds-app .um-item-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.25; }
.ds-app .um-item-title { font-size: .88rem; font-weight: var(--font-weight-semibold); }
.ds-app .um-item-sub { margin-top: .1rem; font-size: .74rem; color: var(--color-text-muted); }
.ds-app .um-item-arrow { font-size: .68rem; color: var(--color-text-disabled); transition: transform .15s ease, color .15s ease; }
.ds-app .um-item:hover .um-item-arrow { transform: translateX(2px); color: var(--color-primary); }
.ds-app .um-foot { padding: .55rem; border-top: 1px solid var(--color-border); }
.ds-app .um-signout:hover,
.ds-app .um-signout:focus-visible { background: var(--color-danger-soft); outline: none; }
.ds-app .um-signout .um-item-title { color: var(--color-danger); }

/* ------------------------------------------------------------------------------- Sidebar */
.ds-app .dashboard-sidebar {
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    box-shadow: none;
    padding: var(--space-2) var(--space-2) var(--space-5);
}
/* .st-mobile-menu: the student phone menu (student/components/sidebar), same items and look as the sidebar */
.ds-app .dashboard-sidebar .menu-item,
.ds-app .st-mobile-menu .menu-item { border-bottom: 0; margin-bottom: 2px; }
.ds-app .dashboard-sidebar .menu-link,
.ds-app .st-mobile-menu .menu-link {
    position: relative;
    gap: var(--space-2);
    padding: 9px var(--space-3) !important; /* the old area CSS sets "padding: 8px !important" */
    border-radius: var(--radius-control);
    color: var(--color-text);
    font-size: 13.5px;
    font-weight: var(--font-weight-medium);
}
.ds-app .dashboard-sidebar .menu-link:hover,
.ds-app .st-mobile-menu .menu-link:hover { background: var(--color-surface-2); color: var(--color-primary); }
.ds-app .dashboard-sidebar .menu-link.active,
.ds-app .st-mobile-menu .menu-link.active,
.ds-app .dashboard-sidebar .has-dropdown.active > .menu-link {
    background: var(--color-primary-soft);
    color: var(--color-primary-ink); /* text on soft: ink reaches 4.5:1 (primary was 4.15:1) */
    font-weight: var(--font-weight-semibold);
}
.ds-app .dashboard-sidebar .menu-icon,
.ds-app .st-mobile-menu .menu-icon {
    width: 20px;
    margin: 0;
    font-size: 15px;
    text-align: center;
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--color-text-muted);
}
.ds-app .dashboard-sidebar .menu-link:hover .menu-icon,
.ds-app .dashboard-sidebar .menu-link.active .menu-icon,
.ds-app .st-mobile-menu .menu-link:hover .menu-icon,
.ds-app .st-mobile-menu .menu-link.active .menu-icon,
.ds-app .dashboard-sidebar .has-dropdown.active > .menu-link .menu-icon { color: var(--color-primary); }
.ds-app .dashboard-sidebar .menu-caret { margin-left: auto; font-size: 10px; color: var(--color-text-subtle); transition: transform .2s ease; }
.ds-app .dashboard-sidebar .has-dropdown.open > .menu-link .menu-caret { transform: rotate(180deg); }
.ds-app .dashboard-sidebar .has-dropdown > .menu-link::after { display: none; } /* the old area CSS draws its own arrow */
.ds-app .dashboard-sidebar .menu-section {
    padding: var(--space-4) var(--space-3) var(--space-1);
    font-size: 10.5px;
    font-weight: var(--font-weight-bold);
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--color-text-muted);   /* subtle was 2.6:1 on white (below AA) */
    list-style: none;
}
.ds-app .dashboard-sidebar .menu-dropdown { background: transparent; padding-left: 30px; }
.ds-app .dashboard-sidebar .dropdown-link {
    display: block;
    padding: 7px var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: var(--font-weight-medium);
    text-decoration: none;
}
.ds-app .dashboard-sidebar .dropdown-link:hover { background: var(--color-surface-2); color: var(--color-primary); }
.ds-app .dashboard-sidebar .dropdown-link.active { color: var(--color-primary); font-weight: var(--font-weight-semibold); background: var(--color-primary-soft); }

.ds-app .dashboard-sidebar.collapsed { padding-left: var(--space-1); padding-right: var(--space-1); }
.ds-app .dashboard-sidebar.collapsed .menu-link { justify-content: center; padding: 10px 0 !important; }
.ds-app .dashboard-sidebar.collapsed .menu-caret,
.ds-app .dashboard-sidebar.collapsed .menu-dropdown { display: none; }
.ds-app .dashboard-sidebar.collapsed .menu-section { padding: var(--space-1) 0 0; margin-top: var(--space-2); font-size: 0; border-top: 1px solid var(--color-border); }
.ds-app .overlay { background: var(--color-overlay); }

/* ------------------------------------------------------------------------------- Page header */
.ds-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}
.ds-page-header__title { margin: 0; font-size: var(--font-size-h2); font-weight: var(--font-weight-bold); letter-spacing: -.01em; color: var(--color-text); }
.ds-page-header__desc { margin: var(--space-1) 0 0; max-width: 70ch; color: var(--color-text-muted); font-size: var(--font-size-body); }
.ds-page-header__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.ds-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin: 0 0 var(--space-1);
    padding: 0;
    list-style: none;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}
.ds-breadcrumb li + li::before { content: "/"; margin-right: var(--space-1); color: var(--color-text-subtle); }
.ds-breadcrumb a { color: var(--color-text-muted); text-decoration: none; }
.ds-breadcrumb a:hover { color: var(--color-primary); }
.ds-breadcrumb [aria-current] { color: var(--color-text); font-weight: var(--font-weight-medium); }

/* ------------------------------------------------------------------------------- Card */
.ds-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-4);
}
.ds-card__title { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: 1rem; font-weight: var(--font-weight-bold); }
.ds-card--flush { padding: 0; overflow: hidden; }

/* ------------------------------------------------------------------------------- Stat cards */
.ds-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.ds-stat {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-3) var(--space-4);
    color: var(--color-text);
    text-decoration: none;
    transition: box-shadow .15s, border-color .15s;
}
a.ds-stat:hover { box-shadow: var(--shadow-hover); border-color: var(--color-border-strong); color: var(--color-text); }
.ds-stat__icon {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-control);
    background: var(--ds-tone-soft, var(--color-primary-soft));
    color: var(--ds-tone, var(--color-primary));
    font-size: 1.1rem;
}
.ds-stat__body { min-width: 0; }
.ds-stat__value { display: block; font-size: 1.55rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--ds-tone-text, var(--color-text)); }
.ds-stat__label { display: block; color: var(--color-text-muted); font-size: var(--font-size-sm); }
.ds-stat__hint { display: block; color: var(--color-text-muted); font-size: var(--font-size-xs); margin-top: 2px; }

/* Tones shared by stat cards, badges and pills */
/* --ds-tone-ink = text on the tone's soft background (AA) */
.ds-tone-primary { --ds-tone: var(--color-primary); --ds-tone-soft: var(--color-primary-soft); --ds-tone-text: var(--color-primary); --ds-tone-ink: var(--color-primary-ink); }
.ds-tone-success { --ds-tone: var(--color-success); --ds-tone-soft: var(--color-success-soft); --ds-tone-text: var(--color-success); --ds-tone-ink: var(--color-success-ink); }
.ds-tone-danger  { --ds-tone: var(--color-danger);  --ds-tone-soft: var(--color-danger-soft);  --ds-tone-text: var(--color-danger);  --ds-tone-ink: var(--color-danger-ink); }
.ds-tone-warning { --ds-tone: var(--color-warning); --ds-tone-soft: var(--color-warning-soft); --ds-tone-text: var(--color-warning); --ds-tone-ink: var(--color-warning-ink); }
.ds-tone-info    { --ds-tone: var(--color-info);    --ds-tone-soft: var(--color-info-soft);    --ds-tone-text: var(--color-info);    --ds-tone-ink: var(--color-info-ink); }
.ds-tone-accent  { --ds-tone: var(--color-accent);  --ds-tone-soft: var(--color-accent-soft);  --ds-tone-text: var(--color-accent);  --ds-tone-ink: var(--color-accent-ink); }
.ds-tone-neutral { --ds-tone: var(--color-neutral); --ds-tone-soft: var(--color-neutral-soft); --ds-tone-text: var(--color-neutral); --ds-tone-ink: var(--color-neutral); }
.ds-stat.ds-tone-neutral,
.ds-stat.ds-tone-primary { --ds-tone-text: var(--color-text); }

/* ------------------------------------------------------------------------------- Filter bar */
.ds-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.ds-filter-bar > .ds-field { margin: 0; min-width: 170px; }
.ds-filter-bar > .ds-field--search { flex: 1 1 240px; }
.ds-filter-bar__actions { display: flex; gap: var(--space-2); }
.ds-filter-bar .select2-container { min-width: 170px; }

/* ------------------------------------------------------------------------------- Table */
.ds-table-wrap {
    overflow-x: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
}
.ds-table { width: 100%; margin: 0; border-collapse: collapse; font-size: 13.5px; color: var(--color-text); }
.ds-table th {
    background: var(--color-surface-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    letter-spacing: .02em;
    text-align: left;
    padding: 10px 14px;
    white-space: nowrap;
    border: 0;
}
.ds-table td { padding: 12px 14px; border-top: 1px solid var(--color-border); vertical-align: middle; }
.ds-table tbody tr { transition: background-color .12s; }
.ds-table tbody tr:hover { background: var(--color-surface-hover); }
.ds-table tr[hidden] { display: none; }
.ds-table .ds-table__actions { text-align: right; white-space: nowrap; }
.ds-table__primary { font-weight: var(--font-weight-semibold); color: var(--color-text); text-decoration: none; }
a.ds-table__primary:hover { color: var(--color-primary); }
.ds-table__sub { display: block; color: var(--color-text-muted); font-size: var(--font-size-sm); margin-top: 2px; }
.ds-table-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-3);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}
/* DataTables inside a ds table */
.ds-table-wrap .dataTables_wrapper { padding: var(--space-3); }
.ds-table-wrap .dataTables_wrapper .ds-table { border: 0; }

/* ------------------------------------------------------------------------------- Pagination */
.ds-pages { display: flex; gap: var(--space-1); list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.ds-pages a,
.ds-pages span {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
}
.ds-pages a:hover { background: var(--color-surface-2); color: var(--color-text); }
.ds-pages .is-current { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.ds-pages .is-disabled { color: var(--color-text-disabled); }

/* ------------------------------------------------------------------------------- Badge / status pill */
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--ds-tone-soft, var(--color-neutral-soft));
    color: var(--ds-tone-ink, var(--color-neutral));
    font-size: 11.5px;
    font-weight: var(--font-weight-semibold);
    line-height: 1.4;
    white-space: nowrap;
}
/* a wrapping row of badges in a table cell */
.ds-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.ds-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------------------------- Buttons */
.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: var(--font-weight-semibold);
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.ds-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ds-btn:disabled,
.ds-btn.is-disabled { opacity: .6; cursor: not-allowed; pointer-events: none; }
.ds-btn--sm { padding: 5px 11px; font-size: 12.5px; border-radius: var(--radius-sm); }
.ds-btn--primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.ds-btn--primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: var(--color-on-primary); }
.ds-btn--secondary { background: var(--color-primary-soft); color: var(--color-primary-ink); }
.ds-btn--secondary:hover { background: var(--color-primary); color: var(--color-on-primary); }
.ds-btn--outline { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); }
.ds-btn--outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.ds-btn--ghost { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.ds-btn--ghost:hover { background: var(--color-surface-2); color: var(--color-text); }
.ds-btn--danger { background: var(--color-danger); border-color: var(--color-danger); color: var(--color-on-danger); }
.ds-btn--danger:hover { background: var(--color-danger-hover); border-color: var(--color-danger-hover); color: var(--color-on-danger); }
.ds-btn--danger-soft { background: var(--color-danger-soft); color: var(--color-danger); }
.ds-btn--danger-soft:hover { border-color: var(--color-danger); color: var(--color-danger); }

/* ------------------------------------------------------------------------------- Empty state */
.ds-empty { text-align: center; color: var(--color-text-muted); padding: var(--space-6) var(--space-4); }
.ds-empty__icon {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: var(--space-3);
    border-radius: 50%;
    background: var(--color-surface-2);
    color: var(--color-text-subtle);
    font-size: 1.5rem;
}
.ds-empty__title { display: block; color: var(--color-text); font-weight: var(--font-weight-semibold); font-size: 15px; }
.ds-empty__text { margin: var(--space-1) auto 0; max-width: 46ch; font-size: var(--font-size-body); }
.ds-empty__action { margin-top: var(--space-4); display: flex; justify-content: center; gap: var(--space-2); flex-wrap: wrap; }

/* ------------------------------------------------------------------------------- Modal */
.ds-modal .modal-header { padding: var(--space-4) var(--space-5); }
.ds-modal .modal-title { font-size: 1.05rem; font-weight: var(--font-weight-bold); color: var(--color-text); }
.ds-modal .modal-body { padding: var(--space-4) var(--space-5); color: var(--color-text); }
.ds-modal .modal-footer { padding: var(--space-3) var(--space-5); gap: var(--space-2); }
.ds-modal .modal-footer > * { margin: 0; }

/* ------------------------------------------------------------------------------- Form fields */
.ds-field { margin-bottom: var(--space-4); }
.ds-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: var(--font-weight-semibold); color: var(--color-text); }
.ds-label .req { color: var(--color-danger); }
.ds-label .opt { color: var(--color-text-muted); font-weight: var(--font-weight-normal); }
.ds-input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background-color: var(--color-surface);
    color: var(--color-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.45;
    transition: border-color .15s, box-shadow .15s;
}
.ds-input::placeholder { color: var(--color-text-muted); }
.ds-input:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.ds-input:disabled,
.ds-input[readonly] { background-color: var(--color-surface-2); }
.ds-input.is-invalid { border-color: var(--color-danger); }
select.ds-input { padding-right: 32px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%), linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.ds-input { min-height: 96px; resize: vertical; }
.ds-input-icon { position: relative; }
.ds-input-icon > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-subtle); pointer-events: none; }
.ds-input-icon > .ds-input { padding-left: 34px; }
/* heading of a group of fields inside a form card */
.ds-form-section {
    margin: 0 0 var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
}
.ds-form-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.ds-app .progress.is-thin { height: 6px; }
.ds-help { margin-top: 5px; color: var(--color-text-muted); font-size: 12px; }
.ds-error { margin-top: 5px; color: var(--color-danger); font-size: 12.5px; font-weight: var(--font-weight-medium); }

/* ------------------------------------------------------------------------------- Image + placeholder */
.ds-img {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--color-surface-2);
    border-radius: var(--radius-control);
    aspect-ratio: var(--ds-img-ratio, 16 / 9);
}
.ds-img > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ds-img__placeholder {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    color: var(--color-text-subtle);
    font-size: 1.8rem;
}
.ds-img.is-empty .ds-img__placeholder,
.ds-img.is-broken .ds-img__placeholder { display: grid; }
/* small square thumbnail in a table row (image, video or placeholder) */
.ds-thumb { width: 56px; height: 56px; flex: none; --ds-img-ratio: 1 / 1; border-radius: var(--radius-sm); font-size: 1.1rem; }
.ds-thumb > video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ds-thumb-btn { display: block; padding: 0; border: 0; background: none; border-radius: var(--radius-sm); cursor: zoom-in; }
.ds-thumb-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
/* full-size image / video in a preview modal. img / video only: .ds-media on a div is the player area
   (bottom of this file), and margin: auto here would shrink that div to 0 width inside a flex card. */
img.ds-media, video.ds-media { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; object-fit: contain; border-radius: var(--radius-control); }

/* ------------------------------------------------------------------------------- Tabs
   <div class="ds-tabs" role="tablist"><button class="ds-tab is-active" role="tab">Overview <b>3</b></button></div>
   <div class="ds-tab-panel is-active" role="tabpanel">...</div> (the page script switches is-active) */
.ds-tabs {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: none;
}
.ds-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: -1px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--color-text-muted);
    font-size: 13.5px;
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    cursor: pointer;
}
.ds-tab b {
    min-width: 20px;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--color-surface-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    text-align: center;
}
.ds-tab:hover { color: var(--color-text); }
.ds-tab.is-active,
.ds-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.ds-tab.is-active b,
.ds-tab.active b { background: var(--color-primary-soft); color: var(--color-primary); }
.ds-filter-bar > .ds-field--narrow { min-width: 90px; flex: 0 0 auto; }
.ds-tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.ds-tab-panel { display: none; }
.ds-tab-panel.is-active { display: block; }

/* ------------------------------------------------------------------------------- Accordion
   <article class="ds-acc is-open"><button class="ds-acc__head" aria-expanded="true">
     <span class="ds-acc__num">1</span><span class="ds-acc__main"><span class="ds-acc__title">..</span>
     <span class="ds-acc__meta">..</span></span><i class="fas fa-chevron-down ds-acc__chev"></i></button>
   <div class="ds-acc__body"><div class="ds-acc__inner">..</div></div></article> */
.ds-acc {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: border-color .15s, box-shadow .15s;
}
.ds-acc + .ds-acc { margin-top: var(--space-2); }
.ds-acc.is-open { border-color: var(--color-primary-line); box-shadow: var(--shadow-hover); }
.ds-acc[hidden] { display: none; }
.ds-acc__head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 0;
    background: none;
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
}
.ds-acc__head:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; border-radius: var(--radius-card); }
.ds-acc__num {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-control);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: var(--font-weight-bold);
    font-size: 13px;
}
.ds-acc__main { flex: 1 1 auto; min-width: 0; }
.ds-acc__title { display: block; font-weight: var(--font-weight-semibold); }
.ds-acc__meta { display: flex; flex-wrap: wrap; gap: 2px var(--space-3); margin-top: 2px; color: var(--color-text-muted); font-size: var(--font-size-sm); }
.ds-acc__chev { flex: none; color: var(--color-text-subtle); font-size: 12px; transition: transform .2s ease; }
.ds-acc.is-open .ds-acc__chev { transform: rotate(180deg); }
.ds-acc__body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
.ds-acc.is-open .ds-acc__body { grid-template-rows: 1fr; }
.ds-acc__inner { overflow: hidden; }
.ds-acc__content { padding: 0 var(--space-4) var(--space-4) calc(var(--space-4) + 34px + var(--space-3)); }

/* small uppercase label above a group inside a card */
.ds-section-label {
    margin: var(--space-4) 0 var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* ------------------------------------------------------------------------------- Chips (resources, files, links) */
.ds-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ds-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 12.5px;
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    cursor: pointer;
}
.ds-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.ds-chip:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ds-chip > i { color: var(--color-primary); }
.ds-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.ds-chip > small { color: var(--color-text-muted); font-size: var(--font-size-xs); }

/* ------------------------------------------------------------------------------- Facts list (icon + text) */
.ds-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); margin: var(--space-3) 0; color: var(--color-text-muted); font-size: 13px; }
.ds-facts > div { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ds-facts i { color: var(--color-text-subtle); width: 16px; text-align: center; }

/* ------------------------------------------------------------------------------- Progress track */
.ds-progress { height: 6px; border-radius: var(--radius-pill); background: var(--color-surface-2); overflow: hidden; }
.ds-progress > span { display: block; height: 100%; width: 0; border-radius: var(--radius-pill); background: var(--color-primary); transition: width .6s ease; }

/* ------------------------------------------------------------------------------- Timeline list (chapters) */
.ds-timeline { position: relative; margin: 0; padding: 0 0 0 var(--space-5); list-style: none; }
.ds-timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--color-border); }
.ds-timeline > li { position: relative; padding: var(--space-2) 0; }
.ds-timeline > li[hidden] { display: none; }
.ds-timeline > li::before {
    content: "";
    position: absolute;
    left: calc(-1 * var(--space-5) + 3px);
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 2px solid var(--color-primary);
}
.ds-timeline > li.is-off::before { border-color: var(--color-text-subtle); }
.ds-timeline__title { font-weight: var(--font-weight-semibold); }
.ds-timeline__title small { margin-right: 6px; color: var(--color-text-muted); font-weight: var(--font-weight-medium); }
.ds-timeline__text { margin-top: 2px; color: var(--color-text-muted); font-size: 13px; }
.ds-timeline > li.is-off .ds-timeline__title { color: var(--color-text-muted); }

/* ------------------------------------------------------------------------------- Media box (cover / intro video) */
.ds-media-box {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface-2);
    cursor: pointer;
}
.ds-media-box > img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
/* shown when there is no image, or it failed to load and removed itself */
.ds-media-box__icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--color-text-subtle); font-size: 2rem; }
.ds-media-box:hover > img { transform: scale(1.03); }
.ds-media-box:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ds-media-box__tag {
    position: absolute;
    left: var(--space-2);
    top: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    box-shadow: var(--shadow-card);
}
.ds-media-box__play {
    position: absolute;
    inset: 0;
    margin: auto;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-size: 1.2rem;
    box-shadow: var(--shadow-pop);
}

/* ------------------------------------------------------------------------------- Preview modal body (image / video / pdf / embed) */
.ds-preview { display: grid; place-items: center; min-height: 200px; }
.ds-preview > img,
.ds-preview > video { max-width: 100%; max-height: 72vh; border-radius: var(--radius-control); }
.ds-preview > video { width: 100%; }
.ds-preview > iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius-control); }
.ds-preview > iframe.is-doc { aspect-ratio: auto; height: 72vh; }

/* highlighted card (e.g. the trainer's own batch) */
.ds-card.is-highlight { border-color: var(--color-primary-line); box-shadow: inset 3px 0 0 var(--color-primary), var(--shadow-card); }
.ds-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); }
.ds-card__heading { margin: 0; font-size: 15px; font-weight: var(--font-weight-bold); }
.ds-card__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.ds-prose { color: var(--color-text); line-height: 1.7; overflow-wrap: anywhere; }

/* card with a full-bleed image on top (course cards) */
.ds-card--media { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ds-card--media > .ds-img { border-radius: 0; }
.ds-card__media { position: relative; }
.ds-card__media > .ds-badge { position: absolute; top: var(--space-2); left: var(--space-2); box-shadow: var(--shadow-card); background: var(--color-surface); }
.ds-card__body { display: flex; flex-direction: column; gap: var(--space-3); flex: 1 1 auto; padding: var(--space-4); }
.ds-card__body > .ds-card__foot { margin-top: auto; }
/* small numbers row inside a card */
.ds-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.ds-kpis > div { padding: var(--space-2); border-radius: var(--radius-sm); background: var(--color-surface-2); text-align: center; }
.ds-kpis b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.ds-kpis span { color: var(--color-text-muted); font-size: var(--font-size-xs); }

.ds-page-header__meta { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }

/* action bar that sticks under the topbar on long forms; the page script adds .is-stuck */
.ds-sticky-bar {
    position: sticky;
    top: var(--header-height);
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: box-shadow .2s ease;
}
.ds-sticky-bar.is-stuck { box-shadow: var(--shadow-hover); }
.ds-empty__icon.ds-tone-danger,
.ds-empty__icon.ds-tone-warning,
.ds-empty__icon.ds-tone-success { background: var(--ds-tone-soft); color: var(--ds-tone); }

/* toolbar above a list: search on the left, buttons on the right */
.ds-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.ds-toolbar > .ds-input-icon { flex: 1 1 260px; max-width: 420px; }

/* ------------------------------------------------------------------------------- Utilities (use these instead of Bootstrap's fixed white / light / dark color classes) */
.ds-surface { background-color: var(--color-surface); }
.ds-surface-2 { background-color: var(--color-surface-2); }
.ds-text { color: var(--color-text); }
.ds-text-muted { color: var(--color-text-muted); }
.ds-text-primary { color: var(--color-primary); }
.ds-text-success { color: var(--color-success); }
.ds-text-danger { color: var(--color-danger); }
.ds-text-warning { color: var(--color-warning); }
.ds-border { border: 1px solid var(--color-border); }
/* text on a brand / colored panel (replaces text-white there); -muted = the softer line under a title */
.ds-text-on-primary { color: var(--color-on-primary) !important; }
.ds-text-on-primary-muted { color: color-mix(in srgb, var(--color-on-primary) 75%, transparent) !important; }
/* a tone's soft background with its ink text (with .ds-tone-*): replaces Bootstrap's bg-primary / bg-success ... */
.ds-fill { background-color: var(--ds-tone-soft) !important; color: var(--ds-tone-ink) !important; } /* !important: beats the old area CSS on cards / headers */
.ds-fill .text-white,
.ds-fill h1, .ds-fill h2, .ds-fill h3, .ds-fill h4, .ds-fill h5, .ds-fill h6 { color: inherit; }
.ds-min-w-0 { min-width: 0; }

/* ------------------------------------------------------------------------------- Schedule pieces (batches) */
/* week day pills: <div class="ds-days"><span class="ds-day is-on">M</span>...</div> */
.ds-days { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.ds-day {
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    border-radius: var(--radius-xs);
    padding: 1px 6px;
    background: var(--color-surface-2);
    color: var(--color-text-muted);
}
.ds-day.is-on { background: var(--color-primary-soft); color: var(--color-primary); }
/* progress ring: <div class="ds-ring" style="--p: 40"><div><b>40%</b><span>complete</span></div></div> */
.ds-ring {
    --p: 0;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    margin: 0 auto;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--color-success) calc(var(--p) * 1%), var(--color-surface-2) 0);
}
.ds-ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--color-surface); display: grid; place-items: center; text-align: center; }
.ds-ring b { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1; }
.ds-ring span { font-size: var(--font-size-xs); color: var(--color-text-muted); }
/* person cell: avatar + name / email */
.ds-person { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.ds-avatar {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: var(--font-weight-bold);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    object-fit: cover;
}
.ds-avatar--xl { width: 96px; height: 96px; font-size: 1.6rem; }
/* profile facts in columns: <dl class="ds-facts-grid"><div><dt>Phone</dt><dd>...</dd></div></dl> */
.ds-facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3) var(--space-5); margin: 0; }
.ds-facts-grid dt { font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .03em; }
.ds-facts-grid dt i { width: 14px; margin-right: 4px; color: var(--color-text-subtle); }
.ds-facts-grid dd { margin: 3px 0 0; font-weight: var(--font-weight-semibold); }
.ds-facts-grid__wide { grid-column: 1 / -1; }
/* label / value list in a side card */
.ds-dl { margin: 0; }
.ds-dl dt { font-size: var(--font-size-xs); color: var(--color-text-muted); font-weight: var(--font-weight-medium); }
.ds-dl dd { margin: 2px 0 var(--space-3); font-weight: var(--font-weight-semibold); }
.ds-dl dd:last-child { margin-bottom: 0; }
/* label | value side by side (stacks on phones) */
.ds-dl--rows { display: grid; grid-template-columns: minmax(120px, 40%) minmax(0, 1fr); gap: 10px var(--space-3); }
.ds-dl--rows dt { font-size: 13px; }
.ds-dl--rows dd { margin: 0; overflow-wrap: anywhere; }
/* main + side columns */
.ds-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0 var(--space-4); align-items: start; }
.ds-split > * { min-width: 0; }
/* stacked rows in a scroll box (lesson lists) */
.ds-list { max-height: 420px; overflow: auto; border: 1px solid var(--color-border); border-radius: var(--radius-control); }
.ds-list__row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: 10px 12px; border-top: 1px solid var(--color-border); }
.ds-list__row:first-child { border-top: 0; }
.ds-list__row[hidden] { display: none; }
/* a table box that scrolls inside the page; the head stays on top */
.ds-table-wrap.is-scroll { max-height: 520px; overflow: auto; }
.ds-table-wrap.is-scroll thead th { position: sticky; top: 0; z-index: 1; }
/* pill filters that filter a list on the page (no reload) */
.ds-pill-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-3); }
.ds-pill-filter {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: var(--radius-pill);
    padding: 5px 12px;
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
}
.ds-pill-filter b { margin-left: 2px; color: var(--color-text-muted); font-weight: var(--font-weight-semibold); }
.ds-pill-filter:hover { border-color: var(--color-primary); }
.ds-pill-filter.is-active { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.ds-pill-filter.is-active b { color: inherit; opacity: .8; }
.ds-pill-filter:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
/* week day picker (form): hidden checkbox + label */
.ds-daypick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ds-daypick input { position: absolute; opacity: 0; pointer-events: none; }
.ds-daypick label {
    display: block;
    margin: 0;
    padding: 8px 0;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    font-size: 13px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-muted);
    cursor: pointer;
}
.ds-daypick input:checked + label { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.ds-daypick input:focus-visible + label { outline: 2px solid var(--color-primary); outline-offset: 2px; }
/* small dashed quick-pick buttons under a field */
.ds-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-2); }
.ds-presets button {
    border: 1px dashed var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-pill);
    padding: 3px 10px;
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
}
.ds-presets button:hover { border-color: var(--color-primary); color: var(--color-primary); }
.ds-presets button.is-active { border-style: solid; border-color: var(--color-primary); color: var(--color-primary); }
/* a select2 next to an invalid select gets the same red border */
.ds-input.is-invalid + .select2-container .select2-selection,
.form-select.is-invalid + .select2-container .select2-selection { border-color: var(--color-danger); }
.ds-divider { margin: var(--space-4) 0; border: 0; border-top: 1px solid var(--color-border); opacity: 1; }
.ds-table th.ds-table__check { width: 44px; }
.ds-clickable { cursor: pointer; }
/* option cards: radio inputs shown as cards (<div class="ds-options"><input id><label for>...</div>) */
.ds-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2); }
.ds-options input { position: absolute; opacity: 0; pointer-events: none; }
.ds-options label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin: 0;
    padding: 10px 6px;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    font-size: 13.5px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
}
.ds-options label i { font-size: 1.3rem; color: var(--color-text-muted); }
.ds-options label small { display: block; color: var(--color-text-muted); font-weight: var(--font-weight-normal); }
.ds-options input:checked + label { border-color: var(--color-primary); background: var(--color-primary-soft); }
.ds-options input:checked + label i { color: var(--color-primary); }
.ds-options input:focus-visible + label { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ds-options--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* flatpickr makes its input readonly: it is still a normal, editable field */
.ds-input.flatpickr-input[readonly] { background-color: var(--color-surface); cursor: pointer; }
.ds-table__sub a { text-decoration: none; }
.ds-table__sub a:hover { text-decoration: underline; }
/* chosen items as removable chips */
.ds-picked {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 42px;
    max-height: 180px;
    overflow: auto;
    padding: var(--space-2);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-control);
}
.ds-picked .ds-badge button { border: 0; background: none; color: inherit; padding: 0; line-height: 1; }
/* small labelled bar in a table cell: <div class="ds-meter"><b class="ds-meter__value">80%</b>
   <div class="ds-progress ds-tone-success"><span style="width:80%"></span></div><small>8 of 10</small></div> */
.ds-meter { min-width: 120px; }
.ds-meter__value { display: block; margin-bottom: 3px; font-size: 12.5px; font-weight: var(--font-weight-bold); }
.ds-meter small { display: block; margin-top: 2px; font-size: 11px; color: var(--color-text-muted); }
.ds-progress[class*="ds-tone-"] > span { background: var(--ds-tone); }
/* a small "next class" line under a schedule */
.ds-next { margin-top: 6px; font-size: 12px; font-weight: var(--font-weight-semibold); color: var(--color-success); }
/* small note box */
.ds-note { display: flex; gap: 6px; padding: 10px 12px; border-radius: var(--radius-control); background: var(--color-primary-soft); color: var(--color-primary-ink); font-size: 13px; }
.ds-note--warn { background: var(--color-warning-soft); color: var(--color-warning-ink); }
.ds-note--danger { background: var(--color-danger-soft); color: var(--color-danger-ink); }
.ds-note--success { background: var(--color-success-soft); color: var(--color-success-ink); }
.ds-note ul { margin-bottom: 0; }
.ds-note[hidden] { display: none; }

/* ------------------------------------------------------------------------------- Merge pill (student page header) */
.ds-merge-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: 100%;
    padding: 5px 13px 5px 10px;
    border: 1px solid var(--color-accent-line);
    border-radius: var(--radius-pill);
    background: var(--color-accent-soft);
    color: var(--color-accent-ink);
    font-size: 13px;
    text-align: left;
}
.ds-merge-pill:hover { border-color: var(--color-accent); }
.ds-merge-pill:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.ds-merge-pill__dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--color-accent); }
.ds-merge-pill__since { margin-left: 3px; color: var(--color-accent-muted); }
.ds-merge-pill .fa-chevron-right { font-size: 10px; opacity: .7; }

/* ------------------------------------------------------------------------------- Merge cards (batch merges) */
.ds-merge-card { border-color: var(--color-accent-line); }
.ds-merge-card .ds-card__title { color: var(--color-accent-ink); }
.ds-merge {
    margin-bottom: var(--space-3);
    padding: 14px var(--space-4);
    border-radius: var(--radius-control);
    border-left: 4px solid var(--color-accent);
    background: var(--color-accent-soft);
}
.ds-merge:last-child { margin-bottom: 0; }
.ds-merge--in { background: var(--color-primary-soft); border-left-color: var(--color-primary); }
.ds-merge__head { display: flex; gap: var(--space-3); align-items: flex-start; }
.ds-merge__icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--color-surface); color: var(--color-accent); }
.ds-merge--in .ds-merge__icon { color: var(--color-primary); }
.ds-merge__title a { color: inherit; }
.ds-merge__meta { margin-top: 2px; font-size: 13px; color: var(--color-accent-muted); }
.ds-merge__chip { margin-left: 3px; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-accent); font-size: 11.5px; font-weight: var(--font-weight-semibold); }
.ds-merge__compare { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--space-2); align-items: stretch; margin-top: var(--space-3); }
.ds-merge__slot { padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface); }
.ds-merge__slot.is-now { border-color: var(--color-accent-line); box-shadow: 0 0 0 2px var(--color-accent-soft); }
.ds-merge--in .ds-merge__slot.is-now { border-color: var(--color-primary-line); }
.ds-merge__label { font-size: 11.5px; font-weight: var(--font-weight-bold); text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-muted); }
.ds-merge__time { margin-top: 6px; font-size: 14px; font-weight: var(--font-weight-bold); }
.ds-merge__arrow { display: grid; place-items: center; color: var(--color-accent); font-size: 1.2rem; }
.ds-merge__reason { margin: var(--space-3) 0 0; font-size: 13.5px; color: var(--color-accent-ink); }
.ds-merge__reason i { margin-right: 3px; opacity: .5; }
.ds-merge__people { margin-top: var(--space-2); }
.ds-merge__people summary { cursor: pointer; font-size: 13px; font-weight: var(--font-weight-semibold); color: var(--color-accent); }
.ds-merge__names { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.ds-merge__names .ds-badge { background: var(--color-surface); }

/* ------------------------------------------------------------------------------- Responsive */
@media (max-width: 991.98px) {
    .ds-split { grid-template-columns: minmax(0, 1fr); }
    .ds-app .ds-topbar__brand .ds-logo__img { max-width: 140px; height: 32px; }
}
@media (max-width: 575.98px) {
    .ds-app .ds-topbar { padding: 0 var(--space-2); }
    .ds-page-header { align-items: stretch; }
    .ds-page-header__actions { width: 100%; }
    .ds-filter-bar > .ds-field,
    .ds-filter-bar__actions { flex: 1 1 100%; }
    .ds-card { padding: var(--space-4); }
    .ds-facts { grid-template-columns: 1fr; }
    .ds-acc__content { padding-left: var(--space-4); }
    .ds-daypick { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    /* two stat tiles per row on phones (one per row made pages very long) */
    .ds-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
    .ds-stat { padding: var(--space-3); gap: var(--space-2); }
    .ds-stat__icon { display: none; }
    .ds-stat__value { font-size: 1.25rem; }
    .ds-merge__compare { grid-template-columns: 1fr; }
    .ds-merge__arrow { transform: rotate(90deg); }
    .ds-app .dropdown-menu.um-menu { width: min(310px, calc(100vw - 1.5rem)); }
}
@media (prefers-reduced-motion: reduce) {
    .ds-app .dropdown-menu.um-menu.show,
    .ds-app .um-chevron,
    .ds-app .um-item-arrow { animation: none; transition: none; }
}

/* video / player areas: dark in both modes (student course player) */
.ds-media { background: var(--color-media); color: var(--color-on-media); }
.ds-text-on-media { color: var(--color-on-media); }
/* a progress bar with a tone is solid (ds-fill alone is the soft surface) */
.progress-bar.ds-fill { background-color: var(--ds-tone) !important; color: var(--color-on-primary) !important; }
/* Bootstrap tone names used in data (bg-{{ $x }} became ds-tone-{{ $x }}): secondary / dark = neutral */
.ds-tone-secondary, .ds-tone-dark { --ds-tone: var(--color-neutral); --ds-tone-soft: var(--color-neutral-soft); --ds-tone-text: var(--color-neutral); --ds-tone-ink: var(--color-neutral); }

/* Settings → Appearance: preset swatches (radio cards), color input, live preview */
.ds-presets .ds-preset { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); cursor: pointer; font-size: 13px; background: var(--color-surface); }
.ds-preset input { position: absolute; opacity: 0; pointer-events: none; }
.ds-preset__swatch { width: 22px; height: 22px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-shadow) 15%, transparent); }
.ds-preset:has(input:checked) { border-color: var(--color-primary); box-shadow: var(--focus-ring); font-weight: var(--font-weight-semibold); }
.ds-preset:has(input:focus-visible) { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ds-color-input { width: 46px; height: 40px; padding: 2px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-control); background: var(--color-surface); cursor: pointer; flex: 0 0 auto; }
.ap-preview a { color: var(--color-primary); }
.ap-preview__bar { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: var(--radius-control); background: var(--color-surface-2); }
.ap-preview__item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--color-text-muted); }
.ap-preview__item.is-active { background: var(--color-primary-soft); color: var(--color-primary-ink); font-weight: var(--font-weight-semibold); }
