:root {
    --background: #f8fafc;
    --primary: #0d9488;
    --primary-light: #14b8a6;
    --primary-pale: #ccfbf1;
    --dark-text: #0f172a;
    --light-text: #64748b;
    --border: #cbd5e1;
}

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Outfit", system-ui, sans-serif;
    color: var(--dark-text);
    background: var(--background);
}

a.navbar-brand {
    white-space: normal;
    text-align: center;
    word-break: break-all;
}

a {
    color: #0077cc;
}

.btn-primary {
    color: #fff;
    background-color: #0d9488;
    border-color: #0f766e;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #0f766e;
    border-color: #0d6b64;
}

.btn-outline-primary {
    color: #0d9488;
    border-color: #0d9488;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: #0d9488;
    border-color: #0d9488;
    color: #fff;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    color: #fff;
    background-color: #0d9488;
    border-color: #0f766e;
}

.border-top {
    border-top: 1px solid #e5e5e5;
}

.border-bottom {
    border-bottom: 1px solid #e5e5e5;
}

.box-shadow {
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05);
}

button.accept-policy {
    font-size: 1rem;
    line-height: inherit;
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    white-space: nowrap;
    line-height: 60px;
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary) !important;
    font-size: 1.25rem;
}

.workspace-sprite {
    display: none;
}

body.workspace-page {
    overflow: hidden;
    background: var(--ws-bg);
    color: var(--ws-text);
    --ws-bg: #f0ede8;
    --ws-surface: #ffffff;
    --ws-surface-2: #f6f4f1;
    --ws-border: #e4dfd8;
    --ws-text: #1c1916;
    --ws-text-2: #6b6460;
    --ws-text-3: #a09b94;
    --ws-sidebar: #14202e;
    --ws-sidebar-hover: rgba(255, 255, 255, 0.07);
    --ws-sidebar-active: rgba(20, 184, 166, 0.15);
    --ws-sidebar-text: #c5d4df;
    --ws-sidebar-muted: #4e6070;
    --ws-sidebar-accent: #2dd4bf;
    --ws-sidebar-border: rgba(255, 255, 255, 0.06);
    --ws-teal: #0d9488;
    --ws-teal-light: #14b8a6;
    --ws-teal-pale: #ccfbf1;
    --ws-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 3px 10px rgba(0, 0, 0, 0.06);
    --ws-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.11), 0 1px 4px rgba(0, 0, 0, 0.05);
    --ws-radius: 14px;
    --ws-radius-sm: 9px;
    --ws-ease: 180ms ease;
    --ws-sidebar-width: 224px;
}

html[data-theme="dark"] body.workspace-page {
    --ws-bg: #0d1117;
    --ws-surface: #161b27;
    --ws-surface-2: #1e2535;
    --ws-border: #2a3347;
    --ws-text: #e8edf5;
    --ws-text-2: #8a9ab5;
    --ws-text-3: #516070;
    --ws-sidebar: #0d1117;
    --ws-sidebar-hover: rgba(255, 255, 255, 0.05);
    --ws-sidebar-border: rgba(255, 255, 255, 0.04);
    --ws-teal-pale: rgba(13, 148, 136, 0.18);
    --ws-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 3px 10px rgba(0, 0, 0, 0.3);
    --ws-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.shell {
    display: grid;
    grid-template-columns: var(--ws-sidebar-width) 1fr;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    background: var(--ws-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--ws-sidebar-border);
    overflow-y: auto;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sb-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 14px;
    text-decoration: none;
}

.sb-logo-mark,
.mob-mark {
    background: var(--ws-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
}

.sb-logo-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 14px;
    letter-spacing: -0.5px;
    box-shadow: 0 2px 10px rgba(13, 148, 136, 0.4);
}

.sb-logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    letter-spacing: -0.3px;
}

.sb-nav {
    flex: 1;
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sb-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: var(--ws-sidebar-muted);
    padding: 14px 8px 4px;
}

.sb-item,
.sb-link,
.theme-btn,
.bnav-item,
.icon-btn,
.edit-btn,
.btn-out,
.btn-plan,
.app-card {
    font-family: inherit;
}

.sb-item,
.sb-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--ws-sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: background var(--ws-ease), color var(--ws-ease);
    white-space: nowrap;
}

.sb-item:hover,
.sb-link:hover {
    background: var(--ws-sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.sb-item.active {
    background: var(--ws-sidebar-active);
    color: var(--ws-sidebar-accent);
}

.sb-item svg,
.sb-link svg,
.theme-btn svg,
.icon-btn svg,
.edit-btn svg,
.drag-handle svg,
.help-ico svg,
.btn-out svg,
.bnav-item svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.sb-bottom {
    padding: 10px 10px 16px;
    border-top: 1px solid var(--ws-sidebar-border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
}

.user-av,
.profile-av {
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ws-teal) 0%, #0891b2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.user-av {
    width: 32px;
    height: 32px;
    font-weight: 700;
    font-size: 0.75rem;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ws-sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-sub {
    font-size: 0.7rem;
    color: var(--ws-sidebar-muted);
}

.theme-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: none;
    background: none;
    color: var(--ws-sidebar-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background var(--ws-ease), color var(--ws-ease);
}

.theme-btn:hover {
    background: var(--ws-sidebar-hover);
    color: var(--ws-sidebar-text);
}

.toggle-track {
    margin-left: auto;
    width: 30px;
    height: 16px;
    background: var(--ws-sidebar-muted);
    border-radius: 8px;
    position: relative;
    transition: background var(--ws-ease);
    flex-shrink: 0;
}

html[data-theme="dark"] .toggle-track {
    background: var(--ws-teal);
}

.toggle-track::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--ws-ease);
}

html[data-theme="dark"] .toggle-track::after {
    transform: translateX(14px);
}

.main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--ws-bg);
}

.mob-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--ws-sidebar);
    flex-shrink: 0;
}

.mob-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
}

.mob-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 13px;
}

.mob-text {
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
}

.mob-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.07);
    color: var(--ws-sidebar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--ws-ease);
}

.mob-btn:hover {
    background: rgba(255, 255, 255, 0.13);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--ws-border);
    flex-shrink: 0;
}

.greeting-hello {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
}

.greeting-sub {
    font-size: 0.78rem;
    color: var(--ws-text-3);
    margin-top: 2px;
}

.tb-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--ws-border);
    background: var(--ws-surface);
    color: var(--ws-text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--ws-ease);
}

.icon-btn:hover {
    background: var(--ws-surface-2);
    color: var(--ws-text);
    border-color: var(--ws-text-3);
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 28px 48px;
    scrollbar-width: thin;
    scrollbar-color: var(--ws-border) transparent;
}

.content::-webkit-scrollbar {
    width: 4px;
}

.content::-webkit-scrollbar-thumb {
    background: var(--ws-border);
    border-radius: 2px;
}

.page {
    display: none;
    animation: fadeUp 0.18s ease;
}

.page.active {
    display: block;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-title {
    margin-bottom: 22px;
}

.sec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.sec-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ws-text);
}

.sec-sub,
.section-copy,
.plan-note {
    font-size: 0.78rem;
    color: var(--ws-text-3);
    margin-top: 2px;
}

.section-copy {
    margin: 4px 0 0;
    font-size: 0.825rem;
    color: var(--ws-text-2);
}

.trial-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 18px;
    padding: 16px 18px;
    background: var(--ws-surface);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    box-shadow: var(--ws-shadow-card);
}

.trial-note-label {
    margin: 0 0 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ws-text-3);
}

.trial-note-copy {
    margin: 0;
    font-size: 0.8rem;
    color: var(--ws-text);
    line-height: 1.5;
}

.trial-note-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.trial-note-actions a,
.trial-note-actions button {
    color: var(--ws-teal);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
}

.edit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 8px;
    border: 1px solid var(--ws-border);
    background: var(--ws-surface);
    color: var(--ws-text-2);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ws-ease);
}

.edit-btn:hover {
    background: var(--ws-surface-2);
    color: var(--ws-text);
}

.edit-btn.on {
    background: var(--ws-teal-pale);
    border-color: var(--ws-teal);
    color: var(--ws-teal);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 14px;
}

.apps-loading,
.error-message {
    grid-column: 1 / -1;
    background: var(--ws-surface);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    padding: 18px;
    text-align: center;
    box-shadow: var(--ws-shadow-card);
}

.error-message {
    color: #b91c1c;
}

.app-card {
    background: var(--ws-surface);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    padding: 22px 16px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ws-text);
    cursor: pointer;
    position: relative;
    box-shadow: var(--ws-shadow-card);
    transition: transform var(--ws-ease), box-shadow var(--ws-ease), border-color var(--ws-ease), opacity var(--ws-ease);
    user-select: none;
}

.app-card:hover:not(.soon) {
    transform: translateY(-3px);
    box-shadow: var(--ws-shadow-hover);
    border-color: var(--ws-text-3);
    text-decoration: none;
    color: var(--ws-text);
}

.app-card.soon {
    cursor: default;
    opacity: 0.6;
}

.app-card.dragging {
    opacity: 0.3;
    cursor: grabbing;
    transform: scale(0.97);
}

.app-card.drag-target {
    border-color: var(--ws-teal);
    box-shadow: 0 0 0 2px var(--ws-teal-pale), var(--ws-shadow-hover);
}

.drag-handle {
    position: absolute;
    top: 9px;
    right: 9px;
    color: var(--ws-text-3);
    opacity: 0;
    cursor: grab;
    padding: 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--ws-ease);
}

.apps-grid.edit .drag-handle {
    opacity: 1;
}

.apps-grid.edit .app-card[data-orderable="true"] {
    cursor: grab;
}

.app-icon {
    width: 58px;
    height: 58px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--ws-ease);
}

.app-card:hover:not(.soon) .app-icon {
    transform: scale(1.06);
}

.app-icon svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-info {
    text-align: center;
    width: 100%;
}

.app-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--ws-text);
    line-height: 1.3;
}

.app-desc {
    font-size: 0.7rem;
    color: var(--ws-text-2);
    margin-top: 3px;
    line-height: 1.4;
}

.badge {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 9px;
    border-radius: 20px;
    margin-top: 2px;
}

.b-active {
    background: #dcfce7;
    color: #16a34a;
}

.b-soon {
    background: var(--ws-surface-2);
    color: var(--ws-text-3);
    border: 1px solid var(--ws-border);
}

.b-manage {
    background: var(--ws-teal-pale);
    color: var(--ws-teal);
}

.info-card {
    background: var(--ws-surface);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    padding: 24px;
    margin-bottom: 16px;
    max-width: 540px;
    box-shadow: var(--ws-shadow-card);
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.profile-av {
    width: 64px;
    height: 64px;
    font-weight: 800;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.profile-email {
    font-size: 0.825rem;
    color: var(--ws-text-2);
    margin-top: 3px;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.field-label,
.plan-name {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ws-text-3);
}

.field-val {
    font-size: 0.9rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    width: fit-content;
    margin-top: 2px;
}

.sp-trial {
    background: #fef9c3;
    color: #ca8a04;
}

.sp-active {
    background: #dcfce7;
    color: #15803d;
}

.sp-inactive {
    background: #e2e8f0;
    color: #475569;
}

.btn-out {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid var(--ws-border);
    background: var(--ws-surface);
    color: var(--ws-text-2);
    font-size: 0.825rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 18px;
    transition: all var(--ws-ease);
    text-decoration: none;
}

.card-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.btn-out-primary {
    border-color: var(--ws-teal);
    color: var(--ws-teal);
    background: var(--ws-teal-pale);
}

.btn-out.btn-out-primary:hover {
    border-color: var(--ws-teal);
    color: var(--ws-teal);
    background: var(--ws-surface-2);
}

.btn-out:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: var(--ws-surface-2);
    text-decoration: none;
}

.plan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 580px;
    margin-top: 18px;
}

.plan-card {
    background: var(--ws-surface);
    border: 2px solid var(--ws-border);
    border-radius: var(--ws-radius);
    padding: 26px;
    position: relative;
    box-shadow: var(--ws-shadow-card);
}

.plan-card.feat {
    border-color: var(--ws-teal);
}

.plan-badge {
    position: absolute;
    top: -11px;
    left: 18px;
    background: var(--ws-teal);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 12px;
    border-radius: 20px;
}

.plan-price {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
}

.plan-period {
    font-size: 0.8rem;
    color: var(--ws-text-2);
    margin-top: 3px;
}

.plan-save {
    font-size: 0.75rem;
    color: var(--ws-teal);
    font-weight: 600;
    margin-top: 4px;
}

.plan-feats {
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.plan-feat {
    font-size: 0.8rem;
    color: var(--ws-text-2);
    display: flex;
    align-items: flex-start;
    gap: 7px;
    line-height: 1.4;
}

.feat-ck {
    color: var(--ws-teal);
    font-weight: 700;
    flex-shrink: 0;
}

.btn-plan {
    display: block;
    width: 100%;
    padding: 10px;
    border-radius: 9px;
    border: 1px solid var(--ws-border);
    background: var(--ws-surface-2);
    color: var(--ws-text);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all var(--ws-ease);
}

.btn-plan:hover {
    border-color: var(--ws-teal);
    color: var(--ws-teal);
}

.plan-card.feat .btn-plan {
    background: var(--ws-teal);
    color: #fff;
    border-color: var(--ws-teal);
}

.plan-card.feat .btn-plan:hover {
    background: var(--ws-teal-light);
}

.checkout-error {
    margin-top: 14px;
    color: #b91c1c;
}

.checkout-loading {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(20, 32, 46, 0.34);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.checkout-loading-card {
    min-width: min(100%, 320px);
    padding: 24px 26px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    background: color-mix(in srgb, var(--ws-surface) 88%, white 12%);
    box-shadow: 0 24px 60px rgba(8, 15, 23, 0.18);
    display: grid;
    justify-items: center;
    gap: 14px;
    text-align: center;
}

.checkout-loading-card p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ws-text);
}

.checkout-loading-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid color-mix(in srgb, var(--ws-teal) 18%, transparent);
    border-top-color: var(--ws-teal);
    animation: checkoutSpin 0.9s linear infinite;
}

body.checkout-busy {
    cursor: progress;
}

.btn-plan:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

@keyframes checkoutSpin {
    to {
        transform: rotate(360deg);
    }
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    max-width: 700px;
}

.help-card {
    background: var(--ws-surface);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: all var(--ws-ease);
    box-shadow: var(--ws-shadow-card);
    text-decoration: none;
}

.help-card:hover {
    border-color: var(--ws-teal);
    transform: translateY(-2px);
    box-shadow: var(--ws-shadow-hover);
    text-decoration: none;
}

.help-ico {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--ws-teal-pale);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ws-teal);
}

.help-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ws-text);
}

.help-desc {
    font-size: 0.75rem;
    color: var(--ws-text-2);
    line-height: 1.5;
}

.bnav {
    display: none;
    background: var(--ws-surface);
    border-top: 1px solid var(--ws-border);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
}

.bnav-inner {
    display: flex;
}

.bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 0;
    border: none;
    background: none;
    color: var(--ws-text-3);
    font-size: 0.62rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: color var(--ws-ease);
}

.bnav-item.active {
    color: var(--ws-teal);
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.login-card,
.profile-card,
.admin-summary-card,
.admin-panel,
.admin-card,
.admin-table-wrapper {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
}

.login-card {
    padding: 3rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 400px;
    width: 100%;
}

.login-header h1 {
    font-weight: 700;
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-header p,
.admin-subtitle,
.admin-card-body p,
.text-muted,
.form-hint,
.profile-email {
    color: var(--light-text);
}

.btn-login,
.btn-primary,
.table-link {
    text-decoration: none;
}

.btn-login {
    display: inline-block;
    background-color: var(--primary);
    color: #fff;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-login:hover,
.btn-primary:hover {
    background-color: var(--primary-light);
    color: #fff;
}

.profile-container {
    display: flex;
    justify-content: center;
    padding: 3rem 1rem;
}

.profile-card {
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 400px;
    width: 100%;
}

.profile-card.profile-edit-card {
    max-width: 640px;
    text-align: left;
}

.profile-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.btn-back {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.btn-back:hover,
.table-link:hover {
    text-decoration: underline;
}

.admin-page {
    padding: 2rem 0;
    max-width: 1000px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.25rem 0 0;
}

.admin-cards,
.admin-summary-grid,
.admin-detail-grid {
    display: grid;
    gap: 1rem;
}

.admin-cards {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 1.5rem;
}

.admin-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    margin-bottom: 1.5rem;
}

.admin-summary-card,
.admin-panel {
    padding: 1rem;
}

.admin-summary-label {
    display: block;
    color: var(--light-text);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.admin-panel h2 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
}

.admin-form-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-inline-message {
    min-height: 1.25rem;
}

.admin-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--dark-text);
    transition: box-shadow 0.2s, transform 0.2s;
}

.admin-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    color: var(--dark-text);
}

.admin-card-icon {
    color: var(--primary);
    display: flex;
    align-items: center;
}

.admin-card-icon svg {
    width: 2rem;
    height: 2rem;
}

.admin-card-body h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

.admin-card-body p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
}

.admin-table-wrapper {
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--background);
    color: var(--light-text);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: var(--background);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.table-link {
    color: var(--primary);
}

.inline-form {
    display: inline;
}

.btn-primary,
.btn-secondary {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary);
    border: none;
    font-weight: 600;
}

.btn-secondary {
    background-color: #fff;
    color: var(--dark-text);
    border: 1px solid var(--border);
    font-weight: 500;
}

.btn-action {
    border: none;
    background: none;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.btn-edit {
    color: var(--primary);
    background: var(--primary-pale);
}

.btn-edit:hover {
    background: #99f6e4;
}

.btn-delete {
    color: #dc2626;
    background: #fee2e2;
}

.btn-delete:hover {
    background: #fecaca;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--dark-text);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .shell {
        display: flex;
        flex-direction: column;
    }

    .sidebar {
        display: none;
    }

    .mob-topbar {
        display: flex;
    }

    .topbar {
        display: none;
    }

    .main {
        flex: 1;
    }

    .content {
        padding: 16px 14px 24px;
    }

    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .field-grid,
    .plan-grid {
        grid-template-columns: 1fr;
    }

    .help-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .trial-note {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .bnav {
        display: block;
    }

    .checkout-loading-card {
        min-width: 0;
        width: 100%;
        max-width: 320px;
    }
}

/* Access history table */
.access-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.access-table th {
    text-align: left;
    padding: 8px 12px;
    color: var(--ws-text-3);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ws-border);
    white-space: nowrap;
}

.access-table td {
    padding: 9px 12px;
    color: var(--ws-text);
    border-bottom: 1px solid var(--ws-border);
    white-space: nowrap;
}

.access-table tbody tr:last-child td {
    border-bottom: none;
}

.access-table tbody tr:hover td {
    background: var(--ws-surface-2);
}

/* ── Card width utilities ───────────────────────── */
.card-narrow  { max-width: 680px; }
.card-medium  { max-width: 860px; }
.card-wide    { max-width: 960px; }
.card-full    { max-width: 900px; }

/* ── Stat box ────────────────────────────────────── */
.stat-box {
    min-width: 130px;
}

/* ── Workspace scrollable variant ───────────────────────────── */
body.workspace-page.page-scrollable {
    overflow-y: auto !important;
}

/* ── Dark mode — Bootstrap navbar pages ─────────────────────── */

html[data-theme="dark"] body:not(.workspace-page) {
    background: #0d1117;
    color: #e8edf5;
}

html[data-theme="dark"] .navbar {
    background-color: #161b27 !important;
    border-color: #2a3347 !important;
}

html[data-theme="dark"] .navbar .nav-link,
html[data-theme="dark"] .navbar .navbar-brand {
    color: #e8edf5 !important;
}

html[data-theme="dark"] .profile-container {
    background: transparent;
}

html[data-theme="dark"] .profile-card {
    background: var(--ws-surface);
    color: var(--ws-text);
    border-color: var(--ws-border);
}

html[data-theme="dark"] .profile-card h2,
html[data-theme="dark"] .profile-card h3,
html[data-theme="dark"] .profile-card p {
    color: inherit;
}

html[data-theme="dark"] .text-muted {
    color: #8a9ab5 !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background-color: #1e2535;
    border-color: #2a3347;
    color: #e8edf5;
}

html[data-theme="dark"] .table {
    color: #e8edf5;
}

html[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: transparent;
    border-color: #2a3347;
    color: #e8edf5;
}

html[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .rounded-4 {
    border-color: #2a3347 !important;
}

html[data-theme="dark"] .alert-light {
    background-color: #1e2535;
    border-color: #2a3347;
    color: #e8edf5;
}

/* ── Pairing ───────────────────────── */
.pairing-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
    display: grid;
    gap: 1.5rem;
}

.pairing-hero,
.pairing-card,
.pairing-list {
    background: #fff;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.pairing-hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
}

.pairing-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f766e;
    font-weight: 700;
}

.pairing-title {
    font-size: clamp(2rem, 3vw, 2.75rem);
    line-height: 1.05;
    margin: 0.75rem 0;
    color: #0f172a;
}

.pairing-copy {
    color: #475569;
    max-width: 44rem;
    margin-bottom: 1.25rem;
}

.pairing-contact {
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border: 1px solid #e2e8f0;
}

.pairing-contact dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin: 0;
}

.pairing-contact dt {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.pairing-contact dd {
    margin: 0;
    color: #0f172a;
    font-weight: 600;
}

.pairing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.pairing-btn,
.pairing-link {
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.3rem;
    font-weight: 700;
    text-decoration: none;
}

.pairing-btn {
    background: #0f766e;
    color: #fff;
}

.pairing-link {
    background: #e2e8f0;
    color: #0f172a;
}

.pairing-card h2,
.pairing-list h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #0f172a;
}

.pairing-state {
    min-height: 360px;
    display: grid;
    place-items: center;
    text-align: center;
    color: #475569;
}

.pairing-state.ready {
    place-items: start;
    text-align: left;
}

.pairing-qr-wrap {
    display: grid;
    gap: 1rem;
    justify-items: center;
}

.pairing-qr {
    padding: 1rem;
    background: #fff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
}

.pairing-qr img {
    display: block;
    width: 280px;
    height: 280px;
    border-radius: 12px;
}

.pairing-code {
    font-family: monospace;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.24em;
    color: #0f172a;
}

.pairing-meta {
    color: #475569;
    font-size: 0.95rem;
}

.pairing-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pairing-inline-actions button {
    border: none;
    border-radius: 12px;
    background: #e2e8f0;
    color: #0f172a;
    padding: 0.75rem 1rem;
    font-weight: 700;
}

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

.pairing-table th,
.pairing-table td {
    padding: 0.85rem 0;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.pairing-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

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

.status-chip.active { background: #dcfce7; color: #166534; }
.status-chip.pending { background: #fef3c7; color: #92400e; }
.status-chip.unpaired_by_patient { background: #fee2e2; color: #991b1b; }
.status-chip.completed    { background: #dbeafe; color: #1e40af; }
.status-chip.dismissed    { background: #fee2e2; color: #991b1b; }
.status-chip.inactive     { background: #f1f5f9; color: #475569; }
.status-chip.neutral      { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.status-chip.soon         { background: #fef3c7; color: #92400e; }

html[data-theme="dark"] .status-chip.active       { background: rgba(22,101,52,0.3);  color: #86efac; }
html[data-theme="dark"] .status-chip.pending      { background: rgba(146,64,14,0.3);  color: #fcd34d; }
html[data-theme="dark"] .status-chip.completed    { background: rgba(30,64,175,0.3);  color: #93c5fd; }
html[data-theme="dark"] .status-chip.dismissed    { background: rgba(153,27,27,0.3);  color: #fca5a5; }
html[data-theme="dark"] .status-chip.inactive,
html[data-theme="dark"] .status-chip.neutral      { background: rgba(71,85,105,0.3);  color: #94a3b8; border-color: #2a3347; }
html[data-theme="dark"] .status-chip.unpaired_by_patient { background: rgba(153,27,27,0.3); color: #fca5a5; }
html[data-theme="dark"] .status-chip.soon         { background: rgba(146,64,14,0.3);  color: #fcd34d; }

.pairing-empty {
    padding: 1.5rem 0;
    color: #64748b;
}

.pairing-error {
    color: #b91c1c;
    font-weight: 600;
}

body.workspace-page {
    overflow-y: auto !important;
}

.pairing-url-field {
    width: 100%;
    font-size: 0.78rem;
    font-family: monospace;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    resize: none;
    word-break: break-all;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

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

    .pairing-contact dl {
        grid-template-columns: 1fr;
    }

    .pairing-qr img {
        width: min(78vw, 280px);
        height: min(78vw, 280px);
    }
}

html[data-theme="dark"] .pairing-hero,
html[data-theme="dark"] .pairing-card,
html[data-theme="dark"] .pairing-list {
    background: #161b27;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .pairing-title { color: #e8edf5; }
html[data-theme="dark"] .pairing-copy,
html[data-theme="dark"] .pairing-meta { color: #8a9ab5; }
html[data-theme="dark"] .pairing-kicker { color: #2dd4bf; }
html[data-theme="dark"] .pairing-contact {
    background: linear-gradient(135deg, #1e2535, #1a2140);
    border-color: #2a3347;
}
html[data-theme="dark"] .pairing-contact dd { color: #e8edf5; }
html[data-theme="dark"] .pairing-link { background: #2a3347; color: #e8edf5; }
html[data-theme="dark"] .pairing-table th,
html[data-theme="dark"] .pairing-table td { border-color: #2a3347; color: #e8edf5; }
html[data-theme="dark"] .pairing-url-field { background: #1e2535; border-color: #2a3347; color: #8a9ab5; }
html[data-theme="dark"] .pairing-inline-actions button { background: #2a3347; color: #e8edf5; }
html[data-theme="dark"] .pairing-card h2,
html[data-theme="dark"] .pairing-list h2 { color: #e8edf5; }

/* ── Profile ───────────────────────── */
.access-history {
    max-width: 760px;
    margin: 24px auto 0;
}

.access-history h3 {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 12px;
}

.access-table-wrapper {
    overflow-x: auto;
}

html[data-theme="dark"] .access-table th {
    background: #1e2535;
    color: #8a9ab5;
    border-color: #2a3347;
}
html[data-theme="dark"] .access-table td {
    color: #e8edf5;
    border-color: #2a3347;
}
html[data-theme="dark"] .access-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}
