:root {
  /* Design tokens: one visual source of truth for the operational UI. */
  --ink: #1c2840;
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --muted: #5e6c82;
  --muted-subtle: #6f7b88;
  --line: #e5eaf2;
  --border: #d7dfeb;
  --charcoal: #1d252b;
  --primary: #315fe9;
  --primary-hover: #244dc9;
  --primary-active: #213f9f;
  --primary-soft: #edf2ff;
  --secondary: #1d252b;
  --success: #287457;
  --success-soft: #edf8f2;
  --warning: #956017;
  --warning-soft: #fff9e9;
  --error: #b34143;
  --error-soft: #fff0ed;
  --info: #315fe9;
  --info-soft: #edf2ff;
  --focus: #315fe9;
  --disabled-bg: #eef0f2;
  --disabled-text: #6f7b88;

  /* Compatibility aliases for existing components. */
  --coral: var(--primary);
  --coral-dark: var(--primary-hover);
  --coral-soft: var(--primary-soft);
  --blue: var(--info);
  --blue-soft: var(--info-soft);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius-control: 8px;
  --radius-surface: 12px;
  --control-height: 42px;
  --filter-control-height: var(--control-height);
  --filter-radius: var(--radius-control);
  --shadow-floating: 0 12px 28px rgba(27, 35, 41, 0.12);
  --shadow-dialog: 0 24px 60px rgba(22, 31, 38, 0.22);
  --shadow: var(--shadow-floating);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.is-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.system-shell {
  max-width: 1180px;
}

.system-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-4);
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
  box-shadow: none;
}

.system-overview.is-healthy {
  border-color: #bfe4d0;
  background: var(--success-soft);
}

.system-overview.is-warning {
  border-color: #edcf90;
  background: var(--warning-soft);
}

.system-overview-main {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: var(--space-3);
}

.system-status-badge,
.system-state-label {
  display: inline-flex;
  width: max-content;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.system-status-badge.is-ok,
.system-state-label.is-ok {
  border-color: #bfe4d0;
  background: var(--success-soft);
  color: var(--success);
}

.system-status-badge.is-attention,
.system-state-label.is-attention {
  border-color: #edcf90;
  background: var(--warning-soft);
  color: var(--warning);
}

.system-status-badge.is-neutral,
.system-state-label.is-neutral {
  border-color: var(--border);
  background: #f6f7f8;
  color: #59636c;
}

.system-overview strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.015em;
}

.system-overview p,
.system-metric p,
.system-section-heading p,
.system-check-row p,
.system-diagnostics > p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.system-overview-meta {
  display: grid;
  flex: 0 0 auto;
  gap: 3px;
  text-align: right;
}

.system-overview-meta span,
.system-overview-meta time {
  color: var(--muted);
  font-size: 12px;
}

.system-overview-meta time {
  color: var(--ink);
  font-weight: 700;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.system-metric {
  min-height: 148px;
  padding: 18px;
  box-shadow: none;
}

.system-metric > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.system-metric > strong {
  display: block;
  margin-top: 14px;
  font-size: 30px;
  letter-spacing: -0.035em;
}

.system-metric-date > strong {
  font-size: 17px;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.system-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  margin-bottom: var(--space-3);
}

.system-monitoring > .system-grid > .content-card,
.system-monitoring > .system-workspace > .content-card {
  margin-top: 0;
}

.system-monitoring > .system-diagnostics {
  margin-top: 0;
}

.system-workspace > .content-card {
  padding: 20px;
  box-shadow: none;
}

.system-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.system-section-heading h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.015em;
}

.system-section-heading .button {
  flex: 0 0 auto;
}

.system-issues-list {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  margin: 0;
  list-style: none;
}

.system-issue {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.system-issue strong {
  display: block;
  font-size: 13px;
}

.system-issue p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.system-issue a {
  flex: 0 0 auto;
  color: var(--primary-hover);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.system-issue a:hover,
.system-issue a:focus-visible {
  color: var(--primary-active);
  text-decoration: underline;
}

.system-issue.is-clear strong {
  color: var(--success);
}

.system-checks {
  display: grid;
}

.system-check-row {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.system-check-row strong {
  font-size: 13px;
}

.system-diagnostics {
  margin-bottom: var(--space-6);
  padding: 0;
  box-shadow: none;
}

.system-diagnostics summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
}

.system-diagnostics > p,
.system-diagnostics-grid {
  margin-right: 20px;
  margin-left: 20px;
}

.system-diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  padding: 16px 0 20px;
  margin-top: 12px;
  margin-bottom: 0;
  border-top: 1px solid var(--line);
}

.system-diagnostics-grid div {
  min-width: 0;
}

.system-diagnostics-grid dt {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.system-diagnostics-grid dd {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

.system-note {
  margin: 16px 0 0;
  color: var(--warning);
  font-size: 13px;
}

.system-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.blacklist-section {
  max-width: 1080px;
  margin-bottom: 32px;
}

.blacklist-heading h2 {
  margin: 4px 0 0;
}

.blacklist-description {
  max-width: 780px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.blacklist-phone-entry {
  margin-top: 20px;
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: #fafbfc;
}

.blacklist-phone-entry h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.blacklist-entry-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 350px);
  gap: 20px;
  align-items: start;
}

.blacklist-input-field,
.blacklist-rule-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
}

.blacklist-phone-entry textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.45;
}

.blacklist-input-field small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.blacklist-phone-entry .button {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 18px;
  border-radius: var(--radius-control);
  font-size: 15px;
  font-weight: 600;
}

.blacklist-phone-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.blacklist-phone-controls select {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.blacklist-rule-hint {
  min-height: 54px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.blacklist-status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid #bfe4d0;
  border-radius: var(--radius-surface);
  background: var(--success-soft);
}

.blacklist-status-icon {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
}

.blacklist-status-icon.is-warning {
  background: var(--warning);
}

.blacklist-status-card > div {
  min-width: 0;
}

.blacklist-status-card span:not(.blacklist-status-icon) {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.blacklist-status-card strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
}

.blacklist-status-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.blacklist-status-card .button {
  width: auto;
  margin-left: auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--coral-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  text-decoration: none;
  line-height: 1.25;
  min-height: var(--control-height);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-weight: 750;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled,
button:disabled {
  cursor: not-allowed;
  background: var(--disabled-bg);
  color: var(--disabled-text);
  opacity: 1;
}

.button:focus-visible,
button:focus-visible,
input:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(58, 99, 175, 0.38);
  outline-offset: 2px;
}

.button-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

.button-primary:hover {
  background: var(--primary-hover);
}

.button-primary:active:not(:disabled) {
  background: var(--primary-active);
}

.button-secondary {
  background: var(--secondary);
  color: #fff;
}

.button-quiet {
  min-height: 36px;
  background: #f1f2f3;
  color: #3b454d;
}

.button-danger {
  border-color: #efc5be;
  background: #fff4f1;
  color: #a23d2f;
}

.button-danger:active:not(:disabled) {
  border-color: #c8796d;
  background: #f8dcd5;
}

.button-danger:hover {
  border-color: #df9f94;
  background: #fce7e2;
}

.button-wide {
  width: 100%;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: var(--radius-surface);
  background: var(--primary);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  box-shadow: none;
}

.brand-mark-small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 20px;
  box-shadow: none;
}

.login-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: #1c242a;
}

.login-shell {
  display: grid;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 20px;
  place-items: center;
}

.login-card {
  width: min(100%, 430px);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
}

.login-card .brand-mark {
  margin-bottom: 28px;
}

.login-card h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 42px);
  letter-spacing: -0.04em;
}

.login-lead {
  margin: 12px 0 28px;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 18px;
}

.admin-login-extra {
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 12px 14px;
}

.admin-login-extra summary {
  color: #505a63;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.admin-login-extra[open] summary { margin-bottom: 12px; }

.login-form label,
.date-fields label {
  display: grid;
  gap: 7px;
  color: #505a63;
  font-size: 13px;
  font-weight: 750;
}

.login-form input,
.date-fields input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--ink);
}

.topbar-viewer {
  display: grid;
  gap: 0.1rem;
  padding: 0 0.5rem;
  text-align: right;
}

.topbar-viewer small { color: var(--muted); font-size: 0.75rem; }

.leader-access-section { margin-top: 1.5rem; }
.leader-access-heading { align-items: flex-start; margin-bottom: 1.25rem; }
.leader-access-heading p:last-child { max-width: 760px; margin-bottom: 0; color: var(--muted); }
.leaders-table td:first-child strong,
.leaders-table td:first-child small { display: block; }
.leaders-table td:first-child small { margin-top: 0.25rem; color: var(--muted); }
.leaders-table code { font-family: inherit; font-weight: 700; }
.leader-access-section .table-wrap { overflow: visible; }
.leader-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); min-width: 0; white-space: nowrap; }
.leader-access-section:not(.report-access-section) .leaders-table td:last-child {
  text-align: center;
  vertical-align: middle;
}
.leader-access-section:not(.report-access-section) .leaders-table td:last-child .leader-actions {
  justify-content: center;
}
.leader-actions-menu { position: relative; }
.leader-actions-menu > summary { list-style: none; }
.leader-actions-menu > summary::-webkit-details-marker { display: none; }
.leader-actions-menu > summary::after { content: "⌄"; margin-left: 6px; font-size: 0.9em; }
.leader-actions-menu[open] > summary::after { content: "⌃"; }
.leader-actions-menu-panel { position: absolute; z-index: 3; top: calc(100% + var(--space-2)); right: 0; display: grid; min-width: 208px; gap: var(--space-1); padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); box-shadow: var(--shadow-floating); }
.leader-actions-menu-panel .button { display: inline-flex; width: 100%; align-items: center; justify-content: flex-start; }
.leader-status { display: inline-flex; padding: 0.3rem 0.55rem; border-radius: 999px; background: #e9f8ef; color: #176b3a; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.leader-status.is-disabled,
.leader-status.is-bitrix_inactive { background: #f1f3f5; color: #59636e; }
.leader-status.is-pending_first_login { background: #fff4d6; color: #805b00; }

.report-access-section { padding: 24px; }
.report-access-section .leader-access-heading { margin-bottom: 20px; }
.report-access-section .leader-access-heading p:last-child { max-width: 780px; }
.report-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(180px, 0.8fr) minmax(200px, 0.9fr) auto;
  align-items: end;
  gap: var(--space-3);
  margin: 20px 0 10px;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: #fafbfb;
}
.report-filter-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}
.report-filter-field > span,
.report-form-field > span,
.report-request-source > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}
.report-filter-field input,
.report-filter-field select,
.report-form-field select {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}
.report-filter-field input::placeholder { color: var(--muted-subtle); }
.report-filter-bar > .button { min-height: var(--control-height); }
.report-results-summary {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.report-subsection { margin-top: 20px; }
.report-subsection + .report-subsection {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.report-subsection .leader-manager-heading { margin-bottom: 10px; }
.report-subsection .leader-manager-heading h3 { font-size: 18px; }
.report-subsection .leader-manager-heading p { max-width: 650px; }
.report-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.report-access-section .table-wrap { overflow-x: auto; }
.report-access-section .leaders-table { min-width: 760px; }
.report-access-section .leaders-table td { padding-top: 15px; padding-bottom: 15px; }
.report-access-section .leaders-table td:first-child strong,
.report-access-section .leaders-table td:first-child small { display: block; }
.report-access-section .leaders-table td:first-child small { margin-top: 3px; color: var(--muted); }
.report-access-section .report-request-table { min-width: 620px; }
.report-access-section .report-request-table td:last-child,
.report-access-section .report-subscription-table td:last-child { text-align: right; }
.report-access-section .report-subscription-table td:nth-child(3) { color: var(--muted); font-weight: 650; }
.report-telegram-handle { color: var(--ink); font-weight: 750; }
.report-telegram-missing { color: var(--muted-subtle); font-style: italic; font-weight: 600; }
.report-empty-cell { padding: 20px 16px; text-align: center !important; }
.report-empty-state { display: grid; justify-items: center; gap: 4px; }
.report-empty-state strong { color: var(--ink); font-size: 14px; }
.report-empty-state span { color: var(--muted); font-size: 12px; line-height: 1.4; }

.report-request-source {
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid #edcf90;
  border-radius: var(--radius-control);
  background: var(--warning-soft);
}
.report-request-source strong { font-size: 17px; }
.report-request-source small,
.report-form-field small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.report-form-field { display: grid; gap: 6px; font-weight: 700; }
.report-department-section { display: grid; gap: 12px; min-width: 0; }
.report-department-tools {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto;
  align-items: end;
  gap: var(--space-3);
}
.report-department-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.report-department-actions .button { min-height: var(--control-height); }
.report-department-list { max-height: 320px; overflow-x: hidden; }
.report-department-list .leader-manager-row {
  grid-template-columns: minmax(0, 1fr) auto;
  cursor: pointer;
}
.report-department-list .leader-manager-row:hover { background: var(--primary-soft); }
.report-department-list input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.dialog-modal.leader-dialog { width: min(920px, calc(100vw - 2rem)); }
.leader-dialog form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: min(86vh, 850px); overflow: hidden; }
.leader-dialog .dialog-header { padding: var(--space-5); }
.leader-dialog-body { display: grid; min-height: 0; gap: var(--space-4); overflow-y: auto; padding: var(--space-5); }
.leader-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.leader-form-grid label { display: grid; gap: var(--space-2); font-weight: 700; }
.leader-form-grid input,
.leader-form-grid select,
.leader-manager-search input,
.leader-manager-row select { width: 100%; min-height: var(--control-height); border: 1px solid var(--border); border-radius: var(--radius-control); background: #fff; padding: 0 var(--space-3); font: inherit; }
.leader-form-grid small { color: var(--muted); font-weight: 400; }
.leader-manager-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.leader-manager-heading h3,
.leader-manager-heading p { margin: 0; }
.leader-manager-heading p { margin-top: 0.25rem; color: var(--muted); }
.leader-manager-count { white-space: nowrap; }
.leader-manager-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-surface); }
.leader-manager-row { display: grid; grid-template-columns: minmax(220px, 1fr) 220px; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.leader-manager-row:last-child { border-bottom: 0; }
.leader-manager-row strong,
.leader-manager-row small { display: block; }
.leader-manager-row small { margin-top: 0.2rem; color: var(--muted); }
.leader-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-5); border-top: 1px solid var(--line); }
.credentials-dialog { width: min(560px, calc(100vw - 2rem)); }
.credentials-dialog > :not(.dialog-header) { margin-right: 26px; margin-left: 26px; }
.credentials-dialog > .dialog-actions { margin-bottom: 26px; }
.credentials-card { display: grid; grid-template-columns: 150px 1fr; gap: 0.75rem 1rem; margin: 1.25rem 0; padding: 1rem; border-radius: 12px; background: #f5f7fa; }
.credentials-card span { color: var(--muted); }
.credentials-card strong { overflow-wrap: anywhere; }
.admin-access-section .leader-actions { flex-wrap: wrap; }
.admin-mfa-status { display: block; margin-top: var(--space-2); color: var(--muted); }
.admin-dialog-body { display: grid; gap: var(--space-4); padding: var(--space-5); }
.admin-dialog-body p { margin: 0; color: var(--muted); }
.admin-dialog-body label { display: grid; gap: var(--space-2); font-weight: 700; }
.admin-dialog-body label small { color: var(--muted); font-weight: 400; }
.admin-dialog-body input { width: 100%; min-height: var(--control-height); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 0 var(--space-3); font: inherit; }
.admin-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-5); border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .report-access-section { padding: 16px; }
  .report-filter-bar { grid-template-columns: 1fr 1fr; }
  .report-filter-search { grid-column: 1 / -1; }
  .report-filter-bar > .button { width: 100%; }
  .report-department-tools { grid-template-columns: 1fr; }
  .report-department-actions { justify-content: flex-start; }
  .leader-dialog { width: calc(100vw - 1rem); max-height: 92vh; }
  .leader-dialog .dialog-header { padding: 16px; }
  .leader-dialog form { max-height: 92vh; }
  .leader-dialog-body { padding: var(--space-4); }
  .leader-dialog .dialog-actions { padding: var(--space-3) var(--space-4) var(--space-4); }
  .leader-form-grid { grid-template-columns: 1fr; }
  .leader-manager-heading { align-items: flex-start; flex-direction: column; }
  .leader-manager-row { grid-template-columns: 1fr; }
  .report-department-list .leader-manager-row { grid-template-columns: minmax(0, 1fr) auto; }
  .leader-access-section .table-wrap { overflow-x: auto; }
  .leader-actions { min-width: 0; justify-content: flex-start; }
  .topbar-viewer { display: none; }
}

.secure-note {
  margin: 22px 0 0;
  color: #9098a0;
  font-size: 12px;
  text-align: center;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1280px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand strong {
  font-size: 16px;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions form {
  margin: 0;
}

.topbar-nav-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: #f1f2f3;
  color: #3b454d;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: 150ms ease;
}

.topbar-nav-link:hover {
  background: #e8eaec;
  transform: translateY(-1px);
}

.topbar-nav-link.is-active {
  border-color: var(--primary);
  background: var(--coral-soft);
  color: var(--coral-dark);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #36a66f;
  box-shadow: 0 0 0 4px rgba(54, 166, 111, 0.12);
}

.status-dot.is-warning i {
  background: #d9911e;
  box-shadow: 0 0 0 4px rgba(217, 145, 30, 0.14);
}

.dashboard-shell {
  width: min(calc(100% - 40px), 1760px);
  margin: 0 auto;
  padding: 42px 0 70px;
  container-type: inline-size;
  container-name: dashboard;
}

.page-heading,
.card-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-heading {
  margin-bottom: 28px;
}

.page-heading > div,
.card-heading > div {
  min-width: 0;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  letter-spacing: -0.045em;
}

.connections-page .page-heading h1 {
  max-width: 100%;
  font-size: clamp(28px, 2.5vw, 32px);
  overflow-wrap: anywhere;
}

.page-heading > div > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 20px;
  margin-bottom: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
  box-shadow: none;
}

.filter-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.filter-field > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.filter-field > select,
.filter-field > input,
.manager-filter summary {
  width: 100%;
  height: var(--filter-control-height);
  min-height: var(--filter-control-height);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.department-filter,
.channel-filter {
  position: relative;
}

.department-filter select,
.channel-filter select {
  appearance: none;
  padding-right: 38px;
}

.department-filter::after,
.channel-filter::after {
  position: absolute;
  right: 15px;
  bottom: 15px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #8c969e;
  border-bottom: 2px solid #8c969e;
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
}

.filter-period {
  min-width: 0;
}

.quick-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.quick-filters button {
  height: var(--filter-control-height);
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  color: #4f5962;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.quick-filters button.is-active {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.manager-filter {
  position: relative;
  width: 100%;
  min-width: 0;
}

.manager-filter-field {
  min-width: 0;
}

.entity-filter-field,
.deal-stage-filter-field {
  min-width: 0;
}

.manager-filter.is-disabled summary {
  cursor: not-allowed;
  background: #f3f5f6;
  color: #78838c;
}

.manager-filter.is-disabled summary::after {
  color: #a2abb2;
}

.manager-filter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  list-style: none;
}

.manager-filter summary::-webkit-details-marker {
  display: none;
}

.manager-filter summary::after {
  color: #8c969e;
  content: "⌄";
  font-size: 18px;
}

.manager-filter[open] summary {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58, 99, 175, 0.18);
}

.manager-filter-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: min(320px, 80vw);
  max-height: min(420px, 60vh);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: #fff;
  box-shadow: var(--shadow-floating);
}

.manager-filter-menu > button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: #f3f5f6;
  color: #46515a;
  cursor: pointer;
  text-align: left;
  font-weight: 750;
}

.manager-filter-options {
  display: grid;
  max-height: 260px;
  gap: 4px;
  margin-top: 7px;
  overflow-y: auto;
}

.manager-filter-options label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.manager-filter-options label:hover {
  background: var(--blue-soft);
}

.manager-filter-options input {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
}

.filter-actions {
  display: flex;
  justify-self: end;
  justify-content: flex-end;
  gap: 10px;
  min-width: max-content;
}

.filter-actions .button {
  height: var(--filter-control-height);
  min-height: var(--filter-control-height);
  padding: 0 18px;
  min-width: 142px;
  border-radius: var(--radius-control);
  font-size: 16px;
  font-weight: 600;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin: 24px 0;
}

.metric-card {
  display: flex;
  min-height: 188px;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
  box-shadow: none;
}

.metric-card > div:last-child {
  display: grid;
  grid-template-rows: 40px 50px 1fr;
  min-width: 0;
  height: 100%;
  flex: 1;
  align-self: stretch;
}

.metric-card-accent {
  border-color: #f0b7a8;
  background: #fffaf8;
}

.metric-card-warning {
  border-color: #f2d9a8;
  background: #fff9ed;
}

.metric-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-control);
  background: var(--coral-soft);
  color: var(--coral-dark);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.metric-icon-blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-icon-slate {
  background: #edf0f2;
  color: #57636c;
}

.metric-icon-warning {
  background: #fff0cf;
  color: #b56a00;
}

.metric-card p {
  display: flex;
  min-height: 40px;
  align-items: flex-start;
  margin: 1px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metric-card strong {
  display: block;
  margin: 0;
  font-size: 38px;
  letter-spacing: -0.04em;
}

.metric-card small {
  display: block;
  align-self: end;
  color: #8b949b;
  font-size: 11px;
  line-height: 1.4;
}

.content-card {
  margin-top: 18px;
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
  box-shadow: none;
}

.connection-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.connection-form-card {
  min-height: 360px;
}

.connection-guide {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(0, 1.3fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 18px;
  padding: 22px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--surface);
  box-shadow: none;
}

.connection-guide h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.connection-guide ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: connection-guide;
}

.connection-guide li {
  position: relative;
  min-height: 56px;
  padding: 5px 12px 5px 38px;
  border-left: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.connection-guide li::before {
  position: absolute;
  top: 5px;
  left: 10px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--coral-soft);
  color: var(--coral);
  content: counter(connection-guide);
  counter-increment: connection-guide;
  font-size: 11px;
  font-weight: 800;
}

.connection-guide li strong,
.connection-guide li span {
  display: block;
}

.connection-guide li span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.connection-layout .content-card {
  margin-top: 0;
}

.connection-form {
  display: grid;
  gap: 18px;
}

.connection-submit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.remote-link-result {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid #cfe4d8;
  border-radius: var(--radius-surface);
  background: #f3faf6;
}

.remote-link-result > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.remote-link-result input {
  height: 42px;
  font-size: 12px;
}

.remote-link-result small {
  color: var(--muted);
  line-height: 1.45;
}

.connection-form label {
  display: grid;
  gap: 7px;
  color: #505a63;
  font-size: 13px;
  font-weight: 750;
}

.connection-form input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--ink);
}

.ai-summary-result {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-surface);
  background: #fafbfc;
}

.ai-summary-result > p:not(.eyebrow) {
  margin: 10px 0 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.ai-summary-result small {
  color: var(--muted);
}

.b24-widget {
  max-width: 760px;
  padding: 28px;
}

.b24-widget h1 {
  margin: 6px 0 10px;
  font-size: 28px;
}

.b24-widget > p:not(.eyebrow) {
  margin: 0 0 22px;
  color: var(--muted);
}

.connection-form select,
.connection-table-tools select {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--ink);
}

.connection-method-picker,
.crm-mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.connection-method-picker legend,
.crm-mode-picker legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.connection-method-picker label,
.crm-mode-picker label {
  display: flex;
  min-height: 74px;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  cursor: pointer;
}

.connection-method-picker label:has(input:checked),
.crm-mode-picker label:has(input:checked) {
  border-color: #e4b5aa;
  background: #fffaf8;
}

.connection-method-picker input,
.crm-mode-picker input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--coral);
}

.connection-method-picker strong,
.connection-method-picker small,
.crm-mode-picker label span,
.crm-mode-picker label small {
  display: block;
}

.connection-method-picker small,
.crm-mode-picker label small,
.crm-mode-picker > p {
  color: var(--muted);
  font-size: 11px;
}

.connection-method-picker small {
  margin-top: 3px;
  font-weight: 600;
  line-height: 1.35;
}

.crm-mode-picker > p {
  grid-column: 1 / -1;
  margin: 0;
}

.manager-combobox {
  position: relative;
}

.manager-picker input[type="search"] {
  margin-bottom: 0;
}

.manager-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: none;
  max-height: 280px;
  overflow-y: auto;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: #fff;
  box-shadow: var(--shadow-floating);
}

.manager-options.is-open {
  display: grid;
}

.manager-option {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.manager-option:hover,
.manager-option:focus-visible {
  outline: 0;
  background: #f3f5f6;
}

.manager-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.manager-options-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.manager-selection {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.manager-selection.is-selected {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #cfe3d7;
  border-radius: var(--radius-control);
  background: #f5faf7;
  color: #2d6144;
  line-height: 1.35;
}

.manager-selection.is-selected strong {
  color: var(--ink);
  font-size: 13px;
}

.manager-selection.is-selected span {
  color: var(--muted);
  font-size: 12px;
}

.sync-state {
  min-height: 20px;
  margin: -12px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

.sync-state.has-warning {
  color: var(--warning);
}

.button-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.username-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
}

.username-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58, 99, 175, 0.18);
}

.username-input span {
  padding-left: 13px;
  color: var(--muted);
}

.username-input input {
  border: 0;
  outline: 0;
}

.bot-badge,
.connection-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef0f2;
  color: #4d5861;
  font-size: 12px;
  font-weight: 750;
}

.qr-card {
  display: grid;
  min-height: 360px;
  align-content: center;
  text-align: center;
}

.qr-placeholder {
  max-width: 360px;
  margin: auto;
  color: var(--muted);
}

.qr-placeholder h2 {
  color: var(--ink);
}

.qr-placeholder-icon {
  display: grid;
  width: 86px;
  height: 86px;
  margin: 0 auto 22px;
  place-items: center;
  border: 1px dashed #cfd5d9;
  border-radius: var(--radius-surface);
  background: #f7f8f9;
  color: #8c969e;
  font-size: 48px;
}

#qr-live-status {
  margin: 0 auto 14px;
}

.qr-card h2 {
  margin: 0 0 18px;
}

.qr-card img {
  display: block;
  width: min(100%, 260px);
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: #fff;
}

.qr-card > strong {
  display: block;
  margin: 4px 0;
}

.remote-connect-page {
  min-height: 100vh;
  background: #f4f5f6;
}

.remote-connect-shell {
  width: min(100% - 28px, 520px);
  margin: 0 auto;
  padding: 34px 0 48px;
}

.remote-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.remote-brand .brand-mark {
  width: 38px;
  height: 38px;
  font-size: 16px;
}

.remote-connect-card {
  margin-top: 22px;
  text-align: center;
}

.remote-connect-card h1 {
  margin: 5px 0 8px;
  font-size: clamp(28px, 8vw, 40px);
  letter-spacing: -0.04em;
}

.remote-manager {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.remote-connect-card > img {
  display: block;
  width: min(100%, 280px);
  margin: 18px auto 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: #fff;
}

.remote-connect-card .connection-form {
  margin-top: 20px;
  text-align: left;
}

.remote-security-note {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.muted-copy {
  color: var(--muted);
  font-size: 13px;
}

.connection-steps {
  display: grid;
  gap: 8px;
  margin: 22px 0 0;
  padding-left: 22px;
  color: #59646d;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

.connection-status.is-connected {
  background: #e7f5ed;
  color: var(--success);
}

.connection-status.is-waiting {
  background: var(--warning-soft);
  color: var(--warning);
}

.connection-status.is-error {
  background: var(--error-soft);
  color: var(--error);
}

.connection-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: -4px 0 18px;
}

.connection-summary span {
  padding: 14px 16px;
  border-radius: var(--radius-control);
  background: #f5f6f7;
  color: #68737b;
  font-size: 12px;
}

.connection-summary strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 22px;
}

.connection-table-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 210px;
  gap: 10px;
  margin-bottom: 12px;
}

.connection-table-tools input {
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}

.connection-table-tools select {
  height: 42px;
}

.connections-table td:first-child strong,
.connections-table td:first-child small {
  display: block;
}

.connection-actions {
  width: auto;
  min-width: 0;
  text-align: right;
  white-space: normal;
}

.connection-action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.connection-action-group .button {
  flex: 0 0 auto;
}

.telegram-without-username {
  color: var(--muted);
  font-size: 13px;
}

.connections-table td:first-child small {
  margin-top: 4px;
  color: #929aa1;
  font-size: 10px;
}

.qr-card .connection-form {
  margin-top: 20px;
  text-align: left;
}

.card-heading {
  align-items: center;
  margin-bottom: 24px;
}

.card-heading h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.025em;
}

.chart-legend {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.chart-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-dialogs {
  background: var(--coral);
}

.legend-unanswered {
  background: #d9911e;
}

.chart-wrap {
  position: relative;
  min-height: 310px;
  overflow-x: auto;
}

#activity-chart {
  display: block;
  width: 100%;
  height: 310px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: #7d8790;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
}

td {
  padding: 17px 14px;
  border-bottom: 1px solid #eff0f2;
  color: #3e4850;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.manager-row {
  cursor: pointer;
  transition: background 120ms ease;
}

.manager-row:hover {
  background: var(--primary-soft);
}

.manager-name {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 800;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--charcoal);
  color: #fff;
  font-size: 12px;
}

.number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.managers-table {
  min-width: 900px;
  table-layout: fixed;
}

.managers-table th:first-child,
.managers-table td:first-child {
  width: 34%;
}

.managers-table th:last-child,
.managers-table td:last-child {
  width: 14%;
  white-space: nowrap;
}

.managers-table th:not(:first-child):not(:last-child),
.managers-table td:not(:first-child):not(:last-child) {
  width: 13%;
}

.row-action {
  border: 0;
  background: transparent;
  color: var(--coral-dark);
  cursor: pointer;
  font-weight: 800;
}

.loading-cell,
.empty-state {
  padding: 36px 20px;
  color: var(--muted);
  text-align: center;
}

.updated-at {
  color: #91999f;
  font-size: 12px;
}

.alert {
  margin: 16px 0;
  padding: 13px 15px;
  border-radius: var(--radius-control);
  font-size: 13px;
  line-height: 1.5;
}

.alert-error {
  border: 1px solid #f0b8ae;
  background: var(--error-soft);
  color: var(--error);
}

.alert-warning {
  border: 1px solid #ead49b;
  background: var(--warning-soft);
  color: var(--warning);
}

.alert-success {
  border: 1px solid #b8dfc9;
  background: var(--success-soft);
  color: var(--success);
}

.dialog-modal {
  width: min(calc(100% - 32px), 1120px);
  max-height: min(86vh, 850px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-surface);
  background: #fff;
  box-shadow: var(--shadow-dialog);
}

.dialog-modal::backdrop {
  background: rgba(18, 24, 28, 0.68);
  backdrop-filter: blur(4px);
}

.dialog-modal.admin-dialog,
.dialog-modal.admin-credentials-dialog { width: min(560px, calc(100% - 24px)); }

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #56616a;
  cursor: pointer;
  font-size: 24px;
}

.dialog-table-wrap {
  max-height: 62vh;
  padding: 10px 26px 26px;
}

.crm-links {
  display: flex;
  gap: 8px;
}

.crm-links a {
  color: var(--blue);
  font-weight: 750;
  text-decoration: none;
}

@container dashboard (max-width: 900px) {
  .blacklist-entry-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .system-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-workspace {
    grid-template-columns: 1fr;
  }

  .system-diagnostics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .connection-layout {
    grid-template-columns: 1fr;
  }

  .connection-guide {
    grid-template-columns: 1fr;
  }

  .manager-filter {
    width: 100%;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-card {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .system-overview {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-3);
  }

  .system-overview-meta {
    text-align: left;
  }

  .system-grid {
    grid-template-columns: 1fr;
  }

  .system-workspace > .content-card,
  .system-diagnostics summary {
    padding-right: var(--space-4);
    padding-left: var(--space-4);
  }

  .system-section-heading,
  .system-issue,
  .system-check-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .system-section-heading .button {
    width: 100%;
  }

  .system-diagnostics > p,
  .system-diagnostics-grid {
    margin-right: var(--space-4);
    margin-left: var(--space-4);
  }

  .system-diagnostics-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-shell {
    width: min(calc(100% - 24px), 1480px);
    padding-top: 28px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .connection-guide {
    padding: 20px;
  }

  .connection-guide ol {
    grid-template-columns: 1fr;
  }

  .connection-guide li {
    min-height: 0;
    padding: 10px 0 10px 34px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .connection-guide li::before {
    top: 10px;
    left: 0;
  }

  .connection-summary,
  .connection-table-tools {
    grid-template-columns: 1fr;
  }

  .page-heading,
  .card-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading .button {
    width: 100%;
  }

  .content-card,
  .metric-card {
    padding: 20px;
  }

  .blacklist-entry-body {
    grid-template-columns: 1fr;
  }

  .blacklist-phone-entry .button {
    width: 100%;
  }

  .blacklist-phone-controls {
    display: grid;
  }

  .blacklist-phone-controls select {
    min-width: 0;
    min-height: 42px;
  }

  .blacklist-status-card {
    align-items: flex-start;
  }

  .blacklist-status-card .button {
    margin-left: 0;
  }

  .chart-legend {
    flex-wrap: wrap;
  }

  .login-card {
    padding: 30px 24px;
  }
}

/* Dashboard UX refinement: shared controls and page-specific composition. */
.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.1;
}

.filter-row {
  display: grid;
  align-items: end;
  gap: 16px;
  min-width: 0;
}

.filter-row-period {
  grid-template-columns: minmax(0, 1fr) minmax(440px, 560px);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.filter-row-context {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.filter-date-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 12px;
}

.date-range-separator {
  align-self: end;
  height: var(--filter-control-height);
  display: inline-flex;
  align-items: center;
  color: #8c969e;
  font-size: 20px;
  font-weight: 600;
}

.system-section-nav {
  display: inline-flex;
  gap: 6px;
  margin: -10px 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.system-section-nav a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  color: #4f5962;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.system-section-nav a:hover,
.system-section-nav a:focus-visible {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.system-section-nav a.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.system-monitoring {
  scroll-margin-top: 92px;
}

.blacklist-section {
  scroll-margin-top: 92px;
}

.manager-option.is-active {
  background: var(--blue-soft);
}

.remote-link-result {
  width: min(100%, 380px);
  margin: 0 auto;
  text-align: left;
}

.remote-link-result h2 {
  margin: 0;
  font-size: 22px;
}

.remote-link-result > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@container dashboard (max-width: 1400px) {
  .filter-row-context {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-row-context .filter-actions {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@container dashboard (max-width: 1100px) {
  .filter-row-period,
  .filter-row-context {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-actions {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@container dashboard (max-width: 620px) {
  .filter-row-period,
  .filter-row-context,
  .filter-date-range {
    grid-template-columns: 1fr;
  }

  .filter-row-period {
    padding-bottom: 14px;
  }

  .date-range-separator {
    display: none;
  }

  .filter-actions {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }

  .filter-actions .button {
    flex: 1 1 0;
    min-width: 0;
  }

  .quick-filters {
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .brand-copy small {
    display: none;
  }

  .connection-form-card,
  .qr-card {
    min-height: auto;
  }

  .connection-method-picker,
  .crm-mode-picker {
    grid-template-columns: 1fr;
  }

  .connection-method-picker label,
  .crm-mode-picker label {
    min-height: 62px;
  }

  .system-section-nav {
    display: flex;
    width: 100%;
  }

  .system-section-nav a {
    flex: 1;
    justify-content: center;
  }
}

/* Resilient interaction states and compact mobile composition. */
.connection-form:not(.is-manager-selected) .connection-method-picker,
.connection-form:not(.is-manager-selected) .crm-mode-picker,
.connection-form:not(.is-manager-selected) #connection-start {
  display: none;
}

/* The onboarding surface stays linear until an employee is selected. */
.connection-layout:not(.is-manager-selected) {
  grid-template-columns: minmax(0, 720px);
  justify-content: start;
}

.connection-layout:not(.is-manager-selected) .connection-form-card {
  min-height: 0;
}

.connection-layout:not(.is-manager-selected) .qr-card {
  display: none;
}

.manager-picker {
  display: grid;
  gap: 7px;
}

.manager-picker > label {
  color: #505a63;
  font-size: 13px;
  font-weight: 750;
}

.manager-selected-card {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 12px 11px 14px;
  border: 1px solid #cfe3d7;
  border-radius: 10px;
  background: #f5faf7;
}

.manager-selected-card > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.manager-selected-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-selected-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-selected-card .button {
  flex: 0 0 auto;
}

.connection-form-card .button-wide {
  width: 100%;
  justify-self: start;
}

.crm-mode-picker {
  gap: 8px;
}

.crm-mode-picker label {
  min-height: 58px;
  background: #fcfcfc;
}

.crm-mode-picker label:has(input:checked) {
  border-color: #e4b5aa;
  background: #fffaf8;
}

@media (max-width: 620px) {
  .connection-layout:not(.is-manager-selected) {
    grid-template-columns: 1fr;
  }

  .manager-selected-card {
    align-items: flex-start;
  }

  .connection-form-card .button-wide {
    width: 100%;
  }
}

.confirmation-dialog {
  width: min(calc(100% - 32px), 470px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-surface);
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
}

.confirmation-dialog::backdrop {
  background: rgba(21, 29, 34, 0.48);
}

.confirmation-dialog-content {
  padding: 24px;
}

.confirmation-dialog-content .eyebrow {
  margin-bottom: 6px;
}

.confirmation-dialog-content h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.025em;
}

.confirmation-dialog-content > p:not(.eyebrow) {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.confirmation-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

#crm-mode-dialog .crm-mode-picker {
  margin-bottom: var(--space-4);
}

.system-note.is-success {
  color: var(--success);
}

.system-note.is-error {
  color: var(--error);
}

@media (max-width: 620px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 12px;
    min-height: 0;
    padding: 12px 16px;
  }

  .topbar-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }

  .topbar-actions form,
  .topbar-nav-link {
    width: 100%;
  }

  .topbar-nav-link {
    min-height: 42px;
    padding: 0 10px;
    font-size: 13px;
  }

  .chart-wrap {
    overflow: hidden;
  }

  .confirmation-dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (pointer: coarse) {
  .button,
  .topbar-nav-link,
  .row-action {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.system-metric-link {
  display: inline-flex;
  width: fit-content;
  margin-top: var(--space-2);
  color: var(--info);
  font-size: 13px;
  font-weight: 750;
  text-underline-offset: 3px;
}

@media (max-width: 620px) {
  .responsive-table-wrap {
    overflow: visible;
  }

  .report-filter-bar { grid-template-columns: 1fr; gap: 10px; }
  .report-filter-search { grid-column: auto; }
  .report-access-section .responsive-data-table,
  .report-access-section .responsive-data-table tbody { display: block; }
  .report-access-section .responsive-data-table tr:not(:has(.loading-cell)):not(:has(.empty-state)) {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .report-access-section .responsive-data-table td:not(.mobile-primary-cell):not(.mobile-actions) {
    display: grid;
    grid-template-columns: minmax(96px, 0.7fr) minmax(0, 1.3fr);
    align-items: start;
    text-align: right;
  }
  .report-access-section .responsive-data-table td:not(.mobile-primary-cell):not(.mobile-actions)::before {
    min-width: 0;
  }
  .report-access-section .responsive-data-table td.mobile-primary-cell { padding-bottom: 12px; }
  .report-access-section .responsive-data-table td.mobile-actions { padding-top: 12px; }
  .report-access-section .report-request-table,
  .report-access-section .report-subscription-table { min-width: 0; }
  .report-department-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .report-department-actions .button { padding: 0 10px; }

  .responsive-data-table,
  .responsive-data-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .responsive-data-table {
    table-layout: auto;
  }

  .responsive-data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .responsive-data-table tbody {
    display: grid;
    gap: var(--space-3);
  }

  .responsive-data-table tr:not(:has(.loading-cell)):not(:has(.empty-state)) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-surface);
    background: var(--surface);
  }

  .responsive-data-table td {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 10px 0;
    border: 0;
    color: var(--ink);
    font-size: 14px;
    text-align: right;
  }

  .responsive-data-table td:not(.mobile-primary-cell):not(.mobile-actions)::before {
    flex: 0 1 auto;
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
  }

  .responsive-data-table td.mobile-primary-cell,
  .responsive-data-table td.mobile-actions {
    grid-column: 1 / -1;
  }

  .responsive-data-table td.mobile-primary-cell {
    display: block;
    padding-top: 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }

  .responsive-data-table td.mobile-actions {
    justify-content: flex-start;
    padding-bottom: 0;
    text-align: left;
  }

  .responsive-data-table .number-cell {
    text-align: right;
  }

  .responsive-data-table .manager-name {
    min-width: 0;
  }

  .responsive-data-table .connection-actions {
    width: auto;
  }

  .responsive-data-table .connection-action-group {
    justify-content: flex-start;
  }

  .responsive-data-table .leader-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .responsive-data-table .leader-actions-menu-panel {
    right: auto;
    left: 0;
  }
}

@media (max-width: 380px) {
  .responsive-data-table .connection-action-group {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .responsive-data-table .connection-action-group .button {
    width: 100%;
  }
}

/* Operational interface: compact hierarchy and consistent controls. */
[hidden] { display: none !important; }
:root { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
::selection { background: var(--primary-soft); color: var(--ink); }
input, textarea { caret-color: var(--primary); }
a { text-underline-offset: 3px; }
.page-heading h1 { font-size: 32px; line-height: 1.2; letter-spacing: -0.025em; }
.page-heading { margin-bottom: 24px; }
h2 { line-height: 1.3; }
.button, button, .topbar-nav-link { font-weight: 600; }
.button-small { min-height: 38px; }
.metric-card { padding: 18px 20px; border-radius: 0; border: 0; box-shadow: none; background: transparent; }
.metric-card strong { font-size: 30px; font-variant-numeric: tabular-nums; }
.metric-card small { font-size: 13px; line-height: 1.45; }
.metrics-grid { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; gap: 0; margin-bottom: 24px; }
.metric-card p { font-size: 14px; }
.metric-card-warning { background: var(--warning-soft); }
.system-grid { gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.system-metric { border: 0; border-radius: 0; box-shadow: none; padding: 18px; }
.system-section-nav { display: flex; flex-wrap: wrap; }
.account-menu { position: relative; margin-left: 12px; }
.account-menu summary { cursor: pointer; padding: 12px; font-size: 13px; color: var(--muted); }
.account-menu form { position: absolute; right: 0; top: 100%; z-index: 30; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.additional-filters { margin-top: 16px; }
.additional-filters > summary, .connection-wizard > summary { cursor: pointer; font-size: 14px; font-weight: 600; padding: 12px 0; }
.additional-filters[open] > summary { margin-bottom: 12px; }
.connection-wizard { margin-top: 24px; }
.connection-wizard > summary { color: var(--primary); }
.connection-guide { border: 0; background: transparent; padding: 16px 0; }
.connection-guide h2 { font-size: 18px; }
.blacklist-phone-entry { border: 0; background: transparent; padding: 0; }
.blacklist-rules { margin-top: 24px; }
.blacklist-rules > label { margin: 12px 0; max-width: 340px; }
.blacklist-rules select { min-height: 42px; max-width: 100%; font: inherit; }
.blacklist-rules-intro { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.blacklist-rules-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 12px; }
.blacklist-rules-tools .filter-field { flex: 1 1 280px; max-width: 420px; }
.blacklist-rules-tools .button { flex: 0 0 auto; }
.blacklist-rules-panel { margin-top: 16px; }
.blacklist-rules-count { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.blacklist-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 13px; }
@media (max-width: 620px) {
  .blacklist-rules-tools .filter-field, .blacklist-rules-tools .button { width: 100%; max-width: none; }
  .blacklist-pagination { justify-content: space-between; }
}
.dialog-explanation, .dialog-tools { padding: 0 24px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.dialog-tools { display: flex; gap: 16px; margin: 16px 0; }
.dialog-tools label { display: grid; gap: 6px; flex: 1; }
.dialog-tools input, .dialog-tools select { width: 100%; min-height: 42px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.leader-dialog .dialog-actions { position: sticky; bottom: 0; background: var(--surface); padding: 16px 0; }
.number-cell { font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .topbar { position: relative; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
  .topbar-actions { display: flex; flex-wrap: wrap; width: 100%; gap: 4px; }
  .topbar-nav-link { min-height: 42px; padding: 0 10px; font-size: 13px; }
  .account-menu { margin-left: auto; }
  .page-heading h1 { font-size: 28px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { padding: 16px; }
  .metric-card:last-child { grid-column: 1 / -1; }
  .system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-tools { flex-direction: column; }
  .dialog-table-wrap { overflow: visible; }
  .dialog-modal .responsive-data-table { min-width: 0; }
  .filter-row-period { gap: 12px; }
  .filter-date-range { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .date-range-separator { display: none; }
}
@media (max-width: 620px) {
  .dialog-table-wrap .responsive-data-table tr { display: grid; grid-template-columns: 1fr; }
  .dialog-table-wrap .responsive-data-table td { display: flex; justify-content: space-between; gap: 12px; }
  .dialog-table-wrap .responsive-data-table td.mobile-primary-cell { display: block; }
  .dialog-table-wrap .responsive-data-table td::before { content: attr(data-label); color: var(--muted); }
  .dialog-table-wrap .responsive-data-table thead { display: none; }
  .system-metric { min-height: 0; padding: 14px; }
  .system-metric strong { font-size: 24px; }
}

@media (max-width: 900px) {
  .topbar { position: relative; }
  .topbar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-actions > .topbar-nav-link { width: 100%; }
  .account-menu { position: absolute; right: 12px; top: 14px; margin: 0; }
  .account-menu summary { font-size: 12px; padding: 8px; }
  .filter-panel { padding: 16px; }
  .filter-row-period { padding-bottom: 12px; }
  .additional-filters { margin-top: 8px; }
  .quick-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .quick-filters button { min-width: 0; padding: 0 6px; font-size: 13px; }
}

/* Response deadlines are separate from the historical dialogue metric. */
.response-section h2 { margin-top: 0; }
.response-section .muted-copy { max-width: 75ch; font-size: 14px; line-height: 1.5; }
.response-counts { display: flex; flex-wrap: wrap; gap: 20px 48px; margin: 20px 0; }
.response-counts dt { font-size: 14px; }
.response-counts dd { margin: 6px 0 0; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.manager-response-note { display: block; margin-top: 6px; font-size: 13px; white-space: normal; }

/* Shared interaction states and final accessibility adjustments. */
.confirm-dialog { max-width: 520px; padding: 24px; }
.confirm-dialog p { line-height: 1.6; overflow-wrap: anywhere; }
.confirm-dialog .dialog-actions { flex-wrap: wrap; }
.password-toggle { align-self: flex-start; width: fit-content; padding: 6px 0; border: 0; background: transparent; color: var(--primary); font-size: 14px; cursor: pointer; }
.retry-button { margin-inline-start: 12px; }
.leader-dialog .dialog-actions { position: sticky; bottom: 0; background: #fff; z-index: 1; }
.topbar-viewer, .manager-name, .leader-manager-row > span { min-width: 0; overflow-wrap: anywhere; }
.dialog-header h2 { min-width: 0; overflow-wrap: anywhere; }
.login-form label { min-width: 0; }
.button-danger { color: #922b21; border-color: #bd726b; background: #fff; }
.button-danger:hover { background: #fbe9e7; color: #752018; }
input, select, textarea { caret-color: var(--primary); }
::selection { background: var(--primary-soft); color: var(--ink); }
a { text-underline-offset: 3px; }
@media (max-width: 600px) {
  input, select, textarea { font-size: 16px; }
  .confirm-dialog { width: calc(100% - 24px); padding: 20px; }
  .dialog-actions .button { min-height: 44px; }
}

.table-wrap { position: relative; }
.connection-summary { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.connection-summary > span { padding: 4px 0; background: transparent; }
.connection-summary strong { margin-right: 6px; }
.metric-card small, .updated-at, .secure-note, .connection-summary > span { color: var(--muted); }
input::placeholder, textarea::placeholder { color: #65707a; opacity: 1; }
.brand-copy small { font-size: 12px; }
@media (max-width: 1024px) {
  .filter-row-period { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .filter-date-range { width: 100%; }
}
@media (max-width: 620px) {
  .connection-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .connection-summary > span { font-size: 13px; }
  .connection-summary > span:last-child { grid-column: 1 / -1; }
}

.report-subscription-table td > small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.4; }

/* Keep expanded filters independent of the control grid. */
.filter-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.filter-footer > p { margin: 0; }
.filter-row-context .manager-filter-menu { width: min(320px, 100% + 64px); }
.deal-stage-filter-field .manager-filter-menu { left: auto; right: 0; }
@media (max-width: 620px) {
  .filter-row-context .manager-filter-menu { width: 100%; }
}

/* Shared Danton workspace shell, aligned with the quality analytics workspace. */
.app-sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  width: 212px;
  flex-direction: column;
  padding: 28px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.app-sidebar .brand { gap: 10px; padding: 0 8px 32px; }
.app-sidebar .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
}
.app-nav-label { padding: 0 12px 10px; color: var(--muted); font-size: 11px; }
.app-nav { display: grid; gap: 5px; }
.app-sidebar .topbar-nav-link {
  min-height: 40px;
  justify-content: flex-start;
  padding: 0 12px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  transition: background-color 150ms ease, color 150ms ease;
}
.app-sidebar .topbar-nav-link:hover { transform: none; background: var(--canvas); color: var(--ink); }
.app-sidebar .topbar-nav-link.is-active {
  border-color: transparent;
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: none;
  font-weight: 650;
}
.app-sidebar-footer {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.app-sidebar-footer small { font-size: 11px; line-height: 1.55; }
.app-account-bar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-left: 212px;
  padding: 10px clamp(24px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.app-page-context { color: var(--muted); font-size: 13px; }
.app-account-user { display: flex; align-items: center; gap: 18px; }
.app-account-greeting { color: var(--muted); font-size: 13px; }
.app-account-bar .account-menu { position: relative; }
.app-account-bar .account-menu > summary {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  list-style-position: inside;
}
.app-account-bar .account-menu form {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 2;
  min-width: 132px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: var(--shadow-floating);
}
.app-account-bar .account-menu .topbar-nav-link {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: var(--ink);
}
.app-account-bar .account-menu .topbar-nav-link:hover { background: var(--canvas); }
.dashboard-shell {
  width: min(calc(100% - 212px), 1600px);
  margin: 0 0 0 212px;
  padding: 30px clamp(24px, 3vw, 48px) 64px;
}
.system-shell { max-width: 1600px; }

@media (max-width: 1023px) {
  .app-sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    padding: 12px 20px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .app-sidebar .brand { padding: 0 0 10px; }
  .app-nav-label, .app-sidebar-footer { display: none; }
  .app-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .app-sidebar .topbar-nav-link { min-height: 34px; padding: 0 10px; font-size: 12px; }
  .app-account-bar { min-height: 48px; margin-left: 0; padding: 8px 24px; }
  .dashboard-shell { width: 100%; margin: 0; padding: 26px 24px 48px; }
}
@media (max-width: 600px) {
  .app-sidebar { padding: 10px 14px 8px; }
  .app-sidebar .brand { padding-bottom: 8px; }
  .app-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .app-sidebar .topbar-nav-link { flex: 0 0 auto; font-size: 11px; }
  .app-account-bar { min-height: 44px; padding: 6px 14px; }
  .app-account-user { gap: 10px; }
  .app-account-greeting { font-size: 12px; }
  .dashboard-shell { padding: 20px 14px 40px; }
}
