/* ── Base ──
   Colours come from public/css/theme.css. Do not write raw hex here —
   a literal colour will not follow the light/dark switch. The only
   exceptions, marked inline below, are colours painted on a surface
   that is dark in BOTH themes (the sidebar) or on a solid fill. */
body {
    font-family: 'Cairo', 'Figtree', ui-sans-serif, system-ui, sans-serif;
    background: var(--surface-page);
    color: var(--text-body);
}

[dir="rtl"] {
    font-family: 'Cairo', ui-sans-serif, system-ui, sans-serif;
}

/* The dashboards do not load Bootstrap's reset, so <hr> keeps the browser
   default `border-style: inset`. That renders as a 3D bevel, which reads as a
   blue-violet rule on a dark surface. Flatten it. */
hr {
    border: 0;
    border-top: 1px solid var(--border);
    opacity: 1;
}

/* ================================================================
   SELECT2 — global project-wide overrides
   ================================================================ */
/* ── Select2 ──────────────────────────────────────────────────────────── */
.select2-container {
    font-family: 'Cairo', ui-sans-serif, sans-serif;
    font-size: .875rem;
}

/* Trigger button */
.select2-container--default .select2-selection--single {
    height: 42px;
    min-height: 42px;
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    display: flex;
    align-items: center;
    background: var(--surface-card);
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s;
}

/* Rendered text — must have min-width:0 to shrink as a flex item */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    flex: 1;
    min-width: 0;
    display: block;
    color: var(--text-strong);
    font-size: .875rem;
    font-family: 'Cairo', ui-sans-serif, sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 .875rem 0 2.4rem;
    line-height: 42px;
}
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0 2.4rem 0 .875rem;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-faint);
}

/* Chevron arrow */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute;
    height: 42px;
    width: 2.2rem;
    top: 0;
    inset-inline-start: 0;
    inset-inline-end: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    inset-inline-start: 0;
    inset-inline-end: auto;
    right: auto;
    left: 0;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--text-muted) transparent transparent transparent;
    border-width: 5px 4px 0 4px;
    margin-top: 1px;
    transition: transform .2s;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: var(--accent) transparent transparent transparent;
    transform: rotate(180deg);
    margin-top: -4px;
}

/* Focus / open state */
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .12);
    outline: none;
}
.select2-container--default.is-invalid .select2-selection--single {
    border-color: var(--danger-alt);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger-alt) 12%, transparent);
}

/* Dropdown panel — the library ships no background of its own, so it has to
   be set here or the panel stays white in the dark theme */
.select2-dropdown {
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface-card);
    box-shadow: var(--shadow-pop);
    font-family: 'Cairo', ui-sans-serif, sans-serif;
    font-size: .875rem;
    overflow: hidden;
    margin-top: 4px;
    animation: select2FadeIn .12s ease;
}
@keyframes select2FadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.select2-results__options { padding: .3rem; max-height: 260px; overflow-y: auto; }

/* Option items */
.select2-container--default .select2-results__option {
    padding: .55rem .85rem;
    border-radius: 7px;
    color: var(--text-body);
    background: transparent;
    white-space: nowrap;
    transition: background .1s;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--accent-bg);
    color: var(--accent-fg);
}
.select2-container--default .select2-results__option[aria-selected=true] {
    background: var(--accent-bg-strong);
    color: var(--accent-fg);
    font-weight: 700;
}
.select2-container--default .select2-results__option[aria-disabled=true] { color: var(--text-faint); }

/* Search field inside dropdown */
.select2-search--dropdown { padding: .5rem .5rem .2rem; }
.select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface-card);
    color: var(--text-strong);
    padding: .45rem .7rem;
    font-family: 'Cairo', ui-sans-serif, sans-serif;
    font-size: .85rem;
    width: 100%;
    outline: none;
    transition: border-color .15s;
}
.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .1);
}

/* ================================================================
   FLATPICKR — project-wide theme (follows the brand colour)
   ================================================================ */
.flatpickr-calendar {
    font-family: 'Cairo', ui-sans-serif, sans-serif !important;
    border-radius: 14px !important;
    background: var(--surface-card) !important;
    color: var(--text-body) !important;
    box-shadow: var(--shadow-pop) !important;
    border: 1.5px solid var(--border) !important;
    font-size: .85rem !important;
    padding: .25rem !important;
    overflow: hidden !important;
}
/* The library hard-codes near-black day text, which disappears on a dark card */
.flatpickr-day {
    border-radius: 8px !important;
    color: var(--text-body) !important;
    font-family: 'Cairo', ui-sans-serif, sans-serif !important;
}
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay,
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover { color: var(--text-faint) !important; }
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--company-primary) !important;
    border-color: var(--company-primary) !important;
    color: var(--text-on-brand) !important;
    font-weight: 700 !important;
}
.flatpickr-day.today {
    border-color: var(--brand) !important;
    color: var(--brand) !important;
    font-weight: 700 !important;
}
.flatpickr-day.today:hover {
    background: var(--company-primary-light) !important;
    color: var(--brand) !important;
}
.flatpickr-day:hover { background: var(--surface-muted) !important; }
.flatpickr-day.inRange {
    background: var(--company-primary-light) !important;
    border-color: var(--company-primary-light) !important;
    color: var(--brand-hover) !important;
}
.flatpickr-months .flatpickr-month {
    background: var(--company-primary) !important;
    color: #fff !important;              /* sits on the solid brand fill */
    border-radius: 10px 10px 0 0 !important;
    height: 44px !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    color: #fff !important;              /* sits on the solid brand fill */
    background: transparent !important;
    font-family: 'Cairo', sans-serif !important;
    font-weight: 700 !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background: var(--company-primary) !important;
    color: #fff !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: rgba(255, 255, 255, .15) !important;
}
.flatpickr-weekdays { background: var(--surface-raised) !important; }
span.flatpickr-weekday {
    color: var(--brand) !important;
    background: transparent !important;
    font-weight: 700 !important;
    font-family: 'Cairo', sans-serif !important;
}
.flatpickr-prev-month,
.flatpickr-next-month {
    color: #fff !important;              /* header strip is the brand fill */
    fill: #fff !important;
}
.flatpickr-prev-month:hover,
.flatpickr-next-month:hover { background: rgba(255, 255, 255, .2) !important; border-radius: 6px; }
.flatpickr-prev-month svg,
.flatpickr-next-month svg { fill: #fff !important; }
/* Time picker (used by the range/hour inputs) */
.flatpickr-time input,
.flatpickr-time .flatpickr-time-separator,
.flatpickr-time .flatpickr-am-pm {
    background: var(--surface-card) !important;
    color: var(--text-body) !important;
}
.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover { background: var(--surface-muted) !important; }

/* ── Company-scoped utilities ── */
.btn-company-primary {
    --bs-btn-bg: var(--company-primary);
    --bs-btn-border-color: var(--company-primary);
    --bs-btn-hover-bg: var(--company-secondary);
    --bs-btn-hover-border-color: var(--company-secondary);
    --bs-btn-color: var(--text-on-brand);
    background-color: var(--company-primary);
    border-color: var(--company-primary);
    color: var(--text-on-brand);
}

.company-settings-card {
    border-top: 0.25rem solid var(--brand);
}

.company-settings-logo-preview {
    max-height: 5rem;
    max-width: 12rem;
    object-fit: contain;
}

/* ── Super-Admin Shell ── */
.super-admin-shell {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    background: var(--shell-gradient);
    color: var(--text-strong);
    font-family: 'Cairo', ui-sans-serif, system-ui, sans-serif;
}

.super-admin-layout {
    box-sizing: border-box;
    height: 100vh;
    min-height: 0;
    display: grid;
    grid-template-columns: 228px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        'sidebar topbar'
        'sidebar main';
    gap: .75rem;
    padding: .75rem;
    overflow: hidden;
}

.super-admin-main {
    grid-area: main;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    overflow-x: hidden;
    direction: ltr; /* scrollbar on right side regardless of page locale */
    padding: clamp(.75rem, 1.1vw, 1rem);
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-card-80);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.sa-main-inner {
    min-height: 100%;
}

/* ── Super-admin top bar ──
   Sits in its own grid row beside the sidebar, so it stays put while the
   page scrolls. Holds the language switcher, the appearance / help /
   notifications buttons and the account menu — all of which used to be
   repeated per page or parked at the bottom of the sidebar. */
.sa-topbar {
    grid-area: topbar;
    /* Above .super-admin-main: it comes later in the DOM and its
       backdrop-filter makes a stacking context, so without this the account
       menu would open behind the page. */
    position: relative;
    z-index: 30;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .45rem .75rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-card-80);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.sa-topbar__meta { min-width: 0; }

.sa-topbar__date {
    font-size: .78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.sa-topbar__tools {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

.sa-topbar__sep {
    width: 1px;
    align-self: stretch;
    margin-inline: .15rem;
    background: var(--border);
}

.sa-topbar__icon-btn {
    position: relative;
    width: 2.2rem;
    height: 2.2rem;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-card);
    color: var(--text-body);
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.sa-topbar__icon-btn:hover {
    color: var(--accent-solid);
    border-color: var(--accent-solid);
}

.sa-topbar__badge {
    position: absolute;
    top: -5px;
    inset-inline-end: -5px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    display: grid;
    place-items: center;
    border-radius: 99px;
    background: var(--danger-solid);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
}

/* ── Account menu ── */
.sa-profile { position: relative; }

.sa-profile__trigger {
    display: flex;
    align-items: center;
    gap: .55rem;
    max-width: 18rem;
    padding: .3rem .55rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-card);
    color: var(--text-strong);
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.sa-profile__trigger:hover,
.sa-profile.is-open .sa-profile__trigger { border-color: var(--accent-solid); }

.sa-profile__avatar {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, #2b6cff, #6b4dff);
    color: #fff;
    font-weight: 800;
    font-size: .85rem;
}

/* A company logo stands in for the initial. It sits on a plain ground rather
   than the gradient, since a logo image (unlike the letter it replaces)
   brings its own background. */
.sa-profile__avatar--logo {
    background: var(--surface-raised);
    border: 1px solid var(--border);
}

.sa-profile__avatar img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    object-fit: cover;
}

.sa-profile__info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: start;
}

.sa-profile__info strong {
    font-size: .8rem;
    font-weight: 800;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-profile__info span {
    font-size: .68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-profile__caret {
    font-size: .7rem;
    color: var(--text-faint);
    transition: transform .15s ease;
}

.sa-profile.is-open .sa-profile__caret { transform: rotate(180deg); }

.sa-profile__menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + .45rem);
    inset-inline-end: 0;
    min-width: 14rem;
    padding: .35rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-raised);
    box-shadow: var(--shadow-lg);
}

.sa-profile__header {
    padding: .55rem .6rem;
    margin-bottom: .25rem;
    border-bottom: 1px solid var(--border-subtle, var(--border));
}

.sa-profile__header strong {
    display: block;
    font-size: .82rem;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-profile__header span {
    display: block;
    font-size: .7rem;
    color: var(--text-muted);
    word-break: break-all;
}

.sa-profile__role {
    color: var(--accent-fg);
    font-weight: 700;
    word-break: normal;
}

.sa-profile__item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .6rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-body);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}

.sa-profile__item i { font-size: .95rem; width: 1.1rem; text-align: center; }
.sa-profile__item:hover { background: var(--surface-card); color: var(--text-strong); }

.sa-profile__item--danger { color: var(--danger-solid); }
.sa-profile__item--danger:hover { background: rgba(239, 68, 68, .12); color: var(--danger-solid); }

/* ── Notifications dropdown ── */
.sa-notif { position: relative; }

.sa-notif__panel {
    position: absolute;
    z-index: 60;
    top: calc(100% + .45rem);
    inset-inline-end: 0;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-raised);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.sa-notif__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--border-subtle, var(--border));
}
.sa-notif__header strong { font-size: .85rem; color: var(--text-strong); }
.sa-notif__mark-all {
    border: 0;
    background: none;
    padding: 0;
    color: var(--accent-fg);
    font-size: .72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}
.sa-notif__mark-all:hover { text-decoration: underline; }

/* Capped and scrollable only inside the topbar dropdown — the full
   notifications page reuses the same list/item classes uncapped. */
.sa-notif__panel .sa-notif__list {
    max-height: 22rem;
    overflow-y: auto;
}

.sa-notif__item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .7rem .9rem;
    border: 0;
    border-bottom: 1px solid var(--border-subtle, var(--border));
    background: transparent;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
}
/* Each item is wrapped in its own <form> (the mark-as-read submit target),
   so :last-child on the button itself always matches — it targets the
   form's own last child, not the last item in the list. Check the form's
   position among its siblings instead. */
.sa-notif__list form:last-child .sa-notif__item { border-bottom: 0; }
.sa-notif__item:hover { background: var(--surface-card); }
.sa-notif__item.is-unread { background: var(--company-primary-light); }

.sa-notif__icon {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .85rem;
}
.sa-notif__icon--indigo { background: var(--tone-indigo-bg); color: var(--tone-indigo-fg); }
.sa-notif__icon--blue   { background: var(--tone-blue-bg);   color: var(--tone-blue-fg); }
.sa-notif__icon--amber  { background: var(--tone-amber-bg);  color: var(--tone-amber-fg); }
.sa-notif__icon--red    { background: var(--tone-red-bg);    color: var(--tone-red-fg); }

.sa-notif__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.sa-notif__title {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-strong);
}
.sa-notif__text {
    font-size: .74rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.sa-notif__time {
    font-size: .68rem;
    color: var(--text-faint);
    margin-top: .1rem;
}

.sa-notif__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: 2rem 1rem;
    color: var(--text-faint);
    font-size: .8rem;
}
.sa-notif__empty i { font-size: 1.4rem; }

.sa-notif__footer {
    display: block;
    padding: .65rem .9rem;
    text-align: center;
    font-size: .78rem;
    font-weight: 700;
    color: var(--accent-fg);
    text-decoration: none;
    border-top: 1px solid var(--border-subtle, var(--border));
}
.sa-notif__footer:hover { background: var(--surface-card); }


.super-dashboard {
    min-height: 100%;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: clamp(.55rem, .85vw, .8rem);
}

/* ── Sidebar ──
   Dark in both themes, so the colours painted on it stay literal. */
.super-sidebar {
    grid-area: sidebar;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1.45rem 1rem;
    color: #fff;
    border-radius: 18px 0 0 18px;
    background: var(--sidebar-gradient);
    box-shadow: var(--sidebar-shadow);
}

[dir="rtl"] .super-sidebar { border-radius: 0 18px 18px 0; }

.super-sidebar__brand {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-bottom: 1.75rem;
    padding-inline: .45rem;
}

.super-sidebar__logo {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #2b6cff, #6b4dff);
    box-shadow: 0 18px 34px rgba(43, 108, 255, .32);
}

.super-sidebar__brand strong {
    display: block;
    font-size: 1.8rem;
    line-height: 1;
    letter-spacing: -.04em;
}

.super-sidebar__brand span {
    color: #aebdec;
    font-size: .75rem;
}

.super-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.super-sidebar__nav::-webkit-scrollbar { display: none; }

.super-sidebar__link {
    display: flex;
    align-items: center;
    gap: .72rem;
    min-height: 2.9rem;
    padding: .6rem .9rem;
    color: rgba(255, 255, 255, .78);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: .18s ease;
    flex-shrink: 0;
}

.super-sidebar__link i {
    font-size: 1.05rem;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.super-sidebar__link span { flex: 1; font-size: .875rem; font-weight: 600; }

.super-sidebar__link:hover,
.super-sidebar__link.is-active {
    color: #fff;
    border-color: rgba(148, 177, 255, .28);
    background: linear-gradient(135deg, #2868f0, #6344df);
    box-shadow: 0 14px 28px rgba(43, 108, 255, .28);
}

/* ── Header ── */
.super-header {
    display: grid;
    grid-template-columns: auto minmax(240px, 1fr) auto;
    grid-template-areas: 'title search cta';
    gap: .65rem .9rem;
    align-items: center;
    direction: inherit;
}

.super-header__title {
    grid-area: title;
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}

.super-header__page-icon {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--accent-bg);
    color: var(--accent);
}

.super-header__search { grid-area: search; display: flex; min-width: 0; }
.super-header__search .super-search { flex: 1; }

.super-header__cta {
    grid-area: cta;
    display: flex;
    align-items: center;
    gap: .65rem;
}

.super-header h1 {
    margin: 0;
    color: var(--text-strong);
    font-size: clamp(1.1rem, 1.5vw, 1.45rem);
    font-weight: 900;
    letter-spacing: -.03em;
    white-space: nowrap;
}

.super-header p {
    margin: .2rem 0 0;
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Search ── */
.super-search {
    flex: 1;
    min-width: 240px;
    height: 3.05rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 0 .95rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-card-80);
    box-shadow: var(--shadow-md);
    direction: inherit;
}

.super-search input {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-strong);
    font-size: .84rem;
}

.super-search input:focus { outline: 0; box-shadow: none; }
.super-search kbd { color: var(--text-faint); border: 1px solid var(--border); border-radius: 6px; padding: .05rem .42rem; background: var(--surface-raised); font-size: .75rem; }

/* ── Buttons ── */
.super-tool-button {
    position: relative;
    width: 2.95rem;
    height: 2.95rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-card-86);
    color: var(--text-body);
    box-shadow: var(--shadow-md);
    font-weight: 800;
}

.super-tool-button b {
    position: absolute;
    top: -.35rem;
    inset-inline-end: -.25rem;
    min-width: 1rem;
    height: 1rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text-on-brand);
    background: var(--accent-solid);
    font-size: .65rem;
}

.super-primary-button,
.super-filter,
.super-ghost-button,
.super-more-button {
    border: 0;
    font-weight: 800;
    white-space: nowrap;
}

.super-primary-button {
    min-height: 3.05rem;
    padding: 0 1.35rem;
    color: var(--text-on-brand);
    border-radius: 10px;
    background: var(--accent-gradient);
    box-shadow: 0 14px 28px rgba(var(--accent-rgb), .24);
}

.super-filter {
    min-height: 2.6rem;
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--text-body);
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-card-72);
    text-decoration: none;
    cursor: pointer;
}

.super-locale-btn {
    min-height: 2.6rem;
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--accent);
    border: 1.5px solid var(--accent-border);
    border-radius: 10px;
    background: var(--accent-bg);
    text-decoration: none;
    font-weight: 900;
    font-size: .83rem;
    white-space: nowrap;
    transition: background .15s ease;
}

.super-locale-btn:hover { background: var(--accent-bg-strong); }

/* ── Stat Cards ── */
.super-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .72rem;
}

.super-stat,
.super-panel {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-card-86);
    box-shadow: var(--shadow-card);
}

.super-stat {
    position: relative;
    min-height: 6.7rem;
    padding: .82rem;
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    grid-template-areas: 'icon content';
    gap: .85rem;
    align-items: center;
}

[dir="rtl"] .super-stat {
    grid-template-columns: minmax(0, 1fr) 3.25rem;
    grid-template-areas: 'content icon';
}

.super-stat__icon {
    grid-area: icon;
    width: 3.25rem;
    height: 3.25rem;
    display: grid;
    place-items: center;
    border-radius: 15px;
    color: var(--accent);
    background: var(--accent-bg-gradient);
}

.super-stat__content { grid-area: content; text-align: start; min-width: 0; }
.super-stat span { display: block; color: var(--text-strong); font-size: .92rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.super-stat strong { display: block; margin-top: .32rem; color: var(--text-strong); font-size: clamp(1.35rem, 2vw, 1.85rem); line-height: 1; font-weight: 900; letter-spacing: -.035em; }
.super-stat small { display: block; margin-top: .55rem; color: var(--success-alt); font-size: .76rem; font-weight: 800; unicode-bidi: plaintext; }

.super-stat--emerald .super-stat__icon { color: var(--success-alt); background: var(--success-bg); }
.super-stat--violet .super-stat__icon { color: var(--accent); background: var(--accent-bg); }
.super-stat--amber .super-stat__icon { color: var(--orange); background: var(--warning-bg); }
.super-stat--amber small { color: var(--danger-alt); }
.super-stat--indigo .super-stat__icon { color: var(--teal); background: var(--teal-bg); }

/* ── Dashboard Grid ── */
.super-dashboard__grid {
    min-height: 0;
    display: grid;
    grid-template-columns: 1.18fr .7fr .86fr;
    grid-template-rows: minmax(205px, .82fr) minmax(235px, 1fr);
    grid-template-areas: 'growth plans modules' 'companies activity system';
    gap: .75rem;
}

/* ── Panels ── */
.super-panel {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: .75rem .85rem;
}

.super-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: .55rem;
}

.super-panel__header h2 {
    margin: 0;
    color: var(--text-strong);
    font-size: 1rem;
    font-weight: 900;
}

.super-panel--growth { grid-area: growth; }
.super-panel--plans { grid-area: plans; }
.super-panel--modules { grid-area: modules; }
.super-panel--companies { grid-area: companies; }
.super-panel--activity { grid-area: activity; }
.super-panel--system { grid-area: system; }

.super-chart { position: relative; min-height: 0; flex: 1; }

/* ── Donut Chart ──
   The three wedge colours are categorical data colours: they carry meaning of
   their own and read on either background, so they stay literal. */
.super-donut {
    width: min(150px, 45vw);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    margin: .25rem auto .8rem;
    border-radius: 50%;
    background: conic-gradient(#2f6df6 0 38%, #7b61ff 38% 80%, #4ac0a3 80% 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 14px 26px rgba(67, 97, 238, .18);
}

.super-donut span {
    width: 58%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    text-align: center;
    border-radius: 50%;
    background: var(--surface-card);
    color: var(--text-strong);
    font-size: 1.2rem;
    font-weight: 900;
}

.super-donut small { color: var(--text-muted); font-size: .72rem; font-weight: 700; }

.super-plan-list,
.super-modules,
.super-activity,
.super-system-list { min-height: 0; overflow: auto; display: grid; gap: .58rem; }

/* ── Plan Row ── */
.super-plan-row {
    display: grid;
    grid-template-columns: .6rem 1fr auto;
    gap: .55rem;
    align-items: center;
    min-height: 2.6rem;
    padding: .45rem .6rem;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-body);
    font-size: .83rem;
}

.super-plan-row i { width: .45rem; height: .45rem; border-radius: 50%; }
.super-plan-row strong { color: var(--text-muted); font-size: .78rem; }

/* ── Module Row ──
   Per-module accent colours are categorical; only the track behind the bar
   is a surface and therefore tokenised. */
.super-module-row div {
    display: grid;
    grid-template-columns: 1.5rem 1fr 2.4rem;
    gap: .55rem;
    align-items: center;
    color: var(--text-body);
    font-size: .84rem;
}

.super-module-row span {
    display: grid;
    place-items: center;
    height: 1.55rem;
    border-radius: 7px;
    color: #fff;
    background: #2f6df6;
    font-weight: 900;
}

.super-module-row:nth-child(2) span { background: #8b5cf6; }
.super-module-row:nth-child(3) span { background: #fb923c; }
.super-module-row:nth-child(4) span { background: #47b883; }
.super-module-row:nth-child(5) span { background: #64748b; }
.super-module-row b { color: var(--text-body); font-weight: 900; }
.super-module-row i { display: block; height: .38rem; margin-block: .35rem .1rem; margin-inline-start: 4rem; margin-inline-end: 3.1rem; border-radius: 999px; background: linear-gradient(90deg, #2f6df6 var(--value), var(--surface-inset) var(--value)); }
.super-module-row:nth-child(2) i { background: linear-gradient(90deg, #8b5cf6 var(--value), var(--surface-inset) var(--value)); }
.super-module-row:nth-child(3) i { background: linear-gradient(90deg, #fb923c var(--value), var(--surface-inset) var(--value)); }
.super-module-row:nth-child(4) i { background: linear-gradient(90deg, #47b883 var(--value), var(--surface-inset) var(--value)); }
.super-module-row:nth-child(5) i { background: linear-gradient(90deg, #31b6b0 var(--value), var(--surface-inset) var(--value)); }

/* ── Table ── */
.super-table-wrap { min-height: 0; overflow: auto; }
.super-table { width: 100%; border-collapse: separate; border-spacing: 0; color: var(--text-body); font-size: .82rem; }
.super-table th { padding: .7rem .65rem; color: var(--text-muted); background: var(--surface-raised); text-align: start; font-weight: 900; }
.super-table th:first-child { border-start-start-radius: 10px; }
.super-table th:last-child { border-start-end-radius: 10px; }
.super-table td { padding: .62rem .65rem; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.super-company-name { display: inline-flex; align-items: center; gap: .55rem; }
.super-company-name i { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: var(--accent-bg); font-style: normal; }

/* ── Badges ── */
.super-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; padding: .22rem .55rem; font-size: .74rem; font-weight: 900; }
.super-badge--emerald { color: var(--success-alt); background: var(--success-bg); }
.super-badge--violet { color: var(--accent); background: var(--accent-bg); }
.super-badge--blue { color: var(--info-fg); background: var(--info-bg); }
.super-badge--amber { color: var(--warning-alt); background: var(--warning-bg); }
.super-badge--indigo { color: var(--info-fg); background: var(--info-bg); }

.super-more-button { width: 2.55rem; height: 2.05rem; border: 1px solid var(--border-subtle); border-radius: 8px; color: var(--text-body); background: var(--surface-card); }
.super-panel-link { display: inline-flex; align-items: center; gap: .35rem; margin-top: auto; padding-top: .7rem; color: var(--accent); text-decoration: none; font-size: .8rem; font-weight: 900; }

/* ── Activity ── */
.super-activity h3 { margin: 0; color: var(--text-strong); font-size: .84rem; font-weight: 900; }
.super-activity p { margin: .12rem 0 0; color: var(--text-muted); font-size: .75rem; }
.super-activity small { color: var(--text-muted); font-size: .72rem; }
.super-activity__icon { width: 2.55rem; height: 2.55rem; display: grid; place-items: center; border-radius: 11px; color: var(--accent); background: var(--accent-bg); flex-shrink: 0; }
.super-activity__body { flex: 1; min-width: 0; }
.super-activity__meta { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; flex-shrink: 0; text-align: end; }
.super-activity__meta strong { color: var(--text-body); font-size: .8rem; font-weight: 800; white-space: nowrap; }
.super-activity__meta small { color: var(--text-faint); font-size: .72rem; white-space: nowrap; }

.super-activity article {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 2.9rem;
    padding: .55rem .65rem;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--surface-card-72);
}

/* ── System Overview ── */
.super-system-list { min-height: 0; overflow: auto; display: grid; gap: .5rem; }

.super-sys-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;
    min-height: 2.55rem;
    padding: .45rem .6rem;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--surface-card-72);
}

.super-sys-row--progress { flex-direction: column; align-items: stretch; gap: .3rem; min-height: auto; padding: .6rem; }
.super-sys-row__top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.super-sys-label { color: var(--text-body); font-size: .82rem; font-weight: 700; }
.super-sys-value { color: var(--text-muted); font-size: .78rem; font-weight: 700; }
.super-sys-number { color: var(--text-strong); font-size: .95rem; font-weight: 900; }
.super-sys-percent { color: var(--text-muted); font-size: .75rem; font-weight: 700; text-align: end; }

.super-sys-bar-wrap {
    height: .35rem;
    border-radius: 999px;
    background: var(--surface-inset);
    overflow: hidden;
}

.super-sys-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--accent-gradient);
}

.super-table-actions { display: flex; align-items: center; gap: .4rem; }

/* ── Icons ──
   #000 here is a mask stencil, not a paint colour — the visible colour comes
   from `background: currentColor` above. Leave these alone. */
.super-icon { width: 1.1rem; height: 1.1rem; display: inline-block; background: currentColor; mask: radial-gradient(circle, #000 62%, transparent 64%); }
.super-icon--search { mask: radial-gradient(circle at 40% 40%, transparent 34%, #000 36% 52%, transparent 54%), linear-gradient(45deg, transparent 58%, #000 60% 72%, transparent 74%); }
.super-icon--chart,
.super-icon--activity,
.super-icon--reports { mask: linear-gradient(#000 0 0) 12% 70%/16% 45% no-repeat, linear-gradient(#000 0 0) 42% 45%/16% 70% no-repeat, linear-gradient(#000 0 0) 72% 25%/16% 90% no-repeat; }
.super-icon--building,
.super-icon--home,
.super-icon--layers,
.super-icon--card,
.super-icon--users,
.super-icon--settings,
.super-icon--clock,
.super-icon--spark,
.super-icon--plus,
.super-icon--pause,
.super-icon--swap,
.super-icon--module,
.super-icon--invoice { mask: linear-gradient(#000 0 0) center/80% 70% no-repeat; }
.super-icon--check { mask: linear-gradient(45deg, transparent 42%, #000 44% 57%, transparent 59%), linear-gradient(-45deg, transparent 39%, #000 41% 54%, transparent 56%); }

/* ── Responsive ── */
@media (max-height: 820px) and (min-width: 1181px) {
    .super-admin-layout { padding: .45rem; gap: .55rem; }
    .super-admin-main { padding: .8rem; }
    .super-dashboard { gap: .55rem; }
    .super-stats { gap: .55rem; }
    .super-stat { min-height: 6.5rem; padding: .75rem; }
    .super-dashboard__grid { grid-template-rows: minmax(190px, .8fr) minmax(220px, 1fr); gap: .5rem; }
    .super-panel { padding: .75rem .85rem; }
    .super-sidebar__nav { gap: .35rem; }
    .super-sidebar__link { min-height: 2.7rem; }
}

@media (max-width: 1180px) {
    .super-admin-shell { height: auto; min-height: 100vh; overflow: auto; }
    .super-admin-layout { height: auto; min-height: 100vh; grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: 'sidebar' 'topbar' 'main'; }
    .sa-topbar { flex-wrap: wrap; gap: .5rem; }
    .sa-topbar__meta { display: none; }
    .sa-topbar__tools { width: 100%; justify-content: flex-end; }
    .super-admin-main { overflow: visible; }
    .super-sidebar { min-height: auto; border-radius: 18px; padding: .9rem; }
    [dir="rtl"] .super-sidebar { border-radius: 18px; }
    .super-sidebar__brand { margin-bottom: .8rem; }
    .super-sidebar__nav { flex-direction: row; flex-wrap: wrap; overflow: visible; }
    .super-sidebar__link { min-height: 2.4rem; padding: .45rem .6rem; flex: 1; justify-content: center; }
    .super-sidebar__link span { display: none; }
    .super-header { grid-template-columns: 1fr; grid-template-areas: 'title' 'search' 'cta'; }
    .super-header__cta { justify-content: stretch; flex-wrap: wrap; }
    .super-header__cta .super-primary-button { flex: 1; }
    .super-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .super-dashboard__grid { grid-template-columns: 1fr 1fr; grid-template-rows: auto; grid-template-areas: 'growth growth' 'plans modules' 'companies activity' 'system system'; }
}

@media (max-width: 720px) {
    .super-admin-layout { padding: .45rem; }
    .super-admin-main { padding: .75rem; border-radius: 16px; }
    .sa-topbar { border-radius: 16px; padding: .4rem .5rem; }
    .sa-profile__info { display: none; }
    .sa-profile__trigger { padding: .25rem .35rem; }
    .super-sidebar__nav { flex-direction: row; flex-wrap: wrap; overflow: visible; }
    .super-search { min-width: 0; }
    .super-filter--date { width: 100%; justify-content: center; }
    .super-stats, .super-dashboard__grid { grid-template-columns: 1fr; }
    .super-dashboard__grid { grid-template-areas: 'growth' 'plans' 'modules' 'companies' 'activity' 'system'; }
    .super-table thead { display: none; }
    .super-table tr { display: grid; gap: .35rem; padding: .7rem 0; border-bottom: 1px solid var(--border-subtle); }
    .super-table td { display: flex; justify-content: space-between; align-items: center; border: 0; padding: .15rem; white-space: normal; }
    .super-table td::before { content: attr(data-label); color: var(--text-muted); font-weight: 900; }
    .super-table td:first-child::before { display: none; }
}
