:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #f1f5f9;
  --border: #dbe3ee;
  --border-strong: #b9c7d8;
  --text: #102033;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --brand: #174ea6;
  --brand-deep: #0f2f5f;
  --brand-soft: #eaf2ff;
  --accent: #f97316;
  --accent-soft: #fff3e8;
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --success-border: #bbf7d0;
  --warn-bg: #fff7ed;
  --warn-text: #9a3412;
  --warn-border: #fed7aa;
  --danger-bg: #fff1f2;
  --danger-text: #be123c;
  --danger-border: #fecdd3;
  --ring: 0 0 0 4px rgba(23, 78, 166, 0.14);
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.06);
  --radius-xl: 8px;
  --radius-lg: 8px;
  --radius-md: 8px;
  --dark: #0f2744;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", sans-serif;
}

body {
  min-height: 100vh;
  padding: 0;
  background:
    radial-gradient(circle at 8% -10%, rgba(23, 78, 166, 0.10), transparent 30%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 52px;
  height: auto;
  flex-shrink: 0;
  filter: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(90deg, rgba(23, 78, 166, 0.07), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: var(--shadow);
  position: relative;
}

.topbar-side {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-company-form {
  min-width: 220px;
  margin: 0;
}

.admin-company-form .field {
  margin: 0;
}

.client-menu-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  justify-content: space-between;
  margin-bottom: 18px;
}

.client-tab-nav {
  flex: 1 1 auto;
  margin-bottom: 0;
}

.client-company-form {
  flex: 0 0 280px;
  align-self: center;
  display: flex;
  align-items: center;
}

.working-company-combobox {
  position: relative;
  width: 100%;
}

.working-company-trigger {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.working-company-trigger:hover,
.working-company-combobox.is-open .working-company-trigger {
  border-color: rgba(31, 83, 150, 0.45);
}

.working-company-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--muted);
  transform: rotate(45deg) translateY(-2px);
  flex: 0 0 auto;
  transition: transform 160ms ease;
}

.working-company-combobox.is-open .working-company-caret {
  transform: rotate(225deg) translateY(-2px);
}

.working-company-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: min(360px, 80vw);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.working-company-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}

.working-company-options {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
}

.working-company-option {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.working-company-option:hover,
.working-company-option[aria-selected="true"] {
  background: var(--brand-soft);
  color: var(--brand);
}

.working-company-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.stripe-alert-banner,
.stripe-alert-note {
  border: 1px solid rgba(190, 18, 60, 0.18);
  background: rgba(255, 241, 242, 0.88);
  color: #9f1239;
}

.stripe-alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(190, 18, 60, 0.08);
}

.stripe-alert-banner p {
  margin: 4px 0 0;
  color: #9f1239;
}

.stripe-alert-banner span {
  flex: 0 0 auto;
  font-weight: 800;
}

.stripe-alert-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.stripe-alert-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 650;
}

.user-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.bbp-select {
  position: relative;
  width: 100%;
}

.bbp-select-native-control {
  position: absolute;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.bbp-select-native-control:disabled {
  opacity: 0;
}

.bbp-select-trigger {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #172033;
  font: inherit;
  font-weight: 750;
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.bbp-select-trigger:disabled,
.bbp-select.is-disabled .bbp-select-trigger {
  cursor: not-allowed;
  opacity: 0.62;
}

.bbp-select-trigger:hover,
.bbp-select.is-open .bbp-select-trigger {
  border-color: rgba(31, 83, 150, 0.45);
}

.bbp-select-trigger:focus-visible {
  outline: none;
  box-shadow: var(--ring), var(--shadow-soft);
}

.bbp-select-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.bbp-select.is-open .bbp-select-caret {
  transform: rotate(225deg) translateY(-2px);
}

.bbp-select-menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.bbp-select-search {
  width: 100%;
  min-height: 40px;
  margin-bottom: 4px;
  padding: 9px 12px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 14px;
  background: #ffffff;
  color: #172033;
  font: inherit;
  font-weight: 500;
  outline: none;
}

.bbp-select-search:focus {
  border-color: rgba(31, 83, 150, 0.55);
  box-shadow: var(--ring);
}

.bbp-select-option {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #172033;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.bbp-select-option:hover,
.bbp-select-option[aria-selected="true"] {
  background: #f1f6ff;
  color: #174ea6;
}

.bbp-select-option:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.callrail-tracking-list {
  display: grid;
  gap: 16px;
}

.callrail-tracking-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: var(--shadow);
}

.callrail-tracking-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.callrail-tracking-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.2;
}

.callrail-tracking-header .muted {
  margin: 0;
}

.callrail-tracking-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.callrail-tracking-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.account-deactivated-banner {
  margin: 0 0 18px;
  padding: 18px 20px;
  border: 1px solid rgba(138, 44, 24, 0.22);
  border-left: 6px solid #b43c1f;
  border-radius: 18px;
  background: #fff3ed;
  color: #6f2817;
  box-shadow: var(--shadow-soft);
}

.test-mode-banner {
  position: sticky;
  top: 0;
  z-index: 1300;
  margin: -24px -24px 20px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(154, 95, 13, 0.22);
  background: linear-gradient(90deg, #f59e0b 0%, #f97316 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 10px 24px rgba(146, 64, 14, 0.16);
}

.account-deactivated-banner h2 {
  margin: 0 0 6px;
  color: #7c2d18;
  font-size: 20px;
}

.account-deactivated-banner p {
  margin: 0;
}

.account-deactivated-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.account-deactivated-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(138, 44, 24, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: #7c2d18;
  font-size: 12px;
  font-weight: 800;
}

.maintenance-banner {
  border-color: rgba(154, 95, 13, 0.26);
  border-left-color: #c27803;
  background: #fff7e6;
  color: #6b4a10;
}

.maintenance-banner h2 {
  color: #7a4a00;
}

.logout-form {
  margin: 0;
  position: absolute;
  top: 20px;
  right: 22px;
}

.btn-topbar-signout {
  white-space: nowrap;
}

.btn-topbar-refresh {
  white-space: nowrap;
  position: absolute;
  top: 20px;
  right: 112px;
  background: #ffffff;
  border-color: var(--border);
  color: var(--brand);
}

.btn-topbar-refresh:hover {
  border-color: rgba(23, 78, 166, 0.32);
  background: var(--brand);
  color: #ffffff;
}

.account-chip {
  min-width: 220px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(248, 250, 252, 0.88);
}

.account-chip-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-chip-value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
}

.account-chip-copy {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.tab-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.workspace-nav {
  margin-bottom: 14px;
}

.workspace-panel {
  display: none;
}

.workspace-panel.is-active {
  display: block;
}

.workspace-tab-button {
  min-width: 180px;
}

.workspace-tab-button-admin {
  color: #9b4a14;
}

.workspace-tab-button-admin.is-active {
  background: var(--accent-soft);
  color: #9b4a14;
}

.admin-tab-nav {
  margin-top: 0;
  margin-bottom: 18px;
  border-style: solid;
  background: #fffaf5;
}

.admin-workspace {
  margin-top: 0;
}

.admin-workspace-header {
  margin-bottom: 14px;
}

.admin-tab-button {
  color: #7f2f08;
}

.admin-tab-button.is-active {
  background: var(--accent-soft);
  color: #9b4a14;
}

.tab-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tab-button.is-active {
  background: #ffffff;
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10);
}

.tab-button:hover {
  color: var(--brand-deep);
  background: rgba(255, 255, 255, 0.72);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.is-active {
  display: block;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 12px;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.subtitle {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 560px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 15px 16px 17px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.stat-value {
  font-size: 27px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.02em;
}

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.panel-copy {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.badge-row,
.tag-group,
.savebar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
}

.badge strong {
  color: var(--text);
}

.badge-success {
  background: var(--brand-soft);
  border-color: var(--success-border);
  color: var(--brand);
  font-weight: 700;
}

.pill-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.pill-item {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.pill-item.active {
  background: linear-gradient(180deg, #eef6ff 0%, #ffffff 100%);
  border-color: rgba(23, 78, 166, 0.28);
}

.pill-title {
  font-size: 14px;
  font-weight: 700;
}

.pill-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.control-stack {
  margin-top: 16px;
  display: grid;
  gap: 16px;
}

.snapshot-stack {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

.overview-recent-transactions {
  margin-top: 10px;
  padding-top: 8px;
}

.overview-recent-transactions .section-label {
  margin-bottom: 12px;
}

.snapshot-card {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.billing-target-card {
  display: grid;
  gap: 14px;
}

#billingSettingsPanel {
  display: grid;
  gap: 14px;
}

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

.billing-target-field {
  min-width: 0;
}

.billing-target-button {
  min-height: 44px;
  white-space: nowrap;
}

.billing-target-description,
.billing-target-status {
  grid-column: 1 / -1;
  margin: 0;
}

.snapshot-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.snapshot-value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
}

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

.field label,
.section-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.section-label {
  margin-top: 0;
}

.input,
.select,
.field input,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input:focus,
.select:focus,
.field input:focus,
.field select:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.trade-add-row {
  grid-template-columns: minmax(180px, 1fr) minmax(110px, 150px) auto;
  align-items: center;
}

.trade-add-row .btn {
  white-space: nowrap;
}

.editor-card {
  display: grid;
  gap: 16px;
}

.trade-settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.trade-search-row {
  margin-top: 16px;
}

.trade-business-hours {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

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

.connection-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 240px);
  gap: 14px;
  margin: 18px;
  align-items: end;
}

.connection-list {
  display: grid;
  gap: 14px;
  margin: 18px;
}

.connection-card,
.trade-connection-panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  padding: 18px;
}

.connection-list-card {
  overflow: hidden;
  padding: 0;
}

.connection-summary-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.connection-summary-button:hover {
  background: #f8fafc;
}

.connection-summary-main {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.connection-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 15px;
  background: linear-gradient(135deg, #eff6ff, #dcfce7);
  color: #0f766e;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.connection-summary-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.connection-summary-copy strong {
  color: #0f172a;
  font-size: 15px;
  font-weight: 850;
}

.connection-summary-copy span:last-child {
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-summary-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.connection-show-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.connection-detail {
  padding: 0 18px 18px;
  border-top: 1px solid rgba(226, 232, 240, 0.86);
}

.connection-empty-state {
  margin: 0;
  padding: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.connection-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.connection-card h3,
.trade-connection-panel h4 {
  margin: 0;
  color: var(--ink);
}

.connection-auth-copy {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.connection-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.connection-field-wide {
  grid-column: 1 / -1;
}

.connection-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.trade-connection-panel {
  margin-top: 18px;
}

.trade-connection-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 12px;
}

.trade-connection-check {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: #f8fafc;
}

.trade-collapse-button {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 12px 14px;
  font-weight: 700;
}

.trade-collapse-meta {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.trade-collapse-icon {
  color: var(--brand);
  font-size: 13px;
}

.trade-business-hours-panel {
  margin-top: 12px;
}

.trade-business-hours-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.business-hours-grid {
  display: grid;
  gap: 10px;
}

.business-day-row {
  display: grid;
  grid-template-columns: 56px auto auto minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-soft);
}

.business-day-row input[type="time"] {
  width: 100%;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
}

.business-day-label {
  font-size: 13px;
  font-weight: 700;
}

.business-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.currency-input {
  position: relative;
}

.currency-input-symbol {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
  z-index: 1;
}

.currency-input input {
  padding-left: 34px;
}

.currency-input-compact .currency-input-symbol {
  left: 10px;
}

.currency-input-compact input {
  padding-left: 28px;
}

.field span {
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 15px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: #ffffff;
  color: var(--brand-deep);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: #f8fbff;
  color: var(--brand-deep);
  box-shadow: var(--shadow-soft);
}

.btn-dark {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  border-color: var(--brand-deep);
}

.btn-dark:hover {
  background: linear-gradient(135deg, #123f86 0%, #0b2449 100%);
  border-color: #0b2449;
  color: #ffffff;
}

.btn-attention {
  background: linear-gradient(135deg, #f97316 0%, #dc2626 100%);
  color: #fff;
  border-color: #b91c1c;
}

.btn-attention:hover {
  background: linear-gradient(135deg, #fb923c 0%, #ef4444 100%);
  border-color: #991b1b;
  color: #ffffff;
}

.btn-small {
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.btn-danger:hover {
  background: #be123c;
  border-color: #9f1239;
  color: #ffffff;
}

.trade-list {
  display: grid;
  gap: 14px;
}

.trade-card {
  padding: 18px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.trade-card-body {
  display: grid;
  gap: 0;
}

.trade-card.is-collapsed .trade-header {
  border-bottom: 0;
}

.trade-card-toggle-button {
  min-width: 112px;
}

.trade-card-selected {
  border-color: var(--brand);
  box-shadow: 0 16px 36px rgba(23, 78, 166, 0.12);
}

.trade-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.trade-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.trade-title {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.02em;
}

.status-badge {
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
}

.status-active {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.status-paused {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.status-warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.status-danger {
  background: #fee2e2;
  color: #9f1d1d;
  border-color: #fecaca;
}

.status-muted {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.trade-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.trade-switch {
  margin-left: 2px;
}

.county-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.trade-more-row {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.county-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.county-card.active {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(23, 78, 166, 0.06), var(--shadow-soft);
}

.county-name {
  font-size: 14px;
  font-weight: 700;
}

.county-status {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.county-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.county-tier-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.county-tier-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto minmax(120px, 140px);
  gap: 12px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.county-tier-check {
  margin: 0;
}

.county-tier-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.county-tier-bid-input {
  width: 100%;
}

.county-tier-placeholder {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.switch {
  position: relative;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  z-index: 2;
}

.switch input:disabled {
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: 0.2s ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 4px;
  left: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: 0.2s ease;
}

.switch .slider {
  background: var(--dark);
}

.switch input:checked + .slider {
  background: var(--brand);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-management-grid {
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.4fr);
}

.admin-lead-layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
}

.tier-admin-list {
  display: grid;
  gap: 12px;
}

.tier-admin-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.tier-admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.tier-admin-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

.billing-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.billing-method-list {
  display: grid;
  gap: 12px;
}

.billing-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.billing-method-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 14px;
  padding: 14px 16px;
}

.billing-method-card.is-primary {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(21, 61, 120, 0.08);
  background: #ffffff;
}

.billing-card-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.billing-card-row h3 {
  margin: 0;
  font-size: 15px;
}

.billing-method-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.billing-form {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

#saveBillingMethodButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 190px;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: btn-spin 0.75s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.billing-address-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.billing-field-full {
  width: 100%;
}

.stripe-card-element {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 12px;
  padding: 13px 14px;
}

.stripe-card-element.is-disabled {
  background: var(--surface-soft);
  opacity: 0.8;
}

.billing-loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 39, 68, 0.48);
  backdrop-filter: blur(6px);
  z-index: 1190;
}

.billing-loading-overlay[hidden] {
  display: none !important;
}

.billing-loading-card {
  width: min(100%, 420px);
  padding: 34px 30px;
  border-radius: 24px;
  border: 1px solid rgba(21, 61, 120, 0.18);
  background: #ffffff;
  box-shadow: 0 30px 70px rgba(15, 39, 68, 0.18);
  text-align: center;
}

.billing-loading-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.billing-loading-card p {
  margin: 0;
  color: var(--muted);
}

.billing-loading-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 999px;
  border: 4px solid rgba(21, 61, 120, 0.14);
  border-top-color: var(--brand);
  animation: btn-spin 0.8s linear infinite;
}

.billing-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 39, 68, 0.52);
  backdrop-filter: blur(4px);
  z-index: 1200;
}

.billing-modal[hidden] {
  display: none !important;
}

.billing-modal-card {
  width: min(100%, 540px);
  padding: 24px 24px 22px;
  border-radius: 20px;
  border: 2px solid #e55f4d;
  background: linear-gradient(180deg, #fff4f2 0%, #ffffff 100%);
  box-shadow: 0 24px 60px rgba(15, 39, 68, 0.24);
}

.convert-lead-modal-card {
  width: min(100%, 920px);
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.convert-lead-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.convert-lead-form-grid textarea {
  width: 100%;
  min-height: 94px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font: inherit;
}

.convert-lead-field-full {
  grid-column: 1 / -1;
}

.convert-lead-modal-actions {
  gap: 12px;
}

.billing-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.billing-modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.billing-modal-title {
  margin: 6px 0 10px;
  font-size: 28px;
  letter-spacing: -0.03em;
  color: #8a2c18;
}

.billing-modal-copy {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
}

.billing-modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.user-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.user-card,
.empty-state {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 14px;
  padding: 14px 16px;
}

.user-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.user-card h3,
.empty-state h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.user-role-field {
  max-width: 260px;
  margin-top: 12px;
}

.user-role-field select:not(.bbp-select-native-control):disabled {
  color: #102033;
  opacity: 1;
  cursor: not-allowed;
  -webkit-text-fill-color: #102033;
}

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

.user-admin-form {
  display: grid;
  gap: 16px;
}

.user-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.user-admin-field-full {
  grid-column: 1 / -1;
}

.user-admin-actions {
  display: flex;
  justify-content: flex-start;
}

.catalog-list {
  display: grid;
  gap: 12px;
}

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

.catalog-summary-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.catalog-summary-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.catalog-summary-value {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
}

.catalog-filter-form {
  margin-bottom: 18px;
}

.catalog-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

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

.catalog-filter-grid {
  grid-template-columns: minmax(140px, 1.15fr) minmax(150px, 1.15fr) minmax(88px, 0.65fr) minmax(118px, 0.75fr);
  align-items: end;
}

.admin-lead-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-lead-textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.admin-lead-result-card {
  margin-top: 4px;
}

.admin-lead-result-copy {
  margin-top: 10px;
}

.admin-lead-result-tags {
  margin-top: 12px;
}

.lead-filters-panel {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.lead-filters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.filter-dropdown {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  align-self: start;
  box-shadow: var(--shadow-soft);
}

.filter-dropdown summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.filter-dropdown summary::after {
  content: "▾";
  font-size: 12px;
  color: var(--muted);
}

.filter-dropdown[open] summary::after {
  content: "▴";
}

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

.filter-dropdown-meta {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.filter-dropdown-menu {
  max-height: 220px;
  overflow: auto;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 7px;
  color: var(--text);
  transition: background 0.15s ease;
}

.filter-check:hover {
  background: var(--brand-soft);
}

.filter-check input {
  accent-color: var(--brand);
}

.lead-filters-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.admin-catalog-layout {
  display: block;
}

.catalog-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow-x: auto;
  overflow-y: hidden;
}

.catalog-table-head {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) minmax(120px, 0.9fr) minmax(150px, 1fr) 80px 110px 110px 120px 130px 90px;
    min-width: 1240px;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.catalog-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) minmax(120px, 0.9fr) minmax(150px, 1fr) 80px 110px 110px 120px 130px 90px;
    min-width: 1240px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: transparent;
}

.catalog-card h3 {
  margin: 0;
  font-size: 15px;
}

.catalog-cell {
  min-width: 0;
}

.catalog-cell-county {
  font-weight: 700;
}

.catalog-cost-input {
    width: 100%;
    max-width: 96px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
    color: var(--text);
  }

.admin-leads-table-head,
.admin-lead-report-card {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 1.5fr) minmax(120px, 1fr) minmax(180px, 1.2fr) 110px 70px minmax(140px, 1fr) 90px 90px 110px;
  min-width: 1320px;
  gap: 14px;
  align-items: center;
}

.profitability-filters-grid {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  align-items: end;
}

.profitability-series-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  grid-column: 1 / -1;
  align-self: end;
  min-width: 0;
  overflow: visible;
}

.profitability-series-toggles {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  min-height: 44px;
  align-items: center;
  overflow-x: visible;
  overflow-y: visible;
  white-space: nowrap;
  width: 100%;
  min-width: 0;
}

.series-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.series-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.series-toggle-revenue {
  border-color: rgba(37, 99, 235, 0.28);
}

.series-toggle-cost {
  border-color: rgba(249, 115, 22, 0.32);
}

.series-toggle-profit {
  border-color: rgba(5, 150, 105, 0.32);
}

.profitability-chart-card {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.profitability-chart-wrap {
  height: 320px;
  margin-top: 16px;
}

.profitability-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.profitability-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.profitability-table th,
.profitability-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-size: 14px;
  white-space: nowrap;
}

.profitability-table thead th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profitability-table th:first-child,
.profitability-table td:first-child {
  text-align: left;
}

.profitability-table tbody th,
.profitability-table tbody td {
  font-weight: 700;
}

.profitability-table tbody tr:last-child th,
.profitability-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-billing-filters-grid {
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.7fr) minmax(260px, 1fr);
}

.admin-billing-table {
  min-width: 1040px;
}

.profitability-simulation-filters-grid {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(220px, 0.9fr);
}

.profitability-simulation-tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.profitability-simulation-input-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.82);
}

.profitability-simulation-input-card h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 15px;
}

.profitability-simulation-tier-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

.profitability-simulation-tier-card strong,
.profitability-simulation-tier-card small {
  display: block;
}

.profitability-simulation-tier-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profitability-simulation-tier-card input {
  width: 100%;
}

.profitability-simulation-table {
  min-width: 1180px;
}

.profitability-simulation-optimization {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(20, 184, 166, 0.24);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.9), rgba(239, 246, 255, 0.78));
}

.profitability-simulation-optimization-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.profitability-simulation-optimization h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 17px;
}

.profitability-optimization-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.profitability-optimization-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
}

.profitability-optimization-card.is-best {
  border-color: rgba(5, 150, 105, 0.34);
  background: #ffffff;
}

.profitability-optimization-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.profitability-optimization-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-billing-company-cell {
  display: grid;
  gap: 4px;
}

.admin-billing-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ping-post-table {
  min-width: 1120px;
}

.ping-post-table .mono-cell {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink);
}

.ping-post-note-row td {
  background: #fff7ed;
  color: #9a3412;
  font-weight: 600;
  text-align: left;
}

.active-catgeos-table {
  min-width: 1120px;
}

.active-catgeos-table th,
.active-catgeos-table td {
  vertical-align: top;
}

.active-catgeos-table th:nth-child(-n + 5),
.active-catgeos-table td:nth-child(-n + 5) {
  text-align: left;
}

.tier-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 260px;
}

.tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tier-pill small {
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.admin-table-muted {
  max-width: 260px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
}

.profitability-positive {
  color: #047857;
}

.profitability-negative {
  color: #b91c1c;
}

.catalog-settings-list {
  display: grid;
  gap: 12px;
}

.catalog-create-trade-form {
  margin-bottom: 18px;
}

.catalog-create-trade-header {
  margin-bottom: 12px;
}

.catalog-create-trade-grid {
  grid-template-columns: minmax(180px, 1.3fr) repeat(3, minmax(150px, 1fr));
}

.catalog-setting-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 320px) auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.catalog-setting-card-wide {
  grid-template-columns: minmax(260px, 1fr) minmax(420px, 0.9fr);
  margin-bottom: 18px;
}

.maintenance-setting-card.is-enabled {
  border-color: rgba(194, 120, 3, 0.32);
  background: #fff8ea;
}

.blocked-tier-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.blocked-tier-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.blocked-tier-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 700;
}

.county-tier-row.is-blocked {
  opacity: 0.72;
  background: #f8fafc;
}

.merchant-processing-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.merchant-processing-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.merchant-processing-header h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.merchant-processing-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
}

.merchant-processing-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.merchant-processing-section h4 {
  margin: 0;
  color: var(--brand-deep);
  font-size: 16px;
}

.catalog-callrail-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.catalog-callrail-settings .btn {
  min-height: 42px;
}

.callrail-toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--text);
  font-weight: 800;
}

.callrail-toggle-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.callrail-toggle-switch {
  display: inline-flex;
}

.callrail-toggle-control input:focus-visible + .callrail-toggle-switch {
  outline: 3px solid rgba(230, 126, 34, 0.32);
  outline-offset: 3px;
  border-radius: 999px;
}

.callrail-toggle-control input:checked + .callrail-toggle-switch .slider {
  background: var(--brand);
}

.callrail-toggle-control input:checked + .callrail-toggle-switch .slider::before {
  transform: translateX(22px);
}

.callrail-toggle-control input:disabled + .callrail-toggle-switch {
  opacity: 0.55;
}

.catalog-setting-card h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.admin-leads-table-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-lead-report-card {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: transparent;
}

.admin-lead-unsold {
  border-color: #f1b7b2;
  background: #fff2f1;
}

.admin-lead-unsold .lead-summary-button {
  background: transparent;
}

.admin-lead-buyers {
  margin-bottom: 16px;
}

.admin-lead-buyers h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.admin-lead-buyer-list {
  display: grid;
  gap: 10px;
}

.admin-lead-buyer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 110px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.admin-lead-transaction-notes {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
}

.tooltip-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 20;
  width: max-content;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1f2a3d;
  color: #ffffff;
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.tooltip-wrap:hover .tooltip-bubble,
.tooltip-wrap:focus-within .tooltip-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.field-label-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.field-tooltip-wrap {
  line-height: 1;
}

.field-tooltip-trigger {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(69, 103, 220, 0.28);
  border-radius: 999px;
  background: rgba(69, 103, 220, 0.08);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.field-tooltip-wrap .tooltip-bubble {
  left: 0;
  bottom: calc(100% + 8px);
  background: #1f2a3d;
  color: #ffffff;
  transform: translateY(4px);
}

.field-tooltip-wrap:hover .tooltip-bubble,
.field-tooltip-wrap:focus-within .tooltip-bubble {
  transform: translateY(0);
}

.field-tooltip-wrap:focus-visible {
  outline: none;
}

.field-tooltip-wrap:focus-visible .field-tooltip-trigger {
  outline: 3px solid rgba(69, 103, 220, 0.22);
  outline-offset: 2px;
}

.catalog-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.footer-savebar {
  position: sticky;
  bottom: 18px;
  margin-top: 18px;
  z-index: 10;
}

.savebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.tag-group-counties {
  margin-top: 8px;
}

.save-status {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.working-summary {
  margin-top: 18px;
}

.transaction-list {
  display: grid;
  gap: 12px;
}

.compact-list {
  margin-top: 12px;
}

.transaction-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 8px;
  padding: 16px;
}

.transaction-card.compact {
  padding: 14px 16px;
}

.transaction-main h3,
.transaction-title-row h3 {
  margin: 0;
  font-size: 15px;
}

.transaction-title-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.transaction-type {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--brand-soft);
  border: 1px solid var(--success-border);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.transaction-meta {
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

.transaction-meta strong {
  display: block;
  color: var(--text);
  margin-bottom: 6px;
}

.lead-transaction-card {
  display: block;
}

.transaction-card.admin-lead-unsold {
  border-color: #efaaa4;
  background: #fff1f0;
  box-shadow: 0 16px 34px rgba(153, 27, 27, 0.09);
}

.admin-lead-unsold .lead-summary-button,
.admin-lead-unsold .lead-expanded-panel {
  background: #fff1f0;
}

.admin-lead-unsold .lead-summary-button:hover {
  background: #ffe7e5;
}

.lead-summary-button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.lead-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.lead-summary-item {
  min-width: 0;
}

.lead-summary-item strong {
  display: block;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

.lead-summary-item-price {
  text-align: right;
}

.lead-summary-item-price-credited strong {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.credited-label {
  display: block;
  margin-top: 3px;
  color: #168a53;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lead-summary-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
}

.admin-control-label {
  margin-top: 18px;
}

.checkbox-field {
  justify-content: flex-start;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--text);
  font-weight: 800;
}

.checkbox-inline input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.lead-expanded-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.lead-transaction-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.lead-transaction-meta-top {
  text-align: right;
  color: var(--muted);
}

.lead-transaction-meta-top strong {
  color: var(--text);
}

.lead-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.lead-detail-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.lead-detail-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lead-detail-item strong {
  display: block;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

.lead-note-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.lead-note-field {
  margin: 0;
}

.lead-note-field textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

.lead-note-actions {
  display: flex;
  justify-content: flex-end;
}

.admin-lead-refund-actions {
  flex-wrap: wrap;
}

.admin-lead-refund-actions > .tooltip-wrap {
  margin-left: 12px;
  margin-bottom: 12px;
}

.admin-lead-refund-actions > .tooltip-wrap:first-child {
  margin-left: 0;
}

.save-status.is-error {
  color: #8a2c18;
}

.floating-notice {
  position: fixed;
  max-width: 320px;
  padding: 12px 14px;
  border: 1px solid #f1d4d0;
  border-radius: 14px;
  background: rgba(255, 244, 242, 0.98);
  color: #8a2c18;
  box-shadow: 0 14px 28px rgba(35, 53, 77, 0.16);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  z-index: 1000;
}

.error-panel {
  margin-top: 24px;
}

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-shell {
  width: 100%;
  max-width: 520px;
}

.auth-card {
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-title {
  font-size: 32px;
}

.auth-subtitle {
  margin-top: 16px;
  max-width: none;
}

.auth-form {
  margin-top: 20px;
  display: grid;
  gap: 16px;
}

.auth-submit,
.auth-google-button {
  width: 100%;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.auth-google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  color: #1f1f1f;
  border-color: #d7dbe2;
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.06);
  overflow: hidden;
}

.auth-google-button:hover {
  background: #ffffff;
  border-color: #c5ccd6;
}

.google-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex-shrink: 0;
  overflow: hidden;
}

.google-mark svg {
  display: block;
  flex: 0 0 16px;
}

.auth-google-label {
  line-height: 1;
}

.auth-divider {
  position: relative;
  margin: 22px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  position: relative;
  display: inline-block;
  padding: 0 10px;
  background: var(--surface);
}

.auth-note,
.auth-alert {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
}

.auth-note {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
}

.auth-alert {
  margin-top: 18px;
}

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

.auth-alert-error {
  border: 1px solid #f1d4d0;
  background: #fff4f2;
  color: #8a2c18;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.switch input:disabled {
  cursor: not-allowed;
}

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

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

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

  .lead-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .client-menu-row {
    flex-direction: column;
    align-items: stretch;
  }

  .client-company-form {
    flex: 1 1 auto;
  }

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

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

  .user-management-grid {
    grid-template-columns: 1fr;
  }

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

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

  .stats {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    max-width: none;
  }

  .lead-note-row {
    grid-template-columns: 1fr;
  }

  .lead-summary-item-price {
    text-align: left;
  }

  .lead-filters-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .county-tier-row {
    grid-template-columns: 1fr;
  }

  .county-tier-placeholder,
  .county-tier-meta {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .billing-target-form {
    grid-template-columns: 1fr;
  }

  .billing-target-button {
    width: 100%;
  }

  body {
    padding: 0;
  }

  h1 {
    font-size: 28px;
  }

  .brand-lockup {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .brand-logo {
    width: 46px;
  }

  .stats,
  .pill-grid,
  .county-grid,
  .lead-filters-grid,
  .admin-lead-grid,
  .lead-summary-grid,
  .lead-detail-grid,
  .trade-settings,
  .editor-grid,
  .inline-field,
  .user-admin-grid,
  .billing-address-grid {
    grid-template-columns: 1fr;
  }

  .workspace-tab-button {
    min-width: 0;
    flex: 1 1 100%;
  }

  .billing-modal {
    padding: 14px;
  }

  .convert-lead-form-grid {
    grid-template-columns: 1fr;
  }

  .billing-method-actions,
  .billing-toolbar {
    justify-content: flex-start;
  }

  .trade-add-row {
    grid-template-columns: 1fr;
  }

  .trade-title {
    font-size: 20px;
  }

  .trade-collapse-button,
  .business-day-row {
    grid-template-columns: 1fr;
  }

  .floating-notice {
    left: 14px;
    max-width: none;
  }
}

/* Tailwind / Preline polish layer. Keeps existing PHP and JS hooks intact. */
.page-shell {
  animation: bbp-shell-in 240ms ease-out;
}

@keyframes bbp-shell-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar,
.card,
.savebar,
.working-company-menu,
.billing-modal-card,
.billing-loading-card {
  border-color: rgba(203, 213, 225, 0.9);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
}

.brand-logo {
  width: 44px;
}

.eyebrow {
  color: var(--brand);
  letter-spacing: 0.14em;
}

.subtitle {
  color: #526174;
}

.stats {
  align-content: start;
}

.stat-card,
.snapshot-card,
.pill-item,
.user-card,
.billing-method-card,
.merchant-processing-card,
.catalog-setting-card,
.callrail-tracking-card {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stat-card:hover,
.snapshot-card:hover,
.pill-item:hover,
.user-card:hover,
.billing-method-card:hover,
.trade-card:hover,
.county-card:hover,
.transaction-card:hover {
  border-color: rgba(148, 163, 184, 0.85);
}

.workspace-tab-button.is-active,
.client-tab-nav .tab-button.is-active {
  color: var(--brand);
}

.admin-tab-button.is-active,
.workspace-tab-button-admin.is-active {
  color: #b45309;
}

.btn:focus-visible,
.tab-button:focus-visible,
.working-company-trigger:focus-visible,
.lead-summary-button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn-dark {
  box-shadow: 0 10px 22px rgba(23, 78, 166, 0.18);
}

.btn-attention {
  box-shadow: 0 10px 22px rgba(249, 115, 22, 0.18);
}

.status-active {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.status-paused {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.status-warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.status-danger,
.save-status.is-error {
  color: var(--danger-text);
}

.trade-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.98)),
    #ffffff;
}

.trade-card-selected {
  border-color: rgba(23, 78, 166, 0.55);
}

.county-card.active {
  border-color: rgba(23, 78, 166, 0.56);
}

.county-tier-row,
.business-day-row,
.blocked-tier-row,
.lead-detail-item,
.transaction-card {
  background: rgba(255, 255, 255, 0.82);
}

.lead-summary-button {
  border-radius: 8px;
}

.lead-summary-button:hover {
  color: var(--brand-deep);
}

.lead-expanded-panel {
  border-color: rgba(203, 213, 225, 0.82);
}

.catalog-table,
.admin-leads-table {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.catalog-table-head,
.admin-leads-table-head {
  background: #f8fafc;
  color: #475569;
}

.catalog-card:hover,
.admin-lead-report-card:hover {
  background: #ffffff;
}

.test-mode-banner {
  margin: -24px -24px 20px;
  background: linear-gradient(90deg, #f59e0b 0%, #ea580c 100%);
}

.billing-modal-card,
.billing-loading-card {
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.26);
}

.floating-notice {
  border-radius: 8px;
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px;
  }

  .test-mode-banner {
    margin: -16px -16px 16px;
  }

  .topbar {
    padding: 16px;
  }
}

/* Preline-inspired dashboard refinement: tighter panels and listing-first surfaces. */
body {
  background:
    radial-gradient(circle at 12% -14%, rgba(23, 78, 166, 0.08), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, #f3f6fa 42%, #eef3f8 100%);
}

.topbar {
  align-items: center;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 16px 44px rgba(15, 23, 42, 0.06);
}

.topbar::before {
  width: 3px;
}

.topbar-side {
  align-items: center;
}

.brand-logo {
  width: 40px;
}

.brand-lockup {
  gap: 12px;
}

h1 {
  font-size: 30px;
  font-weight: 700;
}

.subtitle {
  max-width: 620px;
  margin-top: 7px;
  line-height: 1.45;
}

.account-chip {
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.stats {
  gap: 10px;
}

.stat-card {
  border: 1px solid rgba(203, 213, 225, 0.76);
  background: #ffffff;
  box-shadow: none;
}

.stat-label,
.snapshot-label,
.lead-detail-label,
.catalog-table-head,
.admin-leads-table-head {
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 25px;
}

.workspace-nav,
.client-menu-row,
.admin-tab-nav {
  position: sticky;
  top: 12px;
  z-index: 30;
}

.client-menu-row {
  padding: 6px;
  border: 1px solid rgba(203, 213, 225, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(12px);
}

.client-menu-row .tab-nav {
  margin-bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.client-company-form {
  align-self: stretch;
}

.working-company-trigger {
  min-height: 100%;
  border-color: rgba(203, 213, 225, 0.8);
  background: #ffffff;
}

.tab-nav {
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.tab-button {
  min-height: 38px;
  padding: 9px 13px;
  color: #526174;
}

.tab-button.is-active {
  background: #ffffff;
  color: var(--brand);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), inset 0 -2px 0 rgba(23, 78, 166, 0.75);
}

.admin-tab-nav .tab-button.is-active {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), inset 0 -2px 0 rgba(249, 115, 22, 0.85);
}

.grid-main {
  gap: 16px;
}

.card,
.panel {
  border-color: rgba(203, 213, 225, 0.82);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 14px 40px rgba(15, 23, 42, 0.04);
}

.panel {
  padding: 0;
  overflow: hidden;
}

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.panel > :not(.panel-header) {
  margin: 18px;
}

.panel > .trade-list,
.panel > .transaction-list,
.panel > .snapshot-stack,
.panel > .compact-list,
.panel > .callrail-tracking-list,
.panel > .tier-admin-list {
  margin: 0;
}

.snapshot-stack,
.control-stack,
.transaction-list,
.trade-list,
.callrail-tracking-list,
.tier-admin-list,
.billing-method-list,
.admin-lead-buyer-list {
  gap: 0;
}

.snapshot-card,
.pill-item,
.user-card,
.billing-method-card,
.tier-admin-card,
.callrail-tracking-card,
.transaction-card,
.catalog-setting-card,
.merchant-processing-card {
  border-width: 0 0 1px;
  border-color: rgba(226, 232, 240, 0.95);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.snapshot-card:first-child,
.pill-item:first-child,
.user-card:first-child,
.billing-method-card:first-child,
.tier-admin-card:first-child,
.callrail-tracking-card:first-child,
.transaction-card:first-child,
.catalog-setting-card:first-child,
.merchant-processing-card:first-child {
  border-top: 0;
}

.snapshot-card:last-child,
.pill-item:last-child,
.user-card:last-child,
.billing-method-card:last-child,
.tier-admin-card:last-child,
.callrail-tracking-card:last-child,
.transaction-card:last-child,
.catalog-setting-card:last-child,
.merchant-processing-card:last-child {
  border-bottom: 0;
}

.snapshot-stack,
.user-management-grid .card,
.billing-method-list,
.callrail-tracking-list,
.transaction-list,
.tier-admin-list,
.catalog-settings-list {
  border-radius: 8px;
}

.pill-grid {
  gap: 0;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 8px;
  overflow: hidden;
}

.pill-item {
  border-right-width: 1px;
}

.pill-item.active {
  background: #f8fbff;
}

.trade-list {
  gap: 14px;
}

.trade-card {
  padding: 0;
  overflow: hidden;
  background: #ffffff;
}

.trade-header {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.trade-settings,
.trade-search-row,
.trade-business-hours,
.trade-connection-panel,
.county-grid,
.trade-more-row {
  margin-left: 18px;
  margin-right: 18px;
}

.trade-settings {
  padding-top: 18px;
  border-top: 0;
}

.county-grid {
  gap: 10px;
  margin-bottom: 18px;
}

.county-card {
  background: #ffffff;
  box-shadow: none;
}

.county-card.active {
  background: #fbfdff;
  border-color: rgba(23, 78, 166, 0.32);
  box-shadow: inset 0 0 0 1px rgba(23, 78, 166, 0.08);
}

.trade-card-selected {
  border-color: rgba(23, 78, 166, 0.30);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.pill-item.active,
.working-company-option[aria-selected="true"],
.filter-check:has(input:checked) {
  background: #f5f9ff;
  box-shadow: inset 0 0 0 1px rgba(23, 78, 166, 0.08);
}

.tab-button.is-active,
.admin-tab-nav .tab-button.is-active {
  position: relative;
  background: transparent;
  box-shadow: none;
}

.tab-button.is-active::after,
.admin-tab-nav .tab-button.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.client-tab-nav .tab-button.is-active,
.workspace-tab-button.is-active {
  color: #174ea6;
}

.admin-tab-nav .tab-button.is-active,
.workspace-tab-button-admin.is-active {
  color: #c2410c;
}

.county-tier-row {
  grid-template-columns: minmax(0, 1.3fr) auto minmax(116px, 132px);
}

.status-badge,
.badge,
.tag,
.transaction-type,
.filter-dropdown-meta {
  border-radius: 999px;
  padding-inline: 10px;
}

.input,
.select,
.field input,
.field select,
.field textarea,
.catalog-cost-input,
.working-company-search,
.admin-lead-textarea {
  border-color: rgba(203, 213, 225, 0.9);
  background: #ffffff;
}

.input:hover,
.select:hover,
.field input:hover,
.field select:hover,
.field textarea:hover,
.catalog-cost-input:hover,
.admin-lead-textarea:hover {
  border-color: rgba(148, 163, 184, 0.95);
}

.btn {
  min-height: 38px;
  padding: 9px 13px;
}

.btn-small {
  min-height: 34px;
  padding: 7px 11px;
}

.catalog-table,
.admin-leads-table {
  border-color: rgba(226, 232, 240, 0.95);
  background: #ffffff;
}

.catalog-table-head,
.admin-leads-table-head {
  border-bottom-color: rgba(226, 232, 240, 0.95);
  background: #f8fafc;
}

.catalog-card,
.admin-lead-report-card {
  border-top-color: rgba(226, 232, 240, 0.95);
  background: #ffffff;
}

.catalog-card:hover,
.admin-lead-report-card:hover,
.transaction-card:hover,
.user-card:hover,
.billing-method-card:hover,
.tier-admin-card:hover,
.callrail-tracking-card:hover,
.snapshot-card:hover {
  background: #f8fafc;
}

.lead-filters-panel {
  border-color: rgba(226, 232, 240, 0.95);
  background: #ffffff;
}

.filter-dropdown {
  box-shadow: none;
}

.lead-summary-grid {
  margin-bottom: 0;
}

.lead-expanded-panel {
  margin-top: 14px;
}

.savebar {
  border-color: rgba(203, 213, 225, 0.9);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
}

@media (max-width: 980px) {
  .workspace-nav,
  .client-menu-row,
  .admin-tab-nav {
    position: static;
  }

  .panel > :not(.panel-header),
  .trade-settings,
  .trade-search-row,
  .trade-business-hours,
  .trade-connection-panel,
  .county-grid,
  .trade-more-row {
    margin-left: 14px;
    margin-right: 14px;
  }
}

/* Preline-style controls and listing rows. */
.switch {
  width: 44px;
  height: 24px;
}

.slider {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.slider::before {
  width: 18px;
  height: 18px;
  top: 2px;
  left: 2px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
}

.switch .slider {
  background: #e2e8f0;
}

.switch input:checked + .slider,
.callrail-toggle-control input:checked + .callrail-toggle-switch .slider {
  background: #174ea6;
  border-color: #174ea6;
}

.switch input:checked + .slider::before,
.callrail-toggle-control input:checked + .callrail-toggle-switch .slider::before {
  transform: translateX(20px);
}

.switch input:focus-visible + .slider,
.callrail-toggle-control input:focus-visible + .callrail-toggle-switch .slider {
  box-shadow: var(--ring), inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.switch input:disabled + .slider {
  opacity: 0.55;
}

.input,
.select,
.field input,
.field select,
.field textarea,
.catalog-cost-input,
.admin-lead-textarea,
.working-company-trigger,
.working-company-search {
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 6px;
  border-color: #d1d9e6;
  color: #102033;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.03);
}

.currency-input input {
  min-height: 38px;
  padding-left: 34px;
}

.currency-input-compact input {
  padding-left: 28px;
}

.money-field-readonly input,
.currency-input input[disabled],
.currency-input input[readonly] {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}

.money-field-readonly .currency-input-symbol {
  color: #475569;
}

.county-tier-bid-input {
  font-weight: 700;
}

.select,
.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.input:focus,
.select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.catalog-cost-input:focus,
.admin-lead-textarea:focus,
.working-company-trigger:focus-visible,
.working-company-search:focus {
  border-color: #174ea6;
  box-shadow: var(--ring);
}

.filter-dropdown {
  position: relative;
  border-color: #d1d9e6;
  overflow: visible;
}

.filter-dropdown summary {
  min-height: 38px;
  padding: 9px 12px;
}

.filter-dropdown summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.8px solid #64748b;
  border-bottom: 1.8px solid #64748b;
  transform: rotate(45deg) translateY(-2px);
}

.filter-dropdown[open] summary::after {
  content: "";
  transform: rotate(225deg) translateY(-2px);
}

.filter-dropdown-menu,
.working-company-menu {
  border-radius: 8px;
  border-color: #d1d9e6;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.filter-check,
.working-company-option {
  min-height: 34px;
  border-radius: 6px;
  font-size: 13px;
}

.filter-check:hover,
.working-company-option:hover,
.working-company-option[aria-selected="true"] {
  background: #f1f6ff;
}

.lead-transaction-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.lead-transaction-card + .lead-transaction-card {
  margin-top: 10px;
}

.lead-summary-button {
  display: block;
  padding: 14px 16px;
  background: #ffffff;
  transition: background 0.16s ease;
}

.lead-summary-button:hover {
  background: #f8fafc;
}

.lead-summary-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(170px, 1.2fr) minmax(150px, 1fr) minmax(130px, 0.9fr) minmax(120px, 0.8fr) 78px;
  gap: 16px;
  align-items: center;
}

.lead-summary-item {
  min-width: 0;
}

.lead-detail-label {
  margin-bottom: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.lead-summary-item strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
}

.lead-summary-toggle {
  justify-content: flex-end;
  color: #174ea6;
}

.lead-summary-toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.lead-summary-button[aria-expanded="true"] .lead-summary-toggle::after {
  transform: rotate(225deg) translateY(-2px);
}

.lead-expanded-panel {
  margin: 0;
  padding: 16px;
  border-top: 1px solid #e2e8f0;
  background: #fbfdff;
}

.lead-detail-grid {
  gap: 10px;
}

.lead-detail-item {
  padding: 10px 12px;
  border-color: #e2e8f0;
  background: #ffffff;
}

.admin-lead-report-card.lead-transaction-card {
  border-radius: 8px;
}

.admin-lead-summary-grid {
  grid-template-columns: 84px minmax(140px, 1fr) minmax(170px, 1.2fr) minmax(150px, 1fr) minmax(130px, 0.9fr) 90px minmax(120px, 0.8fr) 90px 90px 86px;
}

.transaction-card:not(.lead-transaction-card) {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 10px;
}

.transaction-main h3,
.transaction-title-row h3 {
  color: #0f172a;
  font-weight: 700;
}

.muted {
  color: #64748b;
}

@media (max-width: 1180px) {
  .lead-summary-grid,
  .admin-lead-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lead-summary-toggle {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .lead-summary-grid,
  .admin-lead-summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .lead-summary-item-price {
    text-align: left;
  }
}

#leadTransactionList.transaction-list {
  margin: 0 18px 18px;
}

#changeTransactionList.transaction-list,
#billingTransactionList.transaction-list {
  margin: 18px;
}

#leadFiltersPanel + #leadTransactionList.transaction-list {
  margin-top: 0;
}

#leadTransactionList .empty-state,
#changeTransactionList .empty-state,
#billingTransactionList .empty-state {
  margin: 0;
}

/* Unified money inputs: trade balances, daily budgets, and county tier caps. */
.currency-input {
  --money-symbol-left: 13px;
  --money-input-padding-left: 40px;
  --money-control-height: 40px;
  --money-control-radius: 6px;
  --money-control-border: #d1d9e6;
  --money-control-bg: #ffffff;
  --money-control-text: #102033;
  --money-symbol-color: #64748b;
}

.currency-input-compact {
  --money-symbol-left: 14px;
  --money-input-padding-left: 42px;
  --money-control-border: #bcc7d6;
}

.currency-input-symbol {
  left: var(--money-symbol-left);
  width: 14px;
  color: var(--money-symbol-color);
  text-align: center;
  font-size: 13px;
  line-height: 1;
  margin-top: 0;
}

.currency-input input {
  height: var(--money-control-height);
  min-height: var(--money-control-height);
  padding: 0 12px 0 var(--money-input-padding-left);
  border-radius: var(--money-control-radius);
  border-color: var(--money-control-border);
  background: var(--money-control-bg);
  color: var(--money-control-text);
  line-height: calc(var(--money-control-height) - 2px);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.currency-input input[type="number"] {
  appearance: textfield;
}

.currency-input input[type="number"]::-webkit-outer-spin-button,
.currency-input input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

/* Revenue Command Center refresh */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #fbfcff;
  --border: #e5edf6;
  --border-strong: #cbd5e1;
  --text: #111827;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --brand: #2563eb;
  --brand-deep: #1e40af;
  --brand-soft: #eff6ff;
  --accent: #0f766e;
  --accent-soft: #ecfdf5;
  --money: #16a34a;
  --warning: #f59e0b;
  --danger: #ef4444;
  --ring: 0 0 0 4px rgba(37, 99, 235, 0.14);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --shadow-lift: 0 24px 70px rgba(15, 23, 42, 0.11);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --sidebar-width: 284px;
}

html,
body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background:
    radial-gradient(circle at 4% 0%, rgba(37, 99, 235, 0.10), transparent 34rem),
    radial-gradient(circle at 92% 7%, rgba(20, 184, 166, 0.12), transparent 30rem),
    linear-gradient(180deg, #f8fafc 0%, #f4f7fb 46%, #eef3f8 100%);
  color: var(--text);
}

.page-shell {
  max-width: none;
  padding: 0;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.dashboard-main {
  min-width: 0;
  padding: 24px;
}

.dashboard-sidebar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 100vh;
  padding: 18px;
  border-right: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(22px);
}

.dashboard-sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  min-height: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #f7fbff);
  box-shadow: var(--shadow-soft);
}

.sidebar-brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.16);
}

.sidebar-brand-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.sidebar-brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.sidebar-nav {
  display: grid;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.sidebar-nav-group {
  display: none;
  gap: 6px;
}

.sidebar-nav-group.is-active {
  display: grid;
}

.sidebar-nav-label {
  margin: 12px 10px 5px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #475569;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
  transform: translateX(2px);
}

.sidebar-support-link {
  margin-top: 8px;
  color: #0f766e;
  text-decoration: none;
}

.sidebar-support-link .sidebar-nav-icon {
  background: #dffaf1;
  color: #0f766e;
}

.sidebar-nav-item.is-active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(20, 184, 166, 0.10));
  color: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.10);
}

.sidebar-workspace-admin.is-active,
.sidebar-nav-item.admin-tab-button.is-active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(37, 99, 235, 0.08));
}

.sidebar-nav-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 6px;
  border-radius: 10px;
  background: #eef2ff;
  color: var(--brand-deep);
  stroke-width: 2.35;
}

.sidebar-nav-item.is-active .sidebar-nav-icon {
  background: #ffffff;
  color: var(--brand);
  box-shadow: var(--shadow-soft);
}

.sidebar-status-card {
  position: relative;
  margin-top: auto;
  overflow: hidden;
  padding: 15px;
  border-radius: 18px;
  background: #0f172a;
  color: #fff;
  box-shadow: var(--shadow);
}

.sidebar-status-card.is-live {
  background: linear-gradient(145deg, #0f172a, #0f766e);
}

.sidebar-status-card.is-test {
  background: linear-gradient(145deg, #0f172a, #b45309);
}

.sidebar-status-card.is-maintenance {
  background: linear-gradient(145deg, #111827, #991b1b);
}

.sidebar-status-card::after {
  content: "";
  position: absolute;
  right: -44px;
  bottom: -56px;
  width: 132px;
  height: 132px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.30);
}

.sidebar-status-card.is-test::after {
  background: rgba(245, 158, 11, 0.34);
}

.sidebar-status-card.is-maintenance::after {
  background: rgba(248, 113, 113, 0.34);
}

.sidebar-status-label {
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-status-value {
  margin-top: 9px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.sidebar-status-copy {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.5;
}

.legacy-tab-nav {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.topbar::before {
  display: none;
}

.brand-lockup {
  gap: 12px;
}

.brand-logo {
  width: 46px;
}

h1 {
  font-size: clamp(27px, 3.2vw, 42px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.055em;
}

.subtitle {
  max-width: 760px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.55;
}

.topbar-side {
  display: grid;
  grid-template-columns: auto auto minmax(220px, auto);
  gap: 10px;
  align-items: start;
  justify-items: end;
}

.btn-topbar-refresh,
.btn-topbar-signout {
  min-height: 42px;
  border-radius: 14px;
}

.btn-topbar-refresh {
  color: #334155;
  background: #ffffff;
  border-color: var(--border);
}

.btn-topbar-signout {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, #0f172a, #334155);
}

.account-chip {
  min-width: 220px;
  border-color: rgba(226, 232, 240, 0.92);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  width: min(100%, 940px);
  max-width: none;
  justify-self: end;
}

.stat-card {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: -42px;
  right: -42px;
  width: 112px;
  height: 112px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
}

.stat-card-money::after { background: rgba(22, 163, 74, 0.12); }
.stat-card-balance::after { background: rgba(20, 184, 166, 0.14); }
.stat-card-call::after { background: rgba(245, 158, 11, 0.15); }

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(37, 99, 235, 0.20);
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.stat-value {
  margin-top: 18px;
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.stat-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.client-menu-row {
  justify-content: flex-end;
  margin-bottom: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.client-company-form {
  flex: 0 0 min(360px, 100%);
}

.working-company-trigger {
  min-height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.admin-workspace .field select,
.admin-workspace .select,
.admin-tab-panel .field select,
.admin-tab-panel .select {
  min-height: 42px;
  border-radius: 14px;
  border-color: rgba(203, 213, 225, 0.9);
  background-color: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.admin-workspace .field select:hover,
.admin-workspace .select:hover,
.admin-tab-panel .field select:hover,
.admin-tab-panel .select:hover {
  border-color: rgba(31, 83, 150, 0.45);
}

.card,
.panel,
.trade-card,
.county-card,
.lead-transaction-card,
.transaction-card:not(.lead-transaction-card),
.billing-method-card,
.user-card,
.snapshot-card,
.callrail-tracking-card,
.catalog-setting-card,
.merchant-processing-card {
  border-color: rgba(226, 232, 240, 0.92);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.panel {
  overflow: hidden;
}

.panel-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.80);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.panel-title {
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.panel-copy {
  max-width: 760px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.55;
}

.performance-panel {
  margin-bottom: 18px;
}

#advertiserPerformancePanel {
  margin: 0;
}

.performance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.72fr);
  gap: 16px;
  padding: 18px;
}

.performance-chart-card,
.performance-side-card {
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.performance-chart-card {
  padding: 16px;
}

.performance-chart-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.performance-chart-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.performance-chart-copy {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.performance-pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.performance-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.performance-pill-blue {
  color: #1d4ed8;
  background: #eff6ff;
}

.performance-pill-green {
  color: #047857;
  background: #ecfdf5;
}

.performance-chart-wrap {
  height: 286px;
}

.performance-side-card {
  padding: 18px;
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.16), transparent 10rem),
    #ffffff;
}

.performance-side-label {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.performance-side-value {
  margin-top: 16px;
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
}

.performance-side-copy {
  margin-top: 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 650;
}

.performance-metric-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.performance-metric-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.performance-metric-list span {
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.performance-metric-list strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 850;
}

.grid-main {
  gap: 18px;
}

.btn,
.input,
.select,
.field input,
.field select,
.field textarea,
.catalog-cost-input,
.admin-lead-textarea,
.working-company-search {
  border-radius: 12px;
}

.btn {
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

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

.btn-dark {
  border-color: transparent;
  background: linear-gradient(135deg, #2563eb, #0f766e);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.20);
}

.btn-dark:hover:not(:disabled) {
  border-color: transparent;
  background: linear-gradient(135deg, #1d4ed8, #115e59);
  color: #ffffff;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.26);
}

.btn-attention:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
  color: #ffffff;
}

.lead-transaction-card,
.transaction-card:not(.lead-transaction-card),
.admin-lead-report-card.lead-transaction-card {
  border-radius: 16px;
  overflow: hidden;
}

.lead-transaction-card + .lead-transaction-card {
  margin-top: 12px;
}

.lead-summary-button {
  border-radius: 16px;
}

.lead-summary-button:hover,
.transaction-card:hover,
.user-card:hover,
.billing-method-card:hover,
.tier-admin-card:hover,
.callrail-tracking-card:hover,
.snapshot-card:hover,
.county-card:hover,
.trade-card:hover {
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.16);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.trade-card,
.county-card,
.transaction-card,
.lead-transaction-card,
.user-card,
.billing-method-card,
.tier-admin-card,
.callrail-tracking-card,
.snapshot-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

@media (max-width: 1180px) {
  .dashboard-layout {
    grid-template-columns: 238px minmax(0, 1fr);
  }

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

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

@media (max-width: 900px) {
  .dashboard-layout {
    display: block;
  }

  .dashboard-sidebar {
    position: sticky;
    top: 0;
    height: auto;
    max-height: 42vh;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.92);
  }

  .dashboard-sidebar-inner {
    gap: 10px;
    height: auto;
  }

  .sidebar-brand {
    padding: 8px 10px;
  }

  .sidebar-brand-logo {
    width: 30px;
    height: 30px;
  }

  .sidebar-brand-title {
    font-size: 13px;
  }

  .sidebar-brand-subtitle,
  .sidebar-status-card,
  .sidebar-nav-label {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 3px;
  }

  .sidebar-nav-group.is-active {
    display: flex;
    gap: 8px;
    min-width: max-content;
  }

  .sidebar-nav-item {
    width: auto;
    min-height: 38px;
    padding: 8px 10px;
    white-space: nowrap;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #ffffff;
  }

  .sidebar-nav-item:hover {
    transform: none;
  }

  .sidebar-nav-icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    border-radius: 8px;
  }

  .dashboard-main {
    padding: 16px;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .topbar-side {
    justify-items: stretch;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-chip {
    grid-column: 1 / -1;
  }

  .stats {
    width: 100%;
    justify-self: stretch;
  }

  .client-menu-row {
    justify-content: stretch;
  }

  .client-company-form {
    flex-basis: 100%;
  }
}

@media (max-width: 640px) {
  .dashboard-sidebar {
    max-height: 34vh;
  }

  .dashboard-main {
    padding: 12px;
  }

  .topbar-side,
  .stats,
  .grid-main,
  .billing-grid,
  .user-management-grid,
  .performance-grid {
    grid-template-columns: 1fr;
  }

  .brand-logo {
    width: 38px;
  }

  .account-chip,
  .stats,
  .performance-chart-toolbar {
    width: 100%;
  }

  .performance-chart-toolbar {
    display: grid;
  }

  .performance-pill-row {
    justify-content: flex-start;
  }

  .performance-chart-wrap {
    height: 240px;
  }

  .stat-card {
    min-height: 112px;
  }

  .panel-header,
  .performance-grid,
  .card.panel > :not(.panel-header) {
    margin-left: 0;
    margin-right: 0;
  }
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.currency-input input:hover {
  border-color: rgba(148, 163, 184, 0.95);
}

.currency-input input:focus {
  border-color: #174ea6;
  box-shadow: var(--ring);
}

.money-field-readonly {
  --money-control-bg: #f8fafc;
  --money-control-text: #0f172a;
  --money-symbol-color: #475569;
}

.money-field-readonly input,
.currency-input input[disabled],
.currency-input input[readonly] {
  cursor: default;
  opacity: 1;
  font-weight: 400;
}

.county-tier-row .currency-input {
  width: 100%;
}

.county-tier-bid-input {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(23, 78, 166, 0.04), 0 1px 2px rgba(15, 23, 42, 0.05);
}

.county-tier-bid-input:hover {
  background: #ffffff;
  border-color: #94a3b8;
}

.county-tier-bid-input:focus {
  background: #ffffff;
}

.trade-settings .field input,
.trade-settings .field select,
.trade-settings .currency-input input,
.trade-settings .toggle-inline {
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
}

.trade-settings .field > input,
.trade-settings .field > select {
  padding-top: 0;
  padding-bottom: 0;
  line-height: 38px;
}

.trade-toggle-field {
  align-content: start;
}

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: #102033;
}

.toggle-inline .switch {
  display: inline-block;
  position: relative;
  width: 44px;
  height: 24px;
  min-width: 44px;
  flex: 0 0 44px;
}

.toggle-inline .switch input {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.toggle-inline .slider {
  display: block;
}

.toggle-inline-text {
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.county-tier-row {
  grid-template-columns: minmax(0, 1fr) minmax(150px, 172px);
  grid-template-areas:
    "tier-label tier-action"
    "tier-meta tier-action";
  align-items: center;
  column-gap: 14px;
  row-gap: 4px;
}

.county-tier-check {
  grid-area: tier-label;
  min-width: 0;
}

.county-tier-check span {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.county-tier-meta {
  grid-area: tier-meta;
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
}

.county-tier-row .currency-input,
.county-tier-placeholder {
  grid-area: tier-action;
  align-self: center;
}

@media (max-width: 560px) {
  .county-tier-row {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "tier-label"
      "tier-meta"
      "tier-action";
  }

  .county-tier-placeholder {
    text-align: left;
  }
}

/* Preline-style lead filters. */
.lead-filters-panel {
  padding: 18px;
  border-color: #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.lead-filters-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.lead-filter-field {
  display: grid;
  gap: 7px;
  align-self: end;
  min-width: 0;
}

.lead-filter-label,
.field .lead-filter-label {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.lead-filter-field input,
.lead-filter-field .filter-dropdown summary {
  height: 40px;
  min-height: 40px;
  border-radius: 14px;
  border-color: #d1d9e6;
  background-color: rgba(255, 255, 255, 0.94);
  color: #102033;
  box-shadow: var(--shadow-soft);
}

.lead-filter-field input {
  padding: 0 12px;
  line-height: 38px;
}

.lead-filter-field input[type="date"] {
  padding-right: 10px;
  color-scheme: light;
}

.lead-filter-field input:hover,
.lead-filter-field .filter-dropdown:hover summary {
  border-color: #94a3b8;
}

.lead-filter-field input:focus,
.lead-filter-field .filter-dropdown summary:focus-visible {
  border-color: #174ea6;
  box-shadow: var(--ring);
  outline: none;
}

.lead-filter-field .filter-dropdown {
  width: 100%;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.lead-filter-field .filter-dropdown summary {
  border: 1px solid #d1d9e6;
  padding: 0 36px 0 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.filter-dropdown-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}

.lead-filter-field .filter-dropdown summary::after {
  position: absolute;
  right: 14px;
  top: 50%;
  margin-top: -5px;
}

.lead-filter-field .filter-dropdown-meta {
  min-width: 34px;
  justify-content: center;
  padding: 3px 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.lead-filter-field .filter-dropdown[open] .filter-dropdown-meta {
  background: #eaf2ff;
  color: #174ea6;
}

.lead-filter-field .filter-dropdown[open] summary {
  border-color: rgba(31, 83, 150, 0.45);
}

.lead-filter-field .filter-dropdown-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 260px;
  padding: 8px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.filter-dropdown-search {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  height: 38px;
  margin-bottom: 8px;
  padding: 0 12px;
  border: 1px solid #d1d9e6;
  border-radius: 12px;
  background: #ffffff;
  color: #102033;
  font-size: 13px;
  line-height: 36px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.filter-dropdown-search:focus {
  border-color: #174ea6;
  box-shadow: var(--ring);
  outline: none;
}

.lead-filter-field .filter-check {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 12px;
}

.lead-filter-field .filter-check input {
  width: 15px;
  height: 15px;
  min-height: 15px;
  padding: 0;
  box-shadow: none;
}

.date-input-wrap {
  display: block;
  position: relative;
}

.date-input-wrap input {
  border: 1px solid #d1d9e6;
  border-radius: 8px;
  background: #ffffff;
}

.date-input-wrap::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 15px;
  height: 15px;
  pointer-events: none;
  transform: translateY(-50%);
  opacity: 0.45;
  background:
    linear-gradient(#64748b, #64748b) 3px 5px / 9px 1.5px no-repeat,
    linear-gradient(#64748b, #64748b) 3px 9px / 9px 1.5px no-repeat,
    linear-gradient(#64748b, #64748b) 0 3px / 15px 1.5px no-repeat;
  border: 1.5px solid #64748b;
  border-radius: 3px;
}

.date-input-wrap input::-webkit-calendar-picker-indicator {
  opacity: 0;
  cursor: pointer;
}

.lead-date-range-field {
  grid-column: span 2;
}

.date-range-picker-control {
  min-width: 0;
}

.date-range-picker-control input,
.date-range-picker-control .flatpickr-input {
  cursor: pointer;
}

.date-range-picker-control .date-input-wrap::before {
  z-index: 1;
}

.lead-filters-actions {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.lead-report-export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.text-link {
  color: #174ea6;
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover,
.text-link:focus-visible {
  color: #0f3b7d;
  text-decoration: underline;
}

.billing-filter-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #dbe7f6;
  border-radius: 10px;
  background: #f8fbff;
}

.billing-filter-summary strong {
  color: #0f172a;
  font-size: 18px;
  font-weight: 700;
}

#changeFiltersPanel .lead-filters-panel,
#billingFiltersPanel .lead-filters-panel,
#adminLeadFiltersPanel .lead-filters-panel {
  margin: 0;
}

#changeFiltersPanel + #changeTransactionList.transaction-list,
#billingFiltersPanel + #billingTransactionList.transaction-list {
  margin-top: 0;
}

.flatpickr-calendar {
  border: 1px solid #d1d9e6;
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  font-family: "Source Sans 3", sans-serif;
}

.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before,
.flatpickr-calendar.arrowBottom::after {
  display: none;
}

.flatpickr-months {
  padding: 8px 8px 0;
}

.flatpickr-current-month {
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
}

.flatpickr-weekday {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.flatpickr-day {
  border-radius: 8px;
  color: #334155;
}

.flatpickr-day.today {
  border-color: #93c5fd;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  border-color: #174ea6;
  background: #174ea6;
  color: #ffffff;
}

.flatpickr-day.inRange,
.flatpickr-day.prevMonthDay.inRange,
.flatpickr-day.nextMonthDay.inRange,
.flatpickr-day.today.inRange {
  border-color: #eaf2ff;
  background: #eaf2ff;
  box-shadow: -5px 0 0 #eaf2ff, 5px 0 0 #eaf2ff;
  color: #174ea6;
}

.flatpickr-day:hover {
  border-color: #eaf2ff;
  background: #f8fbff;
}

@media (max-width: 1280px) {
  .lead-filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lead-date-range-field {
    grid-column: span 3;
  }

}

@media (max-width: 720px) {
  .lead-filters-grid {
    grid-template-columns: 1fr;
  }

  .lead-date-range-field {
    grid-column: auto;
  }

}

@media (max-width: 980px) {
  #leadTransactionList.transaction-list,
  #changeTransactionList.transaction-list,
  #billingTransactionList.transaction-list {
    margin-left: 14px;
    margin-right: 14px;
  }
}

/* Final command-center override layer. Keep this at the end so older page sections cannot pull the UI back to the legacy tab/card treatment. */
.dashboard-layout .topbar,
.dashboard-layout .card,
.dashboard-layout .panel,
.dashboard-layout .savebar,
.dashboard-layout .working-company-menu,
.dashboard-layout .billing-modal-card,
.dashboard-layout .billing-loading-card {
  border-radius: var(--radius-xl);
}

.dashboard-layout .topbar {
  border-radius: 0;
}

.dashboard-layout .card,
.dashboard-layout .panel {
  border: 1px solid rgba(226, 232, 240, 0.92);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.dashboard-layout .panel {
  padding: 0;
}

.dashboard-layout .panel > :not(.panel-header) {
  margin: 18px;
}

.dashboard-layout .performance-panel > #advertiserPerformancePanel {
  margin: 0;
}

.dashboard-layout .performance-panel .performance-grid {
  margin: 0;
}

.dashboard-layout .stat-card {
  border-radius: var(--radius-xl);
}

.dashboard-layout .tab-button.is-active::after,
.dashboard-layout .admin-tab-nav .tab-button.is-active::after {
  display: none;
}

.dashboard-layout .legacy-tab-nav {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.dashboard-layout .flatpickr-calendar {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}

.dashboard-layout .lead-filters-panel,
.dashboard-layout .filter-dropdown-menu,
.dashboard-layout .working-company-menu {
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.dashboard-layout .lead-summary-button,
.dashboard-layout .transaction-card:not(.lead-transaction-card),
.dashboard-layout .lead-transaction-card {
  border-radius: 16px;
}

.dashboard-layout .topbar {
  grid-template-columns: minmax(0, 1fr);
  padding: 8px 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.dashboard-layout .topbar .eyebrow {
  margin-bottom: 6px;
  color: #0f766e;
}

.dashboard-layout .topbar h1 {
  font-size: clamp(34px, 4.8vw, 54px);
}

.dashboard-layout .topbar .subtitle {
  max-width: 760px;
}

.dashboard-layout .topbar-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: -74px;
  margin-left: auto;
  max-width: min(100%, 760px);
}

.dashboard-layout .topbar-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  order: -10;
}

.dashboard-layout .topbar-action-row .account-chip {
  order: 10;
  width: auto;
  max-width: 360px;
  min-width: 220px;
}

.topbar-date-pill,
.topbar-company-static,
.dashboard-layout .working-company-trigger,
.dashboard-layout .btn-topbar-refresh {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.topbar-date-pill svg,
.dashboard-layout .btn-topbar-refresh svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.3;
}

.topbar-date-pill {
  padding: 0 14px;
  cursor: pointer;
}

.topbar-date-filter {
  position: relative;
}

.topbar-date-filter.is-open .topbar-date-pill {
  border-color: rgba(37, 99, 235, 0.34);
  box-shadow: var(--ring);
}

.topbar-date-caret {
  width: 14px;
  height: 14px;
  margin-left: 2px;
  color: #94a3b8;
}

.topbar-date-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: grid;
  width: 260px;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.topbar-date-option {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #334155;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.topbar-date-option:hover,
.topbar-date-option.is-active {
  background: #f1f6ff;
  color: var(--brand-deep);
}

.topbar-date-custom-field {
  display: grid;
  gap: 7px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(226, 232, 240, 0.95);
}

.topbar-date-custom-field span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-date-custom-field input {
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid #d1d9e6;
  border-radius: 12px;
  background: #ffffff;
  color: #102033;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.topbar-date-menu .flatpickr-calendar {
  position: static !important;
  width: 100%;
  margin-top: 8px;
  border-radius: 14px;
  box-shadow: none;
}

.topbar-company-static {
  padding: 0 14px;
}

.topbar-company-static svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.3;
}

.dashboard-layout .topbar-company-form {
  flex: 0 1 300px;
  min-width: 220px;
}

.dashboard-layout .topbar-company-form .working-company-trigger {
  width: 100%;
}

.workspace-admin .topbar-company-form {
  display: none;
}

.dashboard-layout .logout-form {
  margin: 0;
  position: static;
  top: auto;
  right: auto;
}

.dashboard-layout .btn-topbar-refresh {
  position: static;
  top: auto;
  right: auto;
}

.dashboard-layout .account-chip {
  order: 10;
  width: 100%;
  max-width: 360px;
}

.dashboard-layout .stats {
  width: 100%;
  justify-self: stretch;
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.10);
}

.stat-icon svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.35;
}

.stat-card-money .stat-icon {
  color: #15803d;
  background: rgba(22, 163, 74, 0.10);
}

.money-flow-panel {
  margin-top: 0;
  overflow: hidden;
}

.overview-primary-column {
  display: grid;
  gap: 18px;
  align-content: start;
}

.money-flow-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.82);
}

.money-flow-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #475569;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.money-flow-status-badge.is-on {
  color: #047857;
  border-color: rgba(16, 185, 129, 0.22);
  background: #ecfdf5;
}

.money-flow-status-badge.is-off {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.24);
  background: #fffbeb;
}

.money-flow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-top: 22px;
}

.money-flow-card {
  min-height: 122px;
  padding: 20px 20px 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(20, 184, 166, 0.08), transparent 34%),
    #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
}

.money-flow-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.money-flow-value {
  margin-top: 18px;
  color: #0f172a;
  font-size: clamp(25px, 2.15vw, 33px);
  font-weight: 850;
  letter-spacing: -0.05em;
  line-height: 1;
}

.money-flow-meter {
  width: 55%;
  height: 4px;
  margin-top: 22px;
  border-radius: 999px;
  background: #dbeafe;
  overflow: hidden;
}

.money-flow-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bfdbfe 0%, #86efac 100%);
}

@media (max-width: 640px) {
  .money-flow-header {
    flex-direction: column;
    align-items: stretch;
  }

  .money-flow-status-badge {
    align-self: flex-start;
  }

  .money-flow-grid {
    grid-template-columns: 1fr;
  }

  .money-flow-card {
    min-height: 108px;
  }
}

.stat-card-balance .stat-icon {
  color: #0f766e;
  background: rgba(20, 184, 166, 0.12);
}

.stat-card-call .stat-icon {
  color: #b45309;
  background: rgba(245, 158, 11, 0.13);
}

.dashboard-layout .lead-summary-grid {
  grid-template-columns: minmax(260px, 1.45fr) minmax(130px, 0.8fr) minmax(150px, 0.85fr) minmax(126px, 0.72fr) minmax(112px, 0.68fr);
  gap: 14px;
}

.lead-summary-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lead-avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 16px;
  background: linear-gradient(135deg, #e0f2fe, #dcfce7);
  color: #0f766e;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.03em;
  box-shadow: var(--shadow-soft);
}

.lead-summary-main-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.lead-summary-main-copy strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  font-size: 14px;
  font-weight: 850;
}

.lead-summary-subtitle {
  min-width: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-layout .lead-summary-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 12px 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 12px;
  font-weight: 900;
}

.dashboard-layout .transaction-type {
  margin-top: 12px;
}

.sidebar-nav-parent {
  position: relative;
}

.sidebar-nav-parent > .sidebar-nav-item {
  padding-right: 9px;
}

.sidebar-submenu-caret {
  width: 15px;
  height: 15px;
  margin-left: auto;
  color: #94a3b8;
  stroke-width: 2.4;
  transition: transform 0.18s ease, color 0.18s ease;
}

.sidebar-submenu {
  position: absolute;
  top: 0;
  left: calc(100% + 10px);
  z-index: 90;
  display: grid;
  min-width: 218px;
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-6px);
  transition: opacity 0.16s ease, visibility 0.16s ease, transform 0.16s ease;
}

.sidebar-nav-parent:hover > .sidebar-submenu,
.sidebar-nav-parent:focus-within > .sidebar-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.sidebar-nav-parent:hover > .sidebar-nav-item .sidebar-submenu-caret,
.sidebar-nav-parent:focus-within > .sidebar-nav-item .sidebar-submenu-caret {
  color: var(--brand);
  transform: translateX(2px);
}

.sidebar-nav-parent:has(.sidebar-submenu-item.is-active) > .sidebar-nav-item {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(20, 184, 166, 0.10));
  color: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.10);
}

.sidebar-submenu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #475569;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar-submenu-item:hover,
.sidebar-submenu-item:focus-visible,
.sidebar-submenu-item.is-active {
  background: #f1f6ff;
  color: var(--brand-deep);
}

.sidebar-submenu-item svg {
  width: 16px;
  height: 16px;
  color: var(--brand);
  stroke-width: 2.35;
}

@media (min-width: 901px) {
  .dashboard-layout .dashboard-sidebar,
  .dashboard-layout .dashboard-sidebar-inner,
  .dashboard-layout .sidebar-nav,
  .dashboard-layout .sidebar-nav-group.is-active {
    overflow: visible;
  }

  .dashboard-layout .sidebar-nav {
    position: relative;
    z-index: 95;
  }

  .dashboard-layout .sidebar-submenu {
    z-index: 1500;
  }
}

@media (max-width: 900px) {
  .dashboard-layout .dashboard-sidebar {
    max-height: 132px;
    overflow: hidden;
  }

  .dashboard-layout .sidebar-nav {
    min-height: 42px;
  }

  .dashboard-layout .sidebar-nav::-webkit-scrollbar {
    height: 0;
  }

  .dashboard-layout .sidebar-nav-text {
    font-size: 13px;
  }

  .dashboard-layout .sidebar-nav-item {
    flex: 0 0 auto;
  }

  .sidebar-nav-parent {
    flex: 0 0 auto;
  }

  .sidebar-submenu {
    top: calc(100% + 8px);
    left: 0;
    min-width: 210px;
    transform: translateY(-4px);
  }

  .sidebar-nav-parent:hover > .sidebar-submenu,
  .sidebar-nav-parent:focus-within > .sidebar-submenu {
    transform: translateY(0);
  }

  .dashboard-layout .topbar-side {
    justify-content: flex-start;
    margin-top: 0;
    max-width: none;
  }

  .dashboard-layout .topbar-action-row {
    justify-content: flex-start;
  }

  .dashboard-layout .topbar-action-row .account-chip {
    flex: 1 1 260px;
    max-width: none;
  }

  .dashboard-layout .topbar-company-form,
  .topbar-date-pill,
  .topbar-date-filter,
  .topbar-company-static,
  .dashboard-layout .btn-topbar-refresh,
  .dashboard-layout .logout-form {
    flex: 1 1 210px;
  }

  .dashboard-layout .account-chip {
    max-width: none;
  }

  .dashboard-layout .lead-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout .lead-summary-main {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  body.has-workspace-switcher .dashboard-layout .dashboard-sidebar {
    max-height: none;
    overflow: visible;
  }

  body.has-workspace-switcher .dashboard-layout .sidebar-nav {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 0;
  }

  body.has-workspace-switcher .dashboard-layout .sidebar-workspace-item {
    justify-content: center;
    width: 100%;
    min-width: 0;
  }

  body.has-workspace-switcher .dashboard-layout .sidebar-nav-group {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 2200;
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 8px;
    min-width: 0;
    max-height: min(68vh, 520px);
    overflow: auto;
    padding: 12px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(18px);
  }

  body.has-workspace-switcher.mobile-workspace-menu-open .dashboard-layout .sidebar-nav-group.is-active {
    display: grid;
  }

  body.has-workspace-switcher .dashboard-layout .sidebar-nav-group .sidebar-nav-label {
    display: block;
    grid-column: 1 / -1;
    margin: 0 4px 2px;
    color: #64748b;
  }

  body.has-workspace-switcher .dashboard-layout .sidebar-nav-group .sidebar-nav-item {
    width: 100%;
    justify-content: flex-start;
  }

  body.has-workspace-switcher .dashboard-layout .sidebar-nav-parent {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .connection-filter-bar,
  .connection-summary-button {
    grid-template-columns: 1fr;
  }

  .connection-summary-status {
    justify-content: flex-start;
  }

  .dashboard-layout .dashboard-sidebar {
    max-height: 116px;
  }

  .dashboard-layout .sidebar-brand {
    border-radius: 14px;
  }

  .dashboard-layout .sidebar-nav-item {
    min-height: 36px;
    padding: 7px 9px;
    border-radius: 12px;
  }

  .dashboard-layout .sidebar-nav-icon {
    display: none;
  }

  .topbar-date-filter,
  .topbar-date-pill,
  .topbar-date-menu {
    width: 100%;
  }

  .topbar-date-menu {
    left: 0;
    right: auto;
  }

  .dashboard-layout .lead-summary-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-layout .lead-summary-toggle {
    margin-left: 0;
  }

  .dashboard-layout .panel > :not(.panel-header),
  .dashboard-layout #leadTransactionList.transaction-list,
  .dashboard-layout #changeTransactionList.transaction-list,
  .dashboard-layout #billingTransactionList.transaction-list {
    margin-left: 12px;
    margin-right: 12px;
  }
}

.dashboard-layout + .test-mode-banner,
.test-mode-banner {
  position: fixed;
  right: 22px;
  bottom: 22px;
  top: auto;
  z-index: 1400;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: auto;
  max-width: calc(100vw - 28px);
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.28), transparent 7rem),
    #0f172a;
  color: #ffffff;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: 0 22px 58px rgba(15, 23, 42, 0.24);
}

.test-mode-banner strong {
  display: block;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.test-mode-banner small {
  display: block;
  margin-top: 2px;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
}

.test-mode-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.16);
}

/* Keep section titles and form labels consistent without lowercasing acronyms like API, URL, BBP, or CallRail. */
.panel-title,
.section-label,
.snapshot-label,
.catalog-summary-label,
.lead-detail-label,
.account-chip-label,
.sidebar-status-label,
.money-flow-label,
.performance-side-label,
.profitability-table thead th,
.field > label,
.field > span,
.field label,
.topbar-date-custom-field span {
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .test-mode-banner {
    right: 14px;
    bottom: 14px;
    padding: 10px 12px;
    border-radius: 16px;
  }
}
