:root {
  font-family: 'DM Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #17231f; background: #f5f7f4; font-synthesis: none; text-rendering: optimizeLegibility;
  --ink: #17231f; --muted: #6c7771; --line: #e4e9e4; --green: #157b57; --green-dark: #0e6547;
  --green-pale: #e8f4ed; --paper: #fff; --warm: #fbf8f0; --danger: #a3443e; --shadow: 0 16px 44px rgba(27, 48, 37, .055);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(ellipse at 12% 0%, #e9f3eb 0, transparent 38%), #f5f7f4; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.shell { min-height: 100vh; }
.auth-layout { min-height: 100vh; max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 90px; padding: 64px 48px; }
.auth-intro { max-width: 560px; }
.brand-mark { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; color: #fff; font-size: 23px; font-weight: 700; background: linear-gradient(145deg, #248c64, #0b6146); box-shadow: 0 10px 24px rgba(21,123,87,.2); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 16px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.auth-intro > .eyebrow { margin-top: 32px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 4.6vw, 48px); line-height: 1.25; letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: 19px; line-height: 1.4; letter-spacing: -.02em; }
h3 { font-size: 15px; }
.auth-intro > .muted { max-width: 470px; font-size: 16px; line-height: 1.85; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.7; }
.auth-note { margin-top: 34px; padding: 15px 17px; max-width: 430px; border: 1px solid #d8e9db; border-radius: 12px; color: #3e6a52; background: rgba(255,255,255,.62); font-size: 12px; line-height: 1.7; }
.card { padding: 24px; border: 1px solid rgba(218,227,218,.9); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.auth-card { width: 100%; max-width: 420px; padding: 30px; }
.form-head { margin-bottom: 22px; }
.form-head h2 { font-size: 25px; }
label { display: flex; flex-direction: column; gap: 8px; margin-bottom: 17px; color: #384740; font-size: 12px; font-weight: 600; }
input, textarea, select { width: 100%; border: 1px solid #dfe6df; border-radius: 9px; outline: none; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input, select { min-height: 42px; padding: 9px 11px; }
textarea { resize: vertical; padding: 11px; line-height: 1.65; }
input:focus, textarea:focus, select:focus { border-color: #5ba987; box-shadow: 0 0 0 3px rgba(38,140,97,.11); }
input::placeholder, textarea::placeholder { color: #a0aaa3; font-weight: 400; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 9px 14px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 700; transition: background .15s, border-color .15s, transform .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; }
.button.primary { color: #fff; background: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-dark); }
.auth-card .button.primary { width: 100%; min-height: 44px; margin-top: 3px; }
.button.secondary { border-color: #cfe2d5; color: #23684d; background: #f5faf6; }
.button.secondary:hover:not(:disabled) { background: #edf7ef; }
.button.quiet { color: #657169; background: transparent; }
.button.quiet:hover:not(:disabled) { background: #f3f6f3; }
.link-button, .text-button { border: 0; color: var(--green); background: none; font-size: 12px; font-weight: 600; }
.link-button { display: block; margin: 18px auto 0; }
.link-button:hover, .text-button:hover { color: var(--green-dark); text-decoration: underline; }
.notice { margin: 14px 0 0; padding: 10px 12px; border-radius: 9px; color: #3e6c52; background: #eff7f1; font-size: 12px; line-height: 1.65; }
.notice.error { color: #983e39; background: #fcf0ef; }
.notice.warning { color: #7a612e; background: #fcf7e9; }
.notice.success { color: #256547; background: #eaf5ed; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 68px; padding: 0 max(28px, calc((100% - 1380px)/2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.83); backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-label { color: #52625a; font-size: 12px; }
.layout { display: grid; grid-template-columns: 218px minmax(0, 1fr); gap: 34px; max-width: 1380px; margin: 0 auto; padding: 34px 28px 54px; }
.sidebar { align-self: start; position: sticky; top: 24px; padding: 16px 4px; }
.sidebar > .eyebrow { padding: 0 12px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-link { width: 100%; min-height: 42px; padding: 10px 12px; border: 0; border-radius: 9px; color: #56655d; background: transparent; text-align: left; font-size: 13px; font-weight: 600; }
.nav-link:hover { background: #eef4ef; }
.nav-link.active { color: #155f43; background: #e6f2e9; }
.side-note { margin: 38px 9px 0; padding: 13px; border: 1px solid #e0e9df; border-radius: 11px; color: #6e7b72; background: rgba(255,255,255,.65); font-size: 11px; line-height: 1.7; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #34a36e; vertical-align: 1px; }
.content { min-width: 0; display: grid; align-content: start; gap: 20px; }
.page { display: grid; gap: 19px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 86px; padding: 0 2px 6px; }
.page-heading h1 { margin-bottom: 3px; font-size: 30px; }
.page-heading .muted { margin-bottom: 0; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.card-heading h2 { margin-bottom: 0; }
.counter, .pill { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: #53635b; background: #f1f4f1; font-size: 10px; font-weight: 700; }
.pill.success { color: #226346; background: #e8f4ec; }
.pill.warning-pill { color: #835f22; background: #faf2dc; }
.pill.pale { color: #557263; background: #edf4ef; }
.recipient-list { display: grid; gap: 8px; margin: 17px 0; }
.recipient-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.recipient-info, .recipient-actions { display: flex; align-items: center; gap: 10px; }
.recipient-info { min-width: 0; align-items: start; flex-direction: column; gap: 2px; }
.recipient-info strong { font-size: 12px; }
.recipient-info .muted { font-size: 10px; }
.recipient-actions { gap: 8px; }
.text-button { padding: 4px; white-space: nowrap; font-size: 10px; }
.empty-state { margin: 14px 0; padding: 17px; border: 1px dashed #dfe7df; border-radius: 10px; color: #849087; text-align: center; font-size: 12px; line-height: 1.7; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.button-row > .muted { margin: 0 0 0 3px; font-size: 11px; }
.qr-box { display: flex; align-items: center; gap: 15px; margin-top: 16px; padding: 13px; border: 1px solid #e1e9e2; border-radius: 12px; background: #f9fbf9; }
.qr-box img { width: 116px; height: 116px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qr-box strong { font-size: 12px; }
.qr-box .muted { margin: 5px 0 0; font-size: 10px; }
.key-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 17px 0 10px; padding: 8px 9px 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafcf9; }
.key-box code { min-width: 0; overflow-wrap: anywhere; color: #365342; font-size: 11px; }
.key-box .button { flex: 0 0 auto; min-height: 32px; padding: 6px 9px; font-size: 10px; }
.code-box { overflow: hidden; margin-top: 17px; border: 1px solid #263b32; border-radius: 10px; background: #14231d; }
.code-label { padding: 8px 12px; border-bottom: 1px solid #31463d; color: #a5c4b1; font-size: 10px; }
.code-box pre { overflow: auto; margin: 0; padding: 12px; color: #e2ede5; font-size: 10px; line-height: 1.7; white-space: pre; }
.microcopy { margin: 10px 0 0; color: #7d8980; font-size: 10px; line-height: 1.7; }
.send-card { padding-bottom: 21px; }
.form-grid { margin-top: 18px; gap: 13px; }
.form-grid label { margin-bottom: 0; }
.send-card > label { margin-top: 15px; }
.message-list { display: grid; gap: 10px; }
.message-item { padding: 14px 0; border-bottom: 1px solid #edf0ed; }
.message-item:first-child { padding-top: 6px; }
.message-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.message-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.message-top strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.message-body { margin: 7px 0; color: #69766e; font-size: 11px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 7px; color: #9aa39c; font-size: 10px; }
.message-error { margin: 8px 0 0; color: #9e4d47; font-size: 10px; line-height: 1.55; }
.template-summary { display: grid; gap: 7px; margin: 15px 0; }
.config-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #edf0ed; color: #48564e; font-size: 11px; overflow-wrap: anywhere; }
.config-row code { font-size: 10px; color: #315442; }
.admin-only { margin-top: 12px; }
.template-content { margin: 12px 0; padding: 13px; border: 1px solid var(--line); border-radius: 9px; color: #56655d; background: #fafcf9; font-size: 11px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.mapping-list { display: grid; gap: 9px; margin: 14px 0; }
.mapping-row { display: grid; grid-template-columns: minmax(105px, .75fr) minmax(170px, 1.2fr) 120px; align-items: end; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.mapping-field { display: flex; flex-direction: column; gap: 3px; padding-bottom: 11px; }
.mapping-field strong { font-size: 12px; }
.mapping-field .muted { font-size: 10px; }
.mapping-row label { margin: 0; font-size: 10px; }
.mapping-row input, .mapping-row select { min-height: 37px; font-size: 11px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.stat-card { display: grid; gap: 5px; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.stat-card .muted { font-size: 10px; }
.stat-card strong { font-size: 15px; overflow-wrap: anywhere; }
.subheading { margin: 19px 0 3px; }
.footer { padding: 7px 4px 0; color: #929c94; font-size: 10px; line-height: 1.7; }
.footer span { float: right; }
.footer a, .legal-card a { color: #246d4e; text-underline-offset: 3px; }
.consent-box { display: grid; gap: 10px; margin: 1px 0 17px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fafcf9; }
.check-label { display: flex; align-items: flex-start; flex-direction: row; gap: 8px; margin: 0; color: #637068; font-size: 11px; font-weight: 400; line-height: 1.6; }
.check-label input { flex: 0 0 auto; width: 15px; height: 15px; min-height: auto; margin: 2px 0 0; accent-color: var(--green); }
.check-label a { color: #246d4e; }
.inline-check { justify-content: start; align-self: end; min-height: 42px; padding: 11px 2px; }
.danger-zone { border-color: #f0d8d6; }
.button.danger { color: #fff; background: #a84640; }
.button.danger:hover:not(:disabled) { background: #913831; }
.admin-user-list { display: grid; gap: 8px; }
.admin-user-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #edf0ed; }
.admin-user-email { min-width: 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-meta { margin-top: 3px; color: #929c94; font-size: 9px; }
.admin-sending-card { border-color: #e4eade; background: linear-gradient(135deg, #fff 55%, #f7faf5); }
.admin-user-filters { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(145px, .55fr) auto; align-items: end; gap: 10px; margin: 14px 0; }
.admin-user-filters label { margin: 0; }
.admin-user-filters input, .admin-user-filters select { min-height: 39px; }
.admin-user-pagination { margin-top: 10px; }
.admin-user-pagination .button-row { margin: 0; }
.admin-user-pagination .button { min-height: 34px; padding: 7px 11px; }
.legal-shell { max-width: 850px; margin: 0 auto; padding: 30px 20px 70px; }
.legal-shell > .brand { margin-bottom: 18px; }
.legal-card { padding: clamp(22px, 5vw, 48px); }
.legal-card h1 { margin: 14px 0 2px; font-size: 32px; }
.legal-card h2 { margin: 27px 0 9px; font-size: 16px; }
.legal-card p, .legal-card li { color: #56635b; font-size: 13px; line-height: 1.9; }
.legal-card ul { padding-left: 21px; }
.legal-card .muted { margin-bottom: 25px; font-size: 11px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: min(390px, calc(100vw - 44px)); padding: 12px 15px; border: 1px solid #d8e5d9; border-radius: 10px; color: #315f46; background: #f8fcf8; box-shadow: 0 12px 34px rgba(20, 45, 32, .14); font-size: 12px; line-height: 1.6; }
.toast.error { color: #973e39; border-color: #f1d6d4; background: #fffafa; }
.local-demo-banner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; padding: 12px 24px; border-bottom: 1px solid #ead9b2; background: #fff9e8; color: #80642b; font-size: 11px; line-height: 1.7; }
.local-demo-banner a { color: #80642b; text-underline-offset: 3px; }
.intro-docs { display: inline-flex; align-items: center; gap: 14px; margin-top: 22px; color: var(--green); font-size: 13px; font-weight: 600; text-decoration: none; }
.intro-docs:hover { text-decoration: underline; text-underline-offset: 4px; }
a.button { text-decoration: none; }
.integration-steps { display: grid; gap: 15px; margin: 22px 0; padding-left: 22px; color: var(--green); }
.integration-steps li { padding-left: 8px; font-size: 13px; }
.integration-steps strong, .integration-steps span { display: block; }
.integration-steps strong { color: var(--ink); margin-bottom: 4px; }
.integration-steps span { color: var(--muted); font-size: 12px; line-height: 1.75; }
.api-parameter-list { display: grid; margin-top: 20px; }
.api-parameter-list > div { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.7; }
.api-parameter-list code { color: var(--green); }
.api-parameter-list span { color: var(--muted); }
.message-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; }
.message-actions .button { min-height: 32px; padding: 6px 9px; font-size: 11px; }
.message-actions .button:first-child { margin-left: -9px; }
.message-actions .microcopy { margin: 0 0 0 6px; }
.revoke-link { margin-left: auto; color: var(--danger); }
.pagination-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.pagination-row .microcopy { margin: 0; }
.message-dialog { width: min(680px, calc(100vw - 32px)); max-height: min(86vh, 900px); padding: 25px; border: 1px solid #dce7df; border-radius: 18px; background: #fff; color: var(--ink); box-shadow: 0 25px 80px rgba(20, 40, 28, .18); overflow-y: auto; }
.message-dialog::backdrop { background: rgba(18, 35, 25, .38); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.dialog-heading > div { min-width: 0; }
.dialog-heading h2 { white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog-heading .button { flex: 0 0 auto; }
.dialog-content { font-size: 13px; line-height: 1.8; }
.detail-copy { margin: 20px 0; color: #43534a; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-section-title { margin: 24px 0 10px; font-size: 13px; }
.detail-field-list { margin: 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fafcf9; }
.detail-field-row { display: grid; grid-template-columns: minmax(70px, .7fr) minmax(0, 2fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-field-row:last-child { border-bottom: 0; }
.detail-field-row dt { color: #778379; overflow-wrap: anywhere; font-size: 11px; }
.detail-field-row dd { margin: 0; color: #364b3e; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
.business-link { margin: 4px 0 10px; }

@media (max-width: 940px) {
  .layout { grid-template-columns: 175px minmax(0, 1fr); gap: 18px; padding-inline: 18px; }
  .grid.two { grid-template-columns: 1fr; }
  .auth-layout { gap: 40px; padding-inline: 32px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .auth-layout { grid-template-columns: 1fr; gap: 25px; padding: 32px 19px; }
  .auth-intro > .eyebrow { margin-top: 22px; }
  .auth-intro h1 { font-size: 34px; }
  .auth-intro > .muted { font-size: 13px; }
  .auth-note { margin-top: 18px; }
  .auth-card { max-width: none; padding: 22px; }
  .topbar { height: 60px; padding-inline: 15px; }
  .user-label { max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { gap: 5px; }
  .layout { display: block; padding: 17px 13px 32px; }
  .sidebar { position: static; margin-bottom: 15px; padding: 0; }
  .sidebar > .eyebrow, .side-note { display: none; }
  .sidebar nav { display: flex; gap: 5px; overflow-x: auto; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.72); }
  .nav-link { flex: 0 0 auto; width: auto; min-height: 35px; padding: 8px 10px; font-size: 11px; }
  .admin-only { margin: 0; }
  .content { gap: 14px; }
  .page { gap: 13px; }
  .page-heading { min-height: 68px; }
  .page-heading h1 { font-size: 25px; }
  .card { padding: 17px; border-radius: 13px; }
  .card-heading { gap: 8px; }
  .mapping-row { grid-template-columns: 1fr 1fr; gap: 9px; }
  .mapping-field { grid-column: 1 / -1; padding-bottom: 0; }
  .mapping-row label { min-width: 0; }
  .admin-user-filters { grid-template-columns: 1fr 1fr; }
  .admin-user-filters label:first-child { grid-column: 1 / -1; }
  .admin-user-filters .button { justify-self: start; }
  .admin-user-pagination { align-items: flex-start; flex-direction: column; }
  .footer { padding-inline: 3px; }
  .api-parameter-list > div { grid-template-columns: 58px minmax(0, 1fr); gap: 12px; }
  .message-dialog { padding: 20px; }
  .detail-field-row { grid-template-columns: 1fr; gap: 4px; }
}
