/* ── Project overrides on top of the Approx theme ──────────────────────── */

:root, [data-bs-theme] { --bs-font-sans-serif: "Cairo", "Tajawal", "Segoe UI", Tahoma, sans-serif; }
body, .startbar, .topbar, h1, h2, h3, h4, h5, h6, .btn, .form-control, .form-select, .dropdown-menu {
    font-family: "Cairo", "Tajawal", "Segoe UI", Tahoma, sans-serif;
}

/* Brand block: office name instead of an image logo */
.startbar .brand .logo { display: flex; align-items: center; }
.startbar .brand .brand-name { max-width: 170px; display: inline-block; }
body[data-sidebar-size="collapsed"] .startbar .brand .brand-name { display: none; }
.thumb-md.rounded-circle { display: inline-flex; align-items: center; justify-content: center; }

/* Numbers stay LTR inside RTL text so money and dates never read backwards. */
.num, .amount, td.num, .table td .num {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* Status pills — colour is always paired with a written label (spec §48). */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.status-pill .dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; flex: none; }
.status-pill.s-success { background: rgba(43,193,85,.12); color: #1f9d47; }
.status-pill.s-warning { background: rgba(255,169,0,.14); color: #c47f00; }
.status-pill.s-danger  { background: rgba(255,64,64,.12); color: #d63333; }
.status-pill.s-info    { background: rgba(31,138,255,.12); color: #1b74d8; }
.status-pill.s-primary { background: rgba(136,108,255,.12); color: #6c4ee3; }
.status-pill.s-secondary { background: rgba(120,130,140,.12); color: #6a7885; }
.status-pill.s-dark    { background: rgba(30,30,30,.10); color: #444; }

/* KPI cards on the dashboard */
.kpi-card { border: 0; height: 100%; }
.kpi-card .kpi-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; flex: none;
}
.kpi-card .kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.kpi-card .kpi-label { font-size: .85rem; color: var(--bs-body-color); opacity: .8; }

/* Client 360 header */
.client-hero { border-radius: 1rem; }
.client-hero .avatar-lg {
    width: 72px; height: 72px; border-radius: 1rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 700;
}
.metric-box { padding: .85rem 1rem; border-radius: .75rem; background: var(--bs-body-bg); height: 100%; }
.metric-box .label { font-size: .78rem; opacity: .75; margin-bottom: .15rem; }
.metric-box .value { font-size: 1.15rem; font-weight: 700; }

/* Timeline (client activity) */
.timeline-list { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline-list::before {
    content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 11px;
    width: 2px; background: var(--bs-border-color);
}
.timeline-list > li { position: relative; padding-inline-start: 2.25rem; padding-bottom: 1.15rem; }
.timeline-list > li .tl-dot {
    position: absolute; inset-inline-start: 0; top: .15rem;
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; color: #fff;
}
.timeline-list > li .tl-time { font-size: .75rem; opacity: .7; }

/* Pipeline board (leads) */
.pipeline { display: flex; gap: .85rem; overflow-x: auto; padding-bottom: .75rem; }
.pipeline-col { min-width: 265px; flex: 1 0 265px; }
.pipeline-col .col-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: .6rem .85rem; border-radius: .6rem .6rem 0 0; font-weight: 600; font-size: .88rem;
}
.pipeline-col .col-body {
    background: var(--bs-body-bg); border-radius: 0 0 .6rem .6rem;
    padding: .6rem; min-height: 140px; max-height: 62vh; overflow-y: auto;
}
.lead-card { background: var(--bs-card-bg, #fff); border-radius: .55rem; padding: .7rem .8rem; margin-bottom: .55rem; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.lead-card:last-child { margin-bottom: 0; }

/* Tables */
.table thead th { white-space: nowrap; font-size: .82rem; }
.table td { vertical-align: middle; }
.table-hover tbody tr { cursor: default; }
.table-linked tbody tr { cursor: pointer; }

/* Filter bar */
.filter-bar { background: var(--bs-card-bg, #fff); border-radius: .75rem; padding: .85rem 1rem; margin-bottom: 1.1rem; }
.filter-bar .form-control, .filter-bar .form-select { min-height: 42px; }

/* Notification list */
.reminder-item { display: flex; gap: .75rem; padding: .8rem .25rem; border-bottom: 1px solid var(--bs-border-color); }
.reminder-item:last-child { border-bottom: 0; }
.reminder-item.unread { background: rgba(136,108,255,.05); }
.reminder-item .r-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; }

/* Print — account statement (spec §13) */
@media print {
    .startbar, .startbar-overlay, .topbar, .footer, .no-print, .btn { display: none !important; }
    .page-wrapper, .page-content { margin: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    body { background: #fff !important; }
}

/* Empty states */
.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-state i { font-size: 2.5rem; opacity: .25; margin-bottom: .75rem; display: block; }
.empty-state p { margin: 0; opacity: .7; }


/* The theme's .badge-light is white-on-transparent, which disappears on a
   white card. Give it a real chip appearance. */
.badge-light {
    background-color: rgba(120, 130, 140, .12) !important;
    color: var(--bs-body-color) !important;
    border: 0;
}
.badge-light small { color: inherit; opacity: .7; }

/* Dark mode: surfaces that were hard-coded white */
[data-bs-theme="dark"] .filter-bar,
[data-bs-theme="dark"] .lead-card { background: var(--bs-card-bg, var(--bs-tertiary-bg)); }
[data-bs-theme="dark"] .status-pill.s-dark { background: rgba(255,255,255,.1); color: #ddd; }

/* Sidebar group arrow: the theme draws it with Line Awesome, which we don't ship. */
.startbar .navbar-nav .nav-item .nav-link[data-bs-toggle="collapse"]::after {
    font-family: "Font Awesome 6 Free" !important; font-weight: 900 !important; content: "\f105" !important; font-size: .75rem;
}
[dir="rtl"] .startbar .navbar-nav .nav-item .nav-link[data-bs-toggle="collapse"]::after { content: "\f104" !important; transform: none; }
[dir="rtl"] .startbar .navbar-nav .nav-item .nav-link[data-bs-toggle="collapse"][aria-expanded="true"]::after { transform: rotate(-90deg) !important; }

/* Topbar: keep the quick-add button vertically centred with the icons */
.topbar-custom li.topbar-item { display: flex; align-items: center; }
.topbar-custom .topbar-item .btn-sm { white-space: nowrap; }

/* KPI values: keep amount and currency together */
.kpi-card .kpi-value { white-space: nowrap; font-size: clamp(1.05rem, 1.4vw, 1.5rem); }

/* ── Auth screens (login / forgot / reset / force-change) ───────────────── */
.auth-page { background: var(--bs-body-bg); min-height: 100vh; }
.auth-wrap { display: flex; min-height: 100vh; }

.auth-brand {
    flex: 0 0 46%; max-width: 640px; position: relative; overflow: hidden; color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(255,255,255,.16) 0, transparent 38%),
        radial-gradient(circle at 85% 85%, rgba(255,255,255,.12) 0, transparent 40%),
        linear-gradient(145deg, #1d4ed8 0%, #3167f3 55%, #4f8bff 100%);
}
.auth-brand::after { /* subtle dot grid */
    content: ""; position: absolute; inset: 0; opacity: .18; pointer-events: none;
    background-image: radial-gradient(rgba(255,255,255,.9) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}
.auth-brand-inner { position: relative; z-index: 1; display: flex; flex-direction: column; padding: 3.5rem; width: 100%; }
.auth-brand-title { font-size: clamp(1.7rem, 2.4vw, 2.35rem); font-weight: 800; line-height: 1.45; color: #fff; margin-bottom: 1rem; }
.auth-brand-text { font-size: 1.02rem; line-height: 1.9; color: rgba(255,255,255,.82); max-width: 470px; margin-bottom: 2.25rem; }
.auth-features li { display: flex; align-items: center; gap: .85rem; margin-bottom: 1rem; font-weight: 500; color: rgba(255,255,255,.95); }
.auth-features li span {
    width: 40px; height: 40px; border-radius: 12px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.15); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,.18);
}
.auth-brand-foot { margin-top: auto; padding-top: 2rem; font-size: .85rem; color: rgba(255,255,255,.65); margin-bottom: 0; }

.auth-logo {
    width: 48px; height: 48px; border-radius: 14px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
    color: #fff; font-weight: 800; font-size: 1.5rem; font-family: "Cairo", sans-serif;
}
.auth-logo img { max-width: 100%; max-height: 100%; border-radius: 10px; }
.auth-logo-sm { width: 38px; height: 38px; font-size: 1.15rem; background: var(--bs-primary); border: 0; }

.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 1.5rem; }
.auth-topbar { width: 100%; max-width: 440px; display: flex; align-items: center; gap: 1rem; }
@media (min-width: 992px) { .auth-topbar { max-width: none; } }
.auth-card { width: 100%; max-width: 420px; margin: auto 0; padding: 2rem 0; }
.auth-title { font-weight: 800; font-size: 1.75rem; margin-bottom: .35rem; color: var(--bs-emphasis-color); }
.auth-card .form-label { font-weight: 600; font-size: .9rem; margin-bottom: .45rem; }
.auth-footnote { color: var(--bs-secondary-color); font-size: .8rem; margin: 0; }

.auth-input { position: relative; }
.auth-input > i {
    position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 1rem;
    color: var(--bs-secondary-color); font-size: .95rem; pointer-events: none;
}
.auth-input .form-control {
    height: 50px; border-radius: 12px; padding-inline-start: 2.75rem; padding-inline-end: 2.75rem;
    background-color: var(--bs-tertiary-bg); border-color: transparent; font-size: .95rem;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.auth-input .form-control:focus { background-color: var(--bs-body-bg); border-color: var(--bs-primary); box-shadow: 0 0 0 4px rgba(49,103,243,.12); }
.auth-input .form-control.is-invalid { border-color: var(--bs-danger); background-image: none; }
.auth-input .form-control[readonly] { opacity: .75; }
/* inputs are typed LTR (email/password); keep the icon on the start side of the page */
.auth-input .form-control[dir="ltr"] { text-align: start; }
[dir="rtl"] .auth-input .form-control[dir="ltr"] { text-align: right; }
.auth-input:has(.is-invalid) ~ .invalid-feedback { display: block; }
.auth-eye {
    position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: .5rem;
    border: 0; background: transparent; color: var(--bs-secondary-color);
    width: 36px; height: 36px; border-radius: 8px;
}
.auth-eye:hover { color: var(--bs-primary); background: rgba(49,103,243,.08); }

.auth-submit, .auth-card .btn-lg { height: 50px; border-radius: 12px; font-weight: 700; font-size: 1rem;
    box-shadow: 0 8px 20px -8px rgba(49,103,243,.7); }
.auth-card .btn-link.btn-lg, .auth-card .btn-link { box-shadow: none; }
.btn.is-loading { opacity: .75; pointer-events: none; }

.auth-demo { background: var(--bs-tertiary-bg); border-radius: 12px; padding: .75rem 1rem; font-size: .82rem; color: var(--bs-secondary-color); }
.auth-demo summary { cursor: pointer; font-weight: 600; color: var(--bs-body-color); }
.auth-demo li { padding: .2rem 0; }
.auth-card .form-switch .form-check-input { width: 2.4em; height: 1.3em; background-color: var(--bs-tertiary-bg); border-color: var(--bs-border-color); cursor: pointer; }
.auth-card .form-switch .form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.auth-card .form-check-label { cursor: pointer; padding-inline-start: .25rem; }

/* FullCalendar 6 on the Approx palette */
.fc .fc-event, .fc .fc-event .fc-event-main, .fc .fc-event a, .fc .fc-event-title, .fc .fc-event-time { color: #fff; }
.fc .fc-daygrid-dot-event, .fc .fc-daygrid-dot-event .fc-event-title, .fc .fc-list-event a { color: var(--bs-body-color); }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--bs-body-color); text-decoration: none; }
.fc .fc-day-today { background: rgba(49,103,243,.06) !important; }
.fc .fc-button-primary { background: var(--bs-primary); border-color: var(--bs-primary); }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:hover { background: #2554d4; border-color: #2554d4; }

/* Roles screen: a partly-selected group reads differently from a full one */
.group-toggle:indeterminate { background-color: rgba(49,103,243,.35); border-color: rgba(49,103,243,.35); }
.perm-item .form-check-label { cursor: pointer; }

/* Calendar: keep today highlighted but let its date stay readable; "+N more" link */
.fc .fc-daygrid-day.fc-day-today { padding: 0; border-radius: 0; }
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-frame { background-color: rgba(49,103,243,.08); border-radius: 0; }
.fc .fc-daygrid-more-link { font-size: .8rem; font-weight: 600; color: var(--bs-primary); }
.fc .fc-popover { z-index: 1010; box-shadow: 0 10px 30px rgba(0,0,0,.12); border-radius: 10px; overflow: hidden; }

/* Pagination (Bootstrap 5 view): breathing room and the summary line on its own row */
nav .pagination { margin: 1rem 0 0; flex-wrap: wrap; gap: .25rem; }
nav .pagination .page-link { border-radius: 8px !important; min-width: 38px; text-align: center; }
nav > .d-sm-flex > div:first-child p.small { margin-bottom: 0; }

/* Smart search dropdown */
.topbar .app-search .top-search { min-width: 360px; }
@media (min-width: 1400px) { .topbar .app-search .top-search { min-width: 440px; } }
.smart-search-menu {
    position: absolute; top: calc(100% + 6px); inset-inline-start: 0; width: min(560px, 92vw); max-height: 70vh; overflow-y: auto;
    background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 14px;
    box-shadow: 0 18px 40px -12px rgba(15, 23, 42, .25); z-index: 1050; padding: .35rem;
}
.smart-search-menu .ss-head { font-size: .72rem; font-weight: 700; color: var(--bs-secondary-color); padding: .55rem .7rem .25rem; }
.smart-search-menu .ss-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: 10px; color: var(--bs-body-color); text-decoration: none; }
.smart-search-menu .ss-item:hover, .smart-search-menu .ss-item.active { background: rgba(49,103,243,.08); color: var(--bs-primary); }
.smart-search-menu .ss-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.smart-search-menu .ss-t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smart-search-menu .ss-s { color: var(--bs-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smart-search-menu .ss-b { font-size: .7rem; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); border-radius: 6px; padding: .1rem .45rem; flex: none; }
.smart-search-menu .ss-ic { color: var(--bs-secondary-color); }
.smart-search-menu .ss-all { border-top: 1px solid var(--bs-border-color); margin-top: .3rem; border-radius: 0 0 10px 10px; font-weight: 600; }
.smart-search-menu .ss-empty { padding: 1rem; text-align: center; color: var(--bs-secondary-color); }
.smart-search-menu kbd { font-size: .65rem; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); border: 1px solid var(--bs-border-color); }

/* Sidebar: section labels a bit tighter, counters aligned */
.startbar .navbar-nav .menu-label { margin-top: .6rem; padding-top: 10px; padding-bottom: 6px; }
.startbar .navbar-nav .nav-link .sb-badge { font-size: .65rem; font-weight: 700; padding: .25em .5em; }
body[data-sidebar-size="collapsed"] .startbar:not(:hover) .sb-badge { position: absolute; top: 4px; inset-inline-end: 6px; }
.startbar .navbar-nav .nav-item .nav-link { position: relative; }

/* Searchable select (select[data-searchable]) */
.ss-select { position: relative; }
.ss-select .ss-native { position: absolute; inset: 0; opacity: 0; pointer-events: none; height: 100%; }
.ss-select .ss-input { padding-inline-end: 2.2rem; cursor: pointer; background-color: var(--bs-body-bg); }
.ss-select .ss-input:focus { cursor: text; }
.ss-select .ss-caret { position: absolute; top: 50%; inset-inline-end: .85rem; transform: translateY(-50%); font-size: .7rem; color: var(--bs-secondary-color); cursor: pointer; }
.ss-select .ss-panel {
    position: absolute; top: calc(100% + 4px); inset-inline: 0; z-index: 1065; max-height: 300px; overflow-y: auto;
    background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 10px;
    box-shadow: 0 14px 32px -12px rgba(15, 23, 42, .28); padding: .25rem;
}
.ss-select .ss-group { font-size: .72rem; font-weight: 700; color: var(--bs-secondary-color); padding: .45rem .65rem .2rem; }
.ss-select .ss-opt { padding: .45rem .65rem; border-radius: 7px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-select .ss-opt:hover, .ss-select .ss-opt.active { background: rgba(49,103,243,.09); color: var(--bs-primary); }
.ss-select .ss-opt.selected { font-weight: 700; }
.ss-select .ss-opt.selected::after { content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .7rem; margin-inline-start: .4rem; color: var(--bs-primary); }
.ss-select .ss-empty-opt { color: var(--bs-secondary-color); }
.ss-select .ss-none { padding: .7rem; text-align: center; color: var(--bs-secondary-color); }
.form-select-sm + .ss-caret, .ss-select .form-control-sm ~ .ss-caret { inset-inline-end: .6rem; }

/* ══ Floating glass sidebar ═══════════════════════════════════════════════
   A rounded panel floating 12px inside the window, accordion groups (one open
   at a time), settings pinned at the bottom, and no scrollbar. */
:root { --bs-startbar-width: 284px; --bs-startbar-collapsed-width: 92px; --sb-gap: 12px; }

.startbar.sb-glass {
    top: var(--sb-gap); bottom: var(--sb-gap); inset-inline-start: var(--sb-gap);
    right: auto; left: auto;
    width: calc(var(--bs-startbar-width) - var(--sb-gap) * 2);
    border: 0; border-radius: 26px; overflow: hidden;
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(99, 132, 255, .22) 0%, transparent 55%),
        radial-gradient(90% 50% at 100% 100%, rgba(140, 92, 255, .18) 0%, transparent 60%),
        linear-gradient(180deg, rgba(23, 29, 48, .96) 0%, rgba(15, 19, 33, .97) 100%);
    backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, .22),
        inset 0 -1px 1px rgba(255, 255, 255, .06),
        inset 0 0 60px rgba(255, 255, 255, .04),
        0 24px 60px rgba(15, 23, 42, .28);
    display: flex; flex-direction: column;
}
[dir="rtl"] .startbar.sb-glass { right: var(--sb-gap); }
[dir="ltr"] .startbar.sb-glass { left: var(--sb-gap); }

/* Brand */
.startbar.sb-glass .sb-brand {
    height: 68px; flex: none; padding: 0 18px; width: 100% !important;
    border-bottom: 1px solid rgba(255, 255, 255, .08); background: transparent;
}
.startbar.sb-glass .sb-brand .logo { display: flex !important; align-items: center; gap: 10px; min-width: 0; }
.startbar.sb-glass .sb-logo {
    width: 36px; height: 36px; border-radius: 11px; flex: none; display: inline-flex !important; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #4f7dff, #8a5cff); color: #fff; font-weight: 800; font-size: 1.05rem;
    box-shadow: 0 6px 16px -4px rgba(79, 125, 255, .6);
}
.startbar.sb-glass .brand-name { color: #fff; font-weight: 700; font-size: .98rem; max-width: 175px; display: inline-block; height: auto !important; }

/* Menu area: fills the panel, never shows a scrollbar */
.startbar.sb-glass .startbar-menu { flex: 1; min-height: 0; height: auto; padding-bottom: 0; display: flex; }
.startbar.sb-glass .startbar-collapse {
    flex: 1; height: auto !important; padding: 12px 12px 14px; overflow-y: auto; overflow-x: hidden;
    scrollbar-width: none; -ms-overflow-style: none; display: flex;
}
.startbar.sb-glass .startbar-collapse::-webkit-scrollbar { display: none; }
.startbar.sb-glass .sb-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: 100%; margin: 0; padding: 0; }
.startbar.sb-glass .sb-nav > .sb-bottom { margin-top: auto; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .08); }

/* Top-level rows */
.startbar.sb-glass .sb-nav > .nav-item > .nav-link {
    position: relative; display: flex; align-items: center; gap: 12px;
    height: 44px; padding: 0 12px; margin: 0; border-radius: 12px;
    color: rgba(255, 255, 255, .72); font-weight: 600; font-size: .9rem;
    transition: background-color .25s, color .25s;
}
.startbar.sb-glass .sb-nav > .nav-item > .nav-link > span:not(.sb-badge) { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.startbar.sb-glass .sb-nav .menu-icon { width: 18px; font-size: 16px; text-align: center; flex: none; color: rgba(255, 255, 255, .62); margin: 0 !important; transition: color .25s; }
.startbar.sb-glass .sb-nav > .nav-item > .nav-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.startbar.sb-glass .sb-nav > .nav-item > .nav-link.active,
.startbar.sb-glass .sb-nav > .nav-item > .nav-link[aria-expanded="true"] { background: rgba(255, 255, 255, .1); color: #fff; }
.startbar.sb-glass .sb-nav > .nav-item > .nav-link.active .menu-icon,
.startbar.sb-glass .sb-nav > .nav-item > .nav-link[aria-expanded="true"] .menu-icon { color: #8fb0ff; }
/* The theme's own collapse arrow is replaced by .sb-chev */
.startbar.sb-glass .nav-link[data-bs-toggle="collapse"]::after { display: none !important; content: none !important; }
.startbar.sb-glass .sb-chev { font-size: 11px; width: 18px; text-align: center; flex: none; color: rgba(255, 255, 255, .5); transition: transform .3s ease; }
.startbar.sb-glass .nav-link[aria-expanded="true"] .sb-chev { transform: rotate(-180deg); color: #fff; }

/* Counters */
.startbar.sb-glass .sb-badge {
    flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    font-size: .68rem; font-weight: 700; color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.startbar.sb-glass .sb-badge.bg-warning { color: #3b2a00; }
.startbar.sb-glass .nav-link[aria-expanded="true"] > .sb-badge { display: none; } /* shown on the child row instead */

/* Sub menu: dot bullets, smooth open (Bootstrap collapse animates the height) */
.startbar.sb-glass .collapse, .startbar.sb-glass .collapsing { transition: height .35s ease; }
.startbar.sb-glass .sb-sub { padding: 4px 0 6px; margin: 0; gap: 2px; }
.startbar.sb-glass .sb-sub .nav-link {
    position: relative; display: flex; align-items: center; gap: 8px;
    height: 38px; border-radius: 10px; margin: 0; padding: 0 12px;
    padding-inline-start: 42px; color: rgba(255, 255, 255, .62); font-size: .86rem; font-weight: 500;
    transition: background-color .25s, color .25s;
}
.startbar.sb-glass .sb-sub .nav-link > span:not(.sb-badge) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.startbar.sb-glass .sb-sub .nav-link::before {
    content: ""; position: absolute; top: 50%; inset-inline-start: 20px; width: 5px; height: 5px; border-radius: 50%;
    transform: translateY(-50%); background-color: rgba(255, 255, 255, .35); transition: background-color .25s, box-shadow .25s;
}
.startbar.sb-glass .sb-sub .nav-link:hover { background: rgba(255, 255, 255, .04); color: #fff; }
.startbar.sb-glass .sb-sub .nav-link.active { color: #fff; background: rgba(255, 255, 255, .07); }
.startbar.sb-glass .sb-sub .nav-link.active::before { background-color: #8fb0ff; box-shadow: 0 0 0 3px rgba(143, 176, 255, .18); }

/* Page offsets follow the floating panel */
.page-wrapper .page-content { margin-inline-start: var(--bs-startbar-width); }
.topbar { width: calc(100% - var(--bs-startbar-width)); }

/* Desktop "mini" mode: icons only, expands on hover */
@media (min-width: 1200px) {
    body[data-sidebar-size="collapsed"] .startbar.sb-glass:not(:hover) { width: calc(var(--bs-startbar-collapsed-width) - var(--sb-gap) * 2); }
    body[data-sidebar-size="collapsed"] .startbar.sb-glass:not(:hover) .brand-name,
    body[data-sidebar-size="collapsed"] .startbar.sb-glass:not(:hover) .sb-nav .nav-link > span,
    body[data-sidebar-size="collapsed"] .startbar.sb-glass:not(:hover) .sb-chev,
    body[data-sidebar-size="collapsed"] .startbar.sb-glass:not(:hover) .collapse { display: none !important; }
    body[data-sidebar-size="collapsed"] .startbar.sb-glass:not(:hover) .sb-brand { padding: 0; justify-content: center; }
    body[data-sidebar-size="collapsed"] .startbar.sb-glass:not(:hover) .sb-nav > .nav-item > .nav-link { justify-content: center; padding: 0; }
    body[data-sidebar-size="collapsed"] .startbar.sb-glass:not(:hover) .sb-badge {
        position: absolute; top: 4px; inset-inline-end: 4px; min-width: 16px; height: 16px; font-size: .6rem; padding: 0 4px;
    }
    body[data-sidebar-size="collapsed"] .startbar.sb-glass:hover { box-shadow: inset 0 1px 1px rgba(255,255,255,.22), 0 30px 80px rgba(15,23,42,.45); }
    body[data-sidebar-size="collapsed"] .page-wrapper .page-content { margin-inline-start: var(--bs-startbar-collapsed-width); }
    body[data-sidebar-size="collapsed"] .topbar { width: calc(100% - var(--bs-startbar-collapsed-width)); }
}

/* Tablet / phone: slides in over the page */
@media (max-width: 1199.98px) {
    .page-wrapper .page-content { margin-inline-start: 0 !important; }
    .topbar { width: 100% !important; }
    .startbar.sb-glass { transition: transform .35s ease, opacity .25s; margin: 0 !important; }
    body[data-sidebar-size="collapsed"] .startbar.sb-glass { transform: translateX(calc(100% + var(--sb-gap) * 2)); opacity: 0; pointer-events: none; }
    [dir="ltr"] body[data-sidebar-size="collapsed"] .startbar.sb-glass { transform: translateX(calc(-100% - var(--sb-gap) * 2)); }
}

/* Win over the theme's own startbar link colours */
.startbar.sb-glass .sb-badge { flex: none !important; }
.startbar.sb-glass .sb-nav .nav-item .nav-link.active,
.startbar.sb-glass .sb-nav .nav-item .nav-link[aria-expanded="true"] { color: #fff !important; }
.startbar.sb-glass .sb-nav > .nav-item > .nav-link.active,
.startbar.sb-glass .sb-nav > .nav-item > .nav-link[aria-expanded="true"] { background-color: rgba(255, 255, 255, .1) !important; }
.startbar.sb-glass .sb-sub .nav-item .nav-link { background-color: transparent !important; color: rgba(255, 255, 255, .62) !important; }
.startbar.sb-glass .sb-sub .nav-item .nav-link:hover { background-color: rgba(255, 255, 255, .04) !important; color: #fff !important; }
.startbar.sb-glass .sb-sub .nav-item .nav-link.active { background-color: rgba(255, 255, 255, .08) !important; color: #fff !important; font-weight: 600; }
.startbar.sb-glass .nav-item.active { background: transparent !important; }

/* Short screens (laptops ≤ 820px tall): tighter rows so even the largest group fits without scrolling */
@media (max-height: 820px) {
    .startbar.sb-glass .sb-brand { height: 58px; }
    .startbar.sb-glass .startbar-collapse { padding: 8px 10px 10px; }
    .startbar.sb-glass .sb-nav { gap: 2px; }
    .startbar.sb-glass .sb-nav > .nav-item > .nav-link { height: 40px; }
    .startbar.sb-glass .sb-sub { padding: 2px 0 4px; }
    .startbar.sb-glass .sb-sub .nav-link { height: 33px; }
    .startbar.sb-glass .sb-nav > .sb-bottom { padding-top: 6px; }
}
@media (max-height: 680px) {
    .startbar.sb-glass .sb-nav > .nav-item > .nav-link { height: 36px; font-size: .85rem; }
    .startbar.sb-glass .sb-sub .nav-link { height: 30px; font-size: .82rem; }
}
