:root {
    --wcaf-bg: #eef6ff;
    --wcaf-bg-2: #f8fbff;
    --wcaf-surface: #ffffff;
    --wcaf-surface-soft: #f5f9ff;
    --wcaf-border: #dbe7f5;
    --wcaf-border-soft: #edf3fb;
    --wcaf-text: #172033;
    --wcaf-heading: #111936;
    --wcaf-muted: #64748b;
    --wcaf-primary: #3556d8;
    --wcaf-primary-2: #31b7e9;
    --wcaf-primary-dark: #243fb0;
    --wcaf-primary-soft: #eaf2ff;
    --wcaf-success: #12b76a;
    --wcaf-warning: #f79009;
    --wcaf-danger: #f04438;
    --wcaf-sidebar: #2c47b8;
    --wcaf-sidebar-2: #415cd4;
    --wcaf-sidebar-active: rgba(255, 255, 255, 0.96);
    --wcaf-radius-xl: 26px;
    --wcaf-radius-lg: 20px;
    --wcaf-radius-md: 14px;
    --wcaf-shadow: 0 24px 55px rgba(31, 56, 120, 0.13);
    --wcaf-shadow-soft: 0 14px 32px rgba(31, 56, 120, 0.08);
    --wcaf-topbar-height: 74px;
    --wcaf-sidebar-width: 284px;
}

* {
    box-sizing: border-box;
    min-width: 0;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    color: var(--wcaf-text);
    font-size: 0.95rem;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.app-body {
    background:
        radial-gradient(circle at 22rem 4rem, rgba(49, 183, 233, 0.19), transparent 19rem),
        radial-gradient(circle at 80% 10%, rgba(53, 86, 216, 0.11), transparent 23rem),
        linear-gradient(135deg, #edf7ff 0%, #f8fbff 52%, #eef4ff 100%);
}

a {
    text-decoration: none;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

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

.app-content-shell {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.app-sidebar {
    background:
        linear-gradient(160deg, rgba(58, 86, 210, 0.98) 0%, rgba(42, 64, 181, 0.98) 48%, rgba(34, 55, 156, 0.98) 100%),
        radial-gradient(circle at 30% 10%, rgba(255, 255, 255, 0.25), transparent 18rem);
    color: #fff;
    flex: 0 0 var(--wcaf-sidebar-width);
    flex-direction: column;
    min-height: 100vh;
    padding: 1.3rem 1.05rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-sidebar::before,
.app-sidebar::after,
.app-mobile-offcanvas::before,
.app-mobile-offcanvas::after {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    content: "";
    height: 2px;
    left: -2rem;
    position: absolute;
    transform: rotate(48deg);
    width: 14rem;
}

.app-sidebar::before,
.app-mobile-offcanvas::before {
    top: 8.5rem;
}

.app-sidebar::after,
.app-mobile-offcanvas::after {
    bottom: 7.5rem;
    left: auto;
    right: -3.2rem;
}

.app-sidebar-brand {
    margin-bottom: 1.6rem;
    padding: 0.2rem 0.25rem;
    position: relative;
    z-index: 1;
}

.app-brand {
    align-items: center;
    color: inherit;
    display: inline-flex;
    font-weight: 850;
    gap: 0.7rem;
    letter-spacing: -0.035em;
}

.app-brand:hover {
    color: inherit;
}

.app-brand-mark {
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(11, 26, 86, 0.18);
    color: var(--wcaf-primary);
    display: inline-flex;
    flex: 0 0 42px;
    font-size: 1.1rem;
    font-weight: 950;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.app-brand-copy {
    display: grid;
    line-height: 1.08;
}

.app-brand-title {
    color: inherit;
    font-size: 1.04rem;
    font-weight: 900;
}

.app-brand-subtitle {
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0;
}

.app-nav {
    display: grid;
    gap: 0.48rem;
    position: relative;
    z-index: 1;
}

.app-nav-link {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.83);
    display: flex;
    font-weight: 800;
    gap: 0.78rem;
    min-height: 52px;
    padding: 0.62rem 0.75rem;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.app-nav-link:hover {
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
    transform: translateX(2px);
}

.app-nav-link.active {
    background: var(--wcaf-sidebar-active);
    box-shadow: 0 16px 32px rgba(13, 31, 95, 0.18);
    color: var(--wcaf-primary-dark);
}

.app-nav-icon {
    align-items: center;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 15px;
    display: inline-flex;
    flex: 0 0 38px;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.app-nav-link.active .app-nav-icon {
    background: linear-gradient(135deg, var(--wcaf-primary), var(--wcaf-primary-2));
    border-color: transparent;
    color: #fff;
}

.app-nav-svg {
    fill: none;
    height: 19px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 19px;
}

.app-sidebar-footer {
    margin-top: auto;
    padding: 1rem 0.35rem 0.2rem;
    position: relative;
    z-index: 1;
}

.app-system-pill {
    align-items: center;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: 800;
    gap: 0.55rem;
    padding: 0.48rem 0.7rem;
}

.app-status-dot {
    background: #33d889;
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(51, 216, 137, 0.16);
    display: inline-flex;
    height: 8px;
    width: 8px;
}

.app-topbar {
    background: rgba(248, 251, 255, 0.72);
    border-bottom: 1px solid rgba(219, 231, 245, 0.72);
    backdrop-filter: blur(14px);
    z-index: 1015;
}

.app-topbar.is-scrolled {
    box-shadow: 0 12px 30px rgba(31, 56, 120, 0.08);
}

.app-topbar-inner {
    align-items: center;
    display: flex;
    gap: 0.85rem;
    min-height: var(--wcaf-topbar-height);
    padding: 0 1.7rem;
}

.app-topbar-kicker {
    color: var(--wcaf-muted);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    line-height: 1.1;
    text-transform: uppercase;
}

.app-topbar-heading {
    color: var(--wcaf-heading);
    font-weight: 900;
    letter-spacing: -0.04em;
}

.app-menu-button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--wcaf-border);
    border-radius: 14px;
    box-shadow: var(--wcaf-shadow-soft);
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    height: 42px;
    justify-content: center;
    width: 44px;
}

.app-menu-button span {
    background: var(--wcaf-primary-dark);
    border-radius: 99px;
    display: block;
    height: 2px;
    width: 18px;
}

.app-user-email {
    align-items: center;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--wcaf-border);
    border-radius: 999px;
    color: var(--wcaf-muted);
    font-size: 0.82rem;
    font-weight: 750;
    max-width: 310px;
    overflow: hidden;
    padding: 0.47rem 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-logout-btn {
    border: 1px solid var(--wcaf-border);
    box-shadow: 0 8px 18px rgba(31, 56, 120, 0.06);
}

.app-main {
    flex: 1;
    margin: 0 auto;
    max-width: 1500px;
    padding: 1.65rem 1.7rem 3rem;
    width: 100%;
}

.app-alert {
    border: 0;
    border-radius: var(--wcaf-radius-lg);
    box-shadow: var(--wcaf-shadow-soft);
}

.page-header,
.page-title-row {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.64)),
        radial-gradient(circle at 80% 10%, rgba(49, 183, 233, 0.2), transparent 17rem);
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: var(--wcaf-radius-xl);
    box-shadow: var(--wcaf-shadow-soft);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding: 1.25rem;
}

.page-header h1,
.page-title-row h1 {
    color: var(--wcaf-heading);
    font-weight: 900;
    letter-spacing: -0.055em;
    margin-bottom: 0.2rem;
}

.page-header p,
.page-title-row p {
    color: var(--wcaf-muted) !important;
    max-width: 840px;
}

.card,
.app-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.84) !important;
    border-radius: var(--wcaf-radius-xl);
    box-shadow: var(--wcaf-shadow-soft);
    overflow: hidden;
}

.card-header,
.card-footer {
    background: rgba(255, 255, 255, 0.72) !important;
    border-color: var(--wcaf-border-soft);
}

.card-header:first-child {
    border-top-left-radius: var(--wcaf-radius-xl);
    border-top-right-radius: var(--wcaf-radius-xl);
}

.card-footer:last-child {
    border-bottom-left-radius: var(--wcaf-radius-xl);
    border-bottom-right-radius: var(--wcaf-radius-xl);
}

.metric-card {
    min-height: 128px;
    position: relative;
}

.metric-card::after {
    background: radial-gradient(circle, rgba(49, 183, 233, 0.18), transparent 65%);
    border-radius: 999px;
    content: "";
    height: 130px;
    position: absolute;
    right: -46px;
    top: -46px;
    width: 130px;
}

.metric-label {
    color: var(--wcaf-muted);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    position: relative;
    text-transform: uppercase;
    z-index: 1;
}

.metric-value {
    color: var(--wcaf-heading);
    font-size: clamp(1.85rem, 3vw, 2.7rem);
    font-weight: 950;
    letter-spacing: -0.075em;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.metric-card .small {
    position: relative;
    z-index: 1;
}

.ui-hero-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
    margin-bottom: 1.25rem;
}

.ui-hero-card {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72)),
        radial-gradient(circle at 100% 0%, rgba(49, 183, 233, 0.26), transparent 18rem),
        radial-gradient(circle at 0% 100%, rgba(53, 86, 216, 0.14), transparent 18rem);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--wcaf-radius-xl);
    box-shadow: var(--wcaf-shadow-soft);
    min-height: 220px;
    overflow: hidden;
    padding: 1.25rem;
    position: relative;
}

.ui-hero-card::after {
    background: linear-gradient(180deg, rgba(53, 86, 216, 0.14), rgba(49, 183, 233, 0.04));
    border-radius: 999px;
    content: "";
    height: 240px;
    position: absolute;
    right: -100px;
    top: -70px;
    transform: rotate(-24deg);
    width: 150px;
}

.ui-hero-kicker {
    color: var(--wcaf-primary);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.ui-hero-title {
    color: var(--wcaf-heading);
    font-size: clamp(1.8rem, 4vw, 3.05rem);
    font-weight: 950;
    letter-spacing: -0.075em;
    line-height: 0.98;
    margin: 0.65rem 0 0.7rem;
    max-width: 740px;
}

.ui-hero-text {
    color: var(--wcaf-muted);
    font-size: 1rem;
    max-width: 660px;
}

.ui-action-grid {
    display: grid;
    gap: 0.72rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 1.2rem;
}

.ui-action-tile {
    align-items: center;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--wcaf-border-soft);
    border-radius: 18px;
    color: var(--wcaf-heading);
    display: flex;
    font-weight: 850;
    gap: 0.65rem;
    min-height: 62px;
    padding: 0.75rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.ui-action-tile:hover {
    background: #fff;
    box-shadow: var(--wcaf-shadow-soft);
    color: var(--wcaf-primary-dark);
    transform: translateY(-2px);
}

.ui-action-dot {
    align-items: center;
    background: linear-gradient(135deg, var(--wcaf-primary), var(--wcaf-primary-2));
    border-radius: 16px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 38px;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.ui-forecast-card {
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.86);
    border-radius: var(--wcaf-radius-xl);
    box-shadow: var(--wcaf-shadow-soft);
    min-height: 220px;
    overflow: hidden;
    padding: 1.15rem;
}

.ui-waterfall {
    align-items: end;
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(6, 1fr);
    height: 145px;
    margin-top: 0.75rem;
}

.ui-waterfall span {
    align-items: center;
    background: linear-gradient(180deg, #3b56d2, #2945bd);
    border-radius: 8px 8px 3px 3px;
    color: #fff;
    display: flex;
    font-size: 0.78rem;
    font-weight: 900;
    justify-content: center;
    min-height: 24px;
}

.ui-waterfall span:last-child {
    background: linear-gradient(180deg, #13b76f, #0f985d);
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.88rem 1rem;
}

.table thead th {
    background: rgba(245, 249, 255, 0.92);
    border-bottom: 1px solid var(--wcaf-border-soft);
    color: var(--wcaf-muted);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody td {
    border-color: var(--wcaf-border-soft);
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(234, 242, 255, 0.58);
}

.table-actions {
    white-space: nowrap;
}

.form-label {
    color: #344054;
    font-weight: 850;
}

.form-control,
.form-select {
    background-color: rgba(255, 255, 255, 0.86);
    border-color: #d9e6f5;
    border-radius: 14px;
    min-height: 46px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--wcaf-primary);
    box-shadow: 0 0 0 0.22rem rgba(53, 86, 216, 0.13);
}

.btn {
    border-radius: 14px;
    font-weight: 850;
    min-height: 42px;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--wcaf-primary), var(--wcaf-primary-dark));
    border-color: var(--wcaf-primary);
    box-shadow: 0 12px 22px rgba(53, 86, 216, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, var(--wcaf-primary-dark), #1e3498);
    border-color: var(--wcaf-primary-dark);
}

.btn-outline-primary {
    border-color: rgba(53, 86, 216, 0.28);
    color: var(--wcaf-primary-dark);
}

.btn-outline-primary:hover {
    background: var(--wcaf-primary);
    border-color: var(--wcaf-primary);
}

.btn-outline-secondary {
    border-color: #d8e2ef;
    color: #475569;
}

.badge {
    border-radius: 999px;
    font-weight: 900;
    padding: 0.43rem 0.68rem;
}

.code-break,
code.user-select-all {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.integration-step {
    background: rgba(245, 249, 255, 0.78);
    border-left: 4px solid var(--wcaf-primary);
    border-radius: 0 16px 16px 0;
    padding: 0.9rem 1rem;
}

.auth-body {
    align-items: center;
    background:
        radial-gradient(circle at 15% 15%, rgba(49, 183, 233, 0.24), transparent 24rem),
        radial-gradient(circle at 90% 10%, rgba(53, 86, 216, 0.2), transparent 25rem),
        linear-gradient(135deg, #eef8ff, #f8fbff 52%, #edf4ff);
    display: flex;
    min-height: 100vh;
}

.auth-body main {
    width: 100%;
}

.auth-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.86) !important;
    border-radius: 30px;
    box-shadow: var(--wcaf-shadow);
    overflow: hidden;
}

.auth-brand-lockup {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1.6rem;
    text-align: center;
}

.auth-brand-lockup .app-brand-mark {
    background: linear-gradient(135deg, var(--wcaf-primary), var(--wcaf-primary-2));
    color: #fff;
}

.app-mobile-offcanvas {
    background:
        linear-gradient(160deg, rgba(58, 86, 210, 0.99) 0%, rgba(42, 64, 181, 0.99) 100%);
    color: #fff;
    max-width: 340px;
    overflow: hidden;
}

.app-mobile-offcanvas .offcanvas-header,
.app-mobile-offcanvas .offcanvas-body {
    position: relative;
    z-index: 1;
}

.app-mobile-offcanvas .app-nav-link {
    color: rgba(255, 255, 255, 0.86);
}

.app-mobile-offcanvas .app-nav-link.active {
    color: var(--wcaf-primary-dark);
}

@media (min-width: 1400px) {
    .app-main {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (max-width: 1199.98px) {
    .ui-hero-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    :root {
        --wcaf-topbar-height: 66px;
    }

    .app-shell {
        display: block;
    }

    .app-topbar-inner {
        min-height: var(--wcaf-topbar-height);
        padding-left: 0.9rem;
        padding-right: 0.9rem;
    }

    .app-brand-mobile .app-brand-mark {
        flex-basis: 38px;
        height: 38px;
        width: 38px;
    }

    .app-main {
        padding: 1rem 1rem 4rem;
    }

    .page-header,
    .page-title-row {
        align-items: stretch;
        display: grid;
        gap: 0.85rem;
        padding: 1rem;
    }

    .page-header > .d-flex,
    .page-title-row > .d-flex {
        flex-wrap: wrap;
    }

    .page-header .btn,
    .page-title-row .btn {
        flex: 1 1 auto;
    }

    .ui-action-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 0.93rem;
    }

    .app-main {
        padding: 0.82rem 0.75rem 4rem;
    }

    .card,
    .app-card,
    .page-header,
    .page-title-row,
    .ui-hero-card,
    .ui-forecast-card {
        border-radius: 22px;
    }

    .card-body,
    .card-header,
    .card-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .metric-card {
        min-height: 112px;
    }

    .ui-hero-title {
        font-size: clamp(1.55rem, 10vw, 2.15rem);
    }

    .ui-waterfall {
        height: 120px;
    }

    .mobile-stack-table {
        border-collapse: separate;
        border-spacing: 0 0.75rem;
        margin-top: -0.45rem;
    }

    .mobile-stack-table thead {
        display: none;
    }

    .mobile-stack-table tbody,
    .mobile-stack-table tr,
    .mobile-stack-table td {
        display: block;
        width: 100%;
    }

    .mobile-stack-table tr {
        background: rgba(255, 255, 255, 0.94);
        border: 1px solid rgba(255, 255, 255, 0.86);
        border-radius: 18px;
        box-shadow: 0 10px 20px rgba(31, 56, 120, 0.075);
        margin: 0 0 0.8rem;
        overflow: hidden;
    }

    .mobile-stack-table td {
        border: 0;
        border-bottom: 1px solid var(--wcaf-border-soft);
        padding: 0.82rem 0.95rem;
    }

    .mobile-stack-table td:last-child {
        border-bottom: 0;
    }

    .mobile-stack-table td[data-label]::before {
        color: var(--wcaf-muted);
        content: attr(data-label);
        display: block;
        font-size: 0.69rem;
        font-weight: 950;
        letter-spacing: 0.055em;
        line-height: 1.2;
        margin-bottom: 0.25rem;
        text-transform: uppercase;
    }

    .table-actions {
        display: grid !important;
        gap: 0.5rem;
        text-align: left !important;
        white-space: normal;
    }

    .table-actions .btn {
        width: 100%;
    }

    .pagination {
        gap: 0.25rem;
    }
}

@media (max-width: 575.98px) {
    .app-brand-title {
        font-size: 0.96rem;
    }

    .app-topbar .btn,
    .app-menu-button {
        width: auto;
    }

    .app-logout-btn {
        min-height: 38px;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .page-header .btn,
    .page-title-row .btn,
    .card .d-flex.justify-content-end .btn,
    .card-footer.d-flex .btn {
        width: 100%;
    }

    .card .d-flex.justify-content-end,
    .card-footer.d-flex {
        display: grid !important;
        gap: 0.5rem !important;
    }

    .row.g-3 > [class*="col-6"] {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

/* v0.6.6 merchant SMTP and grouped owner menu */
.app-nav-group {
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 24px;
    padding: 0.42rem;
}

.app-nav-group.active {
    background: rgba(255, 255, 255, 0.08);
}

.app-nav-group-label {
    align-items: center;
    color: rgba(255, 255, 255, 0.88);
    display: flex;
    font-weight: 900;
    gap: 0.78rem;
    min-height: 48px;
    padding: 0.46rem 0.34rem;
}

.app-nav-submenu {
    display: grid;
    gap: 0.28rem;
    margin: 0.2rem 0 0.1rem 3.1rem;
}

.app-nav-sublink {
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.92rem;
    font-weight: 820;
    min-height: 38px;
    padding: 0.5rem 0.78rem;
}

.app-nav-sublink:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.app-nav-sublink.active {
    background: rgba(255, 255, 255, 0.94);
    color: var(--wcaf-primary-dark);
}

.email-preview-box {
    background: rgba(246, 248, 255, 0.92);
    border: 1px solid var(--wcaf-border-soft);
    border-radius: 18px;
    padding: 1rem;
}

.email-preview-box textarea {
    min-height: 260px;
}

.email-disabled-hint {
    align-items: center;
    background: rgba(255, 193, 7, 0.12);
    border: 1px solid rgba(255, 193, 7, 0.35);
    border-radius: 16px;
    color: #6b4b00;
    display: flex;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
}

@media (max-width: 991.98px) {
    .app-nav-submenu {
        margin-left: 2.65rem;
    }
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: rgba(37, 99, 235, 0.035);
}

@media (max-width: 767.98px) {
    #balanceDetailsModal .modal-dialog {
        margin: 0.5rem;
    }
}

/* v0.7.6 fixed sidebar and internal menu scroll */
@media (min-width: 992px) {
    body.has-app-sidebar .app-content-shell {
        margin-left: var(--wcaf-sidebar-width);
    }

    .app-sidebar {
        bottom: 0;
        height: 100vh;
        left: 0;
        min-height: 0;
        overflow: hidden;
        padding: 1rem 0.85rem;
        position: fixed;
        top: 0;
        width: var(--wcaf-sidebar-width);
    }

    .app-sidebar-brand {
        flex: 0 0 auto;
        margin-bottom: 0.85rem;
    }

    .app-sidebar-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding-right: 0.18rem;
        scrollbar-gutter: stable;
        overscroll-behavior: contain;
    }

    .app-sidebar-scroll::-webkit-scrollbar {
        width: 7px;
    }

    .app-sidebar-scroll::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.06);
        border-radius: 999px;
    }

    .app-sidebar-scroll::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.28);
        border-radius: 999px;
    }

    .app-nav {
        gap: 0.34rem;
    }

    .app-nav-link {
        font-size: 0.91rem;
        gap: 0.62rem;
        min-height: 44px;
        padding: 0.46rem 0.58rem;
    }

    .app-nav-icon {
        border-radius: 13px;
        flex-basis: 33px;
        height: 33px;
        width: 33px;
    }

    .app-nav-svg {
        height: 17px;
        width: 17px;
    }

    .app-nav-group {
        border-radius: 20px;
        padding: 0.32rem;
    }

    .app-nav-group-label {
        font-size: 0.91rem;
        gap: 0.62rem;
        min-height: 40px;
        padding: 0.34rem 0.25rem;
    }

    .app-nav-submenu {
        gap: 0.18rem;
        margin: 0.08rem 0 0.05rem 2.62rem;
    }

    .app-nav-sublink {
        font-size: 0.86rem;
        min-height: 32px;
        padding: 0.36rem 0.62rem;
    }

    .app-sidebar-footer {
        flex: 0 0 auto;
        padding: 0.65rem 0.25rem 0.1rem;
    }

    .app-system-pill {
        font-size: 0.74rem;
        padding: 0.38rem 0.58rem;
    }
}

@media (max-width: 991.98px) {
    .app-mobile-offcanvas .app-sidebar-scroll {
        max-height: calc(100vh - 90px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

.performance-metrics {
    display: grid;
    gap: 0.18rem;
}

.performance-metrics code {
    color: inherit;
    font-size: 0.78rem;
}

/* v0.8.3 collapsible sidebar submenus */
.app-nav-group-label {
    background: transparent;
    border: 0;
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.app-nav-group-label:hover {
    background: rgba(255, 255, 255, 0.08);
}

.app-nav-group-text {
    flex: 1 1 auto;
    min-width: 0;
}

.app-nav-chevron {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
    line-height: 1;
    margin-left: auto;
    transition: transform 0.16s ease;
}

.app-nav-group.collapsed .app-nav-submenu {
    display: none;
}

.app-nav-group.collapsed .app-nav-chevron {
    transform: rotate(-90deg);
}

@media (min-width: 992px) {
    .app-nav-group-label {
        border-radius: 15px;
    }
}

/* v0.8.4 - topbar notifications */
.app-notification-dropdown {
    position: relative;
}

.app-notification-btn {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    height: 38px;
    justify-content: center;
    min-width: 38px;
    padding: 0.35rem 0.58rem;
    position: relative;
}

.app-notification-bell {
    display: inline-flex;
    font-size: 1rem;
    line-height: 1;
}

.app-notification-badge {
    align-items: center;
    background: var(--wcaf-danger);
    border: 2px solid #fff;
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 0.65rem;
    font-weight: 900;
    height: 19px;
    justify-content: center;
    min-width: 19px;
    padding: 0 0.28rem;
    position: absolute;
    right: -0.24rem;
    top: -0.34rem;
}

.app-notification-menu {
    border: 1px solid var(--wcaf-border);
    border-radius: 18px;
    max-width: calc(100vw - 1.5rem);
    min-width: min(390px, calc(100vw - 1.5rem));
    overflow: hidden;
    padding: 0;
}

.app-notification-list {
    max-height: 390px;
    overflow-y: auto;
}

.app-notification-item {
    align-items: flex-start;
    background: #fff;
    border: 0;
    border-bottom: 1px solid var(--wcaf-border-soft);
    color: var(--wcaf-text);
    display: flex;
    gap: 0.72rem;
    padding: 0.82rem 0.95rem;
    text-align: left;
    width: 100%;
}

.app-notification-item:hover {
    background: var(--wcaf-surface-soft);
}

.app-notification-item.unread {
    background: #f7fbff;
}

.app-notification-dot {
    border-radius: 999px;
    flex: 0 0 9px;
    height: 9px;
    margin-top: 0.35rem;
    width: 9px;
}

.app-notification-dot-low {
    background: var(--wcaf-muted);
}

.app-notification-dot-normal {
    background: var(--wcaf-primary);
}

.app-notification-dot-high {
    background: var(--wcaf-danger);
    box-shadow: 0 0 0 4px rgba(240, 68, 56, 0.12);
}

.app-notification-copy {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.app-notification-copy strong {
    color: var(--wcaf-heading);
    font-size: 0.88rem;
    line-height: 1.2;
}

.app-notification-copy small {
    color: var(--wcaf-muted);
    font-size: 0.78rem;
    line-height: 1.25;
}

.app-notification-copy em {
    color: #94a3b8;
    font-size: 0.72rem;
    font-style: normal;
}

.app-language-switcher .form-select {
    min-width: 7.2rem;
    padding-bottom: 0.32rem;
    padding-top: 0.32rem;
}

.auth-language-switcher {
    z-index: 20;
}

@media (max-width: 575.98px) {
    .app-language-switcher .form-select {
        min-width: 5.8rem;
        max-width: 6.5rem;
        font-size: 0.78rem;
    }
}

/* v0.9.1 - settings/email UX hardening */
.app-language-switcher .app-language-compact {
    min-width: 4.2rem;
    max-width: 4.8rem;
    text-align: center;
    text-transform: uppercase;
}

.settings-subnav {
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--wcaf-border-soft);
    border-radius: 999px;
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.35rem;
}

.settings-subnav-link {
    border-radius: 999px;
    color: var(--wcaf-muted);
    font-size: 0.9rem;
    font-weight: 800;
    padding: 0.55rem 0.9rem;
    white-space: nowrap;
}

.settings-subnav-link:hover {
    background: var(--wcaf-primary-soft);
    color: var(--wcaf-primary-dark);
}

.settings-subnav-link.active {
    background: linear-gradient(135deg, var(--wcaf-primary), var(--wcaf-primary-2));
    box-shadow: 0 12px 22px rgba(53, 86, 216, 0.2);
    color: #fff;
}

.form-grid-balanced > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.form-grid-balanced .form-label,
.card .form-label {
    min-height: 1.35rem;
}

.form-grid-balanced .form-control,
.form-grid-balanced .form-select,
.per_page_toolbar .form-control,
.per_page_toolbar .form-select {
    min-height: 2.55rem;
}

.template-panel {
    background: var(--wcaf-surface-soft);
    border: 1px solid var(--wcaf-border-soft);
    border-radius: var(--wcaf-radius-md);
    padding: 1rem;
}

.template-panel textarea {
    min-height: 18rem;
    resize: vertical;
}

@media (max-width: 575.98px) {
    .settings-subnav {
        align-items: stretch;
        border-radius: var(--wcaf-radius-md);
        display: grid;
        width: 100%;
    }

    .settings-subnav-link {
        text-align: center;
    }

    .app-language-switcher .app-language-compact {
        min-width: 3.8rem;
        max-width: 4.2rem;
    }
}
