:root {
    --app-bg: #f6faff;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fbff;
    --app-border: #dbe7f5;
    --app-text: #06133d;
    --app-muted: #4b5e8a;
    --app-primary: #005bea;
    --app-primary-dark: #003ea8;
    --app-primary-soft: #eaf3ff;
    --app-success: #15803d;
    --app-danger: #dc2626;
    --app-shadow: 0 12px 30px rgba(15, 40, 95, .08);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    color: var(--app-text);
    background:
        radial-gradient(circle at 18% 12%, rgba(0, 91, 234, .08), transparent 26rem),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 34%, var(--app-bg) 100%);
    font-family: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

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

.auth-body {
    min-height: 100vh;
    color: #24272d;
    background: #fff;
}

.auth-page {
    display: flex;
    align-items: center;
    flex-direction: column;
    min-height: 100vh;
    padding: 2.4rem 1.25rem;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1.8rem;
    color: #101828;
    font-size: 1.35rem;
    font-weight: 850;
    text-decoration: none;
}

.auth-brand:hover {
    color: #101828;
}

.auth-brand-logo,
.brand-logo,
.sidebar-brand-logo,
.top-brand-logo {
    display: block;
    width: auto;
    object-fit: contain;
}

.auth-brand-logo {
    height: 2.75rem;
    max-width: 13rem;
}

.sidebar-brand-logo {
    width: min(100%, 11.25rem);
    max-height: 4.5rem;
    padding: .4rem;
    background: rgba(255, 255, 255, .96);
    border-radius: .85rem;
    box-shadow: 0 14px 28px rgba(0, 28, 92, .18);
}

.top-brand-logo {
    width: min(100%, 10rem);
    max-height: 4rem;
    padding: .32rem;
    background: rgba(255, 255, 255, .96);
    border-radius: .75rem;
    box-shadow: 0 12px 24px rgba(0, 28, 92, .16);
}

.auth-card {
    width: min(100%, 37.5rem);
}

.auth-card h1 {
    margin: 0;
    color: #2b2d31;
    font-size: 1.85rem;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
}

.auth-subtitle {
    margin: .65rem 0 2.4rem;
    color: #6a6f76;
    font-size: 1rem;
    text-align: center;
}

.auth-subtitle a,
.auth-forgot {
    color: #086bdc;
    font-weight: 700;
    text-decoration: none;
}

.auth-subtitle a:hover,
.auth-forgot:hover {
    text-decoration: underline;
}

.auth-field {
    display: grid;
    gap: .85rem;
    margin-bottom: 2.35rem;
}

.auth-name-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.auth-name-grid .auth-field {
    margin-bottom: 2.35rem;
}

.auth-field-compact {
    margin-top: -1rem;
    margin-bottom: 1.55rem;
}

.auth-field label {
    color: #676b73;
    font-size: 1rem;
    font-weight: 500;
}

.auth-field label span {
    color: #9aa1ad;
    font-size: .84rem;
    font-weight: 500;
}

.auth-company-context {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0 0 1.45rem;
    padding: .7rem .85rem;
    background: #f4f8ff;
    border: 1px solid #dbe9ff;
    border-radius: .65rem;
}

.auth-company-context span {
    color: #64748b;
    font-size: .84rem;
    font-weight: 750;
}

.auth-company-context strong {
    color: #0b3f9a;
    font-size: .98rem;
    font-weight: 900;
}

.auth-company-context a {
    margin-left: auto;
    color: #086bdc;
    font-size: .86rem;
    font-weight: 800;
    text-decoration: none;
}

.auth-company-context a:hover {
    text-decoration: underline;
}

.auth-field input,
.auth-field select {
    width: 100%;
    min-height: 3.15rem;
    padding: .75rem .9rem;
    color: #22262e;
    background: #fff;
    border: 1px solid #d4d7dd;
    border-radius: .45rem;
    box-shadow: none;
    font-size: 1rem;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-field select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position: calc(100% - 1.15rem) 1.34rem, calc(100% - .8rem) 1.34rem;
    background-size: .35rem .35rem, .35rem .35rem;
    background-repeat: no-repeat;
}

.auth-plan-field {
    margin-bottom: 1.65rem;
}

.auth-field input:focus,
.auth-field select:focus {
    border-color: #2b83e6;
    box-shadow: 0 0 0 .18rem rgba(43, 131, 230, .12);
}

.auth-field small {
    margin-top: -.45rem;
    color: #8a919c;
    font-size: .86rem;
}

.auth-consent {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    margin: -.65rem 0 1.6rem;
    color: #555b64;
    font-size: .94rem;
    line-height: 1.45;
}

.auth-consent input {
    flex: 0 0 auto;
    width: 1.05rem;
    height: 1.05rem;
    margin-top: .17rem;
    accent-color: #287ee6;
}

.auth-consent a {
    color: #086bdc;
    font-weight: 700;
    text-decoration: none;
}

.auth-consent a:hover {
    text-decoration: underline;
}

.auth-forgot {
    justify-self: end;
    margin-top: -.35rem;
    font-size: .94rem;
}

.auth-primary-button {
    width: 100%;
    min-height: 3.35rem;
    color: #fff !important;
    background: #287ee6 !important;
    border: 0 !important;
    border-radius: .4rem !important;
    box-shadow: none !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    cursor: pointer;
}

.auth-primary-button:hover,
.auth-primary-button:focus {
    background: #176ed7 !important;
}

.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .8rem;
    margin: 2.4rem 0 1.85rem;
    color: #9a9da3;
    font-size: 1.05rem;
}

.auth-divider::before,
.auth-divider::after {
    height: 1px;
    background: #e0e1e5;
    content: "";
}

.auth-google-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    width: 100%;
    min-height: 3.45rem;
    color: #555b64;
    background: #fff;
    border: 1px solid #dedfe4;
    border-radius: .45rem;
    box-shadow: none;
    font-size: 1rem;
    font-weight: 650;
    cursor: pointer;
}

.auth-google-button:hover {
    background: #fafbfc;
}

.google-g {
    display: inline-grid;
    width: 1.25rem;
    height: 1.25rem;
    place-items: center;
    color: #4285f4;
    font-size: 1.35rem;
    font-weight: 850;
}

.auth-message {
    display: none;
    margin-top: 1.25rem;
    padding: .85rem 1rem;
    border-radius: .45rem;
    font-size: .94rem;
}

.auth-message:not(:empty) {
    display: block;
}

.auth-error {
    color: #b42318;
    background: #fff2f1;
    border: 1px solid #ffd1cc;
}

.auth-success {
    color: #087443;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.legal-page {
    min-height: 100vh;
    padding: 2rem 1rem 3rem;
    background: #fff;
}

.legal-document {
    width: min(100%, 54rem);
    margin: 0 auto;
    color: #2b2d31;
}

.legal-document h1 {
    margin: 1.25rem 0 .4rem;
    font-size: 2rem;
    line-height: 1.15;
}

.legal-document h2 {
    margin: 1.55rem 0 .45rem;
    font-size: 1.08rem;
    color: #111827;
}

.legal-document p,
.legal-document li {
    color: #5d6470;
    font-size: .98rem;
    line-height: 1.65;
}

.legal-document a {
    color: #086bdc;
    font-weight: 700;
}

.legal-updated {
    margin: 0 0 1.15rem;
    color: #7a8594 !important;
    font-size: .92rem !important;
}

.legal-lead {
    padding: 1rem 1.15rem;
    border: 1px solid #cfe2ff;
    border-left: .3rem solid #0b5fe8;
    border-radius: .9rem;
    background: #f3f8ff;
    color: #22324d !important;
}

.legal-note {
    margin-top: 2rem;
    padding: .95rem 1rem;
    border-radius: .8rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #7c2d12 !important;
    font-size: .92rem !important;
}

.legal-back {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: #086bdc;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 640px) {
    .auth-page {
        justify-content: flex-start;
        padding: 1.4rem 1rem;
    }

    .auth-brand {
        margin-bottom: 1.2rem;
    }

    .auth-card h1 {
        font-size: 1.65rem;
    }

    .auth-subtitle {
        margin-bottom: 1.7rem;
    }

    .auth-field {
        gap: .6rem;
        margin-bottom: 1.45rem;
    }
}

.shell {
    display: grid;
    grid-template-columns: 17rem minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
}

.top {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 1.75rem .85rem;
    background: linear-gradient(180deg, #0648d5 0%, #00379f 100%);
    color: #fff;
    box-shadow: 12px 0 32px rgba(0, 40, 130, .15);
}

.top h1 {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin: 0 0 2rem;
    padding: 0 .85rem;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.25;
}

.top h1::before {
    display: grid;
    place-items: center;
    flex: 0 0 2.75rem;
    width: 2.75rem;
    height: 2.75rem;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, .72);
    border-radius: .85rem;
    content: "AI";
    font-size: .75rem;
    font-weight: 900;
}

.top h1.app-brand,
.top h1.top-brand-with-title {
    align-items: flex-start;
    flex-direction: column;
    gap: .65rem;
}

.top h1.app-brand::before,
.top h1.top-brand-with-title::before {
    display: none;
    content: none;
}

.top h1.top-brand-with-title span {
    color: rgba(255, 255, 255, .94);
    font-size: .92rem;
    font-weight: 750;
}

.nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .55rem;
}

.nav a {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-height: 3.5rem;
    padding: .8rem 1rem;
    color: rgba(255, 255, 255, .92);
    border-radius: .65rem;
    font-size: 1rem;
    font-weight: 750;
    text-decoration: none;
    transition: background .16s ease, transform .16s ease;
}

.nav a i {
    width: 1.35rem;
    font-size: 1.25rem;
    text-align: center;
}

.nav-subgroup {
    display: grid;
    gap: .28rem;
    padding: .4rem .45rem .48rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: .75rem;
    background: rgba(255, 255, 255, .06);
}

.nav-subgroup > span {
    display: flex;
    align-items: center;
    gap: .72rem;
    min-height: 2.6rem;
    padding: .55rem .65rem;
    color: rgba(255, 255, 255, .98);
    font-size: .9rem;
    font-weight: 850;
}

.nav-subgroup > span i {
    width: 1.35rem;
    font-size: 1.15rem;
    text-align: center;
}

.nav a.sub-link {
    min-height: 2.55rem;
    margin-left: .45rem;
    padding: .55rem .7rem .55rem 1.55rem;
    color: rgba(255, 255, 255, .82);
    font-size: .9rem;
    font-weight: 720;
    background: transparent;
}

.nav a.sub-link i {
    width: 1.05rem;
    font-size: 1rem;
}

.nav a.sub-link:hover,
.nav a.sub-link:focus,
.nav a.sub-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .14);
}

.nav a:hover,
.nav a:focus,
.nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, .16);
    transform: translateX(2px);
}

.nav .logout-link {
    margin-top: auto;
}

.dashboard-main {
    min-width: 0;
    padding: 0 2rem 2rem;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 5rem;
    margin: 0 -2rem 1.6rem;
    padding: 0 2rem;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--app-border);
    box-shadow: 0 8px 22px rgba(15, 40, 95, .04);
}

.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.company-login-link {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    max-width: min(42vw, 30rem);
    padding: .42rem .65rem;
    color: #0b3f9a;
    background: #eef6ff;
    border: 1px solid #c9defd;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 850;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    color: var(--app-primary-dark);
    background: transparent;
    border: 0;
    box-shadow: none;
    font-size: 1.65rem;
}

.dashboard-user {
    color: var(--app-text);
    font-size: 1rem;
    font-weight: 700;
    text-align: right;
}

.dashboard-title h2 {
    margin: 0 0 1.5rem;
    font-size: 1.9rem;
    font-weight: 850;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.65rem;
}

.metric-card {
    min-height: 10rem;
    padding: 1.35rem 1.25rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: .85rem;
    box-shadow: var(--app-shadow);
}

.metric-card span {
    display: block;
    color: #0a2464;
    font-size: .95rem;
    font-weight: 650;
}

.metric-card strong {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 1.05rem 0 .9rem;
    color: var(--app-text);
    font-size: 1.75rem;
    line-height: 1;
}

.metric-card strong i,
.feature-icon i {
    color: #0b63f6;
}

.metric-card small {
    color: #0a2464;
    font-weight: 600;
}

.trend-up {
    color: var(--app-success) !important;
}

.trend-up::before {
    content: "↑ ";
}

.dashboard-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.65rem;
}

.quick-actions-panel {
    margin-bottom: 1.65rem;
}

.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 4.75rem;
    padding: 1rem;
    color: var(--app-text);
    background: var(--app-surface-soft);
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    font-weight: 800;
    text-decoration: none;
}

.quick-action i {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-radius: .6rem;
    font-size: 1.35rem;
}

.quick-action:hover,
.quick-action:focus {
    color: var(--app-primary-dark);
    border-color: #b9d4ff;
}

.feature-card,
.panel,
.card,
.box {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: .85rem;
    box-shadow: var(--app-shadow);
}

.feature-card {
    display: grid;
    grid-template-columns: 3.9rem minmax(0, 1fr);
    gap: 1.35rem;
    min-height: 12rem;
    padding: 1.65rem;
}

.feature-icon {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    background: var(--app-primary-soft);
    border-radius: .75rem;
    font-size: 2rem;
}

.feature-card h3 {
    margin: 0 0 .65rem;
    color: var(--app-text);
    font-size: 1.12rem;
    font-weight: 850;
}

.feature-card p {
    min-height: 3.1rem;
    margin: 0 0 1.2rem;
    color: #15306d;
    line-height: 1.55;
}

.panel {
    margin-bottom: 1.35rem;
    padding: 1.35rem;
    min-width: 0;
    max-width: 100%;
}

.panel h2 {
    margin: 0 0 1rem;
    color: var(--app-primary-dark);
    font-size: 1.25rem;
    font-weight: 850;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .9rem;
    margin: 0 0 1rem;
}

.field {
    flex: 1 1 14rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 12rem;
    max-width: 22rem;
}

.field label,
label {
    color: #284075;
    font-size: .82rem;
    font-weight: 800;
}

.field input,
.field select,
input[type="text"],
input[type="password"],
select,
textarea {
    min-height: 2.55rem;
    padding: .58rem .75rem;
    color: var(--app-text);
    background: #fff;
    border: 1px solid #cfdcf0;
    border-radius: .55rem;
    outline: none;
}

.field input:focus,
.field select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: #71a7ff;
    box-shadow: 0 0 0 .22rem rgba(0, 91, 234, .12);
}

.input-invalid,
.field input.input-invalid,
.field select.input-invalid,
textarea.input-invalid {
    border-color: #ef4444 !important;
    background: #fff7f7 !important;
    box-shadow: 0 0 0 .2rem rgba(239, 68, 68, .12) !important;
}

.field-validation-message {
    display: block;
    margin-top: .28rem;
    color: #b91c1c;
    font-size: .78rem;
    font-weight: 800;
}

.input,
.query {
    min-width: min(100%, 26rem);
}

textarea.input {
    width: 100%;
    min-height: 5rem;
    resize: vertical;
}

.button,
input[type="submit"],
input[type="button"],
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 2.5rem;
    padding: .58rem 1rem;
    color: #fff;
    background: linear-gradient(180deg, #1475ff, #005bea);
    border: 0;
    border-radius: .45rem;
    box-shadow: 0 9px 18px rgba(0, 91, 234, .18);
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
}

.row > input[type="file"] {
    flex: 1 1 18rem;
    max-width: 32rem;
}

.row > .button,
.row > input[type="submit"],
.row > input[type="button"],
.row > button {
    flex: 0 0 auto;
}

.panel > .row:first-of-type,
.panel > .row:nth-of-type(2) {
    align-items: end;
}

.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
button:hover {
    color: #fff;
    background: linear-gradient(180deg, #0068ff, #004ed2);
}

.secondary {
    background: #64748b !important;
    box-shadow: none !important;
}

.danger {
    background: var(--app-danger) !important;
    box-shadow: none !important;
}

.button.listening {
    background: #16a34a !important;
}

.meta,
.text-muted {
    display: block;
    color: var(--app-muted);
    font-size: .9rem;
}

.error {
    display: block;
    margin-top: .75rem;
    color: #b91c1c;
    font-weight: 700;
}

.alert-message,
span[id$="StatusLabel"],
span[id$="ErrorLabel"] {
    display: none;
    align-items: flex-start;
    gap: .7rem;
    width: 100%;
    margin-top: 1rem;
    padding: .85rem 1rem;
    border: 1px solid transparent;
    border-left-width: .3rem;
    border-radius: .75rem;
    box-shadow: 0 8px 20px rgba(15, 40, 95, .06);
    font-size: .94rem;
    font-weight: 750;
    line-height: 1.45;
}

.alert-message:not(:empty),
span[id$="StatusLabel"]:not(:empty),
span[id$="ErrorLabel"]:not(:empty) {
    display: flex;
}

.alert-message::before,
span[id$="StatusLabel"]::before,
span[id$="ErrorLabel"]::before {
    display: grid;
    place-items: center;
    flex: 0 0 1.35rem;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    color: #fff;
    font-size: .78rem;
    font-weight: 900;
    line-height: 1;
}

.alert-success,
span[id$="StatusLabel"] {
    color: #14532d;
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left-color: #16a34a;
}

.alert-success::before,
span[id$="StatusLabel"]::before {
    content: "v";
    background: #16a34a;
}

.alert-error,
span[id$="ErrorLabel"] {
    color: #7f1d1d;
    background: #fef2f2;
    border-color: #fecaca;
    border-left-color: #dc2626;
}

.alert-error::before,
span[id$="ErrorLabel"]::before {
    content: "!";
    background: #dc2626;
}

.alert-warning {
    color: #7c2d12 !important;
    background: #fff7ed !important;
    border-color: #fed7aa !important;
    border-left-color: #f59e0b !important;
}

.alert-warning::before {
    content: "!";
    background: #f59e0b !important;
}

span.alert-warning[id$="StatusLabel"]::before {
    content: "!";
    background: #f59e0b !important;
}

.alert-info {
    color: #0f3f83 !important;
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    border-left-color: #0b63f6 !important;
}

.alert-info::before {
    content: "i";
    background: #0b63f6 !important;
}

span.alert-info[id$="StatusLabel"]::before {
    content: "i";
    background: #0b63f6 !important;
}

.hint {
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    color: #0a2464;
    background: #eaf3ff;
    border: 1px solid #bfd7ff;
    border-left: .3rem solid var(--app-primary);
    border-radius: .75rem;
}

.grid {
    width: 100%;
    max-width: 100%;
    margin-top: .75rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: .7rem;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.grid th,
.grid td {
    padding: .95rem 1.05rem;
    color: var(--app-text);
    vertical-align: middle;
    border-bottom: 1px solid #e7eef8;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.grid th {
    color: #00379f;
    background: #fbfdff;
    font-size: .82rem;
    font-weight: 850;
}

.grid tr:last-child td {
    border-bottom: 0;
}

.grid tr:hover td {
    background: #f9fcff;
}

.results-grid .col-id {
    width: 4.5rem;
}

.results-grid .col-category {
    width: 9rem;
}

.results-grid .col-number {
    width: 7rem;
    text-align: right;
}

.results-grid .memory-cell {
    width: auto;
}

.results-grid .memory-cell:not(th) {
    line-height: 1.5;
}

.cards,
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .9rem;
}

.card,
.box {
    padding: 1rem;
}

.card a {
    color: var(--app-primary);
    font-weight: 850;
    text-decoration: none;
}

.card p {
    margin: .45rem 0 0;
    color: var(--app-muted);
}

.box strong {
    display: block;
    margin-top: .25rem;
    color: var(--app-text);
    font-size: 1.45rem;
}

.chat {
    height: min(58vh, 36rem);
    min-height: 22rem;
    overflow: auto;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fbff;
    border: 1px solid var(--app-border);
    border-radius: .85rem;
}

.msg {
    max-width: 82%;
    margin: 0 0 .85rem;
    padding: .8rem .9rem;
    border-radius: .85rem;
    white-space: pre-wrap;
    box-shadow: 0 8px 20px rgba(15, 40, 95, .08);
}

.msg.user {
    margin-left: auto;
    color: #fff;
    background: var(--app-primary);
}

.msg.assistant {
    margin-right: auto;
    color: var(--app-text);
    background: #fff;
    border: 1px solid var(--app-border);
}

.chat-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .65rem;
    min-width: 9rem;
}

.chat-working,
.voice-status {
    align-items: center;
    gap: .55rem;
    margin: .25rem 0 .8rem;
    padding: .6rem .8rem;
    background: #fff;
    border-radius: .75rem;
    box-shadow: var(--app-shadow);
    font-weight: 800;
}

.chat-working {
    color: var(--app-primary-dark);
    border: 1px solid #bfd7ff;
}

.voice-status {
    color: #14532d;
    border: 1px solid #bbf7d0;
}

.chat-working-dot,
.voice-status-dot {
    width: .65rem;
    height: .65rem;
    border-radius: 999px;
}

.chat-working-dot {
    background: var(--app-primary);
    animation: chatPulse 1s infinite;
}

.voice-status-dot {
    background: #16a34a;
    animation: voicePulse 1s infinite;
}

.voice-option {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: #284075;
    font-size: .86rem;
    font-weight: 800;
}

.voice-option input {
    min-height: auto;
}

.memory {
    margin-top: .9rem;
    padding: .85rem 1rem;
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: .3rem solid #16a34a;
    border-radius: .75rem;
}

.chat-shell {
    background: #f5f8fc;
}

.memory-chat-main {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 100vh;
    background: #f5f8fc;
}

.chat-surface {
    min-height: 0;
    overflow: hidden;
    display: grid;
}

.memory-chat-statusbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;
    min-height: 2.5rem;
    padding: .28rem .85rem;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--app-border);
    overflow: hidden;
}

.memory-chat-statusbar .trust-pills {
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
}

.memory-chat-statusbar .trust-pill {
    overflow: hidden;
    max-width: 14rem;
    text-overflow: ellipsis;
}

.trust-pills,
.chat-header-actions,
.active-filter-row,
.quick-filter-pills,
.source-summary,
.chat-input-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
}

.trust-pill,
.filter-chip,
.source-chip,
.confidence {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 1.45rem;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 800;
    white-space: nowrap;
}

.trust-pill.success {
    color: #047857;
    background: #e8f8ef;
}

.trust-pill.info,
.filter-chip {
    color: #1d4ed8;
    background: #eaf3ff;
}

.trust-pill.warning,
.filter-chip.encrypted {
    color: #92400e;
    background: #fef3c7;
}

.trust-pill.neutral {
    color: #475569;
    background: #f1f5f9;
}

.live-dot {
    width: .5rem;
    height: .5rem;
    border-radius: 999px;
    background: #10b981;
    animation: voicePulse 1.4s infinite;
}

.icon-button-text {
    min-height: 1.85rem;
    padding: .28rem .55rem !important;
    font-size: .76rem !important;
    color: #334155 !important;
    background: #fff !important;
    border: 1px solid #d7e1ef !important;
    box-shadow: none !important;
}

.chat-filter-card,
.user-filter-card {
    padding: .35rem .85rem;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--app-border);
}

.chat-hidden-context {
    display: none !important;
}

.chat-filter-card summary {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .25rem;
    color: #475569;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 900;
    list-style: none;
}

.chat-filter-card summary::-webkit-details-marker {
    display: none;
}

.chat-filter-card summary::after {
    content: "Hide";
    margin-left: .45rem;
    color: #64748b;
    font-size: .68rem;
    font-weight: 800;
}

.chat-filter-card:not([open]) summary::after {
    content: "Show";
}

.chat-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(10rem, 1fr));
    gap: .5rem;
    margin-bottom: .35rem;
}

.chat-filter-grid .field {
    min-width: 0;
    max-width: none;
    gap: .18rem;
}

.chat-filter-grid .field label {
    font-size: .7rem;
}

.chat-filter-grid input,
.chat-filter-grid select {
    width: 100%;
    min-height: 2rem;
    padding: .35rem .55rem;
    border-radius: .45rem;
    font-size: .82rem;
}

.filter-reset {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #475569;
    font-size: .74rem;
    font-weight: 850;
    text-decoration: none;
}

.active-filter-row {
    gap: .35rem;
}

.memory-welcome-card {
    width: min(100% - 2rem, 50rem);
    margin: 3.5rem auto;
    padding: 2rem 2.35rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    box-shadow: var(--app-shadow);
}

.welcome-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-radius: .85rem;
    font-size: 1.55rem;
}

.memory-welcome-card h2 {
    margin: 0 0 .65rem;
    color: #1f2937;
    font-size: 1.55rem;
    font-weight: 900;
}

.memory-welcome-card p {
    width: min(100%, 36rem);
    margin: 0 auto 1.55rem;
    color: #5b6f94;
    line-height: 1.55;
}

.welcome-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    width: min(100%, 34rem);
    margin: 0 auto 1.4rem;
}

.welcome-stats span {
    color: #5b6f94;
    font-size: .86rem;
    font-weight: 750;
}

.welcome-stats strong {
    display: block;
    color: #2563eb;
    font-size: 1.65rem;
    line-height: 1;
}

.quick-filter-pills {
    justify-content: center;
    margin-bottom: 1.4rem;
}

.quick-filter-pills button {
    min-width: 6.5rem;
    min-height: 2.15rem;
    padding: .42rem .9rem;
    color: #475569;
    background: #fff;
    border: 1px solid #d9e4f2;
    border-radius: 999px;
    box-shadow: none;
    font-size: .84rem;
}

.quick-filter-pills button.active,
.quick-filter-pills button:hover {
    color: #fff;
    background: #2563eb;
    border-color: #2563eb;
}

.suggestion-list {
    display: grid;
    gap: .55rem;
}

.suggestion-list button {
    display: grid;
    grid-template-columns: 1.4rem minmax(0, 1fr);
    align-items: center;
    min-height: 2.75rem;
    padding: .65rem .85rem;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #dce6f3;
    border-radius: .7rem;
    box-shadow: none;
    font-weight: 700;
    text-align: left;
}

.suggestion-list button:hover {
    color: #1d4ed8;
    background: #eef5ff;
}

.memory-chat-thread {
    min-height: 0;
    height: 100%;
    padding: 1rem 1.15rem 1.25rem;
    overflow: auto;
    scroll-behavior: smooth;
}

.memory-chat-thread .msg {
    max-width: min(49rem, 78%);
    margin-bottom: .78rem;
    padding: .66rem .86rem;
    border-radius: 1rem;
    box-shadow: none;
    font-size: .95rem;
    animation: chatBubbleIn .18s ease-out;
}

.memory-chat-thread .msg.user {
    margin-left: auto;
    color: #0f172a;
    background: linear-gradient(135deg, #dbeafe 0%, #eef6ff 100%);
    border: 0;
    border-bottom-right-radius: .32rem;
}

.memory-chat-thread .msg.assistant {
    margin-right: auto;
    color: #111827;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid #dbe7f5;
    border-bottom-left-radius: .32rem;
    box-shadow: 0 12px 34px rgba(15, 40, 95, .08);
    padding: .9rem 1rem .78rem;
}

.memory-chat-thread .msg.pending-assistant {
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    border-color: #dbeafe;
}

.memory-chat-thread .msg.error {
    color: #991b1b;
    background: #fff5f5;
    border-color: #fecaca;
}

.message-role {
    display: none;
    margin-bottom: .35rem;
    font-size: .78rem;
    font-weight: 900;
    opacity: .78;
}

.message-text {
    line-height: 1.48;
    white-space: pre-wrap;
}

.message-text.ai-answer {
    white-space: normal;
}

.ai-answer {
    display: grid;
    gap: .72rem;
}

.ai-answer p {
    margin: 0;
    color: #182235;
    line-height: 1.68;
}

.ai-answer p + p {
    margin-top: .1rem;
}

.ai-short-reply {
    color: #182235;
    font-size: .98rem;
    line-height: 1.68;
}

.ai-answer h4 {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: .08rem 0 0;
    color: #0b2d68;
    font-size: .96rem;
    font-weight: 850;
    letter-spacing: 0;
}

.ai-answer h4::before {
    display: inline-grid;
    width: 1.35rem;
    height: 1.35rem;
    place-items: center;
    color: #0b63f6;
    background: #eaf3ff;
    border-radius: .42rem;
    content: "\F26A";
    font-family: "bootstrap-icons";
    font-size: .76rem;
}

.ai-answer ul,
.ai-answer ol {
    display: grid;
    gap: .48rem;
    margin: .04rem 0;
    padding-left: 1.15rem;
}

.ai-answer li {
    line-height: 1.5;
    padding-left: .15rem;
}

.ai-answer strong {
    color: #102a66;
    font-weight: 850;
}

.ai-answer code {
    padding: .08rem .28rem;
    color: #0f3b83;
    background: #eef5ff;
    border: 1px solid #dbeafe;
    border-radius: .28rem;
    font-size: .88em;
}

.ai-keyline {
    display: grid;
    grid-template-columns: minmax(7.5rem, auto) minmax(0, 1fr);
    gap: .65rem;
    align-items: start;
    padding: .64rem .72rem;
    background: #f7fbff;
    border: 1px solid #dfeaf8;
    border-radius: .7rem;
}

.ai-keyline strong {
    color: #315078;
    font-size: .8rem;
}

.ai-keyline span {
    min-width: 0;
}

.ai-callout {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .55rem;
    align-items: start;
    padding: .72rem .82rem;
    background: #eef6ff;
    border: 1px solid #bfdbfe;
    border-left: .22rem solid #2563eb;
    border-radius: .76rem;
}

.ai-callout strong {
    color: #1d4ed8;
    font-size: .78rem;
    text-transform: uppercase;
}

.ai-callout.warning {
    background: #fff7ed;
    border-color: #fed7aa;
    border-left-color: #f97316;
}

.ai-callout.warning strong {
    color: #c2410c;
}

.ai-callout.action {
    background: #ecfdf5;
    border-color: #bbf7d0;
    border-left-color: #16a34a;
}

.ai-callout.action strong {
    color: #15803d;
}

.ai-callout.important {
    background: #fefce8;
    border-color: #fde68a;
    border-left-color: #eab308;
}

.ai-callout.important strong {
    color: #a16207;
}

.ai-answer-typing {
    color: #111827;
    white-space: pre-wrap;
}

.pending-assistant {
    color: #475569 !important;
}

.inline-thinking-dot {
    display: inline-block;
    width: .48rem;
    height: .48rem;
    margin-right: .45rem;
    background: var(--app-primary);
    border-radius: 999px;
    animation: chatPulse 1s infinite;
    vertical-align: middle;
}

.inline-thinking-text {
    color: #475569;
    font-weight: 800;
}

@keyframes chatBubbleIn {
    from {
        opacity: 0;
        transform: translateY(.28rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.source-panel {
    margin-top: .72rem;
    padding: .58rem .62rem;
    background: #f8fbff;
    border: 1px solid #e0eaf7;
    border-radius: .8rem;
}

.source-panel.empty {
    display: none;
    color: #64748b;
}

.source-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
}

.source-label {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    color: #38557a;
    font-size: .73rem;
    font-weight: 900;
}

.confidence {
    display: inline-flex;
    align-items: center;
    min-height: 1.35rem;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 900;
}

.source-count {
    color: #52657f;
    font-size: .74rem;
    font-weight: 760;
}

.memory-chat-inputbar .alert-message:not(:empty),
.memory-chat-inputbar span[id$="StatusLabel"]:not(:empty) {
    display: none;
}

.source-chip {
    display: inline-flex;
    align-items: center;
    gap: .12rem;
    min-height: 1.35rem;
    padding: .16rem .52rem .16rem .34rem;
    color: #1d4ed8;
    background: #eaf3ff;
    border: 1px solid #d7e7ff;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 850;
}

.source-chip i {
    font-size: .95rem;
    line-height: 1;
}

.user-image-attachment {
    display: flex;
    align-items: center;
    gap: .4rem;
    width: fit-content;
    max-width: 100%;
    margin-top: .45rem;
    padding: .32rem .55rem;
    color: #0b3f9a;
    background: rgba(255, 255, 255, .62);
    border: 1px solid rgba(11, 93, 222, .18);
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.confidence.high {
    color: #047857;
    background: #d1fae5;
}

.confidence.medium {
    color: #92400e;
    background: #fef3c7;
}

.confidence.neutral {
    color: #475569;
    background: #f1f5f9;
}

.source-details {
    margin-top: .65rem;
}

.source-details summary {
    color: #475569;
    cursor: pointer;
    font-size: .86rem;
    font-weight: 850;
}

.source-memory {
    margin-top: .65rem;
    padding: .75rem;
    background: #f8fafc;
    border: 1px solid #e2eaf5;
    border-radius: .7rem;
}

.source-memory strong,
.source-memory span {
    display: block;
}

.source-memory strong {
    color: #1d4ed8;
    font-size: .86rem;
}

.source-memory span {
    color: #64748b;
    font-size: .78rem;
    font-weight: 800;
}

.source-memory p {
    margin: .45rem 0 0;
    color: #334155;
    font-size: .88rem;
    line-height: 1.45;
}

.memory-image-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
    gap: .7rem;
    margin-top: .7rem;
}

.memory-image-card {
    overflow: hidden;
    margin: 0;
    background: #fff;
    border: 1px solid #dce8f6;
    border-radius: .85rem;
    box-shadow: 0 10px 26px rgba(15, 40, 95, .07);
}

.memory-image-preview {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: #eef4fb;
}

.memory-image-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memory-image-card figcaption {
    display: grid;
    gap: .45rem;
    padding: .62rem .7rem .68rem;
}

.memory-image-card strong,
.memory-image-card a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-width: 0;
}

.memory-image-card strong {
    color: #17325d;
    font-size: .82rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.memory-image-card a {
    width: fit-content;
    color: #0b58dd;
    font-size: .78rem;
    font-weight: 850;
    text-decoration: none;
}

.memory-image-card a:hover {
    text-decoration: underline;
}

.memory-chat-inputbar {
    position: sticky;
    bottom: 0;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, .98);
    border-top: 1px solid var(--app-border);
}

.chat-input-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: .55rem;
    align-items: stretch;
}

.memory-chat-input {
    width: 100%;
    min-height: 3.2rem;
    max-height: 9rem;
    padding: .85rem 1rem;
    border-radius: .75rem;
    resize: vertical;
}

.image-chat-button,
.voice-inline-button,
.send-inline-button {
    min-width: 3.2rem;
    min-height: 3.2rem;
    border-radius: .75rem;
}

.image-chat-button {
    display: inline-flex;
    position: relative;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin: 0;
    min-width: 8.75rem;
    padding: 0 .95rem;
    color: #0b4dcc;
    background: linear-gradient(180deg, #eff6ff, #dbeafe);
    border: 1px solid #adcfff;
    cursor: pointer;
    font-weight: 850;
    box-shadow: 0 10px 22px rgba(37, 99, 235, .1);
    white-space: nowrap;
}

.image-chat-button:hover,
.image-chat-button.has-image {
    color: #fff;
    background: linear-gradient(180deg, #2563eb, #0b58dd);
    border-color: #0b58dd;
}

.image-chat-button span {
    font-size: .85rem;
}

.image-chat-upload {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.voice-inline-button {
    color: #334155;
    background: #f8fafc;
    border: 1px solid #d7e1ef;
    box-shadow: none;
}

.voice-inline-button span {
    font-size: .84rem;
}

.selected-image-chip {
    display: none;
    align-items: center;
    gap: .45rem;
    width: fit-content;
    max-width: min(100%, 38rem);
    margin-top: .48rem;
    padding: .32rem .42rem .32rem .58rem;
    color: #0b3f9a;
    background: #eef6ff;
    border: 1px solid #c7dcff;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 850;
}

.selected-image-chip span {
    overflow: hidden;
    max-width: min(28rem, 68vw);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-image-chip button {
    display: inline-grid;
    width: 1.35rem;
    height: 1.35rem;
    place-items: center;
    padding: 0;
    color: #0b4dcc;
    background: #fff;
    border: 1px solid #c7dcff;
    border-radius: 999px;
    font-size: 1rem;
    line-height: 1;
}

.send-inline-button {
    min-width: 4.3rem;
    background: #2563eb !important;
}

.send-inline-button.is-sending,
.send-inline-button:disabled {
    color: #eaf2ff !important;
    background: #93a9c9 !important;
    cursor: wait;
}

.memory-chat-input:disabled {
    color: #64748b;
    background: #f8fafc;
}

.chat-input-meta {
    justify-content: space-between;
    margin-top: .55rem;
    color: #7384a4;
    font-size: .8rem;
}

.chat-input-meta button {
    min-height: 0;
    padding: 0 .2rem;
    color: #64748b;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: .8rem;
    font-weight: 800;
}

.connector-layout {
    display: grid;
    grid-template-columns: minmax(22rem, .95fr) minmax(28rem, 1.05fr);
    gap: 1.35rem;
    align-items: start;
}

.connector-left,
.connector-right {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    min-width: 0;
}

.connector-card {
    margin-bottom: 0;
    padding: 1.45rem;
}

.connector-card h2 {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: 1.25rem;
    color: #18203a;
}

.connector-card h2 i {
    color: var(--app-primary);
}

.connector-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.connector-form-grid.compact {
    margin-bottom: 1rem;
}

.connector-form-grid .field {
    min-width: 0;
    max-width: none;
}

.connector-form-grid .field input,
.connector-form-grid .field select {
    width: 100%;
}

.connector-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
}

.connector-actions .button,
.source-actions .button {
    min-height: 2.35rem;
    padding: .52rem .9rem;
    border-radius: .48rem;
}

.count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: .35rem .8rem;
    color: #3730a3;
    background: #e8eafe;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 850;
    white-space: nowrap;
}

.source-card {
    display: grid;
    grid-template-columns: 3.1rem minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    margin-top: .75rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
}

.source-logo {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    color: var(--app-primary);
    background: #eaf3ff;
    border-radius: .6rem;
    font-weight: 900;
}

.source-main {
    min-width: 0;
}

.source-main h3 {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0 0 .2rem;
    color: #18203a;
    font-size: 1.08rem;
    font-weight: 850;
}

.source-main p,
.source-main small {
    display: block;
    margin: 0;
    color: var(--app-muted);
    line-height: 1.45;
}

.source-main p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .55rem;
    max-width: 22rem;
}

.health-dot {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    border-radius: 999px;
}

.health-dot.ok {
    background: #10b981;
}

.health-dot.warn {
    background: #f59e0b;
}

.health-dot.error {
    background: #ef4444;
}

.sync-table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

.connector-table th,
.connector-table td {
    padding: .9rem .65rem;
    border-bottom: 1px solid #e9eef7;
    color: #263654;
    vertical-align: top;
}

.connector-table th {
    color: #667085;
    font-size: .86rem;
    font-weight: 750;
}

.connector-table tr:last-child td {
    border-bottom: 0;
}

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

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.65rem;
    padding: .25rem .75rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-badge.success {
    color: #047857;
    background: #d1fae5;
}

.status-badge.warning {
    color: #a94b00;
    background: #fef3c7;
}

.status-badge.error {
    color: #b91c1c;
    background: #fee2e2;
}

.status-badge.neutral {
    color: #475569;
    background: #f1f5f9;
}

.webhook-panel .meta {
    margin-bottom: .85rem;
}

.webhook-stream {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    max-height: 25rem;
    overflow: auto;
    padding-right: .25rem;
}

.webhook-group {
    border: 1px solid #dce5f2;
    border-radius: .7rem;
    background: #fff;
}

.webhook-group.is-attention {
    border-color: #f8c471;
    background: #fffaf0;
}

.webhook-group summary {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr) auto 1rem;
    gap: .85rem;
    align-items: center;
    min-height: 3.5rem;
    padding: .8rem 1rem;
    cursor: pointer;
    list-style: none;
}

.webhook-group summary::-webkit-details-marker {
    display: none;
}

.webhook-group summary::after {
    content: "v";
    color: #94a3b8;
    font-weight: 900;
}

.webhook-group[open] summary::after {
    content: "^";
}

.webhook-time {
    color: #263654;
    font-size: 1.05rem;
    font-weight: 800;
}

.webhook-title {
    overflow: hidden;
    color: #475569;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webhook-group p {
    margin: 0;
    padding: 0 1rem 1rem;
    color: var(--app-muted);
}

.import-page {
    max-width: 62rem;
}

.import-page > span[id$="StatusLabel"]:not(:empty),
.import-page > span[id$="ErrorLabel"]:not(:empty) {
    margin: 0 0 .75rem;
}

.secure-import-banner {
    display: grid;
    grid-template-columns: 2.45rem minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    margin-bottom: .75rem;
    padding: .65rem .85rem;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: .65rem;
}

.secure-lock {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    color: #047857;
    background: #bbf7d0;
    border-radius: .45rem;
    font-size: 1rem;
}

.secure-import-banner strong,
.secure-import-banner span {
    display: block;
}

.secure-import-banner strong {
    margin-bottom: .1rem;
    color: #14532d;
    font-size: .9rem;
    font-weight: 900;
}

.secure-import-banner span {
    color: #166534;
    font-size: .76rem;
    line-height: 1.25;
}

.secure-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .35rem;
}

.secure-badges span {
    display: inline-flex;
    align-items: center;
    min-height: 1.7rem;
    padding: .18rem .48rem;
    color: #64748b;
    background: #fff;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 900;
}

.import-config-card {
    padding: 1.1rem;
    border-radius: .7rem;
}

.import-config-card h2,
.import-upload-card h2 {
    margin-bottom: .25rem;
    color: #172033;
    font-size: 1.05rem;
}

.import-config-card > .meta,
.import-upload-card > .meta {
    margin-bottom: .75rem;
    font-size: .84rem;
}

.import-config-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .65rem .8rem;
}

.import-config-grid .field {
    min-width: 0;
    max-width: none;
}

.import-config-grid .field label {
    display: flex;
    align-items: center;
    gap: .35rem;
    color: #334155;
    font-size: .78rem;
}

.import-config-grid .field input,
.import-config-grid .field select,
.import-native-select {
    width: 100%;
    min-height: 2.15rem;
    padding: .35rem .55rem;
    border-color: #cbd5e1;
    border-radius: .45rem;
    font-size: .82rem;
}

.import-config-grid .field small {
    color: #8491a8;
    font-size: .68rem;
    line-height: 1.25;
}

.import-hidden-context {
    display: none !important;
}

.required-star {
    color: #ef4444;
}

.text-purple {
    color: #6d4bb3;
}

.text-blue {
    color: #3b82f6;
}

.text-amber {
    color: #f59e0b;
}

.text-gold {
    color: #eab308;
}

.text-orange {
    color: #f97316;
}

.import-upload-card {
    padding: 1.1rem;
}

.import-upload-card h2 {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.import-upload-card h2 i {
    color: var(--app-primary);
}

.import-file-box {
    display: grid;
    position: relative;
    grid-template-columns: 2.35rem minmax(0, 1fr);
    gap: .7rem;
    align-items: center;
    padding: .7rem;
    background: #f8fbff;
    border: 1px dashed #a8c7f6;
    border-radius: .75rem;
    cursor: pointer;
}

.import-file-box i {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-radius: .65rem;
    font-size: 1.2rem;
}

.import-file-box span {
    display: block;
    color: #334155;
    font-weight: 850;
}

.import-file-copy strong {
    display: block;
    color: #263347;
    font-size: .86rem;
    line-height: 1.2;
}

.import-file-name {
    display: block;
    margin-top: .12rem;
    color: #64748b;
    font-size: .72rem;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-file-box input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.settings-layout {
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.settings-subnav {
    position: sticky;
    top: 1rem;
    display: grid;
    gap: .45rem;
    padding: .7rem;
    border: 1px solid var(--app-border);
    border-radius: .85rem;
    background: #fff;
    box-shadow: 0 14px 34px rgba(14, 42, 88, .06);
}

.settings-subnav a {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-height: 2.65rem;
    padding: .55rem .7rem;
    color: #233556;
    border-radius: .6rem;
    font-weight: 800;
    text-decoration: none;
}

.settings-subnav a:hover,
.settings-subnav a:focus,
.settings-subnav a.active {
    color: var(--app-blue);
    background: #eef5ff;
}

.settings-content {
    display: grid;
    gap: 1rem;
}

.settings-panel {
    scroll-margin-top: 1rem;
}

.settings-form-grid,
.profile-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
}

.profile-detail-grid div {
    display: grid;
    gap: .32rem;
    min-height: 4.2rem;
    padding: .8rem;
    border: 1px solid #dce7f6;
    border-radius: .75rem;
    background: #f8fbff;
}

.profile-detail-grid span {
    color: #687895;
    font-size: .78rem;
    font-weight: 800;
}

.profile-detail-grid strong {
    color: #071333;
    font-size: .98rem;
    overflow-wrap: anywhere;
}

.plan-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .85rem;
}

.plan-summary-grid div {
    display: grid;
    gap: .32rem;
    min-height: 4.2rem;
    padding: .85rem;
    border: 1px solid #dbe6f7;
    border-radius: .75rem;
    background: #f8fbff;
}

.plan-summary-grid span {
    color: #687895;
    font-size: .78rem;
    font-weight: 800;
}

.plan-summary-grid strong {
    color: #071333;
    font-size: .98rem;
    overflow-wrap: anywhere;
}

.plan-option-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .9rem;
}

.plan-option-card {
    display: grid;
    gap: .7rem;
    min-height: 15rem;
    padding: 1rem;
    border: 1px solid #dbe6f7;
    border-radius: .9rem;
    background: #fff;
}

.plan-option-card.active {
    border-color: var(--app-blue);
    box-shadow: 0 16px 34px rgba(18, 94, 238, .12);
}

.plan-option-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
}

.plan-option-head h3 {
    margin: 0;
    color: #071333;
    font-size: 1.05rem;
    font-weight: 900;
}

.plan-option-card p {
    margin: 0;
    color: #63718d;
    line-height: 1.55;
}

.plan-option-card ul {
    margin: 0;
    padding-left: 1.1rem;
    color: #263955;
}

.current-plan-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.65rem;
    padding: .25rem .55rem;
    border-radius: 999px;
    background: #eaf7ef;
    color: #087a3c;
    font-size: .78rem;
    font-weight: 900;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 2.2rem;
    padding: 0 .75rem;
    color: #067647;
    background: #ecfff6;
    border: 1px solid #bde7d7;
    border-radius: 999px;
    font-weight: 850;
}

.danger-panel {
    border-color: #fecaca;
}

.compact-warning {
    margin-bottom: 1rem;
}

.settings-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
}

@media (max-width: 980px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .settings-subnav {
        position: static;
    }

    .settings-form-grid,
    .profile-detail-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 640px) {
    .auth-name-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

.advanced-search-page {
    display: grid;
    gap: 1rem;
}

.advanced-search-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid #dbe7f7;
}

.advanced-search-header h2 {
    margin: .28rem 0 .2rem;
    font-size: 1.35rem;
}

.advanced-search-header p {
    margin: 0;
    color: #5c6c86;
    font-size: .9rem;
}

.advanced-search-header .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    color: #0065d8;
    font-size: .74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 2.35rem;
    padding: .58rem .9rem;
    color: #0056d6;
    background: #eaf3ff;
    box-shadow: none;
    white-space: nowrap;
}

.advanced-search-form {
    display: grid;
    grid-template-columns: minmax(18rem, 1fr) minmax(10rem, .42fr) minmax(12rem, .48fr) minmax(8rem, .28fr) auto;
    gap: .7rem;
    align-items: end;
}

.advanced-search-form .field {
    min-width: 0;
    max-width: none;
    gap: .25rem;
}

.advanced-search-form .field label {
    font-size: .74rem;
}

.advanced-search-form .field input,
.advanced-search-form .field select {
    width: 100%;
    min-height: 2.45rem;
    padding: .5rem .72rem;
    border-radius: .52rem;
}

.advanced-query-field {
    grid-column: span 1;
}

.advanced-search-button {
    min-height: 2.45rem;
    padding: 0 1.15rem;
    white-space: nowrap;
}

.advanced-search-empty {
    display: grid;
    place-items: center;
    gap: .35rem;
    min-height: 12rem;
    padding: 1.5rem;
    border: 1px dashed #bcd1f0;
    border-radius: .7rem;
    background: #f7fbff;
    color: #65748d;
    text-align: center;
}

.advanced-search-empty i {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .7rem;
    color: #005fe8;
    background: #e4f0ff;
    font-size: 1.18rem;
}

.advanced-search-empty strong {
    color: #071a46;
    font-size: 1rem;
}

.advanced-search-empty span {
    max-width: 32rem;
    font-size: .85rem;
}

.advanced-result-list {
    display: grid;
    gap: .72rem;
}

.advanced-result-card {
    padding: .9rem 1rem;
    border: 1px solid #d7e4f5;
    border-radius: .72rem;
    background: #fff;
    box-shadow: 0 .65rem 1.8rem rgba(31, 73, 125, .06);
}

.result-card-top,
.result-title,
.result-card-meta {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.result-card-top {
    justify-content: space-between;
    margin-bottom: .65rem;
}

.result-icon {
    display: grid;
    place-items: center;
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .62rem;
    color: #075ee8;
    background: #e8f2ff;
}

.result-title strong {
    display: block;
    color: #071a46;
    font-size: .95rem;
}

.result-title span {
    display: block;
    color: #6b7a94;
    font-size: .75rem;
}

.relevance-pill {
    flex: 0 0 auto;
    padding: .25rem .58rem;
    border-radius: 999px;
    color: #087047;
    background: #dffbea;
    font-size: .72rem;
    font-weight: 800;
}

.advanced-result-card p {
    margin: 0 0 .72rem;
    color: #17284b;
    font-size: .92rem;
    line-height: 1.48;
}

.result-card-meta {
    flex-wrap: wrap;
    color: #60708b;
    font-size: .74rem;
}

.result-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 1.55rem;
    padding: .18rem .5rem;
    border-radius: 999px;
    background: #f2f6fb;
}

.result-memory-id {
    margin-left: auto;
}

@media (max-width: 1200px) {
    .advanced-search-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .advanced-query-field {
        grid-column: 1 / -1;
    }

    .advanced-search-button {
        width: 100%;
    }
}

@media (max-width: 700px) {
    .advanced-search-header {
        display: grid;
    }

    .advanced-search-form {
        grid-template-columns: 1fr;
    }

    .advanced-query-field {
        grid-column: auto;
    }

    .result-card-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .result-memory-id {
        margin-left: 0;
    }
}

.admin-ai-guide-button {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1060;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 3rem;
    padding: 0 1rem;
    color: #fff;
    background: linear-gradient(180deg, #0b63f6, #0046c7);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 18px 38px rgba(0, 70, 199, .28);
    font-weight: 900;
}

.admin-ai-guide-button.active {
    background: linear-gradient(180deg, #102a66, #071a44);
}

.admin-ai-guide-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 4.85rem;
    z-index: 1061;
    display: none;
    width: min(27rem, calc(100vw - 2rem));
    max-height: min(42rem, calc(100vh - 6rem));
    overflow: auto;
    padding: 1rem;
    color: #162033;
    background: rgba(255, 255, 255, .98);
    border: 1px solid #dbe7f5;
    border-radius: 1rem;
    box-shadow: 0 24px 60px rgba(8, 25, 60, .2);
}

.admin-ai-guide-panel.open {
    display: block;
    animation: chatBubbleIn .18s ease-out;
}

.chat-page .admin-ai-guide-button {
    right: 1rem;
    bottom: 6.65rem;
    min-height: 2.55rem;
    padding: 0 .9rem;
    box-shadow: 0 14px 32px rgba(0, 70, 199, .22);
}

.chat-page .admin-ai-guide-panel {
    right: 1rem;
    bottom: 9.75rem;
    max-height: min(32rem, calc(100vh - 11rem));
}

.admin-guide-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.admin-guide-kicker {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #0b63f6;
    font-size: .76rem;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-guide-head h3 {
    margin: .18rem 0 0;
    color: #071333;
    font-size: 1.25rem;
    font-weight: 900;
}

.admin-guide-close {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    color: #40516e;
    background: #f3f7fc;
    border: 1px solid #dbe7f5;
    border-radius: 999px;
    font-size: 1.15rem;
    line-height: 1;
}

.admin-guide-goal {
    margin: .85rem 0;
    color: #52657f;
    font-size: .92rem;
    line-height: 1.55;
}

.admin-guide-steps {
    display: grid;
    gap: .55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-guide-steps li {
    display: grid;
    grid-template-columns: 1.65rem minmax(0, 1fr);
    gap: .6rem;
    align-items: start;
    padding: .62rem;
    background: #f8fbff;
    border: 1px solid #e1ebf8;
    border-radius: .75rem;
}

.admin-guide-steps li > span {
    display: grid;
    width: 1.65rem;
    height: 1.65rem;
    place-items: center;
    color: #fff;
    background: #0b63f6;
    border-radius: .5rem;
    font-size: .78rem;
    font-weight: 900;
}

.admin-guide-steps p {
    margin: 0;
    color: #253653;
    font-size: .86rem;
    line-height: 1.45;
}

.admin-guide-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: .9rem;
}

.admin-guide-jumps {
    display: flex;
    flex-wrap: wrap;
    gap: .38rem;
    margin-top: .85rem;
    padding-top: .85rem;
    border-top: 1px solid #e1ebf8;
}

.admin-guide-jump {
    padding: .28rem .55rem;
    color: #38557a;
    background: #f4f8fd;
    border: 1px solid #e1ebf8;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 850;
    text-decoration: none;
}

.admin-guide-jump.active,
.admin-guide-jump:hover {
    color: #0b58dd;
    background: #eaf3ff;
    border-color: #c9defd;
}

.guide-page {
    display: grid;
    gap: 1rem;
}

.guide-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(18rem, .75fr);
    gap: 1rem;
    align-items: stretch;
}

.guide-hero-card,
.guide-side-card,
.guide-step-card {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: .95rem;
    box-shadow: var(--app-shadow);
}

.guide-hero-card {
    padding: 1.35rem;
}

.guide-hero-card .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .8rem;
    padding: .32rem .62rem;
    color: #0b58dd;
    background: #eaf3ff;
    border: 1px solid #c9defd;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 900;
}

.guide-hero-card h2 {
    margin: 0;
    color: #071333;
    font-size: 2rem;
    font-weight: 900;
}

.guide-hero-card p {
    max-width: 58rem;
    margin: .75rem 0 0;
    color: #52657f;
    line-height: 1.65;
}

.guide-side-card {
    display: grid;
    align-content: center;
    gap: .75rem;
    padding: 1.2rem;
    background: linear-gradient(160deg, #0b63f6, #092b77);
    color: #fff;
}

.guide-side-card strong {
    font-size: 2.2rem;
    line-height: 1;
}

.guide-side-card span {
    color: rgba(255, 255, 255, .82);
    line-height: 1.45;
}

.guide-path-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.guide-step-card {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: .75rem;
    min-height: 16rem;
    padding: 1rem;
}

.guide-step-card header {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.guide-step-icon {
    display: grid;
    width: 2.65rem;
    height: 2.65rem;
    place-items: center;
    color: #0b63f6;
    background: #eaf3ff;
    border-radius: .72rem;
    font-size: 1.25rem;
}

.guide-step-card h3 {
    margin: 0;
    color: #071333;
    font-size: 1rem;
    font-weight: 900;
}

.guide-step-card p {
    margin: .18rem 0 0;
    color: #64748b;
    font-size: .84rem;
}

.guide-step-card ul {
    display: grid;
    gap: .4rem;
    margin: 0;
    padding-left: 1rem;
    color: #334155;
    font-size: .86rem;
    line-height: 1.45;
}

.guide-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-top: .65rem;
    border-top: 1px solid #e5edf7;
}

.guide-check-row label {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    color: #38557a;
    font-size: .78rem;
    font-weight: 850;
}

.guide-check-row input {
    width: 1rem;
    height: 1rem;
}

@media (max-width: 900px) {
    .guide-hero,
    .guide-path-grid {
        grid-template-columns: 1fr;
    }

    .admin-ai-guide-button {
        right: .9rem;
        bottom: .9rem;
    }

    .admin-ai-guide-panel {
        right: .75rem;
        bottom: 4.25rem;
        width: calc(100vw - 1.5rem);
    }
}

@media (max-width: 900px) {
    .secure-import-banner {
        grid-template-columns: 2rem minmax(0, 1fr);
    }

    .secure-badges {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

.import-action-row {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr);
    gap: .65rem;
    margin: .85rem 0;
}

.import-cancel-button {
    min-height: 2.65rem;
    color: #334155 !important;
    background: #f1f5f9 !important;
    box-shadow: none !important;
}

.secure-submit-wrap {
    position: relative;
    display: block;
}

.secure-submit-wrap i {
    position: absolute;
    top: 50%;
    left: calc(50% - 8.7rem);
    z-index: 1;
    color: #fff;
    transform: translateY(-50%);
    pointer-events: none;
}

.secure-import-button {
    width: 100%;
    min-height: 2.65rem;
    padding-left: 2.2rem !important;
    background: linear-gradient(180deg, #2563eb, #005bea) !important;
    border-radius: .5rem !important;
    font-size: .9rem;
}

.secure-import-button:disabled {
    background: #9ca3af !important;
    opacity: 1;
}

.import-job-panel {
    margin: 12px 0;
    padding: 14px 16px;
    border: 1px solid #cfe0ff;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 40, 90, .08);
}

.import-job-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.import-job-head strong {
    display: block;
    color: #071641;
    font-size: 15px;
    font-weight: 800;
}

.import-job-head span {
    display: block;
    color: #66728a;
    font-size: 12px;
    margin-top: 2px;
}

.import-job-pill {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    background: #eaf2ff;
    color: #075fe4 !important;
    font-weight: 700;
    padding: 7px 10px;
    white-space: nowrap;
}

.import-progress-track {
    height: 9px;
    margin: 12px 0 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6edf7;
}

.import-progress-track span {
    display: block;
    width: 2%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #075fe4, #31c48d);
    transition: width .25s ease;
}

.import-job-panel p {
    margin: 0;
    color: #556277;
    font-size: 12px;
}

@keyframes chatPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 91, 234, .35); }
    70% { box-shadow: 0 0 0 .45rem rgba(0, 91, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 91, 234, 0); }
}

@keyframes voicePulse {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .4); }
    70% { box-shadow: 0 0 0 .45rem rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

@media (max-width: 1100px) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .connector-layout {
        grid-template-columns: 1fr;
    }

    .chat-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .import-page {
        max-width: none;
    }

    .secure-import-banner {
        grid-template-columns: 2.2rem minmax(0, 1fr);
    }

    .secure-badges {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (max-width: 900px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .top {
        position: relative;
        min-height: auto;
        padding: 1rem;
    }

    .top h1 {
        margin-bottom: 1rem;
    }

    .nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav .logout-link {
        margin-top: 0;
    }

    .dashboard-main {
        padding: 0 1rem 1.5rem;
    }

    .dashboard-header {
        margin: 0 -1rem 1.25rem;
        padding: 0 1rem;
    }

    .memory-chat-statusbar {
        position: relative;
        align-items: flex-start;
        flex-direction: column;
    }

    .memory-chat-main {
        min-height: auto;
    }
}

@media (max-width: 640px) {
    .metric-grid,
    .dashboard-card-grid {
        grid-template-columns: 1fr;
    }

    .feature-card {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .field,
    .field input,
    .field select,
    .chat-actions,
    .input,
    .query {
        width: 100%;
        min-width: 0;
    }

    .grid {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .chat {
        min-height: 18rem;
    }

    .msg {
        max-width: 96%;
    }

    .connector-form-grid {
        grid-template-columns: 1fr;
    }

    .chat-filter-grid,
    .chat-input-wrap,
    .welcome-stats {
        grid-template-columns: 1fr;
    }

    .memory-welcome-card {
        width: calc(100% - 1rem);
        margin: 1rem auto;
        padding: 1.35rem;
    }

    .memory-chat-thread {
        padding: .85rem;
    }

    .memory-chat-thread .msg {
        max-width: 96%;
    }

    .chat-input-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .image-chat-button,
    .voice-inline-button,
    .send-inline-button {
        width: 100%;
    }

    .chat-page .admin-ai-guide-button {
        right: .75rem;
        bottom: 11.5rem;
        width: 2.75rem;
        min-width: 2.75rem;
        min-height: 2.75rem;
        justify-content: center;
        padding: 0;
    }

    .chat-page .admin-ai-guide-button span {
        display: none;
    }

    .chat-page .admin-ai-guide-panel {
        right: .75rem;
        bottom: 14.75rem;
        width: calc(100vw - 1.5rem);
        max-height: min(30rem, calc(100vh - 16rem));
    }

    .source-card {
        grid-template-columns: 3rem minmax(0, 1fr);
        align-items: start;
    }

    .source-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        max-width: none;
    }

    .webhook-group summary {
        grid-template-columns: 1fr auto;
    }

    .webhook-time,
    .webhook-title {
        grid-column: 1 / -1;
    }

    .secure-import-banner,
    .import-config-grid,
    .import-action-row {
        grid-template-columns: 1fr;
    }

    .secure-lock {
        width: 2.2rem;
    }

    .secure-submit-wrap i {
        left: 1.2rem;
    }
}

/* MemBytes compact portal density */
@media (min-width: 901px) {
    .shell {
        grid-template-columns: 13.75rem minmax(0, 1fr);
    }

    .top {
        padding: 1rem .65rem;
    }

    .top h1 {
        gap: .6rem;
        margin-bottom: 1rem;
        padding: 0 .65rem;
        font-size: 1.08rem;
    }

    .top h1::before {
        flex-basis: 2.15rem;
        width: 2.15rem;
        height: 2.15rem;
        border-radius: .65rem;
        font-size: .62rem;
    }

    .nav {
        gap: .25rem;
    }

    .nav a {
        gap: .58rem;
        min-height: 2.55rem;
        padding: .48rem .72rem;
        border-radius: .5rem;
        font-size: .86rem;
    }

    .nav a i {
        width: 1.08rem;
        font-size: 1rem;
    }

    .nav-subgroup {
        gap: .18rem;
        padding: .28rem;
        border-radius: .55rem;
    }

    .nav-subgroup > span {
        min-height: 2.2rem;
        padding: .42rem .52rem;
        font-size: .78rem;
    }

    .nav a.sub-link {
        min-height: 2.2rem;
        margin-left: .25rem;
        padding: .42rem .55rem .42rem 1.25rem;
        font-size: .8rem;
    }

    .dashboard-main {
        padding: 0 1.15rem 1.15rem;
    }

    .dashboard-header {
        min-height: 3.55rem;
        margin: 0 -1.15rem .9rem;
        padding: 0 1.15rem;
    }

    .dashboard-title h2 {
        margin-bottom: .85rem;
        font-size: 1.45rem;
    }

    .dashboard-user {
        font-size: .85rem;
    }

    .metric-grid,
    .dashboard-card-grid {
        gap: .8rem;
        margin-bottom: .9rem;
    }

    .metric-card {
        min-height: 7.25rem;
        padding: .9rem;
        border-radius: .65rem;
    }

    .metric-card span {
        font-size: .8rem;
    }

    .metric-card strong {
        margin: .7rem 0 .45rem;
        font-size: 1.35rem;
    }

    .feature-card,
    .quick-action {
        min-height: 3.7rem;
        padding: .75rem;
    }

    .feature-icon,
    .quick-action i {
        width: 2rem;
        height: 2rem;
        font-size: 1.05rem;
    }

    .panel,
    .connector-card,
    .import-config-card,
    .import-upload-card {
        padding: 1rem;
        border-radius: .7rem;
    }

    .panel h2,
    .connector-card h2 {
        margin-bottom: .8rem;
        font-size: 1.05rem;
    }

    .row,
    .connector-form-grid,
    .import-config-grid {
        gap: .7rem;
    }

    .field {
        gap: .25rem;
    }

    .field label {
        font-size: .76rem;
    }

    input,
    select,
    textarea,
    .input,
    .query,
    .field input,
    .field select,
    .field textarea {
        min-height: 2.25rem;
        padding: .45rem .62rem;
        border-radius: .48rem;
        font-size: .9rem;
    }

    .button,
    button,
    input[type="submit"] {
        min-height: 2.25rem;
        padding: .45rem .8rem;
        border-radius: .48rem;
        font-size: .86rem;
    }
}

@media (min-width: 901px) {
    .chat-shell {
        height: 100vh;
        min-height: 100vh;
        overflow: hidden;
    }

    .memory-chat-main {
        height: 100vh;
        min-height: 0;
        grid-template-rows: auto auto minmax(0, 1fr) auto;
        overflow: hidden;
    }

    .memory-chat-statusbar {
        min-height: 2.15rem;
        padding: .18rem .65rem;
    }

    .memory-chat-statusbar .trust-pills,
    .chat-header-actions {
        gap: .32rem;
    }

    .trust-pill,
    .filter-chip,
    .source-chip,
    .confidence {
        min-height: 1.25rem;
        padding: .12rem .42rem;
        font-size: .68rem;
    }

    .live-dot {
        width: .4rem;
        height: .4rem;
    }

    .icon-button-text {
        min-height: 1.55rem;
        padding: .18rem .42rem !important;
        font-size: .68rem !important;
    }

    .chat-filter-card,
    .user-filter-card {
        padding: .22rem .65rem;
    }

    .user-filter-card .meta {
        display: none;
    }

    .chat-filter-card summary {
        margin-bottom: .15rem;
        font-size: .74rem;
    }

    .chat-filter-grid {
        gap: .35rem;
        margin-bottom: .22rem;
    }

    .chat-filter-grid .field label {
        font-size: .62rem;
    }

    .chat-filter-grid input,
    .chat-filter-grid select {
        min-height: 1.72rem;
        padding: .24rem .42rem;
        font-size: .74rem;
    }

    .active-filter-row {
        gap: .25rem;
    }

    .filter-reset {
        font-size: .66rem;
    }

    .chat-surface {
        min-height: 0;
    }

    .memory-welcome-card {
        width: min(100% - 1.25rem, 42rem);
        margin: 1.05rem auto;
        padding: 1.1rem 1.35rem;
        border-radius: .75rem;
    }

    .welcome-icon {
        width: 2.2rem;
        height: 2.2rem;
        margin-bottom: .55rem;
        border-radius: .6rem;
        font-size: 1.05rem;
    }

    .memory-welcome-card h2 {
        margin-bottom: .35rem;
        font-size: 1.18rem;
    }

    .memory-welcome-card p {
        margin-bottom: .75rem;
        font-size: .86rem;
        line-height: 1.38;
    }

    .welcome-stats {
        gap: .55rem;
        margin-bottom: .75rem;
    }

    .welcome-stats strong {
        font-size: 1.2rem;
    }

    .welcome-stats span {
        font-size: .72rem;
    }

    .quick-filter-pills {
        gap: .35rem;
        margin-bottom: .75rem;
    }

    .quick-filter-pills button {
        min-width: 4.75rem;
        min-height: 1.65rem;
        padding: .24rem .58rem;
        font-size: .72rem;
    }

    .suggestion-list {
        gap: .35rem;
    }

    .suggestion-list button {
        min-height: 2.05rem;
        padding: .42rem .58rem;
        border-radius: .48rem;
        font-size: .8rem;
    }

    .memory-chat-thread {
        padding: .7rem .85rem 1rem;
    }

    .memory-chat-thread .msg {
        max-width: min(46rem, 78%);
        margin-bottom: .58rem;
        padding: .58rem .72rem;
        border-radius: .82rem;
        font-size: .88rem;
    }

    .memory-chat-thread .msg.assistant {
        padding: .72rem .78rem .64rem;
    }

    .message-text {
        line-height: 1.34;
    }

    .source-panel {
        margin-top: .52rem;
        padding: .44rem .5rem;
    }

    .memory-chat-inputbar {
        padding: .55rem .75rem;
    }

    .chat-input-wrap {
        gap: .38rem;
    }

    .memory-chat-input {
        min-height: 2.35rem;
        max-height: 5.5rem;
        padding: .52rem .68rem;
        border-radius: .55rem;
        font-size: .86rem;
    }

    .image-chat-button,
    .voice-inline-button,
    .send-inline-button {
        min-width: 2.55rem;
        min-height: 2.35rem;
        border-radius: .55rem;
    }

    .image-chat-button,
    .voice-inline-button {
        padding: 0 .56rem;
    }

    .image-chat-button {
        min-width: 7.4rem;
    }

    .image-chat-button span,
    .voice-inline-button span {
        font-size: .72rem;
    }

    .send-inline-button {
        min-width: 3.35rem;
    }

    .selected-image-chip {
        margin-top: .35rem;
        padding-top: .25rem;
        padding-bottom: .25rem;
        font-size: .74rem;
    }

    .chat-input-meta {
        display: none;
    }

    .chat-working,
    .voice-status {
        margin-top: .35rem;
        padding: .42rem .58rem;
        font-size: .76rem;
    }
}

@media (min-width: 901px) {
    .connector-layout,
    .connector-left,
    .connector-right {
        gap: .9rem;
    }

    .connector-card {
        padding: 1rem;
    }

    .source-card {
        grid-template-columns: 2.55rem minmax(0, 1fr) auto;
        gap: .65rem;
        padding: .75rem;
    }

    .source-avatar {
        width: 2.1rem;
        height: 2.1rem;
    }

    .connector-table th,
    .connector-table td,
    .grid th,
    .grid td {
        padding: .55rem .5rem;
        font-size: .82rem;
    }

    .webhook-group summary {
        min-height: 2.45rem;
        padding: .5rem .72rem;
    }

    .webhook-details {
        padding: 0 .72rem .72rem;
    }

    .import-page {
        max-width: 72rem;
        padding: 0 .75rem 1rem;
    }

    .secure-import-banner {
        margin-bottom: .9rem;
        padding: .85rem 1rem;
    }

    .secure-lock {
        width: 2.55rem;
        min-height: 2.55rem;
    }

    .secure-badges span {
        min-height: 2rem;
        padding: .22rem .52rem;
        font-size: .68rem;
    }

    .import-config-card,
    .import-upload-card {
        padding: 1rem;
    }

    .import-config-grid {
        gap: .8rem 1rem;
    }

    .import-file-box {
        min-height: 4.5rem;
        padding: .75rem;
    }

    .import-action-row {
        gap: .65rem;
        margin-top: .8rem;
    }

    .secure-import-button {
        min-height: 2.65rem;
        font-size: .9rem;
    }
}

.secure-import-banner {
    grid-template-columns: 2.2rem minmax(0, 1fr) auto;
    gap: .65rem;
    margin-bottom: .65rem;
    padding: .55rem .75rem;
}

.secure-lock {
    width: 2rem;
    height: 2rem;
    min-height: 2rem;
    font-size: .92rem;
}

.secure-import-banner strong {
    margin-bottom: .05rem;
    font-size: .86rem;
}

.source-actions .outline-danger {
    color: #b42318;
    background: #fff;
    border: 1px solid #fecaca;
    box-shadow: none;
}

.source-actions .outline-danger:hover {
    color: #991b1b;
    background: #fff1f2;
}

.data-deletion-panel {
    display: grid;
    gap: 1rem;
}

.deletion-warning {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    gap: .75rem;
    align-items: center;
    padding: .85rem 1rem;
    border: 1px solid #fecaca;
    border-radius: .65rem;
    background: #fff7f7;
}

.deletion-warning i {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: .65rem;
    color: #b42318;
    background: #fee2e2;
    font-size: 1.15rem;
}

.deletion-warning strong,
.deletion-warning span {
    display: block;
}

.deletion-warning strong {
    color: #7f1d1d;
    font-size: .95rem;
}

.deletion-warning span {
    color: #6b7280;
    font-size: .82rem;
    line-height: 1.35;
}

.deletion-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
}

.deletion-grid .field {
    min-width: 0;
    max-width: none;
}

.deletion-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    padding: .75rem;
    border: 1px solid #e5eaf3;
    border-radius: .65rem;
    background: #fbfdff;
}

.deletion-actions .button {
    min-height: 2.3rem;
    padding: .5rem .75rem;
    font-size: .82rem;
}

.workspace-delete-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .8rem;
    align-items: end;
    padding: .85rem;
    border: 1px solid #fecaca;
    border-radius: .65rem;
    background: #fff;
}

.workspace-delete-box small {
    color: #9f1239;
    font-size: .74rem;
}

@media (max-width: 900px) {
    .deletion-grid,
    .workspace-delete-box {
        grid-template-columns: 1fr;
    }
}

.secure-import-banner span {
    font-size: .72rem;
    line-height: 1.2;
}

.secure-badges {
    gap: .3rem;
}

.secure-badges span {
    min-height: 1.55rem;
    padding: .14rem .42rem;
    font-size: .62rem;
}

.import-file-box {
    min-height: 3.2rem;
    padding: .58rem .7rem;
}

.import-file-box input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
