:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #172033;
    --muted: #687386;
    --line: #dce3ec;
    --primary: #1167d8;
    --primary-strong: #0b4fa8;
    --nav: #111827;
    --nav-muted: #97a3b6;
    --green: #198754;
    --amber: #b7791f;
    --red: #c24135;
    --blue: #1f65d6;
    --shadow: 0 16px 36px rgba(17, 24, 39, 0.08);
}

[data-theme="dark"] {
    --bg: #0e1420;
    --surface: #151d2b;
    --surface-soft: #1b2535;
    --ink: #e7edf7;
    --muted: #9aa8bd;
    --line: #293548;
    --primary: #4f8ff7;
    --primary-strong: #80adff;
    --nav: #0a101b;
    --nav-muted: #8c98aa;
    --shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    --sidebar-width: 280px;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100dvh;
    background: linear-gradient(to right, var(--nav) 0 var(--sidebar-width), var(--bg) var(--sidebar-width) 100%);
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 18px;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    align-self: start;
    width: var(--sidebar-width);
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    padding: 22px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: var(--nav);
    color: #d8dee9;
    z-index: 20;
}

.sidebar-brand {
    display: block;
    margin-bottom: 24px;
    color: #fff;
}

.brand-logo {
    display: block;
    object-fit: contain;
}

.brand-logo-sidebar {
    width: 100%;
    max-width: 224px;
    height: auto;
    margin: -8px auto 0;
    border-radius: 8px;
}

.brand-logo-auth {
    width: min(260px, 100%);
    height: auto;
    margin: -4px auto 12px;
    border-radius: 8px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 18px;
}

.auth-brand .eyebrow {
    margin-bottom: 4px !important;
}

.auth-brand h1 {
    font-size: 30px;
    line-height: 1.1;
}

.brand-mark {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    flex: 0 0 40px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.brand-title {
    display: block;
    font-weight: 800;
    line-height: 1.1;
}

.brand-subtitle {
    display: block;
    color: var(--nav-muted);
    font-size: 12px;
}

.sidebar-section {
    margin: 18px 0 8px;
    color: var(--nav-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 4px 0 16px;
}

.sidebar-search > i {
    position: absolute;
    left: 13px;
    color: #7f91a9;
    pointer-events: none;
}

.sidebar-search input {
    width: 100%;
    min-height: 40px;
    padding: 8px 42px 8px 38px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 10px;
    outline: none;
    background: rgba(255, 255, 255, .045);
    color: #eef4ff;
    font: inherit;
}

.sidebar-search input::placeholder {
    color: #7f91a9;
}

.sidebar-search input:focus {
    border-color: rgba(78, 145, 246, .55);
    background: rgba(255, 255, 255, .07);
    box-shadow: 0 0 0 3px rgba(30, 112, 227, .14);
}

.sidebar-search kbd {
    position: absolute;
    right: 10px;
    padding: 2px 7px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 6px;
    background: rgba(255, 255, 255, .06);
    color: #8ea3bf;
    font-size: 11px;
    pointer-events: none;
}

.sidebar-search-empty {
    margin: -4px 4px 14px;
    color: #8ea3bf;
    font-size: 12px;
}

.sidebar-link[hidden],
.sidebar-section[hidden],
.sidebar-search-empty[hidden] {
    display: none !important;
}

.sidebar-subsection {
    margin: 14px 10px 5px;
    color: #60738e;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sidebar-subsection[hidden] {
    display: none !important;
}

.sidebar-group[hidden],
.sidebar-group-menu[hidden] {
    display: none !important;
}

.sidebar-group {
    margin: 3px 0;
}

.sidebar-group-toggle {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #b8c4d5;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
}

.sidebar-group-toggle > span {
    display: flex;
    align-items: center;
    gap: 11px;
}

.sidebar-group-toggle > span > i {
    width: 20px;
    color: #8295ae;
    font-size: 15px;
    text-align: center;
}

.sidebar-group-toggle:hover,
.sidebar-group-toggle[aria-expanded="true"] {
    border-color: rgba(255, 255, 255, .055);
    background: rgba(255, 255, 255, .055);
    color: #fff;
}

.sidebar-group-chevron {
    color: #70849f;
    font-size: 12px;
    transition: transform .16s ease;
}

.sidebar-group-toggle[aria-expanded="true"] .sidebar-group-chevron {
    transform: rotate(180deg);
}

.sidebar-group-menu {
    margin: 3px 0 7px 10px;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, .075);
}

.sidebar-group-menu .sidebar-link {
    min-height: 38px;
    font-size: 13px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 40px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #d8dee9;
    font-size: 14px;
}

.sidebar-link i {
    width: 20px;
    color: var(--nav-muted);
    font-size: 17px;
}

.sidebar-link:hover,
.sidebar-link.is-active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-link:hover i,
.sidebar-link.is-active i {
    color: #fff;
}

.app-main {
    grid-column: 2;
    min-width: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1101px) {
    .app-shell,
    .app-sidebar,
    .app-main {
        transition: grid-template-columns .2s ease, transform .2s ease, background .2s ease;
    }

    body.sidebar-collapsed .app-shell {
        grid-template-columns: 0 minmax(0, 1fr);
        background: var(--bg);
    }

    body.sidebar-collapsed .app-sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-collapsed .app-main {
        grid-column: 2;
    }
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 30px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px);
}

.page-title {
    margin: 4px 0 0;
    font-size: 22px;
    font-weight: 800;
}

.breadcrumb {
    --bs-breadcrumb-divider-color: var(--muted);
    font-size: 13px;
}

.breadcrumb a,
.breadcrumb-item.active {
    color: var(--muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-icon {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.user-menu {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
}

.user-avatar {
    display: inline-grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.user-meta {
    display: grid;
    text-align: left;
    line-height: 1.1;
}

.user-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.user-email {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
}

.dropdown-menu-lg {
    width: min(360px, calc(100vw - 24px));
}

.app-content {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 28px 30px 32px;
    flex: 1 0 auto;
}

.smartie-page-alerts {
    position: relative;
    z-index: 4;
}

.smartie-page-alerts:empty {
    display: none;
}

.smartie-page-alerts .alert {
    margin-bottom: 18px;
}

.app-footer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-shrink: 0;
    justify-content: space-between;
    gap: 16px;
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 0 30px calc(48px + env(safe-area-inset-bottom));
    color: var(--muted);
    font-size: 13px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.page-heading h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 800;
}

.page-heading p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.eyebrow,
.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.modules {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card,
.panel-block,
.auth-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card,
.panel-block {
    padding: 18px;
}

.card p,
.panel-block p {
    color: var(--muted);
}

.dashboard-card.settings-card {
    height: auto;
}

.metric-value,
.stat-value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
}

.metric-icon {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: rgba(17, 103, 216, 0.1);
    color: var(--primary);
    font-size: 20px;
}

.progress {
    height: 9px;
    border-radius: 999px;
    background: rgba(104, 115, 134, 0.16);
}

.table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--line);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 1.6rem;
    line-height: 1.15;
    vertical-align: middle;
}

.badge i {
    line-height: 1;
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(25, 135, 84, 0.12);
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.quick-action:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.dashboard-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.dashboard-quick-action {
    min-height: 74px;
    padding: 10px;
    align-items: center;
}

.dashboard-quick-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    font-size: 18px;
}

.dashboard-quick-action .fw-semibold {
    min-width: 0;
    font-size: 13px;
    line-height: 1.25;
}

.form-check.border .form-check-input {
    float: none;
    margin-left: 0 !important;
    margin-right: 10px;
}

.form-check.border {
    padding-left: 12px !important;
}

.button,
.panel-button,
button:not(.btn):not(.btn-close):not(.sidebar-backdrop) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.button.primary,
.panel-button.primary,
button.primary:not(.btn):not(.btn-close) {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.auth-card {
    width: min(420px, 100%);
    padding: 22px;
}

.auth-card .form-label {
    margin-bottom: 6px;
}

.auth-card .form-control-lg {
    min-height: 46px;
    padding: 9px 12px;
    font-size: 16px;
}

.auth-card .btn-lg {
    min-height: 46px;
    padding-top: 9px;
    padding-bottom: 9px;
    font-size: 17px;
}

.auth-card .form-check {
    min-height: auto;
}

.auth-card .form-check-input {
    width: 18px;
    height: 18px;
    margin-top: 3px;
}

.field {
    display: grid;
    gap: 7px;
    margin-top: 16px;
}

.field input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    font: inherit;
}

.smartie-modal {
    --smartie-modal-accent: var(--primary);
    --smartie-modal-accent-strong: var(--primary-strong);
    backdrop-filter: blur(6px);
}

.smartie-modal[data-modal-status="success"] {
    --smartie-modal-accent: var(--green);
    --smartie-modal-accent-strong: #11643d;
}

.smartie-modal[data-modal-status="edit"],
.smartie-modal[data-modal-status="info"] {
    --smartie-modal-accent: var(--primary);
    --smartie-modal-accent-strong: var(--primary-strong);
}

.smartie-modal[data-modal-status="delete"] {
    --smartie-modal-accent: var(--red);
    --smartie-modal-accent-strong: #9f3129;
}

.smartie-modal[data-modal-status="warning"] {
    --smartie-modal-accent: var(--amber);
    --smartie-modal-accent-strong: #8f5b14;
}

.smartie-modal.fade .modal-dialog {
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.smartie-modal.show .modal-dialog {
    opacity: 1;
    transform: none;
}

.smartie-modal .modal-content {
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--smartie-modal-accent) 20%, var(--line));
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 22px 70px rgba(15, 23, 42, 0.28);
}

.smartie-modal .modal-header {
    align-items: center;
    min-height: 58px;
    border-bottom: 0;
    background: linear-gradient(135deg, var(--smartie-modal-accent), var(--smartie-modal-accent-strong)) !important;
    color: #fff;
}

.smartie-modal .modal-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}

.smartie-modal-title-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    color: rgba(255, 255, 255, 0.94);
}

.smartie-modal .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
    opacity: 0.9;
}

.smartie-modal .modal-body {
    color: var(--ink);
}

.smartie-modal .modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
}

.smartie-modal-footer-note {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 38px;
    color: var(--muted);
}

.smartie-modal-footer-actions {
    display: inline-flex;
    gap: 8px;
    margin-left: auto;
}

.smartie-modal .smartie-modal-confirm {
    border-color: var(--smartie-modal-accent);
    background: var(--smartie-modal-accent);
    color: #fff;
}

.smartie-modal .smartie-modal-confirm:hover {
    border-color: var(--smartie-modal-accent-strong);
    background: var(--smartie-modal-accent-strong);
}

.smartie-submit-loading {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.smartie-submit-loading .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.14em;
}

.btn-sm.smartie-submit-loading .spinner-border,
.btn-icon.smartie-submit-loading .spinner-border {
    width: 0.875rem;
    height: 0.875rem;
}

.smartie-confirm-body {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.smartie-confirm-icon {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    flex: 0 0 38px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--smartie-modal-accent) 12%, var(--surface));
    color: var(--smartie-modal-accent);
    font-size: 20px;
}

[data-panel-confirm-message] {
    white-space: pre-line;
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
        background: var(--bg);
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        width: var(--sidebar-width);
        transition: transform 0.18s ease;
    }

    .app-main {
        grid-column: 1;
    }

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

    .grid.stats,
    .grid.modules,
    .grid.two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app-header,
    .app-content,
    .app-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .user-meta {
        display: none;
    }

    .page-heading {
        flex-direction: column;
    }

    .grid.stats,
    .grid.modules,
    .grid.two {
        grid-template-columns: 1fr;
    }

    .dashboard-quick-actions {
        grid-template-columns: 1fr;
    }
}

/* ========================================================================== */
/* Smartie wPanel 2026 UI refresh                                             */
/* ========================================================================== */
:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-strong: #eef4fb;
    --ink: #162033;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --primary: #1266d4;
    --primary-strong: #0a4eaa;
    --primary-soft: #eaf2ff;
    --accent: #f59e0b;
    --nav: #0d1728;
    --nav-soft: #14243b;
    --nav-muted: #8fa1ba;
    --green: #16865d;
    --amber: #b87305;
    --red: #c33a31;
    --blue: #1266d4;
    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 5px 16px rgba(15, 23, 42, .04);
    --shadow: 0 14px 40px rgba(15, 23, 42, .07);
    --shadow-lg: 0 24px 70px rgba(15, 23, 42, .14);
    --focus-ring: 0 0 0 .22rem rgba(18, 102, 212, .16);
}

[data-theme="dark"] {
    --bg: #0b1220;
    --surface: #111b2b;
    --surface-soft: #162235;
    --surface-strong: #1a2940;
    --ink: #e8eef8;
    --muted: #9babc0;
    --line: #253550;
    --line-strong: #334661;
    --primary: #5b95f5;
    --primary-strong: #86b2ff;
    --primary-soft: #142c52;
    --nav: #070d17;
    --nav-soft: #101c2d;
    --nav-muted: #8293aa;
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, .16);
    --shadow: 0 18px 48px rgba(0, 0, 0, .22);
    --shadow-lg: 0 28px 80px rgba(0, 0, 0, .35);
    --focus-ring: 0 0 0 .22rem rgba(91, 149, 245, .22);
}

html {
    background: var(--bg);
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    background:
        radial-gradient(circle at 78% -15%, rgba(18, 102, 212, .055), transparent 35rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: color-mix(in srgb, var(--primary) 24%, transparent);
}

:focus-visible {
    outline: 0;
    box-shadow: var(--focus-ring) !important;
}

.app-shell {
    --sidebar-width: 286px;
    background: linear-gradient(to right, var(--nav) 0 var(--sidebar-width), var(--bg) var(--sidebar-width) 100%);
}

.app-sidebar {
    padding: 18px 14px 22px;
    border-right: 1px solid rgba(255, 255, 255, .055);
    background:
        radial-gradient(circle at 20% -5%, rgba(34, 118, 236, .24), transparent 16rem),
        linear-gradient(180deg, var(--nav), #0a1322 72%, #09111e);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    min-height: 72px;
    margin: 0 6px 16px;
    padding: 8px 6px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .075);
}

.brand-logo-sidebar {
    max-width: 214px;
    margin: 0 auto;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .18));
}

.sidebar-section {
    margin: 22px 10px 8px;
    color: #73849c;
    font-size: 10.5px;
    letter-spacing: .12em;
}

.sidebar-link {
    position: relative;
    min-height: 45px;
    margin: 2px 0;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #cbd5e1;
    font-size: 13.5px;
    font-weight: 600;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.sidebar-link i {
    display: inline-grid;
    width: 30px;
    height: 30px;
    place-items: center;
    flex: 0 0 30px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .045);
    color: #8ea3bf;
    font-size: 15px;
    transition: inherit;
}

.sidebar-link:hover {
    transform: translateX(2px);
    border-color: rgba(255, 255, 255, .055);
    background: rgba(255, 255, 255, .055);
}

.sidebar-link.is-active {
    border-color: rgba(92, 151, 245, .23);
    background: linear-gradient(100deg, rgba(30, 112, 227, .24), rgba(30, 112, 227, .09));
    box-shadow: inset 3px 0 0 #4e91f6;
}

.sidebar-link.is-active i {
    background: linear-gradient(145deg, #2d7be7, #1559b8);
    color: #fff;
    box-shadow: 0 8px 18px rgba(18, 102, 212, .25);
}

/* Sidebar accordions deliberately override the generic button treatment. */
#appSidebar button.sidebar-group-toggle {
    display: flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 1px 0;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    box-shadow: none;
    color: #aebbd0;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
}

#appSidebar button.sidebar-group-toggle:hover {
    border-color: rgba(255, 255, 255, .055);
    background: rgba(255, 255, 255, .045);
    color: #eef4ff;
}

#appSidebar button.sidebar-group-toggle[aria-expanded="true"] {
    border-color: rgba(78, 145, 246, .16);
    background: rgba(37, 99, 176, .12);
    color: #e5edfa;
}

#appSidebar button.sidebar-group-toggle > span > i {
    display: inline-grid;
    width: 26px;
    height: 26px;
    place-items: center;
    flex: 0 0 26px;
    border-radius: 7px;
    background: rgba(255, 255, 255, .035);
    color: #8498b4;
    font-size: 13px;
}

#appSidebar button.sidebar-group-toggle[aria-expanded="true"] > span > i {
    background: rgba(45, 123, 231, .17);
    color: #76aaf4;
}

.app-sidebar .sidebar-group-menu {
    margin: 2px 0 7px 13px;
    padding: 2px 0 2px 8px;
    border-left: 1px solid rgba(126, 151, 184, .14);
}

.app-sidebar .sidebar-group-menu .sidebar-link {
    min-height: 38px;
    margin: 1px 0;
    padding: 6px 9px;
    font-size: 12.75px;
}

.app-sidebar .sidebar-group-menu .sidebar-link i {
    width: 27px;
    height: 27px;
    flex-basis: 27px;
    border-radius: 7px;
    font-size: 13px;
}

.app-header {
    min-height: 78px;
    padding: 13px clamp(18px, 2.4vw, 34px);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
    backdrop-filter: saturate(150%) blur(18px);
}

.page-title {
    margin-top: 2px;
    color: var(--ink);
    font-size: clamp(19px, 2vw, 23px);
    letter-spacing: -.025em;
}

.breadcrumb {
    margin-bottom: 1px;
    font-size: 11.5px;
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-color: var(--line);
    border-radius: 11px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.btn-icon:hover {
    transform: translateY(-1px);
    background: var(--surface-soft);
}

.user-menu {
    min-height: 44px;
    padding: 5px 8px 5px 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--primary), var(--primary-strong));
    box-shadow: 0 7px 18px rgba(18, 102, 212, .22);
}

.app-content {
    width: min(1540px, 100%);
    padding: 30px clamp(18px, 2.4vw, 34px) 38px;
}

.app-footer {
    width: min(1540px, 100%);
    padding-inline: clamp(18px, 2.4vw, 34px);
}

.page-heading {
    margin-bottom: 24px;
}

.page-heading h2 {
    margin-bottom: 7px;
    font-size: clamp(24px, 2.5vw, 31px);
    letter-spacing: -.035em;
}

.page-heading p {
    max-width: 820px;
    line-height: 1.65;
}

.eyebrow,
.stat-label {
    letter-spacing: .09em;
}

.card,
.panel-block,
.auth-card {
    border-color: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card,
.panel-block {
    padding: clamp(16px, 2vw, 22px);
}

.card:hover,
.panel-block:hover {
    box-shadow: var(--shadow);
}

.metric-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 10%, transparent);
}

.metric-value,
.stat-value {
    letter-spacing: -.045em;
}

.quick-action {
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .02);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.quick-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.table-responsive {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.table {
    margin-bottom: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.table > :not(caption) > * > * {
    padding: .85rem .9rem;
    border-bottom-color: color-mix(in srgb, var(--line) 82%, transparent);
    vertical-align: middle;
}

.table thead th {
    border-bottom-width: 1px;
    background: color-mix(in srgb, var(--surface-soft) 88%, var(--surface));
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .075em;
    white-space: nowrap;
}

.table tbody tr {
    transition: background .14s ease;
}

.table tbody tr:hover > * {
    background: color-mix(in srgb, var(--primary-soft) 36%, var(--surface));
}

.form-control,
.form-select,
.input-group-text {
    min-height: 43px;
    border-color: var(--line-strong);
    border-radius: 10px;
    background-color: var(--surface);
    color: var(--ink);
    box-shadow: none;
}

.form-control::placeholder {
    color: color-mix(in srgb, var(--muted) 66%, transparent);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: color-mix(in srgb, var(--primary) 72%, var(--line));
    box-shadow: var(--focus-ring);
}

.input-group > .form-control:not(:last-child),
.input-group > .form-select:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group > .btn:last-child,
.input-group > .input-group-text:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.form-label {
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

.form-text,
.text-muted,
.muted {
    color: var(--muted) !important;
}

.btn {
    --bs-btn-border-radius: 10px;
    min-height: 40px;
    font-weight: 700;
    box-shadow: none;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-strong);
    --bs-btn-hover-border-color: var(--primary-strong);
    --bs-btn-active-bg: var(--primary-strong);
    --bs-btn-active-border-color: var(--primary-strong);
    box-shadow: 0 7px 16px rgba(18, 102, 212, .16);
}

.btn-sm {
    min-height: 34px;
    --bs-btn-border-radius: 9px;
}

.dropdown-menu {
    padding: 7px;
    border-color: var(--line);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    min-height: 38px;
    border-radius: 8px;
    font-size: 13.5px;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--surface-soft);
}

.alert {
    border-radius: 12px;
    border-width: 1px;
}

.badge,
.status {
    border-radius: 999px;
    font-weight: 700;
}

.progress {
    overflow: hidden;
    height: 8px;
}

.pagination {
    gap: 5px;
}

.page-link {
    min-width: 38px;
    min-height: 38px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line) !important;
    border-radius: 9px !important;
    background: var(--surface);
    color: var(--muted);
    font-weight: 700;
    box-shadow: none !important;
}

.page-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.page-item.active .page-link {
    border-color: var(--primary) !important;
    background: var(--primary);
    color: #fff;
}

.page-item.disabled .page-link {
    background: var(--surface-soft);
    color: color-mix(in srgb, var(--muted) 55%, transparent);
}

.smartie-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
}

.smartie-pager-summary {
    color: var(--muted);
    font-size: 13px;
}

.smartie-empty-state {
    padding: 44px 20px !important;
    text-align: center;
    color: var(--muted);
}

.smartie-empty-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    margin: 0 auto 12px;
    border-radius: 15px;
    background: var(--surface-soft);
    color: var(--primary);
    font-size: 22px;
}

.smartie-modal .modal-content {
    border-radius: 17px;
    box-shadow: var(--shadow-lg);
}

.smartie-modal .modal-header {
    min-height: 64px;
    padding: 15px 18px;
}

.smartie-modal .modal-body {
    padding: 20px;
}

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

/* Global action progress */
.smartie-page-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    width: 100%;
    height: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease;
}

.smartie-page-progress::after {
    content: "";
    display: block;
    width: 38%;
    height: 100%;
    transform: translateX(-110%);
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--primary), #76a9ff, transparent);
}

.smartie-page-progress.is-active {
    opacity: 1;
}

.smartie-page-progress.is-active::after {
    animation: smartie-progress 1.15s ease-in-out infinite;
}

@keyframes smartie-progress {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(290%); }
}

.smartie-dynamic-toasts {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2050;
    display: grid;
    gap: 10px;
    width: min(390px, calc(100vw - 36px));
}

.smartie-toast {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    animation: smartie-toast-in .2s ease-out;
}

.smartie-toast-icon {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    flex: 0 0 29px;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary);
}

.smartie-toast[data-tone="success"] .smartie-toast-icon { color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--surface)); }
.smartie-toast[data-tone="warning"] .smartie-toast-icon { color: var(--amber); background: color-mix(in srgb, var(--amber) 13%, var(--surface)); }
.smartie-toast[data-tone="danger"] .smartie-toast-icon { color: var(--red); background: color-mix(in srgb, var(--red) 11%, var(--surface)); }

@keyframes smartie-toast-in {
    from { opacity: 0; transform: translateY(-8px) scale(.985); }
    to { opacity: 1; transform: none; }
}

/* Authentication */
.auth-shell {
    position: relative;
    min-height: 100dvh;
    padding: clamp(16px, 3vw, 38px);
    overflow: hidden;
    background:
        radial-gradient(circle at 8% 10%, rgba(25, 113, 236, .16), transparent 26rem),
        radial-gradient(circle at 92% 88%, rgba(245, 158, 11, .11), transparent 24rem),
        linear-gradient(145deg, #eef4fb 0%, #f8fafc 48%, #f3f6fb 100%);
}

[data-theme="dark"] .auth-shell {
    background:
        radial-gradient(circle at 8% 10%, rgba(56, 132, 238, .17), transparent 28rem),
        radial-gradient(circle at 92% 88%, rgba(245, 158, 11, .06), transparent 25rem),
        #0a1220;
}

.auth-shell::before,
.auth-shell::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(1px);
    pointer-events: none;
}

.auth-shell::before {
    width: 280px;
    height: 280px;
    top: -150px;
    right: 10%;
    border: 1px solid rgba(18, 102, 212, .14);
    box-shadow: 0 0 0 42px rgba(18, 102, 212, .025), 0 0 0 88px rgba(18, 102, 212, .018);
}

.auth-shell::after {
    width: 180px;
    height: 180px;
    bottom: -110px;
    left: 9%;
    background: rgba(245, 158, 11, .06);
}

.auth-stage {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
    width: min(1180px, 100%);
    min-height: min(760px, calc(100dvh - 76px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 26px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 32px 90px rgba(30, 55, 90, .14);
    backdrop-filter: blur(20px);
}

[data-theme="dark"] .auth-stage {
    border-color: rgba(255, 255, 255, .07);
    box-shadow: 0 34px 100px rgba(0, 0, 0, .38);
}

.auth-showcase {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(34px, 5vw, 62px);
    background:
        radial-gradient(circle at 86% 12%, rgba(75, 145, 245, .34), transparent 20rem),
        radial-gradient(circle at 8% 94%, rgba(245, 158, 11, .15), transparent 19rem),
        linear-gradient(150deg, #0a2547 0%, #0a3972 56%, #0d5ab0 100%);
    color: #fff;
}

.auth-showcase::after {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    right: -190px;
    bottom: -170px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    box-shadow: 0 0 0 50px rgba(255, 255, 255, .035), 0 0 0 105px rgba(255, 255, 255, .025);
}

.auth-showcase-brand {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    backdrop-filter: blur(10px);
}

.auth-showcase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5ee1a1;
    box-shadow: 0 0 0 5px rgba(94, 225, 161, .12);
}

.auth-showcase-copy {
    position: relative;
    z-index: 1;
    max-width: 520px;
}

.auth-showcase-copy h2 {
    margin: 0 0 17px;
    font-size: clamp(34px, 4.2vw, 52px);
    font-weight: 800;
    line-height: 1.03;
    letter-spacing: -.045em;
}

.auth-showcase-copy p {
    max-width: 490px;
    margin: 0;
    color: rgba(231, 241, 255, .78);
    font-size: 15px;
    line-height: 1.75;
}

.auth-feature-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 28px;
}

.auth-feature {
    min-width: 0;
    padding: 14px 12px;
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 14px;
    background: rgba(255, 255, 255, .07);
    backdrop-filter: blur(10px);
}

.auth-feature i {
    display: block;
    margin-bottom: 10px;
    color: #91beff;
    font-size: 20px;
}

.auth-feature strong {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
}

.auth-feature span {
    display: block;
    color: rgba(225, 237, 255, .66);
    font-size: 10.5px;
    line-height: 1.45;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: clamp(28px, 5vw, 62px);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
}

.auth-card {
    width: min(440px, 100%);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.auth-brand {
    margin-bottom: 30px;
    text-align: left;
}

.brand-logo-auth {
    width: min(218px, 70%);
    margin: 0 0 26px;
    border-radius: 0;
}

.auth-brand .eyebrow {
    margin-bottom: 8px !important;
    color: var(--primary);
    font-size: 11px;
}

.auth-brand h1 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(29px, 3.3vw, 37px) !important;
    font-weight: 800;
    letter-spacing: -.04em;
}

.auth-subtitle {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.auth-card .form-control-lg {
    min-height: 52px;
    padding: 11px 13px;
    border-radius: 11px;
    font-size: 15px;
}

.auth-card .btn-lg {
    min-height: 51px;
    border-radius: 11px;
    font-size: 15px;
}

.auth-card .input-group .form-control-lg {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.auth-password-toggle {
    min-width: 48px;
    border-color: var(--line-strong);
    border-radius: 0 11px 11px 0 !important;
    background: var(--surface);
    color: var(--muted);
}

.auth-password-toggle:hover {
    background: var(--surface-soft);
    color: var(--primary);
}

.auth-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin: 2px 0 22px;
}

.auth-link {
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
}

.auth-link:hover {
    color: var(--primary-strong);
}

.auth-security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 22px;
    color: var(--muted);
    font-size: 11.5px;
}

.auth-security-note i {
    color: var(--green);
}

.auth-code-input {
    letter-spacing: .42em;
    font-size: 21px !important;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.auth-back-link:hover {
    color: var(--primary);
}

.password-strength-hints {
    display: grid;
    gap: 5px;
    margin-top: 9px;
    color: var(--muted);
    font-size: 11.5px;
}

.password-strength-hints span::before {
    content: "•";
    margin-right: 7px;
    color: var(--primary);
}

/* authenticated security page */
.security-card {
    max-width: 680px;
}

.security-card-header {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.security-card-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    flex: 0 0 46px;
    border-radius: 13px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 20px;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: none;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(2, 8, 23, .48);
    backdrop-filter: blur(2px);
}

@media (max-width: 1100px) {
    body.sidebar-open {
        overflow: hidden;
    }

    /* The refreshed desktop shell gradient is declared after the original
       responsive rules. Reset it here so the off-canvas sidebar does not
       leave a sidebar-width dark stripe behind mobile page content. */
    .app-shell {
        background: var(--bg);
    }
}

@media (max-width: 1100px) {
    .sidebar-backdrop.is-open {
        display: block;
    }

    .app-sidebar {
        box-shadow: 22px 0 60px rgba(0, 0, 0, .24);
    }

    .auth-stage {
        grid-template-columns: minmax(0, .9fr) minmax(390px, 1.1fr);
    }

    .auth-feature-grid {
        grid-template-columns: 1fr;
    }

    .auth-feature:nth-child(n+3) {
        display: none;
    }
}

@media (max-width: 820px) {
    .auth-shell {
        padding: 14px;
    }

    .auth-stage {
        display: block;
        min-height: auto;
        border-radius: 21px;
    }

    .auth-showcase {
        min-height: 205px;
        padding: 28px;
    }

    .auth-showcase-copy h2 {
        max-width: 520px;
        font-size: clamp(28px, 8vw, 38px);
    }

    .auth-showcase-copy p,
    .auth-feature-grid {
        display: none;
    }

    .auth-panel {
        padding: 34px 26px 38px;
    }

    .auth-brand {
        margin-bottom: 24px;
    }

    .brand-logo-auth {
        width: min(190px, 68%);
        margin-bottom: 20px;
    }
}

@media (max-width: 760px) {
    .app-header {
        min-height: 68px;
        align-items: center;
        flex-direction: row;
    }

    .app-header > .d-flex:first-child {
        min-width: 0;
        flex: 1;
    }

    .header-actions {
        width: auto;
        justify-content: flex-end;
    }

    .header-actions > .dropdown:first-of-type {
        display: none;
    }

    .app-content {
        padding-top: 22px;
    }

    .page-heading {
        gap: 14px;
    }

    .smartie-pager {
        align-items: flex-start;
        flex-direction: column;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .table > :not(caption) > * > * {
        padding: .75rem .78rem;
    }
}

@media (max-width: 520px) {
    .auth-showcase {
        min-height: 165px;
        padding: 22px;
    }

    .auth-showcase-brand {
        padding: 6px 9px;
        font-size: 10.5px;
    }

    .auth-showcase-copy h2 {
        margin-bottom: 0;
        font-size: 27px;
    }

    .auth-panel {
        padding: 28px 21px 32px;
    }

    .auth-meta-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .page-title {
        max-width: 44vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
