:root {
  color-scheme: light;
  --ink: #16312b;
  --muted: #51635a;
  --paper: #f0f3ed;
  --panel: #fbfcf8;
  --line: #d6dfd4;
  --accent: #155643;
  --accent-hover: #0f4737;
  --soft: #e5efe5;
  --sidebar: #112b27;
  --lime: #c8f477;
  font: 15px/1.65 "IBM Plex Sans Arabic", Tahoma, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .64; }
button, input, textarea, select { transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
button:active:not(:disabled) { transform: translateY(1px); }
:focus-visible { outline: 2px solid #247e69; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 3.05rem; line-height: 1.15; font-weight: 750; text-wrap: balance; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

.skip { position: absolute; inset-block-start: 8px; inset-inline-start: 12px; z-index: 2; padding: 8px 12px; background: var(--lime); color: var(--ink); transform: translateY(-150%); }
.skip:focus { transform: translateY(0); }
.workspace { min-height: 100dvh; }
.sidebar { background: var(--sidebar); color: #edf5ef; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 13px clamp(20px, 5vw, 80px); }
.brand, .provider { display: flex; align-items: center; gap: 11px; padding-inline: 10px; }
.brand strong { display: block; font-size: 1.32rem; line-height: 1.15; letter-spacing: -.04em; text-align: start; }
.brand small, .provider small { display: block; color: #adc2bb; font-size: .79rem; margin-top: 3px; }
.brand-icon { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 13px; flex: 0 0 auto; background: var(--lime); color: var(--sidebar); font-weight: 750; }
.brand-icon svg { width: 24px; height: 24px; }
.sidebar nav { display: flex; gap: 5px; margin: 0; }
.sidebar nav button { display: flex; align-items: center; gap: 8px; text-align: start; border: 1px solid transparent; padding: 8px 12px; border-radius: 8px; background: transparent; color: #c4d4ce; white-space: nowrap; }
.sidebar nav button:hover { background: #233d3a; color: #f3f9f4; }
.sidebar nav button[aria-current] { background: #24403a; color: var(--lime); border-color: #3a5142; font-weight: 650; }
.sidebar :focus-visible { outline-color: #b9e4c8; }
.provider { justify-self: end; padding: 0; }
.provider strong { display: block; overflow-wrap: anywhere; }
.sign-out { color: #e4ede4; background: transparent; border: 1px solid #3a5142; border-radius: 8px; padding: 5px 9px; }
.sign-out:hover { background: #24403a; }

.topbar { min-height: 53px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px clamp(20px, 5vw, 80px); display: flex; gap: 14px; align-items: center; justify-content: space-between; color: var(--muted); font-size: .88rem; }
.topbar strong { color: var(--ink); }
.topbar-status { display: flex; align-items: center; gap: 10px; }
#sender { font-variant-numeric: tabular-nums; }
.mode { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; border-radius: 999px; padding: 4px 11px; color: var(--muted); background: var(--paper); font-size: .82rem; font-weight: 650; }
.mode::before { content: ''; width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.mode[data-mode="demo"] { background: #f4eddb; color: #71531b; }
.mode[data-mode="live"] { background: var(--soft); color: var(--accent); }
.content { width: min(100%, 1376px); margin-inline: auto; padding: 39px clamp(20px, 5vw, 78px) 54px; }
.page-heading { margin-bottom: 24px; }
.page-heading p { margin-top: 8px; color: var(--muted); }
.notice { border: 1px solid #bad8c6; background: var(--soft); border-radius: 9px; padding: 10px 13px; margin-bottom: 16px; overflow-wrap: anywhere; }
.notice[data-error="true"] { border-color: #e7bfb4; background: #f9eae4; color: #813d2c; }

.metrics { display: grid; grid-template-columns: 1.3fr 1fr 1fr; background: #e6ede2; border: 1px solid var(--line); border-radius: 13px; margin-bottom: 22px; }
.metrics div { padding: 13px 20px; }
.metrics div + div { border-inline-start: 1px solid var(--line); }
.metrics span { display: block; color: var(--muted); font-size: .86rem; }
.metrics strong { display: block; font-size: 1.55rem; font-weight: 720; font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 3px; }
.compose-grid, .accounts-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(245px, 1fr); align-items: start; gap: 20px; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: 17px; }
.form-panel, .preview, .activity-panel { padding: 24px; }
.panel-heading, .field-title, .form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading { min-height: 32px; margin-bottom: 15px; }
label { display: block; font-size: .94rem; font-weight: 650; }
input:not([type="checkbox"]):not([type="file"]), textarea, select { display: block; width: 100%; min-width: 0; border-radius: 8px; background: #f5f8f2; color: var(--ink); border: 1px solid #ccd9ce; padding: 9px 11px; margin-top: 6px; }
input::placeholder, textarea::placeholder { color: #61736a; opacity: 1; }
textarea { resize: vertical; min-height: 64px; }
.field-title { margin-top: 14px; }
.field-count { font-size: .81rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 7px; }
.form-footer { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 7px; font-size: .86rem; font-weight: 500; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: 0 0 auto; }
.primary, .quiet, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; padding: 8px 12px; font-weight: 650; }
.primary { background: var(--accent); color: #f6fff7; }
.primary:hover { background: var(--accent-hover); }
.primary svg { width: 17px; height: 17px; }
.quiet { color: var(--accent); background: transparent; padding: 4px 8px; font-size: .84rem; }
.quiet:hover, .secondary:hover { background: var(--soft); }
.secondary { color: var(--accent); background: var(--panel); border-color: #becfc4; }
.upload-button { cursor: pointer; position: relative; padding: 5px 9px; font-size: .84rem; direction: rtl; }
.upload-button svg { width: 17px; height: 17px; }
.upload-button:focus-within { outline: 2px solid #247e69; outline-offset: 3px; }
.upload-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.field-error { margin-top: 8px; color: #81351e; font-size: .87rem; }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--accent); padding: 4px 8px; margin-top: 6px; background: var(--soft); border-radius: 7px; }
.file-row bdi { overflow-wrap: anywhere; }
.recipient-review { background: #f2f6ee; border: 1px solid var(--line); border-radius: 10px; margin-top: 11px; padding: 10px 12px; }
.review-heading { display: flex; justify-content: space-between; align-items: center; gap: 7px; }
[data-exceeded="true"] { color: #81351e; font-weight: 700; }
.review-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 5px; }
.review-filter { padding: 3px 8px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); background: #e9eee5; font-size: .8rem; }
.review-filter[aria-pressed="true"] { color: var(--accent); border-color: #a8c0ad; background: #f8fbf6; }
.review-filter[data-kind="invalid"][aria-pressed="true"] { color: #81351e; border-color: #d1a693; }
.review-items, .accounts-list { list-style: none; padding: 0; margin: 0; }
.review-items li, .accounts-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.review-items bdi { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.review-items small, .accounts-list small { color: var(--muted); }
#ack-review { margin-top: 10px; }

.preview h2 { margin: 3px 0 16px; }
.preview-surface { background-color: #e0eadc; background-image: radial-gradient(#9ab59d 0.6px, transparent 0.6px); background-size: 12px 12px; border: 1px solid #d7e3d5; border-radius: 12px; padding: 23px; }
.phone { min-height: 171px; background: #fbfdf7; border: 1px solid #c7d9cb; border-radius: 12px; padding: 12px; box-shadow: 0 9px 24px #254c361b; }
.phone-contact { display: flex; align-items: center; gap: 8px; padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: .82rem; }
.phone-contact span { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; background: var(--soft); color: var(--accent); }
.phone-contact svg { width: 18px; height: 18px; }
.preview-text { width: fit-content; max-width: 100%; max-height: 197px; overflow: auto; margin-top: 11px; padding: 7px 10px; border-radius: 10px; background: #e1ede2; font-size: .82rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview > .hint { margin-top: 12px; }

.inbox-grid { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2.2fr); min-height: 320px; }
.threads, .chat { padding: 18px; min-width: 0; }
.threads { border-inline-end: 1px solid var(--line); }
.threads h2, .chat h2 { margin-bottom: 12px; text-align: start; }
#chat-phone { text-align: right; }
.thread { width: 100%; text-align: start; padding: 8px 10px; border-radius: 7px; border: 1px solid transparent; color: var(--ink); background: transparent; }
.thread:hover, .thread[aria-current] { background: var(--soft); }
.thread[aria-current] { border-color: var(--line); }
.thread strong, .thread small { display: block; text-align: start; }
.thread .thread-phone { text-align: right; }
.thread small { color: var(--muted); }
.empty { padding: 21px 0; color: var(--muted); }
.simulator { margin-bottom: 14px; padding: 12px 16px; }
.simulator summary { cursor: pointer; font-weight: 650; color: var(--accent); }
.simulator form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; align-items: end; gap: 10px; margin-top: 12px; }
#chat-messages { display: grid; gap: 9px; }
.message { justify-self: start; max-width: min(90%, 560px); border-radius: 10px; background: var(--paper); padding: 8px 11px; }
.message.outbound { justify-self: end; background: var(--soft); }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; }
.message small { display: block; color: var(--muted); margin-top: 4px; }
#reply-form { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 16px; }
#reply-form button { margin-top: 8px; }
.pages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: .84rem; margin-top: 10px; }
.pages button:disabled { cursor: default; }

.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: start; }
td, th { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: start; }
th { background: var(--paper); color: var(--muted); white-space: nowrap; font-size: .82rem; }
td { font-size: .91rem; }
td:first-child { min-width: 120px; overflow-wrap: anywhere; }
td .quiet { text-align: start; }
.status { display: inline-block; padding: 2px 8px; border-radius: 5px; background: var(--paper); color: var(--muted); white-space: nowrap; }
.status[data-status="delivered"] { background: var(--soft); color: var(--accent); }
.status[data-status="failed"], .status[data-status="blocked"] { background: #f9eae4; color: #813d2c; }
.status[data-status="unknown"], .status[data-status="unconfirmed"] { background: #f4eddb; color: #71531b; }
.status-detail-cell { max-width: 50ch; overflow-wrap: anywhere; color: var(--muted); }
.accounts-list li { padding-block: 10px; }
.accounts-list small { display: block; }
#account-form label:not(.check) { margin-top: 12px; }
#account-form .check { margin-top: 13px; }
#account-form button[type="submit"] { margin-top: 13px; }
.login-shell { min-height: 100dvh; max-width: 880px; margin: auto; padding: 24px; display: grid; grid-template-columns: 1fr 1.15fr; align-content: center; gap: 22px; }
.login-intro, .login-form { padding: clamp(22px, 4vw, 41px); border-radius: 16px; }
.login-intro { display: grid; justify-items: start; align-content: center; gap: 10px; background: var(--sidebar); color: #e6f4ed; }
.login-intro strong { font: 750 2.1rem/1.2 system-ui; }
.login-intro p { color: #c0d4c7; }
.login-form h1 { font-size: 2rem; margin-bottom: 16px; }
.login-form label, .login-form button { margin-top: 13px; }
.login-form input { margin-top: 5px; }

@media (max-width: 1040px) {
  .content, .topbar { padding-inline: 24px; }
}
@media (max-width: 900px) {
  .sidebar { padding: 12px 20px; display: grid; grid-template-columns: 1fr auto; gap: 11px; }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; display: flex; overflow: auto; margin-top: 0; }
  .provider { margin: 0; border: 0; padding-block: 0; }
  .brand, .provider { padding-inline: 0; }
}
@media (max-width: 620px) {
  .sidebar, .content, .topbar { padding-inline: 14px; }
  .sidebar nav button { padding: 7px 8px; gap: 6px; font-size: .84rem; }
  .sidebar nav svg { width: 17px; height: 17px; }
  .topbar { min-height: 48px; }
  .content { padding-top: 24px; }
  h1 { font-size: 2rem; }
  .metrics div { padding: 9px 8px; }
  .metrics span { font-size: .75rem; }
  .metrics strong { font-size: 1.3rem; }
  .compose-grid, .inbox-grid, .simulator form, .accounts-grid, .login-shell { grid-template-columns: minmax(0, 1fr); }
  .form-panel, .preview, .activity-panel { padding: 14px; }
  .threads { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .provider small { display: none; }
  .topbar-status #sender { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  button, input, textarea, select { transition: none; }
}
