:root {
    color-scheme: light;
    --font-ui: "IBM Plex Sans Arabic", Tajawal, "Segoe UI", Tahoma, Arial, sans-serif;
    --blue: #155eef;
    --blue-hover: #004eeb;
    --blue-soft: #eff6ff;
    --ink: #101828;
    --text: #475467;
    --muted: #667085;
    --line: #e4e7ec;
    --line-strong: #d0d5dd;
    --soft: #f2f4f7;
    --background: #f7f8fb;
    --surface: #fff;
    --success: #079455;
    --success-soft: #ecfdf3;
    --warning: #b54708;
    --warning-soft: #fffaeb;
    --danger: #d92d20;
    --danger-soft: #fef3f2;
    --radius-sm: 8px;
    --radius: 16px;
    --control-height: 42px;
    --sidebar-width: 272px;
    --gutter: clamp(20px, 3vw, 40px);
    --shadow: 0 1px 2px rgb(16 24 40 / 3%), 0 8px 20px rgb(16 24 40 / 3%);
    --transition: 160ms ease;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--ink); font-family: var(--font-ui); font-size: 14px; line-height: 1.65; }
body, button, input, select, textarea { font-family: var(--font-ui); }
body.sidebar-open { overflow: hidden; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgb(21 94 239 / 24%); outline-offset: 3px; }
svg { display: block; width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

/* Shell */
.app-shell { display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar-width); min-height: 100vh; direction: ltr; }
.app-main, .sidebar { direction: rtl; }
.app-main { grid-column: 1; min-width: 0; }
.sidebar { z-index: 20; display: flex; grid-column: 2; grid-row: 1; flex-direction: column; min-height: 100vh; padding: 16px 12px 12px; border-inline-start: 1px solid var(--line); background: var(--surface); color: var(--text); }
.sidebar-brand { display: flex; min-height: 74px; align-items: center; justify-content: space-between; padding: 0 12px 14px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 20px; font-weight: 700; letter-spacing: -.03em; }
.brand:hover { color: var(--ink); }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--blue); color: #fff; font-size: 18px; font-weight: 800; }
.brand-copy { display: grid; gap: 0; line-height: 1.25; }
.brand-copy strong { font-size: 18px; }
.brand-copy small { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0; }
.sidebar-nav { display: grid; gap: 3px; padding: 22px 4px; }
.nav-section-label { margin: 0 10px 8px; color: #98a2b3; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.nav-section-label-spaced { margin-top: 14px; }
.nav-link { display: flex; min-height: 44px; align-items: center; gap: 12px; padding: 0 11px; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-weight: 600; transition: color var(--transition), background var(--transition), border-color var(--transition); }
.nav-link svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--muted); }
.nav-link:hover { background: #f9fafb; color: var(--ink); }
.nav-link.is-active { border-color: #dbe8ff; background: var(--blue-soft); color: var(--blue); }
.nav-link.is-active svg { color: var(--blue); }
.nav-link-button { width: 100%; border: 0; background: transparent; cursor: pointer; text-align: right; }
.nav-link-button:hover, .nav-link-button:hover svg { color: var(--danger); }
.sidebar-footer { margin-top: auto; padding: 14px 4px 0; border-top: 1px solid var(--line); }
.sidebar-close, .sidebar-backdrop { display: none; }

.icon-button { display: grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: #b2ccff; background: var(--blue-soft); color: var(--blue); }
.icon-button svg { width: 19px; height: 19px; }
.main-content { width: 100%; margin: 0 auto; padding: 24px var(--gutter) 52px; }

/* Page surfaces */
.auth-layout { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: var(--background); }
.auth-messages { position: fixed; top: 20px; width: min(100% - 32px, 520px); }
.messages { display: grid; gap: 10px; margin-bottom: 20px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-heading h1, .hero h1 { margin: 0; color: var(--ink); font-size: clamp(26px, 2.5vw, 34px); font-weight: 700; line-height: 1.35; letter-spacing: -.035em; }
.page-heading p, .hero p { max-width: 700px; margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.eyebrow { margin: 0 0 5px !important; color: var(--blue) !important; font-size: 11px !important; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hero, .surface-card, .filter-card, .table-card, .form-card, .summary-card, .status-panel, .auth-card, .error-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.hero { margin-bottom: 20px; padding: clamp(22px, 3vw, 32px); }
.pad-card, .summary-card { padding: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
.section-heading h2 { margin: 0; color: var(--ink); font-size: 17px; font-weight: 700; }
.hint { color: var(--muted); font-size: 12px; }

/* Controls and forms */
.button, button { display: inline-flex; min-height: var(--control-height); align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; line-height: 1.2; cursor: pointer; transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition); }
.button-primary, button:not(.nav-link):not(.icon-button) { background: var(--blue); color: #fff; }
.button-primary:hover, button:not(.nav-link):not(.icon-button):hover { background: var(--blue-hover); color: #fff; box-shadow: 0 4px 10px rgb(21 94 239 / 18%); }
.button-secondary, .button.button-secondary, button.button-secondary { border-color: var(--line-strong); background: var(--surface); color: var(--text); }
.button-secondary:hover, .button.button-secondary:hover, button.button-secondary:hover { border-color: #b2ccff; background: var(--blue-soft); color: var(--blue); box-shadow: none; }
.button-danger, .button.button-danger, button.button-danger { border-color: #fecdca; background: var(--danger-soft); color: var(--danger); }
.button-danger:hover, .button.button-danger:hover, button.button-danger:hover { border-color: #fda29b; background: #fee4e2; color: #b42318; box-shadow: none; }
.button-link { min-height: auto; padding: 0; border: 0; background: transparent; color: var(--blue); }
.button-row, .action-row, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.action-row { justify-content: flex-start; }
button:disabled, .button[aria-disabled="true"] { cursor: not-allowed; opacity: .52; box-shadow: none; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: 14px; line-height: 1.5; padding: 9px 12px; transition: border-color var(--transition), box-shadow var(--transition); }
input, select { min-height: var(--control-height); }
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:hover, select:hover, textarea:hover { border-color: #98a2b3; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(21 94 239 / 12%); outline: 0; }
textarea { min-height: 132px; resize: vertical; }
form p { margin: 0; }
form label, .filter-card label, .filters label { color: var(--ink); font-size: 13px; font-weight: 700; }
.form-card, .card-form { display: grid; gap: 16px; max-width: 780px; padding: clamp(20px, 3vw, 30px); }
.card-form { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.form-card > p, .card-form > p, .auth-card form p { display: grid; gap: 6px; }
.form-card ul.errorlist, form ul.errorlist { margin: 2px 0 0; padding: 0; color: var(--danger); font-size: 12px; list-style: none; }
.selection-options { display: flex; flex-wrap: wrap; gap: 12px 20px; margin: 0; padding: 0; border: 0; }
.selection-options legend { width: 100%; margin-bottom: 3px; color: var(--ink); font-size: 14px; font-weight: 700; }
.selection-options label { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.selection-options input { width: auto; min-height: auto; }
.fieldset-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.fieldset-card legend { padding: 0 7px; color: var(--ink); font-size: 14px; font-weight: 700; }
.filter-card { margin-bottom: 18px; padding: 16px; }
.filter-card form, .filters { display: flex; width: 100%; flex-wrap: wrap; align-items: end; gap: 12px; }
.filter-card p, .filter-card fieldset, .filters p { display: grid; flex: 1 1 180px; gap: 5px; min-width: 150px; margin: 0; }
.filter-card .button, .filters button { flex: 0 0 auto; }
.filter-clear { align-self: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.filter-clear:hover { color: var(--blue); }

/* Data display */
.stats-grid, .placeholder-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card, .placeholder-grid article { min-height: 116px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-label, .placeholder-grid article h2 { margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-value, .placeholder-grid article p { margin: 0; color: var(--ink); font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-meta { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.stat-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: var(--blue-soft); color: var(--blue); }
.stat-icon svg { width: 21px; height: 21px; }
.stat-card-success .stat-icon { background: var(--success-soft); color: var(--success); }
.stat-card-warning .stat-icon { background: var(--warning-soft); color: var(--warning); }
.stat-card-neutral .stat-icon { background: var(--soft); color: var(--muted); }
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 680px; border-collapse: collapse; background: var(--surface); }
th, td { padding: 14px 18px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { background: #f9fafb; color: var(--text); font-size: 12px; font-weight: 700; white-space: nowrap; }
td { color: var(--text); font-size: 13px; }
td strong { color: var(--ink); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfd; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-actions a { font-size: 13px; font-weight: 700; }
.inline-form { display: inline; }
.inline-form button { min-height: auto; margin: 0; padding: 0; border: 0; background: transparent !important; color: var(--danger) !important; font-size: 13px; }
.table-empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.report-table { margin-top: 18px; }
.recipients-table th, .recipients-table td { padding-top: 10px; padding-bottom: 10px; vertical-align: middle; }
.recipients-table .selection-column { width: 64px; text-align: center; }
.recipients-table input[type="checkbox"], .contacts-table input[type="checkbox"] { display: block; width: 18px; min-width: 18px; max-width: 18px; height: 18px; min-height: 18px; max-height: 18px; box-sizing: border-box; flex: 0 0 18px; margin: 0 auto; padding: 0; vertical-align: middle; }
.bidi-safe { direction: ltr; unicode-bidi: plaintext; }
.status-badge { display: inline-flex; min-height: 27px; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; background: var(--soft); color: var(--text); font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge-compact { min-height: 25px; padding: 3px 8px; }
.status-completed, .status-accepted, .status-active { background: var(--success-soft); color: var(--success); }
.status-queued, .status-processing, .status-pending, .status-warning, .status-stale, .status-completed_with_errors { background: var(--warning-soft); color: var(--warning); }
.status-rejected, .status-error, .status-failed { background: var(--danger-soft); color: var(--danger); }
.status-draft, .status-neutral, .status-inactive, .status-unknown, .status-cancelled { background: var(--soft); color: var(--text); }

/* Supporting UI */
.alert { display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; border: 1px solid transparent; border-radius: 12px; font-size: 13px; }
.alert::before { content: "i"; display: grid; width: 19px; height: 19px; flex: 0 0 auto; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; font-weight: 700; }
.alert-error, .alert-danger { border-color: #fecdca; background: var(--danger-soft); color: var(--danger); }
.alert-success { border-color: #abefc6; background: var(--success-soft); color: var(--success); }
.alert-warning { border-color: #fedf89; background: var(--warning-soft); color: var(--warning); }
.alert-info, .alert-debug { border-color: #b2ddff; background: var(--blue-soft); color: var(--blue); }
.alert-error::before, .alert-danger::before, .alert-warning::before { content: "!"; }
.summary-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.summary-list dt, .summary-list dd { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.summary-list dt { background: #f9fafb; color: var(--muted); font-size: 12px; font-weight: 700; }
.summary-list dd { color: var(--ink); font-size: 13px; }
.summary-list dt:nth-last-of-type(1), .summary-list dd:nth-last-of-type(1) { border-bottom: 0; }
.full-message { white-space: pre-wrap; }
.empty-state { display: grid; min-height: 230px; place-items: center; align-content: center; gap: 8px; padding: 32px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); text-align: center; }
.empty-state-icon { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 14px; background: var(--blue-soft); color: var(--blue); }
.empty-state-icon svg { width: 25px; height: 25px; }
.empty-state h2 { margin: 0; color: var(--ink); font-size: 18px; }
.empty-state p { max-width: 440px; margin: 0 0 9px; color: var(--muted); font-size: 13px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.pagination-links { display: inline-flex; align-items: center; gap: 4px; }
.pagination-link, .pagination-current { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-weight: 700; }
.pagination-current { border-color: var(--blue); background: var(--blue); color: #fff; }
.pagination-link { color: var(--text); }
.pagination-link:hover { border-color: #b2ccff; background: var(--blue-soft); color: var(--blue); }
.pagination-ellipsis { display: grid; width: 28px; height: 34px; place-items: center; color: var(--muted); }
.auth-card { width: min(100%, 430px); padding: clamp(26px, 5vw, 40px); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; color: var(--ink); font-size: 23px; font-weight: 700; }
.auth-card h1 { margin: 0; color: var(--ink); font-size: 25px; letter-spacing: -.03em; }
.auth-card > p { margin: 8px 0 24px; color: var(--muted); font-size: 13px; }
.auth-card form { display: grid; gap: 12px; }
.auth-card button { width: 100%; margin-top: 4px; }
.field-error { margin: 0; color: var(--danger); font-size: 12px; }
.error-card { width: min(100%, 580px); padding: 42px 24px; text-align: center; }
.error-card h1 { margin: 0 0 10px; color: var(--ink); font-size: 28px; }
.error-card p { margin: 7px 0; color: var(--muted); }
.correlation { direction: ltr; font-family: Consolas, monospace; font-size: 12px; }
.provider-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.provider-card { padding: 18px; }
.provider-card h2 { margin: 0 0 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.provider-card p { margin: 0; color: var(--ink); font-size: 15px; }
.provider-details { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.provider-details .summary-list { grid-template-columns: 1fr 1fr; }

/* Purpose-built dashboard composition */
.dashboard-page { display: grid; gap: 18px; }
.dashboard-header, .data-page-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.dashboard-heading-copy h1, .data-page-header h1 { margin: 0; color: var(--ink); font-size: clamp(26px, 2.4vw, 34px); font-weight: 700; letter-spacing: -.035em; }
.dashboard-heading-copy > p:not(.eyebrow), .data-page-header > div > p:not(.eyebrow) { max-width: 680px; margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.dashboard-overview { display: grid; gap: 14px; }
.dashboard-notice { margin: 0; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.dashboard-metrics .stat-card { min-width: 0; min-height: 124px; }
.dashboard-balance { border-color: #dbe8ff; background: linear-gradient(145deg, #fff 10%, var(--blue-soft)); }
.dashboard-recent { padding: 20px; }
.dashboard-section-heading, .data-panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.dashboard-section-heading h2, .data-panel-heading h2, .toolbar-copy h2 { margin: 0; color: var(--ink); font-size: 17px; font-weight: 700; }
.dashboard-section-heading p:not(.eyebrow), .data-panel-heading p, .toolbar-copy p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

/* Compact data-page composition */
.data-page-header { margin-bottom: 20px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px; }
.data-toolbar { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 2.3fr); align-items: end; gap: 20px; padding: 17px 18px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.toolbar-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.toolbar-form > p { display: grid; flex: 1 1 160px; gap: 5px; min-width: 150px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.data-panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.data-panel .table-card { border: 0; border-radius: 12px; box-shadow: none; }
.data-panel .pagination { margin-bottom: 0; }

/* Guided quick-send flow */
.workflow-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.workflow-header h1 { margin: 0; color: var(--ink); font-size: clamp(26px, 2.4vw, 34px); font-weight: 700; letter-spacing: -.035em; }
.workflow-header p:not(.eyebrow) { max-width: 680px; margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.workflow-step { display: inline-grid; min-width: 96px; min-height: 58px; place-items: center; align-content: center; gap: 1px; padding: 8px 13px; border: 1px solid #dbe8ff; border-radius: 12px; background: var(--blue-soft); color: var(--blue); font-size: 18px; font-weight: 700; line-height: 1.1; }
.workflow-step small { color: var(--muted); font-size: 10px; font-weight: 600; }
.workflow-step-current { border-color: #b2ccff; background: #e7f0ff; }
.workflow-step-complete { border-color: #abefc6; background: var(--success-soft); color: var(--success); }
.workflow-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .42fr); align-items: start; gap: 18px; max-width: 1040px; }
.workflow-form { max-width: none; }
.quick-send-recipient-field { display: grid; gap: 6px; }
.quick-send-template-field { display: grid; gap: 6px; }
.quick-send-template-field > label { color: var(--ink); font-size: 13px; font-weight: 700; }
.quick-send-template-field .hint, .quick-send-template-empty { margin: 0; color: var(--muted); font-size: 12px; }
.quick-send-template-empty { color: var(--warning); }
.quick-send-field-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.workflow-form button.contact-picker-open { display: grid; width: 32px; min-height: 32px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); box-shadow: none; }
.workflow-form button.contact-picker-open:hover { border-color: #b2ccff; background: var(--blue-soft); color: var(--blue); box-shadow: none; }
.contact-picker-open svg { width: 18px; height: 18px; }
.contact-picker-dialog { width: min(92vw, 520px); max-height: min(82vh, 650px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgb(16 24 40 / 24%); }
.contact-picker-dialog::backdrop { background: rgb(16 24 40 / 48%); }
.contact-picker-content { display: grid; gap: 12px; padding: 22px; }
.contact-picker-content header { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.contact-picker-content h2 { margin: 0; font-size: 18px; }
.contact-picker-content > label { font-weight: 700; }
.contact-picker-status { min-height: 20px; margin: 0; color: var(--muted); font-size: 12px; }
.contact-picker-list { display: grid; max-height: 300px; gap: 7px; overflow-y: auto; }
.contact-picker-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.contact-picker-row:hover, .contact-picker-row.is-selected { border-color: #b2ccff; background: var(--blue-soft); }
.contact-picker-row input[type="radio"] { width: 18px; height: 18px; min-height: 0; flex: 0 0 auto; margin: 0; }
.contact-picker-row > span { display: grid; min-width: 0; gap: 1px; }
.contact-picker-row strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.contact-picker-row bdi { color: var(--muted); font-size: 12px; }
.contact-picker-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.contacts-bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; padding: 11px 14px; border: 1px solid #b2ddff; border-radius: 10px; background: var(--blue-soft); color: var(--ink); }
.contacts-bulk-bar[hidden] { display: none; }
.contacts-table th, .contacts-table td { vertical-align: middle; }
.contacts-table .selection-column { width: 108px; min-width: 108px; padding: 8px; text-align: center; }
.contacts-table .contacts-select-all { display: inline-flex; width: auto; align-items: center; justify-content: center; gap: 6px; margin: 0; color: inherit; font-size: inherit; font-weight: inherit; white-space: nowrap; cursor: pointer; }
.contacts-table .contacts-select-all input[type="checkbox"] { margin: 0; }
.contacts-table input[type="checkbox"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; box-shadow: none; }
.bulk-update-field input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; }
.bulk-update-field { display: grid; gap: 7px; }
.bulk-update-field label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.contacts-bulk-dialog p { margin: 0; color: var(--text); }
.form-section-heading { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.form-section-heading h2, .workflow-aside h2, .review-card-heading h2, .result-card h2 { margin: 0; color: var(--ink); font-size: 17px; font-weight: 700; }
.form-section-heading p, .workflow-aside p, .review-card-heading p, .result-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.workflow-aside { display: grid; gap: 10px; padding: 20px; border: 1px solid #dbe8ff; border-radius: var(--radius); background: linear-gradient(145deg, var(--surface), var(--blue-soft)); }
.workflow-aside .stat-icon { margin-bottom: 2px; }
.review-card, .result-card { max-width: 860px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.review-card-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.review-card .summary-list, .result-card .summary-list { margin-bottom: 14px; }
.review-actions { justify-content: flex-end; margin-top: 16px; }
.result-card-error { display: flex; align-items: flex-start; gap: 14px; border-color: #fecdca; background: var(--danger-soft); }
.result-card-error .stat-icon { flex: 0 0 auto; background: #fee4e2; color: var(--danger); }

@media (max-width: 1220px) { :root { --sidebar-width: 248px; } .stats-grid, .placeholder-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) { .stats-grid, .placeholder-grid, .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .data-toolbar { grid-template-columns: 1fr; gap: 14px; } }
@media (max-width: 820px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; z-index: 20; inset-block: 0; inset-inline-end: 0; width: min(84vw, 300px); min-height: 100vh; transform: translateX(105%); transition: transform 200ms ease; box-shadow: -12px 0 30px rgb(16 24 40 / 14%); }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-close { display: grid; }
    .sidebar-backdrop { position: fixed; z-index: 10; inset: 0; display: block; background: rgb(16 24 40 / 36%); }
    .sidebar-backdrop[hidden] { display: none; }
}
@media (max-width: 600px) {
    :root { --gutter: 16px; }
    .main-content { padding-block: 22px 42px; }
    .page-heading { display: grid; gap: 14px; }
    .page-heading .button, .page-heading > a { width: 100%; }
    .stats-grid, .placeholder-grid, .dashboard-metrics, .provider-grid, .provider-details { grid-template-columns: 1fr; }
    .dashboard-header, .data-page-header, .dashboard-section-heading, .data-panel-heading { display: grid; align-items: stretch; gap: 13px; }
    .workflow-header, .review-card-heading { display: grid; align-items: stretch; gap: 13px; }
    .dashboard-header > .button, .page-actions .button, .dashboard-section-heading .button { width: 100%; }
    .page-actions { display: grid; grid-template-columns: 1fr; }
    .data-panel, .dashboard-recent { padding: 14px; }
    .toolbar-form, .toolbar-actions { display: grid; grid-template-columns: 1fr; }
    .workflow-layout { grid-template-columns: 1fr; }
    .workflow-step { justify-self: start; }
    .review-actions { justify-content: stretch; }
    .review-actions form, .review-actions button { width: 100%; }
    .filter-card { padding: 14px; }
    .filter-card form, .filters { display: grid; grid-template-columns: 1fr; align-items: stretch; }
    .filter-card p, .filters p { min-width: 0; }
    .filter-card .button, .filters button { width: 100%; }
    .summary-list, .provider-details .summary-list { grid-template-columns: 1fr; }
    .summary-list dt, .summary-list dd { border-bottom: 0; }
    .summary-list dd { padding-top: 0; }
    .summary-list dd:not(:last-child) { padding-bottom: 13px; }
    .summary-list dt:not(:first-child) { border-top: 1px solid var(--line); padding-top: 13px; }
    .pagination { align-items: flex-start; flex-direction: column; }
    table { min-width: 720px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* Dashboard and shared sidebar redesign */
.app-sidebar,
.app-sidebar button,
.app-sidebar a,
.dashboard-page,
.dashboard-page button,
.dashboard-page a { font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif; }

.app-sidebar { width: var(--sidebar-width); padding: 24px 16px 16px; border-inline-start: 1px solid #dce3ec; box-shadow: -4px 0 18px rgb(8 42 82 / 3%); color: #40506a; }
.app-sidebar .sidebar-brand { min-height: 86px; padding: 0 16px 20px; border-bottom: 0; }
.app-sidebar .brand { color: #082a52; font-size: 23px; font-weight: 700; letter-spacing: 0; }
.app-sidebar .brand-copy strong { font-size: inherit; }
.app-sidebar .sidebar-nav { gap: 5px; padding: 23px 0; }
.app-sidebar .nav-section-label { margin: 0 14px 9px; color: #667085; font-size: 13px; font-weight: 500; letter-spacing: 0; }
.app-sidebar .nav-section-label-spaced { margin-top: 15px; padding-top: 17px; border-top: 1px solid #edf0f4; }
.app-sidebar .nav-link { min-height: 52px; gap: 14px; padding-inline: 14px; border: 0; border-radius: 10px; color: #40506a; font-size: 14px; font-weight: 500; }
.app-sidebar .nav-link svg { width: 21px; height: 21px; color: #50617c; stroke-width: 1.8; }
.app-sidebar .nav-link:hover { background: #f6f8fb; color: #172033; }
.app-sidebar .nav-link.is-active { background: #eaf2ff; color: #0b67f6; }
.app-sidebar .nav-link.is-active svg { color: #0b67f6; }
.app-sidebar .sidebar-footer { border-color: #edf0f4; }

.dashboard-page { --dash-navy: #082a52; --dash-blue: #0b67f6; --dash-border: #dce3ec; display: grid; gap: 24px; color: #172033; }
.dashboard-hero { position: relative; display: grid; min-height: 238px; align-content: space-between; padding: 30px 34px; overflow: hidden; border-radius: 14px; background: #082a52; color: #fff; box-shadow: 0 5px 16px rgb(8 42 82 / 10%); }
.dashboard-hero::after { position: absolute; inset-block: 0; inset-inline-start: 0; width: 34%; background: repeating-linear-gradient(132deg, transparent 0 25px, rgb(255 255 255 / 2.5%) 26px 27px); content: ""; pointer-events: none; }
.dashboard-hero .dashboard-heading-copy { position: relative; z-index: 1; }
.dashboard-hero .dashboard-heading-copy h1 { margin: 0; color: #fff; font-size: clamp(30px, 3vw, 38px); font-weight: 600; letter-spacing: 0; line-height: 1.35; }
.dashboard-hero .dashboard-heading-copy p { max-width: 720px; margin: 6px 0 0; color: rgb(255 255 255 / 88%); font-size: 15px; }
.dashboard-hero-actions { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; direction: rtl; }
.dashboard-provider-status { display: inline-flex; min-height: 48px; align-items: center; gap: 10px; padding: 8px 17px; border: 1px solid rgb(73 207 144 / 70%); border-radius: 10px; background: rgb(22 138 91 / 36%); color: #fff; font-size: 15px; font-weight: 500; }
.dashboard-provider-status svg { width: 22px; height: 22px; flex-shrink: 0; color: #d9ffed; stroke-width: 2; }
.dashboard-create-button { min-width: 178px; min-height: 52px; justify-content: center; gap: 10px; border-color: #3d91ff; border-radius: 10px; background: #0b67f6; color: #fff; font-size: 16px; font-weight: 600; box-shadow: none; }
.dashboard-create-button:hover { border-color: #79b2ff; background: #0759da; color: #fff; }
.dashboard-overview { display: block; }
.dashboard-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.dashboard-stat-card { display: flex; min-width: 0; min-height: 166px; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 22px; border: 1px solid #dce3ec; border-radius: 13px; background: #fff; box-shadow: 0 2px 8px rgb(16 24 40 / 2%); }
.dashboard-stat-card .stat-label { margin-bottom: 10px; color: #40506a; font-size: 14px; font-weight: 500; }
.dashboard-stat-card .stat-value { color: #101828; font-size: clamp(30px, 2.5vw, 36px); font-weight: 700; }
.dashboard-stat-card .stat-meta { margin-top: 8px; color: #40506a; font-size: 13px; }
.dashboard-stat-card .stat-icon { width: 54px; height: 54px; border-radius: 50%; background: #eaf2ff; color: #0b67f6; }
.dashboard-stat-card .stat-icon svg { width: 26px; height: 26px; }
.dashboard-stat-card.stat-card-warning .stat-icon { background: #fff3e8; color: #c75b00; }
.dashboard-stat-card.stat-card-success .stat-icon { background: #e9f7f0; color: #168a5b; }
.dashboard-balance { position: relative; border-color: #dce3ec; background: #fff; }
.balance-title-row { display: flex; align-items: center; gap: 5px; }
.dashboard-stat-card .balance-title-row .stat-label { margin: 0; }
.dashboard-page button.balance-refresh { position: absolute; top: 16px; right: auto; left: 16px; width: 27px; min-height: 27px; padding: 4px; border: 0; border-radius: 50%; background: transparent; color: #667085; box-shadow: none; }
.dashboard-page button.balance-refresh:hover { background: #eaf2ff; color: #0b67f6; box-shadow: none; }
.dashboard-page button.balance-refresh svg { width: 17px; height: 17px; }
.dashboard-page button.balance-refresh.is-loading svg { animation: balance-refresh-spin .7s linear infinite; }
.dashboard-stat-card .balance-refresh-message { white-space: nowrap; }
@keyframes balance-refresh-spin { to { transform: rotate(360deg); } }
.dashboard-worker-card { justify-content: center; text-align: center; }
.dashboard-worker-card .stat-label { font-size: 14px; }
.dashboard-worker-card .stat-value { margin-top: 26px; font-size: 19px; font-weight: 600; }
.dashboard-worker-card .stat-value.is-stopped { color: #c75b00; }
.dashboard-worker-card .stat-value.is-running { color: #168a5b; }
.dashboard-campaigns { padding: 0; overflow: hidden; border: 1px solid #dce3ec; border-radius: 14px; box-shadow: 0 2px 8px rgb(16 24 40 / 2%); }
.dashboard-campaigns .dashboard-section-heading { min-height: 118px; align-items: center; margin: 0; padding: 22px 30px; }
.dashboard-campaigns .dashboard-section-heading h2 { color: #101828; font-size: 21px; font-weight: 600; }
.dashboard-campaigns .dashboard-section-heading p:not(.eyebrow) { margin-top: 4px; color: #667085; font-size: 13px; }
.dashboard-campaigns .button-secondary { min-height: 45px; padding-inline: 20px; border-color: #0b67f6; color: #0b67f6; font-size: 14px; font-weight: 600; }
.dashboard-campaigns table { min-width: 680px; }
.dashboard-campaigns th { padding: 15px 24px; border-top: 1px solid #dce3ec; background: #fbfcfe; color: #172033; font-size: 13px; font-weight: 600; }
.dashboard-campaigns td { padding: 18px 24px; color: #40506a; font-size: 13px; }
.dashboard-campaigns td a { color: #0b67f6; }

@media (min-width: 821px) {
    .app-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}

@media (max-width: 1220px) {
    .dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
    .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
    .app-sidebar { width: min(86vw, 310px); }
    .dashboard-hero { min-height: 220px; padding: 26px; }
}
@media (max-width: 600px) {
    .dashboard-page { gap: 18px; }
    .dashboard-hero { min-height: 0; gap: 24px; padding: 22px 18px; }
    .dashboard-hero-actions { display: grid; }
    .dashboard-provider-status { width: 100%; font-size: 13px; }
    .dashboard-create-button { width: 100%; }
    .dashboard-metrics { grid-template-columns: 1fr; gap: 12px; }
    .dashboard-stat-card { min-height: 132px; padding: 20px; }
    .dashboard-campaigns .dashboard-section-heading { min-height: 0; padding: 20px; }
    .dashboard-campaigns .dashboard-section-heading .button { width: 100%; }
    .contacts-bulk-bar { align-items: stretch; flex-direction: column; }
}
