:root {
    --ink: #101d13;
    --muted: #586b5e;
    --green: #087f23;
    --green-dark: #05631a;
    --green-soft: #e8f6e8;
    --cream: #f5f9f3;
    --line: #d4e2d5;
}

body { background: linear-gradient(145deg, #eef8ed, #fbfcf8); }
.brand, .button, .sidebar a, .pending-list a, .pagination a, a.nav-link { text-decoration: none; }
main :where(p, li, dd, td, .notice, .muted, .meta) a:not(.button) { color: var(--green-dark); font-weight: 700; text-decoration: none; }
.topbar { padding-block: 10px; box-shadow: 0 2px 16px #0066000d; }
.brand-logo { width: 52px; height: 52px; object-fit: contain; }
.brand-mark { background: var(--green); box-shadow: inset 0 -4px 0 var(--green-dark); }
.sidebar a:hover, .sidebar a.active { background: var(--green-soft); color: var(--green-dark); }
.data-table th { background: #f3f8f2; }
.form-stack :where(input, select, textarea):focus { border-color: var(--green); outline-color: var(--focus-ring); }
.button.primary { box-shadow: 0 8px 18px #00880020; }
.button.primary:focus-visible, a:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* Semantic workflow states shared across modules. `:is()` intentionally gives
   these rules enough specificity to replace legacy `badge active/inactive`
   classes after the status text has been normalized by ui-foundation.js. */
:is(.badge, .status, .status-badge).draft,
:is(.badge, .status, .status-badge).status-draft,
:is(.badge, .status, .status-badge).not-started,
:is(.badge, .status, .status-badge).not_started,
:is(.badge, .status, .status-badge).inactive,
:is(.badge, .status, .status-badge).status-inactive { border-color:#d2d8d4; background:#eef1ef; color:#46534b; }

:is(.badge, .status, .status-badge).pending,
:is(.badge, .status, .status-badge).status-pending,
:is(.badge, .status, .status-badge).review,
:is(.badge, .status, .status-badge).reviewed,
:is(.badge, .status, .status-badge).status-reviewed,
:is(.badge, .status, .status-badge).status-verified,
:is(.badge, .status, .status-badge).awaiting-approval,
:is(.badge, .status, .status-badge).awaiting_approval,
:is(.badge, .status, .status-badge).on-hold,
:is(.badge, .status, .status-badge).on_hold { border-color:#ead38a; background:#fff5ce; color:#765000; }

:is(.badge, .status, .status-badge).submitted,
:is(.badge, .status, .status-badge).status-submitted,
:is(.badge, .status, .status-badge).in-progress,
:is(.badge, .status, .status-badge).in_progress,
:is(.badge, .status, .status-badge).status-in_progress,
:is(.badge, .status, .status-badge).processing,
:is(.badge, .status, .status-badge).partially-delivered,
:is(.badge, .status, .status-badge).partially_delivered,
:is(.badge, .status, .status-badge).status-partially_delivered,
:is(.badge, .status, .status-badge).scheduled { border-color:#b9d3f2; background:#e9f3ff; color:#174f91; }

:is(.badge, .status, .status-badge).active,
:is(.badge, .status, .status-badge).status-active,
:is(.badge, .status, .status-badge).approved,
:is(.badge, .status, .status-badge).status-approved,
:is(.badge, .status, .status-badge).status-approved-for-payment,
:is(.badge, .status, .status-badge).status-batched,
:is(.badge, .status, .status-badge).status-paid,
:is(.badge, .status, .status-badge).status-reconciled,
:is(.badge, .status, .status-badge).completed,
:is(.badge, .status, .status-badge).status-completed,
:is(.badge, .status, .status-badge).sent,
:is(.badge, .status, .status-badge).status-sent,
:is(.badge, .status, .status-badge).published,
:is(.badge, .status, .status-badge).accepted,
:is(.badge, .status, .status-badge).status-accepted { border-color:#b9dfc8; background:#e2f5e9; color:#135936; }

:is(.badge, .status, .status-badge).failed,
:is(.badge, .status, .status-badge).status-failed,
:is(.badge, .status, .status-badge).rejected,
:is(.badge, .status, .status-badge).status-rejected,
:is(.badge, .status, .status-badge).overdue,
:is(.badge, .status, .status-badge).status-overdue,
:is(.badge, .status, .status-badge).returned,
:is(.badge, .status, .status-badge).status-returned,
:is(.badge, .status, .status-badge).suspended,
:is(.badge, .status, .status-badge).status-suspended,
:is(.badge, .status, .status-badge).cancelled,
:is(.badge, .status, .status-badge).closed,
:is(.badge, .status, .status-badge).error { border-color:#edc6ca; background:#f9e9eb; color:#84252f; }

:is(.badge, .status, .status-badge).restricted,
:is(.badge, .status, .status-badge).status-restricted,
:is(.badge, .status, .status-badge).confidential,
:is(.badge, .status, .status-badge).private { border-color:#d7c5ed; background:#f2ebfb; color:#5e3290; }

:where(.status-badge) { border-color:#d2d8d4; background:#eef1ef; color:#46534b; }

.chat-layout { display:grid; grid-template-columns:minmax(0,2fr) minmax(260px,1fr); gap:20px; }
.chat-conversation { display:grid; gap:4px; padding:14px 4px; border-bottom:1px solid var(--line); color:var(--ink); }
.chat-conversation span { color:var(--muted); font-size:.88rem; }
.chat-panel { padding-bottom:16px; }
#chat-stream { height:min(58vh,620px); overflow-y:auto; display:flex; flex-direction:column; gap:10px; padding:8px; }
.chat-message { align-self:flex-start; max-width:min(78%,620px); background:#f0f3f0; border-radius:4px 16px 16px; padding:10px 14px; }
.chat-message.mine { align-self:flex-end; background:var(--green-soft); border-radius:16px 4px 16px 16px; }
.chat-message p { margin:4px 0; white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-message span { color:var(--muted); font-size:.72rem; }
.chat-compose { display:grid; grid-template-columns:1fr auto; gap:10px; margin-top:14px; }
.chat-compose textarea { border:1px solid var(--line); border-radius:12px; padding:12px; resize:none; }
@media(max-width:1024px){.chat-layout{grid-template-columns:1fr}.chat-message{max-width:88%}#chat-stream{height:52vh}.chat-compose{grid-template-columns:1fr}.chat-compose .button{width:100%}}
.sms-metrics{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}.sms-metrics .panel{margin:0;padding:18px}.sms-metrics strong{display:block;font-size:1.65rem;margin-top:6px}.sms-filter select,.sms-filter input{min-height:44px;border:1px solid var(--line);border-radius:9px;padding:8px;background:#fff}@media(max-width:1024px){.sms-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.sms-filter{display:grid;grid-template-columns:1fr}}
/* Phase C secure form collection */
.public-form-shell{max-width:760px;margin:2rem auto}.public-form-shell .panel{padding:clamp(1.25rem,4vw,2.5rem)}.honeypot{position:absolute!important;left:-10000px!important;width:1px!important;height:1px!important;opacity:0!important}.consent-box{align-items:flex-start;padding:1rem;border:1px solid var(--border,#d9e2d9);border-radius:12px;background:#f7fbf7}.consent-box input{margin-top:.25rem}.status.published{color:#056b34}.status.review{color:#7a5200}.status.closed,.status.rejected{color:#9b2525}
/* Correspondence Phase L1 preview */
.letterhead-preview{background:#fff;color:#111;min-height:680px}.letterhead-top{display:flex;justify-content:space-between;gap:1.5rem;align-items:flex-start}.letterhead-top img{width:130px;max-height:100px;object-fit:contain}.letterhead-top address{text-align:right;font-style:normal;font-weight:700}.letterhead-rule{height:4px;margin:1rem 0 2rem;background:linear-gradient(90deg,var(--letter-primary) 28%,var(--letter-secondary) 28%)}.preview-space{min-height:280px;margin-top:2rem}.letterhead-preview footer{border-top:1px solid #ddd;padding-top:1rem;font-size:.8rem;color:#555}@media(max-width:700px){.letterhead-top{flex-direction:column}.letterhead-top address{text-align:left}}
.photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:1rem}.photo-grid .panel{margin:0}.photo-grid form{margin-top:.75rem}
