/* Shared controls and data tables. Loaded after page-specific styles. */
:root {
  --control-radius: 14px;
  --radius: 20px;
  --control-height: 42px;
  --table-heading: #f5f8f7;
  --table-hover: #f0f8f5;
}

.button,
.page :is(.wa-action-button, .wa-tool-button, .wa-table-action, .wa-table-open) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  min-width: 0;
  max-width: 100%;
  padding: 10px 16px;
  border: 1px solid #d7e2dd;
  border-radius: var(--control-radius);
  background: linear-gradient(145deg, #fff, #f2f7f4);
  color: #334b41;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(20, 45, 34, .04);
  cursor: pointer;
  transition: transform .18s cubic-bezier(.2, .65, .3, 1), border-color .16s ease, box-shadow .18s ease;
}

.button:hover,
.page :is(.wa-action-button, .wa-tool-button, .wa-table-action, .wa-table-open):hover {
  transform: none;
  filter: none;
  background: linear-gradient(145deg, #fff, #f2f7f4);
  border-color: #b8cfc3;
  color: #174b38;
  text-decoration: none;
}

.button:active,
.page :is(.wa-action-button, .wa-tool-button, .wa-table-action, .wa-table-open):active {
  box-shadow: inset 0 1px 3px rgba(20, 45, 34, .12);
}

.button-primary,
.page :is(.wa-action-button, .wa-tool-button, .wa-table-action).primary {
  background: linear-gradient(135deg, #145d54, #1b675c);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(15, 118, 110, .13);
}

.button-primary:hover,
.page :is(.wa-action-button, .wa-tool-button, .wa-table-action).primary:hover {
  background: linear-gradient(135deg, #145d54, #1b675c);
  border-color: var(--primary-dark);
  color: #fff;
  box-shadow: 0 3px 9px rgba(15, 118, 110, .24);
}

.button-ghost { background: transparent; box-shadow: none; }
.sidebar .button-ghost { border-color: rgba(255, 255, 255, .14); color: var(--sidebar-text); }
.button-success { background: linear-gradient(135deg, #1d5c3e, #246a49); border-color: #207349; color: #fff; }
.button-success:hover { background: linear-gradient(135deg, #1d5c3e, #246a49); border-color: #175b38; color: #fff; box-shadow: 0 3px 9px rgba(24, 96, 62, .22); }
.button-danger,
.page .wa-table-action.danger { background: linear-gradient(135deg, #fff7f6, #fce9e6); border-color: #f2d3cf; color: #ac3930; }
.button-danger:hover,
.page .wa-table-action.danger:hover { background: linear-gradient(135deg, #fff7f6, #fce9e6); border-color: #e8b3ac; color: #8c2e27; }

.button-small,
.page :is(.wa-table-action, .wa-table-open) {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
}
.button-wide { width: 100%; }
.button > .fa-solid { flex: 0 0 auto; font-size: .95em; }

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .button:not(:disabled):not([aria-disabled="true"]):hover:not(:active),
  .page :is(.wa-action-button, .wa-tool-button, .wa-table-action, .wa-table-open):not(:disabled):not([aria-disabled="true"]):hover:not(:active) {
    transform: scale(1.035);
    box-shadow: 0 8px 18px -5px rgba(20, 55, 39, .3), 0 3px 6px rgba(20, 55, 39, .1);
  }
}

.button:focus-visible,
.page :is(.wa-action-button, .wa-tool-button, .wa-table-action, .wa-table-open):focus-visible {
  outline: 3px solid rgba(15, 118, 110, .45);
  outline-offset: 3px;
}

.button:disabled,
.button[aria-disabled="true"],
.page :is(.wa-action-button, .wa-tool-button, .wa-table-action, .wa-table-open):disabled {
  opacity: .48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.table-panel,
.page .wa-inbox-table {
  min-width: 0;
  overflow-x: auto;
  margin-bottom: 22px;
  border: 1px solid #dfe8e3;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(20, 45, 34, .035);
  scrollbar-width: thin;
  scrollbar-color: #c0d2c7 transparent;
}

.table-panel .panel-header {
  min-width: 0;
  padding: 18px 20px;
  margin: 0;
  border-bottom: 1px solid #e7eee9;
}
.table-panel > .muted { margin: 0; padding: 12px 20px; font-size: 13px; }
.table-panel .panel-header h2 { font-size: 16px; }

table,
.page :is(.wa-inbox-table, .wa-mini-table) table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.5;
}

th, td,
.page :is(.wa-inbox-table, .wa-mini-table) :is(th, td) {
  padding: 15px 18px;
  border-bottom: 1px solid #edf1ee;
  text-align: left;
  vertical-align: middle;
}

th,
.page :is(.wa-inbox-table, .wa-mini-table) th {
  background: var(--table-heading);
  color: #64766c;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}

td { color: #485b50; }
.page .wa-mini-table table { min-width: 0; }
td strong { color: #233d30; font-weight: 600; }
td small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.45; }
.table-identity { min-width: 180px; }
tbody tr:last-child > td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fcfdfc; }
tbody tr:hover,
.page :is(.wa-inbox-table, .wa-mini-table) tbody tr:hover { background: var(--table-hover); }
tbody tr:focus-within { background: var(--table-hover); }

.table-actions { gap: 7px; align-items: center; }
.table-actions-cell { min-width: 150px; }
.table-actions-cell .table-actions { min-width: 170px; max-width: 240px; }
.table-actions-cell .button { text-wrap: pretty; }
.table-panel .status-pill,
.table-panel .priority-pill { min-height: 25px; padding: 4px 9px; font-size: 11px; }

.empty-cell,
.page .wa-inbox-table .empty-cell {
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  font-size: 14px;
}
.table-panel > .empty { padding: 36px 24px; text-align: center; }

/* Keep WhatsApp row controls compact without changing status menus or chat tools. */
.page .wa-row-actions { gap: 7px; }
.page .wa-actions-cell .wa-row-actions { flex-wrap: wrap; width: auto; min-width: 180px; max-width: 280px; }
.page .wa-contact-table :is(th, td):last-child { min-width: 200px; }
.page .wa-actions-cell { min-width: 200px; white-space: normal; }

@media (max-width: 820px) {
  th, td,
  .page :is(.wa-inbox-table, .wa-mini-table) :is(th, td) { padding: 13px 14px; }
  .table-panel .panel-header { padding: 16px; flex-wrap: wrap; gap: 10px; }
  .page :is(.wa-action-button, .wa-tool-button) { min-height: 42px; font-size: 13px; padding: 9px 13px; }
}

@media (pointer: coarse) {
  .button-small,
  .page :is(.wa-table-action, .wa-table-open) { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .page :is(.wa-action-button, .wa-tool-button, .wa-table-action, .wa-table-open) { transition: none; }
}

/* One motion language for native dialogs, import overlays, and disclosures. */
details.is-animating { overflow: hidden; will-change: height; }
.ui-chevron {
  flex: 0 0 auto;
  width: 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  transition: transform .24s cubic-bezier(.22, 1, .36, 1);
}
details[open] > summary:not([aria-expanded]) .ui-chevron,
details > summary[aria-expanded="true"] .ui-chevron { transform: rotate(180deg); }
.disclosure-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  list-style: none;
}
.disclosure-panel > summary::-webkit-details-marker { display: none; }
.disclosure-panel > summary::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 11px;
  transition: transform .24s cubic-bezier(.22, 1, .36, 1);
}
.disclosure-panel[open] > summary:not([aria-expanded])::after,
.disclosure-panel > summary[aria-expanded="true"]::after { transform: rotate(180deg); }

dialog.modal-dialog {
  max-height: 86vh;
  max-height: 86dvh;
  overflow: auto;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 35, 27, .24);
}
.modal-dialog .modal-content { border: 0; border-radius: inherit; box-shadow: none; padding: 24px; }
.modal-dialog[open]::backdrop { animation: ui-backdrop-in .23s ease both; backdrop-filter: blur(3px); }
.modal-dialog.is-closing::backdrop { animation: ui-backdrop-out .17s ease both; }
.wa-import-modal:not([hidden]) .wa-import-backdrop { animation: ui-backdrop-in .23s ease both; }
.wa-import-modal.is-closing .wa-import-backdrop { animation: ui-backdrop-out .17s ease both; }
.page .wa-compose > .fa-solid { height: auto; border: 0; border-radius: 0; background: transparent; color: #0877ff; font-size: 18px; text-align: center; }
.page :is(.wa-action-button, .wa-tool-button, .wa-import-titlebar button) > .fa-solid { flex: 0 0 auto; width: 18px; text-align: center; }
.page .wa-sample-title > .fa-circle-info { color: var(--muted); font-size: 13px; margin-left: 6px; }
.page .wa-tool-button.is-muted { color: #96a79c; box-shadow: none; }

@keyframes ui-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ui-chevron, .disclosure-panel > summary::after { transition: none; }
  .modal-dialog[open]::backdrop,
  .wa-import-modal:not([hidden]) .wa-import-backdrop { animation: none; }
}

/* Rounded workspace surfaces, compact approvals, and a mobile navigation drawer. */
body { font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif; font-size: 14px; line-height: 1.6; letter-spacing: -.01em; }
h1, h2, h3 { letter-spacing: -.025em; }
.page :is(.panel, .metric-card, .form-section, .form-card, .filter-panel, .auth-panel, .ai-setup-card, .disclosure-panel, .workflow-strip, .wa-contact-create-panel, .wa-setting-card, .wa-broadcast-card, .wa-dashboard-panel, .wa-step) { border-radius: 22px; }
.page :is(.form-control, .wa-contact-form input, .wa-contact-form select) { border-radius: 12px; }
.page .filter-panel { padding: 20px; gap: 16px; background: linear-gradient(145deg, #fff, #f7faf8); box-shadow: 0 3px 14px rgba(24, 55, 39, .035); }
.filter-panel label { font-size: 12px; font-weight: 600; color: #53695c; gap: 7px; }
.filter-panel .form-control { min-height: 44px; background: #fff; font-size: 14px; font-weight: 400; }
.filter-actions { gap: 8px; }
.workspace-tabs { display: inline-flex; flex-wrap: wrap; align-items: center; justify-self: start; width: fit-content; min-width: 0; max-width: 100%; gap: 5px; padding: 6px; margin: 0 0 24px; border: 1px solid #e0e9e3; border-radius: 18px; background: #edf3ef; }
.workspace-tabs > :is(a, button) { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 18px; border: 0; border-radius: 13px; background: transparent; color: #5c7063; font: inherit; font-size: 13px; font-weight: 600; line-height: 1.4; text-align: center; text-decoration: none; cursor: pointer; transition: background-color .18s, color .18s, box-shadow .18s; }
.workspace-tabs > :is(a, button):hover { background: #fff; color: #245340; }
.workspace-tabs > :is(a, button):is([aria-current="page"], [aria-current="location"], [aria-selected="true"], .active) { background: linear-gradient(125deg, #fff, #f8fdfa); color: #145d48; box-shadow: 0 2px 7px rgba(23, 65, 44, .09); }
.workspace-tabs > :is(a, button):focus-visible { outline: 3px solid rgba(15, 118, 110, .4); outline-offset: 2px; }
.workspace-tabs > button:disabled { opacity: .5; cursor: not-allowed; }
.approval-icon-button { gap: 9px; min-width: 82px; }
.approval-icon-button .fa-whatsapp { font-size: 17px; }
.approval-icon-button .fa-arrow-right { font-size: 10px; opacity: .8; }
.reject-icon-button { width: 36px; padding: 7px; }
.sidebar-footer .button-primary,
.sidebar-footer .button-primary:hover { background: linear-gradient(135deg, #245c47, #2b6650); border-color: #3d7b62; color: #f5fff9; }
.mobile-nav-toggle, .mobile-sidebar-close { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 45; border: 0; background: rgba(13, 30, 24, .45); backdrop-filter: blur(3px); opacity: 1; transition: opacity .24s ease, visibility .24s ease; }
.sidebar-backdrop[hidden] { display: block; opacity: 0; visibility: hidden; pointer-events: none; }
@media (max-width: 980px) {
  .sidebar { position: fixed; z-index: 50; inset: 12px auto 12px 12px; width: min(292px, calc(100vw - 24px)); height: calc(100vh - 24px); height: calc(100dvh - 24px); margin: 0; padding: 26px 18px 18px; border-radius: 24px; transform: translateX(calc(-100% - 28px)); visibility: hidden; transition: transform .26s cubic-bezier(.22, 1, .36, 1), visibility .26s; }
  .sidebar-open .sidebar { transform: translateX(0); visibility: visible; }
  body.sidebar-open { overflow: hidden; }
  .sidebar > .brand { display: inline-flex; padding-right: 28px; }
  .sidebar .sidebar-footer { display: grid; }
  .sidebar .sidebar-nav { display: grid; gap: 5px; overflow: visible; }
  .sidebar .sidebar-nav .nav-divider { display: block; }
  .sidebar .nav-item { min-height: 48px; }
  .sidebar .nav-section-links { padding-left: 18px; }
  .mobile-topbar { flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; }
  .mobile-topbar > .brand { flex: 1; }
  .mobile-topbar > .button { min-height: 40px; padding: 8px 12px; font-size: 12px; }
  .mobile-nav-toggle, .mobile-sidebar-close { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 40px; width: 40px; height: 40px; padding: 0; border: 1px solid #dce7df; border-radius: 13px; background: #fff; color: #1c5340; cursor: pointer; }
  .mobile-sidebar-close { position: absolute; top: 18px; right: 12px; width: 32px; height: 32px; border: 0; background: rgba(255,255,255,.07); color: #e6f4ed; }
}
@media (max-width: 560px) {
  .workspace-tabs { display: flex; }
  .workspace-tabs > :is(a, button) { flex: 1 1 130px; padding: 8px 12px; }
  .mobile-topbar .brand small { display: none; }
  .mobile-topbar .brand strong { font-size: 13px; }
  .mobile-topbar .brand-mark { width: 32px; height: 32px; }
  .page .filter-panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-backdrop, .workspace-tabs > :is(a, button) { transition: none; }
}
.page .filter-panel { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); align-items: end; }
.wa-inbox-toolbar .wa-inbox-state-filter { flex: 0 1 220px; width: min(100%, 220px); min-height: 46px; }
@media (max-width: 560px) { .wa-inbox-toolbar .wa-inbox-state-filter { flex-basis: 100%; width: 100%; } }

/* Compliance forms include both Django-rendered and handwritten controls. */
.compliance-form { min-width: 0; }
.compliance-form > p { display: grid; gap: 7px; margin: 0; }
.compliance-form label { display: grid; gap: 7px; color: #425c4e; font-size: 13px; font-weight: 600; }
.compliance-form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
}
.compliance-form :is(input, select, textarea):focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .14); }
.compliance-form textarea { min-height: 100px; max-height: 320px; resize: vertical; }
.compliance-form > p:has(> input[type="checkbox"]) { display: flex; align-items: center; gap: 10px; }
.compliance-form > p:has(> input[type="checkbox"]) label { display: block; margin: 0; }
.compliance-form input:is([type="checkbox"], [type="radio"]) { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.compliance-form > p > input[type="checkbox"] { order: -1; }
.compliance-form .helptext { color: var(--muted); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.compliance-form.stacked-form > .button { justify-self: start; }
@media (max-width: 980px) { .compliance-form :is(input, select, textarea) { font-size: 16px; } }
.table-actions-cell .approval-actions { min-width: 0; max-width: none; flex-wrap: nowrap; }
.category-match { color: #177054; }
@media (max-width: 980px) {
  .page :is(input, select, textarea).form-control { font-size: 16px; }
}
@media (max-width: 560px) { .page .filter-panel { grid-template-columns: 1fr; } }

/* Compact WhatsApp administration, consistent with the main workspace. */
.page :is(.wa-broadcast-card, .wa-admin-create, .wa-preferences-card) {
  border: 1px solid #dfe8e3;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 3px 14px rgba(24, 55, 39, .035);
}
.page .wa-broadcast-card { padding: 22px; gap: 18px; margin-bottom: 20px; }
.page .wa-broadcast-card-title h2 { font-size: 16px; }
.page .wa-broadcast-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; }
.page .wa-broadcast-grid :is(input, select) { min-height: 42px; font-size: 14px; padding: 9px 12px; border-radius: 12px; border-color: #d7e2dd; }
.page .wa-broadcast-grid label span,
.page .wa-broadcast-grid .wa-broadcast-field > span { font-size: 13px; }
.page .wa-broadcast-actions { gap: 10px; }
.page .wa-broadcast-actions :is(.button, .wa-action-button) { min-width: 0; }
.page .wa-import-open { min-height: 42px; padding: 9px 12px; border-radius: 12px; }
.page .wa-import-open strong { font-size: 14px; }
.page .wa-import-open small { font-size: 12px; }
.page .wa-broadcast-toolbar { margin: 0 0 16px; }
.page .wa-field-error { font-size: 13px; color: #ac3930; }
.page :is(.wa-admin-create, .wa-preferences-form) label > span { font-size: 13px; font-weight: 600; color: #425c4e; }
.wa-admin-create { padding: 20px; margin-bottom: 20px; }
.wa-admin-create label { display: grid; gap: 7px; min-width: 0; }
.wa-tag-editor { display: flex; align-items: end; gap: 12px; }
.wa-tag-editor > label { flex: 0 1 360px; }
.wa-admin-create-heading { margin-bottom: 16px; }
.wa-admin-create-heading h2 { margin: 0 0 4px; font-size: 16px; }
.wa-admin-create-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.wa-status-editor-fields { display: grid; grid-template-columns: minmax(160px, 1.2fr) minmax(160px, 1fr) 70px auto; align-items: end; gap: 16px; max-width: 960px; }
.page .wa-status-editor .wa-color-input { width: 100%; height: 42px; min-height: 42px; padding: 4px; border: 1px solid #d7e2dd; border-radius: 12px; cursor: pointer; }
.wa-admin-search { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.wa-admin-search .wa-search-field { flex: 0 1 320px; width: auto; }
.page :is(.wa-admin-search, .wa-broadcast-toolbar) .wa-search-field { min-width: 0; min-height: 42px; padding: 0 12px; border-radius: 12px; }
.page :is(.wa-admin-search, .wa-broadcast-toolbar) .wa-search-field input { min-width: 0; min-height: 42px; font-size: 14px; width: 100%; }
.page .wa-search-field-icon { border-radius: 999px; padding: 0 18px; }
.wa-search-field-icon > .fa-magnifying-glass { flex: 0 0 18px; color: #65796c; font-size: 15px; text-align: center; }
.wa-search-field-icon input { min-width: 0; border-radius: inherit; }
.page .wa-status-table table { min-width: 600px; }
.page .wa-status-table :is(th, td):first-child { width: auto; min-width: 200px; }
.page .wa-status-identity { display: inline-flex; gap: 10px; align-items: center; }
.page .wa-status-color-dot { flex: 0 0 12px; width: 12px; height: 12px; border: 1px solid rgba(0,0,0,.12); margin: 0; }
.wa-preferences-card { max-width: 760px; overflow: hidden; }
.wa-preferences-form { display: grid; }
.wa-preferences-heading { display: flex; gap: 14px; align-items: center; padding: 22px; background: #f7fbf9; }
.wa-preferences-icon { display: grid; place-items: center; flex: 0 0 40px; height: 40px; border-radius: 13px; background: #dff3e9; color: #176249; font-size: 24px; }
.wa-preferences-form h2 { margin: 0 0 4px; font-size: 16px; }
.wa-preferences-form p { margin: 0; font-size: 13px; color: var(--muted); }
.wa-preference-row { padding: 0 22px; }
.wa-preference-toggle { display: flex; gap: 20px; justify-content: space-between; align-items: center; padding: 20px 0; border-bottom: 1px solid #e7eee9; cursor: pointer; }
.wa-preference-toggle strong { display: block; color: #233d30; font-size: 14px; }
.wa-preference-toggle small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 4px; }
.wa-preference-toggle input { appearance: none; flex: 0 0 42px; width: 42px; height: 24px; margin: 0; padding: 0; border: 1px solid #b5c8bc; border-radius: 20px; background: #d9e4de; cursor: pointer; position: relative; }
.wa-preference-toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0002; transition: transform .16s ease; }
.wa-preference-toggle input:checked { background: #14765c; border-color: #14765c; }
.wa-preference-toggle input:checked::after { transform: translateX(18px); }
.wa-preference-toggle input:focus-visible { outline: 3px solid #9dd3bb; outline-offset: 3px; }
.wa-preference-timing { display: grid; grid-template-columns: 1fr 160px; align-items: center; gap: 24px; padding: 22px; }
.wa-preference-timing label { display: grid; gap: 7px; }
.wa-preferences-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 22px; border-top: 1px solid #e7eee9; background: #fbfdfc; }
.wa-preferences-form .errorlist { margin: 4px 22px; color: #ac3930; }
.page .wa-dashboard-header { align-items: center; }
.page .wa-dashboard-header h1 { font-size: 28px; }
.page .wa-dashboard-header p:not(.eyebrow) { font-size: 14px; }
.page .wa-dashboard-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 20px 0; }
.page .wa-metric-card { min-height: 118px; padding: 18px; border-radius: 18px; gap: 10px; }
.page .wa-metric-card strong { font-size: 30px; }
.page .wa-metric-card :is(span, small) { font-size: 13px; }
.page .wa-dashboard-panel { min-width: 0; border-radius: 18px; }
.page .wa-panel-heading { padding: 16px 18px; gap: 12px; }
.page .wa-panel-heading h2 { font-size: 15px; }
.page :is(.wa-stat-list, .wa-breakdown-list) div { padding: 14px 18px; gap: 12px; font-size: 13px; }
.page :is(.wa-stat-list, .wa-breakdown-list) strong { font-size: 20px; }
@media (max-width: 1100px) {
  .wa-status-editor-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .wa-status-color-field { max-width: 100px; }
  .page .wa-dashboard-panels { grid-template-columns: 1fr 1fr; }
  .page .wa-dashboard-panel-wide { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .page .wa-broadcast-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page .wa-dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page .wa-dashboard-panels { grid-template-columns: 1fr; }
  .wa-tag-editor { flex-wrap: wrap; }
  .wa-tag-editor > label { flex: 1 1 100%; }
  .wa-preference-timing { grid-template-columns: 1fr; gap: 16px; }
  .wa-preference-timing label { max-width: 220px; }
  .page :is(.wa-broadcast-card, .wa-admin-create) { padding: 18px; }
  .page :is(.wa-admin-create, .wa-admin-search, .wa-broadcast-grid) :is(input:not([type="color"]), select) { font-size: 16px; }
}
@media (max-width: 480px) {
  .page .wa-broadcast-grid, .wa-status-editor-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .wa-preference-toggle input::after { transition: none; } }

.wa-delivery-help { padding: 9px 18px; margin: 0; font-size: 12px; color: #53695c; background: #f4f9f6; border-bottom: 1px solid #e0e9e3; }
.page .wa-message-bubble .wa-delivery-error { font-size: 12px; color: #8c2e27; border-top: 1px solid #e6cbc5; padding-top: 8px; margin-top: 8px; }
.wa-message-bubble [data-retry-form] { margin-top: 8px; }
.wa-message-bubble [hidden] { display: none; }
.page .wa-chat-panel { grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; }

/* Keep separate card sections clear without adding space inside card grids. */
.page > :is(.panel, .table-panel, .detail-grid, .grouped-sections) + :is(.panel, .table-panel, .detail-grid, .grouped-sections),
[data-lead-results] > .archive-controls + .grouped-sections { margin-top: 20px; }
.raw-lead-pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.list-search-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.list-search-status [hidden] { display: none; }
.raw-category-action { padding: 12px 20px; border-bottom: 1px solid var(--line); }
.bulk-approval-progress { margin-bottom: 20px; }
.bulk-approval-run + .bulk-approval-run { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.bulk-approval-run small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.discovered-category-dialog { width: min(680px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); }
.discovered-category-group { min-width: 0; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.discovered-category-group legend { padding: 0 6px; font-weight: 600; }
.discovered-category-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.status-pro_qualified { background: #def3e8; color: #145d48; }
.wa-delivery-status.unknown, .wa-delivery-status.local { color: #85641e; }
.wa-delivery-status.failed { color: #9f342a; }
.wa-delivery-status.delivered, .wa-delivery-status.read { color: #11684e; }
.wa-lead-delivery { margin-bottom: 22px; }
.wa-lead-delivery-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid #e4ede7; padding: 14px 0; }
.wa-lead-delivery-row small { display: block; color: var(--muted); margin-top: 4px; }
.wa-delivery-error { color: #9f342a; font-size: 13px; overflow-wrap: anywhere; }
.wa-health-panel { max-width: 760px; margin-bottom: 20px; padding: 20px 22px; border: 1px solid #dfe8e3; border-radius: 20px; background: #fff; }
.wa-health-panel h2 { margin: 0 0 12px; font-size: 16px; }
.wa-health-panel dl { margin: 0; }
.wa-health-panel dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 13px; }
.wa-health-panel dt { color: var(--muted); }
.wa-health-panel dd { margin: 0; text-align: right; }
@media (max-width: 560px) { .wa-lead-delivery-row { flex-wrap: wrap; } }

.sidebar,
.sidebar-nav,
.app-shell:has(.wa-chat-page) .sidebar-nav { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.app-shell:has(.wa-chat-page) .sidebar-nav::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Compact contact creation and aligned actions. */
.page .wa-contact-create-panel { max-width: 800px; padding: 22px; margin-bottom: 22px; background: #fff; border: 1px solid #dfe8e3; box-shadow: 0 3px 14px rgba(24, 55, 39, .035); }
.wa-contact-form { display: grid; gap: 22px; }
.wa-contact-section { min-width: 0; margin: 0; padding: 0; border: 0; }
.wa-contact-section legend { padding: 0; margin-bottom: 14px; color: #274a39; font-size: 14px; font-weight: 600; }
.wa-contact-section legend i { margin-right: 8px; color: #47765d; }
.wa-contact-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.wa-contact-form-grid > label { display: grid; min-width: 0; gap: 7px; color: #425c4e; font-size: 13px; font-weight: 600; }
.wa-contact-form-grid label > span { display: flex; align-items: center; gap: 5px; }
.wa-contact-form-grid label small { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.wa-contact-section sup { color: #b5483d; }
.page .wa-contact-form .form-control { min-width: 0; width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #d7e2dd; border-radius: 12px; background: #fff; color: #233d30; font: inherit; font-size: 14px; font-weight: 400; }
.page .wa-contact-form .form-control:focus { border-color: #65a98c; box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); outline: none; }
.wa-contact-phone-field { display: grid; grid-column: 1 / -1; gap: 7px; width: 100%; max-width: 420px; min-width: 0; }
.wa-contact-phone-field > label { display: inline-flex; flex-direction: row; align-items: baseline; gap: 4px; color: #425c4e; font-size: 13px; font-weight: 600; }
.wa-contact-form .wa-phone-input { display: grid; align-items: center; grid-template-columns: 42px 78px minmax(0, 1fr); width: 100%; min-width: 0; overflow: hidden; border: 1px solid #d7e2dd; border-radius: 12px; background: #fff; }
.page .wa-contact-form .wa-phone-input .form-control { min-height: 42px; border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: 9px 10px; }
.page .wa-contact-form .wa-phone-input input { border-left: 1px solid #e4ede7; }
.wa-contact-form .wa-phone-input:focus-within { border-color: #65a98c; box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.wa-country-prefix { display: grid; place-items: center; }
.wa-country-prefix .wa-country-flag { display: none; width: 27px; height: 18px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(30, 50, 40, .12); object-fit: contain; }
.wa-country-prefix .wa-country-globe { color: #65796c; font-size: 17px; }
.has-indian-number .wa-country-prefix .wa-country-flag { display: block; }
.has-indian-number .wa-country-prefix .wa-country-globe { display: none; }
.wa-contact-form .wa-form-actions { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 18px; border-top: 1px solid #e7eee9; }
.page .wa-contact-form .wa-form-actions .button { width: auto; min-width: 104px; min-height: 42px; padding: 10px 16px; border-radius: 14px; }
.page .wa-contact-form .wa-contact-cancel { border-color: #d7e2dd; background: #f7faf8; color: #425c4e; }
.page .wa-contact-form .wa-contact-cancel:hover { border-color: #aec9ba; background: #f7faf8; color: #274a39; }
.wa-contact-form .errorlist { list-style: none; padding: 0; margin: 0; color: #ac3930; font-size: 12px; font-weight: 400; }
@media (max-width: 980px) { .page .wa-contact-form .form-control { font-size: 16px; } }
@media (max-width: 560px) {
  .page .wa-contact-create-panel { padding: 18px; }
  .wa-contact-form-grid { grid-template-columns: 1fr; }
  .wa-contact-phone-field { max-width: none; }
  .page .wa-contact-form .wa-form-actions .button { flex: 1 1 130px; }
}

/* Application branding */
.button-primary, .button-primary:hover,
.page :is(.wa-action-button, .wa-tool-button, .wa-table-action).primary,
.page :is(.wa-action-button, .wa-tool-button, .wa-table-action).primary:hover,
.sidebar-footer .button-primary, .sidebar-footer .button-primary:hover {
  background: var(--brand-gradient, linear-gradient(135deg, #145d54, #1b675c));
  border-color: var(--brand-color-start, #145d54);
  color: var(--brand-text, #fff);
}
.app-brand-logo { display: block; flex: 0 0 40px; width: 40px; height: 40px; object-fit: contain; border-radius: 10px; }
.app-brand-copy { min-width: 0; overflow-wrap: anywhere; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin: 12px 0; color: #233d30; }
.auth-brand strong { display: block; font-size: 24px; line-height: 1.3; }
.auth-brand small { display: block; color: var(--muted); margin-top: 4px; }
.sidebar .brand-mark, .auth-brand .brand-mark { background: var(--brand-gradient); color: var(--brand-text); }
@media (max-width: 560px) { .mobile-topbar .app-brand-logo { width: 32px; height: 32px; flex-basis: 32px; } }
.ai-model-picker { max-height: 440px; overflow: auto; }
.ai-model-picker thead { position: sticky; top: 0; z-index: 1; }
.inbox-unread-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; padding: 2px 6px; border-radius: 99px; background: #c93640; color: #fff; font-size: 11px; font-weight: 700; }
.inbox-unread-badge[hidden] { display: none; }
.wa-read-controls { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.raw-bulk-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border: 1px solid #fff9; border-radius: 22px; background: #f4faf5c9; backdrop-filter: blur(18px); box-shadow: 0 8px 35px #163c3226; max-width: calc(100vw - 20px); }
.raw-bulk-bar[hidden] { display: none; }
