:root {
    --bb-bg-dark: #111315;
    --bb-surface-dark: rgba(24, 28, 31, 0.88);
    --bb-surface-dark-2: rgba(31, 36, 40, 0.92);
    --bb-border-dark: rgba(255, 255, 255, 0.08);
    --bb-text-dark: #f5f7fa;
    --bb-text-muted-dark: #a7b0b8;

    --bb-bg-light: #f5f7f9;
    --bb-surface-light: rgba(255, 255, 255, 0.82);
    --bb-surface-light-2: rgba(255, 255, 255, 0.92);
    --bb-border-light: rgba(0, 0, 0, 0.08);
    --bb-text-light: #111827;
    --bb-text-muted-light: #5f6b76;

    --bb-teal: #0f8da8;
    --bb-teal-soft: #16b5d4;
    --bb-orange: #ff5a00;
    --bb-orange-soft: #ff7a2f;

    --bb-radius-lg: 18px;
    --bb-radius-xl: 22px;
    --bb-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    --bb-sidebar-width: 260px;
    --bb-topbar-height: 76px;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html[data-bs-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(15, 141, 168, 0.14), transparent 30%),
        radial-gradient(circle at bottom right, rgba(255, 90, 0, 0.12), transparent 28%),
        var(--bb-bg-dark);
    color: var(--bb-text-dark);
}

html[data-bs-theme="light"] body {
    background:
        radial-gradient(circle at top left, rgba(15, 141, 168, 0.07), transparent 30%),
        radial-gradient(circle at bottom right, rgba(255, 90, 0, 0.08), transparent 28%),
        var(--bb-bg-light);
    color: var(--bb-text-light);
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: var(--bb-sidebar-width);
    padding: 1.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-right: 1px solid;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 1030;
}

html[data-bs-theme="dark"] .sidebar {
    background: var(--bb-surface-dark);
    border-color: var(--bb-border-dark);
}

html[data-bs-theme="light"] .sidebar {
    background: var(--bb-surface-light);
    border-color: var(--bb-border-light);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
}

.sidebar-logo {
    width: 86px;
    height: 86px;
    object-fit: contain;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    text-decoration: none;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    font-weight: 600;
    transition: 0.2s ease;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    border: 0;
    border-radius: 14px;
    background: transparent;
    font-weight: 600;
    text-align: left;
    transition: 0.2s ease;
}

html[data-bs-theme="dark"] .sidebar-toggle {
    color: var(--bb-text-muted-dark);
}

html[data-bs-theme="light"] .sidebar-toggle {
    color: var(--bb-text-muted-light);
}

.sidebar-toggle:hover,
.sidebar-toggle[aria-expanded="true"] {
    background: linear-gradient(135deg, rgba(15, 141, 168, 0.18), rgba(255, 90, 0, 0.16));
    color: inherit;
}

.sidebar-chevron {
    font-size: 0.95rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

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

.sidebar-submenu {
    margin-top: -0.1rem;
}

.sidebar-placeholder {
    display: block;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    border-radius: 12px;
}

html[data-bs-theme="dark"] .sidebar-placeholder {
    color: var(--bb-text-muted-dark);
    background: rgba(255, 255, 255, 0.03);
}

html[data-bs-theme="light"] .sidebar-placeholder {
    color: var(--bb-text-muted-light);
    background: rgba(0, 0, 0, 0.03);
}

html[data-bs-theme="dark"] .sidebar-link {
    color: var(--bb-text-muted-dark);
}

html[data-bs-theme="light"] .sidebar-link {
    color: var(--bb-text-muted-light);
}

.sidebar-link:hover,
.sidebar-link.active {
    background: linear-gradient(135deg, rgba(15, 141, 168, 0.18), rgba(255, 90, 0, 0.16));
    color: inherit;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem 0.25rem 0.75rem;
    border: 0;
    border-radius: 14px;
    background: transparent;
    text-align: left;
    transition: 0.2s ease;
}

html[data-bs-theme="dark"] .sidebar-toggle {
    color: var(--bb-text-muted-dark);
}

html[data-bs-theme="light"] .sidebar-toggle {
    color: var(--bb-text-muted-light);
}

.sidebar-toggle:hover,
.sidebar-toggle[aria-expanded="true"] {
    background: linear-gradient(135deg, rgba(15, 141, 168, 0.18), rgba(255, 90, 0, 0.16));
    color: inherit;
}

.sidebar-main-link {
    flex: 1;
    text-decoration: none;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    color: inherit;
}

.sidebar-main-link:hover {
    color: inherit;
}

.sidebar-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
    line-height: 1;
    border-radius: 12px;
    transition: transform 0.2s ease;
}

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

.sidebar-submenu {
    margin-top: -0.1rem;
}

.sidebar-submenu-inner {
    padding: 0.2rem 0.35rem 0.4rem 0.85rem;
}

.sidebar-placeholder {
    display: block;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    border-radius: 12px;
}

.sidebar-submenu-inner {
    padding: 0.15rem 0.35rem 0.2rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-submenu-link {
    display: block;
    text-decoration: none;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.2;
    transition: 0.2s ease;
}

html[data-bs-theme="dark"] .sidebar-submenu-link {
    color: var(--bb-text-muted-dark);
}

html[data-bs-theme="light"] .sidebar-submenu-link {
    color: var(--bb-text-muted-light);
}

.sidebar-submenu-link:hover {
    background: linear-gradient(135deg, rgba(15, 141, 168, 0.14), rgba(255, 90, 0, 0.12));
    color: inherit;
}

.sidebar-submenu-link.active {
    background: linear-gradient(135deg, rgba(15, 141, 168, 0.22), rgba(255, 90, 0, 0.18));
    color: inherit;
    font-weight: 600;
}

.main-wrapper {
    margin-left: var(--bb-sidebar-width);
    width: calc(100% - var(--bb-sidebar-width));
    min-height: 100vh;
}

.topbar {
    height: var(--bb-topbar-height);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid;
}

.topbar-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--bb-topbar-height);
    padding: 1.0rem 0 1.0rem 0;
}

html[data-bs-theme="dark"] .topbar {
    background: rgba(17, 19, 21, 0.72);
    border-color: var(--bb-border-dark);
}

html[data-bs-theme="light"] .topbar {
    background: rgba(245, 247, 249, 0.78);
    border-color: var(--bb-border-light);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 600;
}

html[data-bs-theme="dark"] .user-pill {
    background: rgba(255, 255, 255, 0.06);
    color: var(--bb-text-dark);
    border: 1px solid var(--bb-border-dark);
}

html[data-bs-theme="light"] .user-pill {
    background: rgba(0, 0, 0, 0.04);
    color: var(--bb-text-light);
    border: 1px solid var(--bb-border-light);
}

.btn-theme,
.btn-logout {
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.btn-theme {
    background: linear-gradient(135deg, rgba(15, 141, 168, 0.22), rgba(15, 141, 168, 0.1));
    border-color: rgba(15, 141, 168, 0.28);
    color: inherit;
}

.btn-theme:hover {
    background: linear-gradient(135deg, rgba(15, 141, 168, 0.3), rgba(15, 141, 168, 0.14));
}

.btn-logout {
    background: linear-gradient(135deg, rgba(255, 90, 0, 0.24), rgba(255, 90, 0, 0.12));
    border-color: rgba(255, 90, 0, 0.28);
    color: inherit;
}

.btn-logout:hover {
    background: linear-gradient(135deg, rgba(255, 90, 0, 0.34), rgba(255, 90, 0, 0.18));
}ß

.content-area {
    padding: 1.5rem;
}

.content-card {
    padding: 1.5rem;
    box-shadow: var(--bb-shadow);
    border: 1px solid;
}

html[data-bs-theme="dark"] .content-card {
    background: var(--bb-surface-dark-2);
    border-color: var(--bb-border-dark);
}

html[data-bs-theme="light"] .content-card {
    background: var(--bb-surface-light-2);
    border-color: var(--bb-border-light);
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    margin: 0;
}

html[data-bs-theme="dark"] .page-subtitle {
    color: var(--bb-text-muted-dark);
}

html[data-bs-theme="light"] .page-subtitle {
    color: var(--bb-text-muted-light);
}

@media (max-width: 991.98px) {
    .sidebar {
        width: 220px;
    }

    .main-wrapper {
        margin-left: 220px;
        width: calc(100% - 220px);
    }

    .topbar-title {
        font-size: 0.95rem;
    }
}

@media (max-width: 767.98px) {
    .sidebar {
        display: none;
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        padding: 0 1rem;
    }

    .content-area {
        padding: 1rem;
    }
}

#theme-toggle {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#theme-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* Dark mode → white icon */
html[data-bs-theme="dark"] #theme-icon svg {
    color: #ffffff;
}

/* Light mode → black icon */
html[data-bs-theme="light"] #theme-icon svg {
    color: #111827;
}

.login-body {
    min-height: 100vh;
}

.login-theme-toggle-wrap {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1100;
}

.login-theme-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 28px;
    padding: 2rem;
    border: 1px solid;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

html[data-bs-theme="dark"] .login-card {
    background: rgba(24, 28, 31, 0.82);
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(0, 0, 0, 0.08);
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
}

.login-logo {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.login-copy {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.45rem;
}

.login-subtitle {
    margin: 0;
    font-size: 0.96rem;
}

html[data-bs-theme="dark"] .login-subtitle {
    color: var(--bb-text-muted-dark);
}

html[data-bs-theme="light"] .login-subtitle {
    color: var(--bb-text-muted-light);
}

.login-alert,
.login-note {
    border-radius: 16px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.93rem;
}

html[data-bs-theme="dark"] .login-alert {
    background: rgba(255, 90, 0, 0.12);
    border: 1px solid rgba(255, 90, 0, 0.22);
    color: #ffd7c5;
}

html[data-bs-theme="light"] .login-alert {
    background: rgba(255, 90, 0, 0.08);
    border: 1px solid rgba(255, 90, 0, 0.18);
    color: #8f3200;
}

html[data-bs-theme="dark"] .login-note {
    background: rgba(15, 141, 168, 0.12);
    border: 1px solid rgba(15, 141, 168, 0.2);
    color: #bfeef8;
}

html[data-bs-theme="light"] .login-note {
    background: rgba(15, 141, 168, 0.08);
    border: 1px solid rgba(15, 141, 168, 0.16);
    color: #0d5e71;
}

.login-label {
    font-weight: 600;
    margin-bottom: 0.45rem;
}

.login-input {
    height: 48px;
    border-radius: 14px;
    padding-left: 0.95rem;
    padding-right: 0.95rem;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] .login-input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #f5f7fa;
}

html[data-bs-theme="dark"] .login-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(15, 141, 168, 0.45);
}

html[data-bs-theme="light"] .login-input {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
    color: #111827;
}

html[data-bs-theme="light"] .login-input:focus {
    border-color: rgba(15, 141, 168, 0.35);
}

.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus,
.login-input:-webkit-autofill:active {
    -webkit-text-fill-color: inherit;
    transition: background-color 9999s ease-in-out 0s;
}

.login-submit-btn {
    height: 48px;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #ffffff;
    background: linear-gradient(135deg, var(--bb-teal), var(--bb-orange));
}

.login-submit-btn:hover {
    color: #ffffff;
    filter: brightness(1.05);
}

@media (max-width: 575.98px) {
    .login-card {
        padding: 1.5rem;
        border-radius: 24px;
    }

    .login-logo {
        width: 96px;
        height: 96px;
    }

    .login-title {
        font-size: 1.2rem;
    }
}

.org-pill {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 600;
}

html[data-bs-theme="dark"] .org-pill {
    background: rgba(15, 141, 168, 0.12);
    color: #d3f5fb;
    border: 1px solid rgba(15, 141, 168, 0.22);
}

html[data-bs-theme="light"] .org-pill {
    background: rgba(15, 141, 168, 0.08);
    color: #0d5e71;
    border: 1px solid rgba(15, 141, 168, 0.16);
}

html[data-bs-theme="dark"] .org-pill-empty {
    background: rgba(255, 255, 255, 0.04);
    color: var(--bb-text-muted-dark);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="light"] .org-pill-empty {
    background: rgba(0, 0, 0, 0.04);
    color: var(--bb-text-muted-light);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.messages-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.app-message {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid;
    font-size: 0.95rem;
    font-weight: 500;
}

html[data-bs-theme="dark"] .app-message-success {
    background: rgba(15, 141, 168, 0.12);
    border-color: rgba(15, 141, 168, 0.22);
    color: #c8f3fb;
}

html[data-bs-theme="light"] .app-message-success {
    background: rgba(15, 141, 168, 0.08);
    border-color: rgba(15, 141, 168, 0.18);
    color: #0d5e71;
}

html[data-bs-theme="dark"] .app-message-warning {
    background: rgba(255, 90, 0, 0.12);
    border-color: rgba(255, 90, 0, 0.22);
    color: #ffd7c5;
}

html[data-bs-theme="light"] .app-message-warning {
    background: rgba(255, 90, 0, 0.08);
    border-color: rgba(255, 90, 0, 0.18);
    color: #8f3200;
}

html[data-bs-theme="dark"] .app-message-error {
    background: rgba(255, 90, 0, 0.12);
    border-color: rgba(255, 90, 0, 0.22);
    color: #ffd7c5;
}

html[data-bs-theme="light"] .app-message-error {
    background: rgba(255, 90, 0, 0.08);
    border-color: rgba(255, 90, 0, 0.18);
    color: #8f3200;
}

.app-table-wrap {
    overflow-x: auto;
}

.app-table {
    width: 100%;
    border-collapse: collapse;
}

.app-table th,
.app-table td {
    padding: 0.95rem 1rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid;
}

html[data-bs-theme="dark"] .app-table th,
html[data-bs-theme="dark"] .app-table td {
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="light"] .app-table th,
html[data-bs-theme="light"] .app-table td {
    border-color: rgba(0, 0, 0, 0.08);
}

.app-table th {
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

html[data-bs-theme="dark"] .app-table th {
    color: var(--bb-text-muted-dark);
}

html[data-bs-theme="light"] .app-table th {
    color: var(--bb-text-muted-light);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-pill-enabled {
    background: rgba(15, 141, 168, 0.12);
    color: #0f8da8;
}

.status-pill-disabled {
    background: rgba(255, 90, 0, 0.12);
    color: #ff5a00;
}

.app-btn-select {
    border: 0;
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--bb-teal), var(--bb-orange));
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.app-btn-select:hover {
    color: #ffffff;
    filter: brightness(1.05);
}

.page-context {
    margin-top: 0.35rem;
    margin-bottom: 0;
    font-size: 0.96rem;
}

html[data-bs-theme="dark"] .page-context {
    color: var(--bb-text-muted-dark);
}

html[data-bs-theme="light"] .page-context {
    color: var(--bb-text-muted-light);
}

.orglist-toolbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin: 1.25rem 0 1rem;
}

.orglist-search {
    width: 100%;
    max-width: 520px;
}

.orglist-search .input-group {
    flex-wrap: nowrap;
}

.orglist-search .form-control {
    min-width: 260px;
    height: 44px;
    border-radius: 14px 0 0 14px;
    padding-left: 0.9rem;
    box-shadow: none !important;
}

.orglist-search .btn {
    white-space: nowrap;
}

.orglist-search .btn:first-of-type {
    border-radius: 0;
}

.orglist-search .btn:last-of-type {
    border-radius: 0 14px 14px 0;
}

html[data-bs-theme="dark"] .orglist-search .form-control {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #f5f7fa;
}

html[data-bs-theme="dark"] .orglist-search .form-control:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(15, 141, 168, 0.45);
}

html[data-bs-theme="light"] .orglist-search .form-control {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
    color: #111827;
}

html[data-bs-theme="light"] .orglist-search .form-control:focus {
    border-color: rgba(15, 141, 168, 0.35);
}

@media (max-width: 575.98px) {
    .orglist-search {
        max-width: 100%;
    }

    .orglist-search .form-control {
        min-width: 0;
    }
}

.organisation-table {
    table-layout: fixed;
    width: 100%;
    font-size: 0.9rem;
}

.organisation-table th,
.organisation-table td {
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.organisation-table .org-name {
    max-width: 240px;
    font-weight: 500;
}

.organisation-table th:nth-child(1),
.organisation-table td:nth-child(1) {
    width: 90px;
}

.organisation-table th:nth-child(2),
.organisation-table td:nth-child(2) {
    width: 220px;
}

.organisation-table th:nth-child(3),
.organisation-table td:nth-child(3) {
    width: 220px;
}

.organisation-table th:nth-child(4),
.organisation-table td:nth-child(4) {
    width: 140px;
}

.organisation-table th:nth-child(5),
.organisation-table td:nth-child(5) {
    width: 130px;
}

.organisation-table th:nth-child(6),
.organisation-table td:nth-child(6) {
    width: 120px;
}

.organisation-table th:nth-child(7),
.organisation-table td:nth-child(7) {
    width: 150px;
}