/* NSoft enterprise UI stylesheet. Critical shell fallback is embedded from templates/includes/up_critical_layout.css. */
:root {
    color-scheme: light;
    --up-bg: #f5f3fb;
    --up-bg-2: #ebe7f7;
    --up-paper: #ffffff;
    --up-surface: #ffffff;
    --up-surface-2: #faf9fd;
    --up-ink: #171325;
    --up-heading: #120d20;
    --up-muted: #6f6a7d;
    --up-muted-2: #8a8497;
    --up-line: rgba(49, 38, 79, .12);
    --up-line-strong: rgba(49, 38, 79, .20);
    --up-primary: #6d2e91;
    --up-primary-2: #7c3aed;
    --up-primary-3: #4c1d95;
    --up-primary-soft: rgba(109, 46, 145, .10);
    --up-primary-soft-2: rgba(124, 58, 237, .13);
    --up-indigo: #312e81;
    --up-success: #198754;
    --up-warning: #b7791f;
    --up-danger: #b42318;
    --up-info: #2563eb;
    --up-shadow: 0 22px 60px rgba(35, 27, 56, .12);
    --up-shadow-sm: 0 12px 32px rgba(35, 27, 56, .08);
    --up-shadow-xs: 0 6px 18px rgba(35, 27, 56, .06);
    --up-radius: 22px;
    --up-radius-sm: 14px;
    --up-sidebar: 18.75rem;
    --bs-primary: #6d2e91;
    --bs-primary-rgb: 109, 46, 145;
    --bs-link-color: #6d2e91;
    --bs-link-hover-color: #4c1d95;
    --bs-body-color: #171325;
    --bs-body-bg: #f5f3fb;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; color: var(--up-ink); font-feature-settings: "cv02", "cv03", "cv04", "cv11"; text-rendering: optimizeLegibility; }
a { color: var(--up-primary); }
a:hover { color: var(--up-primary-3); }
img { max-width: 100%; }

.up-icon { width: 1em; height: 1em; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; line-height: 1; text-align: center; }
.up-nav-glyph .up-icon, .up-icon-button .up-icon, .up-sidebar-close .up-icon { width: 1.05rem; height: 1.05rem; }
.up-action-card .up-icon { width: 1.15rem; height: 1.15rem; }
.empty-state-icon .up-icon, .chat-placeholder-icon .up-icon, .chat-empty-icon .up-icon { width: 1.35rem; height: 1.35rem; }
input, select, textarea { width: 100%; }
input[type="checkbox"], input[type="radio"] { width: auto; }
:focus-visible { outline: 3px solid rgba(124, 58, 237, .32); outline-offset: 2px; }
::selection { background: rgba(124, 58, 237, .20); }

.btn { border-radius: 999px; font-weight: 760; letter-spacing: -.01em; }
.btn-primary { background: linear-gradient(135deg, var(--up-primary), var(--up-primary-2)); border-color: var(--up-primary); color: #fff; box-shadow: 0 12px 24px rgba(109, 46, 145, .22); }
.btn-primary:hover, .btn-primary:focus { background: linear-gradient(135deg, var(--up-primary-3), var(--up-primary)); border-color: var(--up-primary-3); color: #fff; }
.btn-outline-primary { color: var(--up-primary); border-color: rgba(109, 46, 145, .35); background: #fff; }
.btn-outline-primary:hover, .btn-outline-primary:focus { background: var(--up-primary); border-color: var(--up-primary); color: #fff; }
.btn-outline-secondary { border-color: var(--up-line-strong); color: #3f3857; background: #fff; }
.btn-outline-secondary:hover, .btn-outline-secondary:focus { background: #f0ecf8; border-color: rgba(109, 46, 145, .30); color: var(--up-primary-3); }
.btn-outline-success { border-color: rgba(25, 135, 84, .28); color: #12633d; }
.card { border: 1px solid var(--up-line); border-radius: var(--up-radius); box-shadow: var(--up-shadow-sm); }
.form-control, .form-select { min-height: 2.8rem; border-radius: 14px; border-color: var(--up-line-strong); background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: var(--up-primary-2); box-shadow: 0 0 0 .22rem rgba(124, 58, 237, .14); }
.form-label { font-weight: 760; color: #2b253a; }
.form-text, .text-muted { color: var(--up-muted) !important; }
.alert { border-radius: 16px; }
.dropdown-item.active, .dropdown-item:active { background: var(--up-primary); color: #fff; }

.up-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(124, 58, 237, .10), transparent 32rem),
        radial-gradient(circle at 92% 8%, rgba(109, 46, 145, .08), transparent 28rem),
        linear-gradient(180deg, #fbfaff 0%, var(--up-bg) 48%, #f7f4fb 100%);
}
.up-skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 5000; padding: .7rem 1rem; background: var(--up-primary-3); color: #fff; border-radius: 999px; }
.up-skip-link:focus { top: 1rem; }
.up-shell { min-height: 100vh; }

.up-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: var(--up-sidebar);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 18% 0%, rgba(167, 139, 250, .22), transparent 18rem),
        linear-gradient(180deg, #211033 0%, #2b1642 50%, #1c102c 100%);
    color: #f8f5ff;
    border-right: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 18px 0 42px rgba(25, 16, 43, .24);
}
.up-sidebar-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.10); }
.up-brand { display: flex; align-items: center; gap: .82rem; min-width: 0; color: #fff; text-decoration: none; }
.up-brand:hover { color: #fff; }
.up-brand-mark { width: 3.25rem; height: 3.25rem; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 17px; background: #fff; border: 1px solid rgba(255, 255, 255, .64); box-shadow: 0 16px 32px rgba(0, 0, 0, .18); overflow: hidden; }
.up-brand-logo { width: 2.8rem; height: auto; display: block; }
.up-brand-copy { min-width: 0; }
.up-brand-title, .up-brand-subtitle { display: block; line-height: 1.1; }
.up-brand-title { font-size: 1.04rem; font-weight: 900; letter-spacing: -.03em; }
.up-brand-subtitle { margin-top: .18rem; color: #d9cbff; font-size: .76rem; font-weight: 650; }
.up-sidebar-close { border: 0; background: transparent; color: #efe8ff; font-size: 2rem; line-height: 1; }

.up-context-card { margin: 1rem 1rem .45rem; padding: 1rem; border: 1px solid rgba(255,255,255,.13); border-radius: 18px; background: rgba(255,255,255,.075); box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
.up-context-label, .up-context-muted { display: block; }
.up-context-label { color: #d9cbff; font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .10em; }
.up-context-card strong { display: block; margin-top: .25rem; color: #fff; font-size: .98rem; line-height: 1.22; }
.up-context-muted { margin-top: .35rem; color: rgba(248,245,255,.75); font-size: .78rem; }

.up-nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: .75rem .85rem 1.25rem; scrollbar-color: rgba(255,255,255,.24) transparent; scrollbar-width: thin; }
.up-nav::-webkit-scrollbar { width: 6px; }
.up-nav::-webkit-scrollbar-track { background: transparent; }
.up-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.20); border-radius: 999px; }
.up-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.32); }
.up-nav-group + .up-nav-group { margin-top: 1.1rem; }
.up-nav-heading { display: block; margin: 0 0 .45rem .75rem; color: #c9b7ff; font-size: .68rem; font-weight: 950; letter-spacing: .11em; text-transform: uppercase; }
.up-nav-link { display: flex; align-items: center; gap: .72rem; padding: .72rem .78rem; min-height: 2.7rem; border: 1px solid transparent; border-radius: 14px; color: rgba(248,245,255,.86); text-decoration: none; font-weight: 760; transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease; }
.up-nav-link:hover { color: #fff; background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.08); transform: translateX(2px); }
.up-nav-link.active { color: #241035; background: linear-gradient(135deg, #ffffff, #eadfff); border-color: rgba(255,255,255,.56); box-shadow: 0 14px 30px rgba(0,0,0,.18); }
.up-nav-technical { opacity: .82; }
.up-nav-glyph { width: 1.75rem; height: 1.75rem; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 10px; background: rgba(255,255,255,.12); font-size: .92rem; font-weight: 950; }
.up-nav-link.active .up-nav-glyph { background: rgba(109,46,145,.12); color: var(--up-primary-3); }
.up-nav-note { display: block; margin: .35rem .65rem .2rem; padding: .72rem .78rem; border: 1px dashed rgba(255,255,255,.18); border-radius: 14px; color: rgba(248,245,255,.70); background: rgba(255,255,255,.055); font-size: .76rem; line-height: 1.35; }
.up-sidebar-backdrop { display: none; }

.up-workspace { min-height: 100vh; margin-left: var(--up-sidebar); display: flex; flex-direction: column; }
.up-topbar { position: sticky; top: 0; z-index: 1020; min-height: 4.8rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.4rem; background: rgba(255,255,255,.86); border-bottom: 1px solid var(--up-line); backdrop-filter: blur(18px); box-shadow: 0 8px 24px rgba(35,27,56,.05); }
.up-topbar-main, .up-topbar-actions { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.up-topbar-main { flex: 1 1 auto; }
.up-topbar-actions { flex: 0 1 auto; justify-content: flex-end; }
.up-icon-button { width: 2.65rem; height: 2.65rem; border: 1px solid var(--up-line); border-radius: 14px; background: #fff; color: var(--up-primary); }
.up-topbar-title span, .up-context-button small, .up-user-copy small { display: block; color: var(--up-muted); font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.up-topbar-title strong { display: block; max-width: 32rem; overflow: hidden; color: var(--up-heading); font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.up-navbar-shortcuts { align-items: center; gap: .35rem; margin-left: .35rem; padding-left: .8rem; border-left: 1px solid var(--up-line); }
.up-navbar-shortcuts a { display: inline-flex; align-items: center; min-height: 2.35rem; padding: .35rem .75rem; border-radius: 999px; color: #4c455f; text-decoration: none; font-size: .84rem; font-weight: 760; }
.up-navbar-shortcuts a:hover, .up-navbar-shortcuts a.active { background: var(--up-primary-soft); color: var(--up-primary-3); }
.up-context-button { min-height: 2.85rem; display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .8rem; border: 1px solid var(--up-line); border-radius: 16px; background: #fff; color: var(--up-ink); box-shadow: var(--up-shadow-xs); }
.up-context-button strong { display: block; max-width: 12rem; overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.up-user-button { min-height: 2.85rem; display: inline-flex; align-items: center; gap: .6rem; padding: .35rem .78rem .35rem .35rem; border: 1px solid var(--up-line); border-radius: 999px; background: #fff; color: var(--up-ink); box-shadow: var(--up-shadow-xs); }
.up-user-avatar { width: 2.15rem; height: 2.15rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: linear-gradient(135deg, #f4edff, #e7dcff); color: var(--up-primary-3); font-weight: 950; }
.up-user-copy strong { display: block; max-width: 11rem; overflow: hidden; font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }
.up-menu { border: 1px solid var(--up-line); border-radius: 16px; box-shadow: var(--up-shadow); overflow: hidden; }
.up-main { flex: 1; width: 100%; padding: 1.55rem; }
.up-main-inner { width: min(100%, 1440px); margin: 0 auto; }
.up-public-body { background: radial-gradient(circle at 10% 0%, rgba(167,139,250,.24), transparent 26rem), linear-gradient(135deg, #160c24 0%, #2c1544 58%, #4c1d95 100%); }
.up-public-shell { min-height: 100vh; display: flex; align-items: stretch; justify-content: center; padding: 2rem; }
.up-alert { border: 0; border-radius: 16px; box-shadow: var(--up-shadow-sm); }
.up-toast-stack { display: grid; gap: .65rem; margin-bottom: 1rem; }
.up-guidance-strip { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; border: 1px solid rgba(109,46,145,.16); border-radius: 18px; background: #fff; box-shadow: var(--up-shadow-xs); }
.up-guidance-strip strong, .up-guidance-strip span { display: block; }
.up-guidance-strip span { color: var(--up-muted); }
.up-footer { margin-top: auto; border-top: 1px solid var(--up-line); background: rgba(255,255,255,.70); backdrop-filter: blur(16px); }
.up-footer-inner { width: min(100%, 1440px); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.55rem; color: var(--up-muted); font-size: .82rem; }
.up-footer strong { color: var(--up-primary-3); }

.up-page-hero, .enterprise-page-header, .app-page-hero {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    border: 1px solid var(--up-line);
    border-radius: var(--up-radius);
    background: linear-gradient(135deg, #ffffff, #fbfaff 58%, #f4f0ff);
    box-shadow: var(--up-shadow-sm);
    overflow: hidden;
}
.up-page-hero::before, .enterprise-page-header::before, .app-page-hero::before { content: none; }
.enterprise-eyebrow, .app-page-kicker, .up-eyebrow { color: var(--up-primary); font-size: .72rem; font-weight: 950; letter-spacing: .10em; text-transform: uppercase; }
.app-page-title, .up-page-title { margin: 0; color: var(--up-heading); font-weight: 950; letter-spacing: -.045em; }
.app-page-subtitle, .up-page-subtitle { max-width: 60rem; color: var(--up-muted); }
.enterprise-header-actions, .app-page-actions, .up-page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }

.up-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(18rem, .65fr); gap: 1rem; align-items: start; }
.up-dashboard-stack { display: grid; gap: 1rem; }
.up-section-title { margin: 0; color: var(--up-heading); font-size: 1rem; font-weight: 900; letter-spacing: -.02em; }
.up-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.up-stat-card { position: relative; display: flex; flex-direction: column; min-height: 9rem; padding: 1.1rem; border: 1px solid var(--up-line); border-radius: 20px; background: #fff; box-shadow: var(--up-shadow-sm); overflow: hidden; }
.up-stat-card::after { content: ""; position: absolute; right: 1rem; top: 1rem; width: 2.35rem; height: 2.35rem; border-radius: 15px; background: linear-gradient(135deg, rgba(109,46,145,.12), rgba(124,58,237,.20)); }
.up-stat-label { display: block; color: var(--up-muted); font-size: .74rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.up-stat-value { display: block; margin-top: .45rem; color: var(--up-heading); font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 950; line-height: .95; letter-spacing: -.07em; }
.up-stat-card p { margin-top: auto; }
.up-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.up-action-card { display: flex; flex-direction: column; gap: .75rem; min-height: 10rem; padding: 1.1rem; border: 1px solid var(--up-line); border-radius: 20px; background: #fff; color: var(--up-ink); text-decoration: none; box-shadow: var(--up-shadow-sm); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.up-action-card:hover { color: var(--up-ink); border-color: rgba(109,46,145,.28); box-shadow: var(--up-shadow); transform: translateY(-2px); }
.up-action-card span { width: 2.3rem; height: 2.3rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--up-primary-soft); color: var(--up-primary); font-weight: 950; }
.up-action-card strong { font-size: 1rem; }
.up-action-card small { color: var(--up-muted); }

.enterprise-section, .up-panel { border: 1px solid var(--up-line) !important; border-radius: var(--up-radius) !important; background: #fff; box-shadow: var(--up-shadow-sm) !important; }
.enterprise-section-header { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--up-line); }
.enterprise-section-kicker { display: inline-flex; align-items: center; justify-content: center; min-width: 2.1rem; height: 2.1rem; margin-bottom: .65rem; padding: 0 .35rem; border-radius: 12px; background: var(--up-primary-soft); color: var(--up-primary); font-size: .78rem; font-weight: 950; }
.enterprise-inline-panel, .enterprise-switch-panel { padding: 1rem; border: 1px solid var(--up-line); border-radius: 16px; background: var(--up-surface-2); }
.enterprise-guidance-card { border: 1px solid rgba(109,46,145,.16); background: linear-gradient(135deg, rgba(109,46,145,.08), rgba(124,58,237,.05)); }
.enterprise-table { margin-bottom: 0; }
.enterprise-table thead th { padding: .95rem 1rem; border-bottom: 1px solid var(--up-line); background: #faf8ff; color: #5c5570; font-size: .72rem; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }
.enterprise-table tbody td { padding: 1rem; border-bottom: 1px solid rgba(49,38,79,.08); vertical-align: middle; }
.enterprise-table tbody tr { background: #fff; }
.enterprise-table tbody tr:hover { background: #fcfaff; }
.enterprise-table tbody tr:last-child td { border-bottom: 0; }
.table > :not(caption) > * > * { border-color: rgba(49,38,79,.08); }
.empty-state, .chat-empty-state, .chat-placeholder { border-radius: var(--up-radius); }
.empty-state-icon, .chat-placeholder-icon, .chat-empty-icon { width: 3rem; height: 3rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--up-primary-soft); color: var(--up-primary); font-weight: 950; }
.tenant-form-actions, .user-form-actions-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border: 1px solid var(--up-line); border-radius: 20px; background: #fff; box-shadow: var(--up-shadow-sm); }
.document-metadata-list { margin: 0; padding: 0; list-style: none; }
.document-metadata-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--up-line); }
.document-metadata-list li:last-child { border-bottom: 0; }
.document-metadata-list span { color: var(--up-muted); }
.document-metadata-list strong { text-align: right; }
.document-edit-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(22rem, .65fr); gap: 1rem; align-items: start; }
.document-access-card { position: sticky; top: 5.5rem; }
.document-access-grid { display: grid; gap: 1rem; }
.document-access-guidance { padding: .95rem 1rem; border: 1px solid rgba(109,46,145,.16); border-radius: 16px; background: linear-gradient(135deg, rgba(109,46,145,.08), rgba(124,58,237,.04)); }
.document-access-guidance strong { display: block; margin-bottom: .2rem; color: var(--up-heading); font-weight: 900; }
.document-access-guidance span { display: block; color: var(--up-muted); font-size: .86rem; line-height: 1.45; }
.document-allowed-users[hidden], .document-access-guidance[hidden] { display: none !important; }
.document-user-list { display: grid; gap: .55rem; max-height: 20rem; overflow-y: auto; padding: .45rem; }
.document-user-option { display: flex; align-items: flex-start; gap: .7rem; min-height: 3.25rem; margin: 0; padding: .75rem; border: 1px solid var(--up-line); border-radius: 14px; background: #fff; cursor: pointer; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.document-user-option:hover, .document-user-option:focus-within { border-color: rgba(109,46,145,.30); background: #fcfaff; box-shadow: var(--up-shadow-xs); }
.document-user-option input[type="checkbox"] { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; margin: .15rem 0 0; }
.document-user-option-copy { min-width: 0; display: grid; gap: .1rem; }
.document-user-option-copy strong { color: var(--up-heading); font-weight: 850; line-height: 1.25; word-break: break-word; }
.document-user-option-copy small, .document-user-empty { color: var(--up-muted); font-size: .82rem; line-height: 1.35; }
.document-user-empty { padding: .8rem; border: 1px dashed var(--up-line); border-radius: 14px; background: #fff; }
.badge { border-radius: 999px; font-weight: 760; }
.text-bg-primary { background-color: rgba(109, 46, 145, .14) !important; color: #4c1d95 !important; }
.text-bg-success { background-color: rgba(25, 135, 84, .13) !important; color: #0f5132 !important; }
.text-bg-warning { background-color: rgba(183, 121, 31, .16) !important; color: #6f4700 !important; }
.text-bg-secondary, .text-bg-light { background-color: rgba(111, 106, 125, .13) !important; color: #504a62 !important; }
.text-bg-info { background-color: rgba(37, 99, 235, .13) !important; color: #1d4ed8 !important; }

.login-panel { width: min(1120px, 100%); display: grid; grid-template-columns: minmax(0, .95fr) minmax(360px, .72fr); align-self: center; border-radius: 32px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.34); }
.login-story { position: relative; padding: 3rem; background: radial-gradient(circle at 12% 0%, rgba(196,181,253,.22), transparent 18rem), linear-gradient(145deg, #211033, #4c1d95); color: #f8f5ff; }
.login-story::after { content: ""; position: absolute; inset: 1.4rem; border: 1px solid rgba(255,255,255,.14); border-radius: 24px; pointer-events: none; }
.login-seal { width: 5.2rem; height: 3.2rem; display: inline-flex; align-items: center; justify-content: center; padding: .4rem .6rem; border-radius: 16px; background: #fff; box-shadow: 0 16px 32px rgba(0,0,0,.18); }
.login-seal img { width: 100%; height: auto; display: block; }
.login-story h1 { margin-top: 2.8rem; max-width: 12ch; font-size: clamp(2.8rem, 6vw, 5.5rem); line-height: .88; font-weight: 950; letter-spacing: -.07em; }
.login-story p { max-width: 34rem; color: rgba(248,245,255,.78); font-size: 1.05rem; }
.login-card { padding: 3rem; background: #fff; }
.login-card h2 { font-weight: 950; letter-spacing: -.04em; }

.user-summary-card, .user-selection-card, .user-picker, .document-user-list { border: 1px solid var(--up-line); border-radius: 18px; background: #fff; box-shadow: var(--up-shadow-xs); }
.user-summary-card { padding: 1rem; }
.user-picker { overflow: hidden; }
.user-picker-toolbar, .user-picker-heading, .user-picker-footer { padding: .9rem 1rem; border-bottom: 1px solid var(--up-line); background: #fbfaff; }
.user-picker-footer { border-top: 1px solid var(--up-line); border-bottom: 0; background: #fff; }
.user-picker-list { max-height: 18rem; overflow-y: auto; padding: .5rem; }
.user-picker-list-large { max-height: 26rem; }
.user-picker-expanded .user-picker-list-large { max-height: 34rem; }
.user-picker-toolbar-balanced { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.user-picker-toolbar-balanced .user-picker-search { flex: 1 1 auto; }
.user-client-assignment-card .user-selection-card { min-height: 3rem; }
.user-picker-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.user-picker-empty, .user-picker-footer, .user-selection-help { color: var(--up-muted); font-size: .83rem; }
.user-permission-list { display: grid; gap: .65rem; }

.user-selection-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    width: 100%;
    min-height: 3rem;
    padding: .85rem;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.user-selection-card:hover,
.user-selection-card:focus-within {
    border-color: rgba(109,46,145,.28);
    background: #fcfaff;
}
.user-selection-card.is-selected,
.user-selection-card:has(input[type="checkbox"]:checked) {
    border-color: rgba(109, 46, 145, .52);
    background: linear-gradient(90deg, rgba(109, 46, 145, .10), #fff 62%);
    box-shadow: 0 10px 24px rgba(109, 46, 145, .08);
}
.user-selection-card.is-selected::before,
.user-selection-card:has(input[type="checkbox"]:checked)::before {
    content: "";
    position: absolute;
    inset: .65rem auto .65rem .42rem;
    width: .22rem;
    border-radius: 999px;
    background: var(--up-primary);
}
.user-selection-card input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}
.user-selection-indicator {
    position: relative;
    flex: 0 0 1.15rem;
    width: 1.15rem;
    height: 1.15rem;
    margin-top: .12rem;
    border: 1.5px solid rgba(49, 38, 79, .28);
    border-radius: .35rem;
    background: #fff;
    box-shadow: inset 0 0 0 2px #fff;
}
.user-selection-card.is-selected .user-selection-indicator,
.user-selection-card:has(input[type="checkbox"]:checked) .user-selection-indicator {
    border-color: var(--up-primary);
    background: var(--up-primary);
}
.user-selection-card.is-selected .user-selection-indicator::after,
.user-selection-card:has(input[type="checkbox"]:checked) .user-selection-indicator::after {
    content: "";
    position: absolute;
    left: .34rem;
    top: .14rem;
    width: .35rem;
    height: .65rem;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.user-selection-content, .user-selection-title, .user-selection-help { display: block; }
.user-selection-title { color: #2b253a; font-weight: 760; line-height: 1.25; }
.user-client-cell { min-width: 12rem; }
.user-active-check { padding: .75rem 1rem; background: #fbfaff; }

.chat-workspace { display: grid; grid-template-columns: minmax(18rem, 25rem) minmax(0, 1fr); gap: 1rem; }
.chat-sidebar, .chat-panel { border: 1px solid var(--up-line) !important; border-radius: var(--up-radius) !important; overflow: hidden; box-shadow: var(--up-shadow-sm) !important; background: #fff; }
.chat-list { max-height: 44rem; overflow-y: auto; }
.chat-list-item { display: flex; gap: .8rem; padding: .9rem 1rem; border-bottom: 1px solid var(--up-line); color: var(--up-ink); text-decoration: none; }
.chat-list-item:hover, .chat-list-item.active { background: var(--up-surface-2); color: var(--up-ink); }
.chat-avatar { width: 2.4rem; height: 2.4rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--up-primary-soft); color: var(--up-primary); font-weight: 950; }
.chat-avatar-lg { width: 3rem; height: 3rem; }
.chat-list-content, .chat-list-name, .chat-list-meta { display: block; min-width: 0; }
.chat-list-name { font-weight: 850; }
.chat-list-meta { color: var(--up-muted); font-size: .8rem; }
.chat-panel-header, .chat-compose { padding: 1rem; border-bottom: 1px solid var(--up-line); background: #fff; }
.chat-compose { border-top: 1px solid var(--up-line); border-bottom: 0; }
.chat-placeholder, .chat-empty-state { min-height: 18rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 2rem; text-align: center; color: var(--up-muted); }
.chat-box { min-height: 360px; max-height: 540px; overflow-y: auto; background: linear-gradient(180deg, #fff, #fbfaff); }
.chat-bubble { max-width: 80%; }
.app-soft-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .65rem; border-radius: 999px; background: var(--up-primary-soft); color: var(--up-primary); font-weight: 800; }

@media (min-width: 1200px) { .enterprise-sticky-card { position: sticky; top: 6rem; } }
@media (max-width: 1399.98px) { .up-dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 1199.98px) { .up-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .up-navbar-shortcuts { display: none !important; } .document-edit-layout { grid-template-columns: 1fr; } .document-access-card { position: static; } }
@media (max-width: 991.98px) {
    .up-sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    .sidebar-open .up-sidebar { transform: translateX(0); }
    .up-sidebar-backdrop { position: fixed; inset: 0; z-index: 1030; display: block; pointer-events: none; background: rgba(20, 12, 33, .52); opacity: 0; transition: opacity .22s ease; }
    .sidebar-open .up-sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .up-workspace { margin-left: 0; }
    .up-stat-grid { grid-template-columns: 1fr; }
    .chat-workspace { grid-template-columns: 1fr; }
    .login-panel { grid-template-columns: 1fr; }
    .login-story { display: none; }
}
@media (max-width: 767.98px) {
    .up-topbar { align-items: stretch; flex-direction: column; }
    .up-topbar-main, .up-topbar-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; }
    .up-context-button { flex: 1 1 12rem; justify-content: space-between; }
    .up-main { padding: 1rem; }
    .up-page-hero, .enterprise-page-header, .app-page-hero, .tenant-form-actions, .user-form-actions-card, .up-guidance-strip { flex-direction: column; align-items: stretch; }
    .enterprise-header-actions, .app-page-actions, .up-page-actions { justify-content: flex-start; }
    .up-action-grid { grid-template-columns: 1fr; }
    .up-footer-inner { flex-direction: column; align-items: flex-start; padding: 1rem; }
    .login-card { padding: 2rem; }
    .up-public-shell { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

.up-error-page {
  min-height: calc(100vh - 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.up-error-card {
  width: min(760px, 100%);
  background: var(--up-surface, #fff);
  border: 1px solid var(--up-border, #e5e2eb);
  border-radius: 28px;
  box-shadow: var(--up-shadow-lg, 0 24px 70px rgba(49, 23, 73, .14));
  padding: clamp(1.5rem, 4vw, 3rem);
}

.up-error-guidance {
  display: grid;
  gap: .35rem;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  background: rgba(109, 46, 145, .08);
  border: 1px solid rgba(109, 46, 145, .18);
  color: var(--up-text, #23172f);
}

.up-error-guidance strong {
  color: var(--up-primary-700, #4b176e);
}

.up-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.25rem;
}

.up-error-meta {
  color: var(--up-muted, #6f667a);
  font-size: .85rem;
  margin: 1.5rem 0 0;
}

.up-tenant-access-badge {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: .35rem .65rem;
  border-radius: 999px;
  border: 1px solid rgba(109, 46, 145, .18);
  background: rgba(109, 46, 145, .08);
  color: var(--up-primary-700, #4b176e);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}

.user-access-filter-form { width: 100%; }
.user-access-list { display: grid; gap: 0; }
.user-access-row { padding: 1rem; border-top: 1px solid var(--up-line); background: #fff; }
.user-access-row:first-child { border-top: 0; }
.user-access-row.has-access { background: linear-gradient(90deg, rgba(109,46,145,.06), #fff 36%); }
.user-access-client { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; }
.user-access-permissions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; }
.user-access-toggle { min-height: 3rem; padding: .65rem .75rem; box-shadow: none; }
.user-access-row-actions { display: flex; justify-content: flex-end; margin-top: .85rem; }
.user-access-guidance { align-items: center; }

@media (max-width: 1199.98px) {
  .user-access-permissions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 575.98px) {
  .user-access-client { align-items: flex-start; flex-direction: column; }
  .user-access-permissions { grid-template-columns: 1fr; }
  .user-access-row-actions { justify-content: stretch; }
  .user-access-row-actions .btn { width: 100%; }
}
