:root {
  --ink: #0f172a;
  --ink-soft: #172033;
  --line: #dbe5f0;
  --line-dark: #263449;
  --paper: #f5f8fc;
  --white: #ffffff;
  --muted: #64748b;
  --muted-light: #a8b5c7;
  --platform-primary: #3aa7f5;
  --platform-primary-strong: #0b65a8;
  --platform-primary-soft: #e8f5ff;
  --platform-on-primary: #061b2f;
  --focus-ring: #1377bd;
  --signal: #3aa7f5;
  --signal-dark: #061b2f;
  --lime: #3aa7f5;
  --amber: #f0b94b;
  --brand-accent: #0b65a8;
  --success: #168451;
  --danger: #c82432;
}

.company-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.company-actions .company-open-button {
  grid-column: auto;
}

.button-danger {
  border-color: #b42318;
  background: #b42318;
  color: #fff;
}

.button-danger:hover:not(:disabled) {
  border-color: #912018;
  background: #912018;
}

.button-danger:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.company-deletion-modal {
  max-width: 640px;
}

#company-deletion-form {
  display: grid;
  gap: 1rem;
}

.company-deletion-warning {
  border-left: 3px solid #b42318;
  border-radius: 0 5px 5px 0;
  background: #fff1f0;
  color: #7a271a;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 1rem;
}

.company-deletion-confirmation-field {
  color: #303731;
  display: grid;
  font-size: 0.78rem;
  font-weight: 750;
  gap: 0.55rem;
}

.company-deletion-confirmation-field strong {
  color: #7a271a;
  overflow-wrap: anywhere;
}

#company-deletion-confirmation {
  background: #fafbf9;
  border: 1px solid #cdd3cd;
  border-radius: 5px;
  color: var(--ink);
  min-height: 48px;
  padding: 0.75rem 0.85rem;
  width: 100%;
}

#company-deletion-confirmation:focus {
  background: var(--white);
  border-color: #b42318;
}

.company-deletion-actions {
  margin-top: 0.25rem;
}

@media (max-width: 700px) {
  .company-actions {
    flex-direction: column-reverse;
  }

  .company-actions .button {
    width: 100%;
  }
}

[hidden] {
  display: none !important;
}

.static-open-button {
  font-family: inherit;
}

.quote-back-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: #c6cec7;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 850;
  gap: 0.45rem;
  padding: 0;
  text-align: left;
  width: fit-content;
}

.platform-inline-mark {
  background: #f8fbff;
  border-radius: 5px;
  display: block;
  height: 20px;
  object-fit: contain;
  padding: 2px;
  width: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 800;
  gap: 0.65rem;
  justify-content: center;
  min-height: 46px;
  padding: 0.75rem 1rem;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

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

.button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.button-primary {
  background: var(--platform-primary-strong);
  color: var(--white);
}

.button-primary:hover {
  background: #084f85;
}

.button-secondary {
  background: transparent;
  border-color: #53637a;
  color: var(--white);
}

.button-secondary:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.button-brand {
  background: var(--brand-accent);
  color: var(--white);
}

.button-brand:hover {
  background: color-mix(in srgb, var(--brand-accent), #000 12%);
}

.button-quiet {
  background: transparent;
  border-color: #cbd8e6;
  color: var(--ink);
}

.button-quiet:hover {
  background: var(--platform-primary-soft);
  border-color: #9bc8ec;
}

.button-full {
  width: 100%;
}

.section-kicker {
  color: var(--platform-primary-strong);
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 0.45rem;
}

/* Product console */

.console-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100dvh;
}

.console-sidebar {
  background: #0b1220;
  border-right: 1px solid #1c2a3e;
  box-shadow: 12px 0 34px rgba(15, 23, 42, 0.08);
  color: var(--white);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 1.4rem 1rem 1.1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.product-mark {
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  justify-content: center;
  min-height: 54px;
  padding: 0 0.35rem;
}

.sidebar-product-logo {
  display: block;
  height: auto;
  max-width: 190px;
  object-fit: contain;
  width: 100%;
}

.sidebar-product-logo-dark {
  mix-blend-mode: screen;
}

.product-logo-full {
  display: block;
  height: auto;
  margin-inline: auto;
  max-width: 250px;
  width: min(100%, 250px);
}

.console-nav {
  display: grid;
  gap: 0.38rem;
  margin-top: 2.2rem;
}

.console-nav-item {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #9eabc0;
  display: flex;
  font-size: 0.86rem;
  font-weight: 720;
  gap: 0.85rem;
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  position: relative;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.console-nav-item:hover {
  background: rgba(58, 167, 245, 0.08);
  border-color: rgba(58, 167, 245, 0.12);
  color: #eaf4ff;
  transform: translateX(2px);
}

.console-nav-item.is-active {
  background: rgba(58, 167, 245, 0.14);
  border-color: rgba(91, 183, 248, 0.18);
  color: var(--white);
}

.console-nav-item.is-active::after {
  background: var(--platform-primary);
  border-radius: 999px;
  content: "";
  height: 22px;
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
}

.nav-icon {
  color: #718198;
  display: inline-block;
  flex: 0 0 18px;
  height: 18px;
  position: relative;
  transition: color 160ms ease;
  width: 18px;
}

.console-nav-item:hover .nav-icon,
.console-nav-item.is-active .nav-icon { color: var(--platform-primary); }

.nav-icon::before,
.nav-icon::after {
  box-sizing: border-box;
  content: "";
  position: absolute;
}

.nav-icon-overview::before {
  background: currentColor;
  border-radius: 2px;
  box-shadow: 8px 0 currentColor, 0 8px currentColor, 8px 8px currentColor;
  height: 6px;
  left: 2px;
  top: 2px;
  width: 6px;
}

.nav-icon-companies::before {
  border: 1.6px solid currentColor;
  border-radius: 2px;
  inset: 2px 3px 1px;
}

.nav-icon-companies::after {
  background: currentColor;
  border-radius: 1px;
  box-shadow: 4px 0 currentColor, 0 4px currentColor, 4px 4px currentColor;
  height: 2px;
  left: 6px;
  top: 6px;
  width: 2px;
}

.nav-icon-leads::before {
  border: 1.6px solid currentColor;
  border-radius: 50%;
  height: 6px;
  left: 6px;
  top: 1px;
  width: 6px;
}

.nav-icon-leads::after {
  border: 1.6px solid currentColor;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  bottom: 1px;
  height: 8px;
  left: 2px;
  width: 14px;
}

.nav-icon-conversations::before {
  border: 1.6px solid currentColor;
  border-radius: 4px;
  inset: 2px 1px 4px;
}

.nav-icon-conversations::after {
  border-bottom: 1.6px solid currentColor;
  border-right: 1.6px solid currentColor;
  bottom: 2px;
  height: 5px;
  left: 5px;
  transform: rotate(45deg);
  width: 5px;
}

.nav-icon-form::before {
  border: 1.6px solid currentColor;
  border-radius: 2px;
  inset: 1px 3px;
}

.nav-icon-form::after {
  background: currentColor;
  box-shadow: 0 4px currentColor, 0 8px currentColor;
  height: 1.5px;
  left: 7px;
  top: 5px;
  width: 5px;
}

.nav-icon-settings::before {
  border: 2px solid currentColor;
  border-radius: 50%;
  inset: 4px;
}

.nav-icon-settings::after {
  border: 1.6px solid currentColor;
  border-radius: 3px;
  inset: 2px;
  opacity: 0.72;
  transform: rotate(45deg);
}

.studio-avatar {
  align-items: center;
  background: #152238;
  border: 1px solid #d5e1ee;
  border-radius: 10px;
  color: var(--white);
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  overflow: hidden;
  width: 38px;
}

.studio-avatar.is-platform {
  background: transparent;
  border-color: transparent;
  padding: 0;
}

.studio-avatar img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.studio-avatar.is-platform img {
  filter: brightness(1.22) saturate(1.06);
}

.organization-switcher {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.68rem;
  font-weight: 800;
  gap: 0.65rem;
  margin: 0;
  min-width: 0;
}

.organization-switcher select {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  max-width: min(34vw, 330px);
  min-height: 42px;
  min-width: 210px;
  padding: 0 2.15rem 0 0.75rem;
}

.console-topbar {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 auto 1.65rem;
  max-width: 1280px;
  min-height: 44px;
  position: relative;
  z-index: 30;
}

.account-menu {
  margin-left: auto;
  position: relative;
}

.account-menu-trigger {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  gap: 0.68rem;
  min-height: 46px;
  padding: 0.35rem 0.65rem 0.35rem 0.38rem;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.account-menu-trigger:hover,
.account-menu-trigger[aria-expanded="true"] {
  background: var(--white);
  border-color: #b8d5eb;
  box-shadow: 0 10px 26px rgba(15, 36, 64, 0.1);
}

.account-menu-identity {
  display: block;
  min-width: 0;
}

.account-menu-identity strong,
.account-menu-identity small {
  display: block;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-identity strong {
  font-size: 0.72rem;
}

.account-menu-identity small {
  color: var(--muted);
  font-size: 0.62rem;
  margin-top: 0.16rem;
}

.account-menu-chevron {
  border-bottom: 1.5px solid #6e7d90;
  border-right: 1.5px solid #6e7d90;
  height: 6px;
  margin: 0 0.2rem 0 0.15rem;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
  width: 6px;
}

.account-menu-trigger[aria-expanded="true"] .account-menu-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.account-menu-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(15, 36, 64, 0.16);
  max-width: calc(100vw - 2rem);
  min-width: 210px;
  padding: 0.45rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
}

.account-menu-label {
  color: var(--muted);
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.45rem 0.6rem 0.35rem;
  text-transform: uppercase;
}

.account-menu-details {
  border-bottom: 1px solid var(--line);
  margin: 0 0.2rem 0.25rem;
  padding: 0.15rem 0.4rem 0.7rem;
}

.account-menu-details strong,
.account-menu-details small {
  display: block;
  overflow-wrap: anywhere;
}

.account-menu-details strong {
  color: var(--ink);
  font-size: 0.72rem;
}

.account-menu-details small {
  color: var(--muted);
  font-size: 0.65rem;
  margin-top: 0.2rem;
}

.account-menu-signout {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #a02631;
  cursor: pointer;
  display: block;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 0.65rem;
  text-align: left;
  width: 100%;
}

.account-menu-signout:hover {
  background: #fff0f1;
}

.console-main {
  background:
    radial-gradient(circle at 96% 2%, rgba(58, 167, 245, 0.08), transparent 24rem),
    var(--paper);
  min-width: 0;
  padding: 2rem clamp(1.1rem, 3vw, 3.2rem) 3.5rem;
}

.console-header {
  align-items: flex-end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 auto 2rem;
  max-width: 1280px;
}

.console-header h1 {
  font-size: 2rem;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0;
}

.console-header p {
  color: var(--muted);
  margin: 0.45rem 0 0;
}

.metric-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 1280px;
}

.metric-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 145px;
  padding: 1.2rem;
  box-shadow: 0 8px 28px rgba(15, 34, 57, 0.045);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.metric-card:hover {
  border-color: #bfd4e7;
  box-shadow: 0 12px 32px rgba(15, 34, 57, 0.075);
  transform: translateY(-2px);
}

.metric-card > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.metric-card strong {
  font-size: 1.8rem;
  line-height: 1.05;
  margin: 1rem 0 0.5rem;
  overflow-wrap: anywhere;
}

.metric-card small {
  color: #738299;
  font-size: 0.68rem;
  margin-top: auto;
}

.metric-card-primary {
  background: linear-gradient(145deg, #edf8ff 0%, #dcefff 100%);
  border-color: #afd9f7;
  color: var(--signal-dark);
}

.metric-card-primary > span,
.metric-card-primary small {
  color: #336989;
}

.source-overview {
  margin: 2rem auto 0;
  max-width: 1280px;
}

.source-overview-heading {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.source-overview-heading h2 {
  font-size: 1.15rem;
  margin: 0.25rem 0 0;
}

.source-overview-heading > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.source-breakdown {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.source-summary {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 0.8rem;
  min-height: 92px;
  padding: 1rem;
  text-align: left;
}

.source-summary:last-child {
  border-right: 0;
}

.source-summary:hover,
.source-summary:focus-visible {
  background: #f7f9f6;
}

.source-summary > span:first-child {
  align-items: baseline;
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
}

.source-summary-name {
  font-size: 0.75rem;
  font-weight: 750;
}

.source-summary strong {
  font-size: 1.15rem;
}

.source-summary-detail {
  display: grid;
  gap: 0.35rem;
}

.source-summary-detail small {
  color: var(--muted);
  font-size: 0.65rem;
}

.source-summary-track {
  background: #e4e9e2;
  display: block;
  height: 3px;
  overflow: hidden;
  width: 100%;
}

.source-summary-track > span {
  background: #111713;
  display: block;
  height: 100%;
}

.source-summary.source-instagram .source-summary-track > span { background: #c13584; }
.source-summary.source-whatsapp .source-summary-track > span { background: #168f51; }
.source-summary.source-facebook .source-summary-track > span { background: #2867b2; }
.source-summary.source-website .source-summary-track > span { background: #e24b33; }
.source-summary.source-public-form .source-summary-track > span { background: #759d27; }

.console-section {
  margin: 2.6rem auto 0;
  max-width: 1280px;
}

.company-list {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.company-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 1.2rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 1.15rem;
  box-shadow: 0 8px 28px rgba(15, 34, 57, 0.045);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.company-card:hover {
  border-color: #bfd4e7;
  box-shadow: 0 12px 32px rgba(15, 34, 57, 0.075);
  transform: translateY(-2px);
}

.company-card-header {
  align-items: center;
  display: grid;
  gap: 0.75rem;
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.company-card-header strong,
.company-card-header small {
  display: block;
}

.company-card-header strong {
  font-size: 0.88rem;
}

.company-card-header small {
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 0.2rem;
}

.company-avatar {
  align-items: center;
  background: #13233a;
  border: 1px solid #28415f;
  border-radius: 10px;
  color: var(--white);
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.company-state {
  background: #eefbd8;
  border-radius: 999px;
  color: #40551b;
  font-size: 0.62rem;
  font-weight: 850;
  padding: 0.45rem 0.65rem;
  white-space: nowrap;
}

.company-state.is-inactive {
  background: #f5e3e5;
  color: #852d36;
}

.company-card-stats {
  align-items: end;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, auto));
}

.company-card-stats span {
  display: grid;
  gap: 0.25rem;
}

.company-card-stats small {
  color: var(--muted);
  font-size: 0.62rem;
}

.company-card-stats strong {
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.company-open-button {
  align-self: end;
  min-height: 40px;
  white-space: nowrap;
}

.section-heading {
  align-items: flex-end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-heading h2,
.install-band h2 {
  font-size: 1.25rem;
  line-height: 1.2;
  margin: 0;
}

.demo-label,
.channel-state,
.lead-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.64rem;
  font-weight: 850;
  line-height: 1;
  padding: 0.45rem 0.65rem;
  white-space: nowrap;
}

.demo-label {
  background: #e5e9e3;
  color: #687169;
}

.section-note {
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0;
  max-width: 420px;
  text-align: right;
}

.lead-table {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(15, 34, 57, 0.045);
}

.lead-row {
  align-items: center;
  border-top: 1px solid #e7eae6;
  display: grid;
  font-size: 0.77rem;
  gap: 1rem;
  grid-template-columns: 1.05fr 1.45fr 0.7fr 0.72fr 0.65fr;
  min-height: 68px;
  padding: 0.75rem 1rem;
}

.lead-row:first-child {
  border-top: 0;
}

.lead-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lead-row strong,
.lead-row small {
  display: block;
}

.lead-row small {
  color: var(--muted);
  font-size: 0.67rem;
  margin-top: 0.2rem;
}

.lead-source {
  align-items: center;
  background: #edf0ed;
  border-radius: 999px;
  color: #4c5750;
  display: inline-flex;
  font-size: 0.58rem;
  font-weight: 850;
  line-height: 1;
  margin-top: 0.4rem;
  padding: 0.36rem 0.5rem;
  white-space: nowrap;
}

.source-instagram { background: #f9e4ec; color: #8a264a; }
.source-whatsapp { background: #def5e7; color: #24683d; }
.source-facebook { background: #e2edfb; color: #275a92; }
.source-website { background: #fff0d2; color: #75520e; }
.source-public-form { background: #ebf8d6; color: #46601d; }

.lead-head {
  background: #f7f8f6;
  color: #727b73;
  font-size: 0.64rem;
  font-weight: 850;
  min-height: 42px;
}

.status-nowy {
  background: #eefbd8;
  color: #40551b;
}

.status-kontakt {
  background: #fff3d7;
  color: #735414;
}

.status-umowiony {
  background: #dcecf8;
  color: #214e70;
}

.channel-list {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(15, 34, 57, 0.045);
}

.channel-row {
  align-items: center;
  border-top: 1px solid #e7eae6;
  display: grid;
  gap: 1rem;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  min-height: 82px;
  padding: 0.85rem 1rem;
}

.channel-row:first-child {
  border-top: 0;
}

.channel-marker {
  align-items: center;
  background: #13233a;
  border-radius: 10px;
  color: var(--white);
  display: inline-flex;
  font-size: 0.66rem;
  font-weight: 900;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.channel-row h3 {
  font-size: 0.87rem;
  margin: 0;
}

.channel-row p {
  color: var(--muted);
  font-size: 0.72rem;
  margin: 0.25rem 0 0;
}

.channel-state-active {
  background: #e7f8ca;
  color: #40551b;
}

.channel-state-ready {
  background: #e7edf2;
  color: #45545e;
}

.channel-state-pending {
  background: #fff1d5;
  color: #6f5114;
}

.install-band {
  align-items: center;
  background: linear-gradient(135deg, #0b1220 0%, #10233a 100%);
  border: 1px solid #1d3550;
  border-radius: 16px;
  color: var(--white);
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  margin: 2.6rem auto 0;
  max-width: 1280px;
  padding: 1.6rem;
}

.install-band .section-kicker {
  color: var(--signal);
}

.install-band p {
  color: var(--muted-light);
  font-size: 0.8rem;
  line-height: 1.55;
  margin: 0.6rem 0 0;
  max-width: 590px;
}

.install-actions {
  display: grid;
  gap: 0.7rem;
}

.install-actions code {
  background: #09111e;
  border: 1px solid #29425e;
  border-radius: 9px;
  color: #d9e8f6;
  display: block;
  font-size: 0.68rem;
  overflow: hidden;
  padding: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.embed-snippet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.embed-snippet code {
  border-radius: 9px 0 0 9px;
}

.embed-snippet button {
  background: var(--signal);
  border: 0;
  border-radius: 0 9px 9px 0;
  color: var(--signal-dark);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 0 0.75rem;
}

/* Public quote */

.quote-page {
  background: #0b0d0c;
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(520px, 1.18fr);
  min-height: 100dvh;
}

.quote-visual {
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
}

.quote-page.is-dynamic-quote .quote-visual {
  background:
    radial-gradient(circle at 18% 24%, color-mix(in srgb, var(--brand-accent), transparent 70%), transparent 34%),
    radial-gradient(circle at 82% 72%, color-mix(in srgb, var(--brand-accent), transparent 84%), transparent 30%),
    linear-gradient(145deg, #101612 0%, #07100b 48%, #111713 100%);
}

.quote-page.is-dynamic-quote .quote-visual::before {
  background-image:
    linear-gradient(color-mix(in srgb, var(--brand-accent), transparent 92%) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--brand-accent), transparent 92%) 1px, transparent 1px);
  background-size: 48px 48px;
  content: "";
  inset: -10%;
  position: absolute;
  transform: rotate(-6deg);
}

.quote-visual > img {
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
}

.quote-visual-overlay {
  background: rgba(7, 9, 8, 0.68);
  inset: 0;
  position: absolute;
}

.quote-brand {
  color: var(--white);
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  min-height: 100dvh;
  padding: clamp(1.25rem, 4vw, 3.25rem);
  position: relative;
  z-index: 1;
}

.quote-product-link {
  color: #c6cec7;
  font-size: 0.66rem;
  font-weight: 900;
  width: fit-content;
}

.quote-eyebrow {
  color: var(--brand-accent);
  display: block;
  font-size: 0.72rem;
  font-weight: 950;
  margin-bottom: 0.8rem;
}

.quote-brand h1 {
  font-size: clamp(2.25rem, 5vw, 4.8rem);
  line-height: 0.95;
  margin: 0;
  max-width: 720px;
  overflow-wrap: anywhere;
}

.quote-brand p {
  color: #d2d8d3;
  font-size: 1rem;
  line-height: 1.6;
  margin: 1.2rem 0 0;
  max-width: 560px;
}

.quote-facts {
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-top: 1rem;
}

.quote-facts span {
  color: #bfc7c0;
  font-size: 0.68rem;
}

.quote-facts strong {
  color: var(--white);
  display: block;
  font-size: 0.94rem;
  margin-bottom: 0.15rem;
}

.quote-tool-shell {
  align-self: center;
  background: var(--paper);
  min-height: 100dvh;
  padding: clamp(1.1rem, 4vw, 3.4rem) clamp(1rem, 5vw, 4.5rem) 1.5rem;
}

.quote-tool-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto 1.2rem;
  max-width: 720px;
}

.quote-tool-header strong,
.quote-tool-header span {
  display: block;
}

.quote-tool-header strong {
  font-size: 0.76rem;
}

.quote-tool-header span {
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 0.2rem;
}

.quote-tool-header a {
  color: var(--brand-accent);
  font-size: 0.75rem;
  font-weight: 850;
}

.quote-status {
  background: #f1f5ed;
  border: 1px solid #d3dcd0;
  border-left: 3px solid var(--brand-accent);
  border-radius: 6px;
  color: #455047;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.55;
  margin: 0 auto 1rem;
  max-width: 720px;
  padding: 0.9rem 1rem;
}

.quote-status[hidden] { display: none; }

.quote-status.is-error {
  background: #fff0f1;
  border-color: #e7b8bd;
  border-left-color: var(--danger);
  color: #7e252f;
}

.quote-form,
.quote-result {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 7px;
  margin: 0 auto;
  max-width: 720px;
  padding: clamp(1.15rem, 3vw, 2rem);
}

.form-topline {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.form-step,
.result-kicker {
  color: var(--brand-accent);
  display: block;
  font-size: 0.66rem;
  font-weight: 950;
  margin-bottom: 0.4rem;
}

.form-topline h2,
.quote-result h2 {
  font-size: 1.45rem;
  line-height: 1.15;
  margin: 0;
}

.step-dots {
  display: flex;
  gap: 0.35rem;
  padding-top: 0.3rem;
}

.step-dots span {
  background: #dfe4de;
  border-radius: 2px;
  display: block;
  height: 5px;
  width: 34px;
}

.step-dots span.is-complete {
  background: var(--brand-accent);
}

.form-stage {
  display: grid;
  gap: 1.1rem;
}

.required-fields-note {
  color: #68778a;
  font-size: 0.68rem;
  margin: -0.15rem 0 0.85rem;
  text-align: right;
}

.required-fields-note span,
.required-marker {
  color: #a32630;
  font-weight: 900;
}

.field-label-text {
  display: inline;
}

.field-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-label,
.need-fieldset legend {
  color: #3d443e;
  display: grid;
  font-size: 0.71rem;
  font-weight: 850;
  gap: 0.45rem;
}

.field-label input,
.field-label textarea,
.field-label select {
  background: #fafbf9;
  border: 1px solid #cdd3cd;
  border-radius: 5px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  min-height: 49px;
  padding: 0.75rem 0.85rem;
  resize: vertical;
  width: 100%;
}

.field-label textarea {
  line-height: 1.5;
  min-height: 104px;
}

.field-label input::placeholder,
.field-label textarea::placeholder {
  color: #969f97;
}

.field-label input:focus,
.field-label textarea:focus,
.field-label select:focus {
  background: var(--white);
  border-color: var(--brand-accent);
  outline: 2px solid color-mix(in srgb, var(--brand-accent), transparent 78%);
}

.need-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.need-fieldset legend {
  margin-bottom: 0.55rem;
}

.need-options {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.need-options.has-odd-options .need-option:last-child {
  grid-column: 1 / -1;
}

.need-option {
  align-items: center;
  background: #fafbf9;
  border: 1px solid #d4dad4;
  border-radius: 5px;
  color: #353b36;
  cursor: pointer;
  display: flex;
  font-size: 0.72rem;
  font-weight: 750;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.65rem 0.7rem;
  text-align: left;
}

.need-option span {
  align-items: center;
  border: 1px solid #bcc4bd;
  border-radius: 3px;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.7rem;
  height: 20px;
  justify-content: center;
  width: 20px;
}

.need-option:hover,
.need-option.is-selected {
  border-color: var(--brand-accent);
}

.need-option.is-selected {
  background: color-mix(in srgb, var(--brand-accent), #fff 92%);
  color: color-mix(in srgb, var(--brand-accent), #000 28%);
}

.need-option.is-selected span {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: var(--white);
}

.form-actions,
.result-actions {
  align-items: center;
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
}

.form-actions .button-brand {
  min-width: 220px;
}

.consent-row {
  align-items: flex-start;
  color: #5c655d;
  display: flex;
  font-size: 0.67rem;
  gap: 0.6rem;
  line-height: 1.45;
}

.consent-row input {
  accent-color: var(--brand-accent);
  flex: 0 0 auto;
  height: 17px;
  margin: 0.08rem 0 0;
  width: 17px;
}

.consent-row a {
  color: var(--ink);
  text-decoration: underline;
}

.honeypot {
  height: 0;
  left: -10000px;
  overflow: hidden;
  position: absolute;
  width: 0;
}

.form-error {
  background: #fff0f1;
  border-left: 3px solid var(--danger);
  color: #8d1d26;
  font-size: 0.72rem;
  line-height: 1.45;
  margin: 1rem 0 0;
  padding: 0.7rem 0.8rem;
}

.button-spinner {
  animation: spin 800ms linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: var(--white);
  height: 16px;
  width: 16px;
}

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

.powered-by {
  color: #8a938b;
  font-size: 0.62rem;
  margin: 0.8rem auto 0;
  max-width: 720px;
  text-align: center;
}

.powered-by strong {
  color: #5a635b;
}

.quote-result {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
}

.result-check {
  align-items: center;
  background: #e5f8d0;
  border-radius: 5px;
  color: #355418;
  display: inline-flex;
  font-size: 1.1rem;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  margin-bottom: 1rem;
  width: 42px;
}

.result-reply {
  color: #4f5850;
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 1rem 0 1.2rem;
}

.result-summary {
  border-bottom: 1px solid #e1e5e0;
  border-top: 1px solid #e1e5e0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1.2rem;
  width: 100%;
}

.result-summary > div {
  min-width: 0;
  padding: 1rem 0.8rem 1rem 0;
}

.result-summary > div + div {
  border-left: 1px solid #e1e5e0;
  padding-left: 1rem;
}

.result-summary span,
.result-summary strong {
  display: block;
}

.result-summary span {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.result-summary strong {
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

/* Embedded version */

.embed-page {
  background: var(--white);
  margin: 0;
  max-width: 720px;
  min-height: 100dvh;
  padding: 0.8rem;
}

.embed-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  padding: 0.3rem 0.2rem 0.8rem;
}

.embed-header span,
.embed-header strong {
  display: block;
}

.embed-header span {
  color: var(--brand-accent);
  font-size: 0.6rem;
  font-weight: 900;
  margin-bottom: 0.2rem;
}

.embed-header strong {
  font-size: 0.76rem;
}

.embed-header small {
  color: var(--muted);
  font-size: 0.64rem;
}

.quote-form-compact,
.quote-result-compact {
  border: 0;
  padding: 0.7rem 0.2rem;
}

/* Legal */

.legal-page {
  margin: 0 auto;
  max-width: 780px;
  min-height: 100dvh;
  padding: clamp(1.25rem, 6vw, 4rem) 1.2rem;
}

.legal-back {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 3rem;
}

.legal-page h1 {
  font-size: 2.25rem;
  line-height: 1.05;
  margin: 0;
}

.legal-intro {
  color: #4e574f;
  font-size: 1rem;
  line-height: 1.7;
  margin: 1rem 0 2.4rem;
}

.legal-page section {
  border-top: 1px solid var(--line);
  padding: 1.3rem 0;
}

.legal-page h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.legal-page section p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.65;
  margin: 0;
}

.legal-page aside {
  background: #fff4d9;
  border-left: 3px solid var(--amber);
  color: #654d19;
  font-size: 0.75rem;
  line-height: 1.6;
  margin-top: 1.2rem;
  padding: 1rem;
}

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

  .quote-page {
    grid-template-columns: minmax(300px, 0.7fr) minmax(490px, 1.3fr);
  }

  .company-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .console-shell {
    display: block;
  }

  .console-sidebar {
    min-height: auto;
    padding: 0.85rem 1rem;
    position: static;
  }

  .console-nav {
    display: flex;
    gap: 0.2rem;
    margin-top: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  .console-nav-item {
    flex: 0 0 auto;
    min-height: 38px;
  }

  .console-main {
    padding-top: 1.5rem;
  }

  .quote-page {
    display: block;
  }

  .quote-visual,
  .quote-brand {
    min-height: 390px;
  }

  .quote-brand {
    padding: 1.25rem;
  }

  .quote-brand h1 {
    font-size: 2.5rem;
  }

  .quote-tool-shell {
    min-height: auto;
    padding: 1.2rem 1rem 1.5rem;
  }

  .install-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .console-topbar {
    align-items: stretch;
    gap: 0.65rem;
  }

  .organization-switcher {
    flex: 1 1 auto;
  }

  .organization-switcher span {
    display: none;
  }

  .organization-switcher select {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .account-menu-trigger {
    min-height: 42px;
  }

  .account-menu-identity {
    display: none;
  }

  .account-menu-chevron {
    margin-left: 0;
  }

  .account-menu-panel {
    min-width: 190px;
  }

  .console-header {
    align-items: stretch;
    flex-direction: column;
  }

  .console-header .button {
    width: 100%;
  }

  .console-header h1 {
    font-size: 1.65rem;
  }

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

  .metric-card {
    min-height: 132px;
    padding: 0.85rem;
  }

  .metric-card strong {
    font-size: 1.35rem;
  }

  .source-breakdown {
    grid-template-columns: 1fr;
  }

  .source-summary {
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }

  .source-summary:last-child {
    border-bottom: 0;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-note {
    text-align: left;
  }

  .company-card {
    grid-template-columns: 1fr;
  }

  .company-card-stats {
    justify-content: space-between;
  }

  .company-open-button {
    width: 100%;
  }

  .lead-head {
    display: none;
  }

  .lead-row {
    align-items: start;
    gap: 0.65rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 1rem;
  }

  .lead-row > span::before {
    color: #8a938b;
    content: attr(data-label);
    display: block;
    font-size: 0.58rem;
    font-weight: 850;
    margin-bottom: 0.2rem;
  }

  .channel-row {
    align-items: start;
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .channel-state {
    grid-column: 2;
    justify-self: start;
  }

  .quote-visual,
  .quote-brand {
    min-height: 350px;
  }

  .quote-brand h1 {
    font-size: 2rem;
  }

  .quote-brand p {
    font-size: 0.86rem;
  }

  .quote-facts {
    gap: 0.5rem;
  }

  .quote-facts span {
    font-size: 0.6rem;
  }

  .field-grid,
  .need-options,
  .result-summary {
    grid-template-columns: 1fr;
  }

  .result-summary > div + div {
    border-left: 0;
    border-top: 1px solid #e1e5e0;
    padding-left: 0;
  }

  .form-actions,
  .result-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .form-actions .button,
  .result-actions .button {
    min-width: 0;
    width: 100%;
  }

  .quote-tool-header {
    align-items: flex-start;
    gap: 0.5rem;
  }

  .legal-page h1 {
    font-size: 1.8rem;
  }
}

@media (max-width: 390px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .quote-facts {
    grid-template-columns: 1fr;
  }

  .quote-visual,
  .quote-brand {
    min-height: 430px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Live dashboard */

.auth-shell {
  align-items: center;
  background:
    radial-gradient(circle at 14% 18%, rgba(58, 167, 245, 0.2), transparent 30%),
    radial-gradient(circle at 86% 76%, rgba(35, 143, 223, 0.14), transparent 26%),
    linear-gradient(135deg, #07101d 0%, #0d1b2d 50%, #050b14 100%);
  display: flex;
  isolation: isolate;
  justify-content: center;
  min-height: 100dvh;
  overflow: hidden;
  padding: 1rem;
  position: relative;
}

.auth-shell::before {
  background-image:
    linear-gradient(rgba(58, 167, 245, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58, 167, 245, 0.055) 1px, transparent 1px);
  background-size: 52px 52px;
  content: "";
  inset: -20%;
  opacity: 0.65;
  position: absolute;
  transform: rotate(-7deg);
  z-index: -2;
}

.auth-shell::after {
  aspect-ratio: 1;
  border: 1px solid rgba(58, 167, 245, 0.2);
  border-radius: 50%;
  box-shadow:
    0 0 0 80px rgba(58, 167, 245, 0.035),
    0 0 0 160px rgba(58, 167, 245, 0.02);
  content: "";
  position: absolute;
  right: -16rem;
  top: 50%;
  transform: translateY(-50%);
  width: min(58rem, 78vw);
  z-index: -1;
}

.auth-panel {
  background: rgba(250, 252, 255, 0.97);
  border: 1px solid rgba(97, 183, 245, 0.25);
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(2, 12, 27, 0.44);
  max-width: 430px;
  padding: 2rem;
  position: relative;
  width: 100%;
  z-index: 1;
}

.auth-brand {
  align-items: center;
  display: flex;
  justify-content: center;
  margin-bottom: 2.5rem;
  width: 100%;
}
.auth-panel h1 { font-size: 1.8rem; margin: 0; }
.auth-panel > p { color: var(--muted); font-size: 0.85rem; line-height: 1.6; margin: 0.65rem 0 1.4rem; }
.auth-form { display: grid; gap: 1rem; }

.auth-text-button {
  background: transparent;
  border: 0;
  color: #435149;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 800;
  justify-self: center;
  padding: 0.2rem;
}

.auth-text-button:hover { color: var(--ink); text-decoration: underline; }
.auth-back-button { display: block; margin: 1rem auto 0; }

.auth-password-note {
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: -0.35rem;
}

.form-success {
  background: #edf6dc;
  border: 1px solid #c8d9a9;
  border-radius: 5px;
  color: #40561a;
  font-size: 0.72rem;
  line-height: 1.55;
  margin: 0;
  padding: 0.8rem;
}

.auth-link-error {
  background: #fff0f1;
  border: 1px solid #e5b5ba;
  border-radius: 5px;
  color: #84242c;
  display: grid;
  font-size: 0.72rem;
  gap: 0.35rem;
  line-height: 1.5;
  padding: 0.9rem;
}

.auth-link-error[hidden] { display: none; }

.auth-public-link {
  background: transparent;
  border: 0;
  color: #59635b;
  cursor: pointer;
  display: block;
  font-size: 0.72rem;
  font-weight: 750;
  margin-top: 1.3rem;
  text-align: center;
  width: 100%;
}

.quote-page,
.quote-page.quote-theme-generic,
.quote-page.quote-theme-service { --brand-accent: #3aa7f5; }
.quote-page.quote-theme-blackline { --brand-accent: #e72335; }
.quote-page.quote-theme-beauty { --brand-accent: #b9365d; }

.console-nav-button {
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.header-actions,
.lead-controls { display: flex; flex-wrap: wrap; gap: 0.55rem; }

body.has-modal { overflow: hidden; }

.modal-backdrop[hidden] { display: none; }

.modal-backdrop {
  align-items: center;
  background: rgba(5, 12, 24, 0.72);
  display: flex;
  inset: 0;
  justify-content: center;
  overflow-y: auto;
  padding: 1.5rem;
  position: fixed;
  z-index: 1000;
}

.company-onboarding-modal {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 72px rgba(5, 16, 34, 0.3);
  max-height: calc(100dvh - 3rem);
  overflow-y: auto;
  width: min(780px, 100%);
}

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

.modal-header h2 {
  font-size: 1.55rem;
  margin: 0.25rem 0 0.35rem;
}

.modal-header p {
  color: #687169;
  font-size: 0.78rem;
  margin: 0;
}

.modal-close {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 40px;
  font-size: 1.35rem;
  height: 40px;
  justify-content: center;
  line-height: 1;
}

.modal-close:hover { border-color: #8e978f; }

.company-onboarding-form { padding: 1.5rem; }

.onboarding-progress {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.onboarding-progress li {
  align-items: center;
  background: #f6f7f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #687169;
  display: flex;
  font-size: 0.7rem;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.65rem 0.7rem;
}

.onboarding-progress li > span {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 24px;
  font-size: 0.65rem;
  height: 24px;
  justify-content: center;
}

.onboarding-progress li[aria-current="step"] {
  background: var(--platform-primary-soft);
  border-color: #9dcef1;
  color: var(--ink);
}

.onboarding-progress li[aria-current="step"] > span,
.onboarding-progress li.is-complete > span {
  background: var(--platform-primary);
  border-color: #228edb;
  color: var(--platform-on-primary);
}

.onboarding-step-heading { margin-bottom: 1.2rem; }

.onboarding-step-heading > span {
  color: #687169;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.onboarding-step-heading h3,
.company-onboarding-success-view h3 {
  font-size: 1.2rem;
  margin: 0.28rem 0 0.35rem;
  outline: none;
}

.onboarding-step-heading h3:focus-visible,
.company-onboarding-success-view h3:focus-visible {
  border-radius: 4px;
  box-shadow: 0 0 0 3px rgba(19, 119, 189, 0.25);
}

.onboarding-step-heading p,
.onboarding-information p {
  color: #687169;
  font-size: 0.74rem;
  line-height: 1.55;
  margin: 0;
}

.onboarding-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.onboarding-grid .field-label { margin: 0; }

.onboarding-grid .field-label small {
  color: #687169;
  display: block;
  font-size: 0.67rem;
  font-weight: 500;
  line-height: 1.45;
  margin-top: 0.4rem;
}

.field-label .field-error {
  color: #a32630;
  font-weight: 700;
}

.field-label input[aria-invalid="true"],
.field-label textarea[aria-invalid="true"],
.field-label select[aria-invalid="true"] {
  border-color: #bf3f49;
  box-shadow: 0 0 0 3px rgba(191, 63, 73, 0.1);
}

.consent-row input[aria-invalid="true"] {
  outline: 2px solid #bf3f49;
  outline-offset: 2px;
}

.onboarding-template-preview {
  background: #f3f5f1;
  border-block: 1px solid var(--line);
  margin: 1.4rem 0;
  padding: 1rem 0.15rem;
}

.onboarding-template-preview strong {
  display: block;
  font-size: 1rem;
  margin-top: 0.3rem;
}

.onboarding-template-preview p {
  color: #59635b;
  font-size: 0.74rem;
  line-height: 1.55;
  margin: 0.3rem 0 0;
}

.onboarding-information {
  background: #f6f7f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 1.25rem;
  padding: 1rem;
}

.onboarding-information strong {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

.onboarding-summary {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.onboarding-summary > div {
  background: #f6f7f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 0;
  padding: 0.85rem;
}

.onboarding-summary dt {
  color: #687169;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.onboarding-summary dd {
  font-size: 0.78rem;
  font-weight: 800;
  margin: 0.3rem 0 0;
  overflow-wrap: anywhere;
}

.onboarding-ready-list {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.onboarding-ready-list span {
  color: #465048;
  font-size: 0.7rem;
  font-weight: 700;
}

.onboarding-ready-list span::before {
  color: #5e8f18;
  content: "✓";
  margin-right: 0.4rem;
}

.onboarding-success {
  background: #eef9df;
  border: 1px solid #cfe6a6;
  border-radius: 5px;
  color: #34510b;
  font-size: 0.76rem;
  font-weight: 750;
  margin: 1rem 0;
  padding: 0.8rem 0.9rem;
}

.onboarding-warning {
  background: #fff8e8;
  border: 1px solid #ead49c;
  border-radius: 5px;
  color: #6f5312;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.5;
  margin: 0.75rem 0;
  padding: 0.8rem 0.9rem;
}

.company-onboarding-success-view { padding: 2rem 1.5rem 1.5rem; }

.onboarding-success-mark {
  align-items: center;
  background: var(--platform-primary);
  border-radius: 50%;
  color: var(--platform-on-primary);
  display: flex;
  font-size: 1.1rem;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  margin-bottom: 1rem;
  width: 42px;
}

.onboarding-form-link {
  color: var(--ink);
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 800;
  margin-top: 0.35rem;
  overflow-wrap: anywhere;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.onboarding-actions {
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.onboarding-actions #cancel-company-onboarding { margin-right: auto; }

.onboarding-success-actions {
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.dashboard-alert {
  align-items: center;
  background: #fff1f2;
  border: 1px solid #e7b8bd;
  border-radius: 6px;
  color: #7e252f;
  display: flex;
  font-size: 0.77rem;
  gap: 0.7rem;
  margin: 0 auto 1rem;
  max-width: 1280px;
  padding: 0.8rem 1rem;
}

.settings-success {
  background: #eef9df;
  border: 1px solid #cfe6a6;
  border-radius: 6px;
  color: #34510b;
  font-size: 0.77rem;
  font-weight: 750;
  margin: 0 auto 1rem;
  max-width: 1280px;
  padding: 0.85rem 1rem;
}

.settings-layout {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 2rem auto 0;
  max-width: 1280px;
}

.settings-section {
  align-content: start;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(15, 34, 57, 0.045);
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: 1.2rem;
}

.settings-section-header,
.settings-form-footer {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.settings-section-header h2 {
  font-size: 1.15rem;
  margin: 0.2rem 0 0;
}

.settings-intro {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
  margin: 0;
}

.service-list {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.service-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 0.4rem 1rem;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 1rem 0.2rem;
  text-align: left;
  width: 100%;
}

.service-item:last-child {
  border-bottom: 0;
}

.service-item:hover {
  background: #f7f8f5;
}

.service-item strong,
.service-item small {
  display: block;
}

.service-item small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
  margin-top: 0.25rem;
}

.service-price {
  font-size: 0.8rem;
  font-weight: 850;
  white-space: nowrap;
}

.service-state {
  background: #edf8d9;
  border-radius: 999px;
  color: #3e5a09;
  font-size: 0.62rem;
  font-weight: 850;
  padding: 0.4rem 0.55rem;
  white-space: nowrap;
}

.service-state.is-inactive {
  background: #e8ebe8;
  color: #687069;
}

.settings-form {
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.settings-toggle {
  align-items: center;
  color: #4e574f;
  cursor: pointer;
  display: flex;
  font-size: 0.72rem;
  font-weight: 750;
  gap: 0.55rem;
}

.settings-toggle input {
  accent-color: var(--signal);
  height: 17px;
  width: 17px;
}

.settings-toggle-compact {
  white-space: nowrap;
}

.settings-form-footer {
  border-top: 1px solid var(--line);
  margin-top: 0.25rem;
  padding-top: 1rem;
}

.settings-form-footer small {
  color: var(--muted);
  font-size: 0.65rem;
}

.team-settings-section {
  grid-column: 1 / -1;
}

.integration-health-section {
  grid-column: 1 / -1;
}

.integration-health-actions {
  align-items: center;
  display: flex;
  gap: 0.65rem;
}

.integration-health-badge {
  background: #e8ebe8;
  border-radius: 999px;
  color: #596159;
  font-size: 0.64rem;
  font-weight: 850;
  padding: 0.45rem 0.65rem;
  white-space: nowrap;
}

.integration-health-badge.is-healthy { background: #e9f8d2; color: #3d590c; }
.integration-health-badge.is-warning { background: #fff2d4; color: #755410; }
.integration-health-badge.is-error { background: #fff0f1; color: #98232d; }
.integration-health-badge.is-loading { background: #edf0ed; color: #69716a; }

.integration-health-metrics {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.integration-health-metrics article {
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.9rem;
}

.integration-health-metrics span,
.integration-health-metrics small {
  color: var(--muted);
  font-size: 0.63rem;
  line-height: 1.4;
}

.integration-health-metrics strong {
  font-size: 1.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-error-panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.75rem;
  padding-top: 0.9rem;
}

.integration-error-heading {
  align-items: baseline;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.integration-error-heading strong { font-size: 0.78rem; }
.integration-error-heading span { color: var(--muted); font-size: 0.65rem; }

.integration-error-list {
  display: grid;
  gap: 0.5rem;
}

.integration-error-item {
  align-items: center;
  background: #fff8f8;
  border-left: 3px solid #cf6b74;
  display: grid;
  gap: 0.25rem 1rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0.7rem 0.8rem;
}

.integration-error-item strong { font-size: 0.72rem; }
.integration-error-item span,
.integration-error-item time { color: var(--muted); font-size: 0.62rem; }
.integration-error-item span { grid-column: 1 / -1; }

.team-access-message {
  border-radius: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.5;
  padding: 0.75rem 0.85rem;
}

.team-access-message.is-error {
  background: #fff0f1;
  border-left: 3px solid var(--danger);
  color: #8d1d26;
}

.team-access-message.is-success {
  background: #eef9df;
  border-left: 3px solid #8bbd35;
  color: #34510b;
}

.team-access-list {
  border-top: 1px solid var(--line);
}

.team-access-group + .team-access-group {
  margin-top: 1.35rem;
}

.team-access-group-title {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.66rem;
  font-weight: 850;
  justify-content: space-between;
  letter-spacing: 0.04em;
  margin: 0;
  padding: 0.8rem 0.2rem 0.55rem;
  text-transform: uppercase;
}

.team-access-group-title span {
  background: #e7ebe5;
  border-radius: 999px;
  color: #596159;
  font-size: 0.6rem;
  min-width: 24px;
  padding: 0.25rem 0.45rem;
  text-align: center;
}

.team-access-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  min-height: 72px;
  padding: 0.75rem 0.2rem;
}

.team-access-avatar {
  align-items: center;
  background: #e7ebe5;
  border: 1px solid #d4d9d3;
  border-radius: 50%;
  color: #303731;
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.team-access-details {
  min-width: 0;
}

.team-access-details strong,
.team-access-details small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-access-details strong {
  font-size: 0.78rem;
}

.team-access-details small {
  color: var(--muted);
  font-size: 0.66rem;
  margin-top: 0.25rem;
}

.team-role-badge {
  background: #e8ebe8;
  border-radius: 999px;
  color: #596159;
  font-size: 0.62rem;
  font-weight: 850;
  padding: 0.4rem 0.6rem;
  white-space: nowrap;
}

.team-role-badge.is-owner {
  background: #eaf8d4;
  color: #405a12;
}

.team-role-badge.is-pending {
  background: #fff3d7;
  color: #735414;
}

.team-member-actions {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.team-role-select {
  background: var(--white);
  border: 1px solid #cdd3cd;
  border-radius: 5px;
  color: var(--ink);
  font-size: 0.68rem;
  min-height: 38px;
  padding: 0.45rem 0.6rem;
}

.team-action-button {
  font-size: 0.68rem;
  min-height: 38px;
  padding: 0.5rem 0.7rem;
}

.team-action-button.is-danger {
  border-color: #e2b5b9;
  color: #9c2630;
}

.team-action-button.is-danger:hover {
  background: #fff0f1;
  border-color: #cd7d84;
}

.team-invite-form {
  margin-top: 0.35rem;
}

.team-invite-note {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.55;
  margin: 0;
}

@media (max-width: 960px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .settings-section-header,
  .settings-form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .service-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .service-state {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .team-access-row {
    align-items: start;
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .team-role-badge,
  .team-member-actions {
    grid-column: 2;
    justify-self: start;
  }

  .team-member-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .integration-health-actions,
  .integration-error-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

.lead-controls input,
.lead-controls select,
.detail-status-row select {
  background: var(--white);
  border: 1px solid #cdd3cd;
  border-radius: 5px;
  color: var(--ink);
  font-size: 0.72rem;
  min-height: 40px;
  padding: 0.55rem 0.7rem;
}

.lead-controls input { min-width: 270px; }
.status-new { background: #eefbd8; color: #40551b; }
.status-contacted { background: #fff3d7; color: #735414; }
.status-booked { background: #dcecf8; color: #214e70; }
.status-won { background: #dff4e7; color: #24613a; }
.status-lost { background: #f5e3e5; color: #852d36; }

#lead-list { display: contents; }

.lead-row-button {
  background: var(--white);
  border-bottom: 0;
  border-left: 0;
  border-right: 0;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.lead-row-button:hover { background: #fafbf9; }
.lead-client { align-items: center; display: flex; gap: 0.7rem; }

.lead-avatar {
  align-items: center;
  background: #e4e8e2;
  border: 1px solid #d2d7d1;
  border-radius: 5px;
  color: #3f4841;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.63rem;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.lead-empty { color: var(--muted); font-size: 0.8rem; padding: 2.5rem 1rem; text-align: center; }

.lead-drawer-backdrop {
  background: rgba(10, 12, 11, 0.52);
  inset: 0;
  position: fixed;
  z-index: 50;
}

.lead-drawer {
  background: #f7faff;
  box-shadow: -18px 0 50px rgba(0, 0, 0, 0.18);
  height: 100dvh;
  margin-left: auto;
  max-width: 510px;
  overflow-y: auto;
  width: min(100%, 510px);
}

.lead-drawer-header {
  align-items: flex-start;
  background: linear-gradient(135deg, #0b1220 0%, #112b48 100%);
  color: var(--white);
  display: flex;
  justify-content: space-between;
  padding: 1.5rem;
}

.lead-detail-client { align-items: center; display: flex; gap: 0.9rem; }
.lead-avatar-large { background: var(--signal); border-color: var(--signal); color: var(--signal-dark); height: 46px; width: 46px; }
.lead-detail-client .section-kicker { color: var(--signal); }
.lead-detail-client h2 { font-size: 1.25rem; margin: 0; }
.lead-detail-client p { color: #aeb6af; font-size: 0.74rem; margin: 0.25rem 0 0; }

.drawer-close {
  align-items: center;
  background: transparent;
  border: 1px solid #424943;
  border-radius: 5px;
  color: var(--white);
  cursor: pointer;
  display: inline-flex;
  font-size: 1.25rem;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.lead-drawer-content { padding: 1.35rem; }
.detail-status-row { align-items: center; background: #edf0eb; border: 1px solid #d7ddd6; border-radius: 6px; display: flex; justify-content: space-between; padding: 0.75rem; }
.detail-status-row label { color: #59625a; font-size: 0.72rem; font-weight: 850; }
.detail-status-row select { min-width: 150px; }
.detail-section { border-bottom: 1px solid #dfe3de; padding: 1.3rem 0; }
.detail-section:last-child { border-bottom: 0; }
.detail-section h3 { font-size: 0.75rem; margin: 0 0 0.8rem; text-transform: uppercase; }
.detail-section p { color: #505a52; font-size: 0.8rem; line-height: 1.65; margin: 0; white-space: pre-wrap; }
.detail-list { display: grid; gap: 0.75rem; margin: 0; }
.detail-list > div { display: grid; gap: 1rem; grid-template-columns: 130px minmax(0, 1fr); }
.detail-list dt { color: #7b847c; font-size: 0.7rem; }
.detail-list dd { font-size: 0.76rem; font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.detail-highlight { align-items: center; background: var(--white); border: 1px solid #d8ddd7; border-left: 4px solid var(--signal); border-radius: 5px; display: flex; gap: 0.8rem; justify-content: space-between; margin-bottom: 0.8rem; padding: 0.9rem; }
.detail-highlight strong { font-size: 0.82rem; }
.detail-highlight span { color: #3f531e; font-size: 0.78rem; font-weight: 850; white-space: nowrap; }

.sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.inbox-shell {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(15, 34, 57, 0.06);
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  height: min(680px, calc(100dvh - 190px));
  margin: 0 auto;
  max-width: 1280px;
  min-height: 520px;
  overflow: hidden;
}

.conversation-pane {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.conversation-toolbar {
  align-items: flex-end;
  display: flex;
  justify-content: space-between;
  padding: 1.15rem 1.15rem 0.85rem;
}

.conversation-toolbar h2 {
  font-size: 1.05rem;
  margin: 0.15rem 0 0;
}

.conversation-count {
  align-items: center;
  background: #e8ece7;
  border-radius: 999px;
  color: #475048;
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 850;
  height: 26px;
  justify-content: center;
  min-width: 26px;
  padding: 0 0.45rem;
}

.conversation-search { padding: 0 1.15rem 1rem; }

.conversation-search input {
  background: #f7faff;
  border: 1px solid #cbd8e6;
  border-radius: 9px;
  color: var(--ink);
  font: inherit;
  font-size: 0.76rem;
  min-height: 42px;
  padding: 0.65rem 0.75rem;
  width: 100%;
}

.conversation-search input:focus-visible,
.conversation-item:focus-visible,
.thread-back:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--signal), transparent 45%);
  outline-offset: 1px;
}

.conversation-list {
  border-top: 1px solid var(--line);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.conversation-item {
  align-items: flex-start;
  background: var(--white);
  border: 0;
  border-bottom: 1px solid #e5e8e4;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 0.75rem;
  grid-template-columns: 38px minmax(0, 1fr);
  padding: 0.9rem 1.05rem;
  text-align: left;
  width: 100%;
}

.conversation-item:hover { background: #f8faf7; }
.conversation-item.is-active { background: var(--platform-primary-soft); box-shadow: inset 3px 0 var(--platform-primary); }

.conversation-avatar {
  align-items: center;
  background: #17263b;
  border-radius: 50%;
  color: var(--white);
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.conversation-item-content,
.conversation-item-heading,
.conversation-item-footer {
  min-width: 0;
}

.conversation-item-content { display: grid; gap: 0.25rem; }
.conversation-item-heading,
.conversation-item-footer { align-items: center; display: flex; gap: 0.5rem; justify-content: space-between; }
.conversation-item-heading strong { font-size: 0.77rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item-heading time,
.conversation-item-footer { color: #7a837b; font-size: 0.62rem; }
.conversation-preview { color: #535d55; font-size: 0.7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item-footer > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.unread-badge {
  align-items: center;
  background: var(--signal);
  border-radius: 999px;
  color: var(--signal-dark);
  display: inline-flex;
  font-weight: 900;
  height: 19px;
  justify-content: center;
  min-width: 19px;
  padding: 0 0.35rem;
}

.thread-pane {
  background: #f4f8fd;
  min-height: 0;
  min-width: 0;
  position: relative;
}

.thread-empty {
  align-items: center;
  color: #687169;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.thread-empty-icon {
  align-items: center;
  background: #e5e9e4;
  border-radius: 50%;
  color: #4c564e;
  display: inline-flex;
  font-size: 1.25rem;
  height: 50px;
  justify-content: center;
  width: 50px;
}

.thread-empty h2 { color: var(--ink); font-size: 1rem; margin: 0.85rem 0 0.25rem; }
.thread-empty p { font-size: 0.72rem; margin: 0; }

.thread-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
}

.thread-header {
  align-items: center;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: auto 34px minmax(0, 1fr) auto;
  min-height: 70px;
  padding: 0.8rem 1.1rem;
}

.thread-header .lead-avatar { border-radius: 50%; height: 34px; width: 34px; }
.thread-header div { display: grid; min-width: 0; }
.thread-header strong { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-header small { color: #707971; font-size: 0.64rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thread-back {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  display: none;
  font-size: 1.2rem;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.thread-status {
  background: #e7f4d5;
  border-radius: 999px;
  color: #40591b;
  font-size: 0.62rem;
  font-weight: 850;
  padding: 0.4rem 0.55rem;
}

.thread-header .thread-controls {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.thread-automation select {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 800;
  max-width: 150px;
  padding: 0.38rem 1.7rem 0.38rem 0.65rem;
}

.thread-automation select:disabled {
  cursor: wait;
  opacity: 0.65;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem;
}

.message-row { display: flex; width: 100%; }
.message-row.is-outbound { justify-content: flex-end; }
.message-bubble {
  background: var(--white);
  border: 1px solid #d8ddd7;
  border-radius: 6px;
  box-shadow: 0 1px 1px rgba(17, 20, 18, 0.04);
  max-width: min(72%, 620px);
  min-width: 140px;
  padding: 0.7rem 0.8rem 0.55rem;
}

.is-outbound .message-bubble { background: #e6f4ff; border-color: #b8dcf7; }
.message-sender { color: #59645b; display: block; font-size: 0.59rem; font-weight: 850; margin-bottom: 0.3rem; }
.message-bubble p { color: #263029; font-size: 0.76rem; line-height: 1.5; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.message-bubble footer { color: #778078; display: flex; font-size: 0.56rem; gap: 0.55rem; justify-content: flex-end; margin-top: 0.45rem; }
.message-bubble footer .is-failed { color: #a02d38; font-weight: 800; }
.inbox-empty { color: #727b73; font-size: 0.72rem; margin: auto; padding: 2rem 1rem; text-align: center; }
.inbox-empty-error { color: #8a303a; }

.message-pagination {
  align-items: center;
  background: var(--white);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 52px;
  padding: 0.55rem 1rem;
}

.message-pagination[hidden] { display: none; }
.message-pagination span { color: #687169; font-size: 0.64rem; text-align: center; }

.message-page-button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.66rem;
  font-weight: 850;
  min-height: 34px;
  padding: 0.4rem 0.65rem;
}

.message-page-button:hover:not(:disabled) { border-color: #8e978f; }
.message-page-button:disabled { cursor: default; opacity: 0.42; }

@media (max-width: 760px) {
  .header-actions,
  .lead-controls { width: 100%; }
  .header-actions .button,
  .lead-controls input,
  .lead-controls select { min-width: 0; width: 100%; }
  .dashboard-section-heading { align-items: stretch; }
  .lead-controls { flex-direction: column; }
  .lead-client { grid-column: 1 / -1; }
  .lead-client::before { display: none !important; }
  .dashboard-alert { align-items: flex-start; flex-direction: column; }
  .inbox-shell { display: block; height: calc(100dvh - 180px); min-height: 480px; }
  .conversation-pane,
  .thread-pane { height: 100%; }
  .conversation-pane { border-right: 0; }
  .inbox-shell:not(.has-selection) .thread-pane,
  .inbox-shell.has-selection .conversation-pane { display: none; }
  .thread-back { display: inline-flex; }
  .thread-header { grid-template-columns: auto 34px minmax(0, 1fr); }
  .thread-header .thread-controls { grid-column: 2 / -1; justify-content: flex-end; }
  .message-bubble { max-width: 88%; }
  .message-pagination { padding-inline: 0.7rem; }
  .message-page-button { padding-inline: 0.5rem; }
}

@media (max-width: 520px) {
  .auth-panel { padding: 1.4rem; }
  .header-actions { flex-direction: column-reverse; }
  .lead-drawer-header,
  .lead-drawer-content { padding: 1rem; }
  .detail-list > div { gap: 0.25rem; grid-template-columns: 1fr; }
  .detail-highlight { align-items: flex-start; flex-direction: column; }
  .modal-backdrop { align-items: stretch; padding: 0; }
  .company-onboarding-modal { border-radius: 0; max-height: 100dvh; min-height: 100dvh; }
  .modal-header,
  .company-onboarding-form { padding: 1rem; }
  .company-onboarding-success-view { padding: 1.4rem 1rem 1rem; }
  .onboarding-progress { gap: 0.3rem; }
  .onboarding-progress li { gap: 0.35rem; justify-content: center; padding: 0.55rem 0.35rem; }
  .onboarding-progress li strong { font-size: 0.6rem; }
  .onboarding-grid { grid-template-columns: 1fr; }
  .onboarding-summary,
  .onboarding-ready-list { grid-template-columns: 1fr; }
  .onboarding-actions { align-items: stretch; flex-direction: column-reverse; }
  .onboarding-actions .button,
  .onboarding-success-actions .button { width: 100%; }
  .onboarding-success-actions { align-items: stretch; flex-direction: column-reverse; }
}
/* Versioned industry templates */

.nav-icon-templates::before {
  border: 1.6px solid currentColor;
  border-radius: 3px;
  height: 12px;
  left: 1px;
  top: 1px;
  width: 12px;
}

.nav-icon-templates::after {
  background: currentColor;
  border: 2px solid #0b1220;
  border-radius: 3px;
  bottom: 1px;
  height: 10px;
  right: 1px;
  width: 10px;
}

.template-manager-layout {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1280px;
}

.template-library,
.template-editor-shell {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(15, 34, 57, 0.055);
}

.template-library {
  overflow: hidden;
  position: sticky;
  top: 1.5rem;
}

.template-library-heading,
.template-editor-heading,
.template-fieldset-heading,
.template-form-actions {
  align-items: center;
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
}

.template-library-heading {
  border-bottom: 1px solid var(--line);
  padding: 1.1rem;
}

.template-library-heading h2,
.template-editor-heading h2 {
  font-size: 1rem;
  margin: 0.16rem 0 0;
}

.template-count,
.template-version,
.industry-template-state {
  align-items: center;
  background: var(--platform-primary-soft);
  border-radius: 999px;
  color: var(--platform-primary-dark);
  display: inline-flex;
  font-size: 0.62rem;
  font-weight: 850;
  justify-content: center;
  min-height: 26px;
  min-width: 26px;
  padding: 0.25rem 0.55rem;
}

.industry-template-list {
  display: grid;
  max-height: calc(100dvh - 260px);
  min-height: 280px;
  overflow-y: auto;
}

.industry-template-card {
  background: var(--white);
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 0.55rem;
  padding: 1rem 1.1rem;
  text-align: left;
  transition: background-color 150ms ease, box-shadow 150ms ease;
  width: 100%;
}

.industry-template-card:hover,
.industry-template-card.is-selected {
  background: #f3f9ff;
}

.industry-template-card.is-selected {
  box-shadow: inset 3px 0 var(--platform-primary);
}

.industry-template-card-heading,
.industry-template-card-meta {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
}

.industry-template-card strong {
  font-size: 0.78rem;
}

.industry-template-card p {
  color: var(--muted);
  display: -webkit-box;
  font-size: 0.68rem;
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.industry-template-card-meta {
  color: #728097;
  font-size: 0.62rem;
}

.industry-template-state.is-inactive {
  background: #edf0f4;
  color: #68758a;
}

.template-editor-shell {
  min-height: 560px;
  padding: clamp(1rem, 2.4vw, 1.6rem);
}

.template-editor-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 500px;
  padding: 2rem;
  text-align: center;
}

.template-editor-empty h2 {
  color: var(--ink);
  font-size: 1rem;
  margin: 0.85rem 0 0.4rem;
}

.template-editor-empty p {
  font-size: 0.74rem;
  line-height: 1.6;
  margin: 0;
  max-width: 390px;
}

.template-editor-mark {
  align-items: center;
  background: var(--platform-primary-soft);
  border: 1px solid #b9dcf6;
  border-radius: 12px;
  color: var(--platform-primary);
  display: inline-flex;
  font-size: 1.6rem;
  font-weight: 500;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.industry-template-form {
  display: grid;
  gap: 1rem;
}

.industry-template-form[hidden],
.template-editor-empty[hidden] {
  display: none;
}

.template-editor-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.template-fieldset {
  border: 1px solid #dce6f0;
  border-radius: 12px;
  display: grid;
  gap: 0.85rem;
  margin: 0;
  min-width: 0;
  padding: 1rem;
}

.template-fieldset > legend,
.template-fieldset-heading legend {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
  padding: 0 0.35rem;
}

.template-fieldset-heading legend {
  padding: 0;
}

.template-service-editor {
  display: grid;
  gap: 0.75rem;
}

.template-fieldset .field-label small {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.45;
}

.template-service-row {
  background: #f8fbfe;
  border: 1px solid #d8e4ef;
  border-radius: 10px;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: minmax(160px, 1fr) minmax(100px, 0.35fr) auto;
  padding: 0.85rem;
}

.template-service-row .template-service-description,
.template-service-row .template-service-keywords {
  grid-column: 1 / -1;
}

.template-service-remove {
  align-self: end;
  min-width: 86px;
}

.template-form-actions {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

@media (max-width: 960px) {
  .template-manager-layout {
    grid-template-columns: 1fr;
  }

  .template-library {
    position: static;
  }

  .industry-template-list {
    max-height: 340px;
    min-height: 0;
  }
}

@media (max-width: 620px) {
  .template-library-heading,
  .template-editor-heading,
  .template-fieldset-heading,
  .template-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .template-editor-shell,
  .template-editor-empty {
    min-height: 0;
  }

  .template-service-row .template-service-description,
  .template-service-row .template-service-keywords {
    grid-column: auto;
  }

  .template-service-remove,
  .template-form-actions .button {
    width: 100%;
  }
}
