/* Message Space: shared visual system, loaded after page component styles. */
:root {
    --brand-primary: #284e43;
    --brand-dark: #1c3b32;
    --brand-deep: #172f29;
    --brand-soft: #eff5f1;
    --brand-highlight: #dce9df;
    --border: #e5e9e6;
    --surface: #f8faf8;
    --text: #202b26;
    --muted: #69766e;
    --shadow-soft: 0 6px 24px rgb(26 45 34 / 3%);
    --shadow-strong: 0 20px 64px rgb(26 45 34 / 6%);
}
body { background: #fff; color: var(--text); line-height: 1.65; -webkit-font-smoothing: antialiased; }
::selection { background: #dce9df; color: #172f29; }
h1, h2, h3, .panel-title, .simple-title { color: var(--text); letter-spacing: -.035em; }
h1 { font-size: clamp(26px, 2.7vw, 36px); font-weight: 600; }
h2 { font-weight: 600; }
.muted, small, .field-hint { color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .13em; color: var(--muted); }
.text-link, .panel-link, .back-link, .register-prompt a, .request-help-link { color: var(--brand-dark); }
:where(a, button, input, select, textarea):focus-visible { outline: 2px solid #527c67; outline-offset: 3px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand-primary); }
.skip-link { color: var(--brand-dark); border: 1px solid var(--border); border-radius: 8px; }

/* Workspace */
.portal-shell { grid-template-columns: 260px minmax(0, 1fr); background: var(--surface); }
.portal-sidebar { background: #fff; border-right: 1px solid var(--border); color: var(--text); }
.portal-sidebar__inner { padding: 32px 20px 24px; min-height: 100%; }
.portal-brand { gap: 11px; margin-bottom: 36px; }
.portal-brand__logo { width: 38px; height: 38px; }
.portal-brand__text { color: var(--text); font-size: 20px; font-weight: 700; letter-spacing: -.06em; }
.portal-create-btn { min-height: 46px; border-radius: 10px; background: var(--brand-primary); font-size: 12px; box-shadow: none; }
.portal-create-btn:hover { background: var(--brand-dark); box-shadow: none; }
.sidebar-section-label { margin: 30px 12px 12px; color: #78857c; font-size: 10px; font-weight: 600; letter-spacing: .14em; }
.portal-nav { margin-top: 0; gap: 6px; }
.portal-nav__item, .portal-nav__item--active, .portal-nav__item--selected { padding: 0; border: 0; background: transparent; box-shadow: none; }
.portal-nav__head { min-height: 46px; padding: 12px; border-radius: 10px; color: #66736b; font-size: 12px; font-weight: 500; gap: 12px; }
.portal-nav__head:hover, .portal-subnav__item:hover { color: var(--brand-dark); background: #f5f8f5; }
.portal-nav__item--active > .portal-nav__head, .portal-nav__item--selected > .portal-nav__head { background: #edf3ee; color: var(--brand-dark); font-weight: 700; }
.portal-nav__icon-wrap, .portal-nav__item--active .portal-nav__icon-wrap, .portal-nav__caret { color: inherit; }
.portal-nav__svg, .portal-nav__icon-wrap > svg { width: 20px; height: 20px; }
.portal-subnav { border-left-color: var(--border); }
.portal-subnav__item { border-radius: 8px; color: var(--muted); }
.portal-subnav__item--active, .portal-subnav__item--active:hover { background: var(--brand-primary); color: #fff; }
.sidebar-account { margin-top: 36px; padding: 16px; border-color: var(--border); background: #f8faf8; border-radius: 12px; color: var(--text); font-size: 12px; }
.sidebar-account small { color: var(--muted); line-height: 1.7; }
.sidebar-logout .button { min-height: 40px; font-size: 12px; }
.portal-topbar { min-height: 84px; padding: 18px 40px; background: #fff; border-bottom: 1px solid var(--border); box-shadow: none; }
.portal-topbar__spacer { color: #778179; font-size: 12px; font-weight: 400; }
.portal-topbar__context { color: var(--text); font-weight: 500; }
.portal-topbar__actions { gap: 16px; }
.portal-user { padding: 0; border: 0; background: transparent; color: var(--text); box-shadow: none; font-size: 12px; font-weight: 500; }
.portal-user:hover { transform: none; }
.portal-user__avatar { width: 34px; height: 34px; background: #edf3ee; color: var(--brand-dark); font-size: 12px; }
.portal-logout { min-height: 36px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #626e65; font-size: 11px; font-weight: 500; box-shadow: none; }
.portal-logout:hover { background: #f5f8f5; color: var(--brand-dark); border-color: #bacdbf; box-shadow: none; transform: none; }
.portal-content { max-width: 1500px; padding: 40px; }
.app-footer { padding: 20px 40px; margin-top: 16px; background: transparent; color: var(--muted); font-size: 11px; }
.page-heading { margin: 0 0 32px; gap: 20px; }
.page-heading .eyebrow { margin-bottom: 10px; color: #7a857d; font-size: 10px; }
.page-heading p { font-size: 13px; line-height: 1.8; }
.date-label { padding: 9px 14px; border-radius: 8px; color: var(--muted); }

/* Cards, actions, and tabular content */
.card, .wa-builder .template-builder-card, .wa-builder .template-builder-preview__card, .report-chart { background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-soft); }
.card { padding: 26px; }
.table-card { padding: 0; }
.user-create-card { max-width: 640px; }
.wallet-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }
.wallet-value { display: block; margin: 12px 0; color: var(--text); font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em; overflow-wrap: anywhere; }
.wallet-value small { font-size: 13px; letter-spacing: 0; font-weight: 400; }
.wallet-form .button { margin-top: 22px; }
.wallet-credit { color: #237848; font-weight: 600; }
.wallet-ledger { min-width: 640px; }
.wallet-ledger :is(td:nth-child(3), td:nth-child(4)) { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .wallet-summary { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.stats { gap: 20px; margin-bottom: 28px; }
.stat-card { position: relative; overflow: hidden; border-top: 1px solid var(--border); }
.stat-card::after { content: ''; position: absolute; right: 24px; top: 26px; width: 7px; height: 7px; border-radius: 50%; background: #9bb9a3; }
.stat-heading { padding-right: 18px; font-size: 12px; font-weight: 500; color: var(--muted); }
.stat { margin: 16px 0 10px; color: var(--text); font-size: 38px; font-weight: 600; letter-spacing: -.06em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-card small { font-size: 11px; color: var(--muted); }
.stat-icon { background: var(--brand-soft); color: var(--brand-dark); border-radius: 10px; }
.stat-card:has(.stat-icon)::after { display: none; }
.button, .submit-btn { min-height: 44px; border-radius: 9px; padding: 11px 18px; border: 1px solid transparent; background: var(--brand-primary); color: #fff; font-size: 12px; font-weight: 600; box-shadow: none; transition: background-color .15s ease, border-color .15s ease; }
.button:hover, .submit-btn:hover { background: var(--brand-dark); box-shadow: none; transform: none; }
.button.secondary { border-color: var(--border); background: #fff; color: #536158; }
.button.secondary:hover { background: #f5f8f5; border-color: #bbcdc0; color: var(--brand-dark); }
.button.small { border-radius: 8px; font-size: 11px; }
.account-banner { padding: 28px; background: #eef4ef; border: 1px solid #e0e9e1; border-radius: 16px; }
.account-banner h2 { font-size: 20px; }
.account-banner p { max-width: 600px; color: #647368; line-height: 1.8; }
.dashboard-welcome { margin-bottom: 28px; }
.banner-eyebrow { display: block; margin-bottom: 8px; color: #587362; font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.section-label { margin-bottom: 18px; }
.section-label h2 { font-size: 17px; }
.section-label > span, .section-heading .eyebrow { font-size: 10px; color: var(--muted); }
.section-heading { padding: 26px; }
.text-link { font-size: 12px; font-weight: 600; }
.dashboard-status-grid { gap: 24px; }
.dashboard-status-list > div { padding: 17px 0; }
.dashboard-status-list dd { font-size: 18px; font-weight: 600; color: var(--text); }
.dashboard-status-total { margin-top: 10px; }
.dashboard-status-total dt { color: var(--text); }
.dashboard-description, .dashboard-status-list dt { color: var(--muted); font-size: 12px; }
.note { font-size: 11px; line-height: 1.8; }
th { background: #f8faf8; color: #78837a; padding: 14px 24px; border-color: var(--border); font-size: 10px; font-weight: 600; letter-spacing: .04em; }
td { padding: 20px 24px; border-color: #edf0ed; font-size: 12px; }
tbody tr:hover, .report-table tbody tr:hover { background: #fafcf9; }
.avatar { background: #eff4ef; color: var(--brand-dark); border-radius: 12px; }
.badge, .report-status, .campaign-status { border-radius: 6px; font-size: 10px; }
.badge.admin { background: #edf3ee; color: var(--brand-dark); border-color: #dce7de; }
.badge.user { background: #f3f7f3; color: #3c6b4b; border-color: #dce7de; }
.search-form { padding: 24px; gap: 10px; }
:is(.search-form input, .role-form select, .wa-filters select, .report-filters input, .report-filters select, .text-input, .wa-recipients, .template-builder-field input, .template-builder-field select) { border: 1px solid #dce3dc; border-radius: 9px; background: #fff; color: var(--text); box-shadow: none; }
:is(.text-input, .template-builder-field input, .template-builder-field select):focus { border-color: #779883; box-shadow: 0 0 0 3px rgb(82 124 103 / 9%); }
input::placeholder, textarea::placeholder { color: #8b958e; }
.pagination { padding: 20px 24px; color: var(--muted); }
.empty, .wa-empty { padding: 56px 24px; color: var(--muted); }
.wa-empty > span { background: var(--brand-soft); color: var(--brand-primary); border-radius: 16px; }

/* Authentication */
.auth-shell { width: 100%; max-width: 1400px; min-height: 100dvh; padding: 40px; }
.auth-frame { min-width: 0; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); min-height: 720px; border: 1px solid var(--border); border-radius: 24px; background: #fff; box-shadow: var(--shadow-strong); }
.auth-frame > *, .auth-hero-inner, .panel-card { min-width: 0; }
.auth-hero { padding: 48px; background: #f2f6f1; color: var(--text); border-right: 1px solid var(--border); }
.auth-hero::before, .auth-hero::after { display: none; }
.auth-hero-inner { gap: 36px; }
.brand-lockup { gap: 12px; flex-direction: row; align-items: center; }
.auth-hero .brand-logo { width: 40px; height: 40px; border-radius: 0; box-shadow: none; }
.auth-hero .brand-subtitle { color: var(--text); font-size: 22px; letter-spacing: -.055em; font-weight: 700; }
.auth-hero .hero-copy { margin-top: 64px; }
.auth-hero .eyebrow { color: #5f7866; font-size: 10px; letter-spacing: .14em; margin-bottom: 18px; }
.auth-title { max-width: 470px; color: var(--text); font-size: clamp(32px, 3.3vw, 46px); font-weight: 500; line-height: 1.2; letter-spacing: -.055em; }
.auth-description { max-width: 390px; margin: 22px 0 0; color: var(--muted); font-size: 13px; line-height: 1.9; }
.hero-footer p, .hero-footer span { color: var(--muted); font-size: 11px; line-height: 1.8; }
.hero-footer span { display: block; margin-top: 12px; }
.auth-panel { display: flex; align-items: center; padding: 56px; background: #fff; }
.panel-card { width: 100%; max-width: 380px; margin: 0 auto; padding: 0; box-shadow: none; background: transparent; border: 0; }
.panel-topbar { margin: 0 0 40px; gap: 6px; font-size: 11px; }
.panel-register { color: var(--muted); font-size: 11px; }
.panel-link { font-size: 11px; font-weight: 600; }
.panel-title { margin: 0 0 12px; font-size: 28px; font-weight: 600; }
.panel-copy, .simple-copy { color: var(--muted); font-size: 12px; line-height: 1.9; }
.field-group { margin-top: 22px; }
.field-label { margin-bottom: 8px; font-size: 12px; font-weight: 500; color: #46534a; }
.text-input { min-height: 48px; padding: 12px 14px; font-size: 13px; }
.checkbox-label { color: var(--muted); font-size: 12px; }
.submit-btn { width: 100%; margin-top: 24px; min-height: 48px; }
.register-prompt { font-size: 11px; color: var(--muted); margin-top: 24px; }
.auth-simple-shell { min-height: 100dvh; padding: 48px 20px; background: #f8faf8; }
.auth-simple-card { width: 100%; max-width: 560px; padding: 40px; border: 1px solid var(--border); border-radius: 20px; background: #fff; box-shadow: var(--shadow-soft); }
.simple-title { font-size: 27px; font-weight: 600; }
.back-link { font-size: 12px; }
.register-brand { margin-top: 28px; }
.field-hint { font-size: 11px; }
.auth-message { margin-top: 32px; padding: 22px; max-width: 360px; border: 1px solid #dfe8de; border-radius: 16px; background: #fff; box-shadow: 0 12px 32px rgb(45 70 48 / 4%); }
.auth-message__label { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: #7a877c; font-size: 10px; letter-spacing: .08em; }
.auth-message__bubble { padding: 16px; border-radius: 2px 12px 12px; background: #f2f6f0; }
.auth-message__bubble strong { font-size: 12px; font-weight: 600; }
.auth-message__bubble p { margin: 8px 0 0; font-size: 11px; color: #637066; line-height: 1.9; }
.auth-message__foot { display: block; margin-top: 14px; text-align: right; font-size: 10px; color: var(--muted); }

/* Compose, review, reports, and onboarding */
.wa-page-heading { margin-top: 0; }
.wa-steps { padding: 20px 24px; border-radius: 12px; border-color: var(--border); gap: 32px; }
.wa-steps .is-complete > span { background: #edf3ee; color: var(--brand-dark); }
.wa-builder .template-builder-card, .wa-builder .template-builder-preview__card { padding: 26px; }
.wa-builder .template-builder-editor { border-color: var(--border); border-radius: 10px; }
.wa-builder .wa-visual-editor { position: relative; padding-bottom: 32px; }
.wa-message-editor { min-height: 210px; max-height: 520px; overflow-y: auto; padding: 18px; color: var(--text); font-size: 14px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-message-editor:focus { outline: none; }
.wa-visual-editor:focus-within { border-color: #779883; box-shadow: 0 0 0 3px rgb(82 124 103 / 9%); }
.wa-message-editor[aria-invalid="true"] { box-shadow: inset 0 0 0 1px #be123c; }
.wa-message-editor:empty::before, .wa-message-editor:has(> div:only-child > br:only-child)::before { content: attr(data-placeholder); color: #8b958e; pointer-events: none; }
.wa-builder .wa-visual-editor .template-builder-editor__count { right: 16px; bottom: 10px; }
.wa-builder .wa-visual-editor .template-builder-editor__toolbar { border-bottom: 1px solid var(--border); gap: 6px; }
.wa-builder .template-builder-editor__toolbar button[aria-pressed="true"] { color: var(--brand-dark); background: #dfece2; box-shadow: inset 0 0 0 1px #b8cdbd; }
.wa-builder .template-builder-editor__toolbar [data-insert-variable] { padding-inline: 10px; font-size: 12px; font-family: monospace; }
.wa-editor-divider { height: 20px; width: 1px; background: var(--border); margin-inline: 3px; }
.wa-emoji-picker { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; padding: 12px; background: #f8faf8; border-bottom: 1px solid var(--border); }
.wa-emoji-picker button { min-width: 0; min-height: 38px; border: 0; border-radius: 8px; background: transparent; font-size: 23px; }
.wa-emoji-picker button:hover { background: #e4eee5; }
.wa-editor-error { margin: 0; font-size: 12px; color: #be123c; }
.template-builder-editor__count.is-over-limit { color: #be123c; font-weight: 700; }
:is(.wa-message-editor, .template-builder-phone__body) :is(ul, ol) { margin: 0; padding-left: 24px; }
:is(.wa-message-editor, .template-builder-phone__body) li { padding-left: 2px; }
:is(.wa-message-editor, .template-builder-phone__body) code { background: #edf1eb; border-radius: 3px; padding: 1px 3px; font-family: ui-monospace, Consolas, monospace; font-size: .95em; }
@media (max-width: 600px) {
    .wa-message-editor { font-size: 16px; padding: 14px; }
    .wa-emoji-picker { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .wa-builder .wa-visual-editor .template-builder-editor__toolbar button { min-width: 36px; min-height: 36px; }
}
.wa-builder .template-builder-editor__toolbar { background: #f8faf8; }
.wa-builder .template-builder-editor__toolbar button:hover { background: var(--brand-soft); color: var(--brand-dark); }
.wa-builder .template-builder-button-card, .wa-builder .wa-upload { border-radius: 10px; border-color: #dce3dc; background: #f8faf8; }
.wa-builder .template-builder-tip { background: #f1f6f0; border-left-color: #8ba98e; border-radius: 0 8px 8px 0; }
.wa-builder .template-builder-add-button { border-color: #dce3dc; border-radius: 8px; }
.wa-preview-account { background: #315b4c; margin: 20px -26px 0; }
.wa-builder .template-builder-phone { margin-inline: -26px; background-color: #eef1e9; background-image: radial-gradient(#dce3d8 .7px, transparent .7px); }
.wa-info { border-color: var(--border); background: #f5f8f4; border-radius: 10px; color: #5f6f63; }
.wa-summary-count { color: var(--text); }
.report-chart { padding: 28px; }
.report-filters { background: #f8faf8; border-color: var(--border); }
.report-table { border-radius: 16px; }
.report-chart-heading h2, .report-chart-highlight strong, .report-legend strong { color: var(--text); }
.report-excel { background: var(--brand-primary); border-color: var(--brand-primary); }
.report-excel:hover { background: var(--brand-dark); }
.request-intro { border: 1px solid var(--border); color: var(--text); border-radius: 20px; box-shadow: 0 24px 80px rgb(24 46 32 / 16%); }
.request-intro::backdrop { background: rgb(24 38 28 / 35%); }
.request-intro__eyebrow { background: var(--brand-soft); color: var(--brand-dark); }
.request-intro__steps li::before { background: var(--brand-soft); color: var(--brand-dark); }
.request-intro .request-intro__note { background: #f5f8f4; }
.request-queue__link { color: inherit; }
.request-queue__link:hover { border-color: #b9cfbf; box-shadow: var(--shadow-soft); transform: translateY(-2px); }

@media (max-width: 1200px) {
    .portal-content { padding: 32px; }
    .portal-topbar { padding-inline: 32px; }
    .auth-shell { padding: 24px; }
    .auth-hero, .auth-panel { padding: 36px; }
}
@media (max-width: 1080px) {
    .portal-shell { grid-template-columns: minmax(0, 1fr); }
    .portal-sidebar { width: min(300px, 86vw); }
    .portal-burger { border: 1px solid var(--border); background: #f8faf8; border-radius: 8px; }
    .portal-burger span { background: var(--text); }
    .portal-sidebar__close { background: #f1f5f0; border-radius: 8px; }
    .portal-sidebar__close span { background: var(--text); }
}
@media (max-width: 720px) {
    .portal-topbar { min-height: 70px; padding: 14px 20px; gap: 12px; }
    .portal-content { padding: 28px 20px; }
    .portal-topbar__spacer { font-size: 12px; color: var(--text); }
    .portal-topbar__actions { gap: 8px; }
    .portal-user { padding: 0; }
    .portal-user__avatar { width: 30px; height: 30px; }
    .portal-user__name { display: none; }
    .app-footer { padding: 20px; gap: 12px; }
    .page-heading { margin-bottom: 24px; }
    .account-banner { padding: 24px; gap: 20px; }
    .account-banner .button { width: 100%; }
    .card { padding: 22px; }
    .table-card { padding: 0; }
    .stat-card { padding: 20px; }
    .stat-card::after { right: 16px; top: 22px; }
    .stat { font-size: 30px; }
    .dashboard-status-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .section-label { gap: 12px; flex-wrap: wrap; }
    .section-label h2 { font-size: 16px; }
    .auth-shell { padding: 20px 16px; }
    .auth-frame { grid-template-columns: minmax(0, 1fr); min-height: auto; border-radius: 18px; }
    .auth-hero { padding: 28px; border-right: 0; border-bottom: 1px solid var(--border); }
    .auth-hero .hero-copy { margin-top: 28px; }
    .auth-title { max-width: 430px; font-size: 32px; }
    .auth-description { margin-top: 14px; font-size: 12px; }
    .auth-message, .hero-footer { display: none; }
    .auth-panel { padding: 32px 28px; }
    .panel-topbar { margin-bottom: 28px; }
    .panel-title { font-size: 26px; }
    .auth-simple-card { padding: 28px 24px; }
    .simple-title { font-size: 25px; }
    .wa-steps { padding: 16px; gap: 16px; }
    .report-chart { padding: 22px; }
    .wa-builder .template-builder-card { padding: 22px; }
    .text-input, .search-form input, .wa-filters select, .report-filters input, .report-filters select { font-size: 16px; }
}
@media (max-width: 480px) {
    .stats { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .stat-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .stat-card::after { display: none; }
    .stat { grid-column: 2; grid-row: 1 / 3; align-self: center; margin: 0; }
    .page-heading h1 { font-size: 26px; }
    .app-footer { flex-wrap: wrap; }
    .auth-title { font-size: 28px; }
}
