:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #18233b;
    background: #f3f6fb;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 2rem;
}

.welcome-card {
    width: min(100%, 42rem);
    padding: clamp(2rem, 6vw, 4rem);
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 1.5rem 4rem #24365a12;
}

.eyebrow { color: #4968d8; font-size: .8rem; font-weight: 750; letter-spacing: .18em; }
h1 { max-width: 11ch; margin: 1rem 0; font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1.05; }
p { color: #536079; line-height: 1.7; }
nav { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
a { color: #3153c8; font-weight: 650; }
a:focus-visible { outline: 3px solid #90a4ff; outline-offset: 3px; }

.auth-card { width: min(100%, 46rem); }
form { display: grid; gap: 1rem; margin-top: 1.5rem; }
label { display: grid; gap: .4rem; color: #25324a; font-size: .92rem; font-weight: 650; }
input { width: 100%; min-height: 2.8rem; padding: .65rem .75rem; border: 1px solid #cbd5e1; border-radius: .55rem; color: #18233b; font: inherit; }
.password-control { display: flex; width: 100%; }
.password-control input { min-width: 0; border-radius: .55rem 0 0 .55rem; }
.password-toggle { display: grid; flex: 0 0 2.9rem; min-height: 2.8rem; place-items: center; padding: .55rem; border: 1px solid #cbd5e1; border-left: 0; border-radius: 0 .55rem .55rem 0; color: #536079; background: #f8fafc; }
.password-toggle:hover { color: #3153c8; background: #eef2ff; }
.password-toggle svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-eye-slash { display: none; }
.password-toggle.is-visible .password-eye-slash { display: block; }
input:focus-visible, button:focus-visible { outline: 3px solid #90a4ff; outline-offset: 2px; }
button { min-height: 2.8rem; border: 0; border-radius: .55rem; padding: .7rem 1rem; color: #fff; background: #3153c8; font: inherit; font-weight: 700; cursor: pointer; }
button.secondary { color: #25324a; background: #e8edf5; }
.notice { padding: .8rem 1rem; border-radius: .6rem; color: #1b4d36; background: #e8f6ed; }
.notice.error { color: #8b1d24; background: #fff0f0; }
.organization-choice { grid-template-columns: 1fr auto; align-items: center; padding: 1rem; border: 1px solid #e2e8f0; border-radius: .7rem; }
dl { display: grid; grid-template-columns: minmax(8rem, .4fr) 1fr; gap: .8rem 1.2rem; }
dt { color: #536079; } dd { margin: 0; font-weight: 650; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .8rem; }
.plans article { padding: .9rem; border: 1px solid #e2e8f0; border-radius: .7rem; }
.plans h2 { margin-top: .3rem; font-size: 1.1rem; }
.member-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: .8rem 0; padding: 1rem; border: 1px solid #e2e8f0; border-radius: .7rem; }
.member-row form { margin: 0; }
.crm-record-actions { width: min(100%, 22rem); }
.crm-record-actions summary { color: #3153c8; cursor: pointer; font-weight: 650; }
.crm-tag { display: inline-block; margin: .25rem .25rem 0 0; padding: .15rem .5rem; border: 1px solid var(--tag-color, #526581); border-radius: 999px; color: #25324a; font-size: .78rem; }
.crm-record-actions label:has(input[type="checkbox"]) { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: .55rem; }
.crm-record-actions input[type="checkbox"] { width: auto; min-height: auto; }
.crm-activity-row { display: grid; gap: .25rem; margin: .8rem 0; padding: .75rem; border-left: 3px solid #a9b7d1; background: #f6f8fb; }
.crm-activity-row > span { color: #536079; font-size: .86rem; }
.crm-activity-row form { margin: .3rem 0 0; }
.crm-archive-form { display: grid; gap: .5rem; margin: .5rem 0 0; }
.crm-confirm-archive { display: flex; grid-template-columns: auto 1fr; align-items: center; }
.crm-confirm-archive input { width: auto; min-height: auto; }
select { width: 100%; min-height: 2.8rem; padding: .65rem .75rem; border: 1px solid #cbd5e1; border-radius: .55rem; color: #18233b; background: #fff; font: inherit; }
@media (max-width: 36rem) { body { padding: 1rem; } .organization-choice { grid-template-columns: 1fr; } }
.global-card {
    width: min(1180px, calc(100% - 2rem));
    max-width: none;
    text-align: left;
}

.global-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.global-header h1 { margin: 0; }
.global-header nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.global-header nav form { margin: 0; }
.global-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.global-metrics article, .plans article { padding: 1rem; border: 1px solid #d7dee8; border-radius: 12px; background: #fff; }
.global-metrics article { display: grid; gap: .5rem; }
.global-metrics strong { font-size: 1.8rem; }
.usage-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.usage-panel h2 { grid-column: 1 / -1; margin-bottom: 0; }
.usage-panel article { padding: 1rem; border: 1px solid #d7dee8; border-radius: 12px; background: #fff; }
.usage-panel article h3 { margin-top: 0; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table-wrap th, .table-wrap td { padding: .75rem; border-bottom: 1px solid #d7dee8; text-align: left; vertical-align: top; }
.inline-form { display: flex; align-items: center; gap: .5rem; min-width: 250px; }
.inline-form input { min-width: 120px; }
.plans article form { margin-top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.entitlement-fields { display: grid; gap: .6rem; margin: .75rem 0; border: 1px solid #d7dee8; border-radius: 8px; }
.entitlement-fields > div { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; }
.check-label { display: flex; align-items: center; gap: .4rem; }
.check-label input { width: auto; }
.onboarding-card { width: min(100%, 52rem); }
.onboarding-progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; padding: 0; list-style: none; counter-reset: onboarding; }
.onboarding-progress li { padding: .75rem; border-bottom: 3px solid #cbd5e1; color: #536079; counter-increment: onboarding; }
.onboarding-progress li::before { content: counter(onboarding) ". "; font-weight: 750; }
.onboarding-progress li.current { border-color: #3153c8; color: #18233b; font-weight: 750; }
.onboarding-progress li.done { border-color: #258458; }
.business-day { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: .75rem; margin: .75rem 0; border: 1px solid #d7dee8; border-radius: .7rem; }
.business-day legend { padding: 0 .4rem; font-weight: 700; }
.organization-logo { width: auto; max-width: 12rem; max-height: 8rem; object-fit: contain; }
input[type="file"] { min-height: auto; }
.inbox-page { width: min(1440px, calc(100% - 2rem)); }
.inbox-layout { display: grid; grid-template-columns: minmax(17rem, .8fr) minmax(0, 1.8fr); gap: 1rem; margin-top: 1.5rem; min-height: 34rem; }
.inbox-list, .inbox-thread { min-width: 0; border: 1px solid #d7dee8; border-radius: .85rem; background: #fff; }
.inbox-list { overflow: hidden; }
.inbox-filters { padding: .9rem; margin: 0; border-bottom: 1px solid #e2e8f0; }
.conversation-list { display: grid; gap: .35rem; margin: 0; padding: .5rem; list-style: none; }
.conversation-card { display: grid; gap: .35rem; padding: .8rem; border-radius: .65rem; color: inherit; text-decoration: none; }
.conversation-card:hover, .conversation-card.selected { background: #eef2ff; }
.conversation-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.conversation-channel, .conversation-preview { color: #536079; font-size: .85rem; }
.conversation-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-count { display: inline-grid; min-width: 1.45rem; height: 1.45rem; place-items: center; border-radius: 999px; color: #fff; background: #3153c8; font-size: .78rem; }
.inbox-empty, .inbox-empty-state { padding: 1.5rem; color: #536079; text-align: center; }
.inbox-empty-state { display: grid; align-content: center; min-height: 100%; }
.inbox-empty-state h2 { margin-bottom: 0; color: #18233b; }
.inbox-thread { display: flex; flex-direction: column; overflow: hidden; }
.thread-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid #e2e8f0; }
.thread-header h2 { margin: .2rem 0 .5rem; }
.thread-meta { display: grid; justify-items: end; gap: .5rem; color: #536079; font-size: .85rem; }
.status-badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; background: #e8edf5; font-weight: 700; }
.channel-settings-page { max-width: 68rem; }
.channel-settings-page .onboarding-step { margin-top: 1.25rem; padding: 1.25rem; border: 1px solid #d7dee8; border-radius: .85rem; background: #fff; }
.channel-settings-page .onboarding-step h2 { margin-top: 0; }
.channel-settings-page .muted { display: block; margin-top: .35rem; color: #536079; font-size: .9rem; }
.channel-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.channel-row > div:first-child { display: grid; gap: .25rem; }
.channel-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.channel-actions form { margin: 0; }
.message-timeline { display: flex; flex: 1; flex-direction: column; align-items: stretch; gap: .75rem; overflow-y: auto; max-height: 55vh; padding: 1.25rem; background: #f8fafc; }
.message-history-nav { display: flex; justify-content: space-between; gap: .75rem; padding: .5rem 1.25rem; border-top: 1px solid #e2e8f0; background: #fff; }
.inbox-sla-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.inbox-sla-summary article { display: grid; gap: .2rem; padding: .8rem 1rem; border: 1px solid #d7dee8; border-radius: .7rem; background: #fff; }
.inbox-sla-summary strong { color: #16324f; font-size: 1.5rem; }
.inbox-sla-summary small { color: #536079; }
.inbox-sla-summary > p { grid-column: 1 / -1; margin: 0; }
.sla-escalation-card { border-color: #d99191 !important; background: #fff7f7 !important; }
.sla-report-filter { margin: 1rem 0; }
.sla-report-filter fieldset { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; padding: 1rem; border: 1px solid #d7dee8; border-radius: .7rem; }
.sla-report-filter label { display: grid; gap: .3rem; }
.sla-report-filter input { min-height: 2.5rem; padding: .4rem .6rem; border: 1px solid #aeb9c8; border-radius: .35rem; font: inherit; }
.sla-report-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sla-report-cards.usage-reconciliation-cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.sla-report-table { margin-top: 1.25rem; }
.sla-report-table table { min-width: 58rem; }
.business-exceptions { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid #d7dee8; }
.business-exceptions > p { color: #536079; }
.business-exception-list { display: grid; gap: .6rem; padding: 0; list-style: none; }
.business-exception-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem; border: 1px solid #d7dee8; border-radius: .6rem; background: #fff; }
.business-exception-list form { margin: 0; }
.business-exception-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; padding: 1rem; border: 1px solid #d7dee8; border-radius: .75rem; background: #f8fafc; }
@media (max-width: 42rem) { .business-exception-form { grid-template-columns: 1fr; } .business-exception-list li { align-items: flex-start; flex-direction: column; } }
.message-bubble { max-width: min(90%, 42rem); padding: .75rem .9rem; border: 1px solid #e2e8f0; border-radius: .8rem; background: #fff; }
.message-bubble.outbound { align-self: end; border-color: #c8d2fc; background: #eef2ff; }
.message-bubble.internal { align-self: center; width: min(96%, 42rem); border-style: dashed; background: #fff9e8; }
.message-bubble p { margin: .2rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem; color: #536079; font-size: .78rem; }
.message-content { color: #18233b; }
.message-bubble audio, .message-bubble video { display: block; max-width: min(100%, 32rem); margin-top: .5rem; }
.password-strength { margin: -.3rem 0 1rem; padding: .8rem; border: 1px solid #d7dee8; border-radius: .65rem; background: #f8fafc; }
.password-strength-track { height: .45rem; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.password-strength-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #dc2626; transition: width .18s ease, background-color .18s ease; }
.password-strength[data-strength="medium"] .password-strength-track span { background: #d97706; }
.password-strength[data-strength="strong"] .password-strength-track span { background: #15803d; }
.password-strength p { min-height: 1.2em; margin: .35rem 0; color: #536079; font-size: .82rem; }
.password-strength ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .3rem .8rem; margin: .25rem 0 0; padding: 0; list-style: none; }
.password-strength li { color: #64748b; font-size: .83rem; }
.password-strength li::before { content: attr(data-icon) " "; color: #b91c1c; font-weight: 700; }
.password-strength li.is-valid { color: #166534; }
.password-strength li.is-valid::before { color: #15803d; }
.phone-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin: .75rem 0 1rem; padding: .85rem; border: 1px solid #d7dee8; border-radius: .65rem; }
.phone-fields legend { padding: 0 .3rem; font-weight: 600; }
.phone-fields label { margin: 0; }
.phone-fields small { grid-column: 1 / -1; color: #b91c1c; }
@media (max-width: 42rem) { .phone-fields { grid-template-columns: 1fr; } }
.message-media-image { display: block; max-width: min(100%, 28rem); max-height: 24rem; object-fit: contain; border-radius: .5rem; }
.note-form, .status-form, .assignment-form { margin: 0; padding: 1rem 1.25rem; border-top: 1px solid #e2e8f0; }
.note-form textarea { width: 100%; min-height: 5rem; padding: .65rem .75rem; border: 1px solid #cbd5e1; border-radius: .55rem; color: #18233b; font: inherit; resize: vertical; }
.status-form { grid-template-columns: minmax(10rem, 1fr) auto; align-items: end; }
.assignment-form { grid-template-columns: minmax(10rem, 1fr) auto; align-items: end; background: #fff; }
@media (max-width: 52rem) { .inbox-layout { grid-template-columns: 1fr; } .inbox-list { max-height: 20rem; overflow-y: auto; } .message-timeline { max-height: 45vh; } .inbox-sla-summary, .sla-report-cards { grid-template-columns: 1fr; } }
