:root {
    /* Brand — LaraInvoice v2: Jewel Teal on Ink / Ivory */
    --primary: 174 75% 26%;
    --primary-hover: 174 70% 18%;
    --primary-soft: 168 40% 94%;
    --primary-ring: var(--primary);
    --brand-navy: 174 62% 10%;
    --brand-navy-soft: 199 100% 96%;
    --table-head: 245 85% 96%;
    --table-head-text: 245 45% 37%;
    --table-stripe: 225 33% 97%;
    /* Status */
    --success: 152 70% 38%;
    --info: 201 90% 45%;
    --warning: 35 92% 50%;
    --danger: 0 72% 51%;
    --secondary: 220 9% 46%;
    /* Primitive HSL channels */
    --white: 0 0% 100%;
    --black: 0 0% 0%;
    --ink: 192 54% 5%;
    --indigo: 174 75% 26%;
    /* Branded and data-visualization channels */
    --google-blue: 217 89% 61%;
    --google-green: 136 53% 43%;
    --google-yellow: 45 97% 50%;
    --google-red: 5 81% 56%;
    --metric-blue: 199 89% 38%;
    --metric-orange: 18 82% 62%;
    --metric-green: 173 72% 37%;
    --metric-purple: 274 46% 51%;
    --metric-cyan: 187 54% 39%;
    --metric-red: 350 64% 52%;
    --dashboard-blue-light: 219 44% 30%;
    --dashboard-blue: 221 47% 23%;
    --dashboard-blue-deep: 222 47% 17%;
    --success-bright: 153 69% 44%;
    --success-deep: 160 85% 39%;
    --danger-bright: 354 100% 59%;
    --danger-vivid: 356 100% 56%;
    --danger-deep: 0 72% 45%;
    --danger-light: 0 72% 62%;
    --info-light: 201 90% 60%;
    --warning-ink: 28 90% 20%;
    --warning-deep: 35 80% 36%;
    --warning-light: 35 92% 60%;
    --email-channel: 252 83% 60%;
    --telegram-channel: 200 87% 47%;
    --shadow-ink: 222 47% 11%;
    --night: 192 54% 5%;
    --night-deep: 192 60% 3%;
    --night-shadow: 206 55% 2%;
    --dark-surface: 222 13% 14%;
    --dark-surface-deep: 222 14% 11%;
    --dark-surface-hover: 222 12% 18%;
    --dark-border: 220 10% 22%;
    --dark-border-soft: 220 10% 20%;
    --dark-border-strong: 220 10% 30%;
    --dark-accent-surface: 210 40% 12%;
    --dark-accent-border: 210 30% 22%;
    --dark-text: 210 16% 94%;
    --dark-text-muted: 220 12% 75%;
    --neutral-950: 220 14% 8%;
    --neutral-900: 220 14% 14%;
    --neutral-800: 220 14% 24%;
    --neutral-400: 220 14% 70%;
    /* Neutrals (crisp blue-slate) */
    --bg: 168 33% 97%;
    --bg-img: none;
    --surface: 0 0% 100%;
    --surface-2: 210 33% 98%;
    --surface-3: 210 24% 94%;
    --text: 192 45% 8%;
    --text-muted: 215 16% 42%;
    --text-soft: 215 14% 58%;
    --border: 210 22% 90%;
    --border-strong: 211 18% 80%;
    /* Sidebar — light (white) in light mode; dark-mode block overrides */
    --sb-bg: 0 0% 100%;
    --sb-bg-2: 237 38% 97%;
    --sb-text: 230 14% 35%;
    --sb-text-mut: 229 10% 52%;
    --sb-text-strong: 231 30% 16%;
    --sb-hover: 237 70% 96%;
    --sb-active: var(--primary);
    --sb-active-fg: 0 0% 100%;
    --sb-border: 234 22% 89%;
    /* Radius */
    --r-sm: 4px;
    --r: 4px;
    --r-lg: 4px;
    --r-xl: 4px;
    /* Shadows (soft, premium) */
    --shadow-xs: none;
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: none;
    /* Layout */
    --sb-w: 264px;
    --sb-w-collapsed: 72px;
    --nav-h: 72px;
    /* Motion */
    --t-fast: 120ms ease;
    --t: 200ms cubic-bezier(.2, .6, .2, 1);
    --select-chevron-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    /* Typography — body vs. headings */
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --font-heading: var(--font-body);
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}


/* =========================================================
   2. BASE & TYPOGRAPHY
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    color: hsl(var(--text));
    background: hsl(var(--bg));
    background-image: var(--bg-img);
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-header__title,
.page-header__subtitle,
.card__title,
.auth-head__title,
.auth-brand__headline,
.empty__title,
.modal-title {
    font-family: var(--font-heading);
}

b,
strong,
dt {
    font-weight: 600;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 .5rem;
    color: hsl(var(--text));
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.25rem;
}

h3 {
    font-size: 1.0625rem;
}

p {
    margin: 0 0 1rem;
    color: hsl(var(--text-muted));
}

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

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

::selection {
    background: hsl(var(--primary) / 0.18);
}


/* Subtle scrollbar */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--border-strong));
    border-radius: 999px;
    border: 2px solid hsl(var(--bg));
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--text-soft));
}


/* =========================================================
   3. APP SHELL
   ========================================================= */

.app {
    display: grid;
    grid-template-columns: var(--sb-w) 1fr;
    min-height: 100vh;
    min-height: 100dvh;
    background-image: linear-gradient(to right, hsl(174 62% 8%) var(--sb-w), transparent var(--sb-w));
}

[data-mode="dark"] .app {
    background-image: linear-gradient(to right, hsl(192 54% 4%) var(--sb-w), transparent var(--sb-w));
}

.app__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100%;
}

.app__content {
    padding: clamp(16px, 2.5vw, 36px);
    flex: 1 1 auto;
    min-width: 0;
}


/* =========================================================
   4. SIDEBAR — token-driven, dark navy in every colour mode
   ========================================================= */


/* Sidebar stays dark in every colour mode. Scoped to .sidebar (not :root) so
   these tokens inherit only to the nav — the login screen (.auth) keeps the
   light values. Light mode uses a deep navy that sits in the same hue family as
   the app's navy ink (so it reads as intentional, not a black slab); dark mode
   drops to the near-black, page-matching tone in the override below. */

.sidebar {
    --sb-bg: 174 62% 8%;
    --sb-bg-2: 174 48% 12%;
    --sb-text: 168 28% 86%;
    --sb-text-mut: 172 16% 68%;
    --sb-text-strong: 168 33% 96%;
    --sb-hover: 174 40% 14%;
    --sb-active: 173 72% 42%;
    --sb-active-fg: 0 0% 100%;
    --sb-border: 174 28% 16%;
    /* Glow, not the deep jewel, so marks stay readable on the pine rail. */
    --sb-accent: 172 53% 67%;
}

[data-mode="dark"] .sidebar {
    --sb-bg: 192 54% 4%;
    --sb-bg-2: 174 40% 8%;
    --sb-text: 168 24% 84%;
    --sb-text-mut: 172 14% 62%;
    --sb-text-strong: 168 33% 96%;
    --sb-hover: 174 32% 12%;
    --sb-active: 172 53% 67%;
    --sb-active-fg: 192 54% 6%;
    --sb-border: 174 24% 14%;
    --sb-accent: 172 53% 72%;
}

.sidebar {
    background:
        radial-gradient(120% 42% at 0% 0%, hsl(var(--primary) / 0.16), transparent 70%),
        hsl(var(--sb-bg));
    color: hsl(var(--sb-text));
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: stretch;
    height: auto;
    min-height: 100%;
    z-index: 1040;
    border-right: 1px solid hsl(var(--sb-border));
    box-shadow: none;
    overflow: hidden;
}


/* Brand */

.sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 20px;
    height: var(--nav-h);
    border-bottom: 1px solid hsl(var(--sb-border));
    flex: 0 0 var(--nav-h);
}

.sidebar__close {
    display: none;
    position: absolute;
    top: 13px;
    right: 12px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid hsl(var(--sb-border));
    border-radius: var(--r-sm);
    background: hsl(var(--sb-bg-2));
    color: hsl(var(--sb-text));
    align-items: center;
    justify-content: center;
    transition: color var(--t), border-color var(--t), background var(--t);
}

.sidebar__close:hover,
.sidebar__close:focus-visible {
    color: hsl(var(--sb-text-strong));
    border-color: hsl(var(--sb-accent) / 0.4);
    background: hsl(var(--primary) / 0.2);
}

.sidebar__close svg {
    width: 18px;
    height: 18px;
}

.sidebar__brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
    display: grid;
    place-items: center;
    color: hsl(var(--white));
    font-weight: 600;
    font-size: 14px;
    box-shadow: none;
}

.sidebar__brand-name {
    color: hsl(var(--sb-text-strong));
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.sidebar__brand-img {
    display: block;
    max-width: 158px;
    max-height: 32px;
    width: auto;
    object-fit: contain;
}

.sidebar__brand-fallback {
    width: 42px;
    height: 42px;
    border-radius: 4px;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
    color: hsl(var(--white));
    place-items: center;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    box-shadow: none;
}

.sidebar__brand-suffix {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: hsl(var(--primary) / 0.18);
    color: hsl(var(--sb-active));
    font-weight: 600;
    letter-spacing: 0;
}


/* Workspace identity — initials mark + site title */

.workspace-brand {
    gap: 12px;
    text-decoration: none;
}

.workspace-brand__mark {
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: linear-gradient(145deg, hsl(246 100% 75%), hsl(var(--primary)));
    color: hsl(var(--white));
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: inset 0 1px 0 hsl(var(--white) / 0.3);
}

.workspace-brand__text {
    min-width: 0;
}

.workspace-brand__text strong {
    display: block;
    overflow: hidden;
    color: hsl(var(--sb-text-strong));
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-brand__text small {
    display: block;
    margin-top: 3px;
    color: hsl(var(--sb-text-mut));
    font-size: 11px;
}


/* Scroll area — soft fade at both edges hints that the list continues */

.sidebar__scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 12px 20px;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--sb-text-mut) / 0.35) transparent;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14px, #000 calc(100% - 20px), transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 14px, #000 calc(100% - 20px), transparent);
}

.sidebar__scroll::-webkit-scrollbar {
    width: 3px;
}

.sidebar__scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar__scroll::-webkit-scrollbar-thumb {
    background: hsl(var(--sb-text-mut) / 0.35);
    border-radius: 999px;
}

.sidebar__scroll::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--sb-text-mut) / 0.6);
}


/* Menu groups — no headings, just breathing room between them */

.sidebar__scroll>.menu+.menu {
    margin-top: 14px;
}


/* Menu structure (nested) */

.menu,
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu__item {
    margin: 2px 0;
}


/* Link/trigger common */

.menu__link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 5px 10px;
    border-radius: 4px;
    color: hsl(var(--sb-text));
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: background var(--t), color var(--t), box-shadow var(--t);
    border: 0;
    background: transparent;
    width: 100%;
    text-align: start;
}

.menu__link--depth-0 {
    padding-inline-start: 5px;
}

.menu__link:hover {
    background: hsl(var(--sb-hover));
    color: hsl(var(--sb-text-strong));
}

.menu__link:focus-visible {
    outline: 2px solid hsl(var(--sb-accent));
    outline-offset: 1px;
}

.menu__link--active,
.menu__link--active:hover {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
    color: hsl(var(--sb-active-fg));
    font-weight: 600;
    box-shadow: inset 0 1px 0 hsl(var(--white) / 0.12);
}


/* Top-level icons sit in a quiet tile that lights up with state */

.menu__icon-tile {
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    color: hsl(var(--sb-text-mut));
    transition: background var(--t), color var(--t);
}

.menu__icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    stroke-width: 1.8;
}

.menu__link:hover .menu__icon-tile {
    color: hsl(var(--sb-text-strong));
    background: hsl(var(--white) / 0.06);
}

.menu__link--current .menu__icon-tile {
    color: hsl(var(--sb-accent));
    background: hsl(var(--primary) / 0.24);
}

.menu__link--active .menu__icon-tile,
.menu__link--active:hover .menu__icon-tile {
    color: hsl(var(--white));
    background: hsl(var(--white) / 0.16);
}

.menu__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Right-side meta (badge / count) */

.menu__meta {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 4px;
    background: hsl(var(--primary) / 0.22);
    color: hsl(var(--sb-active));
    letter-spacing: 0.02em;
}

.menu__meta--neutral {
    background: hsl(var(--sb-hover));
    color: hsl(var(--sb-text));
}

.menu__badge {
    --badge-c: var(--danger);
    --badge-fg: var(--white);
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 4px;
    border: 0;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: hsl(var(--badge-fg));
    background: hsl(var(--badge-c));
    box-shadow: none;
}

.menu__badge--danger {
    --badge-c: var(--danger);
}

.menu__badge--warning {
    --badge-c: var(--warning);
    --badge-fg: var(--warning-ink);
}

.menu__badge--success {
    --badge-c: var(--success);
}

.menu__badge--info {
    --badge-c: var(--info);
}


/* On the indigo active pill a white chip keeps the count legible */

.menu__link--active .menu__badge {
    color: hsl(var(--badge-c));
    background: hsl(var(--white));
    box-shadow: none;
}

.menu__link--active .menu__badge--warning {
    color: hsl(var(--warning-ink));
}


/* Caret rotation for collapsibles (uses Bootstrap [aria-expanded]) */

.menu__caret {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    color: hsl(var(--sb-text-mut));
    transition: transform var(--t), color var(--t);
}

.menu__link:hover .menu__caret,
.menu__link[aria-expanded="true"] .menu__caret {
    color: hsl(var(--sb-text-strong));
}

.menu__link[aria-expanded="true"] .menu__caret {
    transform: rotate(90deg);
}

.menu__link[aria-expanded="true"] {
    color: hsl(var(--sb-text-strong));
    font-weight: 600;
    box-shadow: none;
}


/* Nested navigation groups — a tree rail with one dot per child. The rail
   lines up under the centre of the parent's 30px icon tile. */

.submenu {
    margin: 2px 0 8px;
    margin-inline-start: 20px;
    padding: 0;
    padding-inline-start: 12px;
    border-inline-start: 1px solid hsl(var(--sb-border));
}

.submenu .menu__link {
    position: relative;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12.75px;
    color: hsl(var(--sb-text-mut));
}

.submenu .menu__link::before {
    content: "";
    position: absolute;
    top: 50%;
    inset-inline-start: -16px;
    width: 7px;
    height: 7px;
    border: 1.5px solid hsl(var(--sb-border));
    border-radius: 50%;
    background: hsl(var(--sb-bg));
    transform: translateY(-50%);
    transition: background var(--t), border-color var(--t), box-shadow var(--t);
}

.submenu .menu__link:hover {
    background: hsl(var(--sb-hover));
    color: hsl(var(--sb-text-strong));
}

.submenu .menu__link:hover::before {
    border-color: hsl(var(--sb-text-mut));
}

.submenu .menu__link--active,
.submenu .menu__link--active:hover {
    background: hsl(var(--primary) / 0.2);
    color: hsl(var(--sb-text-strong));
    font-weight: 600;
    box-shadow: none;
}

.submenu .menu__link--active::before {
    border-color: hsl(var(--sb-accent));
    background: hsl(var(--sb-accent));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.35);
}


/* Mobile backdrop */

.sidebar__backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: hsl(var(--night) / 0.55);
    backdrop-filter: blur(2px);
    z-index: 1039;
}

.sidebar__backdrop--visible {
    display: block;
}


/* Footer — signed-in admin card */

.sidebar__footer {
    flex: 0 0 auto;
    padding: 12px;
    border-top: 1px solid hsl(var(--sb-border));
}

.sidebar-account {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid hsl(var(--sb-border));
    border-radius: 4px;
    background: hsl(var(--sb-bg-2));
}

.sidebar-account__profile {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 4px;
    border-radius: 4px;
    color: inherit;
    text-decoration: none;
    transition: background var(--t);
}

.sidebar-account__profile:hover {
    background: hsl(var(--sb-hover));
}

.sidebar-account__text {
    display: grid;
    min-width: 0;
    line-height: 1.3;
}

.sidebar-account__text strong,
.sidebar-account__text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-account__text strong {
    color: hsl(var(--sb-text-strong));
    font-size: 12.5px;
    font-weight: 600;
}

.sidebar-account__text small {
    color: hsl(var(--sb-text-mut));
    font-size: 11px;
}

.sidebar-account__action {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    color: hsl(var(--sb-text-mut));
    transition: background var(--t), color var(--t);
}

.sidebar-account__action svg {
    width: 16px;
    height: 16px;
}

.sidebar-account__action:hover {
    color: hsl(0 90% 80%);
    background: hsl(var(--danger) / 0.18);
}

.sidebar-account__profile:focus-visible,
.sidebar-account__action:focus-visible {
    outline: 2px solid hsl(var(--sb-accent));
    outline-offset: 1px;
}

.sidebar__version {
    margin: 8px 0 0;
    color: hsl(var(--sb-text-mut));
    font-size: 10.5px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.admin-avatar--sidebar {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    font-size: 12px;
}


/* =========================================================
   5. TOP NAVBAR
   ========================================================= */

.navbar-top {
    height: var(--nav-h);
    background: hsl(var(--surface) / 0.85);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-top__toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-sm);
    background: hsl(var(--surface));
    align-items: center;
    justify-content: center;
    color: hsl(var(--text));
}

.navbar-top__search {
    flex: 1;
    max-width: 260px;
}


/* Spotlight trigger button (looks like a search) */

.spotlight-trigger {
    flex: 1;
    min-width: 0;
    max-width: 260px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--r);
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface-2));
    color: hsl(var(--text-muted));
    font-size: 13.5px;
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
}

.spotlight-trigger:hover {
    background: hsl(var(--surface));
    border-color: hsl(var(--border-strong));
    color: hsl(var(--text));
}

.spotlight-trigger__icon {
    color: hsl(var(--text-soft));
}

.spotlight-trigger__label {
    flex: 1;
    text-align: left;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spotlight-trigger__kbd {
    margin-left: auto;
    display: inline-flex;
    gap: 3px;
}

.kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    font-weight: 600;
    color: hsl(var(--text-muted));
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    padding: 1px 6px;
    line-height: 1.4;
    box-shadow: none;
}

.navbar-top__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 0 0 auto;
}

.navbar-top__icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    background: transparent;
    color: hsl(var(--text-muted));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background var(--t), color var(--t), border-color var(--t);
}

.navbar-top__icon-btn:hover {
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}

.admin-tooltip {
    --bs-tooltip-bg: hsl(var(--brand-navy));
    --bs-tooltip-color: hsl(var(--white));
    --bs-tooltip-opacity: 1;
    --bs-tooltip-border-radius: 4px;
    --bs-tooltip-padding-x: 10px;
    --bs-tooltip-padding-y: 7px;
}

.admin-tooltip .tooltip-inner {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: none;
}

.navbar-top__icon-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: hsl(var(--danger));
    box-shadow: 0 0 0 2px hsl(var(--surface));
}

.navbar-top__divider {
    width: 1px;
    height: 24px;
    background: hsl(var(--border));
    margin: 0 4px;
}


/* Light/dark mode toggle */

.theme-toggle__icon {
    width: 18px;
    height: 18px;
}

.theme-toggle__icon--dark {
    display: none;
}

[data-mode="dark"] .theme-toggle__icon--light {
    display: none;
}

[data-mode="dark"] .theme-toggle__icon--dark {
    display: block;
}


/* Language switcher pill */

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-sm);
    background: hsl(var(--surface));
    color: hsl(var(--text));
    cursor: pointer;
    transition: background var(--t), border-color var(--t);
    font-family: inherit;
}

.lang-switch:hover {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
}

.lang-switch__flag {
    font-size: 14px;
    line-height: 1;
}

.language-flag-img {
    width: 22px;
    height: 16px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 0 0 1px hsl(var(--border-strong));
    flex: 0 0 auto;
}

.language-flag-img--table {
    width: 26px;
    height: 19px;
}

.lang-switch__code {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.navbar-top__profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
    cursor: pointer;
    transition: background var(--t), border-color var(--t);
}

.navbar-top__profile:hover {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
}

.navbar-top__profile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
    color: hsl(var(--white));
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 11.5px;
}

.navbar-top__profile-name {
    font-size: 13px;
    font-weight: 600;
    color: hsl(var(--text));
}


/* Resilient image frames keep missing uploads from exposing browser error icons. */

.image-frame [data-image-fallback-content] {
    display: none;
}

.image-frame--fallback [data-image-fallback-content] {
    display: grid;
}

.image-frame--fallback [data-image-fallback-target] {
    display: none !important;
}

.admin-avatar {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 50%;
    background: hsl(var(--surface));
    color: hsl(var(--white));
    box-shadow: inset 0 0 0 1px hsl(var(--white) / 0.22);
}

.admin-avatar.image-frame--fallback {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
}

.admin-avatar .admin-avatar__fallback {
    position: absolute;
    inset: 0;
    place-items: center;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.admin-avatar__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: hsl(var(--surface));
    z-index: 1;
}

.admin-avatar--nav {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.admin-avatar--profile {
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
    font-size: 22px;
}

.notification-menu {
    width: min(380px, calc(100vw - 24px));
    padding: 0;
    overflow: hidden;
}

.notification-menu__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--surface-2));
}

.notification-menu__title {
    color: hsl(var(--text));
    font-size: 13px;
    font-weight: 600;
}

.notification-menu__subtitle {
    margin-top: 2px;
    color: hsl(var(--text-muted));
    font-size: 12px;
}

.notification-menu__mark {
    color: hsl(var(--primary-hover));
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.notification-menu__mark:hover {
    color: hsl(var(--primary));
}

.notification-menu__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    position: relative;
    padding: 12px 16px;
    color: hsl(var(--text));
    border-bottom: 1px solid hsl(var(--border));
    text-decoration: none;
    transition: background var(--t);
}

.notification-menu__item:hover {
    color: hsl(var(--text));
    background: hsl(var(--surface-2));
}

.notification-menu__item--unread {
    background: hsl(var(--primary) / 0.06);
}

.notification-menu__icon {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    color: hsl(var(--primary-hover));
    background: hsl(var(--primary-soft));
}

.notification-menu__content {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding-right: 10px;
}

.notification-menu__text {
    color: hsl(var(--text));
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.notification-menu__time {
    color: hsl(var(--text-muted));
    font-size: 11.5px;
}

.notification-menu__unread {
    position: absolute;
    top: 18px;
    right: 14px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: hsl(var(--primary));
}

.notification-menu__empty {
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 28px 18px;
    color: hsl(var(--text-muted));
    font-size: 13px;
}

.notification-menu__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    color: hsl(var(--primary-hover));
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.notification-menu__footer:hover {
    color: hsl(var(--primary));
    background: hsl(var(--surface-2));
}


/* Page header */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 18px;
}

.page-header__title {
    font-size: clamp(1.3rem, 1.7vw, 1.55rem);
    font-weight: 600;
    margin: 0;
    color: hsl(var(--text));
    letter-spacing: -0.01em;
}

.page-header__subtitle {
    color: hsl(var(--text-muted));
    margin: 4px 0 0;
    font-size: 14px;
}

.page-header__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.page-header__actions--search {
    flex-wrap: nowrap;
}

.page-header__actions--search .search-form {
    flex: 0 1 280px;
    width: 280px;
    min-width: 190px;
}

.page-header__actions--search .admin-search {
    width: 100%;
}

.page-header__actions .btn--sm {
    flex: 0 0 auto;
    min-height: 40px;
    padding-inline: 14px;
    font-weight: 600;
}

.page-header__actions .search__input {
    min-height: 40px;
}

@media (max-width: 720px) {
    .page-header {
        align-items: flex-start;
    }
    .page-header__actions,
    .page-header__actions--search {
        flex-wrap: wrap;
        width: 100%;
    }
    .page-header__actions--search .search-form {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }
    .page-header__filter {
        flex: 1 1 11rem;
        min-width: min(100%, 11rem);
    }
    .page-header__filter .input {
        width: 100%;
        min-width: 0;
    }
    .page-header__actions .btn--sm {
        flex: 0 0 auto;
        padding-inline: 12px;
    }
}

.crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: hsl(var(--text-muted));
    margin-bottom: 6px;
}

.crumbs a {
    color: hsl(var(--text-muted));
}

.crumbs a:hover {
    color: hsl(var(--primary));
}

.crumbs__sep {
    color: hsl(var(--text-soft));
}


/* Premium page-level settings nav */

.settings-topnav {
    position: sticky;
    top: var(--nav-h);
    z-index: 1020;
    display: flex;
    align-items: center;
    min-height: 58px;
    margin: -24px -24px 18px;
    padding: 0 24px;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
    box-shadow: none;
    overflow: visible;
}

.settings-topnav::before {
    display: none;
}

.settings-topnav__links {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    align-content: center;
    gap: 0;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.settings-topnav__links::-webkit-scrollbar {
    display: none;
}

.settings-topnav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex: 0 0 auto;
    min-height: 58px;
    padding: 0 12px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    color: hsl(var(--text-muted));
    font-size: 12.75px;
    font-weight: 600;
    white-space: nowrap;
    transition: background var(--t), border-color var(--t), color var(--t);
}

.settings-topnav__link i {
    width: 16px;
    height: 16px;
}

.settings-topnav__link:hover {
    color: hsl(var(--text));
    background: hsl(var(--surface-2));
}

.settings-topnav__link--active {
    color: hsl(var(--primary-hover));
    background: linear-gradient(180deg, hsl(var(--primary-soft) / 0.35), hsl(var(--primary-soft) / 0.7));
    border-bottom-color: hsl(var(--primary));
}


/* Dark surface makes --text-muted (tuned for white cards) too low-contrast
   for this bar's own inactive/active tab labels — brighten both. */

[data-mode="dark"] .settings-topnav__link {
    color: hsl(var(--text) / 0.65);
}

[data-mode="dark"] .settings-topnav__link:hover {
    color: hsl(var(--text));
}

[data-mode="dark"] .settings-topnav__link--active {
    color: hsl(237 80% 78%);
}


/* =========================================================
   6. SPOTLIGHT — command palette overlay (no modal chrome)
   ========================================================= */

.spotlight {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1080;
}

.spotlight--open {
    display: block;
}

.spotlight__backdrop {
    position: absolute;
    inset: 0;
    background: hsl(var(--night) / 0.45);
    backdrop-filter: blur(4px);
    animation: spot-fade var(--t) both;
}

.spotlight__panel {
    position: relative;
    width: min(640px, calc(100% - 32px));
    margin: 88px auto 0;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: spot-rise var(--t) both;
}

@keyframes spot-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes spot-rise {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.spotlight__search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid hsl(var(--border));
}

.spotlight__search-icon {
    color: hsl(var(--text-muted));
}

.spotlight__input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 15px;
    color: hsl(var(--text));
    font-family: inherit;
}

.spotlight__input::placeholder {
    color: hsl(var(--text-soft));
}

.spotlight__esc {
    font-size: 11px;
    color: hsl(var(--text-muted));
    padding: 2px 6px;
    border-radius: 4px;
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
}

.spotlight__results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 6px;
}

.spotlight__group-title {
    padding: 10px 12px 4px;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    color: hsl(var(--text-soft));
    font-weight: 600;
}

.spotlight__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    cursor: pointer;
    color: hsl(var(--text));
    font-size: 14px;
    transition: background var(--t-fast);
}

.spotlight__item:hover,
.spotlight__item--active {
    background: hsl(var(--primary) / 0.08);
}

.spotlight__item-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
    display: grid;
    place-items: center;
    color: hsl(var(--text-muted));
    flex: 0 0 28px;
}

.spotlight__item-label {
    font-weight: 600;
    line-height: 1.25;
}

.spotlight__item-main {
    flex: 1;
    min-width: 0;
}

.spotlight__item-meta {
    margin-top: 2px;
    color: hsl(var(--text-soft));
    font-size: 12px;
    line-height: 1.25;
}

.spotlight__match {
    background: hsl(var(--warning) / 0.32);
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
}

.spotlight__item-hint {
    font-size: 12px;
    color: hsl(var(--text-muted));
}


/* ── Navigating: overlay stays up while the target page loads ── */

.spotlight--navigating .spotlight__results {
    pointer-events: none;
}


/* everything except the chosen row recedes */

.spotlight--navigating .spotlight__item:not(.spotlight__item--loading),
.spotlight--navigating .spotlight__group-title {
    opacity: 0.45;
    transition: opacity var(--t);
}

.spotlight__item--loading {
    background: hsl(var(--primary-soft));
}

.spotlight__item--loading .spotlight__item-hint {
    color: transparent;
    position: relative;
}


/* swap the "Open" hint for a spinner without shifting the row */

.spotlight__item--loading .spotlight__item-hint::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 13px;
    height: 13px;
    margin-top: -7px;
    border: 2px solid hsl(var(--primary) / 0.25);
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: spotlight-spin 0.6s linear infinite;
}

@keyframes spotlight-spin {
    to {
        transform: rotate(360deg);
    }
}


/* thin progress sliver along the top of the panel */

.spotlight--navigating .spotlight__panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: var(--r) var(--r) 0 0;
    background: linear-gradient(90deg, transparent, hsl(var(--primary)), transparent);
    background-size: 40% 100%;
    background-repeat: no-repeat;
    animation: spotlight-progress 1.1s ease-in-out infinite;
}

@keyframes spotlight-progress {
    0% {
        background-position: -40% 0;
    }
    100% {
        background-position: 140% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spotlight__item--loading .spotlight__item-hint::after,
    .spotlight--navigating .spotlight__panel::after {
        animation: none;
    }
}

.spotlight__item-kbd {
    display: inline-flex;
    gap: 3px;
}

.spotlight__empty {
    display: grid;
    justify-items: center;
    gap: 0;
    padding: 38px 24px 30px;
    text-align: center;
    color: hsl(var(--text-muted));
}

.spotlight__empty[hidden] {
    display: none;
}

.spotlight__empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
    color: hsl(var(--text-soft));
}

.spotlight__empty-icon .u-icon {
    width: 20px;
    height: 20px;
}

.spotlight__empty-title {
    color: hsl(var(--text));
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.spotlight__empty-text {
    max-width: 330px;
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.6;
}


/* the echoed query */

.spotlight__empty-term {
    color: hsl(var(--text));
    font-weight: 600;
    overflow-wrap: anywhere;
}

.spotlight__empty-term[hidden] {
    display: none;
}


/* divider keeps the suggestions from reading as part of the message */

.spotlight__empty-suggest {
    width: 100%;
    max-width: 380px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid hsl(var(--border));
}

.spotlight__empty-label {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: hsl(var(--text-muted));
}

.spotlight__empty-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.spotlight__suggestion {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 4px;
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
    color: hsl(var(--text-muted));
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
}

.spotlight__suggestion:hover {
    background: hsl(var(--primary-soft));
    border-color: hsl(var(--primary) / 0.45);
    color: hsl(var(--primary));
}

.spotlight__suggestion:focus-visible {
    outline: 2px solid hsl(var(--primary));
    outline-offset: 2px;
}


/* On dark, --primary text over --primary-soft only reaches 2.6:1 — lift both. */

[data-mode="dark"] .spotlight__suggestion:hover {
    background: hsl(var(--primary) / 0.22);
    border-color: hsl(var(--primary) / 0.5);
    color: hsl(237 80% 78%);
}

.spotlight__footer {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--surface-2));
    font-size: 12px;
    color: hsl(var(--text-muted));
}

.spotlight__footer-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}


/* =========================================================
   7. BUTTONS
   ========================================================= */

.btn {
    --btn-bg: hsl(var(--surface));
    --btn-fg: hsl(var(--text));
    --btn-bd: hsl(var(--border));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    font-size: 13.5px;
    padding: 8px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--btn-bd);
    background: var(--btn-bg);
    color: var(--btn-fg);
    line-height: 1.2;
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t), transform var(--t-fast);
    font-family: inherit;
}


/* Explicit hover state — must match :hover specificity of Bootstrap so our
   --btn-* tokens win over Bootstrap's --bs-btn-hover-* defaults that would
   otherwise reset bg/color/border to transparent. */

.btn:hover {
    background: var(--btn-bg);
    color: var(--btn-fg);
    border-color: var(--btn-bd);
    box-shadow: var(--shadow-xs);
}

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.24);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn--sm {
    padding: 6px 10px;
    font-size: 12.5px;
}

.btn--lg {
    padding: 11px 18px;
    font-size: 14.5px;
    border-radius: var(--r);
}

.btn--icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn--icon.btn--sm {
    width: 30px;
    height: 30px;
}


/* Variants */

.btn--primary {
    --btn-bg: hsl(var(--primary));
    --btn-fg: hsl(var(--white));
    --btn-bd: hsl(var(--primary));
    box-shadow: none;
}

.btn--primary:hover {
    --btn-bg: hsl(var(--primary-hover));
    --btn-bd: hsl(var(--primary-hover));
}

.btn--secondary {
    --btn-bg: hsl(var(--secondary));
    --btn-fg: hsl(var(--white));
    --btn-bd: hsl(var(--secondary));
}

.btn--secondary:hover {
    filter: brightness(0.95);
}

.btn--success {
    --btn-bg: hsl(var(--success));
    --btn-fg: hsl(var(--white));
    --btn-bd: hsl(var(--success));
}

.btn--danger {
    --btn-bg: hsl(var(--danger));
    --btn-fg: hsl(var(--white));
    --btn-bd: hsl(var(--danger));
}

.btn--warning {
    --btn-bg: hsl(var(--warning));
    --btn-fg: hsl(var(--ink));
    --btn-bd: hsl(var(--warning));
}

.btn--outline {
    --btn-bg: transparent;
    --btn-fg: hsl(var(--text));
    --btn-bd: hsl(var(--border-strong));
}

.btn--outline:hover {
    --btn-bg: hsl(var(--surface-2));
}

.btn--outline-primary {
    --btn-bg: transparent;
    --btn-fg: hsl(var(--primary));
    --btn-bd: hsl(var(--primary) / 0.4);
}

.btn--outline-primary:hover {
    --btn-bg: hsl(var(--primary) / 0.08);
    --btn-bd: hsl(var(--primary));
}

.btn--ghost {
    --btn-bg: transparent;
    --btn-fg: hsl(var(--text));
    --btn-bd: transparent;
}

.btn--ghost:hover {
    --btn-bg: hsl(var(--surface-3));
}


/* =========================================================
   8. FORMS
   ========================================================= */

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: hsl(var(--neutral-950));
    margin-bottom: 8px;
}


/* Auto required asterisk: any group containing a required field */

.form-group:has(:is(input, select, textarea)[required])>.form-label>span:first-child::after,
.form-group:has(:is(input, select, textarea)[aria-required="true"])>.form-label>span:first-child::after {
    content: " *";
    color: hsl(var(--danger));
    font-weight: 600;
}


/* Fallback: labels without the inner <span> wrapper (e.g. <x-form.label>) */

.form-group:has(:is(input, select, textarea)[required])>.form-label:not(.field-label)::after,
.form-group:has(:is(input, select, textarea)[aria-required="true"])>.form-label:not(.field-label)::after {
    content: " *";
    color: hsl(var(--danger));
    font-weight: 600;
}

.form-help {
    font-size: 12px;
    color: hsl(var(--text-muted));
    margin-top: 6px;
}

.input,
.select,
.textarea {
    width: 100%;
    display: block;
    min-height: 40px;
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    color: hsl(var(--text));
    background: hsl(var(--white));
    border: 1px solid hsl(var(--border-strong));
    border-radius: 4px;
    font-family: inherit;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}

.input::placeholder,
.textarea::placeholder {
    color: hsl(var(--text-soft));
    font-weight: 400;
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: hsl(var(--border-strong));
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    background: hsl(var(--white));
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.16);
}

.textarea {
    min-height: 96px;
    resize: vertical;
}


/* Read-only — generated values the admin can copy but not change */

.input[readonly],
.select[readonly],
.textarea[readonly] {
    background: hsl(var(--surface-2));
    color: hsl(var(--text-muted));
    border-color: hsl(var(--border));
    cursor: default;
}

.input[readonly]:hover,
.textarea[readonly]:hover {
    border-color: hsl(var(--border));
}

.input[readonly]:focus,
.textarea[readonly]:focus {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
    box-shadow: none;
}


/* Validation error state */

.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
    border-color: hsl(var(--danger));
    background: hsl(var(--danger) / 0.03);
}

.input.is-invalid:focus,
.select.is-invalid:focus,
.textarea.is-invalid:focus {
    border-color: hsl(var(--danger));
    box-shadow: 0 0 0 3px hsl(var(--danger) / 0.15);
}

.form-group .text-danger,
.invalid-feedback {
    font-size: 12.5px;
    font-weight: 500;
    color: hsl(var(--danger));
}


/* Password field with show/hide toggle */

.pw-field {
    position: relative;
}

.pw-field__input {
    padding-right: 40px;
}

.pw-field__toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: hsl(var(--text-soft));
}

.pw-field__toggle:hover {
    color: hsl(var(--text-muted));
}

.pw-field__icon--hide {
    display: none;
}

.pw-field__toggle--active .pw-field__icon--show {
    display: none;
}

.pw-field__toggle--active .pw-field__icon--hide {
    display: block;
}

.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
    padding-right: 36px;
}

select.input,
select.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: var(--select-chevron-light);
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
    padding-right: 36px;
}


/* Bootstrap form controls (normalize to our design system) */

.form-control,
.form-select {
    width: 100%;
    display: block;
    min-height: 40px;
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    color: hsl(var(--text));
    background-color: hsl(var(--white));
    border: 1px solid hsl(var(--border-strong));
    border-radius: 4px;
    box-shadow: none;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}

.form-control::placeholder {
    color: hsl(var(--text-soft));
    font-weight: 400;
}

.form-control:hover,
.form-select:hover {
    border-color: hsl(var(--border-strong));
}

.form-control:focus,
.form-select:focus {
    outline: none;
    background-color: hsl(var(--white));
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.16);
}

.input-group-text {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 12px;
    color: hsl(var(--text-muted));
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border-strong));
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

.input-group .form-control {
    border-radius: 4px;
}


/* Modals (Bootstrap) */

.modal-content {
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
}


/* =========================================================
   Language tabs (multilingual inputs)
   ========================================================= */

.lang-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    border: 0;
    margin: 0 0 10px;
}

.lang-tabs .nav-link {
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    padding: 6px 10px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1;
    color: hsl(var(--text-muted));
    background: hsl(var(--surface));
    transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
}

.lang-tabs .nav-link:hover {
    color: hsl(var(--text));
    border-color: hsl(var(--border-strong));
    background: hsl(var(--surface-2));
}

.lang-tabs .nav-link.active {
    color: hsl(var(--primary));
    border-color: hsl(var(--primary) / 0.35);
    background: hsl(var(--primary) / 0.10);
    box-shadow: 0 0 0 1px hsl(var(--primary) / 0.18) inset;
}

.lang-tab-panel {
    border: 0;
    border-radius: 0;
    background: transparent;
}

[data-mode="dark"] .lang-tabs .nav-link {
    border-color: hsl(var(--border));
    background: hsl(var(--surface));
    color: hsl(var(--text-muted));
}

[data-mode="dark"] .lang-tabs .nav-link:hover {
    color: hsl(var(--text));
    border-color: hsl(var(--border-strong));
    background: hsl(var(--surface-2));
}

[data-mode="dark"] .lang-tabs .nav-link.active {
    color: hsl(var(--primary));
    border-color: hsl(var(--primary) / 0.35);
    background: hsl(var(--primary) / 0.12);
}

.modal-header,
.modal-footer {
    border-color: hsl(var(--border));
}

.modal-header {
    padding: 16px 18px;
}

.modal-body {
    padding: 16px 18px;
}

.modal-footer {
    padding: 14px 18px 18px;
}

.btn-close {
    filter: none;
    opacity: 0.55;
    transition: opacity var(--t-fast);
}

.btn-close:hover {
    opacity: 0.85;
}

.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    min-height: 40px;
    background: hsl(var(--white)) !important;
    border: 1px solid hsl(var(--border-strong)) !important;
    border-radius: 4px;
    color: hsl(var(--text));
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    padding: 5px 10px;
}

.select2-container--default .select2-selection--multiple .select2-search__field {
    background: transparent;
    color: hsl(var(--text));
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    color: hsl(var(--text));
    margin-top: 4px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: hsl(var(--text-muted));
    margin-right: 6px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: hsl(var(--text));
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: hsl(var(--text-muted));
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    color: hsl(var(--text-muted));
    margin-right: 28px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: hsl(var(--text));
    font-weight: 500;
    line-height: 38px;
    padding-left: 12px;
    padding-right: 34px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px;
    right: 8px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: hsl(var(--primary)) !important;
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.16);
}

.select2-dropdown {
    background: hsl(var(--white)) !important;
    border: 1px solid hsl(var(--border-strong)) !important;
    color: hsl(var(--text));
    box-shadow: none;
    overflow: hidden;
}

.select2-results__options {
    max-height: 240px;
    overflow-y: auto;
}

.select2-results__options::-webkit-scrollbar {
    width: 10px;
}

.select2-results__options::-webkit-scrollbar-track {
    background: hsl(var(--surface));
}

.select2-results__options::-webkit-scrollbar-thumb {
    background: hsl(var(--border-strong));
    border: 2px solid hsl(var(--surface));
    border-radius: 999px;
}

.select2-container--default .select2-results__option--selected {
    background: hsl(var(--primary) / 0.14);
    color: hsl(var(--text));
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: hsl(var(--primary));
    color: hsl(var(--white));
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background: hsl(var(--white));
    border: 1px solid hsl(var(--border-strong));
    border-radius: 4px;
    color: hsl(var(--text));
    min-height: 40px;
    padding: 8px 12px;
    font-weight: 500;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.16);
}


/* CKEditor 5 */

.ck.ck-editor {
    color: hsl(var(--text));
}

.ck.ck-editor__main>.ck-editor__editable,
.ck.ck-toolbar,
.ck.ck-dropdown__panel,
.ck.ck-balloon-panel,
.ck.ck-list,
.ck.ck-input,
.ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-input {
    background: hsl(var(--surface));
    border-color: hsl(var(--border));
    color: hsl(var(--text));
}

.ck.ck-editor__main>.ck-editor__editable {
    min-height: 160px;
    border-bottom-left-radius: var(--r-sm) !important;
    border-bottom-right-radius: var(--r-sm) !important;
}

.ck.ck-toolbar {
    border-top-left-radius: var(--r-sm) !important;
    border-top-right-radius: var(--r-sm) !important;
}

.ck.ck-button,
.ck.ck-button.ck-off,
.ck.ck-dropdown .ck-dropdown__button,
.ck.ck-splitbutton .ck-splitbutton__action,
.ck.ck-splitbutton .ck-splitbutton__arrow {
    color: hsl(var(--text));
    background: transparent;
}

.ck.ck-button:hover,
.ck.ck-button.ck-on,
.ck.ck-button.ck-off:hover,
.ck.ck-dropdown .ck-dropdown__button:hover,
.ck.ck-list__item .ck-button:hover,
.ck.ck-list__item .ck-button.ck-on {
    background: hsl(var(--primary) / 0.14);
    color: hsl(var(--text));
}

.ck.ck-button:focus,
.ck.ck-button.ck-focused,
.ck.ck-editor__editable.ck-focused,
.ck.ck-input:focus {
    border-color: hsl(var(--primary)) !important;
    box-shadow: 0 0 0 1px hsl(var(--primary)) !important;
}

.ck.ck-toolbar .ck.ck-toolbar__separator {
    background: hsl(var(--border));
}

.ck.ck-editor__editable_inline> :first-child {
    margin-top: 0;
}

.ck.ck-editor__editable_inline> :last-child {
    margin-bottom: 0;
}


/* Search field */

.search {
    position: relative;
}

.search__input {
    width: 100%;
    min-height: 42px;
    padding: 9px 13px 9px 39px;
    font-size: 13px;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    color: hsl(var(--text));
    font-family: inherit;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}

.search__input:focus {
    outline: none;
    background: hsl(var(--surface));
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}

.search__icon {
    position: absolute;
    left: 13px;
    top: 50%;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    color: hsl(var(--text-muted));
    pointer-events: none;
}


/* Check & switch */

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.check input {
    accent-color: hsl(var(--primary));
    width: 16px;
    height: 16px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch__slider {
    position: absolute;
    inset: 0;
    background: hsl(var(--border-strong));
    border-radius: 999px;
    transition: background var(--t);
    cursor: pointer;
}

.switch__slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: hsl(var(--white));
    box-shadow: var(--shadow-sm);
    transition: transform var(--t);
}

.switch input:checked+.switch__slider {
    background: hsl(var(--primary));
}

.switch input:checked+.switch__slider::before {
    transform: translateX(16px);
}


/* =========================================================
   9. CARDS (base)
   ========================================================= */

.card {
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}


/* Allow help-tooltips (from .help-qs) to escape card bounds */

.card:has(.help-qs)::after,
.card:has(.help-qs) {
    overflow: visible;
}


/* Dropdowns need to escape cards that wrap tables */

.card.mb-4 {
    overflow: visible;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid hsl(var(--border));
    gap: 12px;
}

.card__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.card__subtitle {
    font-size: 12.5px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}

.card__body {
    padding: 18px;
}

.card__footer {
    padding: 12px 20px;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--surface-2));
}


/* =========================================================
   10. WIDGETS — 16+ dashboard tiles
   ========================================================= */


/* 10.1  Stats card (icon + value + trend) */

.widget-stat {
    display: block;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    padding: 18px 20px;
    height: 100%;
    box-shadow: var(--shadow-xs);
    color: inherit;
    transition: box-shadow var(--t), transform var(--t);
}

.widget-stat:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    color: inherit;
}

.widget-stat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.widget-stat__label {
    font-size: 13px;
    color: hsl(var(--text-muted));
    font-weight: 500;
}

.widget-stat__icon {
    width: 38px;
    height: 38px;
    border-radius: var(--r);
    display: grid;
    place-items: center;
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
}

.widget-stat__icon--info {
    background: hsl(var(--info) / 0.12);
    color: hsl(var(--info));
}

.widget-stat__icon--warning {
    background: hsl(var(--warning) / 0.15);
    color: hsl(var(--warning));
}

.widget-stat__icon--danger {
    background: hsl(var(--danger) / 0.12);
    color: hsl(var(--danger));
}

.widget-stat__value {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: hsl(var(--text));
    line-height: 1.1;
}

.widget-stat__trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 4px;
}

.widget-stat__trend--up {
    background: hsl(var(--success) / 0.12);
    color: hsl(var(--success));
}

.widget-stat__trend--down {
    background: hsl(var(--danger) / 0.12);
    color: hsl(var(--danger));
}

.widget-stat__sub {
    font-size: 12px;
    color: hsl(var(--text-muted));
    margin-left: 6px;
}


/* 10.2  Gradient stat card */

.widget-gradient {
    height: 100%;
    position: relative;
    border-radius: var(--r-lg);
    padding: 20px;
    color: hsl(var(--white));
    background: radial-gradient(120% 100% at 100% 0%, hsl(var(--primary) / 0.55), transparent 60%), linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
    box-shadow: none;
    overflow: hidden;
}

.widget-gradient::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 60% at 110% 110%, hsl(var(--white) / 0.12), transparent 60%);
    pointer-events: none;
}

.widget-gradient__label {
    font-size: 12.5px;
    opacity: 0.85;
}

.widget-gradient__value {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-top: 6px;
}

.widget-gradient__foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 12.5px;
    opacity: 0.95;
}

.widget-gradient__chip {
    background: hsl(var(--white) / 0.16);
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 600;
}


/* 10.3  Progress card */

.widget-progress {
    padding: 20px;
}

.widget-progress__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.widget-progress__title {
    font-size: 14px;
    font-weight: 600;
}

.widget-progress__pct {
    font-size: 13px;
    color: hsl(var(--text-muted));
    font-weight: 500;
}

.progress-bar {
    height: 8px;
    width: 100%;
    background: hsl(var(--surface-3));
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--primary) / 0.75));
    border-radius: inherit;
    transition: width var(--t);
}

.progress-bar__fill--warning {
    background: linear-gradient(90deg, hsl(var(--warning)), hsl(var(--warning-light)));
}

.progress-bar__fill--danger {
    background: linear-gradient(90deg, hsl(var(--danger)), hsl(var(--danger-light)));
}

.progress-bar__fill--info {
    background: linear-gradient(90deg, hsl(var(--info)), hsl(var(--info-light)));
}

.widget-progress__legend {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: hsl(var(--text-muted));
}


/* 10.4  Revenue card with mini sparkline */

.widget-revenue {
    padding: 20px;
}

.widget-revenue__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.widget-revenue__amount {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.spark {
    width: 100%;
    height: 64px;
    margin-top: 12px;
    border-radius: var(--r);
    background: linear-gradient(160deg, transparent 0 18%, hsl(var(--primary) / 0.2) 19% 21%, transparent 22% 42%, hsl(var(--primary) / 0.28) 43% 45%, transparent 46% 64%, hsl(var(--primary) / 0.2) 65% 67%, transparent 68%), linear-gradient(180deg, hsl(var(--primary) / 0.16), transparent 80%);
}


/* 10.5  Activity card (mini list with dots) */

.widget-activity {
    padding: 4px 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid hsl(var(--border));
}

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

.activity-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: hsl(var(--primary));
    margin-top: 6px;
    flex: 0 0 8px;
    box-shadow: 0 0 0 4px hsl(var(--primary) / 0.15);
}

.activity-item__dot--info {
    background: hsl(var(--info));
    box-shadow: 0 0 0 4px hsl(var(--info) / 0.15);
}

.activity-item__dot--warning {
    background: hsl(var(--warning));
    box-shadow: 0 0 0 4px hsl(var(--warning) / 0.15);
}

.activity-item__dot--danger {
    background: hsl(var(--danger));
    box-shadow: 0 0 0 4px hsl(var(--danger) / 0.15);
}

.activity-item__title {
    font-size: 13.5px;
    font-weight: 500;
    color: hsl(var(--text));
}

.activity-item__meta {
    font-size: 12px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}


/* 10.6  User summary card */

.widget-user {
    padding: 20px;
    text-align: center;
}

.widget-user__avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-hover)));
    color: hsl(var(--white));
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 600;
    box-shadow: none;
}

.widget-user__name {
    font-size: 15px;
    font-weight: 600;
}

.widget-user__role {
    font-size: 12.5px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}

.widget-user__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 16px;
    border-top: 1px solid hsl(var(--border));
    padding-top: 14px;
}

.widget-user__stat-value {
    font-weight: 600;
    font-size: 15px;
}

.widget-user__stat-label {
    font-size: 11.5px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}


/* setting/profile — summary card + avatar picker */

.profile-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.profile-hero {
    position: relative;
    padding: 0 20px 20px;
    text-align: center;
}


/* tinted band so the avatar has something to sit against */

.profile-hero__cover {
    height: 76px;
    margin: 0 -20px 0;
    background: radial-gradient(120% 140% at 20% 0%, hsl(var(--primary) / 0.35), transparent 60%), linear-gradient(120deg, hsl(var(--primary)), hsl(var(--primary-hover)));
}

.profile-hero__avatar.admin-avatar--profile {
    margin: -38px auto 12px;
    border: 3px solid hsl(var(--surface));
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1;
}

.profile-hero__name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.profile-hero__email {
    font-size: 12.5px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.profile-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    padding: 4px 11px;
    border-radius: 4px;
    background: hsl(var(--primary-soft));
    color: hsl(var(--primary));
    font-size: 11.5px;
    font-weight: 600;
}


/* On dark, --primary over --primary-soft only reaches 2.6:1 — lift both. */

[data-mode="dark"] .profile-hero__badge {
    background: hsl(var(--primary) / 0.22);
    color: hsl(237 80% 78%);
}

.profile-meta {
    padding: 4px 20px;
    border-top: 1px solid hsl(var(--border));
}

.profile-meta__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    font-size: 13px;
}

.profile-meta__row+.profile-meta__row {
    border-top: 1px solid hsl(var(--border));
}

.profile-meta__label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: hsl(var(--text-muted));
    flex-shrink: 0;
}

.profile-meta__value {
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.profile-card__foot {
    margin-top: auto;
    padding: 16px 20px 20px;
}


/* ── Avatar picker (profile form) ── */

.avatar-picker {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r);
    background: hsl(var(--surface-2));
}

.avatar-picker__preview {
    position: relative;
    width: 78px;
    height: 78px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    display: grid;
    place-items: center;
}

.avatar-picker__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.avatar-picker__fallback {
    display: grid;
    place-items: center;
    color: hsl(var(--text-soft));
}

.avatar-picker__fallback svg {
    width: 28px;
    height: 28px;
}

.avatar-picker__body {
    min-width: 0;
}

.avatar-picker__title {
    font-size: 13.5px;
    font-weight: 600;
}

.avatar-picker__hint {
    font-size: 12px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}

.avatar-picker__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

@media (max-width: 575.98px) {
    .avatar-picker {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
}


/* 10.7  Notification summary card */

.widget-notif {
    padding: 6px 0;
}

.notif-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    transition: background var(--t);
}

.notif-row:hover {
    background: hsl(var(--surface-2));
}

.notif-row__icon {
    width: 34px;
    height: 34px;
    border-radius: var(--r);
    display: grid;
    place-items: center;
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
    flex: 0 0 34px;
}

.notif-row__icon--info {
    background: hsl(var(--info) / 0.10);
    color: hsl(var(--info));
}

.notif-row__icon--warning {
    background: hsl(var(--warning) / 0.15);
    color: hsl(var(--warning));
}

.notif-row__icon--danger {
    background: hsl(var(--danger) / 0.10);
    color: hsl(var(--danger));
}

.notif-row__title {
    font-size: 13.5px;
    font-weight: 500;
}

.notif-row__time {
    font-size: 11.5px;
    color: hsl(var(--text-muted));
}


/* 10.8  Task progress card (list with progress) */

.widget-tasks {
    padding: 6px 0;
}

.task-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid hsl(var(--border));
}

.task-row:last-child {
    border-bottom: 0;
}

.task-row__check {
    width: 18px;
    height: 18px;
    border: 1.5px solid hsl(var(--border-strong));
    border-radius: 4px;
    display: grid;
    place-items: center;
    flex: 0 0 18px;
    cursor: pointer;
    transition: background var(--t), border-color var(--t);
}

.task-row__check:hover {
    border-color: hsl(var(--primary));
}

.task-row__check--done {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
    color: hsl(var(--white));
}

.task-row__main {
    flex: 1;
    min-width: 0;
}

.task-row__title {
    font-size: 13.5px;
    font-weight: 500;
}

.task-row__title--done {
    color: hsl(var(--text-muted));
    text-decoration: line-through;
}

.task-row__meta {
    font-size: 11.5px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}


/* 10.9  KPI split card (2 columns) */

.widget-kpi-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.widget-kpi-split__cell {
    padding: 18px 20px;
}

.widget-kpi-split__cell+.widget-kpi-split__cell {
    border-left: 1px solid hsl(var(--border));
}

.widget-kpi-split__label {
    font-size: 12.5px;
    color: hsl(var(--text-muted));
}

.widget-kpi-split__value {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-top: 4px;
}

.widget-kpi-split__delta {
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.widget-kpi-split__delta--up {
    color: hsl(var(--success));
}

.widget-kpi-split__delta--down {
    color: hsl(var(--danger));
}


/* 10.10 Comparison card (this week vs last) */

.widget-compare {
    padding: 20px;
}

.widget-compare__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.widget-compare__label {
    font-size: 13px;
    color: hsl(var(--text-muted));
}

.widget-compare__value {
    font-size: 14px;
    font-weight: 600;
}

.widget-compare__bar {
    height: 6px;
    background: hsl(var(--surface-3));
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
}

.widget-compare__bar>span {
    display: block;
    height: 100%;
    background: hsl(var(--primary));
    border-radius: inherit;
}

.widget-compare__bar--alt>span {
    background: hsl(var(--secondary));
}


/* 10.11 Table preview card — uses .table inside .card */


/* 10.12 Chart card (large) */

.chart-placeholder {
    position: relative;
    width: 100%;
    height: 280px;
    border-radius: var(--r);
    background: linear-gradient(180deg, hsl(var(--primary) / 0.06), hsl(var(--primary) / 0)), repeating-linear-gradient(to right, hsl(var(--border)) 0 1px, transparent 1px 80px), repeating-linear-gradient(to bottom, hsl(var(--border)) 0 1px, transparent 1px 56px);
    overflow: hidden;
}

.chart-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, hsl(var(--primary) / 0.3), hsl(var(--primary) / 0.02));
    clip-path: polygon(0 75%, 12% 62%, 24% 70%, 36% 48%, 49% 61%, 63% 42%, 76% 52%, 88% 28%, 100% 35%, 100% 100%, 0 100%);
}


/* 10.13 Compact stat row (horizontal mini stats) */

.widget-row {
    display: flex;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.widget-row__cell {
    flex: 1;
    padding: 14px 18px;
}

.widget-row__cell+.widget-row__cell {
    border-left: 1px solid hsl(var(--border));
}

.widget-row__label {
    font-size: 12px;
    color: hsl(var(--text-muted));
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.widget-row__value {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 2px;
}


/* 10.14 Timeline card */

.timeline {
    padding: 8px 20px 16px;
}

.timeline__item {
    position: relative;
    padding: 12px 0 12px 24px;
}

.timeline__item::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: hsl(var(--border));
}

.timeline__item:first-child::before {
    top: 18px;
}

.timeline__item:last-child::before {
    bottom: calc(100% - 18px);
}

.timeline__dot {
    position: absolute;
    left: 0;
    top: 14px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: hsl(var(--surface));
    border: 2px solid hsl(var(--primary));
}

.timeline__title {
    font-size: 13.5px;
    font-weight: 600;
}

.timeline__meta {
    font-size: 12px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}


/* 10.15 Recent activity feed (with avatars) */

.feed {
    padding: 6px 0;
}

.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid hsl(var(--border));
}

.feed-item:last-child {
    border-bottom: 0;
}

.feed-item__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: hsl(var(--primary) / 0.15);
    color: hsl(var(--primary));
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 12px;
    flex: 0 0 34px;
}

.feed-item__main {
    flex: 1;
    min-width: 0;
}

.feed-item__text {
    font-size: 13.5px;
}

.feed-item__text strong {
    color: hsl(var(--text));
}

.feed-item__meta {
    font-size: 12px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}


/* 10.16 Empty state card */

.empty {
    text-align: center;
    padding: 40px 24px;
}

.empty__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
}

.empty__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
}

.empty__desc {
    color: hsl(var(--text-muted));
    margin: 0 0 16px;
    font-size: 13.5px;
}


/* 10.17 Website section library */

.section-library {
    width: 100%;
}

.section-library__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 24px;
}

.section-library__heading {
    min-width: 0;
}

.section-library__eyebrow {
    display: block;
    margin-bottom: 7px;
    color: hsl(var(--primary));
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.section-library__heading h1 {
    margin: 0 0 6px;
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.section-library__heading p {
    margin: 0;
    color: hsl(var(--text-muted));
    font-size: 12.5px;
}

.section-library__search {
    width: min(310px, 100%);
    flex: 0 0 auto;
}

.section-library__search .search__input {
    min-height: 44px;
    border-radius: 4px;
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
}

.section-library__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.section-tile {
    position: relative;
    display: flex;
    align-items: center;
    flex-direction: column;
    min-width: 0;
    min-height: 236px;
    padding: 27px 22px 0;
    overflow: hidden;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r);
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
    color: hsl(var(--text));
    text-align: center;
    text-decoration: none;
    transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}

.section-tile::before {
    position: absolute;
    top: 0;
    left: 50%;
    width: 42px;
    height: 2px;
    transform: translateX(-50%) scaleX(0);
    border-radius: 0 0 3px 3px;
    background: hsl(var(--primary));
    content: "";
    transition: transform var(--t);
}

.section-tile:hover,
.section-tile:focus-visible {
    transform: translateY(-2px);
    border-color: hsl(var(--primary) / 0.34);
    box-shadow: none;
    color: hsl(var(--text));
}

.section-tile:hover::before,
.section-tile:focus-visible::before {
    transform: translateX(-50%) scaleX(1);
}

.section-tile:focus-visible {
    outline: 3px solid hsl(var(--primary) / 0.14);
    outline-offset: 2px;
}

.section-tile__icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 16px;
    border: 1px solid hsl(var(--primary) / 0.14);
    border-radius: 50%;
    background: hsl(var(--primary-soft));
    color: hsl(var(--primary));
    transition: transform var(--t), background var(--t), color var(--t);
}

.section-tile__icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.9;
}

.section-tile:hover .section-tile__icon,
.section-tile:focus-visible .section-tile__icon {
    transform: translateY(-2px);
    background: hsl(var(--primary));
    color: hsl(var(--white));
}

.section-tile__title {
    display: block;
    overflow: hidden;
    width: 100%;
    margin-bottom: 9px;
    color: hsl(var(--text));
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.015em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-tile__description {
    display: -webkit-box;
    overflow: hidden;
    max-width: 265px;
    min-height: 54px;
    color: hsl(var(--text-muted));
    font-size: 11.5px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.section-tile__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: calc(100% + 44px);
    min-height: 42px;
    margin: auto -22px 0;
    padding: 0 17px;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--surface-2) / 0.52);
    text-align: left;
}

.section-tile__footer code {
    overflow: hidden;
    max-width: 50%;
    color: hsl(var(--primary-hover));
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-tile__meta {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 6px;
    color: hsl(var(--text-soft));
    font-size: 9.5px;
    font-weight: 600;
}

.section-tile__meta svg {
    width: 13px;
    height: 13px;
    transition: transform var(--t);
}

.section-tile:hover .section-tile__meta,
.section-tile:focus-visible .section-tile__meta {
    color: hsl(var(--primary-hover));
}

.section-tile:hover .section-tile__meta svg,
.section-tile:focus-visible .section-tile__meta svg {
    transform: translate(1px, -1px);
}

.section-library__empty {
    grid-column: 1 / -1;
    min-height: 260px;
    border: 1px dashed hsl(var(--border-strong));
    border-radius: var(--r);
    background: hsl(var(--surface));
}

.section-library__empty--search {
    margin-top: 2px;
}

@media (max-width: 1280px) {
    .section-library__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .section-library__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .section-library__header {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 20px;
    }
    .section-library__heading h1 {
        font-size: 20px;
    }
    .section-library__search {
        width: 100%;
    }
    .section-library__grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .section-tile {
        min-height: 220px;
    }
}


/* =========================================================
   11. TABLES
   ========================================================= */

.table-wrap {
    position: relative;
    overflow: visible;
    border-radius: var(--r-lg);
    background: hsl(var(--surface));
}

.card>.table-wrap:first-child,
.card>.table-wrap:first-child .table-scroll {
    border-top-left-radius: calc(var(--r-lg) - 1px);
    border-top-right-radius: calc(var(--r-lg) - 1px);
}

.card>.table-wrap:first-child .table thead:first-child th:first-child,
.card>.table-wrap:first-child .table tbody:first-child tr:first-child td:first-child {
    border-top-left-radius: calc(var(--r-lg) - 1px);
}

.card>.table-wrap:first-child .table thead:first-child th:last-child,
.card>.table-wrap:first-child .table tbody:first-child tr:first-child td:last-child {
    border-top-right-radius: calc(var(--r-lg) - 1px);
}

.card>.table-wrap:last-child .table tbody:last-child tr:last-child td:first-child {
    border-bottom-left-radius: calc(var(--r-lg) - 1px);
}

.card>.table-wrap:last-child .table tbody:last-child tr:last-child td:last-child {
    border-bottom-right-radius: calc(var(--r-lg) - 1px);
}

.table-scroll {
    overflow-x: auto;
    border-radius: inherit;
    scrollbar-color: hsl(var(--primary) / 0.35) transparent;
}


/* A table-wrap directly under a .card__header: the header already owns the top corners. */

.card__header+.table-wrap,
.card__header+.table-wrap .table-scroll {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    --bs-table-bg: transparent;
    --bs-table-color: hsl(var(--text));
    --bs-table-hover-bg: hsl(var(--primary) / 0.035);
}

.table thead th {
    background: hsl(var(--table-head));
    text-align: start;
    font-weight: 600;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0.01em;
    color: hsl(var(--table-head-text));
    padding: 12px 16px;
    border-bottom: 1px solid hsl(var(--primary) / 0.12);
    white-space: nowrap;
}


/* Extra breathing room on the outer columns */

.table thead th:first-child,
.table tbody td:first-child,
.table tfoot td:first-child,
.table tfoot th:first-child {
    padding-inline-start: 20px;
}

.table thead th:last-child,
.table tbody td:last-child,
.table tfoot td:last-child,
.table tfoot th:last-child {
    padding-inline-end: 20px;
}


/* Optional sticky header for tall scrollable tables */

.table--sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid hsl(var(--border) / 0.7);
    vertical-align: middle;
    background: hsl(var(--surface));
    color: hsl(var(--text));
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
    transition: background-color 120ms ease;
}


/* Zebra rows by default — declared before the hover rule so hover still wins */

.table tbody tr:nth-child(even) > td {
    background: hsl(var(--table-stripe));
}

.table tbody tr:hover > td,
.table tbody tr:focus-within > td {
    background: hsl(var(--primary) / 0.07);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tfoot td,
.table tfoot th {
    background: hsl(var(--surface-2));
    padding: 12px 16px;
    font-weight: 600;
    border-top: 1px solid hsl(var(--border));
}


/* Zebra rows are now the default (see .table tbody rules above), so the
   striped / .table--striped option needs no rule of its own. */

.table--bordered th,
.table--bordered td {
    border-right: 1px solid hsl(var(--border));
}

.table--bordered th:last-child,
.table--bordered td:last-child {
    border-right: 0;
}

.table--sm thead th,
.table--sm tbody td,
.table--sm tfoot td,
.table--sm tfoot th {
    padding-block: 9px;
}

.table__user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table__avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: hsl(var(--primary-soft));
    color: hsl(var(--primary));
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.02em;
    box-shadow: inset 0 0 0 1px hsl(var(--primary) / 0.12);
    flex-shrink: 0;
}

.table__user-name {
    font-weight: 600;
    color: hsl(var(--text));
    line-height: 1.35;
}

.table__user-mail {
    margin-top: 4px;
    font-size: 12px;
    color: hsl(var(--text-muted));
    line-height: 1.35;
}

.table__actions {
    display: table-cell;
    text-align: end;
    white-space: nowrap;
}

.table code,
.table__code {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface-2));
    color: hsl(var(--text-muted));
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
}

.table__actions .btn--outline {
    --btn-bg: hsl(var(--surface));
    --btn-fg: hsl(var(--text));
    --btn-bd: hsl(var(--border));
    min-height: 32px;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.table__actions .btn--outline:hover {
    --btn-bg: hsl(var(--surface-2));
    --btn-fg: hsl(var(--primary));
    --btn-bd: hsl(var(--border-strong));
}


/* Status badges read as square tags inside tables */

.table .badge {
    border-radius: 4px;
}

.card:has(>.table-wrap) {
    border-color: hsl(var(--border));
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}

@media (max-width: 768px) {
    .table-wrap:not(.table-wrap--static) {
        position: relative;
        max-width: 100%;
    }
    .table-wrap:not(.table-wrap--static)>.table-scroll {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }
    .table-wrap:not(.table-wrap--static)>.table-scroll>.table {
        min-width: 700px;
    }
    .table-wrap:not(.table-wrap--static)>.table-scroll>.table thead th,
    .table-wrap:not(.table-wrap--static)>.table-scroll>.table tbody td,
    .table-wrap:not(.table-wrap--static)>.table-scroll>.table tfoot td,
    .table-wrap:not(.table-wrap--static)>.table-scroll>.table tfoot th {
        padding-inline: 12px;
    }
    .table-scroll:focus-visible {
        outline: 2px solid hsl(var(--primary) / 0.45);
        outline-offset: -2px;
    }
    /* Card-style tables remain available as an explicit opt-in. */
    .table--stacked {
        min-width: 0 !important;
    }
    .table--stacked thead {
        display: none;
    }
    .table--stacked,
    .table--stacked tbody,
    .table--stacked tr,
    .table--stacked td {
        display: block;
        width: 100%;
    }
    .table--stacked tbody tr {
        margin: 0 12px 14px;
        width: auto;
        border: 1px solid hsl(var(--border));
        border-radius: var(--r-lg);
        background: hsl(var(--surface));
        box-shadow: var(--shadow-xs);
        overflow: hidden;
    }
    .table--stacked tbody tr:first-child {
        margin-top: 12px;
    }
    .table--stacked tbody td {
        text-align: right;
        padding: 12px 14px 12px 50%;
        position: relative;
        border-bottom: 1px solid hsl(var(--border) / 0.7);
    }
    .table--stacked tbody tr:last-child td {
        border-bottom: 1px solid hsl(var(--border) / 0.7);
    }
    .table--stacked tbody td:last-child,
    .table--stacked tbody tr:last-child td:last-child {
        border-bottom: 0;
    }
    .table--stacked tbody td::before {
        content: attr(data-label);
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        width: calc(50% - 26px);
        padding-right: 10px;
        font-weight: 600;
        font-size: 12px;
        text-transform: none;
        letter-spacing: 0;
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: hsl(var(--text-muted));
    }
    /* Cells without a data-label don't reserve the label column */
    .table--stacked tbody td:not([data-label]) {
        padding-left: 14px;
    }
    .table--stacked tbody td[colspan] {
        padding: 12px 14px;
    }
    .table--stacked .table__actions {
        display: block;
        text-align: right;
    }
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.table-toolbar__heading,
.table-toolbar__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.table-toolbar__actions {
    margin-left: auto;
}

.table-toolbar__search {
    width: min(320px, 100%);
}

.admin-search {
    width: 220px;
    max-width: 100%;
}

.empty--spacious {
    padding: 60px 20px;
}

@media (max-width: 575px) {
    .table-toolbar,
    .table-toolbar__actions,
    .table-toolbar__search,
    .admin-search,
    .search-form {
        width: 100%;
    }
    .table-toolbar__actions {
        margin-left: 0;
    }
}


/* Loading skeleton — shimmer while a table loads */

.skeleton-line {
    display: block;
    border-radius: 4px;
    min-height: 12px;
    background: linear-gradient( 90deg, hsl(var(--surface-3)) 25%, hsl(var(--surface-2)) 45%, hsl(var(--surface-3)) 65%);
    background-size: 200% 100%;
    animation: table-shimmer 1.4s ease infinite;
}

@keyframes table-shimmer {
    from {
        background-position: 200% 0;
    }
    to {
        background-position: -200% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-line {
        animation: none;
    }
}


/* =========================================================
   12. BADGES, ALERTS, PAGINATION, EMPTY
   ========================================================= */


/* Badge */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 22px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 4px;
    background: hsl(var(--surface-3));
    color: hsl(var(--text));
    border: 1px solid transparent;
    line-height: 1.3;
    white-space: nowrap;
}


/* Tinted, borderless variants. Ink is darker than the raw status colour so
   small badge text clears 4.5:1 on its own tint. */

.badge--neutral {
    background: hsl(var(--surface-3));
    color: hsl(var(--text-muted));
}

.badge--primary {
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
}

.badge--success {
    background: hsl(var(--success) / 0.12);
    color: hsl(152 70% 27%);
}

.badge--danger {
    background: hsl(var(--danger) / 0.10);
    color: hsl(0 72% 42%);
}

.badge--warning {
    background: hsl(var(--warning) / 0.16);
    color: hsl(30 85% 30%);
}

.badge--info {
    background: hsl(var(--info) / 0.12);
    color: hsl(201 90% 32%);
}

.badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}


/* Alert */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--r);
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
}

.alert__icon {
    flex: 0 0 auto;
    margin-top: 2px;
}

.alert__title {
    font-weight: 600;
    margin: 0 0 2px;
    font-size: 13.5px;
}

.alert__msg {
    margin: 0;
    font-size: 12.5px;
    color: hsl(var(--text-muted));
}

.alert--info {
    background: hsl(var(--info) / 0.07);
    border-color: hsl(var(--info) / 0.25);
}

.alert--info .alert__icon,
.alert--info .alert__title {
    color: hsl(var(--info));
}

.alert--success {
    background: hsl(var(--success) / 0.07);
    border-color: hsl(var(--success) / 0.25);
}

.alert--success .alert__icon,
.alert--success .alert__title {
    color: hsl(var(--success));
}

.alert--warning {
    background: hsl(var(--warning) / 0.10);
    border-color: hsl(var(--warning) / 0.30);
}

.alert--warning .alert__icon,
.alert--warning .alert__title {
    color: hsl(var(--warning-deep));
}

.alert--danger {
    background: hsl(var(--danger) / 0.07);
    border-color: hsl(var(--danger) / 0.25);
}

.alert--danger .alert__icon,
.alert--danger .alert__title {
    color: hsl(var(--danger));
}


/* Pagination */

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 60px;
    margin-top: 16px;
    padding: 12px 20px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
}

.card>.pagination-bar,
.card__body.p-0>.pagination-bar {
    margin-top: 0;
    border-width: 1px 0 0;
    border-radius: 0 0 calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px);
    box-shadow: none;
}

.pagination-bar__summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    color: hsl(var(--text-muted));
    font-size: 13px;
    line-height: 1.4;
}

.pagination-bar__summary strong {
    color: hsl(var(--text));
    font-weight: 600;
}

.pagination-bar__controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-bar__page-state {
    display: none;
    color: hsl(var(--text-muted));
    font-size: 13px;
    white-space: nowrap;
}

.pagination-bar__page-state strong {
    color: hsl(var(--text));
    font-weight: 600;
}

.pagination {
    display: inline-flex;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 6px;
}

.pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
    color: hsl(var(--text));
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

.pagination__link:hover {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
    color: hsl(var(--text));
}

.pagination__link:focus-visible {
    outline: 0;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary-ring) / 0.18);
}

.pagination__link--arrow {
    color: hsl(var(--text-muted));
}

.pagination__item--active .pagination__link {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
    color: hsl(var(--white));
    box-shadow: none;
}

.pagination__item--disabled .pagination__link {
    color: hsl(var(--text-soft));
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border));
    box-shadow: none;
    opacity: .58;
    pointer-events: none;
}

.pagination__item--ellipsis .pagination__link {
    min-width: 26px;
    padding: 0 4px;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    color: hsl(var(--text-soft));
}

@media (max-width: 575px) {
    .pagination-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }
    .pagination-bar__summary {
        justify-content: center;
    }
    .pagination-bar__controls {
        justify-content: center;
    }
    .pagination-bar__page-state {
        display: inline-flex;
        align-items: baseline;
        gap: 4px;
    }
    .pagination__item--number,
    .pagination__item--ellipsis {
        display: none;
    }
}


/* =========================================================
   13. DROPDOWNS (override Bootstrap)
   ========================================================= */

.dropdown-menu {
    border: 1px solid hsl(var(--border));
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 220px;
    font-size: 14px;
}

.dropdown-item {
    border-radius: var(--r-sm);
    padding: 8px 10px;
    color: hsl(var(--text));
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
}

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

.dropdown-item--danger:hover {
    background: hsl(var(--danger) / 0.08);
    color: hsl(var(--danger));
}

.dropdown-divider {
    border-top-color: hsl(var(--border));
    margin: 6px 4px;
}

.dropdown-header {
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    color: hsl(var(--text-soft));
    padding: 8px 10px 4px;
    font-weight: 600;
}


/* =========================================================
   14. UTILITIES
   ========================================================= */

.u-stack-sm>*+* {
    margin-top: 8px;
}

.u-stack>*+* {
    margin-top: 16px;
}

.u-stack-lg>*+* {
    margin-top: 24px;
}

.u-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.u-spacer {
    flex: 1;
}

.u-muted {
    color: hsl(var(--text-muted));
}

.u-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.u-mt-0 {
    margin-top: 0 !important;
}


/* =========================================================
   15. RESPONSIVE
   ========================================================= */


/* Phone and tablet: use one predictable off-canvas navigation pattern. */

@media (max-width: 1100px) {
    .app {
        grid-template-columns: minmax(0, 1fr);
        background-image: none;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(var(--sb-w), calc(100vw - 48px));
        height: 100vh;
        height: 100dvh;
        transform: translateX(-105%);
        transition: transform 240ms cubic-bezier(.2, .8, .2, 1);
        box-shadow: var(--shadow-lg);
        visibility: hidden;
    }
    .sidebar--open {
        transform: translateX(0);
        visibility: visible;
    }
    .sidebar__brand {
        justify-content: flex-start;
        padding: 0 64px 0 18px;
    }
    .sidebar__brand-img {
        max-width: 156px;
        max-height: 32px;
    }
    .sidebar__close {
        display: inline-flex;
    }
    .sidebar__backdrop--visible {
        display: block;
    }
    .navbar-top {
        padding: 0 16px;
        gap: 10px;
    }
    .navbar-top__toggle {
        display: inline-flex;
    }
    .spotlight-trigger {
        max-width: 360px;
    }
    .app__content {
        min-width: 0;
        overflow: clip;
    }
}

@media (max-width: 768px) {
    .navbar-top {
        padding: 0 14px;
        gap: 10px;
    }
    .spotlight-trigger {
        flex: 0 0 38px;
        width: 38px;
        padding: 0;
        justify-content: center;
    }
    .spotlight-trigger__label,
    .spotlight-trigger__kbd,
    .navbar-top__profile-name {
        display: none;
    }
    .lang-switch__code {
        display: none;
    }
    .lang-switch {
        padding: 0 8px;
    }
    .app__content {
        padding: 16px;
    }
    .settings-topnav {
        min-height: 0;
        margin: -16px -16px 18px;
        padding: 0 16px;
    }
    .settings-topnav__links {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .settings-topnav__links::-webkit-scrollbar {
        display: none;
    }
    .page-header__title {
        font-size: 1.25rem;
    }
    /* Stack settings shell on mobile */
    .settings-shell {
        grid-template-columns: 1fr !important;
    }
    .settings-nav {
        position: static !important;
    }
}

@media (max-width: 1199px) and (min-width: 769px) {
    .settings-topnav__link {
        min-height: 50px;
        padding: 0 10px;
        font-size: 12.25px;
    }
    .settings-topnav__link i {
        width: 15px;
        height: 15px;
    }
}

@media (max-width: 575px) {
    .navbar-top {
        padding: 0 10px;
        gap: 8px;
    }
    .spotlight-trigger {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
    }
    .spotlight-trigger__kbd,
    .navbar-top__icon-btn--visit,
    .navbar-top__icon-btn--settings,
    .navbar-top__lang,
    .navbar-top__divider {
        display: none;
    }
    .navbar-top__toggle,
    .navbar-top__icon-btn {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
    }
    .navbar-top__profile {
        width: 36px;
        height: 36px;
        padding: 3px;
        justify-content: center;
    }
    .navbar-top__profile>i {
        display: none;
    }
    .navbar-top .dropdown-menu {
        max-width: calc(100vw - 20px);
    }
    .app__content {
        padding: 14px 10px;
    }
    .settings-topnav {
        margin: -14px -10px 16px;
        padding: 0 10px;
    }
    .settings-topnav__link {
        min-height: 48px;
        padding: 0 10px;
        font-size: 12.5px;
    }
}

@media (max-width: 360px) {
    .navbar-top__profile-menu {
        display: none;
    }
}

body.is-sidebar-open {
    overflow: hidden;
}


/* =========================================================
   16. SETTINGS PAGE — sub-nav + content layout
   ========================================================= */

.settings-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    align-items: start;
}


/* Left vertical sub-nav */

.settings-nav {
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    position: sticky;
    top: calc(var(--nav-h) + 16px);
    box-shadow: var(--shadow-xs);
}

.settings-nav__item:first-child {
    border-top-left-radius: var(--r-lg);
    border-top-right-radius: var(--r-lg);
}

.settings-nav__item:last-child {
    border-bottom-left-radius: var(--r-lg);
    border-bottom-right-radius: var(--r-lg);
}

.settings-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: hsl(var(--text-muted));
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--t), color var(--t);
}

.settings-nav__item:hover {
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
}

.settings-nav__item--active {
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
    font-weight: 600;
}

.settings-nav__item--active .settings-nav__icon {
    color: hsl(var(--primary));
}

.settings-nav__icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: hsl(var(--text-muted));
}


/* Field with help icon (matches the screenshot's "?" pattern) */

.field-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: hsl(var(--text));
    margin-bottom: 6px;
}

.field-label__help {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid hsl(var(--border-strong));
    color: hsl(var(--text-muted));
    display: inline-grid;
    place-items: center;
    font-size: 9px;
    font-weight: 600;
    cursor: help;
    background: hsl(var(--surface));
    position: relative;
}

.field-label__help::after,
.field-label__help::before {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 9px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
}

.field-label__help::after {
    content: attr(data-qs);
    z-index: 1085;
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
    padding: 8px 10px;
    border-radius: var(--r-sm);
    background: hsl(var(--night));
    color: hsl(var(--white));
    box-shadow: none;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    word-break: break-word;
    transform: translate(-50%, 4px);
}

.field-label__help::before {
    content: "";
    z-index: 1086;
    bottom: calc(100% + 3px);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: hsl(var(--night)) transparent transparent;
    transform: translate(-50%, 4px);
}

.field-label__help:hover::after,
.field-label__help:hover::before,
.field-label__help:focus-visible::after,
.field-label__help:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.captcha-widget__img {
    height: 45px;
    max-width: 100%;
    border-radius: var(--r-sm);
}

.captcha-widget__refresh-icon {
    width: 16px;
    height: 16px;
}

.field-label__required {
    color: hsl(var(--danger));
    margin-left: 2px;
}


/* Tag-input field — chips with × and a free-text input on the same row */

.tag-input {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    min-height: 40px;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-sm);
    cursor: text;
    transition: border-color var(--t), box-shadow var(--t);
}

.tag-input:focus-within {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 1px hsl(var(--primary));
}

.tag-input__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 10px;
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
    border: 1px solid hsl(var(--primary) / 0.25);
    border-radius: var(--r-sm);
    font-size: 12.5px;
    font-weight: 500;
}

.tag-input__chip-x {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 0;
    background: transparent;
    color: hsl(var(--primary));
    display: grid;
    place-items: center;
    cursor: pointer;
}

.tag-input__chip-x:hover {
    background: hsl(var(--primary) / 0.15);
}

.tag-input__field {
    flex: 1;
    min-width: 120px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 13.5px;
    color: hsl(var(--text));
    font-family: inherit;
    padding: 4px 4px;
}

.tag-input__field::placeholder {
    color: hsl(var(--text-soft));
}


/* =========================================================
   Integration row — logo + title/desc + badges + action
   ========================================================= */

.integration-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}

.integration-row:hover {
    border-color: hsl(var(--border-strong));
    box-shadow: var(--shadow-sm);
}

.integration-row__logo {
    width: 48px;
    height: 48px;
    border-radius: var(--r);
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    overflow: hidden;
}

.integration-row__logo svg,
.integration-row__logo img {
    max-width: 70%;
    max-height: 70%;
}

.integration-row__main {
    flex: 1;
    min-width: 0;
}

.integration-row__title {
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--text));
    margin: 0 0 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.integration-row__desc {
    font-size: 12.5px;
    color: hsl(var(--text-muted));
    margin: 0 0 8px;
}

.integration-row__badges {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

.integration-row__actions {
    display: flex;
    gap: 6px;
    align-items: center;
}


/* Pulsing status dot (running / live) */

.pulse-dot {
    position: relative;
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: hsl(var(--success));
}

.pulse-dot::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid hsl(var(--success) / 0.4);
    animation: pulse 1.6s ease-out infinite;
}

.pulse-dot--warning {
    background: hsl(var(--warning));
}

.pulse-dot--warning::before {
    border-color: hsl(var(--warning) / 0.4);
}

.pulse-dot--danger {
    background: hsl(var(--danger));
}

.pulse-dot--danger::before {
    border-color: hsl(var(--danger) / 0.4);
}

.pulse-dot--idle {
    background: hsl(var(--text-soft));
}

.pulse-dot--idle::before {
    display: none;
}

@keyframes pulse {
    0% {
        transform: scale(0.6);
        opacity: 1;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}


/* =========================================================
   Toggle row — icon + title/desc + switch
   ========================================================= */

.toggle-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 4px;
}

.toggle-row+.toggle-row {
    border-top: 1px solid hsl(var(--border));
}

.toggle-row__icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r);
    display: grid;
    place-items: center;
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
    flex: 0 0 44px;
    border: 1px solid hsl(var(--primary) / 0.20);
}

.toggle-row__icon--success {
    background: hsl(var(--success) / 0.10);
    color: hsl(var(--success));
    border-color: hsl(var(--success) / 0.22);
}

.toggle-row__icon--info {
    background: hsl(var(--info) / 0.10);
    color: hsl(var(--info));
    border-color: hsl(var(--info) / 0.22);
}

.toggle-row__icon--warning {
    background: hsl(var(--warning) / 0.15);
    color: hsl(var(--warning-deep));
    border-color: hsl(var(--warning) / 0.30);
}

.toggle-row__icon--danger {
    background: hsl(var(--danger) / 0.10);
    color: hsl(var(--danger));
    border-color: hsl(var(--danger) / 0.22);
}

.toggle-row__icon--neutral {
    background: hsl(var(--surface-2));
    color: hsl(var(--text-muted));
    border-color: hsl(var(--border));
}

.toggle-row__main {
    flex: 1;
    min-width: 0;
}

.toggle-row__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--text));
    margin: 0 0 2px;
}

.toggle-row__desc {
    font-size: 12.5px;
    color: hsl(var(--text-muted));
    margin: 0;
    line-height: 1.45;
}

.toggle-row__desc strong {
    color: hsl(var(--text));
    font-weight: 600;
}


/* Larger switch variant for the row */

.switch--lg {
    width: 46px;
    height: 26px;
}

.switch--lg .switch__slider::before {
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
}

.switch--lg input:checked+.switch__slider::before {
    transform: translateX(20px);
}


/* =========================================================
   17. FILE UPLOADER — premium dropzone + preview
   ========================================================= */

.uploader {
    display: block;
}

.uploader__label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: hsl(var(--text));
    margin-bottom: 8px;
}


/* Dropzone — empty state */

.uploader__dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    min-height: 180px;
    padding: 24px 20px;
    border-radius: var(--r-lg);
    border: 1.5px dashed hsl(var(--border-strong));
    background: repeating-linear-gradient(45deg, hsl(var(--surface-2)) 0 12px, hsl(var(--surface)) 12px 24px);
    color: hsl(var(--text-muted));
    cursor: pointer;
    transition: border-color var(--t), background var(--t), transform var(--t), box-shadow var(--t);
}

.uploader__dropzone:hover {
    border-color: hsl(var(--primary));
    background: hsl(var(--primary) / 0.04);
    color: hsl(var(--text));
}

.uploader__dropzone--drag {
    border-color: hsl(var(--primary));
    background: hsl(var(--primary) / 0.07);
    box-shadow: 0 0 0 4px hsl(var(--primary) / 0.12);
    transform: scale(1.005);
}

.uploader__dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.uploader__icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
    margin-bottom: 4px;
}

.uploader__title {
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--text));
}

.uploader__title strong {
    color: hsl(var(--primary));
}

.uploader__hint {
    font-size: 12px;
    color: hsl(var(--text-muted));
}


/* Filled state — preview card with image + remove */

.uploader__preview {
    position: relative;
    border-radius: var(--r-lg);
    border: 1.5px dashed hsl(var(--primary) / 0.5);
    background: hsl(var(--primary) / 0.04);
    padding: 14px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.uploader__preview--dark {
    background: hsl(var(--neutral-900));
    border-color: hsl(var(--neutral-800));
}

.uploader__preview-img {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
    display: block;
}

.uploader__remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: hsl(var(--danger));
    color: hsl(var(--white));
    border: 0;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform var(--t-fast), background var(--t);
}

.uploader__remove:hover {
    background: hsl(var(--danger-deep));
    transform: scale(1.06);
}


/* Browse pill (inside preview, like screenshot) */

.uploader__browse {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: hsl(var(--white));
    background: hsl(var(--primary));
    border: 0;
    border-radius: var(--r-sm);
    cursor: pointer;
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: none;
    transition: background var(--t);
}

.uploader__browse:hover {
    background: hsl(var(--primary-hover));
}


/* Progress (during upload) */

.uploader__progress {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    height: 4px;
    background: hsl(var(--surface-3));
    border-radius: 999px;
    overflow: hidden;
}

.uploader__progress>span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--primary) / 0.75));
    border-radius: inherit;
    transition: width var(--t);
}


/* File info row (for non-image uploads) */

.uploader__file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r);
    margin-top: 8px;
}

.uploader__file-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
    display: grid;
    place-items: center;
    flex: 0 0 38px;
}

.uploader__file-meta {
    flex: 1;
    min-width: 0;
}

.uploader__file-name {
    font-size: 13px;
    font-weight: 500;
}

.uploader__file-size {
    font-size: 11.5px;
    color: hsl(var(--text-muted));
}


/* =========================================================
   PERMISSION MATRIX — module × action checkbox grid
   ========================================================= */

.perm-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.perm-matrix thead th {
    background: hsl(var(--surface-2));
    font-weight: 600;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    color: hsl(var(--text-muted));
    padding: 12px 14px;
    border-bottom: 1px solid hsl(var(--border));
    text-align: center;
}

.perm-matrix thead th:first-child {
    text-align: left;
}

.perm-matrix tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid hsl(var(--border));
    text-align: center;
    vertical-align: middle;
}

.perm-matrix tbody td:first-child {
    text-align: left;
    font-weight: 500;
    color: hsl(var(--text));
    display: flex;
    align-items: center;
    gap: 10px;
}

.perm-matrix tbody tr:last-child td {
    border-bottom: 0;
}

.perm-matrix tbody td.is-na {
    color: hsl(var(--text-soft));
    font-size: 16px;
    line-height: 1;
}

.perm-matrix__module-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
    display: grid;
    place-items: center;
    flex: 0 0 28px;
}

.perm-matrix input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: hsl(var(--primary));
    cursor: pointer;
}


/* =========================================================
   18. PAYMENT GATEWAY CARD
   ========================================================= */

.gateway-card {
    position: relative;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}

.gateway-card:hover {
    box-shadow: var(--shadow);
    border-color: hsl(var(--border-strong));
}

.gateway-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}


/* Status pill (top-left) — Active / Inactive */

.gateway-card__status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    color: hsl(var(--white));
    background: hsl(var(--success));
    letter-spacing: 0.02em;
}

.gateway-card__status--inactive {
    background: hsl(var(--danger));
}


/* Mode pill (top-right) — Live / Test */

.gateway-card__mode {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    background: hsl(var(--success) / 0.12);
    color: hsl(var(--success));
    border: 1px solid hsl(var(--success) / 0.25);
}

.gateway-card__mode--test {
    background: hsl(var(--warning) / 0.15);
    color: hsl(var(--warning-deep));
    border-color: hsl(var(--warning) / 0.30);
}


/* Logo block */

.gateway-card__body {
    text-align: center;
    padding: 8px 4px 4px;
}

.gateway-card__logo {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.gateway-card__logo img,
.gateway-card__logo svg {
    max-height: 36px;
    max-width: 80%;
    object-fit: contain;
}

.gateway-card__logo--placeholder {
    font-weight: 600;
    font-size: 16px;
    color: hsl(var(--primary));
    letter-spacing: -0.01em;
}

.gateway-card__name {
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--text));
}


/* Action buttons row */

.gateway-card__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 6px;
    align-items: stretch;
}


/* =========================================================
   FILTER BAR — horizontal toolbar with selects + actions
   ========================================================= */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
}

.filter-bar--card {
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r);
    box-shadow: var(--shadow-xs);
}

.filter-bar__group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

.filter-bar .select,
.filter-bar .input,
.filter-bar .form-select,
.filter-bar .form-control {
    width: auto;
    display: inline-flex;
    height: 36px;
    padding: 6px 32px 6px 12px;
    font-size: 13.5px;
    flex: 0 0 auto;
}

.filter-bar .input,
.filter-bar .form-control {
    padding-right: 12px;
}


/* Spacer pushes following items to the end on the cross axis */

.u-spacer {
    flex: 1 1 auto;
    min-width: 0;
}


/* Stack on small screens */

@media (max-width: 640px) {
    .filter-bar {
        gap: 8px;
    }
    .filter-bar__group {
        width: 100%;
    }
    .filter-bar__group>* {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }
    .filter-bar>.btn {
        width: 100%;
    }
}


/* Blog post thumbnail (table cell) */

.post-thumb {
    width: 56px;
    height: 36px;
    border-radius: var(--r-sm);
    border: 1px solid hsl(var(--border));
    background-size: cover;
    background-position: center;
    flex: 0 0 auto;
}


/* Equal-height cards in the grid */

#gwGrid>[class*="col-"] {
    display: flex;
}

#gwGrid .gateway-card {
    flex: 1;
    min-height: 200px;
}


/* 5-up at xxl (Bootstrap doesn't have a native col-2-4) */

@media (min-width: 1400px) {
    #gwGrid .col-xxl-2-4 {
        flex: 0 0 auto;
        width: 20%;
    }
}


/* =========================================================
   19. APP FOOTER — copyright + meta
   ========================================================= */

.app-footer {
    margin-top: auto;
    padding: 14px 24px;
    background: hsl(var(--surface));
    border-top: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12.5px;
    color: hsl(var(--text-muted));
}

.app-footer__brand strong {
    color: hsl(var(--text));
    font-weight: 600;
}

.app-footer__version {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    margin-left: 6px;
    border-radius: 4px;
    background: hsl(var(--primary) / 0.10);
    color: hsl(var(--primary));
    font-weight: 600;
    font-size: 11.5px;
}

.app-footer__meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-footer__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: hsl(var(--success));
    box-shadow: 0 0 0 3px hsl(var(--success) / 0.18);
}

@media (max-width: 768px) {
    .app-footer {
        padding: 12px 16px;
    }
}

.status-card {
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    padding: 36px 28px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    max-width: 520px;
    margin: 0 auto;
}

.status-card__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    background: hsl(var(--success) / 0.12);
    color: hsl(var(--success));
    position: relative;
}

.status-card__icon::after {
    /* subtle pulse ring */
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid hsl(var(--success) / 0.25);
}

.status-card__icon--warning {
    background: hsl(var(--warning) / 0.15);
    color: hsl(var(--warning-deep));
}

.status-card__icon--warning::after {
    border-color: hsl(var(--warning) / 0.3);
}

.status-card__icon--danger {
    background: hsl(var(--danger) / 0.12);
    color: hsl(var(--danger));
}

.status-card__icon--danger::after {
    border-color: hsl(var(--danger) / 0.3);
}

.status-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 6px;
}

.status-card__msg {
    font-size: 13.5px;
    color: hsl(var(--text-muted));
    margin: 0 0 4px;
}

.status-card__msg strong {
    color: hsl(var(--text));
    font-weight: 600;
}

.status-card__meta {
    font-size: 12px;
    color: hsl(var(--text-soft));
    margin-top: 10px;
}

.status-card__actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 18px;
    flex-wrap: wrap;
}


/* =========================================================
   22. AUTH LAYOUT — login / forgot / reset
   ========================================================= */

.auth {
    min-height: 100vh;
    background: hsl(var(--bg));
    color: hsl(var(--text));
}

.auth-shell {
    display: grid;
    grid-template-columns: 1.02fr 1fr;
    min-height: 100vh;
}

.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 44px 48px;
    overflow: hidden;
    color: #fff;
    background-image: linear-gradient( rgba(0, 0, 0, 0.767), rgba(0, 0, 0, 0.733)), var(--auth-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.auth-brand>* {
    position: relative;
    z-index: 1;
}

.auth-brand__logo {
    max-height: 40px;
    max-width: 210px;
    object-fit: contain;
}

.auth-brand__body {
    margin-top: auto;
    max-width: 30rem;
}


/* Explicit colours — the panel is dark in both modes, so it must not inherit
   the theme's heading/muted tones (which flip with the mode). */

.auth-brand__headline {
    font-size: clamp(1.75rem, 2.4vw, 2.35rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: hsl(var(--white));
}

.auth-brand__text {
    margin-top: 12px;
    font-size: 14.5px;
    line-height: 1.65;
    color: hsl(var(--white) / 0.74);
}

.auth-brand__note {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 26px;
    padding: 9px 14px;
    border-radius: 4px;
    border: 1px solid hsl(var(--white) / 0.14);
    background: hsl(var(--white) / 0.06);
    font-size: 12.5px;
    font-weight: 500;
    color: hsl(var(--white) / 0.85);
}

.auth-brand__note svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: hsl(var(--primary-fg-soft, 237 80% 78%));
    color: hsl(237 80% 78%);
}

.auth-brand__foot {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid hsl(var(--white) / 0.1);
    font-size: 12.5px;
    color: hsl(var(--white) / 0.6);
}


/* ── Right: form pane ── */

.auth-pane {
    display: grid;
    place-items: center;
    padding: 48px 32px;
    background: hsl(var(--surface));
}

.auth-pane__inner {
    width: 100%;
    max-width: 396px;
    animation: auth-rise 480ms cubic-bezier(.2, .6, .2, 1);
}

.auth-head {
    margin-bottom: 26px;
}

.auth-head__title {
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: hsl(var(--text));
}

.auth-head__sub {
    margin-top: 6px;
    font-size: 14px;
    color: hsl(var(--text-muted));
}

.auth-form__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
        /* auto rows would share the leftover 100vh and inflate the header */
        grid-template-rows: auto 1fr;
    }
    .auth-brand {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
        padding: 18px 24px;
    }
    .auth-brand::after,
    .auth-brand__body,
    .auth-brand__foot {
        display: none;
    }
    .auth-brand__logo {
        max-height: 32px;
    }
    .auth-pane {
        padding: 36px 20px 48px;
        align-items: start;
    }
}


/* Slow-drifting aurora blob for depth, inside the dark brand panel */

.auth-brand::before {
    content: "";
    position: absolute;
    width: 560px;
    height: 560px;
    left: -180px;
    top: -200px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.4;
    background: radial-gradient(circle, hsl(var(--primary) / 0.55), transparent 65%);
    animation: auth-drift 18s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes auth-drift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        transform: translate3d(70px, 50px, 0) scale(1.12);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand::before,
    .auth-pane__inner {
        animation: none;
    }
}


/* .auth-card / .auth-card__brand* were the old centred-card shell — the split
   layout replaced them. Only .auth-card__foot and __divider are still used. */


/* Slightly more substantial form controls on auth pages */

.auth .input {
    height: 44px;
}

.auth .btn--primary {
    min-height: 44px;
    font-size: 14px;
    box-shadow: none;
}

.auth .btn--primary:hover {
    box-shadow: none;
}

@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card__divider {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    color: hsl(var(--text-soft));
    margin: 18px 0;
}

.auth-card__divider::before,
.auth-card__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: hsl(var(--border));
}

.auth-card__foot {
    text-align: center;
    font-size: 13px;
    color: hsl(var(--text-muted));
    margin-top: 18px;
}

.auth-card__foot a {
    font-weight: 600;
}


/* Faux reCAPTCHA box (matches the screenshot) */

.recaptcha {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-sm);
    margin: 4px 0 16px;
}

.recaptcha__check {
    width: 26px;
    height: 26px;
    background: hsl(var(--white));
    border: 2px solid hsl(var(--neutral-400));
    border-radius: 3px;
    cursor: pointer;
    flex: 0 0 26px;
    display: grid;
    place-items: center;
    color: hsl(var(--success));
    font-size: 18px;
    transition: border-color var(--t);
}

.recaptcha__check.is-checked {
    border-color: hsl(var(--success));
    background: hsl(var(--success) / 0.06);
}

.recaptcha__label {
    font-size: 13px;
    color: hsl(var(--text));
    flex: 1;
}

.recaptcha__brand {
    text-align: right;
    line-height: 1.1;
}

.recaptcha__brand-mark {
    font-size: 9px;
    color: hsl(var(--text-soft));
    letter-spacing: 0;
}

.recaptcha__brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--google-blue)), hsl(var(--google-green)) 50%, hsl(var(--google-yellow)), hsl(var(--google-red)));
    display: inline-block;
}


/* Auth footer (page-level) */


/* =========================================================
   24. UTILITIES — common inline style replacements
   ========================================================= */


/* Flexbox */

.u-flex {
    display: flex;
}

.u-flex-col {
    flex-direction: column;
}

.u-flex-wrap {
    flex-wrap: wrap;
}

.u-items-center {
    align-items: center;
}

.u-items-start {
    align-items: flex-start;
}

.u-items-end {
    align-items: flex-end;
}

.u-justify-between {
    justify-content: space-between;
}

.u-justify-center {
    justify-content: center;
}

.u-justify-start {
    justify-content: flex-start;
}

.u-justify-end {
    justify-content: flex-end;
}


/* Grid */

.u-grid {
    display: grid;
}

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

.u-grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.u-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}


/* Gap */

.u-gap-2 {
    gap: 8px;
}

.u-gap-3 {
    gap: 12px;
}

.u-gap-4 {
    gap: 16px;
}

.u-gap-6 {
    gap: 24px;
}

.u-gap-y-2 {
    row-gap: 8px;
}

.u-gap-y-3 {
    row-gap: 12px;
}


/* Width */

.u-w-full {
    width: 100%;
}

.u-w-auto {
    width: auto;
}


/* Height */

.u-h-full {
    height: 100%;
}


/* Text */

.u-text-sm {
    font-size: 13px;
}

.u-text-xs {
    font-size: 12px;
}

.u-text-xs-5 {
    font-size: 12.5px;
}

.u-text-xxs {
    font-size: 11px;
}

.u-text-xxs-5 {
    font-size: 11.5px;
}

.u-text-base {
    font-size: 14px;
}

.u-text-lg {
    font-size: 16px;
}

.u-font-medium {
    font-weight: 500;
}

.u-font-semibold {
    font-weight: 600;
}

.u-font-bold {
    font-weight: 600;
}

.u-text-center {
    text-align: center;
}

.u-text-right {
    text-align: right;
}

.u-text-left {
    text-align: left;
}

.u-text-muted {
    color: hsl(var(--text-muted));
}

.u-text-primary {
    color: hsl(var(--primary));
}


/* Spacing - Margin */

.u-m-0 {
    margin: 0;
}

.u-mt-2 {
    margin-top: 8px;
}

.u-mt-3 {
    margin-top: 12px;
}

.u-mt-4 {
    margin-top: 16px;
}

.u-mt-5 {
    margin-top: 20px;
}

.u-mb-2 {
    margin-bottom: 8px;
}

.u-mb-3 {
    margin-bottom: 12px;
}

.u-mb-4 {
    margin-bottom: 16px;
}

.u-mx-auto {
    margin-left: auto;
    margin-right: auto;
}


/* Spacing - Padding */

.u-p-0 {
    padding: 0;
}

.u-p-2 {
    padding: 8px;
}

.u-p-3 {
    padding: 12px;
}

.u-p-4 {
    padding: 16px;
}

.u-pb-0 {
    padding-bottom: 0;
}

.u-pb-1 {
    padding-bottom: 4px;
}

.u-pb-2 {
    padding-bottom: 8px;
}

.u-pt-0 {
    padding-top: 0;
}

.u-pr-3 {
    padding-right: 12px;
}

.u-pr-9 {
    padding-right: 36px;
}


/* Border */

.u-border-0 {
    border: 0;
}

.u-border-t {
    border-top: 1px solid hsl(var(--border));
}

.u-border-b {
    border-bottom: 1px solid hsl(var(--border));
}


/* Position */

.u-relative {
    position: relative;
}

.u-absolute {
    position: absolute;
}


/* Display */

.u-hidden {
    display: none;
}

.u-inline-flex {
    display: inline-flex;
}


/* Icon sizes */

.u-icon-sm {
    width: 12px;
    height: 12px;
}

.u-icon {
    width: 14px;
    height: 14px;
}

.u-icon-md {
    width: 16px;
    height: 16px;
}

.u-icon-lg {
    width: 18px;
    height: 18px;
}

.u-icon-xl {
    width: 20px;
    height: 20px;
}


/* Cursor */

.u-pointer {
    cursor: pointer;
}

.u-not-allowed {
    cursor: not-allowed;
}


/* Opacity */

.u-opacity-50 {
    opacity: 0.5;
}


/* Border radius */

.u-rounded {
    border-radius: var(--r);
}

.u-rounded-sm {
    border-radius: var(--r-sm);
}

.u-rounded-full {
    border-radius: 9999px;
}


/* Alignment */

.u-align-middle {
    vertical-align: -2px;
}


/* Icon stroke */

.u-stroke-2-5 {
    stroke-width: 2.5;
}

.u-stroke-3 {
    stroke-width: 3;
}


/* Animation */

.u-spin {
    animation: spin-slow 0.8s linear infinite;
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}


/* Font family */

.u-font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}


/* Line height */

.u-lh-1 {
    line-height: 1;
}


/* =========================================================
   23. RTL OVERRIDES — applied when <html dir="rtl">
   ---------------------------------------------------------
   Most layout (CSS Grid + flex + gap) flips automatically
   in RTL. Below we fix the cases that use absolute or
   directional properties.
   ========================================================= */

[dir="rtl"] body {
    text-align: right;
}


/* Sidebar — borders + active accent */

[dir="rtl"] .sidebar {
    border-right: 0;
    border-left: 1px solid hsl(var(--sb-border));
}

/* Sidebar mobile drawer comes from the right (the submenu rail and badges
   already use logical properties, so they mirror without overrides) */

@media (max-width: 1100px) {
    [dir="rtl"] .sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }
    [dir="rtl"] .sidebar--open {
        transform: translateX(0);
    }
    [dir="rtl"] .sidebar__close {
        right: auto;
        left: 12px;
    }
    [dir="rtl"] .sidebar__brand {
        padding: 0 18px 0 64px;
    }
}


/* Caret arrow direction (chevron-right naturally points wrong way in RTL) */

[dir="rtl"] .menu__caret {
    transform: rotate(180deg);
}

[dir="rtl"] .menu__link[aria-expanded="true"] .menu__caret {
    transform: rotate(90deg);
}


/* Search icon + select chevron flip */

[dir="rtl"] .search__icon {
    left: auto;
    right: 12px;
}

[dir="rtl"] .search__input {
    padding: 9px 36px 9px 12px;
}

[dir="rtl"] .select {
    background-position: left 12px center;
    padding: 9px 12px 9px 36px;
}


/* Spotlight trigger — keep search icon left visually */

[dir="rtl"] .spotlight-trigger__label {
    text-align: right;
}

[dir="rtl"] .spotlight__search-icon {
    transform: scaleX(-1);
}


/* Settings sub-nav active indicator + arrow */

[dir="rtl"] .crumbs__sep,
[dir="rtl"] [data-lucide="chevron-right"] {
    transform: rotate(180deg);
}

[dir="rtl"] .menu__link[aria-expanded="true"] [data-lucide="chevron-right"] {
    transform: rotate(90deg);
}


/* Auth pages: mirror the split shell, keep the footer link centred */

[dir="rtl"] .auth-shell {
    direction: rtl;
}

[dir="rtl"] .auth-card__foot {
    text-align: center;
}


/* Stat-card / progress / table small fixes */

[dir="rtl"] .table thead th {
    text-align: right;
}

[dir="rtl"] .table__actions {
    justify-content: flex-start;
}

[dir="rtl"] .text-end {
    text-align: left !important;
}


/* Sidebar brand suffix margin auto already works via flex; no change needed */


/* Pagination chevrons */

[dir="rtl"] .pagination [data-lucide="chevron-left"] {
    transform: rotate(180deg);
}

[dir="rtl"] .pagination [data-lucide="chevron-right"] {
    transform: rotate(180deg);
}


/* =========================================================
   21. DARK MODE — overrides for neutral tokens
   ---------------------------------------------------------
   Activated by setting [data-mode="dark"] on <html>.
   Brand color (--primary) stays fixed; we only recolor
   surfaces, text, borders, and shadows here.
   ========================================================= */

[data-mode="dark"] {
    /* Surfaces — Ink and Pine */
    --bg: 192 54% 5%;
    --bg-img: radial-gradient(900px 500px at 10% 0%, hsl(173 72% 37% / 0.16), transparent 60%), radial-gradient(700px 400px at 90% 100%, hsl(174 75% 26% / 0.12), transparent 55%);
    --surface: 174 42% 9%;
    --surface-2: 174 36% 12%;
    --surface-3: 174 28% 16%;
    /* Text */
    --text: 168 33% 96%;
    --text-muted: 168 18% 74%;
    --text-soft: 172 12% 60%;
    /* Borders */
    --border: 174 22% 18%;
    --border-strong: 174 18% 28%;
    /* Sidebar */
    --sb-bg: 192 54% 4%;
    --sb-bg-2: 174 40% 8%;
    --sb-text: 168 24% 84%;
    --sb-text-mut: 172 14% 62%;
    --sb-text-strong: 168 33% 96%;
    --sb-hover: 174 32% 12%;
    --sb-active: 172 53% 67%;
    --sb-active-fg: 192 54% 6%;
    --sb-border: 174 24% 14%;
    /* Soft tints — brighter than Jewel Teal so chips stay visible */
    --primary: 173 72% 42%;
    --primary-hover: 172 53% 62%;
    --primary-soft: 174 36% 16%;
    --table-head: 174 32% 14%;
    --table-head-text: 168 40% 86%;
    --table-stripe: 174 30% 11%;
    /* Shadows — deeper for dark surfaces */
    --shadow-xs: none;
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: none;
    color-scheme: dark;
}


/* Auth body background gradient adjustment */

[data-mode="dark"] body.auth {
    background: radial-gradient(1200px 600px at 50% -100px, hsl(var(--primary) / 0.10), transparent 60%), hsl(var(--bg));
}


/* Inputs & forms — subtle inner surface */

[data-mode="dark"] .input,
[data-mode="dark"] .select,
[data-mode="dark"] .textarea,
[data-mode="dark"] .form-control,
[data-mode="dark"] .form-select,
[data-mode="dark"] .search__input {
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .input::placeholder,
[data-mode="dark"] .textarea::placeholder,
[data-mode="dark"] .search__input::placeholder,
[data-mode="dark"] .form-control::placeholder {
    color: hsl(var(--text-soft));
}


/* Read-only sits below the page surface so it still reads as locked on dark */

[data-mode="dark"] .input[readonly],
[data-mode="dark"] .select[readonly],
[data-mode="dark"] .textarea[readonly],
[data-mode="dark"] .input[readonly]:focus,
[data-mode="dark"] .textarea[readonly]:focus {
    background: hsl(var(--bg));
    color: hsl(var(--text-muted));
}

[data-mode="dark"] .ck.ck-editor,
[data-mode="dark"] .ck.ck-editor__main>.ck-editor__editable,
[data-mode="dark"] .ck.ck-toolbar,
[data-mode="dark"] .ck.ck-dropdown__panel,
[data-mode="dark"] .ck.ck-balloon-panel,
[data-mode="dark"] .ck.ck-list,
[data-mode="dark"] .ck.ck-input,
[data-mode="dark"] .ck.ck-labeled-field-view>.ck.ck-labeled-field-view__input-wrapper>.ck.ck-input {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border));
    color: hsl(var(--text));
}

[data-mode="dark"] .ck.ck-editor__main>.ck-editor__editable {
    background: hsl(var(--surface));
}

[data-mode="dark"] .ck.ck-editor__editable.ck-placeholder::before {
    color: hsl(var(--text-soft));
}

[data-mode="dark"] .ck.ck-button,
[data-mode="dark"] .ck.ck-button.ck-off,
[data-mode="dark"] .ck.ck-dropdown .ck-dropdown__button,
[data-mode="dark"] .ck.ck-splitbutton .ck-splitbutton__action,
[data-mode="dark"] .ck.ck-splitbutton .ck-splitbutton__arrow,
[data-mode="dark"] .ck.ck-list__item .ck-button {
    color: hsl(var(--text));
    background: transparent;
}

[data-mode="dark"] .ck.ck-button .ck-icon,
[data-mode="dark"] .ck.ck-button .ck-icon *,
[data-mode="dark"] .ck.ck-dropdown .ck-button .ck-icon,
[data-mode="dark"] .ck.ck-dropdown .ck-button .ck-icon * {
    color: hsl(var(--text));
}

[data-mode="dark"] .ck.ck-button:hover,
[data-mode="dark"] .ck.ck-button.ck-on,
[data-mode="dark"] .ck.ck-button.ck-off:hover,
[data-mode="dark"] .ck.ck-dropdown .ck-dropdown__button:hover,
[data-mode="dark"] .ck.ck-list__item .ck-button:hover,
[data-mode="dark"] .ck.ck-list__item .ck-button.ck-on {
    background: hsl(var(--primary) / 0.16);
    color: hsl(var(--text));
}

[data-mode="dark"] .ck.ck-toolbar .ck.ck-toolbar__separator {
    background: hsl(var(--border));
}

[data-mode="dark"] .ck.ck-dropdown__panel,
[data-mode="dark"] .ck.ck-balloon-panel {
    box-shadow: var(--shadow-lg);
}


/* Select chevron (white-ish) */

[data-mode="dark"] .select,
[data-mode="dark"] .form-select,
[data-mode="dark"] select.input {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
    padding-right: 36px;
}

[data-mode="dark"] .select2-container--default .select2-selection--single,
[data-mode="dark"] .select2-container--default .select2-selection--multiple,
[data-mode="dark"] .select2-dropdown,
[data-mode="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background: hsl(var(--surface-2)) !important;
    border-color: hsl(var(--border)) !important;
    color: hsl(var(--text));
}

[data-mode="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: hsl(var(--surface-3));
    border-color: hsl(var(--border));
    color: hsl(var(--text));
}

[data-mode="dark"] .select2-container--default .select2-selection--multiple .select2-search__field {
    color: hsl(var(--text));
}

[data-mode="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: hsl(var(--text-muted));
}

[data-mode="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder,
[data-mode="dark"] .select2-container--default .select2-selection--single .select2-selection__clear {
    color: hsl(var(--text-muted));
}

[data-mode="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
[data-mode="dark"] .select2-results__option {
    color: hsl(var(--text));
}

[data-mode="dark"] .select2-container--default .select2-results__option--selected {
    background: hsl(var(--surface-3));
}


/* Prevent any inherited/pattern backgrounds showing through */

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple,
.select2-dropdown,
.select2-results__options,
.select2-container--default .select2-search--dropdown .select2-search__field,
.select2-container--default .select2-selection--multiple .select2-selection__rendered,
.select2-container--default .select2-selection--multiple .select2-search__field {
    background-image: none !important;
}

[data-mode="dark"] .select2-results__options::-webkit-scrollbar-track {
    background: hsl(var(--surface-2));
}

[data-mode="dark"] .select2-results__options::-webkit-scrollbar-thumb {
    background: hsl(var(--border-strong));
    border-color: hsl(var(--surface-2));
}


/* Code blocks */

[data-mode="dark"] code,
[data-mode="dark"] pre {
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}


/* Tables — keep the header tint in dark mode */

[data-mode="dark"] .table thead th {
    background: hsl(var(--table-head));
    color: hsl(var(--table-head-text));
    border-bottom-color: hsl(var(--primary) / 0.28);
}

[data-mode="dark"] .table__avatar {
    background: hsl(var(--primary) / 0.18);
    color: hsl(237 80% 78%);
    box-shadow: inset 0 0 0 1px hsl(var(--primary) / 0.3);
}


/* Surface (not surface-2) so the shared dark .btn--outline:hover still reads */

[data-mode="dark"] .table__actions .btn--outline {
    --btn-bg: hsl(var(--surface));
    --btn-fg: hsl(var(--text));
    --btn-bd: hsl(var(--border-strong));
}

[data-mode="dark"] .skeleton-line {
    background: linear-gradient( 90deg, hsl(var(--surface-2)) 25%, hsl(var(--surface-3)) 45%, hsl(var(--surface-2)) 65%);
    background-size: 200% 100%;
}


/* Cards & dropdowns shadow tweak handled by --shadow tokens */


/* Outline button hover — preserve readable text on dark */

[data-mode="dark"] .btn--outline:hover {
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
}


/* Spotlight overlay deeper backdrop */

[data-mode="dark"] .spotlight {
    background: hsl(var(--black) / 0.60);
}

[data-mode="dark"] .spotlight__panel {
    background: hsl(var(--surface));
}


/* Modal */

[data-mode="dark"] .modal-content {
    background: hsl(var(--surface));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .modal-header,
[data-mode="dark"] .modal-footer {
    border-color: hsl(var(--border));
}


/* Bootstrap dropdown background */

[data-mode="dark"] .dropdown-menu {
    background: hsl(var(--surface));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .dropdown-item {
    color: hsl(var(--text));
}

[data-mode="dark"] .dropdown-item:hover,
[data-mode="dark"] .dropdown-item:focus {
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
}

[data-mode="dark"] .dropdown-divider {
    border-top-color: hsl(var(--border));
}


/* Badges — neutral badge needs lighter bg */

[data-mode="dark"] .badge--primary {
    color: hsl(237 80% 78%);
}

[data-mode="dark"] .badge--success {
    color: hsl(152 60% 62%);
}

[data-mode="dark"] .badge--danger {
    color: hsl(0 85% 74%);
}

[data-mode="dark"] .badge--warning {
    color: hsl(38 92% 64%);
}

[data-mode="dark"] .badge--info {
    color: hsl(199 85% 68%);
}


/* Pagination */

[data-mode="dark"] .pagination-bar {
    background: hsl(var(--surface));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .pagination__link {
    background: hsl(var(--surface));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .pagination__link:hover {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
    color: hsl(var(--text));
}

[data-mode="dark"] .pagination__link--arrow {
    color: hsl(var(--text-muted));
}

[data-mode="dark"] .pagination__item--active .pagination__link {
    color: hsl(var(--white));
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

[data-mode="dark"] .pagination__item--disabled .pagination__link {
    color: hsl(var(--text-soft));
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .pagination__item--ellipsis .pagination__link {
    color: hsl(var(--text-soft));
    background: transparent;
    border-color: transparent;
}


/* Scrollbar (Chromium) */

[data-mode="dark"] ::-webkit-scrollbar {
    background: hsl(var(--surface));
}

[data-mode="dark"] ::-webkit-scrollbar-thumb {
    background: hsl(var(--surface-3));
    border-radius: 999px;
}

[data-mode="dark"] ::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--border-strong));
}


/* Smooth transitions when toggling */

html {
    transition: background-color 200ms ease, color 200ms ease;
}


/* =========================================================
   21b. DARK MODE — extended polish for remaining components
   ========================================================= */


/* Body / page background also adapts (was set on :root only) */

[data-mode="dark"] body {
    background: hsl(var(--bg));
    color: hsl(var(--text));
}


/* Make muted/soft text more legible on dark surfaces */

[data-mode="dark"] {
    --text-muted: 206 12% 75%;
    --text-soft: 206 10% 60%;
}


/* Headings inherit but explicitly enforce for cases that re-color */

[data-mode="dark"] h1,
[data-mode="dark"] h2,
[data-mode="dark"] h3,
[data-mode="dark"] h4,
[data-mode="dark"] h5,
[data-mode="dark"] h6,
[data-mode="dark"] .page-header__title,
[data-mode="dark"] .card__title,
[data-mode="dark"] .empty__title,
[data-mode="dark"] .auth-head__title {
    color: hsl(var(--text));
}


/* Card borders get softer surface tone */

[data-mode="dark"] .card,
[data-mode="dark"] .stat-card,
[data-mode="dark"] .widget-kpi-split,
[data-mode="dark"] .settings-nav,
[data-mode="dark"] .filter-bar,
[data-mode="dark"] .filter-bar--card,
[data-mode="dark"] .perm-matrix {
    background: hsl(var(--surface));
    border-color: hsl(var(--border));
    color: hsl(var(--text));
}


/* Page header subtitles & breadcrumbs */

[data-mode="dark"] .page-header__subtitle,
[data-mode="dark"] .crumbs,
[data-mode="dark"] .crumbs a,
[data-mode="dark"] .auth-head__sub,
[data-mode="dark"] .auth-card__foot {
    color: hsl(var(--text-muted));
}


/* KBD chip */

[data-mode="dark"] .kbd {
    background: hsl(var(--surface-2));
    color: hsl(var(--text-muted));
    border-color: hsl(var(--border));
    box-shadow: none;
}


/* Spotlight backdrop deeper */

[data-mode="dark"] .spotlight__backdrop {
    background: hsl(var(--black) / 0.60);
}

[data-mode="dark"] .spotlight__panel {
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
}

[data-mode="dark"] .spotlight__esc {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border));
    color: hsl(var(--text-muted));
}

[data-mode="dark"] .spotlight__item-icon {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .spotlight__item:hover,
[data-mode="dark"] .spotlight__item--active {
    background: hsl(var(--primary) / 0.16);
}


/* Sidebar backdrop on mobile */

[data-mode="dark"] .sidebar__backdrop {
    background: hsl(var(--black) / 0.60);
}


/* Empty state icon */

[data-mode="dark"] .empty__icon {
    background: hsl(var(--primary) / 0.18);
}

[data-mode="dark"] .empty__desc {
    color: hsl(var(--text-muted));
}


/* Bootstrap inputs/selects/checks/radios */

[data-mode="dark"] .form-control,
[data-mode="dark"] .form-select,
[data-mode="dark"] .input-group-text {
    background-color: hsl(var(--surface-2));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .form-control:focus,
[data-mode="dark"] .form-select:focus {
    background-color: hsl(var(--surface-2));
    color: hsl(var(--text));
    border-color: hsl(var(--primary) / 0.6);
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.22);
}

[data-mode="dark"] .form-check-input {
    background-color: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
}

[data-mode="dark"] .form-check-input:checked {
    background-color: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

[data-mode="dark"] .form-label,
[data-mode="dark"] .form-text {
    color: hsl(var(--text-muted));
}


/* Modal close button (Bootstrap default uses dark X svg) */

[data-mode="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(2);
}


/* Toggle switch track */

[data-mode="dark"] .toggle__track,
[data-mode="dark"] .switch__track {
    background: hsl(var(--surface-3));
    border-color: hsl(var(--border));
}


/* Recaptcha auth box */

[data-mode="dark"] .recaptcha {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .recaptcha__check {
    background: hsl(var(--surface));
    border-color: hsl(var(--border-strong));
}

[data-mode="dark"] .recaptcha__label {
    color: hsl(var(--text));
}


/* Auth divider line stays from --border, fine */

[data-mode="dark"] .auth-card__divider::before,
[data-mode="dark"] .auth-card__divider::after {
    background: hsl(var(--border));
}


/* Settings nav items */

[data-mode="dark"] .settings-nav__item {
    color: hsl(var(--text-muted));
}

[data-mode="dark"] .settings-nav__item:hover {
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
}

[data-mode="dark"] .settings-nav__item--active {
    background: hsl(var(--primary) / 0.16);
    color: hsl(var(--text));
}


/* Permission matrix module icon */

[data-mode="dark"] .perm-matrix__module-icon {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border));
    color: hsl(var(--text-muted));
}


/* Tabs / nav-tabs */

[data-mode="dark"] .nav-tabs {
    border-bottom-color: hsl(var(--border));
}

[data-mode="dark"] .nav-tabs .nav-link {
    color: hsl(var(--text-muted));
}

[data-mode="dark"] .nav-tabs .nav-link:hover {
    color: hsl(var(--text));
    border-color: transparent;
}

[data-mode="dark"] .nav-tabs .nav-link.active {
    background: transparent;
    color: hsl(var(--text));
    border-color: hsl(var(--border)) hsl(var(--border)) hsl(var(--surface));
}


/* Chart / canvas / SVG containers — many charts inherit transparent bg, fine.
   Force chart card surface so any libraries with default white look right. */

[data-mode="dark"] .chart,
[data-mode="dark"] .chart-card,
[data-mode="dark"] canvas {
    background: transparent;
}


/* Progress bars */

[data-mode="dark"] .progress {
    background: hsl(var(--surface-2));
}


/* Status card / hero callouts that use --surface */

[data-mode="dark"] .status-card {
    background: hsl(var(--surface));
}


/* Filter bar inner controls */

[data-mode="dark"] .filter-bar .input,
[data-mode="dark"] .filter-bar .select {
    background: hsl(var(--surface-2));
}


/* Tooltips (Bootstrap) */

[data-mode="dark"] .tooltip-inner {
    background: hsl(var(--surface-3));
    color: hsl(var(--text));
}

[data-mode="dark"] .tooltip .tooltip-arrow::before {
    border-color: hsl(var(--surface-3)) !important;
}


/* Popovers (Bootstrap) */

[data-mode="dark"] .popover {
    background: hsl(var(--surface));
    border-color: hsl(var(--border));
    color: hsl(var(--text));
}

[data-mode="dark"] .popover-header {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border));
    color: hsl(var(--text));
}

[data-mode="dark"] .popover-body {
    color: hsl(var(--text));
}


/* Bootstrap text utilities that hardcode color */

[data-mode="dark"] .text-muted {
    color: hsl(var(--text-muted)) !important;
}

[data-mode="dark"] .text-body {
    color: hsl(var(--text)) !important;
}

[data-mode="dark"] .text-dark {
    color: hsl(var(--text)) !important;
}

[data-mode="dark"] .bg-light {
    background-color: hsl(var(--surface-2)) !important;
}

[data-mode="dark"] .bg-white {
    background-color: hsl(var(--surface)) !important;
}


/* HR */

[data-mode="dark"] hr {
    border-color: hsl(var(--border));
    opacity: 1;
}


/* Selection */

[data-mode="dark"] ::selection {
    background: hsl(var(--primary) / 0.40);
    color: hsl(var(--text));
}


/* =========================================================
   21c. DARK MODE — Bootstrap variable overrides
   Bootstrap 5 components use --bs-* variables that ignore our
   tokens. Map them so default Bootstrap classes follow theme.
   ========================================================= */

[data-mode="dark"] {
    --bs-body-color: hsl(var(--text));
    --bs-body-bg: hsl(var(--bg));
    --bs-secondary-color: hsl(var(--text-muted));
    --bs-tertiary-color: hsl(var(--text-soft));
    --bs-secondary-bg: hsl(var(--surface-2));
    --bs-tertiary-bg: hsl(var(--surface-3));
    --bs-border-color: hsl(var(--border));
    --bs-border-color-translucent: hsl(var(--border));
    --bs-emphasis-color: hsl(var(--text));
    --bs-link-color: hsl(var(--primary));
    --bs-link-hover-color: hsl(var(--primary-hover));
    /* Buttons */
    --bs-btn-bg: transparent;
    --bs-btn-color: hsl(var(--text));
    --bs-btn-border-color: hsl(var(--border));
    --bs-btn-hover-bg: hsl(var(--surface-2));
    --bs-btn-hover-color: hsl(var(--text));
    --bs-btn-hover-border-color: hsl(var(--border-strong));
    /* Cards */
    --bs-card-bg: hsl(var(--surface));
    --bs-card-color: hsl(var(--text));
    --bs-card-border-color: hsl(var(--border));
    --bs-card-cap-bg: hsl(var(--surface-2));
    /* Modals */
    --bs-modal-bg: hsl(var(--surface));
    --bs-modal-color: hsl(var(--text));
    --bs-modal-border-color: hsl(var(--border));
    --bs-modal-header-border-color: hsl(var(--border));
    --bs-modal-footer-border-color: hsl(var(--border));
    /* Dropdowns */
    --bs-dropdown-bg: hsl(var(--surface));
    --bs-dropdown-color: hsl(var(--text));
    --bs-dropdown-border-color: hsl(var(--border));
    --bs-dropdown-link-color: hsl(var(--text));
    --bs-dropdown-link-hover-bg: hsl(var(--surface-2));
    --bs-dropdown-link-hover-color: hsl(var(--text));
    --bs-dropdown-divider-bg: hsl(var(--border));
    --bs-dropdown-header-color: hsl(var(--text-muted));
    /* List group */
    --bs-list-group-bg: hsl(var(--surface));
    --bs-list-group-color: hsl(var(--text));
    --bs-list-group-border-color: hsl(var(--border));
    --bs-list-group-action-color: hsl(var(--text));
    --bs-list-group-action-hover-bg: hsl(var(--surface-2));
    --bs-list-group-action-hover-color: hsl(var(--text));
    /* Forms */
    --bs-form-control-bg: hsl(var(--surface-2));
    --bs-form-control-color: hsl(var(--text));
    /* Pagination */
    --bs-pagination-bg: hsl(var(--surface));
    --bs-pagination-color: hsl(var(--text));
    --bs-pagination-border-color: hsl(var(--border));
    --bs-pagination-hover-bg: hsl(var(--surface-2));
    --bs-pagination-hover-color: hsl(var(--text));
    --bs-pagination-hover-border-color: hsl(var(--border-strong));
    --bs-pagination-disabled-bg: hsl(var(--surface));
    --bs-pagination-disabled-color: hsl(var(--text-soft));
    /* Tables */
    --bs-table-bg: transparent;
    --bs-table-color: hsl(var(--text));
    --bs-table-border-color: hsl(var(--border));
    --bs-table-striped-bg: hsl(var(--surface-2));
    --bs-table-hover-bg: hsl(var(--surface-3));
    /* Accordion */
    --bs-accordion-bg: hsl(var(--surface));
    --bs-accordion-color: hsl(var(--text));
    --bs-accordion-border-color: hsl(var(--border));
    --bs-accordion-button-bg: hsl(var(--surface));
    --bs-accordion-button-color: hsl(var(--text));
    --bs-accordion-button-active-bg: hsl(var(--surface-2));
    --bs-accordion-button-active-color: hsl(var(--text));
    /* Offcanvas */
    --bs-offcanvas-bg: hsl(var(--surface));
    --bs-offcanvas-color: hsl(var(--text));
    --bs-offcanvas-border-color: hsl(var(--border));
    /* Toasts */
    --bs-toast-bg: hsl(var(--surface) / 0.95);
    --bs-toast-color: hsl(var(--text));
    --bs-toast-border-color: hsl(var(--border));
    --bs-toast-header-bg: hsl(var(--surface-2));
    --bs-toast-header-color: hsl(var(--text));
}


/* Hard overrides for any default-styled .btn/.btn-light/.btn-secondary that
   bypass our --btn-* custom vars when used outside our variant classes */

[data-mode="dark"] .btn:not([class*="btn--"]):not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info) {
    background-color: hsl(var(--surface));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .btn-light,
[data-mode="dark"] .btn-outline-light {
    background-color: hsl(var(--surface-2));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}

[data-mode="dark"] .btn-light:hover,
[data-mode="dark"] .btn-outline-light:hover {
    background-color: hsl(var(--surface-3));
    color: hsl(var(--text));
    border-color: hsl(var(--border-strong));
}


/* Bootstrap progress bar track */

[data-mode="dark"] .progress,
[data-mode="dark"] .progress-stacked {
    background-color: hsl(var(--surface-2));
}


/* Card header / footer that use --bs-card-cap-bg */

[data-mode="dark"] .card-header,
[data-mode="dark"] .card-footer {
    background-color: hsl(var(--surface-2));
    border-color: hsl(var(--border));
    color: hsl(var(--text));
}


/* List group */

[data-mode="dark"] .list-group-item {
    background-color: hsl(var(--surface));
    color: hsl(var(--text));
    border-color: hsl(var(--border));
}


/* Accordion button SVG arrow — invert to white-ish */

[data-mode="dark"] .accordion-button::after {
    filter: invert(1) brightness(2);
}


/* =========================================================
   ADMIN PAGE MODULES
   Page-specific rules live here instead of Blade templates.
   ========================================================= */


/* media/index */

.media-toolbar {
    gap: 12px !important;
}

.media-search {
    position: relative;
    min-width: 320px;
}

.media-search__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.72;
}

.media-search__input {
    width: 100%;
    padding-left: 36px;
    min-height: 36px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
}

.media-search__input:focus {
    outline: none;
    border-color: hsl(var(--primary) / 0.55);
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}

.media-panel {
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    padding: 14px;
    background: hsl(var(--surface-2));
    box-shadow: var(--shadow);
}

.media-grid__header {
    padding: 2px 0;
}

.media-tree__item {
    border: 1px solid transparent;
    border-radius: 4px;
    margin-bottom: 8px;
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
    font-weight: 600;
    color: hsl(var(--text));
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 10px;
    user-select: none;
    cursor: pointer;
}

.media-tree__main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.media-tree__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-tree__menu {
    flex: 0 0 auto;
    opacity: 0;
    transition: opacity 160ms ease;
}

.media-tree__item:hover .media-tree__menu,
.media-tree__item--active .media-tree__menu {
    opacity: 1;
}

.media-tree__button {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface-2));
    color: hsl(var(--text-muted));
    display: grid;
    place-items: center;
    padding: 0;
}

.media-tree__button:hover {
    background: hsl(var(--surface-3));
    color: hsl(var(--text));
}

.media-tree__item:hover {
    transform: translateY(-1px);
    border-color: hsl(var(--border));
    box-shadow: var(--shadow-sm);
}

.media-tree__item--active {
    background: hsl(var(--primary) / 0.10);
    border-color: hsl(var(--primary) / 0.35);
    color: hsl(var(--text));
}

@keyframes mediaPopIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.media-item {
    border-radius: 4px;
    /* keep dropdown menus visible; the thumb clips its own corners */
    overflow: visible;
    border: 1px solid hsl(var(--border));
    box-shadow: var(--shadow);
    animation: mediaPopIn 520ms cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: calc(var(--media-delay-step, 0) * 22ms);
    transition: transform 220ms cubic-bezier(.2, .6, .2, 1), box-shadow 220ms cubic-bezier(.2, .6, .2, 1);
}

.media-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.media-item__thumb {
    position: relative;
    background: hsl(var(--surface-3));
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px 4px 0 0;
}

.media-item__image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}


/* Type-aware file tiles */

.media-item__file {
    width: 100%;
    height: 150px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: hsl(var(--kind-color, var(--text-muted)) / 0.08);
    color: hsl(var(--kind-color, var(--text-muted)));
}

.media-item__file-icon {
    width: 52px;
    height: 52px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    background: hsl(var(--surface) / 0.9);
    border: 1px solid hsl(var(--kind-color, var(--border)) / 0.35);
    box-shadow: var(--shadow-xs);
}

.media-item__file-extension {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    padding: 2px 10px;
    border-radius: 4px;
    background: hsl(var(--kind-color, var(--text-muted)) / 0.16);
    border: 1px solid hsl(var(--kind-color, var(--border)) / 0.3);
}

.media-file--image {
    --kind-color: 158 64% 40%;
}

.media-file--video {
    --kind-color: 262 70% 58%;
}

.media-file--audio {
    --kind-color: 199 84% 44%;
}

.media-file--pdf {
    --kind-color: 4 74% 52%;
}

.media-file--word {
    --kind-color: 217 82% 52%;
}

.media-file--sheet {
    --kind-color: 152 60% 38%;
}

.media-file--slides {
    --kind-color: 24 88% 52%;
}

.media-file--archive {
    --kind-color: 38 84% 46%;
}

.media-file--code {
    --kind-color: 288 55% 50%;
}

.media-file--text {
    --kind-color: 220 12% 46%;
}

.media-file--other {
    --kind-color: 220 12% 46%;
}


/* Per-item kebab menu */

.media-item__menu {
    flex: 0 0 auto;
}

.media-item__kebab {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid transparent;
    background: transparent;
    color: hsl(var(--text-muted));
    display: grid;
    place-items: center;
    padding: 0;
}

.media-item__kebab:hover {
    border-color: hsl(var(--border));
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
}


/* List view */

.media-grid--list {
    --bs-gutter-y: 0.5rem;
}

.media-row {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
    padding: 8px 12px;
    animation: mediaPopIn 320ms cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: calc(var(--media-delay-step, 0) * 14ms);
}

.media-row:hover {
    border-color: hsl(var(--border-strong, var(--border)));
    box-shadow: var(--shadow-sm);
}

.media-row__img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex: 0 0 auto;
}

.media-row__icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: hsl(var(--kind-color, var(--text-muted)) / 0.12);
    color: hsl(var(--kind-color, var(--text-muted)));
}

.media-row__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 0;
    font-weight: 600;
    color: hsl(var(--text));
    cursor: pointer;
}

.media-row__name:hover {
    color: hsl(var(--primary));
}

.media-row__ext,
.media-row__size,
.media-row__date {
    flex: 0 0 auto;
    font-size: 12px;
    color: hsl(var(--text-muted));
    white-space: nowrap;
}

.media-row__ext {
    min-width: 48px;
    font-weight: 600;
}

.media-row__size {
    min-width: 72px;
    text-align: right;
}

.media-row__date {
    min-width: 92px;
    text-align: right;
}

.media-row .media-item__favorite {
    position: static;
}

@media (max-width: 767px) {
    .media-row__date,
    .media-row__ext {
        display: none;
    }
}


/* Pagination */

.media-pager {
    display: flex;
    align-items: center;
    gap: 6px;
}

.media-pager__btn {
    min-width: 34px;
    height: 34px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
    color: hsl(var(--text));
    font-weight: 600;
    padding: 0 8px;
}

.media-pager__btn:hover:not(:disabled):not(.media-pager__btn--active) {
    background: hsl(var(--surface-2));
}

.media-pager__btn--active {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
    color: hsl(var(--white));
}

.media-pager__btn:disabled {
    opacity: .45;
}

.media-pager__gap {
    color: hsl(var(--text-muted));
    padding: 0 2px;
}


/* Details modal */

.media-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

@media (max-width: 767px) {
    .media-details {
        grid-template-columns: 1fr;
    }
}

.media-details__preview {
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface-2));
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    overflow: hidden;
}

.media-details__img,
.media-details__video {
    max-width: 100%;
    max-height: 340px;
    display: block;
}

.media-details__audio {
    width: 90%;
}

.media-details__placeholder {
    height: 240px;
    width: 100%;
    cursor: default;
}

.media-details__list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
    margin: 0;
}

.media-details__list dt {
    color: hsl(var(--text-muted));
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    align-self: center;
}

.media-details__list dd {
    margin: 0;
    min-width: 0;
    word-break: break-word;
}

.media-details__url {
    display: flex;
    align-items: center;
    gap: 8px;
}

.media-details__url code {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    padding: 6px 8px;
}

.media-item__check {
    position: absolute;
    left: 10px;
    top: 10px;
    background: hsl(var(--surface) / 0.92);
    border-radius: 999px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid hsl(var(--border));
    box-shadow: var(--shadow-xs);
    z-index: 2;
}

.media-item__favorite {
    position: absolute;
    right: 10px;
    top: 10px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    box-shadow: var(--shadow-xs);
    z-index: 2;
    background: hsl(var(--surface) / 0.92) !important;
}

.media-item__favorite--active {
    border-color: hsl(var(--warning) / 0.55);
    background: hsl(var(--warning) / 0.14) !important;
    color: hsl(var(--warning)) !important;
}

.media-grid__empty {
    border: 1px dashed hsl(var(--border-strong));
    border-radius: 4px;
    background: hsl(var(--surface-2));
    box-shadow: var(--shadow-xs);
}


/* Upload dropzone */

.media-dropzone {
    position: relative;
    border: 1px dashed hsl(var(--border-strong));
    border-radius: 4px;
    background: hsl(var(--surface-2));
    padding: 18px;
    overflow: hidden;
}

.media-dropzone--drag {
    border-color: hsl(var(--primary));
    background: hsl(var(--primary) / 0.06);
}

.media-dropzone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.media-dropzone__inner {
    display: grid;
    place-items: center;
    text-align: center;
    gap: 8px;
    padding: 10px 8px;
}

.media-dropzone__icon {
    width: 52px;
    height: 52px;
    border-radius: 4px;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-xs);
    color: hsl(var(--primary));
}

.media-dropzone__title {
    font-weight: 600;
    color: hsl(var(--text));
}

.media-dropzone__sub {
    font-weight: 600;
    color: hsl(var(--text-muted));
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
}

.media-dropzone__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.media-selected__list {
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
    max-height: 240px;
    overflow: auto;
}

.media-selected__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid hsl(var(--border));
}

.media-selected__row:last-child {
    border-bottom: 0;
}

.media-selected__name {
    font-weight: 600;
    color: hsl(var(--text));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-selected__size {
    font-weight: 600;
    color: hsl(var(--text-muted));
    font-size: 12px;
    white-space: nowrap;
}


/* GLightbox theme tweaks (match our UI) */

.glightbox-clean .gslide-title,
.glightbox-clean .gslide-desc {
    font-family: inherit !important;
}

.glightbox-clean .gslide-title {
    font-weight: 600 !important;
}

.glightbox-clean .gclose,
.glightbox-clean .gnext,
.glightbox-clean .gprev {
    border-radius: 4px !important;
}


/* Upload queue (Google Drive style) */

.media-upload {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: min(420px, calc(100vw - 36px));
    z-index: 1100;
    pointer-events: none;
}

.media-upload__panel {
    pointer-events: auto;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(16px);
    opacity: 0;
    transition: transform 240ms cubic-bezier(.2, .6, .2, 1), opacity 240ms cubic-bezier(.2, .6, .2, 1);
}

.media-upload--open .media-upload__panel {
    transform: translateY(0);
    opacity: 1;
}

.media-upload__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: hsl(var(--surface-2));
    border-bottom: 1px solid hsl(var(--border));
}

.media-upload__title {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .02em;
    text-transform: none;
    color: hsl(var(--text));
}

.media-upload__close {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
    color: hsl(var(--text-muted));
    display: grid;
    place-items: center;
    font-size: 18px;
    line-height: 1;
}

.media-upload__body {
    max-height: 52vh;
    overflow: auto;
    padding: 10px 12px 12px;
    display: grid;
    gap: 10px;
}

.media-upload__item {
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    padding: 10px 10px 10px 12px;
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.media-upload__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.media-upload__name {
    font-weight: 600;
    color: hsl(var(--text));
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-upload__status {
    font-size: 12px;
    color: hsl(var(--text-muted));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-upload__progress {
    display: block;
    width: 100%;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: hsl(var(--surface-3));
    overflow: hidden;
    appearance: none;
}

.media-upload__progress::-webkit-progress-bar {
    background: hsl(var(--surface-3));
}

.media-upload__progress::-webkit-progress-value {
    border-radius: inherit;
    background: linear-gradient(90deg, hsl(var(--primary)) 0%, hsl(var(--primary-hover)) 100%);
}

.media-upload__progress::-moz-progress-bar {
    border-radius: inherit;
    background: linear-gradient(90deg, hsl(var(--primary)) 0%, hsl(var(--primary-hover)) 100%);
}

.media-upload__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.media-upload__percent {
    font-weight: 600;
    font-size: 12px;
    color: hsl(var(--text));
}

.media-upload__abort {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface-2));
    color: hsl(var(--text-muted));
    display: grid;
    place-items: center;
}

.media-upload__item--done .media-upload__progress::-webkit-progress-value {
    background: linear-gradient(90deg, hsl(var(--success-bright)) 0%, hsl(var(--success-deep)) 100%);
}

.media-upload__item--done .media-upload__progress::-moz-progress-bar {
    background: linear-gradient(90deg, hsl(var(--success-bright)) 0%, hsl(var(--success-deep)) 100%);
}

.media-upload__item--failed .media-upload__progress::-webkit-progress-value {
    background: linear-gradient(90deg, hsl(var(--danger-bright)) 0%, hsl(var(--danger-vivid)) 100%);
}

.media-upload__item--failed .media-upload__progress::-moz-progress-bar {
    background: linear-gradient(90deg, hsl(var(--danger-bright)) 0%, hsl(var(--danger-vivid)) 100%);
}

@media (max-width: 575px) {
    .media-search {
        min-width: 100%;
        width: 100%;
    }
}


/* dashboard */

.dashboard {
    --dash-ease: cubic-bezier(.2, .8, .2, 1);
    --dash-ease-soft: cubic-bezier(.2, .6, .2, 1);
    color: hsl(var(--text));
    min-width: 0;
    display: grid;
    gap: 24px;
}

.dashboard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    padding-bottom: 0;
    flex-wrap: wrap;
}

.dashboard-head h1 {
    margin: 0;
    color: hsl(var(--text));
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 2.4vw, 2rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.dashboard-head__eyebrow {
    margin: 0 0 8px;
    color: hsl(var(--text-muted));
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

/* Workspace shell: navbar context and analytics composition (sidebar brand lives in section 4). */
.workspace-context { display: flex; align-items: center; gap: 12px; font-size: 12px; color: hsl(var(--text-muted)); margin-inline-end: auto; min-width: 0; }
.workspace-context strong { color: hsl(var(--text)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-analytics { display: grid; gap: 24px; min-width: 0; }
.dashboard-analytics--split { grid-template-columns: minmax(0, 2.3fr) minmax(250px, 1fr); }
.dashboard-analytics .dashboard-finance { grid-template-columns: 1fr; gap: 0; padding: 8px 16px; }
.dashboard-analytics .dashboard-finance .metric-card { min-height: 94px; padding: 16px 8px; }
.dashboard-analytics .dashboard-finance .metric-card + .metric-card { border-top: 1px solid hsl(var(--border)); border-radius: 0; }
.dashboard-analytics .chart-card { display: flex; flex-direction: column; }
.dashboard-analytics .chart-card__canvas { flex: 1; min-height: 300px; }
.dashboard-head__eyebrow span { margin-inline: 8px; color: hsl(var(--text-soft)); }
@media (max-width: 1199px) {
    .workspace-context > span { display: none; }
    .dashboard-analytics--split { grid-template-columns: minmax(0, 1fr); }
    .dashboard-analytics .dashboard-finance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .workspace-context { display: none; }
    .dashboard-analytics { gap: 16px; }
    .dashboard-analytics .dashboard-finance { grid-template-columns: 1fr; }
}

.dashboard-head__description {
    margin: 10px 0 0;
    color: hsl(var(--text-muted));
    font-size: 13px;
    line-height: 1.65;
    max-width: 48ch;
}

/* Dashboard hierarchy: primary indicators, financial summary, then analytics. */
.dashboard-kpis .metric-card {
    --kpi-color: 245 53% 45%;
    min-height: 136px;
    padding: 22px;
    background: hsl(var(--kpi-color));
    border: 0;
    color: white;
    box-shadow: none;
}

.dashboard-kpis .metric-card:nth-child(2) { --kpi-color: 174 70% 28%; }
.dashboard-kpis .metric-card:nth-child(3) { --kpi-color: 206 76% 34%; }
.dashboard-kpis .metric-card:nth-child(4) { --kpi-color: 225 40% 25%; }

.dashboard-kpis .metric-card::after {
    content: '';
    position: absolute;
    width: 130px;
    height: 130px;
    inset-inline-end: -65px;
    inset-block-end: -75px;
    border: 24px solid rgb(255 255 255 / .07);
    border-radius: 50%;
    pointer-events: none;
}

.dashboard-kpis .metric-card strong,
.dashboard-kpis .metric-card__label { color: white; }
.dashboard-kpis .metric-card__meta { color: rgb(255 255 255 / .8); }
.dashboard-kpis .metric-card__icon {
    color: white;
    background: rgb(255 255 255 / .16);
    border-radius: 4px;
    box-shadow: none;
}

.dashboard-finance {
    padding: 8px;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
}

.dashboard-finance .metric-card {
    min-height: 112px;
    border: 0;
    box-shadow: none;
    border-radius: var(--r);
}

.dashboard-finance .metric-card strong {
    font-size: clamp(20px, 1.7vw, 28px);
    overflow-wrap: anywhere;
}

.dashboard-period {
    padding: 7px 12px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-sm);
    color: hsl(var(--text-muted));
    font-size: 12px;
    white-space: nowrap;
}

@media (max-width: 575px) {
    .dashboard-kpis .metric-card { min-height: 130px; padding: 18px; }
    .dashboard-finance { padding: 0; }
    .dashboard-head__description { font-size: 12px; }
}

.admin-skip-link {
    position: fixed;
    inset-block-start: 8px;
    inset-inline-start: 8px;
    z-index: 1100;
    padding: 12px 20px;
    border-radius: var(--r);
    background: hsl(var(--surface));
    box-shadow: var(--shadow);
    transform: translateY(-160%);
}

.admin-skip-link:focus {
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .dashboard *, .sidebar *, .app__content * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

.dashboard-head__cron {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    color: hsl(var(--text-muted));
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.dashboard-head__cron:hover {
    border-color: hsl(var(--primary) / 0.45);
    background: hsl(var(--primary) / 0.07);
    color: hsl(var(--primary));
    transform: translateY(-1px);
}

.dashboard-head__cron:focus-visible {
    outline: 3px solid hsl(var(--primary) / 0.18);
    outline-offset: 2px;
}

.dashboard-head__cron.is-copied {
    border-color: hsl(var(--success) / 0.45);
    background: hsl(var(--success) / 0.09);
    color: hsl(var(--success));
}

.dashboard-head__cron:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.dashboard-head__cron svg {
    width: 15px;
    height: 15px;
    color: hsl(var(--primary));
}

.dashboard-cron-modal {
    overflow: hidden;
    border: 1px solid hsl(var(--border));
}

.dashboard-cron-modal .modal-header {
    padding: 20px 24px;
    border-bottom-color: hsl(var(--border));
}

.dashboard-cron-modal .modal-body {
    padding: 0;
}

.cron-setup__intro {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 24px;
    background: hsl(var(--primary) / 0.055);
    border-bottom: 1px solid hsl(var(--border));
}

.cron-setup__intro-icon {
    display: inline-grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 4px;
    background: hsl(var(--primary) / 0.12);
    color: hsl(var(--primary));
}

.cron-setup__intro-icon svg {
    width: 20px;
    height: 20px;
}

.cron-setup__intro h3 {
    margin: 1px 0 4px;
    color: hsl(var(--text));
    font-size: 15px;
    font-weight: 600;
}

.cron-setup__intro p {
    margin: 0;
    color: hsl(var(--text-muted));
    font-size: 12.5px;
    line-height: 1.55;
}

.cron-setup__steps {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 10px 24px;
    list-style: none;
}

.cron-setup__steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
}

.cron-setup__steps li+li {
    border-top: 1px solid hsl(var(--border) / 0.7);
}

.cron-setup__steps li>span {
    display: inline-grid;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    background: hsl(var(--surface-soft));
    color: hsl(var(--primary));
    font-size: 11px;
    font-weight: 600;
}

.cron-setup__steps div {
    display: grid;
    gap: 2px;
}

.cron-setup__steps strong {
    color: hsl(var(--text));
    font-size: 12.5px;
}

.cron-setup__steps small {
    color: hsl(var(--text-muted));
    font-size: 11.5px;
    line-height: 1.5;
}

.cron-setup__copy-area {
    padding: 18px 24px 22px;
    border-top: 1px solid hsl(var(--border));
}

.cron-setup__copy-area label {
    display: block;
    margin-bottom: 7px;
    color: hsl(var(--text));
    font-size: 11.5px;
    font-weight: 600;
}

.cron-setup__copy-row {
    display: flex;
    gap: 8px;
}

.cron-setup__copy-row input {
    min-width: 0;
    flex: 1;
    height: 42px;
    padding: 0 12px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface-soft));
    color: hsl(var(--text-muted));
    font-family: var(--font-mono, monospace);
    font-size: 11.5px;
    outline: none;
}

.cron-setup__copy-row button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 112px;
    height: 42px;
    padding: 0 15px;
    border: 0;
    border-radius: 4px;
    background: hsl(var(--primary));
    color: hsl(0 0% 100%);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 160ms ease, transform 160ms ease;
}

.cron-setup__copy-row button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.cron-setup__copy-row button.is-copied {
    background: hsl(var(--success));
}

.cron-setup__copy-row button svg,
.cron-setup__copy-area p svg,
.cron-setup__warning svg {
    width: 15px;
    height: 15px;
}

.cron-setup__copy-area p {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0;
    color: hsl(var(--text-muted));
    font-size: 10.5px;
}

.cron-setup__copy-area p svg {
    flex: 0 0 auto;
    color: hsl(var(--success));
}

.cron-setup__warning {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 18px 24px 22px;
    padding: 12px 14px;
    border: 1px solid hsl(var(--warning) / 0.35);
    border-radius: 4px;
    background: hsl(var(--warning) / 0.09);
    color: hsl(var(--text));
    font-size: 12px;
}

@keyframes dashFadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-grid>* {
    animation: dashFadeUp 360ms var(--dash-ease) both;
}

.dashboard-grid>*:hover {
    transform: translateY(-2px);
}

.dashboard-card {
    transition: transform 240ms var(--dash-ease-soft), box-shadow 240ms var(--dash-ease-soft), border-color 240ms var(--dash-ease-soft);
}

.dashboard-card:hover {
    box-shadow: var(--shadow);
    border-color: hsl(var(--primary) / 0.22);
}

.dashboard-grid> :nth-child(1) {
    animation-delay: 0ms;
}

.dashboard-grid> :nth-child(2) {
    animation-delay: 80ms;
}

.dashboard-grid> :nth-child(3) {
    animation-delay: 160ms;
}

.dashboard-grid> :nth-child(4) {
    animation-delay: 240ms;
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-grid>*,
    .sparkline__path {
        animation: none !important;
        transition: none !important;
        transform: none !important;
        filter: none !important;
        stroke-dashoffset: 0 !important;
    }
}

.dashboard-actions,
.chart-card__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
    padding: 8px 14px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-size: 12px;
    line-height: 1;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: none;
}

.dashboard-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.4;
}

.dashboard-btn--light {
    background: hsl(var(--surface));
    border-color: hsl(var(--border));
    color: hsl(var(--text));
}

.dashboard-btn--light:hover {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
}

.dashboard-btn--primary {
    background: linear-gradient(180deg, hsl(var(--primary)), hsl(var(--primary-hover)));
    border-color: hsl(var(--primary-hover));
    color: hsl(var(--white));
    box-shadow: inset 0 1px 0 hsl(var(--white) / 0.25);
}

.dashboard-btn--sm {
    min-height: 32px;
    padding: 8px 13px;
}

.dashboard-section {
    margin-top: 0;
}

.dashboard-section--tight {
    margin-top: 0;
}

.dashboard-grid {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.dashboard-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: stretch;
}

.dashboard-card {
    position: relative;
    display: block;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    color: inherit;
    overflow: hidden;
    min-width: 0;
}

.dashboard-card:hover {
    color: inherit;
}

.metric-card {
    --metric-accent: var(--metric-blue);
    min-height: 126px;
    padding: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: start;
    gap: 12px;
    text-decoration: none;
    /* Soft accent halo drifting out of the top-right corner (behind the icon) —
               gives each card its colour without a hard band. */
    background: hsl(var(--surface));
    transition: transform 240ms var(--dash-ease-soft), border-color 240ms var(--dash-ease-soft), box-shadow 240ms var(--dash-ease-soft);
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: hsl(var(--metric-accent) / 0.42);
    box-shadow: var(--shadow-sm);
}

.metric-card--compact {
    min-height: 126px;
}

.metric-card__icon {
    grid-column: 2;
    grid-row: 1;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(140deg, hsl(var(--metric-accent) / 0.2), hsl(var(--metric-accent) / 0.08));
    box-shadow: inset 0 0 0 1px hsl(var(--metric-accent) / 0.22);
    color: hsl(var(--metric-accent));
    transition: transform 220ms var(--dash-ease-soft), background 220ms var(--dash-ease-soft);
}

.metric-card:hover .metric-card__icon {
    transform: translateY(-2px) rotate(-3deg);
    background: linear-gradient(140deg, hsl(var(--metric-accent) / 0.27), hsl(var(--metric-accent) / 0.12));
}

.metric-card__icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.1;
}


/* Alpha tints — render as soft pastels on light, glowing chips on dark */

.metric-card__icon--blue,
.metric-card__icon--blue-soft {
    --metric-accent: var(--metric-blue);
}

.metric-card:has(.metric-card__icon--orange) {
    --metric-accent: var(--metric-orange);
}

.metric-card:has(.metric-card__icon--green) {
    --metric-accent: var(--metric-green);
}

.metric-card:has(.metric-card__icon--purple) {
    --metric-accent: var(--metric-purple);
}

.metric-card:has(.metric-card__icon--cyan) {
    --metric-accent: var(--metric-cyan);
}

.metric-card:has(.metric-card__icon--red) {
    --metric-accent: var(--metric-red);
}

.metric-card__body,
.metric-card__body>span {
    display: block;
    min-width: 0;
}

.metric-card__body {
    grid-column: 1;
    grid-row: 1;
    overflow: hidden;
}

.metric-card__label {
    margin-bottom: 10px;
    color: hsl(var(--text-muted));
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: -0.005em;
}

.metric-card strong {
    display: block;
    margin-bottom: 8px;
    color: hsl(var(--text));
    font-size: clamp(1.45rem, 2vw, 1.75rem);
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.metric-card__meta,
.metric-card__text {
    color: hsl(var(--text-muted));
    font-size: 11.25px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-card__dash {
    display: none;
    margin-right: 5px;
    color: hsl(var(--text-soft));
    font-size: 13px;
    line-height: 1;
    vertical-align: -1px;
}

.metric-card__trend {
    display: flex !important;
    align-items: center;
    gap: 10px;
    color: hsl(var(--text-muted));
    font-size: 12px;
    font-weight: 600;
    flex-wrap: wrap;
}

.metric-card__trend>span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-width: 47px;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 4px;
    font-weight: 600;
}

.metric-card__trend svg {
    width: 13px;
    height: 13px;
    stroke-width: 2.7;
}

.metric-card__trend--up>span {
    background: hsl(var(--metric-green) / 0.15);
    color: hsl(var(--metric-green));
}

.metric-card__trend--danger>span {
    background: hsl(var(--metric-red) / 0.14);
    color: hsl(var(--metric-red));
}


/* Sparkline — decorative trend, right side of the card */

.metric-card__spark {
    display: none;
}

.sparkline__path {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    animation: sparkDraw 1100ms ease-out forwards 300ms;
}

@keyframes sparkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

.dashboard-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 19px 24px 0;
}

.dashboard-card__header h2 {
    margin: 0;
    color: hsl(var(--text));
    font-size: 14px;
    line-height: 1.25;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-transform: none;
}

.dashboard-card__header p {
    margin: 5px 0 0;
    color: hsl(var(--text-muted));
    font-size: 12px;
    font-weight: 600;
}

.dashboard-icon-btn {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: hsl(var(--text));
    display: grid;
    place-items: center;
    padding: 0;
}

.dashboard-icon-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 3;
}

.chart-card {
    min-height: 256px;
}

.chart-card__canvas {
    height: 213px;
    width: 100%;
    margin-top: 2px;
}

.insight-chart-card {
    --insight-accent: var(--metric-blue);
    min-height: 316px;
    background:
        linear-gradient(180deg, hsl(var(--insight-accent) / 0.055), transparent 105px),
        hsl(var(--surface));
}

.insight-chart-card--browser {
    --insight-accent: var(--metric-blue);
}

.insight-chart-card--os {
    --insight-accent: var(--metric-purple);
}

.insight-chart-card--device {
    --insight-accent: var(--metric-green);
}

.insight-chart-card__heading {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.insight-chart-card__icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    color: hsl(var(--insight-accent));
    background: hsl(var(--insight-accent) / 0.12);
    border: 1px solid hsl(var(--insight-accent) / 0.17);
    border-radius: 4px;
}

.insight-chart-card__icon svg {
    width: 17px;
    height: 17px;
    stroke-width: 2.2;
}

.insight-chart-card__badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    color: hsl(var(--insight-accent));
    background: hsl(var(--insight-accent) / 0.09);
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.insight-chart-card__canvas {
    width: 100%;
    height: 244px;
    padding: 8px 4px 14px;
}

@media (max-width: 1199px) {
    .dashboard-grid--four,
    .dashboard-grid--three,
    .dashboard-main-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-main-grid>.chart-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    .dashboard-actions {
        margin-top: 14px;
    }
    .dashboard-grid--four,
    .dashboard-grid--three,
    .dashboard-grid--two,
    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }
    .metric-card,
    .metric-card--compact {
        min-height: 120px;
    }
    .dashboard-card__header {
        flex-direction: column;
    }
    .insight-chart-card .dashboard-card__header {
        flex-direction: row;
    }
}

@media (max-width: 575px) {
    .dashboard-head {
        padding-bottom: 0;
    }
    .dashboard-head__cron {
        min-height: 32px;
        padding: 0 10px;
        font-size: 11px;
    }
    .dashboard-cron-modal .modal-header,
    .cron-setup__intro,
    .cron-setup__copy-area {
        padding-left: 18px;
        padding-right: 18px;
    }
    .cron-setup__steps {
        padding-left: 18px;
        padding-right: 18px;
    }
    .insight-chart-card__badge {
        display: none;
    }
    .cron-setup__copy-row {
        display: grid;
    }
    .cron-setup__copy-row button {
        width: 100%;
    }
    .dashboard-grid {
        gap: 12px;
    }
    .dashboard-section {
        margin-top: 0;
    }
    .dashboard { gap: 16px; }
    .metric-card,
    .metric-card--compact {
        grid-template-columns: minmax(0, 1fr) 42px;
        padding: 18px;
        gap: 12px;
    }
    .metric-card__icon {
        width: 42px;
        height: 42px;
    }
    .metric-card strong {
        font-size: 26px;
    }
    .dashboard-card__header {
        gap: 12px;
        padding: 17px 16px 0;
    }
    .chart-card__actions {
        width: 100%;
        justify-content: space-between;
    }
    .chart-card__canvas {
        height: 230px;
    }
}

@media (max-width: 380px) {
    .dashboard-head h1 {
        font-size: 20px;
    }
    .metric-card__spark {
        display: none;
    }
    .chart-card__canvas {
        height: 210px;
    }
}


/* setting/language/list */

.language-editor__keywords {
    min-height: 400px !important;
}


/* setting/social_login/list */

.social-provider {
    display: flex;
    gap: 10px;
}

.social-provider__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.social-provider__media,
.integration-card__media {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    overflow: hidden;
    padding: 7px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface-2));
}

.social-provider__fallback,
.integration-card__fallback,
.gateway-card__fallback {
    place-items: center;
    color: hsl(var(--text-soft));
}

.social-provider__fallback svg,
.integration-card__fallback svg,
.gateway-card__fallback svg {
    width: 22px;
    height: 22px;
}

.social-provider__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.social-help__intro {
    display: flex;
    gap: 10px;
    align-items: center;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid hsl(var(--border));
}

.social-help__section {
    margin-bottom: 18px;
}

.social-copy {
    display: flex;
    gap: 8px;
    align-items: center;
}

.social-copy .input {
    font-family: var(--font-mono, monospace);
    font-size: 0.85rem;
}

.social-copy .btn {
    flex-shrink: 0;
}

.social-help__steps {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
    color: hsl(var(--text-soft));
}

.social-help__note {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--surface-2));
    color: hsl(var(--text-soft));
    font-size: 0.875rem;
}

.social-help__note svg {
    flex-shrink: 0;
    color: hsl(var(--primary));
}

.social-help__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}


/* payment_gateway/list */

.gateway-card {
    text-align: center;
    padding: 0;
    border: 1px solid hsl(var(--border));
    box-shadow: var(--shadow-xs);
    transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}

.gateway-card .gateway-card__badges {
    margin: 0;
    justify-content: space-between;
    display: flex;
}

.gateway-card .gateway-card__title {
    margin: 7px 0 0;
    color: hsl(var(--text));
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.gateway-card .card__body {
    min-height: 208px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gateway-card__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gateway-card__media {
    display: grid;
    place-items: center;
    width: 68px;
    height: 52px;
    margin: 0 auto;
    padding: 7px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface-2));
    overflow: hidden;
}

.gateway-card:hover {
    transform: translateY(-2px);
    border-color: hsl(var(--primary) / 0.28);
    box-shadow: var(--shadow);
}

.gateway-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.gateway-card__description {
    display: -webkit-box;
    overflow: hidden;
    color: hsl(var(--text-muted));
    font-size: 12px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.gateway-card .gateway-card__actions {
    margin-top: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

.gateway-card .gateway-card__actions>.btn {
    width: 100%;
    min-height: 36px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    font-weight: 600;
}

.gateway-card .gateway-card__actions svg {
    width: 16px;
    height: 16px;
}

[data-mode="dark"] .gateway-card {
    box-shadow: var(--shadow-xs);
}

[data-mode="dark"] .gateway-card:hover {
    box-shadow: var(--shadow);
}


/* setting/integration/list */

.integration-card {
    padding: 10px 0;
    border-bottom: 1px solid hsl(var(--border));
}

.integration-card__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.integration-card__toggle {
    cursor: pointer;
    user-select: none;
}


/* website/pages/edit */

.page-editor-heading {
    align-items: flex-end;
}

.page-editor-heading__eyebrow {
    margin-bottom: 4px;
    color: hsl(var(--primary));
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.page-editor-heading__subtitle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: 5px 0 0;
    color: hsl(var(--text-muted));
    font-size: 12px;
}

.page-editor-heading__subtitle span {
    padding: 2px 7px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface-2));
    color: hsl(var(--text-soft));
    font-family: var(--font-mono, monospace);
    font-size: 9px;
}

.page-editor-card__header,
.page-editor-builder__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-editor-card__header {
    justify-content: flex-start;
}

.page-editor-card__icon,
.page-editor-builder__icon {
    display: grid;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 4px;
    background: hsl(var(--primary) / .11);
    color: hsl(var(--primary));
}

.page-editor-card__icon svg,
.page-editor-builder__icon svg {
    width: 18px;
    height: 18px;
}

.page-editor-card .card__subtitle,
.page-editor-builder .card__subtitle {
    margin-top: 3px;
    color: hsl(var(--text-muted));
    font-size: 10.5px;
    line-height: 1.45;
}

.page-editor-title-field {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid hsl(var(--border));
}

.page-editor-section-label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
    color: hsl(var(--text));
    font-size: 11px;
    font-weight: 600;
}

.page-editor-section-label svg {
    width: 14px;
    height: 14px;
    color: hsl(var(--primary));
}

.page-editor-media {
    height: 100%;
}

.page-editor-media>p {
    margin: -7px 0 13px;
    color: hsl(var(--text-soft));
    font-size: 9.5px;
}

.page-editor-media .uploader__dropzone,
.page-editor-media .uploader__preview {
    min-height: 190px;
}

.page-editor-social {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid hsl(var(--border));
}

.page-editor-privacy {
    border-color: hsl(var(--primary) / .2);
    background: linear-gradient(110deg, hsl(var(--primary) / .055), hsl(var(--surface)) 45%);
}

.page-layout-editor__title {
    font-weight: 600;
}

.page-editor-builder__heading {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 11px;
}

.page-editor-builder__icon--library {
    background: hsl(var(--info) / .11);
    color: hsl(var(--info));
}

.page-editor-count {
    flex: 0 0 auto;
    padding: 5px 9px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface-2));
    color: hsl(var(--text-muted));
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
}

.page-editor-count b {
    color: hsl(var(--text));
    font-size: 10px;
}

.page-layout-editor__list {
    min-height: 180px;
    padding: 10px;
    border: 1px dashed hsl(var(--border));
    border-radius: var(--r);
    background: hsl(var(--surface-2) / .72);
}

.page-layout-editor__selected-list {
    min-height: 390px;
}

.page-layout-editor__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 61px;
    margin-bottom: 8px;
    padding: 10px 11px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    color: hsl(var(--text));
    cursor: grab;
    box-shadow: var(--shadow-xs);
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.page-layout-editor__item:last-child {
    margin-bottom: 0;
}

.page-layout-editor__item .page-layout-editor__item-content {
    flex: 1 1 auto;
    min-width: 0;
}

.page-layout-editor__item .page-layout-editor__item-title {
    display: block;
    overflow: hidden;
    color: hsl(var(--text));
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-layout-editor__item .page-layout-editor__item-key {
    margin-top: 2px;
    color: hsl(var(--text-soft)) !important;
    font-family: var(--font-mono, monospace);
    font-size: 8.5px;
}

.page-layout-editor__handle {
    display: grid;
    flex: 0 0 auto;
    width: 22px;
    height: 30px;
    place-items: center;
    color: hsl(var(--text-muted));
    cursor: grab;
}

.page-layout-editor__handle svg {
    width: 15px;
    height: 15px;
}

.page-layout-editor__position {
    display: grid;
    flex: 0 0 auto;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 4px;
    background: hsl(var(--primary) / .09);
    color: hsl(var(--primary));
    font-size: 9px;
    font-weight: 600;
}

.page-layout-editor__item:hover {
    border-color: hsl(var(--primary) / .34);
    background: hsl(var(--surface));
    box-shadow: none;
    transform: translateY(-1px);
}

.page-layout-editor__item--ghost {
    opacity: .45;
    background: hsl(var(--primary) / 0.12);
    border-style: dashed;
}

.page-layout-editor__item--chosen {
    border-color: hsl(var(--primary) / .5);
    background: hsl(var(--surface));
    box-shadow: none;
}

.page-layout-editor__item--available:hover {
    cursor: grab;
}

.page-layout-editor__available-list {
    max-height: 565px;
    overflow-y: auto;
    scrollbar-color: hsl(var(--primary) / .35) transparent;
}

.page-layout-editor__available-list .page-layout-editor__item {
    min-height: 56px;
}

.page-layout-editor__remove {
    display: grid;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    border: 1px solid hsl(var(--danger) / .2);
    border-radius: 4px;
    background: hsl(var(--danger) / .06);
    color: hsl(var(--danger));
    cursor: pointer;
    opacity: .72;
    transition: opacity 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.page-layout-editor__remove:hover,
.page-layout-editor__item:hover .page-layout-editor__remove {
    opacity: 1;
}

.page-layout-editor__remove:hover {
    background: hsl(var(--danger) / .12);
    transform: scale(1.04);
}

.page-layout-editor__remove svg,
.page-layout-editor__add svg {
    width: 14px;
    height: 14px;
}

.page-layout-editor__add {
    display: grid;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    border: 1px solid hsl(var(--primary) / .2);
    border-radius: 4px;
    background: hsl(var(--primary) / .07);
    color: hsl(var(--primary));
    cursor: pointer;
    transition: background-color 150ms ease, transform 150ms ease;
}

.page-layout-editor__add:hover {
    background: hsl(var(--primary) / .14);
    transform: scale(1.04);
}

.page-layout-editor__empty {
    display: flex;
    min-height: 350px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 35px 20px;
    color: hsl(var(--text-muted));
    text-align: center;
}

.page-layout-editor__empty>span {
    display: grid;
    width: 52px;
    height: 52px;
    margin-bottom: 12px;
    place-items: center;
    border-radius: 4px;
    background: hsl(var(--primary) / .09);
    color: hsl(var(--primary));
}

.page-layout-editor__empty svg {
    width: 22px;
    height: 22px;
}

.page-layout-editor__empty strong {
    margin-bottom: 4px;
    color: hsl(var(--text));
    font-size: 12px;
}

.page-layout-editor__empty p {
    max-width: 280px;
    margin: 0;
    font-size: 10.5px;
    line-height: 1.55;
}

.page-editor-library {
    position: sticky;
    top: 84px;
}

.page-editor-library__search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    margin-bottom: 11px;
    padding: 0 11px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    color: hsl(var(--text-soft));
}

.page-editor-library__search:focus-within {
    border-color: hsl(var(--primary) / .48);
    box-shadow: 0 0 0 3px hsl(var(--primary) / .1);
}

.page-editor-library__search svg {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
}

.page-editor-library__search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: hsl(var(--text));
    font-size: 10.5px;
}

.page-editor-library__empty {
    display: flex;
    min-height: 150px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    border: 1px dashed hsl(var(--border));
    border-radius: var(--r);
    background: hsl(var(--surface-2) / .7);
    color: hsl(var(--text-muted));
    font-size: 10.5px;
    text-align: center;
}

.page-editor-library__empty[hidden] {
    display: none;
}

.page-editor-library__empty svg {
    width: 20px;
    height: 20px;
    color: hsl(var(--text-soft));
}

.page-layout-editor__footer {
    position: sticky;
    bottom: 12px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 18px;
    padding: 11px 13px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface) / .94);
    box-shadow: none;
    backdrop-filter: blur(14px);
}

.page-layout-editor__footer .btn {
    min-height: 38px;
    min-width: 105px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.page-layout-editor__save-note {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-right: auto;
    color: hsl(var(--text-muted));
    font-size: 10px;
}

.page-layout-editor__save-note svg {
    width: 14px;
    height: 14px;
    color: hsl(var(--primary));
}

@media (max-width: 1199px) {
    .page-editor-library {
        position: static;
    }
    .page-layout-editor__available-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 420px;
        gap: 8px;
    }
    .page-layout-editor__available-list .page-layout-editor__item {
        margin-bottom: 0;
    }
}

@media (max-width: 767px) {
    .page-editor-heading {
        align-items: flex-start;
    }
    .page-editor-card__header,
    .page-editor-builder__header {
        align-items: flex-start;
    }
    .page-layout-editor__available-list {
        display: block;
    }
    .page-layout-editor__available-list .page-layout-editor__item {
        margin-bottom: 8px;
    }
    .page-layout-editor__footer {
        bottom: 8px;
    }
    .page-layout-editor__save-note {
        display: none;
    }
}

@media (max-width: 480px) {
    .page-editor-builder__header {
        gap: 10px;
    }
    .page-editor-count {
        display: none;
    }
    .page-layout-editor__footer .btn {
        flex: 1 1 0;
        min-width: 0;
    }
}


/* setting/notification */

.notification-settings__section {
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid hsl(var(--border));
}

.notification-settings__section .form-group label {
    font-weight: 600;
}


/* setting/robots_txt */

.robots-editor {
    min-height: 360px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    line-height: 1.55;
    resize: vertical;
}


/* setting/server_information */

.server-info__card .card__header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.server-info__icon {
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    background: hsl(var(--primary) / 0.12);
    color: hsl(var(--primary));
}

.server-info__icon svg {
    width: 16px;
    height: 16px;
}

.server-info__list {
    margin: 0;
}

.server-info__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 4px;
    border-bottom: 1px solid hsl(var(--border));
}

.server-info__row:last-child {
    border-bottom: 0;
    padding-bottom: 4px;
}

.server-info__key {
    flex: 0 0 auto;
    max-width: 55%;
    margin: 0;
    color: hsl(var(--text-muted));
    font-size: 12.75px;
    font-weight: 600;
}

.server-info__value {
    margin: 0;
    text-align: right;
    min-width: 0;
}

.server-info__text {
    color: hsl(var(--text));
    font-size: 12.75px;
    font-weight: 600;
    word-break: break-word;
}

.server-info__pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.7;
    white-space: nowrap;
}

.server-info__pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.server-info__pill--good {
    background: hsl(var(--success) / 0.14);
    color: hsl(var(--success));
}

.server-info__pill--bad {
    background: hsl(var(--danger) / 0.14);
    color: hsl(var(--danger));
}

.server-info__pill--warning {
    background: hsl(var(--warning) / 0.16);
    color: hsl(var(--warning));
}

@media (max-width: 575px) {
    .server-info__row {
        flex-direction: column;
        gap: 4px;
    }
    .server-info__key {
        max-width: 100%;
    }
    .server-info__value {
        text-align: left;
    }
}


/* miscell/update */

.update-card .card__body {
    padding: 2rem;
}

.update-card__icon {
    margin-bottom: 1rem;
}

.update-card__icon svg,
.update-card__icon i {
    width: 56px;
    height: 56px;
}

.update-card__icon.update-card__icon--current {
    color: hsl(var(--success));
}

.update-card__icon.update-card__icon--available {
    color: hsl(var(--info));
}

.update-card__steps {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.update-card__steps li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 2px;
    border-bottom: 1px solid hsl(var(--border));
    font-weight: 500;
}

.update-card__steps li:last-child {
    border-bottom: none;
}

.update-card__steps svg,
.update-card__steps i {
    width: 18px;
    height: 18px;
    color: hsl(var(--primary));
    flex-shrink: 0;
    margin-top: 2px;
}

.update-card__steps small {
    display: block;
    color: hsl(var(--text-muted));
    font-weight: 400;
}

.update-card__notes {
    text-align: left;
    max-width: 460px;
    margin: 0 auto 18px;
    padding: 12px 14px;
    background: hsl(var(--surface-2));
    border: 1px solid hsl(var(--border));
    border-radius: var(--r);
    font-size: 13px;
    color: hsl(var(--text));
    white-space: pre-line;
}

.update-page .card__header[role="button"] {
    cursor: pointer;
}

.update-page .card__header[aria-expanded="true"] [data-lucide="chevron-down"] {
    transform: rotate(180deg);
}

.update-page .card__header [data-lucide="chevron-down"] {
    transition: transform var(--t);
}


/* miscell/custom_css */

.custom-css-card {
    border-radius: 4px;
    box-shadow: none;
    border: none;
}

.custom-css-card .CodeMirror {
    height: 500px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    font-size: 14px;
}

[data-mode="dark"] .custom-css-card {
    box-shadow: none;
}

[data-mode="dark"] .custom-css-card .CodeMirror {
    border-color: hsl(var(--dark-border));
}

.custom-css-card__save {
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}


/* miscell/cache */

.cache-card {
    border-radius: 4px;
    box-shadow: none;
    border: none;
    padding: 2rem;
}

.cache-card__icon-wrap {
    text-align: center;
    margin-bottom: 1.5rem;
}

.cache-card__icon {
    color: hsl(var(--success));
}

.cache-card__title {
    font-weight: 600;
    color: hsl(var(--text));
}

.cache-card__item {
    border: none;
    padding-left: 0;
    padding-right: 0;
    font-size: 1rem;
    color: hsl(var(--text-muted));
}

.cache-card__item-icon {
    color: hsl(var(--success));
    margin-right: 1rem;
}

.cache-card__action {
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out;
}

[data-mode="dark"] .cache-card__title {
    color: hsl(var(--dark-text));
}

[data-mode="dark"] .cache-card__item {
    color: hsl(var(--dark-text-muted));
}

[data-mode="dark"] .cache-card {
    box-shadow: none;
}


/* mail_template/index */

.channel-template__name {
    font-weight: 600;
    color: hsl(var(--primary));
    text-decoration: none;
}

.channel-template__name:hover {
    text-decoration: underline;
}

.channel-template__code {
    font-size: 11.5px;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}

.channel-template__channels {
    display: inline-flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.channel-switch {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.channel-switch__label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: hsl(var(--text-muted));
    white-space: nowrap;
}

.channel-switch__label .u-icon-sm {
    width: 14px;
    height: 14px;
}

.channel-switch--email .channel-switch__label {
    color: hsl(var(--email-channel));
}

.channel-switch--sms .channel-switch__label {
    color: hsl(var(--info));
}

.channel-switch--telegram .channel-switch__label {
    color: hsl(var(--telegram-channel));
}

.channel-switch--email .switch input:checked+.switch__slider {
    background: hsl(var(--email-channel));
}

.channel-switch--sms .switch input:checked+.switch__slider {
    background: hsl(var(--info));
}

.channel-switch--telegram .switch input:checked+.switch__slider {
    background: hsl(var(--telegram-channel));
}

.channel-switch .switch {
    width: 34px;
    height: 20px;
}

.channel-switch .switch__slider::before {
    width: 14px;
    height: 14px;
}

.channel-switch .switch input:checked+.switch__slider::before {
    transform: translateX(14px);
}

@media (max-width: 768px) {
    .table--stacked tbody td.table__channels-cell {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 14px;
    }
    .table--stacked tbody td.table__channels-cell::before {
        position: static;
        transform: none;
        width: auto;
        flex: 0 0 auto;
        padding: 0;
    }
    .table--stacked .table__channels-cell .channel-template__channels {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: flex-end;
        gap: 8px;
    }
    .table--stacked .table__channels-cell .channel-switch {
        gap: 4px;
    }
    .table--stacked .table__channels-cell .channel-switch__label {
        font-size: 11px;
    }
}


/* Same switch styling reused inline with the channel content tabs on the
   template edit form — see admin/mail_template/form.blade.php. */

.channel-status-row {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
    padding: 2px 2px 16px;
    border-bottom: 1px solid hsl(var(--border));
    margin-bottom: 16px;
}


/* acl/role/form */

.permissions-table thead th {
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--surface-2));
}

.permissions-table tbody tr+tr td {
    border-top: 1px solid hsl(var(--border) / 0.7);
}

.permissions-table td,
.permissions-table th {
    padding: 1rem 0.75rem;
}

.permission-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    border: 1px solid hsl(var(--border-strong));
    background: hsl(var(--white));
    cursor: pointer;
    transition: all 0.2s ease;
}

.permission-checkbox--small {
    width: 20px;
    height: 20px;
}

.permission-checkbox__input {
    position: absolute;
    opacity: 0;
    inset: 0;
    cursor: pointer;
}

.permission-checkbox__control {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: transparent;
    transition: all 0.2s ease;
    display: inline-block;
}

.permission-checkbox__input:checked+.permission-checkbox__control {
    background: var(--bs-primary, hsl(var(--primary)));
    box-shadow: inset 0 0 0 3px hsl(var(--white));
}

.permission-checkbox__input:indeterminate+.permission-checkbox__control {
    background: linear-gradient(135deg, hsl(var(--primary) / 0.55), hsl(var(--indigo) / 0.55));
}

.permission-checkbox:hover {
    border-color: var(--bs-primary, hsl(var(--primary)));
}

.permissions-table__row:hover td:first-child {
    color: var(--bs-primary, hsl(var(--primary)));
}

@media (max-width: 991px) {
    .permissions-table thead th:first-child,
    .permissions-table tbody td:first-child {
        position: sticky;
        left: 0;
        background: hsl(var(--white));
    }
}

[data-mode="dark"] .permissions-table thead th {
    border-bottom-color: hsl(var(--dark-border));
    background: hsl(var(--dark-surface));
}

[data-mode="dark"] .permissions-table tbody tr+tr td {
    border-top-color: hsl(var(--dark-border-soft));
}

[data-mode="dark"] .permission-checkbox {
    border-color: hsl(var(--dark-border-strong));
    background: hsl(var(--dark-surface-deep));
}

[data-mode="dark"] .permission-checkbox__input:checked+.permission-checkbox__control {
    box-shadow: inset 0 0 0 3px hsl(var(--dark-surface-deep));
}

@media (max-width: 991px) {
    [data-mode="dark"] .permissions-table thead th:first-child,
    [data-mode="dark"] .permissions-table tbody td:first-child {
        background: hsl(var(--dark-surface-deep));
    }
}


/* support_tickets/form */

.ticket-thread__timeline {
    position: relative;
}

.ticket-thread__timeline::before {
    content: "";
    position: absolute;
    left: 28px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: hsl(var(--black) / 0.06);
}

.ticket-thread__item {
    position: relative;
    padding-left: 70px;
    margin-bottom: 1rem;
}

.ticket-thread__dot {
    position: absolute;
    left: 20px;
    top: .45rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: hsl(var(--primary));
    box-shadow: 0 0 0 4px hsl(var(--primary) / 0.15);
}

.ticket-thread__item--admin .ticket-thread__dot {
    background: hsl(var(--info));
    box-shadow: 0 0 0 4px hsl(var(--info) / 0.2);
}

.ticket-thread__item--ticket .ticket-thread__dot {
    background: hsl(var(--text-soft));
    box-shadow: 0 0 0 4px hsl(var(--text-soft) / 0.25);
}

.ticket-thread__message {
    background: hsl(var(--white));
    border: 1px solid hsl(var(--black) / 0.07);
    border-radius: .8rem;
    padding: 1rem 1.1rem;
}

.ticket-thread__message--admin {
    background: hsl(var(--primary-soft));
    border-color: hsl(var(--primary) / 0.22);
}

.ticket-thread__attachment {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .825rem;
    padding: .35rem .6rem;
    border: 1px solid hsl(var(--black) / 0.08);
    border-radius: .6rem;
    background: hsl(var(--white));
    text-decoration: none;
}

.ticket-thread__attachment:hover {
    background: hsl(var(--surface-2));
}

.ticket-thread__meta {
    color: hsl(var(--text-muted));
    font-size: .85rem;
}

.ticket-thread__actions .btn,
.ticket-thread__actions select {
    height: 40px;
}

[data-mode="dark"] .ticket-thread__timeline::before {
    background: hsl(var(--dark-border));
}

[data-mode="dark"] .ticket-thread__message {
    background: hsl(var(--dark-surface-deep));
    border-color: hsl(var(--dark-border));
}

[data-mode="dark"] .ticket-thread__message--admin {
    background: hsl(var(--dark-accent-surface));
    border-color: hsl(var(--dark-accent-border));
}

[data-mode="dark"] .ticket-thread__attachment {
    background: hsl(var(--dark-surface));
    border-color: hsl(var(--dark-border));
    color: hsl(var(--dark-text));
}

[data-mode="dark"] .ticket-thread__attachment:hover {
    background: hsl(var(--dark-surface-hover));
}

[data-mode="dark"] .ticket-thread__meta {
    color: hsl(var(--dark-text-muted));
}


/* report/notifications */

.notification-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.notification-list__item {
    border-left: 3px solid transparent;
    transition: 0.2s;
    margin-bottom: 0;
}

.notification-list__item:hover {
    background-color: hsl(var(--surface-2));
}

.notification-list__item.notification-list__item--unread {
    border-left-color: hsl(var(--primary));
    background-color: hsl(var(--primary) / 0.06);
}

.notification-list__icon {
    color: hsl(var(--primary));
    line-height: 1;
}


/* payment/list */

.payment-table__row--soft {
    background-color: hsl(var(--surface-2));
}

[data-mode="dark"] .payment-table__row--soft {
    background-color: hsl(var(--dark-surface));
}


/* =========================================================
   SHARED ADMIN MODIFIERS
   BEM modifiers replacing fixed inline declarations in Blade.
   ========================================================= */

.u-icon--xs {
    width: 11px;
    height: 11px;
}

.u-icon--sm {
    width: 13px;
    height: 13px;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.form-actions--compact {
    gap: 8px;
}

.form-actions--spaced {
    gap: 8px;
    margin-top: 16px;
}

.form-actions--tight-top {
    margin-top: 10px;
}

.form-actions--wrap {
    flex-wrap: wrap;
    gap: 8px;
}

.table__secondary-link {
    margin-left: 6px;
}

.table__code {
    font-size: 12px;
}

.table__column--reference {
    width: 140px;
}

.table__column--message {
    max-width: 220px;
}

.table__avatar--brand {
    background: hsl(var(--primary) / 0.12);
    color: hsl(var(--primary));
    font-size: 11px;
}

.table__image--method {
    width: 26px;
    height: 26px;
    border-radius: var(--r);
    object-fit: cover;
}

.table__image--gateway {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.table__image-frame {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    overflow: hidden;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface-2));
}

.table__image-fallback {
    place-items: center;
    color: hsl(var(--text-soft));
}

.table__image-fallback svg {
    width: 15px;
    height: 15px;
}

.badge--spaced {
    margin-right: 4px;
}

.btn--danger-outline {
    color: hsl(var(--danger));
    border-color: hsl(var(--danger) / 0.35);
}

.btn--danger-outline:hover,
.btn--danger-outline:focus-visible {
    color: hsl(var(--white));
    background: hsl(var(--danger));
    border-color: hsl(var(--danger));
}

.contact-message__body {
    white-space: pre-wrap;
    line-height: 1.7;
}

.empty--hidden {
    display: none;
}

.ticket-conversation__title {
    letter-spacing: 0;
}

.card--danger-outline {
    border-color: hsl(var(--danger) / 0.35);
}

.json-viewer {
    max-height: 50vh;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r);
    background: hsl(var(--surface-2));
}

.section-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 22px;
}

.section-edit-header__main {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

.section-edit-header__back {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: 1px solid hsl(var(--border));
    border-radius: 50%;
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
    color: hsl(var(--text-muted));
    transition: border-color var(--t), color var(--t), transform var(--t);
}

.section-edit-header__back:hover,
.section-edit-header__back:focus-visible {
    transform: translateX(-2px);
    border-color: hsl(var(--primary) / 0.35);
    color: hsl(var(--primary-hover));
}

.section-edit-header__back:focus-visible {
    outline: 3px solid hsl(var(--primary) / 0.14);
    outline-offset: 2px;
}

.section-edit-header__back svg {
    width: 17px;
    height: 17px;
}

.section-edit-header__eyebrow {
    display: block;
    margin-bottom: 4px;
    color: hsl(var(--primary));
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.section-edit-header h1 {
    overflow: hidden;
    margin: 0 0 4px;
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-edit-header__main p {
    margin: 0;
    color: hsl(var(--text-muted));
    font-size: 12px;
}

.section-edit-header__meta {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.section-edit-header__meta>span {
    display: grid;
    gap: 3px;
    min-width: 86px;
    padding: 3px 14px;
}

.section-edit-header__meta>span+span {
    border-left: 1px solid hsl(var(--border));
}

.section-edit-header__meta small {
    color: hsl(var(--text-soft));
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.section-edit-header__meta code {
    color: hsl(var(--primary-hover));
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}

.section-edit-header__meta strong {
    color: hsl(var(--text));
    font-size: 13px;
    font-weight: 600;
}

.section-editor-workspace {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.section-editor-outline {
    position: sticky;
    top: calc(var(--nav-h) + 18px);
    min-width: 0;
}

.section-editor-outline__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding: 0 8px;
}

.section-editor-outline__heading span {
    color: hsl(var(--text));
    font-size: 11px;
    font-weight: 600;
}

.section-editor-outline__heading small {
    color: hsl(var(--text-soft));
    font-size: 9px;
}

.section-editor-outline__nav {
    display: grid;
    gap: 2px;
}

.section-editor-outline__nav a {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    min-width: 0;
    padding: 9px 8px;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
    color: hsl(var(--text-muted));
    text-decoration: none;
    transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}

.section-editor-outline__nav a:hover,
.section-editor-outline__nav a:focus-visible,
.section-editor-outline__nav a.is-active {
    border-left-color: hsl(var(--primary));
    background: hsl(var(--primary) / 0.07);
    color: hsl(var(--primary-hover));
}

.section-editor-outline__nav a:focus-visible {
    outline: 0;
}

.section-editor-outline__nav svg {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    margin-top: 1px;
}

.section-editor-outline__nav a>span {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: hsl(var(--text));
    font-size: 10.5px;
    font-weight: 600;
}

.section-editor-outline__nav a small {
    overflow: hidden;
    color: hsl(var(--text-soft));
    font-size: 8.5px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-editor-outline__note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 16px 8px 0;
    padding-top: 14px;
    border-top: 1px solid hsl(var(--border));
    color: hsl(var(--text-soft));
    font-size: 9px;
    line-height: 1.5;
}

.section-editor-outline__note svg {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    margin-top: 1px;
    color: hsl(var(--primary));
}

.section-editor {
    overflow: hidden;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-lg);
    background: hsl(var(--surface));
    box-shadow: var(--shadow-xs);
}

.section-editor__masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 20px;
    border-bottom: 1px solid hsl(var(--border));
}

.section-editor__title {
    margin: 0;
    color: hsl(var(--text));
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.section-editor__subtitle {
    margin: 3px 0 0;
    color: hsl(var(--text-muted));
    font-size: 11.5px;
}

.section-editor__field-total {
    flex: 0 0 auto;
    color: hsl(var(--text-muted));
    font-size: 9.5px;
    font-weight: 600;
}

.section-editor__rows {
    display: block;
}

.section-editor__row {
    display: block;
    min-width: 0;
    border-bottom: 1px solid hsl(var(--border));
    scroll-margin-top: calc(var(--nav-h) + 18px);
}

.section-editor__row:last-child {
    border-bottom: 0;
}

.section-editor__field-info {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 23px 26px 0;
}

.section-editor__field-info>div {
    min-width: 0;
}

.section-editor__field-icon {
    display: grid;
    place-items: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    color: hsl(var(--primary));
}

.section-editor__field-icon svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.section-editor__label {
    display: block;
    margin: 1px 0 0;
    color: hsl(var(--text));
    font-size: 12px;
    font-weight: 600;
}

.section-editor__description {
    margin: 3px 0 0;
    color: hsl(var(--text-muted));
    font-size: 10.5px;
    line-height: 1.45;
}

.section-editor__recommendation {
    display: inline-block;
    margin-top: 5px;
    color: hsl(var(--primary-hover));
    font-size: 9.5px;
    font-weight: 600;
}

.section-editor__control {
    min-width: 0;
    padding: 13px 26px 24px 59px;
}

.section-editor__control>.input {
    min-height: 42px;
}

.section-editor__control>textarea.input {
    min-height: 118px;
    resize: vertical;
}

.section-editor__meta {
    margin-left: 5px;
    color: hsl(var(--text-muted));
    font-size: 10px;
    font-weight: 500;
}

.section-editor__group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.section-editor__group-field--wide {
    grid-column: 1 / -1;
}

.section-editor__preview {
    display: block;
    max-width: 100%;
    max-height: 110px;
    padding: 5px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r-sm);
    background: hsl(var(--surface));
    object-fit: contain;
}

.section-editor__preview--compact {
    width: 72px;
    height: 56px;
}

.section-editor__current-image {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: hsl(var(--text-muted));
    font-size: 10.5px;
}

.section-editor__hint {
    margin-top: 6px;
    color: hsl(var(--text-muted));
    font-size: 10.5px;
}

.repeater-container,
.repeater-items-list {
    min-width: 0;
}

.repeater-items-list:not(:empty) {
    display: grid;
    gap: 10px;
}

.repeater-item {
    overflow: hidden;
    border-left: 2px solid hsl(var(--primary) / 0.45);
    border-radius: 0 4px 4px 0;
    background: hsl(var(--surface-2) / 0.58);
}

.repeater-item__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 46px;
    padding: 7px 11px 7px 13px;
    border-bottom: 1px solid hsl(var(--border));
    background: transparent;
}

.repeater-item__header>div {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.repeater-item__index {
    color: hsl(var(--text-soft));
    font-family: var(--font-mono);
    font-size: 9px;
}

.repeater-item-title {
    color: hsl(var(--text));
    font-size: 11.5px;
    font-weight: 600;
}

.repeater-item__body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 14px;
}

.repeater-item__field--wide {
    grid-column: 1 / -1;
}

.repeater-container__add {
    margin-top: 10px;
}

.section-editor__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    padding: 13px 16px;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--surface));
}

.section-editor__actions>div {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 820px) {
    .section-edit-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
    .section-edit-header__meta {
        margin-left: 55px;
    }
    .section-editor-workspace {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .section-editor-outline {
        position: static;
        overflow: hidden;
    }
    .section-editor-outline__heading,
    .section-editor-outline__note {
        display: none;
    }
    .section-editor-outline__nav {
        display: flex;
        gap: 4px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }
    .section-editor-outline__nav a {
        align-items: center;
        flex: 0 0 auto;
        padding: 7px 9px;
        border-bottom: 2px solid transparent;
        border-left: 0;
        border-radius: 4px 4px 0 0;
    }
    .section-editor-outline__nav a:hover,
    .section-editor-outline__nav a:focus-visible,
    .section-editor-outline__nav a.is-active {
        border-bottom-color: hsl(var(--primary));
        border-left-color: transparent;
    }
    .section-editor-outline__nav a small {
        display: none;
    }
}

@media (max-width: 575px) {
    .section-edit-header__main {
        align-items: flex-start;
    }
    .section-edit-header h1 {
        font-size: 20px;
        white-space: normal;
    }
    .section-edit-header__meta {
        width: 100%;
        margin-left: 0;
    }
    .section-edit-header__meta>span {
        flex: 1 1 50%;
    }
    .section-editor__masthead,
    .section-editor__actions {
        padding-left: 14px;
        padding-right: 14px;
    }
    .section-editor__group,
    .repeater-item__body {
        grid-template-columns: 1fr;
    }
    .section-editor__group-field--wide,
    .repeater-item__field--wide {
        grid-column: auto;
    }
    .section-editor__actions {
        align-items: stretch;
        flex-direction: column;
    }
    .section-editor__actions>div {
        justify-content: flex-end;
    }
    .section-editor__field-info {
        padding: 20px 16px 0;
    }
    .section-editor__control {
        padding: 12px 16px 20px 49px;
    }
    .repeater-item__header .btn {
        width: 34px;
        padding-left: 0;
        padding-right: 0;
        overflow: hidden;
        color: transparent;
        gap: 0;
    }
    .repeater-item__header .btn .u-icon {
        color: hsl(var(--danger));
    }
}

.navbar-top__chevron {
    width: 14px;
    height: 14px;
    color: hsl(var(--text-muted));
}

.navbar-top__chevron--compact {
    width: 12px;
    height: 12px;
}

.navbar-top__language-check {
    width: 14px;
    height: 14px;
    margin-left: auto;
    color: hsl(var(--primary));
}

.navbar-top__profile-avatar--image {
    object-fit: cover;
}

.profile-summary__image,
.profile-summary__avatar {
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
    border-radius: 50%;
    object-fit: cover;
}


/* Shared admin component modules */

.provider-panel {
    margin-top: 20px;
    padding: 20px 24px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface-2));
}

.provider-panel__title {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid hsl(var(--border));
}

.admin-section-header {
    margin-bottom: 20px;
}

.admin-section-header+.admin-section-header,
.config-section .admin-section-header {
    margin-top: 0;
}

.config-item {
    padding: 14px 0;
    border-bottom: 1px solid hsl(var(--border));
}

.config-item:last-of-type {
    border-bottom: 0;
}

.config-item__row,
.config-item__info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.config-item__row {
    justify-content: space-between;
}

.config-item__media,
.config-item__icon {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    overflow: hidden;
    border: 1px solid hsl(var(--primary) / 0.2);
    border-radius: 4px;
    background: hsl(var(--primary) / 0.09);
    color: hsl(var(--primary));
}

.config-item__media,
.config-item__fallback,
.config-item__icon {
    place-items: center;
}

.config-item__media,
.config-item__icon {
    display: grid;
}

.config-item__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.config-item__fallback svg,
.config-item__icon svg {
    width: 21px;
    height: 21px;
}

.config-item__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.config-item__label {
    margin-bottom: 0;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.config-item__panel {
    margin-top: 14px;
    padding: 16px;
    border: 1px dashed hsl(var(--border-strong));
    border-radius: 4px;
    background: hsl(var(--surface-2));
}

.icon-picker .u-flex {
    flex-wrap: wrap;
}

.icon-picker__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r);
    background: hsl(var(--surface));
    font-size: 18px;
}

.icon-picker [data-icon-input] {
    flex: 1 1 220px;
}

.icon-picker__clear {
    color: hsl(var(--danger));
    border-color: hsl(var(--danger) / 0.35);
}

.icon-picker__search {
    margin-bottom: 10px;
}

.icon-picker__count {
    margin-bottom: 8px;
    font-size: 12px;
}

.icon-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
    max-height: 420px;
    overflow-y: auto;
}

.icon-picker__option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 10px 4px;
    overflow: hidden;
    border: 1px solid hsl(var(--border));
    border-radius: var(--r);
    background: hsl(var(--surface));
    color: inherit;
    cursor: pointer;
    font-size: 11px;
    transition: color var(--t), border-color var(--t), background var(--t);
}

.icon-picker__option:hover,
.icon-picker__option:focus-visible {
    border-color: hsl(var(--primary) / 0.45);
    background: hsl(var(--primary) / 0.08);
    color: hsl(var(--primary));
}

.icon-picker__option-icon {
    font-size: 18px;
}

.icon-picker__option-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-picker__option--hidden {
    display: none;
}

.profile-summary__avatar {
    font-size: 24px;
}

.profile-summary__stats {
    margin-top: 16px;
}

.media-tree__main--depth-0 {
    padding-left: 12px;
}

.media-tree__main--depth-1 {
    padding-left: 26px;
}

.media-tree__main--depth-2 {
    padding-left: 40px;
}

.media-tree__main--depth-3 {
    padding-left: 54px;
}

.media-tree__main--depth-4 {
    padding-left: 68px;
}

.media-tree__main--depth-5 {
    padding-left: 82px;
}

.media-tree__main--depth-6 {
    padding-left: 96px;
}

.media-selected {
    display: none;
}

.media-selected--visible {
    display: block;
}

.media-grid__cell--delay-0 {
    --media-delay-step: 0;
}

.media-grid__cell--delay-1 {
    --media-delay-step: 1;
}

.media-grid__cell--delay-2 {
    --media-delay-step: 2;
}

.media-grid__cell--delay-3 {
    --media-delay-step: 3;
}

.media-grid__cell--delay-4 {
    --media-delay-step: 4;
}

.media-grid__cell--delay-5 {
    --media-delay-step: 5;
}

.media-grid__cell--delay-6 {
    --media-delay-step: 6;
}

.media-grid__cell--delay-7 {
    --media-delay-step: 7;
}

.media-grid__cell--delay-8 {
    --media-delay-step: 8;
}

.media-grid__cell--delay-9 {
    --media-delay-step: 9;
}

.media-grid__cell--delay-10 {
    --media-delay-step: 10;
}

.media-grid__cell--delay-11 {
    --media-delay-step: 11;
}

.media-view__button--active {
    color: hsl(var(--white));
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
}


/* ==========================================================================
   Sidebar brand logo + dashboard spacing system
   One gap (--dash-gap) between every row and card, one inner padding (--dash-pad)
   for every card, and equal heights for cards in the same tier.
   ========================================================================== */

.workspace-brand__mark--image {
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 4px;
    object-fit: contain;
}

.workspace-brand__logo {
    display: block;
    max-width: 168px;
    max-height: 36px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: left center;
}

.sidebar .workspace-brand__logo {
    /* Light wordmarks disappear on the navy rail. The dark file is the swap target. */
    max-height: 32px;
}

.dashboard {
    --dash-gap: 20px;
    --dash-pad: 20px;
    gap: var(--dash-gap);
}

.dashboard-head {
    align-items: center;
    padding-bottom: 4px;
}

.dashboard-head__eyebrow { margin-bottom: 6px; }
.dashboard-head__description { margin-top: 6px; }

.dashboard-grid,
.dashboard-analytics,
.dashboard-main-grid { gap: var(--dash-gap); }

/* Cards: same padding, same icon, same type rhythm everywhere */
.metric-card,
.metric-card--compact {
    min-height: 118px;
    padding: var(--dash-pad);
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 16px;
}

.metric-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: hsl(var(--metric-accent) / 0.12);
    box-shadow: none;
}

.metric-card:hover .metric-card__icon {
    transform: none;
    background: hsl(var(--metric-accent) / 0.18);
}

.metric-card__icon svg { width: 18px; height: 18px; }
.metric-card__label { margin-bottom: 8px; font-size: 12.5px; }
.metric-card strong { margin-bottom: 6px; font-size: 1.625rem; }
.metric-card__meta, .metric-card__text { font-size: 12px; }
.metric-card__trend > span { border-radius: 4px; min-height: 22px; }

/* KPI tier: solid colour, no decorative ring, same height as the other tiers */
.dashboard-kpis .metric-card {
    min-height: 118px;
    padding: var(--dash-pad);
    box-shadow: none;
}

.dashboard-kpis .metric-card::after { display: none; }
.dashboard-kpis .metric-card__icon { border-radius: 4px; }

/* Card headers line up with the card padding */
.dashboard-card__header { padding: var(--dash-pad) var(--dash-pad) 0; }

/* Analytics: chart and finance summary share one height; finance rows split it evenly */
.dashboard-analytics--split { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.dashboard-analytics .chart-card__canvas { min-height: 320px; padding: 8px 12px 12px; }

.dashboard-analytics .dashboard-finance {
    grid-auto-rows: 1fr;
    padding: 0 var(--dash-pad);
    border-radius: var(--r-lg);
}

.dashboard-analytics .dashboard-finance .metric-card {
    min-height: 0;
    padding: 16px 0;
    align-items: center;
}

.dashboard-analytics .dashboard-finance .metric-card:hover { transform: none; box-shadow: none; }
.dashboard-analytics .dashboard-finance .metric-card strong { font-size: 1.375rem; margin-bottom: 4px; }
.dashboard-analytics .dashboard-finance .metric-card__label { margin-bottom: 6px; }

/* Insight charts: no tinted wash, tighter empty space */
.insight-chart-card {
    min-height: 0;
    background: hsl(var(--surface));
}

.insight-chart-card__heading h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight-chart-card__heading > div { min-width: 0; }
.insight-chart-card__canvas { height: 240px; padding: 8px 12px 16px; }

@media (max-width: 1199px) {
    .dashboard-analytics--split { grid-template-columns: minmax(0, 1fr); }
    .dashboard-analytics .dashboard-finance { grid-auto-rows: auto; padding: 0 var(--dash-pad); }
    .dashboard-analytics .dashboard-finance { column-gap: 32px; }
    .dashboard-analytics .dashboard-finance .metric-card:nth-child(2) { border-top: 0; }
}

@media (max-width: 767px) {
    .dashboard-analytics .dashboard-finance .metric-card:nth-child(2) { border-top: 1px solid hsl(var(--border)); }
}

@media (max-width: 767px) {
    .dashboard { --dash-gap: 14px; --dash-pad: 16px; }
    .metric-card, .metric-card--compact, .dashboard-kpis .metric-card { min-height: 108px; }
}


/* ==========================================================================
   Tables — clean, flat and calm
   White header with small muted labels, hairline row dividers, no zebra,
   and no hover or focus effects on rows.
   ========================================================================== */

.table {
    font-size: 13.5px;
    --bs-table-hover-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-accent-bg: transparent;
}

.table thead th {
    background: hsl(var(--surface));
    color: hsl(var(--text-muted));
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 14px 16px;
    border-bottom: 1px solid hsl(var(--border));
}

.table tbody td {
    padding: 15px 16px;
    background: hsl(var(--surface));
    border-bottom: 1px solid hsl(var(--border) / 0.6);
    transition: none;
}

.table thead th:first-child,
.table tbody td:first-child,
.table tfoot td:first-child,
.table tfoot th:first-child { padding-inline-start: 24px; }

.table thead th:last-child,
.table tbody td:last-child,
.table tfoot td:last-child,
.table tfoot th:last-child { padding-inline-end: 24px; }

/* No zebra and no row hover */
.table tbody tr:nth-child(even) > td,
.table tbody tr:hover > td,
.table tbody tr:focus-within > td,
.table-hover > tbody > tr:hover > *,
.table-striped > tbody > tr:nth-of-type(odd) > * {
    background: hsl(var(--surface));
    --bs-table-bg-state: transparent;
    --bs-table-accent-bg: transparent;
    box-shadow: none;
}

.table tbody tr,
.table tbody tr:hover { transform: none; }

.table tfoot td,
.table tfoot th {
    background: hsl(var(--surface));
    padding-block: 14px;
}

.table__user-name { font-weight: 600; }
.table__user-mail { margin-top: 2px; }

.table code,
.table__code {
    border: 0;
    background: hsl(var(--surface-2));
    border-radius: 4px;
}

.table--sm thead th { padding-block: 11px; }
.table--sm tbody td { padding-block: 11px; }


/* ==========================================================================
   Sidebar active state — quiet tint, accent icon, thin left bar.
   No gradient, glow or boxed icon tile.
   ========================================================================== */

.menu__link { border-radius: 4px; position: relative; }

.menu__icon-tile,
.menu__link:hover .menu__icon-tile,
.menu__link--current .menu__icon-tile,
.menu__link--active .menu__icon-tile,
.menu__link--active:hover .menu__icon-tile {
    background: transparent;
}

.menu__link--current .menu__icon-tile { color: hsl(var(--sb-text-strong)); }
.menu__link--current { color: hsl(var(--sb-text-strong)); }

.menu__link--active,
.menu__link--active:hover {
    background: hsl(var(--white) / 0.08);
    color: hsl(var(--white));
    font-weight: 600;
    box-shadow: none;
}

.menu__link--depth-0.menu__link--active::after {
    content: '';
    position: absolute;
    inset-inline-start: -12px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: hsl(var(--sb-accent));
}

.menu__link--active .menu__icon-tile,
.menu__link--active:hover .menu__icon-tile { color: hsl(var(--sb-accent)); }

.submenu .menu__link--active,
.submenu .menu__link--active:hover {
    background: transparent;
    color: hsl(var(--white));
}

.submenu .menu__link--active::before { box-shadow: none; }


/* ==========================================================================
   Navbar search (spotlight trigger) — a calm, wide field centred in the bar
   ========================================================================== */

.spotlight-trigger {
    flex: 0 1 440px;
    max-width: 440px;
    height: 40px;
    gap: 10px;
    padding: 0 8px 0 14px;
    margin-inline: auto;
    border: 1px solid transparent;
    border-radius: 4px;
    background: hsl(var(--surface-2));
    color: hsl(var(--text-soft));
    font-size: 13.5px;
    font-weight: 400;
    box-shadow: inset 0 0 0 1px hsl(var(--border) / 0.6);
}

.spotlight-trigger:hover {
    background: hsl(var(--surface-2));
    border-color: transparent;
    color: hsl(var(--text-muted));
    box-shadow: inset 0 0 0 1px hsl(var(--border-strong));
}

.spotlight-trigger:focus-visible {
    outline: 2px solid hsl(var(--primary) / 0.45);
    outline-offset: 2px;
}

.spotlight-trigger__icon {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    color: hsl(var(--text-soft));
    stroke-width: 2;
}

.spotlight-trigger__kbd {
    margin-inline-start: auto;
    padding: 3px 7px;
    border-radius: 4px;
    background: hsl(var(--surface));
    box-shadow: inset 0 0 0 1px hsl(var(--border));
    color: hsl(var(--text-muted));
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
}

/* Desktop: breadcrumb | search | actions as three columns, so the field stays centred */
@media (min-width: 1200px) {
    .navbar-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 440px) auto; }
    .navbar-top .workspace-context { margin-inline-end: 0; }
    .spotlight-trigger { width: 100%; max-width: none; margin-inline: 0; }
    .navbar-top .navbar-top__actions { margin-left: 0; justify-self: end; }
}

@media (max-width: 1199px) {
    .spotlight-trigger { flex: 1 1 auto; max-width: 360px; margin-inline: 0; }
}

@media (max-width: 768px) {
    .spotlight-trigger { flex: 0 0 38px; width: 38px; height: 38px; padding: 0; justify-content: center; }
}


/* ==========================================================================
   Dashboard widgets: one 4px radius for every card and everything inside it.
   Breadcrumb: tighter spacing.
   ========================================================================== */

.dashboard {
    --r-sm: 4px;
    --r: 4px;
    --r-lg: 4px;
    --r-xl: 4px;
}

.dashboard .dashboard-card,
.dashboard .metric-card,
.dashboard .dashboard-kpis .metric-card,
.dashboard .dashboard-finance,
.dashboard .metric-card__icon,
.dashboard .dashboard-kpis .metric-card__icon,
.dashboard .insight-chart-card__icon,
.dashboard .metric-card__trend > span,
.dashboard .dashboard-period,
.dashboard .dashboard-head__cron,
.dashboard .dashboard-btn {
    border-radius: 4px;
}

.dashboard-analytics .dashboard-finance .metric-card,
.dashboard-analytics .dashboard-finance .metric-card + .metric-card { border-radius: 0; }

.workspace-context { gap: 6px; }
.workspace-context > span[aria-hidden] { color: hsl(var(--text-soft)); }
.dashboard-head__eyebrow span { margin-inline: 4px; }

/* Dashboard header: same size and spacing as other admin page headers */
.app__content { padding: 24px 28px; }
.dashboard-head { min-height: 0; padding-bottom: 0; align-items: center; }
.dashboard-head h1 { font-size: 1.375rem; font-weight: 600; line-height: 1.25; }
.dashboard-head__description { margin: 3px 0 0; font-size: 13px; max-width: none; }
.dashboard-head__description span { margin-inline: 4px; color: hsl(var(--text-soft)); }
.dashboard-head__cron { min-height: 34px; padding: 6px 12px; }

@media (max-width: 767px) {
    .app__content { padding: 16px; }
}


/* ==========================================================================
   Dashboard widget icons: plain, small, monochrome — no tinted boxes.
   ========================================================================== */

.dashboard .metric-card { grid-template-columns: minmax(0, 1fr) 18px; }

.dashboard .metric-card__icon,
.dashboard .dashboard-kpis .metric-card__icon,
.dashboard .metric-card:hover .metric-card__icon {
    width: 18px;
    height: 18px;
    background: none;
    box-shadow: none;
    border-radius: 0;
    color: hsl(var(--text-soft));
    transform: none;
}

.dashboard .dashboard-kpis .metric-card__icon { color: rgb(255 255 255 / .6); }

.dashboard .metric-card__icon svg { width: 18px; height: 18px; stroke-width: 1.75; }

.dashboard .insight-chart-card__icon {
    width: auto;
    height: auto;
    flex: 0 0 auto;
    background: none;
    border: 0;
    color: hsl(var(--text-soft));
}

.dashboard .insight-chart-card__icon svg { width: 18px; height: 18px; stroke-width: 1.75; }


/* ==========================================================================
   Sidebar scrollbar: slim floating thumb, hidden until the sidebar is hovered.
   Chromium ignores ::-webkit-scrollbar when scrollbar-width/color are set, so
   those standard properties are only used where ::-webkit-scrollbar is unsupported (Firefox).
   ========================================================================== */

.sidebar__scroll {
    scrollbar-gutter: stable;
}

@supports selector(::-webkit-scrollbar) {
    .sidebar__scroll {
        scrollbar-width: auto;
        scrollbar-color: auto;
    }
}

.sidebar__scroll::-webkit-scrollbar { width: 8px; }
.sidebar__scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar__scroll::-webkit-scrollbar-button { display: none; height: 0; }

.sidebar__scroll::-webkit-scrollbar-thumb {
    background-color: transparent;
    border: 2px solid transparent;
    border-radius: 4px;
    background-clip: padding-box;
    min-height: 40px;
}

.sidebar:hover .sidebar__scroll::-webkit-scrollbar-thumb,
.sidebar__scroll:focus-within::-webkit-scrollbar-thumb {
    background-color: hsl(var(--white) / 0.14);
}

.sidebar__scroll::-webkit-scrollbar-thumb:hover,
.sidebar__scroll::-webkit-scrollbar-thumb:active {
    background-color: hsl(var(--white) / 0.28);
}

@supports not selector(::-webkit-scrollbar) {
    .sidebar__scroll { scrollbar-width: thin; scrollbar-color: transparent transparent; }
    .sidebar:hover .sidebar__scroll { scrollbar-color: hsl(var(--white) / 0.18) transparent; }
}


/* ==========================================================================
   Notification templates list
   ========================================================================== */

.templates-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.templates-filter {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: hsl(var(--surface-2));
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px hsl(var(--border) / 0.7);
}

.templates-filter__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 12px;
    border-radius: 3px;
    color: hsl(var(--text-muted));
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.templates-filter__item:hover { color: hsl(var(--text)); }

.templates-filter__item.is-active {
    background: hsl(var(--surface));
    color: hsl(var(--text));
    box-shadow: inset 0 0 0 1px hsl(var(--border));
}

.templates-filter__count {
    color: hsl(var(--text-soft));
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.templates-search {
    position: relative;
    width: min(320px, 100%);
}

.templates-search__icon {
    position: absolute;
    inset-inline-start: 12px;
    top: 50%;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    color: hsl(var(--text-soft));
    pointer-events: none;
}

.templates-search input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 36px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    color: hsl(var(--text));
    font-size: 13.5px;
}

.templates-search input:focus {
    outline: none;
    border-color: hsl(var(--primary) / 0.5);
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}

.templates-table__name a {
    color: hsl(var(--text));
    font-weight: 600;
    text-decoration: none;
}

.templates-table__name a:hover { color: hsl(var(--primary)); }

.templates-table__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.templates-table__meta code {
    padding: 0;
    min-height: 0;
    background: none;
    color: hsl(var(--text-soft));
    font-size: 11.5px;
}

.templates-table__audience {
    color: hsl(var(--text-muted));
    font-size: 11.5px;
    font-weight: 500;
}

.templates-table__audience::after {
    content: '·';
    margin-inline-start: 8px;
    color: hsl(var(--text-soft));
}

.templates-table__subject {
    color: hsl(var(--text-muted));
    max-width: 380px;
}

.templates-token {
    display: inline-block;
    padding: 0 5px;
    border-radius: 3px;
    background: hsl(var(--surface-2));
    box-shadow: inset 0 0 0 1px hsl(var(--border) / 0.8);
    color: hsl(var(--text));
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.6;
}

/* Channel on/off chips: a plain checkbox styled as a chip */
.channel-chips {
    display: inline-flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.channel-chip {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.channel-chip__input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.channel-chip__body {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px hsl(var(--border));
    color: hsl(var(--text-soft));
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    user-select: none;
}

.channel-chip__body svg { width: 14px; height: 14px; }

.channel-chip__input:checked + .channel-chip__body {
    background: hsl(var(--primary) / 0.08);
    box-shadow: inset 0 0 0 1px hsl(var(--primary) / 0.35);
    color: hsl(var(--primary));
}

.channel-chip__input:focus-visible + .channel-chip__body {
    outline: 2px solid hsl(var(--primary) / 0.5);
    outline-offset: 2px;
}

.channel-chip__input:disabled + .channel-chip__body { opacity: 0.55; cursor: progress; }

.templates-table__edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px hsl(var(--border));
    color: hsl(var(--text));
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
}

.templates-table__edit svg { width: 14px; height: 14px; }
.templates-table__edit:hover { color: hsl(var(--primary)); }

@media (max-width: 767px) {
    .templates-toolbar { align-items: stretch; }
    .templates-search { width: 100%; }
}


/* ==========================================================================
   Notification template editor
   ========================================================================== */

.template-editor__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.template-editor__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: hsl(var(--text-muted));
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.template-editor__back svg { width: 14px; height: 14px; }
.template-editor__back:hover { color: hsl(var(--primary)); }

.template-editor__head h1 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: hsl(var(--text));
}

.template-editor__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    color: hsl(var(--text-muted));
    font-size: 13px;
}

.template-editor__meta code {
    padding: 0;
    min-height: 0;
    background: none;
    border: 0;
    color: hsl(var(--text-soft));
    font-size: 12px;
}

.template-editor__meta span::after {
    content: '·';
    margin-inline-start: 10px;
    color: hsl(var(--text-soft));
}

.template-editor__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.template-editor__main { display: grid; gap: 20px; min-width: 0; }

.template-editor__side {
    position: sticky;
    top: calc(var(--nav-h, 64px) + 20px);
    min-width: 0;
}

.template-panel { margin: 0; overflow: hidden; }

.template-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 0 20px;
    border-bottom: 1px solid hsl(var(--border));
}

.template-panel__head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--text));
}

.template-panel__head--tabs { padding: 0 12px; align-items: stretch; }

.template-panel__aside { color: hsl(var(--text-soft)); font-size: 12px; }

.template-panel__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 20px; min-width: 0; }
.template-editor .tab-content, .template-editor .tab-pane { min-width: 0; }
.template-panel__body .form-group, .template-panel__body .mb-3 { margin-bottom: 0; }

.template-panel__body--split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.template-panel__body--flush { gap: 0; padding: 4px 0; }

.template-panel__hint {
    margin: -8px 0 0;
    color: hsl(var(--text-muted));
    font-size: 12.5px;
}

.template-panel__hint--split { display: flex; justify-content: space-between; gap: 12px; }
.template-counter { color: hsl(var(--text-soft)); font-variant-numeric: tabular-nums; white-space: nowrap; }
.template-panel__empty { margin: 0; padding: 16px 20px; color: hsl(var(--text-muted)); font-size: 13px; }

.input--mono { font-family: var(--font-mono); font-size: 12.5px; color: hsl(var(--text-muted)); }

/* Channel tabs (underline style) */
.template-tabs { display: flex; gap: 4px; }

.template-tabs__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: hsl(var(--text-muted));
    font-size: 13.5px;
    font-weight: 500;
}

.template-tabs__item svg { width: 16px; height: 16px; }
.template-tabs__item:hover { color: hsl(var(--text)); }

.template-tabs__item.active {
    color: hsl(var(--text));
    border-bottom-color: hsl(var(--primary));
}

/* "Send by …" row with an On/Off chip */
.template-channel-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-radius: 4px;
    background: hsl(var(--surface-2));
}

.template-channel-toggle strong { display: block; font-size: 13px; font-weight: 600; color: hsl(var(--text)); }
.template-channel-toggle span { display: block; margin-top: 2px; font-size: 12.5px; color: hsl(var(--text-muted)); }

.template-channel-toggle .channel-chip__body { min-width: 52px; justify-content: center; background: hsl(var(--surface)); }
.template-channel-toggle .channel-chip__body::after { content: attr(data-off); }
.template-channel-toggle .channel-chip__input:checked + .channel-chip__body::after { content: attr(data-on); }
.template-channel-toggle .channel-chip__input:checked + .channel-chip__body { background: hsl(var(--primary) / 0.08); }

/* Shortcodes: one row each, click to copy */
.template-shortcode {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 16px;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 20px;
    border: 0;
    border-top: 1px solid hsl(var(--border) / 0.6);
    background: none;
    text-align: start;
    color: hsl(var(--text-muted));
    font-size: 13px;
}

.template-shortcode:first-child { border-top: 0; }

.template-shortcode code {
    min-height: 0;
    padding: 1px 6px;
    border: 0;
    border-radius: 3px;
    background: hsl(var(--surface-2));
    box-shadow: inset 0 0 0 1px hsl(var(--border) / 0.8);
    color: hsl(var(--text));
    font-size: 12px;
}

.template-shortcode span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-shortcode svg { width: 15px; height: 15px; color: hsl(var(--text-soft)); }
.template-shortcode:hover svg { color: hsl(var(--primary)); }
.template-shortcode:hover code { box-shadow: inset 0 0 0 1px hsl(var(--primary) / 0.4); }

/* Preview */
.template-preview__subject {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 13px;
}

.template-preview__subject span { color: hsl(var(--text-soft)); font-size: 12px; }
.template-preview__subject strong { color: hsl(var(--text)); font-weight: 600; }

#template-preview-frame {
    display: block;
    width: 100%;
    height: calc(100vh - 250px);
    min-height: 460px;
    border: 0;
    background: hsl(var(--surface-2));
}

.template-preview__sms {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 360px;
    padding: 24px 20px;
    background: hsl(var(--surface-2));
}

.template-preview__sender {
    color: hsl(var(--text-muted));
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.template-preview__bubble {
    align-self: flex-start;
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 12px 12px 12px 4px;
    background: hsl(var(--surface));
    box-shadow: inset 0 0 0 1px hsl(var(--border));
    color: hsl(var(--text));
    font-size: 13.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 1199px) {
    .template-editor__grid { grid-template-columns: minmax(0, 1fr); }
    .template-editor__side { position: static; }
}

@media (max-width: 575px) {
    .template-panel__body--split { grid-template-columns: minmax(0, 1fr); }
    .template-panel__hint--split { flex-direction: column; }
}


/* ==========================================================================
   Payment gateways list: compact tiles
   ========================================================================== */

.gateway-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.gateway-tile {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 14px 14px 14px;
    border-radius: 4px;
    background: hsl(var(--surface));
    box-shadow: inset 0 0 0 1px hsl(var(--border));
}

.gateway-tile__logo {
    position: relative;
    display: grid;
    place-items: center;
    width: 56px;
    height: 40px;
    padding: 4px;
    border-radius: 4px;
    background: #fff;
    box-shadow: inset 0 0 0 1px hsl(var(--border) / 0.8);
    overflow: hidden;
}

.gateway-tile__logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gateway-tile__fallback { color: hsl(var(--text-soft)); }
.gateway-tile__fallback svg { width: 18px; height: 18px; }

.gateway-tile.is-off .gateway-tile__logo img { filter: grayscale(1); opacity: 0.6; }

.gateway-tile__body { min-width: 0; }

.gateway-tile__name {
    display: block;
    overflow: hidden;
    color: hsl(var(--text));
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gateway-tile__name:hover { color: hsl(var(--primary)); }

.gateway-tile__status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    color: hsl(var(--text-muted));
    font-size: 12.5px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: hsl(var(--text-soft) / 0.6);
    flex: 0 0 7px;
}

.status-dot--on { background: hsl(152 60% 42%); }

.gateway-tile__mode {
    margin-inline-start: 4px;
    padding: 0 6px;
    border-radius: 3px;
    background: hsl(38 92% 50% / 0.12);
    color: hsl(30 80% 36%);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.6;
}

.gateway-tile__actions { display: flex; align-items: center; gap: 4px; }

.gateway-tile .gateway-tile__toggle {
    min-height: 30px;
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 4px;
    background: none;
    box-shadow: none;
    color: hsl(var(--text-muted));
    font-size: 12.5px;
    font-weight: 500;
}

.gateway-tile .gateway-tile__toggle:hover { background: hsl(var(--surface-2)); color: hsl(var(--text)); }
.gateway-tile.is-off .gateway-tile__toggle { color: hsl(var(--primary)); }

.gateway-tile__edit {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    color: hsl(var(--text-muted));
}

.gateway-tile__edit svg { width: 17px; height: 17px; }
.gateway-tile__edit:hover { background: hsl(var(--surface-2)); color: hsl(var(--text)); }

.gateway-grid__empty { margin: 16px 0; color: hsl(var(--text-muted)); font-size: 13px; }


/* ==========================================================================
   Payment gateway editor
   ========================================================================== */

.u-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

.gateway-editor__title { display: flex; align-items: center; gap: 14px; }
.gateway-editor__title .gateway-tile__logo { width: 64px; height: 46px; }
.gateway-editor__title h1 { margin: 0; font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; color: hsl(var(--text)); }

.gateway-editor__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

.gateway-editor__side { display: grid; gap: 20px; min-width: 0; position: sticky; top: calc(var(--nav-h, 64px) + 20px); }

.gateway-editor__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gateway-editor__fields .form-group { margin: 0; }
.gateway-editor__limits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gateway-editor .form-group, .gateway-editor .mb-3 { margin-bottom: 0; }

.gateway-editor__add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 4px;
    background: none;
    color: hsl(var(--primary));
    font-size: 13px;
    font-weight: 500;
}

.gateway-editor__add svg { width: 15px; height: 15px; }
.gateway-editor__add:hover { background: hsl(var(--primary) / 0.08); }

/* Currency rows as a small table */
.gateway-currencies__head,
.gateway-currency-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 64px 36px;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
}

.gateway-currencies__head {
    height: 38px;
    color: hsl(var(--text-muted));
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid hsl(var(--border) / 0.6);
}

.gateway-currencies__head span:nth-child(3) { text-align: center; }

.gateway-currency-row { padding-block: 10px; border-bottom: 1px solid hsl(var(--border) / 0.6); }
.gateway-currency-row:last-child { border-bottom: 0; }
.gateway-currency-row .select2-container { width: 100% !important; }

.gateway-currency-row__default { display: grid; place-items: center; margin: 0; cursor: pointer; }
.gateway-currency-row__default input { width: 16px; height: 16px; accent-color: hsl(var(--primary)); cursor: pointer; }

.gateway-currency-row__remove {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 4px;
    background: none;
    color: hsl(var(--text-soft));
}

.gateway-currency-row__remove svg { width: 16px; height: 16px; }
.gateway-currency-row__remove:hover { background: hsl(0 80% 55% / 0.08); color: hsl(0 70% 48%); }

.gateway-editor__error { margin: 0; padding: 10px 20px; color: hsl(0 70% 48%); font-size: 13px; }

/* Input with a trailing unit */
.input-affix { position: relative; }
.input-affix .input { padding-inline-end: 52px; }

.input-affix span {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: hsl(var(--text-soft));
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
}

/* Live / Test choice */
.gateway-mode { display: grid; gap: 8px; }

.gateway-mode__option { position: relative; margin: 0; cursor: pointer; }

.gateway-mode__option input {
    position: absolute;
    top: 14px;
    inset-inline-start: 14px;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: hsl(var(--primary));
}

.gateway-mode__option > span {
    display: block;
    padding: 12px 14px 12px 40px;
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px hsl(var(--border));
}

.gateway-mode__option strong { display: block; font-size: 13.5px; font-weight: 600; color: hsl(var(--text)); }
.gateway-mode__option small { display: block; margin-top: 2px; font-size: 12.5px; color: hsl(var(--text-muted)); }

.gateway-mode__option input:checked + span {
    background: hsl(var(--primary) / 0.05);
    box-shadow: inset 0 0 0 1px hsl(var(--primary) / 0.45);
}

.gateway-mode__option input:focus-visible + span { outline: 2px solid hsl(var(--primary) / 0.5); outline-offset: 2px; }

@media (max-width: 1199px) {
    .gateway-editor__grid { grid-template-columns: minmax(0, 1fr); }
    .gateway-editor__side { position: static; }
}

@media (max-width: 767px) {
    .gateway-editor__fields, .gateway-editor__limits { grid-template-columns: minmax(0, 1fr); }
    .gateway-currencies__head, .gateway-currency-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px 32px; gap: 8px; padding-inline: 16px; }
}


/* ==========================================================================
   Form fields: calm at rest, crisp on focus.
   Quiet border at rest; on focus a sharp 2px brand-coloured edge (1px border +
   1px inset) with no glow, and the field's label darkens.
   ========================================================================== */

.input, .select, .textarea, .form-control, .form-select,
.templates-search input,
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border-color: hsl(var(--border));
    caret-color: hsl(var(--primary));
    transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.input:hover, .select:hover, .textarea:hover, .form-control:hover, .form-select:hover,
.templates-search input:hover,
.select2-container--default .select2-selection--single:hover,
.select2-container--default .select2-selection--multiple:hover {
    border-color: hsl(var(--border-strong));
}

.input:focus, .select:focus, .textarea:focus, .form-control:focus, .form-select:focus,
.templates-search input:focus,
[data-mode="dark"] .form-control:focus,
[data-mode="dark"] .form-select:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: inset 0 0 0 1px hsl(var(--primary));
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: hsl(var(--primary)) !important;
    box-shadow: inset 0 0 0 1px hsl(var(--primary));
}

.ck.ck-editor__editable.ck-focused,
.ck.ck-input:focus {
    border-color: hsl(var(--primary)) !important;
    box-shadow: inset 0 0 0 1px hsl(var(--primary)) !important;
}

.input:focus::placeholder, .textarea:focus::placeholder, .form-control:focus::placeholder {
    color: hsl(var(--text-soft) / 0.6);
}

/* Read-only and invalid keep their own look */
.input[readonly]:focus, .textarea[readonly]:focus {
    border-color: hsl(var(--border-strong));
    box-shadow: none;
}

.input.is-invalid:focus, .select.is-invalid:focus, .textarea.is-invalid:focus {
    border-color: hsl(var(--danger));
    box-shadow: inset 0 0 0 1px hsl(var(--danger));
}

/* The label of the field being edited darkens */
.form-label, .uploader__label { transition: color 140ms ease; }
.form-group:focus-within > .form-label,
.form-group:focus-within > label:first-child {
    color: hsl(var(--text));
}


/* ==========================================================================
   Blog post editor
   ========================================================================== */

.post-title-input {
    width: 100%;
    padding: 4px 0;
    border: 0;
    background: none;
    color: hsl(var(--text));
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.015em;
    outline: none;
    caret-color: hsl(var(--primary));
}

.post-title-input::placeholder { color: hsl(var(--text-soft) / 0.7); }

.post-slug {
    margin: 6px 0 0;
    overflow: hidden;
    color: hsl(var(--text-soft));
    font-family: var(--font-mono);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-slug span { color: hsl(var(--text-muted)); }

.post-lang-pane { min-width: 0; }
.post-lang-pane .ck.ck-editor__main > .ck-editor__editable { min-height: 420px; }

.post-seo-fields { display: grid; gap: 16px; }

.post-counter-label { display: flex; justify-content: space-between; align-items: baseline; }
.template-counter.is-over { color: hsl(30 80% 40%); }

.seo-preview {
    display: grid;
    gap: 3px;
    padding: 14px 16px;
    border-radius: 4px;
    background: hsl(var(--surface-2));
}

.seo-preview__url {
    overflow: hidden;
    color: hsl(var(--text-muted));
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seo-preview__title {
    overflow: hidden;
    color: hsl(221 70% 42%);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-mode="dark"] .seo-preview__title { color: hsl(221 85% 75%); }

.seo-preview__desc {
    display: -webkit-box;
    overflow: hidden;
    color: hsl(var(--text-muted));
    font-size: 13px;
    line-height: 1.5;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.post-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.post-actions .btn { justify-content: center; }

.post-editor-form .templates-filter__count { font-size: 11px; }


/* ==========================================================================
   Modals: quiet header, clear hierarchy, grey footer strip, soft entrance.
   Overlays keep one soft shadow so they separate from the page.
   ========================================================================== */

.modal-backdrop { background-color: hsl(222 47% 8%); }
.modal-backdrop.show { opacity: 0.5; }
.modal.show { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }

.modal-content,
[data-mode="dark"] .modal-content {
    border: 0;
    border-radius: 4px;
    background: hsl(var(--surface));
    box-shadow: 0 0 0 1px hsl(var(--border) / 0.6), 0 24px 48px -16px hsl(222 47% 8% / 0.35);
    overflow: hidden;
}

.modal.fade .modal-dialog {
    transform: translateY(8px) scale(0.98);
    transition: transform 180ms cubic-bezier(.2, .8, .2, 1), opacity 180ms ease;
    opacity: 0;
}

.modal.show .modal-dialog { transform: none; opacity: 1; }

.modal-header,
[data-mode="dark"] .modal-header {
    align-items: center;
    padding: 18px 20px 6px;
    border-bottom: 0;
    background: none;
    color: hsl(var(--text));
}

.modal-header.text-white { color: hsl(var(--text)) !important; }

.modal-title,
.modal-header .modal-title {
    margin: 0;
    color: hsl(var(--text));
    font-size: 16px !important;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 12px 20px 20px;
    color: hsl(var(--text-muted));
    font-size: 14px;
    line-height: 1.55;
}

.modal-footer,
[data-mode="dark"] .modal-footer {
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid hsl(var(--border) / 0.7);
    background: hsl(var(--surface-2));
}

.modal-footer > * { margin: 0; }
.modal-footer:empty { display: none; }

/* Close: a quiet square icon button */
.modal .btn-close {
    width: 32px;
    height: 32px;
    margin: -6px -8px -6px auto;
    padding: 0;
    border-radius: 4px;
    background-size: 11px;
    opacity: 0.5;
    box-shadow: none;
}

.modal .btn-close:hover { opacity: 0.9; background-color: hsl(var(--surface-2)); }
.modal .btn-close:focus { box-shadow: none; outline: 2px solid hsl(var(--primary) / 0.45); outline-offset: 1px; }
[data-mode="dark"] .modal .btn-close { filter: invert(1) grayscale(1); }

/* Confirmation dialog */
.modal-sm { --bs-modal-width: 420px; }

.confirm-modal__content { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; align-items: start; }
.confirm-modal__content p { margin: 7px 0 0; color: hsl(var(--text)); font-size: 14px; line-height: 1.5; }

.confirm-modal__icon {
    display: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
}

.confirm-modal__icon svg { width: 19px; height: 19px; }
.confirm-modal__icon--danger { background: hsl(0 80% 55% / 0.1); color: hsl(0 70% 48%); }
.confirm-modal__icon--primary { background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); }

.confirm-modal[data-tone="danger"] .confirm-modal__icon--danger,
.confirm-modal:not([data-tone="danger"]) .confirm-modal__icon--primary { display: grid; }

.confirm-modal .modal-body { padding-top: 14px; }


/* ==========================================================================
   Sidebar rhythm: one item height, one small gap, groups split by a hairline.
   Submenu line runs down from the centre of the parent icon; the dots sit on it
   and the child labels line up with the parent label.
   ========================================================================== */

.sidebar__scroll { padding: 12px 12px 20px; }

.menu__item { margin: 0; }
.menu__item + .menu__item { margin-top: 2px; }

.menu__link { min-height: 38px; padding-block: 4px; }
.menu__link--depth-0 { padding-inline: 4px 10px; }

.sidebar__scroll > .menu + .menu {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid hsl(var(--white) / 0.07);
}

/* Parent icon tile is 30px wide after 4px padding → its centre is 19px in. */
.submenu {
    margin: 2px 0 4px;
    margin-inline-start: 19px;
    padding-inline-start: 14px;
    border-inline-start: 1px solid hsl(var(--white) / 0.09);
}

.submenu .menu__item + .menu__item { margin-top: 1px; }

.submenu .menu__link {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 12.75px;
}

/* Dot centred on the line, which sits 14.5px left of the link box. */
.submenu .menu__link::before {
    inset-inline-start: -18px;
    width: 8px;
    height: 8px;
    border-width: 1.5px;
}


/* ==========================================================================
   Settings shell: grouped left menu + content panel
   ========================================================================== */

.settings-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.settings-nav {
    position: sticky;
    top: calc(var(--nav-h, 64px) + 24px);
    display: grid;
    gap: 18px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
}

.settings-nav__title {
    margin: 0;
    color: hsl(var(--text));
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.settings-nav__group { display: grid; gap: 1px; }

.settings-nav__label {
    margin: 0 0 4px;
    padding-inline: 10px;
    color: hsl(var(--text-soft));
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.settings-nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    padding: 0 10px;
    border-radius: 4px;
    color: hsl(var(--text-muted));
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
}

.settings-nav__link svg { width: 17px; height: 17px; flex: 0 0 17px; color: hsl(var(--text-soft)); }
.settings-nav__link:hover { background: hsl(var(--surface-2)); color: hsl(var(--text)); }

.settings-nav__link.is-active {
    background: hsl(var(--surface));
    box-shadow: inset 0 0 0 1px hsl(var(--border));
    color: hsl(var(--text));
    font-weight: 600;
}

.settings-nav__link.is-active svg { color: hsl(var(--primary)); }

.settings-shell__panel { min-width: 0; }

/* Settings page content: titled sections, label column + fields column */
.settings-head { margin-bottom: 8px; }
.settings-head h1 { margin: 0; font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; color: hsl(var(--text)); }
.settings-head p { margin: 4px 0 0; color: hsl(var(--text-muted)); font-size: 13.5px; }

.settings-form { display: grid; gap: 0; }

.settings-section {
    display: grid;
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
    gap: 32px;
    padding: 28px 0;
    border-bottom: 1px solid hsl(var(--border) / 0.8);
}

.settings-section__intro h2 { margin: 0; font-size: 14.5px; font-weight: 600; color: hsl(var(--text)); }
.settings-section__intro p { margin: 6px 0 0; color: hsl(var(--text-muted)); font-size: 13px; line-height: 1.55; }

.settings-section__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px;
    padding: 20px;
    border-radius: 4px;
    background: hsl(var(--surface));
    box-shadow: inset 0 0 0 1px hsl(var(--border));
    align-content: start;
}

.settings-section__fields .form-group { margin: 0; min-width: 0; }
.settings-section__full { grid-column: 1 / -1; }

/* URL prefix: base URL shown in front of the input */
.input-prefix {
    display: flex;
    align-items: stretch;
    border-radius: 4px;
}

.input-prefix > span {
    display: flex;
    align-items: center;
    max-width: 55%;
    padding: 0 10px;
    border: 1px solid hsl(var(--border));
    border-inline-end: 0;
    border-radius: 4px 0 0 4px;
    background: hsl(var(--surface-2));
    color: hsl(var(--text-soft));
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: rtl;
}

.input-prefix .input { border-radius: 0 4px 4px 0; min-width: 0; }

/* Branding uploaders */
.settings-branding { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settings-branding__item { min-width: 0; }
.settings-branding__item .uploader__preview,
.settings-branding__item .uploader__dropzone { min-height: 140px; }
.settings-branding__item .uploader__preview-img { max-height: 70px; object-fit: contain; }
.settings-branding__item--dark .uploader__preview { background: hsl(225 44% 13%); }

/* Save bar sticks to the bottom of the viewport while editing */
.settings-savebar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 4px;
    background: hsl(var(--surface));
    box-shadow: inset 0 0 0 1px hsl(var(--border)), 0 -8px 24px -12px hsl(222 47% 8% / 0.18);
}

.settings-savebar > span { color: hsl(var(--text-muted)); font-size: 13px; }

@media (max-width: 1199px) {
    .settings-section { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

@media (max-width: 991px) {
    .settings-shell { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .settings-nav { position: static; display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
    .settings-nav__title, .settings-nav__label { display: none; }
    .settings-nav__group { display: flex; gap: 4px; }
    .settings-nav__link { white-space: nowrap; }
}

@media (max-width: 767px) {
    .settings-section__fields, .settings-branding { grid-template-columns: minmax(0, 1fr); }
    .settings-savebar > span { display: none; }
}


/* ==========================================================================
   Notification settings: channel tabs, provider picker, provider fields
   ========================================================================== */

.settings-head--split {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.settings-head--split .templates-filter__item svg { width: 15px; height: 15px; }

.settings-section__fields--stack { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }

.provider-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    padding: 20px;
}

.provider-picker .form-group { margin: 0; }
.provider-picker__test { height: 40px; white-space: nowrap; }

/* Selected provider's fields sit under the picker, separated by a hairline */
.settings-section__fields--stack .provider-panel {
    margin: 0;
    padding: 20px;
    border: 0;
    border-top: 1px solid hsl(var(--border) / 0.8);
    border-radius: 0;
    background: hsl(var(--surface-2) / 0.5);
    box-shadow: none;
}

.settings-section__fields--stack .provider-panel__title {
    margin: 0 0 14px;
    color: hsl(var(--text));
    font-size: 13px;
    font-weight: 600;
}

.settings-section__fields--stack .provider-panel .text-muted { margin-top: -8px; font-size: 12.5px; }
.settings-section__fields--stack .provider-panel .row { --bs-gutter-x: 16px; --bs-gutter-y: 16px; row-gap: 16px; }
.settings-section__fields--stack .provider-panel .form-group { margin-bottom: 0; }
.settings-section__fields--stack .provider-panel .input { background: hsl(var(--surface)); }

@media (max-width: 575px) {
    .provider-picker { grid-template-columns: minmax(0, 1fr); }
}


/* ==========================================================================
   Dashboard login insights: ranked lists with thin bars
   ========================================================================== */

.insight-list { display: flex; flex-direction: column; padding: 20px; min-height: 0; }

.insight-list__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.insight-list__title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.insight-list__title svg { width: 17px; height: 17px; color: hsl(var(--text-soft)); flex: 0 0 17px; align-self: center; }
.insight-list__title h2 { margin: 0; font-size: 14px; font-weight: 600; color: hsl(var(--text)); }

.insight-list__meta { color: hsl(var(--text-soft)); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.insight-list__rows { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }

.insight-list__line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 13px;
}

.insight-list__name { overflow: hidden; color: hsl(var(--text)); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

.insight-list__value { color: hsl(var(--text)); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.insight-list__value small { margin-inline-start: 8px; color: hsl(var(--text-soft)); font-size: 12px; font-weight: 500; }

.insight-list__bar {
    display: block;
    height: 6px;
    border-radius: 3px;
    background: hsl(var(--surface-2));
    overflow: hidden;
}

.insight-list__bar > span { display: block; height: 100%; border-radius: 3px; background: hsl(var(--primary) / 0.75); }
.insight-list__row:nth-child(n+2) .insight-list__bar > span { background: hsl(var(--primary) / 0.45); }

.insight-list__empty { margin: auto 0; padding: 24px 0; color: hsl(var(--text-muted)); font-size: 13px; text-align: center; }


/* ==========================================================================
   Server information: health summary, key/value sections, permissions table
   ========================================================================== */

.server-page { display: grid; gap: 20px; }
.server-page .template-editor__head { margin-bottom: 0; }

.server-health { margin: 0; overflow: hidden; }

.server-health__summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid hsl(var(--border) / 0.8);
}

.server-health__summary > svg { width: 22px; height: 22px; flex: 0 0 22px; }
.server-health__summary strong { display: block; font-size: 15px; font-weight: 600; color: hsl(var(--text)); }
.server-health__summary span { display: block; margin-top: 1px; font-size: 12.5px; color: hsl(var(--text-muted)); }
.server-health__summary--ok > svg { color: hsl(152 60% 38%); }
.server-health__summary--warn > svg { color: hsl(30 85% 45%); }
.server-health__summary--bad > svg { color: hsl(0 70% 50%); }

.server-health__checks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }

.server-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 20px;
    min-width: 0;
}

.server-check + .server-check { border-inline-start: 1px solid hsl(var(--border) / 0.8); }

.server-check__state {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 50%;
}

.server-check__state svg { width: 13px; height: 13px; }
.server-check__state--ok { background: hsl(152 60% 42% / 0.14); color: hsl(152 60% 32%); }
.server-check__state--warn { background: hsl(38 92% 50% / 0.16); color: hsl(30 80% 36%); }
.server-check__state--bad { background: hsl(0 80% 55% / 0.12); color: hsl(0 70% 46%); }

.server-check__text { min-width: 0; }
.server-check__text strong { display: block; font-size: 13px; font-weight: 600; color: hsl(var(--text)); }
.server-check__text span { display: block; margin-top: 2px; overflow: hidden; color: hsl(var(--text-muted)); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }

.server-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.server-grid__wide { grid-column: 1 / -1; }

.server-grid__title { display: flex; align-items: center; gap: 8px; }
.server-grid__title svg { width: 16px; height: 16px; color: hsl(var(--text-soft)); }

.server-kv { margin: 0; padding: 4px 0; }

.server-kv__row {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: 16px;
    padding: 9px 20px;
    font-size: 13px;
}

.server-kv__row + .server-kv__row { border-top: 1px solid hsl(var(--border) / 0.55); }
.server-kv__row dt { color: hsl(var(--text-muted)); font-weight: 500; }

.server-kv__row dd {
    margin: 0;
    overflow: hidden;
    color: hsl(var(--text));
    font-weight: 500;
    text-align: end;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-kv__mono { font-family: var(--font-mono); font-size: 12px; color: hsl(var(--text-muted)); }

.server-kv__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
}

.server-kv__status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.server-kv__status--ok { color: hsl(152 60% 32%); }
.server-kv__status--off { color: hsl(var(--text-soft)); }
.server-kv__status--warn { color: hsl(30 80% 38%); }
.server-kv__status--bad { color: hsl(0 70% 46%); }

.server-perms td, .server-perms th { white-space: nowrap; }
.server-perms code { background: none; padding: 0; min-height: 0; color: hsl(var(--text)); font-size: 12.5px; }

@media (max-width: 1199px) {
    .server-health__checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .server-check + .server-check { border-inline-start: 0; }
    .server-check { border-top: 1px solid hsl(var(--border) / 0.6); }
    .server-grid { grid-template-columns: minmax(0, 1fr); }
}


/* ==========================================================================
   Notifications — jGrowl (assets/admin/js/notify.js)
   Flat card, coloured start edge per type, one soft shadow because it floats.
   ========================================================================== */

#jGrowl {
    position: fixed;
    z-index: 1090; /* above Bootstrap modals (1055) */
    width: 360px;
    max-width: calc(100vw - 24px);
    padding: 0;
    pointer-events: none;
}

#jGrowl.top-right {
    top: calc(var(--nav-h, 72px) + 12px);
    right: 16px;
    left: auto;
}

[dir="rtl"] #jGrowl.top-right {
    right: auto;
    left: 16px;
}

/* jGrowl always keeps an empty .jGrowl-notification spacer in the container — keep it invisible */
#jGrowl .jGrowl-notification:not(.lk-notify) {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
}

#jGrowl .jGrowl-notification.lk-notify {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 8px;
    padding: 12px 40px 12px 14px;
    border: 1px solid hsl(var(--border));
    border-inline-start: 3px solid hsl(var(--text-muted));
    border-radius: 4px;
    background: hsl(var(--surface));
    color: hsl(var(--text));
    box-shadow: 0 8px 24px -12px hsl(var(--shadow-ink) / 0.35);
    font-size: 13px;
    line-height: 1.45;
    text-align: start;
    pointer-events: auto;
}

#jGrowl .jGrowl-header:empty {
    display: none;
}

#jGrowl .jGrowl-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

#jGrowl .lk-notify__icon {
    display: grid;
    flex: 0 0 18px;
    place-items: center;
    margin-top: 1px;
}

#jGrowl .lk-notify__text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

#jGrowl .lk-notify__title {
    color: hsl(var(--text));
    font-size: 13.5px;
    font-weight: 600;
}

#jGrowl .lk-notify__message {
    color: hsl(var(--text-muted));
    overflow-wrap: anywhere;
}

#jGrowl .jGrowl-close {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: hsl(var(--text-muted));
    cursor: pointer;
    opacity: .7;
}

#jGrowl .jGrowl-close:hover {
    background: hsl(var(--surface-2, var(--border)));
    opacity: 1;
}

#jGrowl .jGrowl-close:focus-visible {
    outline: 2px solid hsl(var(--primary) / .5);
    outline-offset: 1px;
    opacity: 1;
}

#jGrowl .lk-notify--success { border-inline-start-color: hsl(var(--success)); }
#jGrowl .lk-notify--success .lk-notify__icon { color: hsl(var(--success)); }
#jGrowl .lk-notify--error { border-inline-start-color: hsl(var(--danger)); }
#jGrowl .lk-notify--error .lk-notify__icon { color: hsl(var(--danger)); }
#jGrowl .lk-notify--warning { border-inline-start-color: hsl(var(--warning)); }
#jGrowl .lk-notify--warning .lk-notify__icon { color: hsl(var(--warning)); }
#jGrowl .lk-notify--info { border-inline-start-color: hsl(var(--info)); }
#jGrowl .lk-notify--info .lk-notify__icon { color: hsl(var(--info)); }

@media (max-width: 575px) {
    #jGrowl.top-right {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    #jGrowl .jGrowl-notification {
        transition: none;
    }
}


/* =========================================================
   Media library (admin/media) — redesign
   Sidebar (library views + folder tree) | toolbar, selection
   bar, folder tiles, file grid / list. Flat, 4px radius,
   no shadows except the floating upload panel.
   ========================================================= */
.mlib {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.mlib__side,
.mlib__main {
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
}

/* ---- Sidebar ---- */
.mlib__side {
    position: sticky;
    top: calc(var(--nav-h) + 16px);
    max-height: calc(100vh - var(--nav-h) - 32px);
    overflow-y: auto;
    padding: 12px 8px;
    scrollbar-width: thin;
}

.mlib__nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid hsl(var(--border));
}

.mlib__side-label {
    padding: 0 10px;
    margin: 4px 0 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: hsl(var(--text-soft));
}

.mlib__nav .mlib__side-label:not(:first-child) {
    margin-top: 14px;
}

.mlib__nav-item,
.mlib-tree__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: hsl(var(--text));
    font-size: 13.5px;
    text-align: start;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
}

.mlib__nav-item:hover,
.mlib-tree__item:hover {
    background: hsl(var(--surface-2));
}

.mlib__nav-item:focus-visible,
.mlib-tree__item:focus-visible {
    outline: 2px solid hsl(var(--primary) / .45);
    outline-offset: -2px;
}

.mlib__nav-item--active,
.mlib__nav-item--active:hover,
.mlib-tree__item--active,
.mlib-tree__item--active:hover {
    background: hsl(var(--primary) / .08);
    color: hsl(var(--primary));
    font-weight: 500;
}

.mlib__nav-icon,
.mlib-tree__icon {
    flex: none;
    width: 16px;
    height: 16px;
    color: hsl(var(--text-muted));
}

.mlib__nav-item--active .mlib__nav-icon,
.mlib-tree__item--active .mlib-tree__icon {
    color: currentColor;
}

.mlib__side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline-end: 2px;
    margin-bottom: 4px;
}

.mlib__side-tools {
    display: inline-flex;
    gap: 2px;
}

.mlib-tree {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mlib-tree__item {
    padding-inline-start: calc(10px + var(--depth, 0) * 14px);
    padding-inline-end: 4px;
}

.mlib-tree__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mlib-tree__menu {
    flex: none;
}

.mlib-tree__more,
.mlib-more {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: hsl(var(--text-muted));
    cursor: pointer;
}

.mlib-tree__more svg,
.mlib-more svg {
    width: 16px;
    height: 16px;
}

.mlib-tree__more {
    opacity: 0;
}

.mlib-tree__item:hover .mlib-tree__more,
.mlib-tree__item:focus-within .mlib-tree__more,
.mlib-tree__more[aria-expanded="true"] {
    opacity: 1;
}

.mlib-tree__more:hover,
.mlib-more:hover,
.mlib-more[aria-expanded="true"] {
    background: hsl(var(--text) / .06);
    color: hsl(var(--text));
}

.mlib-tree__empty {
    padding: 6px 10px;
    font-size: 13px;
    color: hsl(var(--text-soft));
}

/* ---- Shared small controls ---- */
.mlib__icon-btn,
.mlib__tool-btn,
.mlib__seg-btn,
.mlib__bar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    color: hsl(var(--text));
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.mlib__icon-btn {
    width: 32px;
    padding: 0;
}

.mlib__side .mlib__icon-btn {
    width: 26px;
    height: 26px;
    border-color: transparent;
    background: transparent;
    color: hsl(var(--text-muted));
}

.mlib__icon-btn svg,
.mlib__tool-btn svg,
.mlib__seg-btn svg,
.mlib__bar-btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.mlib__icon-btn:hover:not(:disabled),
.mlib__tool-btn:hover,
.mlib__tool-btn[aria-expanded="true"],
.mlib__seg-btn:hover,
.mlib__bar-btn:hover {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
}

.mlib__side .mlib__icon-btn:hover:not(:disabled) {
    border-color: transparent;
    color: hsl(var(--text));
}

.mlib__icon-btn:disabled {
    opacity: .4;
    cursor: default;
}

.mlib__icon-btn:focus-visible,
.mlib__tool-btn:focus-visible,
.mlib__seg-btn:focus-visible,
.mlib__bar-btn:focus-visible {
    outline: 2px solid hsl(var(--primary) / .45);
    outline-offset: 1px;
}

/* ---- Main panel ---- */
.mlib__main {
    position: relative;
    min-width: 0;
    min-height: 520px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.mlib__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.mlib__crumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 260px;
}

.mlib__trail {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}

.mlib__crumb {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 220px;
    padding: 4px 6px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: hsl(var(--text-muted));
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.mlib__crumb:hover {
    background: hsl(var(--surface-2));
    color: hsl(var(--text));
}

.mlib__crumb--current,
.mlib__crumb--current:hover {
    background: transparent;
    color: hsl(var(--text));
    font-size: 15px;
    font-weight: 600;
    cursor: default;
}

.mlib__crumb-sep {
    flex: none;
    width: 14px;
    height: 14px;
    color: hsl(var(--text-soft));
}

.mlib__tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mlib__search {
    position: relative;
    display: block;
    margin: 0;
}

.mlib__search-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 10px;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    color: hsl(var(--text-soft));
    pointer-events: none;
}

.mlib__search-input {
    width: 240px;
    height: 32px;
    padding: 0 10px 0 32px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    color: hsl(var(--text));
    font-size: 13px;
}

.mlib__search-input::placeholder {
    color: hsl(var(--text-soft));
}

.mlib__search-input:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / .12);
}

.mlib__seg {
    display: inline-flex;
}

.mlib__seg-btn {
    width: 32px;
    padding: 0;
    color: hsl(var(--text-muted));
}

.mlib__seg-btn:first-child {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}

.mlib__seg-btn + .mlib__seg-btn {
    margin-inline-start: -1px;
    border-start-start-radius: 0;
    border-end-start-radius: 0;
}

.mlib__seg-btn--active,
.mlib__seg-btn--active:hover {
    position: relative;
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
    color: hsl(var(--text));
}

/* Count / selection bar */
.mlib__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 12px 0 14px;
    padding: 6px 8px 6px 10px;
    border-radius: 4px;
    background: hsl(var(--surface-2));
}

.mlib__bar--selecting {
    background: hsl(var(--primary) / .08);
}

.mlib__count {
    font-size: 13px;
    color: hsl(var(--text-muted));
}

.mlib__bar--selecting .mlib__count {
    color: hsl(var(--primary));
    font-weight: 600;
}

.mlib__bar-actions {
    display: flex;
    gap: 6px;
    margin-inline-start: auto;
}

.mlib__bar [data-when="selecting"] {
    display: none;
}

.mlib__bar--selecting [data-when="selecting"]:not(.d-none) {
    display: inline-flex;
}

.mlib__bar--selecting [data-when="idle"] {
    display: none;
}

.mlib__bar-btn {
    height: 30px;
}

.mlib__bar-btn--danger {
    color: hsl(var(--danger));
}

.mlib__bar-btn--danger:hover {
    border-color: hsl(var(--danger) / .45);
    background: hsl(var(--danger) / .06);
}

/* Checkboxes */
.mlib__check {
    display: inline-grid;
    place-items: center;
    margin: 0;
    cursor: pointer;
}

.mlib__check-input {
    appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    border: 1.5px solid hsl(var(--border-strong));
    border-radius: 3px;
    background: hsl(var(--surface)) no-repeat center / 10px 10px;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}

.mlib__check-input:hover {
    border-color: hsl(var(--primary));
}

.mlib__check-input:checked,
.mlib__check-input:indeterminate {
    border-color: hsl(var(--primary));
    background-color: hsl(var(--primary));
}

.mlib__check-input:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.2 5 8.5l4.5-5'/%3E%3C/svg%3E");
}

.mlib__check-input:indeterminate {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 6h6'/%3E%3C/svg%3E");
}

.mlib__check-input:focus-visible {
    outline: 2px solid hsl(var(--primary) / .45);
    outline-offset: 2px;
}

.mlib__check-input:disabled {
    opacity: .4;
    cursor: default;
}

/* ---- Folder tiles ---- */
.mlib-folders {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.mlib-folders:not(:empty) {
    margin-bottom: 18px;
}

.mlib-folder {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    color: hsl(var(--text));
    font-size: 13.5px;
    font-weight: 500;
    text-align: start;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}

.mlib-folder:hover {
    background: hsl(var(--surface-2));
    border-color: hsl(var(--border-strong));
}

.mlib-folder:focus-visible {
    outline: 2px solid hsl(var(--primary) / .45);
    outline-offset: 1px;
}

.mlib-folder__icon {
    flex: none;
    width: 18px;
    height: 18px;
    color: hsl(var(--warning));
}

.mlib-folder__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- File grid ---- */
.mlib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    gap: 14px;
    transition: opacity .15s ease;
}

.mlib__main--loading .mlib-grid,
.mlib__main--loading .mlib-folders {
    opacity: .55;
    pointer-events: none;
}

.mlib-card {
    position: relative;
    min-width: 0;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    transition: border-color .12s ease;
}

.mlib-card:hover {
    border-color: hsl(var(--border-strong));
}

.mlib-card.is-selected {
    border-color: hsl(var(--primary));
    outline: 1px solid hsl(var(--primary));
}

.mlib-card__thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 3px 3px 0 0;
    background: hsl(var(--surface-2));
    overflow: hidden;
}

.mlib-card__media {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

button.mlib-card__media {
    cursor: pointer;
}

.mlib-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mlib-card__check,
.mlib-card__fav {
    position: absolute;
    top: 8px;
    opacity: 0;
    transition: opacity .12s ease;
}

.mlib-card__check {
    inset-inline-start: 8px;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: hsl(var(--surface) / .92);
}

.mlib-card__fav {
    inset-inline-end: 8px;
}

.mlib-card:hover .mlib-card__check,
.mlib-card:hover .mlib-card__fav,
.mlib-card:focus-within .mlib-card__check,
.mlib-card:focus-within .mlib-card__fav,
.mlib-grid--selecting .mlib-card__check,
.mlib-card.is-selected .mlib-card__check,
.mlib-card__fav.mlib-fav--active {
    opacity: 1;
}

.mlib-grid--selecting .mlib-card,
.mlib-grid--selecting .mlib-card__media,
.mlib-grid--selecting .mlib-row {
    cursor: pointer;
}

.mlib-fav {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: hsl(var(--text-soft));
    cursor: pointer;
}

.mlib-card__fav {
    background: hsl(var(--surface) / .92);
    color: hsl(var(--text-muted));
}

.mlib-fav svg {
    width: 15px;
    height: 15px;
}

.mlib-fav:hover {
    color: hsl(var(--text));
}

.mlib-fav--active,
.mlib-fav--active:hover {
    color: hsl(var(--warning));
}

.mlib-card__body {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 4px 8px 10px;
}

.mlib-card__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: start;
    cursor: pointer;
}

.mlib-card__name {
    font-size: 13px;
    font-weight: 500;
    color: hsl(var(--text));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mlib-card__meta {
    font-size: 12px;
    color: hsl(var(--text-soft));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mlib-menu {
    flex: none;
}

/* File-type tile (non-images) */
.mlib-file {
    --kind: var(--text-muted);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    color: hsl(var(--kind));
}

.mlib-file svg {
    width: 34px;
    height: 34px;
}

.mlib-file__ext {
    padding: 1px 6px;
    border-radius: 3px;
    background: hsl(var(--kind) / .1);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .04em;
}

.mlib-file--video { --kind: 262 52% 52%; }
.mlib-file--audio { --kind: 330 55% 50%; }
.mlib-file--pdf { --kind: var(--danger); }
.mlib-file--word { --kind: 214 70% 48%; }
.mlib-file--sheet { --kind: var(--success); }
.mlib-file--slides { --kind: 24 85% 50%; }
.mlib-file--archive { --kind: 35 60% 42%; }
.mlib-file--code { --kind: 190 70% 36%; }

.mlib-file--sm {
    flex-direction: row;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: hsl(var(--kind) / .1);
}

.mlib-file--sm svg {
    width: 18px;
    height: 18px;
}

.mlib-file--sm .mlib-file__ext {
    display: none;
}

.mlib-file--lg {
    min-height: 260px;
}

.mlib-file--lg svg {
    width: 56px;
    height: 56px;
}

/* ---- List view ---- */
.mlib-grid--list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mlib-row {
    display: grid;
    grid-template-columns: 24px 36px minmax(0, 1fr) 80px 90px 120px 30px 30px;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 6px 8px;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 13px;
    color: hsl(var(--text-muted));
}

.mlib-row.is-selected {
    background: hsl(var(--primary) / .06);
}

.mlib-row--head {
    min-height: 34px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: hsl(var(--text-soft));
}

.mlib-row__thumb {
    display: block;
    width: 36px;
    height: 36px;
}

.mlib-row__img {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    display: block;
    background: hsl(var(--surface-2));
}

.mlib-row__name {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: hsl(var(--text));
    font-weight: 500;
    text-align: start;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.mlib-row__name:hover {
    color: hsl(var(--primary));
}

/* ---- Empty states ---- */
.mlib-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    padding: 40px 20px;
    border-radius: 4px;
    text-align: center;
}

.mlib-empty--drop {
    border: 1.5px dashed hsl(var(--border-strong));
}

.mlib-empty__icon {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 14px;
    border-radius: 4px;
    background: hsl(var(--surface-2));
    color: hsl(var(--text-muted));
}

.mlib-empty__icon svg {
    width: 26px;
    height: 26px;
}

.mlib-empty__title {
    font-size: 15px;
    font-weight: 600;
    color: hsl(var(--text));
}

.mlib-empty__text {
    max-width: 360px;
    margin: 6px 0 0;
    font-size: 13.5px;
    color: hsl(var(--text-muted));
}

.mlib-empty__actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

.mlib-note {
    grid-column: 1 / -1;
    padding: 18px 0;
    font-size: 13px;
    color: hsl(var(--text-soft));
}

/* ---- Pagination ---- */
.mlib__pager:not(:empty) {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.mlib-pager {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mlib-pager__btn {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--surface));
    color: hsl(var(--text));
    font-size: 13px;
    cursor: pointer;
}

.mlib-pager__btn svg {
    width: 15px;
    height: 15px;
}

.mlib-pager__btn:hover:not(:disabled) {
    background: hsl(var(--surface-2));
}

.mlib-pager__btn--active,
.mlib-pager__btn--active:hover {
    border-color: hsl(var(--primary));
    background: hsl(var(--primary));
    color: #fff;
    cursor: default;
}

.mlib-pager__btn:disabled {
    opacity: .4;
    cursor: default;
}

.mlib-pager__gap {
    padding: 0 4px;
    color: hsl(var(--text-soft));
}

/* ---- Drag-and-drop overlay ---- */
.mlib__drop {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    padding: 10px;
    border-radius: 4px;
    background: hsl(var(--surface) / .9);
    pointer-events: none;
}

.mlib__main--dragging .mlib__drop {
    display: block;
}

.mlib__drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
    border: 2px dashed hsl(var(--primary));
    border-radius: 4px;
    background: hsl(var(--primary) / .04);
    color: hsl(var(--text-muted));
    font-size: 13.5px;
}

.mlib__drop-inner svg {
    width: 36px;
    height: 36px;
    color: hsl(var(--primary));
}

.mlib__drop-inner strong {
    font-size: 16px;
    color: hsl(var(--text));
}

.mlib__drop-dest {
    font-weight: 600;
    color: hsl(var(--text));
}

/* ---- Upload modal ---- */
.mlib-upload-dest {
    margin: 0 0 12px;
    font-size: 13px;
    color: hsl(var(--text-muted));
}

.mlib-upload-dest__name {
    color: hsl(var(--text));
}

#mediaUploaderModal .media-dropzone {
    padding: 32px 18px;
    border: 1.5px dashed hsl(var(--border-strong));
    background: hsl(var(--surface-2));
    text-align: center;
    transition: border-color .12s ease, background-color .12s ease;
}

#mediaUploaderModal .media-dropzone--drag {
    border-color: hsl(var(--primary));
    background: hsl(var(--primary) / .05);
}

#mediaUploaderModal .media-dropzone__icon svg {
    width: 32px;
    height: 32px;
    color: hsl(var(--text-muted));
}

#mediaUploaderModal .media-dropzone__title {
    margin-top: 8px;
    font-size: 15px;
    font-weight: 600;
    color: hsl(var(--text));
}

#mediaUploaderModal .media-dropzone__sub {
    margin: 2px 0 14px;
    font-size: 13px;
    color: hsl(var(--text-muted));
}

#mediaUploaderModal .media-dropzone__actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.media-selected--visible {
    margin-top: 14px;
}

.media-selected__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.media-selected__title {
    font-size: 13px;
    font-weight: 600;
    color: hsl(var(--text));
}

#mediaSelectedWrap .media-selected__list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
}

#mediaSelectedWrap .media-selected__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 10px;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 13px;
}

#mediaSelectedWrap .media-selected__row:last-child {
    border-bottom: 0;
}

#mediaSelectedWrap .media-selected__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: hsl(var(--text));
}

#mediaSelectedWrap .media-selected__size {
    flex: none;
    color: hsl(var(--text-soft));
}

.media-selected__more {
    padding: 7px 10px;
    font-size: 12.5px;
    color: hsl(var(--text-soft));
}

/* Details preview placeholder */
#media-details-preview .mlib-file {
    border-radius: 4px;
    background: hsl(var(--surface-2));
}

/* Floating upload progress panel: one soft shadow, since it overlays content. */
.media-upload__panel {
    border-radius: 4px;
    box-shadow: 0 8px 24px hsl(222 47% 11% / .12);
}

/* ---- Responsive ---- */
@media (max-width: 1199px) {
    .mlib__search-input {
        width: 180px;
    }
}

@media (max-width: 991px) {
    .mlib {
        grid-template-columns: minmax(0, 1fr);
    }

    .mlib__side {
        position: static;
        max-height: none;
        padding: 10px;
    }

    .mlib__nav {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 4px;
        scrollbar-width: none;
    }

    .mlib__nav::-webkit-scrollbar {
        display: none;
    }

    .mlib__nav .mlib__side-label {
        display: none;
    }

    .mlib__nav-item {
        flex: none;
        width: auto;
        border: 1px solid hsl(var(--border));
    }

    .mlib__nav-item--active {
        border-color: hsl(var(--primary) / .35);
    }

    .mlib-tree {
        max-height: 200px;
        overflow-y: auto;
    }

    .mlib-tree__more {
        opacity: 1;
    }
}

@media (max-width: 767px) {
    .mlib__main {
        padding: 12px;
        min-height: 0;
    }

    .mlib__tools {
        width: 100%;
    }

    .mlib__search {
        flex: 1;
    }

    .mlib__search-input {
        width: 100%;
    }

    .mlib-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .mlib-folders {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mlib-card__check,
    .mlib-card__fav {
        opacity: 1;
    }

    .mlib-row {
        grid-template-columns: 24px 36px minmax(0, 1fr) 30px 30px;
    }

    .mlib-row__col-type,
    .mlib-row__col-size,
    .mlib-row__col-date,
    .mlib-row--head {
        display: none;
    }

    .mlib__bar {
        flex-wrap: wrap;
    }

    .mlib__bar-btn {
        font-size: 12.5px;
        padding: 0 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mlib *,
    .mlib-grid {
        transition: none !important;
    }
}

/* Phone widths: keep the document from scrolling sideways. Tables scroll inside their card. */
html { overflow-x: clip; }
body { max-width: 100%; }
.app, .app__main, .app__content, .auth, .auth-shell, .auth-pane, .auth-pane__inner { min-width: 0; max-width: 100%; }
img, svg, video, canvas, iframe { max-width: 100%; }
input, select, textarea, .input { max-width: 100%; }
pre, code, .table-wrap, .table-scroll, .table-responsive { max-width: 100%; }
.modal-dialog { width: calc(100% - 24px); max-width: min(560px, calc(100vw - 24px)); margin-left: auto; margin-right: auto; }

@media (max-width: 1024px) {
    .card, .table-wrap, .table-scroll, .page-header, .app__content {
        max-width: 100%;
        min-width: 0;
    }
    .table-wrap { overflow: hidden; }
    .table-scroll { width: 100%; overflow-x: auto; }
}

@media (max-width: 720px) {
    .app__content [style*="grid-template-columns"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .app__content [style*="display:flex"] {
        flex-wrap: wrap !important;
    }
    .app__content [style*="display:flex"] > * {
        min-width: 0;
        max-width: 100%;
    }
}
.page-header, .page-header__title, .card, .card__header { min-width: 0; max-width: 100%; }
.page-header__title, .auth-head__title, h1, h2, h3 { overflow-wrap: break-word; }

@media (max-width: 1100px) {
    .app__content { overflow-x: auto; }
}

@media (max-width: 420px) {
    .auth-pane { padding: 24px 16px 40px; }
    .auth-brand { padding: 14px 16px; gap: 12px; }
    .auth-brand__logo { max-width: 46vw; }
    .auth-form__row { align-items: flex-start; }
    .navbar-top { min-width: 0; }
}

.demo-login {
    display: grid;
    gap: 10px;
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid hsl(var(--primary) / 0.35);
    border-radius: 12px;
    background: hsl(var(--primary) / 0.08);
}
.demo-login p { margin: 0; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.demo-login__btn { justify-self: start; white-space: nowrap; }
