html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* ========= Custom scrollbar ========= */

/* Firefox / modern standards */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.45) transparent;
}

/* WebKit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5568d3, #6a3f8f);
    background-clip: padding-box;
}

/* Dark-themed scrollbar for the log viewer */
.log-viewer::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 8px;
}

.log-viewer {
    scrollbar-color: rgba(102, 126, 234, 0.6) #2a2a2a;
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #1a1a2e 0%, #16213e 45%, #0f3460 100%);
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
    background-repeat: no-repeat;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(10, 14, 30, 0.25) 0%, rgba(15, 52, 96, 0.18) 100%);
    z-index: 0;
}

    body > main {
        flex: 1;
        position: relative;
        width: 100%;
        overflow-y: auto;
        animation: pageFadeIn 0.9s ease-out;
    }

    body > main > .main-content {
        max-width: 80%;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

    body > header {
        flex: 0 0 auto;
        position: relative;
        z-index: 10;
    }

    body > footer {
        flex: 0 0 auto;
        position: relative;
        z-index: 10;
    }

.offcanvas-nav-item {
    display: none;
}

    .offcanvas.show .offcanvas-nav-item,
    .offcanvas.showing .offcanvas-nav-item {
        display: block;
    }

.offcanvas.show .offcanvas-non-canvas-item,
.offcanvas.showing .offcanvas-non-canvas-item {
    display: none;
}

/* ========= Layout (from _Layout.cshtml.css) ========= */

/* ---- Navbar ---- */

.navbar.bg-primary {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%) !important;
    border-bottom: 2px solid rgba(102, 126, 234, 0.4);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.navbar .navbar-nav {
    align-items: center;
}

.navbar .navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

.navbar .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s, transform 0.15s;
    position: relative;
    display: flex;
    align-items: center;
}

.navbar .navbar-nav .nav-link:hover {
    color: #fff;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.35), rgba(118, 75, 162, 0.35));
    transform: translateY(-1px);
}

.navbar .navbar-nav .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Vertical separators between nav items (desktop only) */
@media (min-width: 992px) {
    .navbar .navbar-nav .nav-item + .nav-item {
        margin-left: 6px;
        position: relative;
    }

    .navbar .navbar-nav .nav-item + .nav-item::before {
        content: '';
        position: absolute;
        left: -4px;
        top: 50%;
        transform: translateY(-50%);
        width: 1px;
        height: 18px;
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Home icon in navbar */
.nav-icon {
    height: 40px;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s, filter 0.2s;
}

.nav-icon:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.5));
}

/* Brand styling */
a.navbar-brand {
    white-space: normal;
    text-align: center;
    word-break: break-all;
    padding: 0;
    margin-right: 1rem;
    color: #fff !important;
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: opacity 0.2s;
}

a.navbar-brand:hover {
    opacity: 0.85;
}

/* Account dropdown button */
.navbar .btn-link.nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    transition: color 0.2s, background 0.2s;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
}

.navbar .btn-link.nav-link:hover {
    color: #fff !important;
    background: rgba(102, 126, 234, 0.3);
}

a {
    color: #0077cc;
}

.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.border-top {
    border-top: 1px solid #e5e5e5;
}

.border-bottom {
    border-bottom: 1px solid #e5e5e5;
}

.box-shadow {
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}

button.accept-policy {
    font-size: 1rem;
    line-height: inherit;
}

#brandFallback {
    display: none;
    align-items: center;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

/* ========= Page headings ========= */

.page-heading {
    color: white;
}

/* ========= Gradient button (reusable) ========= */

.btn-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 24px;
    letter-spacing: 0.3px;
    color: white;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-gradient-lg {
    padding: 12px 24px;
    letter-spacing: 0.5px;
}

/* ========= Sign-in form ========= */

.signin-form {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.signin-form .form-label {
    color: #555;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.95rem;
    text-align: center;
}

.signin-form .form-control {
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 12px 14px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fafafa;
    text-align: center;
}

.signin-form .form-control:focus {
    background-color: white;
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.signin-form .form-control::placeholder {
    color: #999;
    opacity: 0.7;
    text-align: center;
}

.signin-form .form-group {
    margin-bottom: 1.5rem;
    text-align: center;
}

.signin-form .form-group:last-of-type {
    margin-bottom: 2rem;
}

.signin-form .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 12px 0;
    font-weight: 600;
    border-radius: 8px;
}

.signin-form .btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.signin-container {
    min-height: 60vh;
}

.signin-submit {
    border-radius: 8px;
    font-weight: 600;
    padding: 12px 24px;
    letter-spacing: 0.5px;
    min-width: 250px;
    display: block;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .signin-form {
        padding: 1.5rem;
    }
}

/* ========= Cookie consent overlay ========= */

.cookie-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.cookie-banner {
    background: #ffffff;
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
    animation: cookieSlideUp 0.4s ease-out;
}

@keyframes cookieSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cookie-banner-icon {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 0.75rem;
}

.cookie-banner-title {
    font-weight: 700;
    color: #333;
    margin-bottom: 0.75rem;
}

.cookie-banner-text {
    font-size: 0.93rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.cookie-banner-text a {
    color: #667eea;
    text-decoration: underline;
}

.cookie-accept-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 12px 36px;
    font-size: 1rem;
    letter-spacing: 0.3px;
    margin-top: 0.5rem;
}

.cookie-accept-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.cookie-essential-btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 12px 36px;
    font-size: 1rem;
    letter-spacing: 0.3px;
}

/* ========= Styled modals (user-modal / delete-modal) ========= */

.user-modal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.user-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    padding: 1.25rem 1.5rem;
    border-bottom: none;
}

.user-modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.user-modal .modal-body {
    padding: 1.5rem 2rem;
}

.user-modal .modal-footer {
    border-top: 1px solid #eee;
    padding: 1rem 2rem;
}

.user-modal .form-label {
    color: #555;
    font-weight: 600;
    font-size: 0.95rem;
}

.user-modal .form-control,
.user-modal .form-select {
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 10px 14px;
    font-size: 1rem;
    background-color: #fafafa;
    transition: all 0.3s ease;
}

.user-modal .form-control:focus,
.user-modal .form-select:focus {
    background-color: white;
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.user-modal .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 24px;
    letter-spacing: 0.3px;
}

.user-modal .btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.user-modal .btn-secondary {
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 24px;
}

.user-modal .section-divider {
    border-top: 1px solid #eee;
    margin: 1rem 0;
}

/* ========= Mailbox Wizard ========= */

.wizard-indicators {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.wizard-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 70px;
    transition: all 0.3s ease;
}

.wizard-indicator-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e9ecef;
    color: #adb5bd;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.wizard-indicator-label {
    font-size: 0.75rem;
    color: #adb5bd;
    font-weight: 600;
    transition: color 0.3s ease;
}

.wizard-indicator.active .wizard-indicator-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.wizard-indicator.active .wizard-indicator-label {
    color: #667eea;
}

.wizard-indicator.completed .wizard-indicator-number {
    background: #28a745;
    color: white;
}

.wizard-indicator.completed .wizard-indicator-label {
    color: #28a745;
}

.wizard-indicator-line {
    flex: 1;
    height: 2px;
    background: #e9ecef;
    margin: 0 8px;
    margin-bottom: 20px;
    min-width: 20px;
}

.wizard-provider-card,
.wizard-auth-card {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fafafa;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wizard-provider-card:hover,
.wizard-auth-card:hover {
    border-color: #667eea;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.wizard-provider-card.selected,
.wizard-auth-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}


.delete-modal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.delete-modal .modal-header {
    background: #dc3545;
    color: white;
    border-radius: 12px 12px 0 0;
    padding: 1.25rem 1.5rem;
    border-bottom: none;
}

.delete-modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.delete-modal .modal-body {
    padding: 1.5rem 2rem;
}

.delete-modal .modal-footer {
    border-top: 1px solid #eee;
    padding: 1rem 2rem;
}

.delete-modal .btn-danger {
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 24px;
}

.delete-modal .btn-secondary {
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 24px;
}

/* ========= Chart containers ========= */

.chart-container {
    position: relative;
    height: 350px;
}

/* ========= Whitelist scroll panel ========= */

.whitelist-scroll {
    max-height: 300px;
    overflow-y: auto;
}

/* ========= Sign-in page fade-in ========= */

.signin-container main {
    opacity: 1;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========= Mailbox slot meter ========= */

.slot-meter {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.slot-meter-label {
    font-weight: 600;
    font-size: 1.05rem;
    color: #333;
}

.slot-meter-count {
    font-weight: 700;
    font-size: 1.05rem;
    color: #555;
}

.slot-meter-separator {
    color: #aaa;
    margin: 0 1px;
}

.slot-meter-track {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.slot-dot {
    width: 3rem;
    height: 3rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 4.5rem;
}

.slot-dot-filled {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.slot-dot-empty {
    background: #f0f0f0;
    color: #ccc;
    border: 2px dashed #ddd;
}

.slot-meter-bar {
    height: 6px;
    border-radius: 3px;
    background-color: #e9ecef;
}

.slot-meter-bar .progress-bar {
    border-radius: 3px;
    transition: width 0.6s ease;
}

.slot-meter-status {
    font-size: 0.9rem;
    text-align: center;
}

/* ========= Buy Now page ========= */

.buy-now-icon {
    font-size: 3.5rem;
    color: #667eea;
}

.buy-now-price-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 1.5rem;
    color: white;
}

.buy-now-price {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.buy-now-currency {
    font-size: 1.5rem;
    vertical-align: super;
    font-weight: 600;
    margin-right: 2px;
}

.buy-now-period {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.85;
    margin-left: 4px;
}

.buy-now-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.buy-now-features li {
    padding: 0.5rem 0;
    font-size: 1.05rem;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.buy-now-features li:last-child {
    border-bottom: none;
}

/* ========= System Settings ========= */

.system-test-icon {
    font-size: 2.5rem;
}

.log-viewer {
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    border-radius: 8px;
    padding: 12px 16px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-entry {
    padding: 1px 0;
    border-bottom: 1px solid #2d2d2d;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-level-error {
    color: #f48771;
}

.log-level-warn {
    color: #cca700;
}

.log-level-info {
    color: #89d185;
}

.log-timestamp {
    color: #6a9955;
}

/* Health metrics */

.health-metrics {
    background: rgba(0, 0, 0, .03);
    border-radius: 8px;
    padding: 10px 12px;
}

.health-status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.health-status-dot.online {
    background-color: #198754 !important;
    box-shadow: 0 0 6px rgba(25, 135, 84, .5);
}

.health-status-dot.offline {
    background-color: #dc3545 !important;
    box-shadow: 0 0 6px rgba(220, 53, 69, .5);
}

.health-metric-value {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.2;
}

.health-metric-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6c757d;
}

/* ========= Gmail Setup Guide ========= */

.guide-steps {
    position: relative;
    padding-left: 3rem;
}

.guide-steps::before {
    content: '';
    position: absolute;
    left: 1.15rem;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.guide-step {
    position: relative;
    margin-bottom: 2rem;
}

.guide-step:last-child {
    margin-bottom: 0;
}

.guide-step-number {
    position: absolute;
    left: -3rem;
    top: 0;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
    z-index: 1;
}

.guide-step-content h5 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.guide-step-content p,
.guide-step-content ol,
.guide-step-content ul {
    color: #555;
}

.guide-screenshot {
    margin-top: 0.75rem;
}

.guide-screenshot-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    color: #6c757d;
    font-size: 0.95rem;
}

.guide-screenshot-placeholder i {
    font-size: 1.5rem;
}

.letter-spaced {
    letter-spacing: 4px;
}

/* ========= How It Works — Architecture diagram ========= */

.arch-diagram {
    overflow-x: auto;
}

.arch-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.arch-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    min-width: 160px;
    font-weight: 600;
}

.arch-node i {
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

.arch-node span {
    font-size: 0.95rem;
}

.arch-node small {
    font-size: 0.78rem;
    font-weight: 400;
    opacity: 0.75;
}

.arch-external {
    background: #e8f4fd;
    border: 2px solid #90caf9;
    color: #1565c0;
}

.arch-core {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.35);
}

.arch-core small {
    opacity: 0.85;
}

.arch-service {
    background: #ffffff;
    border: 2px solid #dee2e6;
    color: #333;
}

.arch-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.5rem;
    min-width: 100px;
}

.arch-line {
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #90caf9, #667eea);
    border-radius: 2px;
}

.arch-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #667eea;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.arch-branches {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.arch-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.arch-vline {
    width: 3px;
    height: 32px;
    background: linear-gradient(180deg, #667eea, #dee2e6);
    border-radius: 2px;
    margin-bottom: 0.25rem;
}

/* ---- Architecture diagram: mobile vertical layout ---- */
@media (max-width: 575.98px) {
    .arch-diagram {
        overflow-x: visible;
    }

    .arch-row {
        flex-direction: column;
        gap: 0;
        margin-bottom: 1rem;
    }

    .arch-node {
        min-width: 0;
        width: 100%;
        padding: 1rem 1.25rem;
    }

    /* Rotate horizontal connector to a vertical bridge */
    .arch-connector {
        min-width: 0;
        width: auto;
        padding: 0;
    }

    .arch-line {
        width: 3px;
        height: 28px;
        margin: 0 auto;
    }

    .arch-label {
        margin-top: 0.15rem;
        margin-bottom: 0.15rem;
    }

    .arch-branches {
        gap: 0.75rem;
    }

    .arch-branch .arch-node {
        min-width: 0;
        width: 100%;
    }
}

/* ========= How It Works — Processing pipeline ========= */

.pipeline {
    position: relative;
}

.pipeline-stage {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.pipeline-icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.pipeline-icon-primary { background: linear-gradient(135deg, #667eea, #764ba2); }
.pipeline-icon-info    { background: linear-gradient(135deg, #17a2b8, #138496); }
.pipeline-icon-danger  { background: linear-gradient(135deg, #dc3545, #c82333); }
.pipeline-icon-warning { background: linear-gradient(135deg, #ffc107, #e0a800); color: #333; }
.pipeline-icon-success { background: linear-gradient(135deg, #28a745, #218838); }
.pipeline-icon-secondary { background: linear-gradient(135deg, #6c757d, #5a6268); }

.pipeline-body {
    flex: 1;
}

.pipeline-body h5 {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.pipeline-body p {
    color: #555;
    margin-bottom: 0.5rem;
    font-size: 0.93rem;
    line-height: 1.65;
}

.pipeline-connector {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0 0.5rem 1.4rem;
    color: #667eea;
    font-size: 1.1rem;
}

.pipeline-code-block {
    background: #1e1e2e;
    color: #a6e3a1;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    margin-top: 0.75rem;
    overflow-x: auto;
}

/* ========= How It Works — Category cards ========= */

.cat-card {
    border-radius: 10px;
    padding: 1.25rem;
    height: 100%;
    border-left: 4px solid;
    background: #ffffff;
}

.cat-card i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.cat-card h6 {
    font-weight: 700;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.cat-card p {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0;
    line-height: 1.5;
}

.cat-safe       { border-color: #28a745; }
.cat-safe i     { color: #28a745; }
.cat-newsletter { border-color: #17a2b8; }
.cat-newsletter i { color: #17a2b8; }
.cat-promo      { border-color: #ffc107; }
.cat-promo i    { color: #e0a800; }
.cat-ad         { border-color: #fd7e14; }
.cat-ad i       { color: #fd7e14; }
.cat-sales      { border-color: #6f42c1; }
.cat-sales i    { color: #6f42c1; }
.cat-spam       { border-color: #dc3545; }
.cat-spam i     { color: #dc3545; }

/* ========= How It Works — Tech stack items ========= */

.tech-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tech-item {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    padding: 1.25rem;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.tech-icon {
    flex-shrink: 0;
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
}

.tech-icon-blue   { background: linear-gradient(135deg, #667eea, #5568d3); }
.tech-icon-purple { background: linear-gradient(135deg, #764ba2, #6a3f8f); }
.tech-icon-teal   { background: linear-gradient(135deg, #20c997, #17a689); }
.tech-icon-red    { background: linear-gradient(135deg, #dc3545, #c82333); }
.tech-icon-indigo { background: linear-gradient(135deg, #6610f2, #520dc2); }

.tech-body {
    flex: 1;
}

.tech-body h5 {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
}

.tech-body p {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.4rem;
}

.tech-url {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 500;
}

/* ========= How It Works — Security cards ========= */

.sec-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1.25rem;
    height: 100%;
}

.sec-card i {
    font-size: 1.6rem;
    margin-bottom: 0.6rem;
    display: block;
}

.sec-card h6 {
    font-weight: 700;
    color: #333;
    margin-bottom: 0.4rem;
}

.sec-card p {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.55;
    margin-bottom: 0;
}

/* ========= How It Works — responsive ========= */

@media (max-width: 768px) {
    .arch-row {
        flex-direction: column;
    }

    .arch-connector {
        min-width: auto;
        padding: 0.5rem 0;
    }

    .arch-line {
        width: 3px;
        height: 32px;
    }

    .arch-branches {
        gap: 1rem;
    }

    .pipeline-stage {
        gap: 0.75rem;
    }

    .tech-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .hiw-method-flow {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hiw-oauth-flow {
        padding-left: 0;
    }
}

/* ========= How It Works — hero pills ========= */

.hiw-pill-purple {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.45em 1em;
}

.hiw-pill-blue {
    background: linear-gradient(135deg, #4facfe, #00f2fe) !important;
    color: white;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.45em 1em;
}

.hiw-pill-green {
    background: linear-gradient(135deg, #43e97b, #38f9d7) !important;
    color: white;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.45em 1em;
}

.hiw-pill-red {
    background: linear-gradient(135deg, #ea4335, #fbbc05) !important;
    color: white;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.45em 1em;
}

/* ========= How It Works — connection method cards ========= */

.hiw-method-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.75rem;
    height: 100%;
    border: 2px solid #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hiw-method-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.hiw-method-imap {
    border-top: 4px solid #667eea;
}

.hiw-method-oauth {
    border-top: 4px solid #ea4335;
}

.hiw-method-icon {
    font-size: 2.2rem;
    margin-bottom: 0.6rem;
}

.hiw-method-imap .hiw-method-icon {
    color: #667eea;
}

.hiw-method-oauth .hiw-method-icon {
    color: #ea4335;
}

.hiw-method-card h5 {
    font-weight: 700;
    color: #333;
    margin-bottom: 0.25rem;
}

.hiw-method-subtitle {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
}

.hiw-method-features {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hiw-method-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: #444;
}

.hiw-method-feature i {
    flex-shrink: 0;
    font-size: 0.9rem;
}

/* Connection method flow diagram */
.hiw-method-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.hiw-flow-node {
    padding: 0.3em 0.65em;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.78rem;
    white-space: nowrap;
    min-width: 0;
    text-align: center;
}

.hiw-flow-you {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.hiw-flow-app {
    background: #e8f4fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.hiw-flow-google {
    background: #fef2f2;
    color: #ea4335;
    border: 1px solid #f5a5a5;
}

.hiw-flow-server {
    background: #e8fdf0;
    color: #218838;
    border: 1px solid #a3d9b1;
}

.hiw-flow-arrow {
    color: #adb5bd;
    font-size: 0.85rem;
}

/* ========= How It Works — Google arch node ========= */

.hiw-arch-google {
    background: #fef2f2;
    border: 2px solid #f5a5a5;
    color: #ea4335;
}

/* ========= How It Works — OAuth flow diagram ========= */

.hiw-oauth-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 1rem 0;
}

.hiw-oauth-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 420px;
}

.hiw-oauth-num {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: white;
}

.hiw-oauth-num-1 { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.hiw-oauth-num-2 { background: linear-gradient(135deg, #ea4335, #fbbc05); }
.hiw-oauth-num-3 { background: linear-gradient(135deg, #667eea, #764ba2); }
.hiw-oauth-num-4 { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.hiw-oauth-num-5 { background: linear-gradient(135deg, #20c997, #17a689); }

.hiw-oauth-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 2px solid;
    background: white;
    transition: transform 0.15s ease;
}

.hiw-oauth-card:hover {
    transform: translateX(4px);
}

.hiw-oauth-card i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.hiw-oauth-card strong {
    font-size: 0.88rem;
    color: #333;
}

.hiw-oauth-card small {
    font-size: 0.75rem;
    color: #888;
    display: block;
}

.hiw-oauth-card-blue {
    border-color: #90caf9;
}
.hiw-oauth-card-blue i { color: #4facfe; }

.hiw-oauth-card-red {
    border-color: #f5a5a5;
}
.hiw-oauth-card-red i { color: #ea4335; }

.hiw-oauth-card-purple {
    border-color: #c4b5e0;
}
.hiw-oauth-card-purple i { color: #764ba2; }

.hiw-oauth-card-green {
    border-color: #a3d9b1;
}
.hiw-oauth-card-green i { color: #28a745; }

.hiw-oauth-card-teal {
    border-color: #8ee4c8;
}
.hiw-oauth-card-teal i { color: #20c997; }

.hiw-oauth-arrow {
    color: #adb5bd;
    font-size: 1rem;
    padding: 0.2rem 0 0.2rem 0.85rem;
    align-self: center;
}

/* ========= How It Works — detection method mini-cards ========= */

.hiw-detect-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.75rem 0.85rem;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.85rem;
    height: 100%;
}

.hiw-detect-card i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.hiw-detect-card strong {
    color: #333;
    line-height: 1.3;
}

.hiw-detect-card small {
    font-size: 0.78rem;
    color: #888;
    line-height: 1.4;
}

/* ========= Mailbox Manager — colorful table & modal ========= */

.mb-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.mb-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 12px 12px 0 0;
}

.mb-card-header h5 {
    font-weight: 700;
}

/* Table */
.mb-table {
    font-size: 0.9rem;
}

/* Data flow table: fixed layout so percentage widths are honoured
   and long Purpose text wraps instead of forcing horizontal scroll. */
.mb-table-fixed {
    table-layout: fixed;
    word-break: break-word;
}

@media (max-width: 575.98px) {
    .mb-table-fixed th,
    .mb-table-fixed td {
        font-size: 0.82rem;
        padding: 0.6rem 0.5rem;
    }

    .mb-table-fixed th {
        white-space: normal;
    }
}

.mb-table thead {
    background: #f0f2ff;
}

.mb-table thead th {
    color: #4a4e8a;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.85rem 0.75rem;
    border-bottom: 2px solid #d5d9f2;
    white-space: nowrap;
}

.mb-table tbody tr {
    transition: background-color 0.2s ease;
}

.mb-table tbody tr:nth-child(odd) {
    background-color: #fafaff;
}

.mb-table tbody tr:nth-child(even) {
    background-color: #f0f4ff;
}

.mb-table tbody tr:hover {
    background-color: #e8ecff;
}

.mb-table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #e8ecf4;
    color: #444;
}

.mb-table tbody td code {
    background: #eef1fb;
    color: #5a5fc0;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Allow dropdown menus to extend beyond .table-responsive containers.
   Without this, overflow-x:auto clips dropdowns when the table has few rows. */
.table-responsive {
    overflow: visible;
}

/* Badges */
.mb-badge-on {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.35em 0.65em;
}

.mb-badge-off {
    background: linear-gradient(135deg, #dc3545, #e85d6c) !important;
    color: white;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.35em 0.65em;
}

/* Edit / Delete buttons */
.mb-btn-edit {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mb-btn-edit:hover {
    background: linear-gradient(135deg, #5568d3, #6a3f8f);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

.mb-btn-delete {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mb-btn-delete:hover {
    background: linear-gradient(135deg, #c82333, #a71d2a);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.4);
}

/* ========= Mailbox Manager — mobile card view ========= */

.mb-mobile-card {
    background: #fff;
    border: 2px solid #e8ecf4;
    border-radius: 12px;
    transition: box-shadow 0.2s ease;
}

.mb-mobile-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.mb-mobile-card-header {
    background: #f0f2ff;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e8ecf4;
    border-radius: 12px 12px 0 0;
}

.mb-mobile-card-body {
    padding: 0.75rem 1rem;
}

.mb-mobile-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f2ff;
}

.mb-mobile-field:last-child {
    border-bottom: none;
}

.mb-mobile-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #4a4e8a;
    white-space: nowrap;
    min-width: 80px;
}

.mb-mobile-value {
    font-size: 0.88rem;
    color: #444;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mb-mobile-value code {
    background: #eef1fb;
    color: #5a5fc0;
    padding: 0.2em 0.45em;
    border-radius: 4px;
    font-size: 0.85em;
}

.mb-mobile-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e8ecf4;
    background: #fafaff;
    border-radius: 0 0 12px 12px;
}

@media (max-width: 991.98px) {
    .slot-dot {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1rem;
    }

    .slot-meter {
        padding: 1rem;
    }
}

/* ========= Mailbox Manager — modal styling ========= */

#mailboxModal form,
#mailboxWizard form {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1 1 auto;
    max-height: 100%;
}

.mb-modal {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.mb-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1.1rem 1.5rem;
}

.mb-modal-header .modal-title {
    font-weight: 700;
}

.mb-modal-body {
    background: #f5f6ff;
    padding: 1.5rem 2rem;
}

.mb-modal .modal-footer {
    background: #f5f6ff;
    border-top: 1px solid #e0e3f5;
    padding: 1rem 2rem;
}

.mb-modal .modal-footer .btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 10px 24px;
}

.mb-modal .modal-footer .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.mb-modal .modal-footer .btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.mb-form-label {
    font-weight: 600;
    color: #4a4e8a;
    font-size: 0.9rem;
}

.mb-input {
    border: 2px solid #d5d9f2;
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    font-size: 0.93rem;
    background-color: #fff;
}

.mb-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.18);
}

.mb-input::placeholder {
    color: #aab0d0;
}

/* Toggle switches */
.mb-switch {
    padding: 0.55rem 0 0.55rem 2.75rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.mb-switch:hover {
    background-color: #f0f2ff;
}

.mb-switch-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.mb-switch-input:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

.mb-switch .form-check-label {
    font-weight: 500;
    color: #444;
}

/* ========= Content page typography ========= */

/* Readable paragraph styling for long-form content pages */
.content-text {
    line-height: 1.85;
    text-indent: 1.5em;
    margin-bottom: 1rem;
    text-align: justify;
    hyphens: auto;
}

/* Remove indent on the first paragraph after a heading or icon header */
h1 + .content-text,
h2 + .content-text,
h3 + .content-text,
h4 + .content-text,
h5 + .content-text,
h6 + .content-text,
.content-heading + .content-text {
    text-indent: 0;
}

/* Heading row used in card bodies (icon + title) */
.content-heading {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.content-heading i {
    font-size: 1.8rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.content-heading h2,
.content-heading h3 {
    margin-bottom: 0;
}

/* Zero-indent variant for short blurbs, captions, sign-offs */
.content-text-plain {
    line-height: 1.85;
    margin-bottom: 1rem;
    text-indent: 0;
}


/* Modal section divider */
.mb-divider {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, #764ba2, transparent);
}

.mb-section-title {
    font-weight: 700;
    color: #4a4e8a;
    font-size: 1rem;
}

/* ========= Home page — email stats charts ========= */

.home-stacked-bar {
    display: flex;
    height: 28px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

.home-stacked-segment {
    transition: width 0.6s ease;
    position: relative;
}

.home-stacked-segment:first-child {
    border-radius: 14px 0 0 14px;
}

.home-stacked-segment:last-child {
    border-radius: 0 14px 14px 0;
}

.home-stacked-segment:only-child {
    border-radius: 14px;
}

.home-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.home-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.home-bar-label {
    min-width: 130px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.home-bar-label i {
    font-size: 1.05rem;
}

.home-bar-track {
    flex: 1;
    height: 22px;
    background: #eef1fb;
    border-radius: 11px;
    overflow: hidden;
}

.home-bar-fill {
    height: 100%;
    border-radius: 11px;
    transition: width 0.6s ease;
    min-width: 4px;
}

.home-bar-value {
    min-width: 100px;
    text-align: right;
    font-size: 0.88rem;
    color: #333;
    white-space: nowrap;
}

@media (max-width: 576px) {
    .home-bar-label {
        min-width: 90px;
        font-size: 0.8rem;
    }

    .home-bar-value {
        min-width: 70px;
        font-size: 0.8rem;
    }

    .home-bar-value small {
        display: none;
    }
}

/* ========= User Manager — stat cards ========= */

.um-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.um-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.um-stat-icon {
    font-size: 1.8rem;
    opacity: 0.85;
}

.um-stat-value {
    font-size: 1.5rem;
    line-height: 1.2;
}

.um-stat-label {
    font-size: 0.8rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.um-stat-users {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.um-stat-admins {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.um-stat-mailboxes {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.um-stat-active {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* ========= User Manager — expand button & row ========= */

.um-expand-btn {
    background: none;
    border: 2px solid #d5d9f2;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    transition: all 0.2s ease;
}

.um-expand-btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.um-expand-icon {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.um-expand-btn[aria-expanded="true"] .um-expand-icon {
    transform: rotate(90deg);
}

.um-user-row {
    transition: background-color 0.2s ease;
}

/* ========= User Manager — role badges ========= */

.um-role-admin {
    background: linear-gradient(135deg, #f093fb, #f5576c) !important;
    color: white;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.35em 0.7em;
}

.um-role-user {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.35em 0.7em;
}

.um-badge-count {
    background: linear-gradient(135deg, #4facfe, #00f2fe) !important;
    color: white;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.35em 0.7em;
}

/* ========= User Manager — subscription badges ========= */

.um-sub-active {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white;
    font-weight: 600;
}

.um-sub-pending {
    background: linear-gradient(135deg, #ffc107, #fd7e14) !important;
    color: #333;
    font-weight: 600;
}

.um-sub-expired {
    background: linear-gradient(135deg, #6c757d, #adb5bd) !important;
    color: white;
    font-weight: 600;
}

.um-sub-cancelled {
    background: linear-gradient(135deg, #dc3545, #c82333) !important;
    color: white;
    font-weight: 600;
}

.um-sub-failed {
    background: linear-gradient(135deg, #e85d6c, #dc3545) !important;
    color: white;
    font-weight: 600;
}

/* ========= User Manager — expandable mailbox panel ========= */

.um-mailbox-collapse-row > td {
    background: transparent !important;
}

.um-mailbox-panel {
    margin: 0 1rem 0.75rem 2.5rem;
    border: 2px solid #d5d9f2;
    border-radius: 10px;
    overflow: hidden;
    background: #fafaff;
    box-shadow: inset 0 2px 6px rgba(102, 126, 234, 0.08);
}

.um-mailbox-header {
    background: linear-gradient(135deg, #e8ecff 0%, #f0f2ff 100%);
    padding: 0.65rem 1rem;
    font-weight: 600;
    color: #4a4e8a;
    font-size: 0.85rem;
    border-bottom: 1px solid #d5d9f2;
}

.um-mailbox-table {
    font-size: 0.82rem;
}

.um-mailbox-table thead {
    background: #f0f2ff;
}

.um-mailbox-table thead th {
    color: #4a4e8a;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #d5d9f2;
    white-space: nowrap;
}

.um-mailbox-table tbody td {
    padding: 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid #e8ecf4;
    color: #555;
}

.um-mailbox-table tbody tr:hover {
    background-color: #e8ecff;
}

/* ========= User Manager — mobile responsive ========= */

@media (max-width: 991.98px) {
    .um-stat-card {
        padding: 0.75rem;
    }

    .um-stat-icon {
        font-size: 1.25rem;
    }

    .um-stat-value {
        font-size: 1.1rem;
    }

    .um-stat-label {
        font-size: 0.72rem;
    }

    .um-mailbox-panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ========= Password strength indicator ========= */

.pwd-strength-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwd-strength-track {
    flex: 1;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.pwd-strength-bar {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
}

.pwd-strength-bar.pwd-weak   { background: #dc3545; }
.pwd-strength-bar.pwd-fair   { background: #fd7e14; }
.pwd-strength-bar.pwd-good   { background: #198754; }
.pwd-strength-bar.pwd-strong { background: #0d6efd; }

.pwd-strength-label {
    min-width: 48px;
    text-align: right;
    font-weight: 600;
}

.pwd-strength-label.pwd-weak   { color: #dc3545; }
.pwd-strength-label.pwd-fair   { color: #fd7e14; }
.pwd-strength-label.pwd-good   { color: #198754; }
.pwd-strength-label.pwd-strong { color: #0d6efd; }

/* ========= Password visibility toggle ========= */

.pwd-toggle-wrapper {
    position: relative;
}

.pwd-toggle-wrapper > input {
    padding-right: 2.5rem;
}

.pwd-toggle-btn {
    position: absolute;
    top: 50%;
    right: 0.65rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #6c757d;
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    transition: color 0.15s ease;
}

.pwd-toggle-btn:hover {
    color: #495057;
}

/* ========= Dark theme overrides ========= */

/* ---------- Body & overlay ---------- */
[data-bs-theme="dark"] body::before {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(5, 10, 25, 0.50) 100%);
}

/* ---------- Global text & links ---------- */
[data-bs-theme="dark"] a {
    color: #8ea8f0;
}

/* bg-light override moved to Bootstrap utility overrides section below */

/* ---------- Sign-in form ---------- */
[data-bs-theme="dark"] .signin-form {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .signin-form .form-label {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .signin-form .form-control {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .signin-form .form-control:focus {
    background-color: var(--bs-body-bg);
    border-color: #667eea;
}

[data-bs-theme="dark"] .signin-form .form-control::placeholder {
    color: #8a8a9a;
}

/* ---------- Cards ---------- */
[data-bs-theme="dark"] .card {
    border-color: var(--bs-border-color);
}

/* ---------- Cookie banner ---------- */
[data-bs-theme="dark"] .cookie-banner {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .cookie-banner-title {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .cookie-banner-text {
    color: var(--bs-secondary-color);
}

/* ---------- Footer ---------- */
[data-bs-theme="dark"] footer .text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* ---------- Guide pages ---------- */
[data-bs-theme="dark"] .guide-step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

[data-bs-theme="dark"] .guide-step-content h5 {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .guide-step-content p,
[data-bs-theme="dark"] .guide-step-content ol,
[data-bs-theme="dark"] .guide-step-content ul {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .guide-screenshot-placeholder {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-secondary-color);
}

/* ---------- Pipeline (How It Works) ---------- */
[data-bs-theme="dark"] .pipeline-body h5 {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .pipeline-body p {
    color: var(--bs-secondary-color);
}

/* ---------- Category cards ---------- */
[data-bs-theme="dark"] .cat-card {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .cat-card h6 {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .cat-card p {
    color: var(--bs-secondary-color);
}

/* ---------- Tech stack ---------- */
[data-bs-theme="dark"] .tech-item {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .tech-body h5 {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .tech-body p {
    color: var(--bs-secondary-color);
}

/* ---------- Security cards ---------- */
[data-bs-theme="dark"] .sec-card {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .sec-card h6 {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .sec-card p {
    color: var(--bs-secondary-color);
}

/* ---------- Architecture diagram ---------- */
[data-bs-theme="dark"] .arch-external {
    background: rgba(21, 101, 192, 0.15);
    border-color: rgba(144, 202, 249, 0.35);
    color: #90caf9;
}

[data-bs-theme="dark"] .arch-service {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .hiw-arch-google {
    background: rgba(234, 67, 53, 0.12);
    border-color: rgba(245, 165, 165, 0.35);
    color: #f5a5a5;
}

/* ---------- Connection method cards ---------- */
[data-bs-theme="dark"] .hiw-method-card {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .hiw-method-card h5 {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .hiw-method-subtitle {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .hiw-method-feature {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .hiw-method-flow {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .hiw-flow-app {
    background: rgba(21, 101, 192, 0.15);
    color: #90caf9;
    border-color: rgba(144, 202, 249, 0.35);
}

[data-bs-theme="dark"] .hiw-flow-google {
    background: rgba(234, 67, 53, 0.12);
    color: #f5a5a5;
    border-color: rgba(245, 165, 165, 0.35);
}

[data-bs-theme="dark"] .hiw-flow-server {
    background: rgba(33, 136, 56, 0.15);
    color: #a3d9b1;
    border-color: rgba(163, 217, 177, 0.35);
}

/* ---------- OAuth flow cards ---------- */
[data-bs-theme="dark"] .hiw-oauth-card {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .hiw-oauth-card strong {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .hiw-oauth-card small {
    color: var(--bs-secondary-color);
}

/* ---------- Detection cards ---------- */
[data-bs-theme="dark"] .hiw-detect-card {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .hiw-detect-card strong {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .hiw-detect-card small {
    color: var(--bs-secondary-color);
}

/* ---------- Mailbox Manager table ---------- */
[data-bs-theme="dark"] .mb-table thead {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .mb-table thead th {
    color: #a0a8d0;
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .mb-table tbody tr:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.02);
}

[data-bs-theme="dark"] .mb-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.04);
}

[data-bs-theme="dark"] .mb-table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

[data-bs-theme="dark"] .mb-table tbody td {
    color: var(--bs-body-color);
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .mb-table tbody td code {
    background: rgba(102, 126, 234, 0.15);
    color: #a0b4f0;
}

/* ---------- Mailbox Manager modal ---------- */
[data-bs-theme="dark"] .mb-modal-body {
    background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .mb-modal .modal-footer {
    background: var(--bs-body-bg);
    border-top-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .mb-form-label {
    color: #a0a8d0;
}

[data-bs-theme="dark"] .mb-input {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .mb-input:focus {
    border-color: #667eea;
}

[data-bs-theme="dark"] .mb-input::placeholder {
    color: #6c7293;
}

[data-bs-theme="dark"] .mb-switch:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

[data-bs-theme="dark"] .mb-switch .form-check-label {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .mb-section-title {
    color: #a0a8d0;
}

[data-bs-theme="dark"] .mb-divider {
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), rgba(118, 75, 162, 0.5), transparent);
}

/* ---------- Mailbox Manager mobile cards ---------- */
[data-bs-theme="dark"] .mb-mobile-card {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .mb-mobile-card-header {
    background: rgba(102, 126, 234, 0.1);
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .mb-mobile-card-body {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .mb-mobile-field {
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .mb-mobile-label {
    color: #a0a8d0;
}

[data-bs-theme="dark"] .mb-mobile-value {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .mb-mobile-value code {
    background: rgba(102, 126, 234, 0.15);
    color: #a0b4f0;
}

[data-bs-theme="dark"] .mb-mobile-card-actions {
    border-top-color: var(--bs-border-color);
    background: rgba(255, 255, 255, 0.02);
}

/* ---------- Slot meter ---------- */
[data-bs-theme="dark"] .slot-meter {
    background: rgba(33, 37, 41, 0.95);
}

[data-bs-theme="dark"] .slot-meter-label {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .slot-meter-count {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .slot-dot-empty {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-secondary-color);
}

/* ---------- Wizard cards ---------- */
[data-bs-theme="dark"] .wizard-provider-card,
[data-bs-theme="dark"] .wizard-auth-card {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .wizard-provider-card:hover,
[data-bs-theme="dark"] .wizard-auth-card:hover {
    background: var(--bs-body-bg);
    border-color: #667eea;
}

[data-bs-theme="dark"] .wizard-provider-card.selected,
[data-bs-theme="dark"] .wizard-auth-card.selected {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

[data-bs-theme="dark"] .wizard-indicator-number {
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .wizard-indicator-line {
    background: var(--bs-border-color);
}

/* ---------- Email stats (home) ---------- */
[data-bs-theme="dark"] .home-bar-label {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .home-bar-track {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .home-bar-value {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .home-stacked-bar {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ---------- User Manager ---------- */
[data-bs-theme="dark"] .um-mailbox-panel {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .um-mailbox-header {
    background: rgba(102, 126, 234, 0.1);
    color: #a0a8d0;
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .um-mailbox-table thead {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .um-mailbox-table thead th {
    color: #a0a8d0;
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .um-mailbox-table tbody td {
    color: var(--bs-secondary-color);
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .um-mailbox-table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

[data-bs-theme="dark"] .um-expand-btn {
    border-color: var(--bs-border-color);
}

/* ---------- Buy Now ---------- */
[data-bs-theme="dark"] .buy-now-features li {
    color: var(--bs-body-color);
    border-bottom-color: var(--bs-border-color);
}

/* ---------- Content pages ---------- */
[data-bs-theme="dark"] .content-text,
[data-bs-theme="dark"] .content-text-plain {
    color: var(--bs-body-color);
}

/* ---------- System Settings ---------- */
[data-bs-theme="dark"] .health-metrics {
    background: rgba(255, 255, 255, 0.03);
}

[data-bs-theme="dark"] .health-metric-label {
    color: var(--bs-secondary-color);
}

/* ---------- Modals (styled) ---------- */
[data-bs-theme="dark"] .user-modal .modal-body {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .user-modal .modal-footer {
    border-top-color: var(--bs-border-color);
    background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .user-modal .form-label {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .user-modal .form-control,
[data-bs-theme="dark"] .user-modal .form-select {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .user-modal .form-control:focus,
[data-bs-theme="dark"] .user-modal .form-select:focus {
    background-color: var(--bs-body-bg);
    border-color: #667eea;
}

[data-bs-theme="dark"] .user-modal .section-divider {
    border-top-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .delete-modal .modal-body {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .delete-modal .modal-footer {
    border-top-color: var(--bs-border-color);
    background: var(--bs-body-bg);
}

/* ---------- Password strength ---------- */
[data-bs-theme="dark"] .pwd-strength-track {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .pwd-toggle-btn {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .pwd-toggle-btn:hover {
    color: var(--bs-body-color);
}

/* ---------- Theme toggle button ---------- */
#themeToggle {
    font-size: 1.15rem;
    opacity: 0.85;
    transition: opacity 0.2s;
}

#themeToggle:hover {
    opacity: 1;
}

/* ---------- Bootstrap utility overrides for dark mode ---------- */

/*
 * In Bootstrap 5.3, .text-dark resolves to rgba(var(--bs-dark-rgb), ...)
 * but --bs-dark-rgb is NOT redefined in the dark palette, so it stays
 * nearly-black (33,37,41) — invisible on dark backgrounds.
 * Override it to use the emphasis (white) color instead.
 */
[data-bs-theme="dark"] .text-dark {
    color: var(--bs-emphasis-color) !important;
}

/*
 * .text-secondary uses --bs-secondary-color which IS redefined in dark mode,
 * but some pages pair it with bg-light bg-opacity-90 where the contrast
 * is still poor.  Bump it to the full body color for readability.
 */
[data-bs-theme="dark"] .text-secondary {
    color: var(--bs-body-color) !important;
}

/*
 * .bg-light bg-opacity-90 cards: bg-light maps to --bs-light-rgb which
 * stays as 248,249,250 in dark mode.  Override the light semantic color
 * inside the dark palette so cards get a proper dark surface.
 */
[data-bs-theme="dark"] .bg-light {
    --bs-light-rgb: 43, 48, 53;
}

/*
 * .text-muted is used in descriptive/helper text.  In dark mode
 * it can be too dim against a dark card surface.
 */
[data-bs-theme="dark"] .text-muted {
    color: var(--bs-secondary-color) !important;
}

/* .lead text used on several hero sections */
[data-bs-theme="dark"] .lead {
    color: var(--bs-body-color);
}

/* list-group items used in the welcome modal and settings cards */
[data-bs-theme="dark"] .list-group-item {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

/* description lists (dt/dd) used on the Settings read-only view */
[data-bs-theme="dark"] dt {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] dd {
    color: var(--bs-secondary-color);
}

/* Inline code in content pages */
[data-bs-theme="dark"] code {
    color: #e685b5;
}

/* content-heading icons and titles inside cards */
[data-bs-theme="dark"] .content-heading h2,
[data-bs-theme="dark"] .content-heading h3 {
    color: var(--bs-body-color);
}

/* Pipeline warning icon has hardcoded dark text */
[data-bs-theme="dark"] .pipeline-icon-warning {
    color: #fff;
}

/*
 * .bg-white uses --bs-white-rgb (always 255,255,255) which stays bright
 * white in dark mode.  Remap to the secondary background for dark surfaces.
 */
[data-bs-theme="dark"] .bg-white {
    --bs-white-rgb: 43, 48, 53;
}

/* Borders on .border in dark mode should use the dark palette border color */
[data-bs-theme="dark"] .border {
    border-color: var(--bs-border-color) !important;
}
