:root {
    --primary: #0f4c5c;
    --secondary: #334155;
    --accent: #b45309;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b42318;
    --info: #0369a1;
    --background: #f6f8fb;
    --surface: #ffffff;
    --surface-secondary: #eef3f6;
    --text-primary: #1f2933;
    --text-secondary: #64748b;
    --border: #d8e0e8;
    --app-font-family: "Inter", Arial, sans-serif;
    --ms-primary: var(--primary);
    --ms-surface: var(--background);
    --ms-text: var(--text-primary);
    --ms-border: var(--border);
    --ms-success: var(--success);
    --ms-danger: var(--danger);
    --ms-muted: var(--text-secondary);
    --ms-card: var(--surface);
    --bs-primary: var(--ms-primary);
    --bs-body-font-family: var(--app-font-family);
    --bs-body-color: var(--ms-text);
    --bs-body-bg: var(--ms-surface);
    --bs-border-color: var(--ms-border);
}

body {
    background: var(--ms-surface);
    color: var(--ms-text);
    font-weight: 500;
    overflow-x: hidden;
}

.demo-tenant-banner {
    align-items: center;
    background: #fff7ed;
    border-bottom: 1px solid #fdba74;
    color: #9a3412;
    display: flex;
    font-size: 0.86rem;
    gap: 0.65rem;
    padding: 0.62rem 1.25rem;
}

.demo-tenant-banner strong {
    background: #c2410c;
    border-radius: 4px;
    color: #fff;
    font-size: 0.72rem;
    padding: 0.18rem 0.38rem;
}

.tenant-dropdown-section {
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.45rem 1rem 0.2rem;
    text-transform: uppercase;
}

.demo-tenant-card {
    border-color: #fdba74;
}

.document-demo-watermark {
    display: none;
}

@media print {
    .document-demo-watermark {
        color: rgba(180, 83, 9, 0.16);
        display: block;
        font-size: 9rem;
        font-weight: 800;
        left: 50%;
        letter-spacing: 0;
        pointer-events: none;
        position: fixed;
        top: 45%;
        transform: translate(-50%, -50%) rotate(-32deg);
        z-index: 9999;
    }
}

.app-shell {
    background: var(--ms-surface);
    min-height: 100vh;
}

.app-sidebar {
    background: var(--surface);
    border-right: 1px solid var(--ms-border);
    box-shadow: 12px 0 30px rgba(31, 41, 51, 0.04);
    display: flex;
    flex-direction: column;
    height: 100vh;
    left: 0;
    overflow-y: auto;
    padding: 1rem;
    position: fixed;
    top: 0;
    width: 17rem;
    z-index: 1035;
}

.sidebar-header {
    align-items: center;
    border-bottom: 1px solid #edf1f5;
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    min-height: 4rem;
    padding-bottom: 0.9rem;
}

.sidebar-brand {
    align-items: center;
    color: var(--ms-primary);
    display: inline-flex;
    min-width: 0;
    text-decoration: none;
}

.sidebar-search {
    align-items: center;
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    display: flex;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
    padding: 0.48rem 0.6rem;
}

.sidebar-search input {
    background: transparent;
    border: 0;
    color: var(--text-primary);
    font-size: 0.82rem;
    min-width: 0;
    outline: 0;
    width: 100%;
}

.sidebar-close,
.topbar-menu-button,
.topbar-icon-button {
    align-items: center;
    background: #f3f6fa;
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    color: #334e68;
    display: inline-flex;
    height: 2.4rem;
    justify-content: center;
    padding: 0;
    width: 2.4rem;
}

.sidebar-close:hover,
.sidebar-close:focus,
.topbar-menu-button:hover,
.topbar-menu-button:focus,
.topbar-icon-button:hover,
.topbar-icon-button:focus {
    background: #e6eff8;
    border-color: #bfd0e3;
    color: var(--ms-primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-bottom: 1rem;
}

.sidebar-section-title {
    color: var(--ms-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 0.35rem;
    padding: 0 0.75rem;
    text-transform: uppercase;
}

.sidebar-link {
    align-items: center;
    border-radius: 8px;
    color: #334e68;
    display: flex;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 0.75rem;
    min-height: 2.55rem;
    padding: 0.62rem 0.75rem;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar-link:hover,
.sidebar-link:focus {
    background: var(--surface-secondary);
    color: var(--ms-primary);
    transform: translateX(1px);
}

.sidebar-link.is-active {
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
    box-shadow: inset 3px 0 0 var(--ms-primary);
    color: var(--ms-primary);
}

.sidebar-group {
    background: color-mix(in srgb, var(--surface-secondary) 58%, var(--surface));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem;
}

.sidebar-group-label {
    align-items: center;
    color: #243b53;
    cursor: pointer;
    display: flex;
    font-size: 0.92rem;
    font-weight: 800;
    gap: 0.65rem;
    min-height: 2.45rem;
    padding: 0.45rem 0.55rem;
}

.sidebar-group-label::-webkit-details-marker {
    display: none;
}

.sidebar-group-label::after {
    border: solid #829ab1;
    border-width: 0 2px 2px 0;
    content: "";
    display: inline-block;
    height: 0.45rem;
    margin-left: auto;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
    width: 0.45rem;
}

.sidebar-group[open] > .sidebar-group-label::after {
    transform: rotate(225deg);
}

.sidebar-group-label:hover,
.sidebar-group-label:focus,
.sidebar-group-label.is-active {
    background: var(--surface-secondary);
    border-radius: 7px;
    color: var(--ms-primary);
}

.sidebar-subnav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-top: 0.2rem;
}

.sidebar-sub-link {
    font-size: 0.86rem;
    margin-left: 0.2rem;
    min-height: 2.25rem;
    padding-bottom: 0.48rem;
    padding-top: 0.48rem;
}

.sidebar-level-2.sidebar-link,
.sidebar-level-3.sidebar-link {
    margin-left: 0.9rem;
}

.sidebar-sub-link .app-icon {
    height: 1rem;
    width: 1rem;
}

.app-icon {
    flex: 0 0 auto;
    height: 1.12rem;
    stroke-width: 2.1;
    width: 1.12rem;
}

.app-main {
    margin-left: 17rem;
    min-height: 100vh;
    min-width: 0;
}

.app-topbar {
    align-items: center;
    background: color-mix(in srgb, var(--background) 94%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--ms-border);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    min-height: 4.75rem;
    padding: 0.85rem 1.35rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-left,
.topbar-actions {
    align-items: center;
    display: flex;
    gap: 0.85rem;
    min-width: 0;
}

.topbar-title {
    color: #243b53;
    font-size: 1.18rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
}

.topbar-search {
    align-items: center;
    background: #fff;
    border: 1px solid var(--ms-border);
    border-radius: 999px;
    color: #829ab1;
    gap: 0.45rem;
    min-width: min(18rem, 26vw);
    padding: 0.48rem 0.78rem;
}

.topbar-search input {
    background: transparent;
    border: 0;
    color: var(--ms-text);
    min-width: 0;
    outline: 0;
    width: 100%;
}

.topbar-user {
    align-items: center;
    display: flex;
    gap: 0.55rem;
    min-width: 0;
}

.topbar-user-name {
    color: #334e68;
    font-size: 0.88rem;
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-avatar {
    align-items: center;
    background: var(--ms-primary);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    height: 2.15rem;
    justify-content: center;
    width: 2.15rem;
}

.tenant-switcher {
    min-width: 0;
}

.tenant-switcher-button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--ms-border);
    border-radius: 999px;
    color: #243b53;
    display: inline-flex;
    gap: 0.55rem;
    max-width: min(22rem, 32vw);
    min-width: 0;
    padding: 0.35rem 0.65rem 0.35rem 0.35rem;
}

.tenant-switcher-button:hover,
.tenant-switcher-button:focus {
    border-color: var(--ms-primary);
    color: var(--ms-primary);
}

.tenant-switcher-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
    text-align: left;
}

.tenant-switcher-label {
    color: var(--ms-muted);
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
}

.tenant-switcher-name {
    color: #243b53;
    font-size: 0.86rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tenant-avatar {
    align-items: center;
    background: var(--tenant-color, var(--ms-primary));
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.78rem;
    font-weight: 800;
    height: 2.2rem;
    justify-content: center;
    width: 2.2rem;
}

.tenant-avatar-logo {
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    padding: 0.18rem;
}

.tenant-avatar-logo img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.tenant-avatar-sm {
    border-radius: 7px;
    height: 1.9rem;
    width: 1.9rem;
}

.tenant-dropdown {
    border-color: var(--ms-border);
    min-width: 19rem;
}

.tenant-dropdown-item {
    align-items: center;
    display: flex;
    gap: 0.65rem;
    white-space: normal;
}

.tenant-dropdown-item.active {
    background: #eef3f9;
    color: var(--ms-primary);
}

.app-content {
    padding: 1.35rem;
}

.sidebar-backdrop {
    background: rgba(31, 41, 51, 0.38);
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 0.2s ease;
    z-index: 1030;
}

.navbar {
    backdrop-filter: saturate(180%) blur(8px);
    min-height: 68px;
    box-shadow: 0 10px 26px rgba(31, 41, 51, 0.05);
}

.navbar-brand {
    align-items: center;
    display: inline-flex;
    gap: 0.65rem;
    letter-spacing: 0;
    min-width: 0;
    padding-bottom: 0.25rem;
    padding-top: 0.25rem;
}

.brand-logo-wrap {
    align-items: center;
    display: inline-flex;
    gap: 0.75rem;
    min-width: 0;
}

.navbar-logo {
    display: block;
    height: 3.25rem;
    max-width: min(14rem, 42vw);
    object-fit: contain;
    width: auto;
}

.sidebar-logo {
    display: block;
    height: 2.5rem;
    max-width: 12.5rem;
    object-fit: contain;
    width: auto;
}

.login-logo {
    display: block;
    height: 3.75rem;
    max-width: 100%;
    object-fit: contain;
    width: auto;
}

.brand-mark {
    color: var(--ms-primary);
    font-weight: 800;
}

.brand-fallback {
    align-items: center;
    display: inline-flex;
    gap: 0.6rem;
    min-width: 0;
}

.brand-fallback-mark {
    align-items: center;
    background: var(--primary);
    border-radius: 7px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.74rem;
    font-weight: 800;
    height: 2.15rem;
    justify-content: center;
    width: 2.15rem;
}

.brand-fallback-text {
    display: flex;
    flex-direction: column;
    line-height: 1.08;
    min-width: 0;
}

.brand-fallback-text strong {
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.brand-fallback-text small {
    color: var(--text-secondary);
    font-size: 0.66rem;
    margin-top: 0.18rem;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-subtitle {
    color: #52606d;
    font-size: 0.86rem;
    font-weight: 500;
    white-space: nowrap;
}

.nav-link {
    color: #334e68;
    font-size: 0.92rem;
    border-radius: 6px;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
}

.nav-link:hover,
.nav-link:focus {
    background: #eef3f9;
    color: var(--ms-primary);
}

.card {
    background: var(--ms-card);
    border-color: var(--ms-border);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(31, 41, 51, 0.04);
}

.page-heading {
    border-bottom: 1px solid var(--ms-border);
    padding: 0.2rem 0 1rem;
}

.eyebrow {
    color: var(--ms-muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.settings-card {
    color: var(--ms-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.settings-card:hover,
.settings-card:focus {
    border-color: var(--ms-primary);
    box-shadow: 0 16px 32px rgba(31, 41, 51, 0.08);
    transform: translateY(-1px);
}

.card-header,
.card-footer {
    background: #fff;
    border-color: var(--ms-border);
    padding: 0.9rem 1rem;
}

.card-header {
    color: #243b53;
}

.btn {
    border-radius: 6px;
    font-weight: 800;
    padding-left: 0.95rem;
    padding-right: 0.95rem;
}

.btn .app-icon,
.btn [data-lucide] {
    height: 1rem;
    vertical-align: -0.15rem;
    width: 1rem;
}

.placeholder-assistant {
    top: 5.75rem;
}

.placeholder-assistant-list {
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.placeholder-assistant code {
    color: #52606d;
    font-size: 0.72rem;
    overflow-wrap: anywhere;
}

.communication-preview {
    border-top: 1px solid var(--ms-border);
    line-height: 1.65;
    padding-top: 1rem;
}

.btn-primary {
    background-color: var(--ms-primary);
    border-color: var(--ms-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: color-mix(in srgb, var(--primary) 84%, #000);
    border-color: color-mix(in srgb, var(--primary) 84%, #000);
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary);
    --bs-btn-active-border-color: var(--primary);
}

.btn-secondary {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.btn-outline-secondary {
    --bs-btn-color: var(--secondary);
    --bs-btn-border-color: var(--border);
    --bs-btn-hover-bg: var(--secondary);
    --bs-btn-hover-border-color: var(--secondary);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--secondary);
}

.btn-ghost:hover,
.btn-ghost:focus {
    background: var(--surface-secondary);
    color: var(--primary);
}

.btn-success {
    background-color: var(--ms-success);
    border-color: var(--ms-success);
}

.btn-danger {
    background-color: var(--ms-danger);
    border-color: var(--ms-danger);
}

.btn-danger:hover,
.btn-danger:focus {
    background-color: color-mix(in srgb, var(--danger) 84%, #000);
    border-color: color-mix(in srgb, var(--danger) 84%, #000);
}

.table {
    --bs-table-hover-bg: color-mix(in srgb, var(--primary) 7%, var(--surface));
    margin-bottom: 0;
}

.table thead th {
    background: var(--surface-secondary);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
    padding-bottom: 0.85rem;
    padding-top: 0.85rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody td {
    border-color: var(--border);
    padding-bottom: 0.82rem;
    padding-top: 0.82rem;
}

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

.table tbody tr:nth-child(even) > * {
    background-color: color-mix(in srgb, var(--surface-secondary) 35%, var(--surface));
}

.table-responsive,
.responsive-table-wrapper {
    border-radius: 0 0 8px 8px;
    overflow-x: auto;
    width: 100%;
}

.table-responsive table,
.responsive-table-wrapper table {
    min-width: 760px;
}

.table-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.text-truncate-cell {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-card {
    box-shadow: 0 10px 24px rgba(31, 41, 51, 0.035);
}

.table-column-width-input {
    flex: 0 0 5.75rem;
    width: 5.75rem;
}

.table-settings-modal .modal-dialog {
    --bs-modal-width: min(58rem, calc(100vw - 2rem));
}

.table-settings-modal-content {
    max-height: min(54rem, calc(100vh - 2rem));
    overflow: hidden;
}

.table-settings-modal-body {
    min-height: 0;
    overflow-y: auto;
}

.table-settings-column-list {
    border: 1px solid var(--border);
    border-radius: 6px;
    max-height: min(48vh, 32rem);
    overflow-y: auto;
}

.table-settings-column-row {
    border-left: 0;
    border-right: 0;
    gap: 0.55rem;
}

.table-settings-column-row:first-child {
    border-top: 0;
}

.table-settings-column-row:last-child {
    border-bottom: 0;
}

.table-settings-column-label {
    min-width: 13rem;
}

.table-settings-column-label .form-check-label {
    overflow-wrap: anywhere;
}

.table-settings-modal-footer {
    align-items: center;
    background: var(--surface);
    display: flex;
    justify-content: space-between;
    position: sticky;
    bottom: 0;
    z-index: 3;
}

.form-control,
.form-select {
    border-color: var(--ms-border);
    border-radius: 6px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ms-primary);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--primary) 18%, transparent);
}

a {
    color: var(--ms-primary);
}

.alert {
    border-radius: 8px;
}

.badge {
    border-radius: 999px;
    font-weight: 800;
    padding: 0.42em 0.66em;
}

.article-thumb {
    background: #fff;
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    display: block;
    height: 2.75rem;
    object-fit: contain;
    padding: 0.25rem;
    width: 3.75rem;
}

.article-thumb-placeholder,
.article-image-placeholder {
    align-items: center;
    background: #e6eff8;
    color: var(--ms-primary);
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
}

.article-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.article-section-nav a {
    background: #f3f6fa;
    border: 1px solid var(--ms-border);
    border-radius: 999px;
    color: #334e68;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.42rem 0.72rem;
    text-decoration: none;
}

.article-section-nav a:hover,
.article-section-nav a:focus {
    background: #e6eff8;
    border-color: #bfd0e3;
    color: var(--ms-primary);
}

.article-image-preview {
    align-items: center;
    background: #fff;
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    min-height: 9rem;
    padding: 1rem;
}

.article-image-preview img {
    display: block;
    max-height: 8rem;
    max-width: 100%;
    object-fit: contain;
}

.article-image-placeholder {
    border-radius: 8px;
    min-height: 7rem;
    width: 100%;
}

.text-bg-success {
    background-color: #dff6e9 !important;
    color: #17633d !important;
}

.text-bg-warning {
    background-color: #fff4cc !important;
    color: #7a5900 !important;
}

.text-bg-danger {
    background-color: #fde2df !important;
    color: var(--ms-danger) !important;
}

.text-bg-secondary {
    background-color: #edf1f5 !important;
    color: #486581 !important;
}

.text-bg-primary {
    background-color: #e6eff8 !important;
    color: var(--ms-primary) !important;
}

.danger-zone {
    border-color: #f2b8b5;
}

.reset-scope-item {
    background: #f9fbfd;
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    color: #334e68;
    min-height: 100%;
    padding: 0.75rem 0.85rem;
}

form.card .card-body,
.card .card-body {
    padding: 1rem;
}

form.card {
    border-color: #d2dce8;
}

.pagination {
    margin-bottom: 0;
}

.erp-pagination {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    width: 100%;
}

.erp-pagination-summary,
.erp-pagination-mobile-page {
    color: var(--ms-muted);
    font-size: 0.82rem;
}

.erp-pagination-mobile {
    align-items: center;
    gap: 0.65rem;
    justify-content: space-between;
    width: 100%;
}

.erp-pagination-button {
    background: #fff;
    border: 1px solid var(--ms-border);
    border-radius: 6px;
    color: var(--ms-primary);
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.48rem 0.72rem;
    text-decoration: none;
}

.erp-pagination-button:hover,
.erp-pagination-button:focus {
    background: #eef3f9;
    border-color: #bfd0e3;
    color: var(--ms-primary);
}

.erp-pagination-button.disabled {
    background: #f7f9fb;
    color: #9aa5b1;
    cursor: not-allowed;
}

.page-link {
    border-color: var(--ms-border);
    color: var(--ms-primary);
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.48rem 0.72rem;
}

.page-item.active .page-link {
    background: var(--ms-primary);
    border-color: var(--ms-primary);
}

.page-item.disabled .page-link {
    background: #f7f9fb;
    color: #9aa5b1;
}

.help-icon {
    align-items: center;
    background: #eef3f9;
    border: 1px solid #cbd7e6;
    border-radius: 999px;
    color: var(--ms-primary);
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 800;
    height: 1.25rem;
    justify-content: center;
    line-height: 1;
    margin-left: 0.3rem;
    padding: 0;
    width: 1.25rem;
}

.help-icon:hover,
.help-icon:focus {
    background: var(--ms-primary);
    border-color: var(--ms-primary);
    color: #fff;
    outline: none;
}

.help-button {
    align-items: center;
    display: inline-flex;
    gap: 0.4rem;
}

.help-button-mark {
    align-items: center;
    background: #e6eff8;
    border-radius: 999px;
    display: inline-flex;
    height: 1.2rem;
    justify-content: center;
    width: 1.2rem;
}

.help-floating-button {
    align-items: center;
    background: var(--ms-primary);
    border: 0;
    border-radius: 999px;
    bottom: 1.2rem;
    box-shadow: 0 16px 34px rgba(31, 41, 51, 0.18);
    color: #fff;
    display: inline-flex;
    font-weight: 800;
    gap: 0.45rem;
    padding: 0.72rem 1rem;
    position: fixed;
    right: 1.2rem;
    z-index: 1040;
}

.help-floating-button:hover,
.help-floating-button:focus {
    background: #00264d;
}

.help-offcanvas {
    border-left: 1px solid var(--ms-border);
}

.help-offcanvas-entry,
.help-panel-entry {
    background: #f9fbfd;
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    color: var(--ms-text);
    display: block;
    padding: 0.85rem;
}

.help-offcanvas-entry:hover,
.help-offcanvas-entry:focus,
.help-panel-entry:hover,
.help-panel-entry:focus {
    border-color: var(--ms-primary);
    box-shadow: 0 12px 26px rgba(31, 41, 51, 0.07);
}

.help-steps {
    padding-left: 1.25rem;
}

.help-steps li + li {
    margin-top: 0.35rem;
}

.wysiwyg-editor {
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    overflow: hidden;
}

.wysiwyg-toolbar {
    align-items: center;
    background: #f3f6fa;
    border-bottom: 1px solid var(--ms-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.45rem;
}

.wysiwyg-toolbar-group {
    align-items: center;
    border-right: 1px solid #d8e3ef;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding-right: 0.45rem;
}

.wysiwyg-toolbar-group:last-child {
    border-right: 0;
    padding-right: 0;
}

.wysiwyg-toolbar .btn {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
}

.wysiwyg-toolbar .form-select {
    max-width: 10.5rem;
    min-width: 5.25rem;
    width: auto;
}

.wysiwyg-color-control {
    align-items: center;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    cursor: pointer;
    display: inline-flex;
    height: 1.9375rem;
    justify-content: center;
    padding: 0.2rem 0.3rem;
}

.wysiwyg-color-control input {
    border: 0;
    cursor: pointer;
    height: 1.15rem;
    padding: 0;
    width: 1.35rem;
}

.wysiwyg-placeholder-select {
    max-width: 14rem;
}

.wysiwyg-editor-area {
    background: #fff;
    outline: none;
    overflow-x: auto;
    padding: 0.85rem;
}

.wysiwyg-editor-area:focus {
    box-shadow: inset 0 0 0 0.2rem rgba(0, 51, 102, 0.1);
}

.wysiwyg-editor-area p:last-child {
    margin-bottom: 0;
}

.wysiwyg-editor-area img,
.rich-text-content img,
.wysiwyg-preview img {
    height: auto;
    max-width: 100%;
}

.wysiwyg-editor-area table,
.rich-text-content table,
.wysiwyg-preview table {
    border-collapse: collapse;
    display: table;
    max-width: 100%;
    width: 100%;
}

.wysiwyg-editor-area td,
.wysiwyg-editor-area th,
.rich-text-content td,
.rich-text-content th,
.wysiwyg-preview td,
.wysiwyg-preview th {
    border: 1px solid #cbd5e1;
    padding: 0.4rem 0.5rem;
    vertical-align: top;
}

.wysiwyg-html-source {
    background: #fff;
    border: 0;
    color: #243b53;
    display: block;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 0.82rem;
    min-height: 18rem;
    outline: none;
    padding: 0.85rem;
    resize: vertical;
    width: 100%;
}

.wysiwyg-html-source:focus {
    box-shadow: inset 0 0 0 0.2rem rgba(0, 51, 102, 0.1);
}

.wysiwyg-preview {
    background: #f9fbfd;
    border-top: 1px solid var(--ms-border);
    overflow-x: auto;
    padding: 0.85rem;
}

.wysiwyg-preview-label {
    color: #52606d;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-bottom: 0.55rem;
    text-transform: uppercase;
}

.rich-text-content {
    color: #243b53;
    line-height: 1.55;
}

.rich-text-content p:last-child,
.rich-text-content ul:last-child,
.rich-text-content ol:last-child {
    margin-bottom: 0;
}

.placeholder-help {
    background: #f9fbfd;
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    padding: 0.85rem;
}

.placeholder-chip {
    background: #eef3f9;
    border: 1px solid #d8e3ef;
    border-radius: 999px;
    color: var(--ms-primary);
    display: inline-flex;
    font-size: 0.78rem;
    padding: 0.25rem 0.5rem;
}

.email-preview-frame {
    background: #fff;
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    color: #243b53;
    max-width: 100%;
    overflow-x: auto;
    padding: 1rem;
}

.email-preview-frame p:last-child,
.email-signature p:last-child {
    margin-bottom: 0;
}

.email-signature {
    border-top: 1px solid #edf1f5;
    color: #52606d;
    font-size: 0.9rem;
    margin-top: 1.25rem;
    padding-top: 0.85rem;
}

.branding-upload {
    align-items: center;
    border-bottom: 1px solid var(--border);
    display: grid;
    gap: 1rem;
    grid-template-columns: 8rem minmax(0, 1fr);
    padding-bottom: 1rem;
}

.branding-upload:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.branding-upload-preview {
    align-items: center;
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    height: 4.75rem;
    justify-content: center;
    overflow: hidden;
    padding: 0.5rem;
}

.branding-upload-preview img {
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.branding-preview-placeholder {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
}

.branding-color-control {
    align-items: center;
    display: flex;
    gap: 0.45rem;
}

.branding-color-control input[type="color"] {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    flex: 0 0 2.65rem;
    height: 2.4rem;
    padding: 0.18rem;
    width: 2.65rem;
}

.branding-preview-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
}

.branding-preview-logo {
    align-items: center;
    display: flex;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.branding-preview-logo > span {
    align-items: center;
    background: var(--primary);
    border-radius: 6px;
    color: #fff;
    display: flex;
    font-size: 0.7rem;
    font-weight: 800;
    height: 2.1rem;
    justify-content: center;
    width: 2.1rem;
}

.branding-preview-logo img {
    height: 2.1rem;
    max-width: 5rem;
    object-fit: contain;
}

.branding-preview-logo small {
    color: var(--text-secondary);
    display: block;
    font-size: 0.68rem;
}

.branding-preview-menu-item {
    align-items: center;
    border-radius: 5px;
    color: var(--secondary);
    display: flex;
    font-size: 0.78rem;
    gap: 0.45rem;
    padding: 0.48rem 0.55rem;
}

.branding-preview-menu-item.is-active {
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
    color: var(--primary);
    font-weight: 700;
}

.branding-preview-menu-item [data-lucide] {
    height: 0.95rem;
    width: 0.95rem;
}

.branding-preview-content {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 0.75rem;
    padding: 0.85rem;
}

.theme-style-modern .app-sidebar,
.theme-style-modern .card,
.theme-style-modern .filter-card {
    box-shadow: none;
}

.theme-style-modern .card,
.theme-style-modern .alert,
.theme-style-modern .btn,
.theme-style-modern .form-control,
.theme-style-modern .form-select {
    border-radius: 5px;
}

.theme-style-classic .app-sidebar {
    box-shadow: none;
}

.theme-style-classic .card,
.theme-style-classic .alert,
.theme-style-classic .btn,
.theme-style-classic .form-control,
.theme-style-classic .form-select,
.theme-style-classic .sidebar-search {
    border-radius: 3px;
}

@media (min-width: 992px) {
    body.sidebar-collapsed .app-sidebar {
        padding-left: 0.55rem;
        padding-right: 0.55rem;
        width: 4.65rem;
    }

    body.sidebar-collapsed .app-main {
        margin-left: 4.65rem;
    }

    body.sidebar-collapsed .sidebar-header {
        justify-content: center;
    }

    body.sidebar-collapsed .sidebar-section-title,
    body.sidebar-collapsed .sidebar-search input,
    body.sidebar-collapsed .brand-fallback-text,
    body.sidebar-collapsed .sidebar-group-label span,
    body.sidebar-collapsed .sidebar-group-label::after,
    body.sidebar-collapsed .sidebar-subnav {
        display: none;
    }

    body.sidebar-collapsed .sidebar-search {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    body.sidebar-collapsed .sidebar-logo {
        height: 2.15rem;
        max-width: 2.9rem;
    }

    body.sidebar-collapsed .sidebar-group-label,
    body.sidebar-collapsed .sidebar-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        box-shadow: 16px 0 40px rgba(31, 41, 51, 0.14);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        width: min(18rem, 86vw);
    }

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

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .app-main {
        margin-left: 0;
    }

    .app-topbar {
        padding: 0.75rem 1rem;
    }

    .app-content {
        padding: 1rem;
    }

    .topbar-actions {
        gap: 0.55rem;
    }

    .topbar-user-name {
        display: none;
    }

    .tenant-switcher-button {
        max-width: min(18rem, 42vw);
    }
}

@media (max-width: 575.98px) {
    .wysiwyg-toolbar {
        align-items: flex-start;
    }

    .wysiwyg-toolbar-group {
        border-right: 0;
        padding-right: 0;
    }

    .wysiwyg-toolbar .form-select,
    .wysiwyg-placeholder-select {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .table-settings-modal-content {
        max-height: 100vh;
    }

    .table-settings-column-list {
        max-height: none;
    }

    .table-settings-column-label {
        flex-basis: calc(100% - 5.75rem);
        min-width: 0;
    }

    .table-settings-modal-footer,
    .table-settings-modal-footer > div {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .table-settings-modal-footer .btn {
        justify-content: center;
        width: 100%;
    }

    .help-floating-button {
        bottom: 0.85rem;
        padding: 0.62rem 0.85rem;
        right: 0.85rem;
    }

    .navbar-logo {
        height: 2.5rem;
        max-width: min(11rem, 58vw);
    }

    .login-logo {
        height: 3rem;
    }

    .brand-logo-wrap {
        gap: 0.5rem;
    }

    .page-heading {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 0.75rem;
    }

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

    .topbar-left,
    .topbar-actions {
        justify-content: space-between;
        width: 100%;
    }

    .tenant-switcher {
        flex: 1 1 auto;
        min-width: 0;
    }

    .tenant-switcher-button {
        max-width: 100%;
        width: 100%;
    }

    .topbar-actions form:last-child {
        margin-left: auto;
    }
}

@media (max-width: 575.98px) {
    .app-content {
        padding: 0.85rem;
    }

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

    .topbar-icon-button,
    .topbar-user {
        display: none;
    }

    .tenant-switcher-label {
        display: none;
    }

    .card-body,
    form.card .card-body,
    .card .card-body {
        padding: 0.85rem;
    }

    .branding-upload {
        align-items: stretch;
        grid-template-columns: 1fr;
    }
}
