:root {
  --bg: #eef1ec;
  --ink: #17201d;
  --muted: #66716d;
  --line: #d7ddd7;
  --panel: #ffffff;
  --steel: #223136;
  --steel-light: #314348;
  --accent: #bb3324;
  --accent-dark: #962418;
  --focus: #44717c;
}

* {
  box-sizing: border-box;
}

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

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

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(238, 241, 236, 0.92)),
    var(--bg);
}

.auth-shell {
  width: min(940px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  border: 1px solid #cdd5cf;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(27, 38, 35, 0.16);
  overflow: hidden;
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 38px 40px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(34, 49, 54, 0.96), rgba(19, 28, 26, 0.98)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 22px);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow,
.form-kicker {
  margin: 0 0 10px;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-panel h1,
.topbar h1,
.welcome h1 {
  margin: 0;
  line-height: 1;
}

.brand-panel h1 {
  max-width: 10ch;
  font-size: clamp(3rem, 5vw, 4.75rem);
  overflow-wrap: anywhere;
}

.intro {
  max-width: 360px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.98rem;
  line-height: 1.55;
}

.login-panel {
  display: grid;
  align-items: center;
  padding: 44px 38px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 251, 249, 1)),
    var(--panel);
}

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

.login-form h2,
.welcome h2 {
  margin: 0;
  font-size: 1.75rem;
}

.login-form label {
  margin-top: 8px;
  color: var(--steel);
  font-size: 0.9rem;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  height: 50px;
  border: 1px solid #dbe0da;
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  background: #fdfdfb;
  outline: none;
}

.login-form input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 137, 0.14);
}

.login-form button,
.secondary-button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #ffffff;
  background: linear-gradient(180deg, #c43a2a, var(--accent));
  cursor: pointer;
  font-weight: 800;
}

.login-form button {
  margin-top: 14px;
  width: 100%;
}

.login-form button:hover,
.secondary-button:hover {
  background: var(--accent-dark);
}

.alert {
  border: 1px solid rgba(183, 55, 37, 0.3);
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--accent-dark);
  background: rgba(183, 55, 37, 0.08);
  font-size: 0.92rem;
  font-weight: 600;
}

.app-page {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: #f6f7f4;
}

.crm-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--steel), #182321);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 8px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
}

.brand-mark-small {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  font-size: 0.82rem;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

.nav-item,
.icon-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.76);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 700;
}

.nav-item {
  padding: 0 12px;
}

.nav-item img,
.icon-button img {
  width: 20px;
  height: 20px;
  filter: invert(1);
  opacity: 0.74;
}

.nav-item:hover,
.icon-button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.is-active,
.icon-button.is-active {
  color: #ffffff;
  background: rgba(187, 51, 36, 0.94);
}

.nav-item.is-active img,
.icon-button.is-active img,
.icon-button:hover img {
  opacity: 1;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 6px;
}

.sidebar-logout {
  margin: 0;
}

.icon-button {
  width: 100%;
  border: 0;
  padding: 0 12px;
  background: transparent;
  cursor: pointer;
}

.crm-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.crm-header {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.crm-header .eyebrow {
  color: var(--muted);
}

.crm-header h1 {
  margin: 0;
  font-size: 1.45rem;
}

.header-subline {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.supplier-number {
  color: #4d6b42;
}

.header-lead-edit {
  min-width: 280px;
}

.header-title-row {
  align-items: center;
  justify-content: flex-start;
}

.header-title-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-title-main h1 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.header-title-main .inline-icon-actions {
  flex: 0 0 auto;
}

.header-edit-form {
  width: min(420px, 100%);
}

.header-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.primary-action,
.secondary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.primary-action {
  border: 0;
  color: #ffffff;
  background: linear-gradient(180deg, #c43a2a, var(--accent));
}

.primary-action.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.secondary-action,
.ghost-action {
  border: 1px solid var(--line);
  color: var(--steel);
  background: #ffffff;
}

.secondary-action-button {
  min-height: 42px;
}

.secondary-action-button:disabled {
  cursor: default;
  opacity: 0.64;
}

.ghost-action {
  justify-self: start;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action:hover,
.ghost-action:hover {
  border-color: #c7d0c7;
  background: #f7f8f5;
}

.primary-action img,
.secondary-action img,
.ghost-action img {
  width: 18px;
  height: 18px;
}

.primary-action img {
  filter: invert(1);
}

.primary-action-button {
  border: 0;
}

.phone-widget {
  position: relative;
}

.phone-toggle,
.phone-call-button,
.phone-mute-button,
.phone-hangup-button,
.phone-accept-button,
.phone-reject-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  cursor: pointer;
}

.phone-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--steel);
  background: #ffffff;
}

.phone-toggle:hover {
  border-color: #c7d0c7;
  background: #f7f8f5;
}

.phone-toggle img,
.phone-call-button img,
.phone-mute-button img,
.phone-hangup-button img,
.phone-accept-button img,
.phone-reject-button img {
  width: 16px;
  height: 16px;
}

.phone-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  width: 286px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(20, 34, 36, 0.14);
}

.phone-panel [hidden] {
  display: none !important;
}

.phone-dial-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.phone-dial-row input,
.phone-audio-settings select {
  width: 100%;
  height: 36px;
  border: 1px solid #dbe0da;
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.phone-dial-row input {
  padding: 0 10px;
  font-weight: 700;
}

.phone-dial-row input:focus,
.phone-audio-settings select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 137, 0.12);
}

.phone-call-button {
  width: 38px;
  height: 36px;
  border-color: rgba(57, 135, 73, 0.28);
  border-radius: 6px;
  background: #2f8f48;
}

.phone-call-button:disabled {
  cursor: default;
  opacity: 0.58;
}

.phone-call-button img,
.phone-hangup-button img,
.phone-accept-button img,
.phone-reject-button img {
  filter: invert(1);
}

.phone-audio-settings {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.phone-audio-settings label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.phone-audio-settings select {
  padding: 0 8px;
  font-size: 0.78rem;
}

.phone-error {
  margin-top: 8px;
  border: 1px solid rgba(183, 55, 37, 0.22);
  border-radius: 6px;
  padding: 7px 8px;
  color: var(--accent-dark);
  background: rgba(183, 55, 37, 0.07);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.phone-incoming-view {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(57, 135, 73, 0.2);
  border-radius: 7px;
  padding: 10px;
  background: #fbfdfb;
}

.phone-incoming-view.is-ringing {
  animation: phoneIncomingPulse 1.1s ease-in-out infinite;
}

.phone-incoming-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.phone-incoming-copy strong,
.phone-incoming-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-incoming-copy strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.phone-incoming-copy span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.phone-incoming-actions {
  display: grid;
  grid-template-columns: 36px 36px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.phone-accept-button,
.phone-reject-button {
  width: 36px;
  height: 34px;
  border-radius: 6px;
}

.phone-accept-button {
  border-color: rgba(57, 135, 73, 0.28);
  background: #2f8f48;
}

.phone-reject-button {
  border-color: rgba(183, 55, 37, 0.26);
  background: var(--accent);
}

.phone-ignore-button {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
}

.phone-ignore-button:hover {
  border-color: #c7d0c7;
  background: #f7f8f5;
}

@keyframes phoneIncomingPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(57, 135, 73, 0.18);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(57, 135, 73, 0.08);
  }
}

.phone-call-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.phone-call-view strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-call-view span {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.phone-call-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.phone-mute-button,
.phone-hangup-button {
  width: 34px;
  height: 34px;
  border-radius: 6px;
}

.phone-mute-button {
  background: #ffffff;
}

.phone-mute-button.is-muted {
  border-color: rgba(183, 55, 37, 0.25);
  background: rgba(183, 55, 37, 0.08);
}

.phone-hangup-button {
  border-color: rgba(183, 55, 37, 0.26);
  background: var(--accent);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
}

.user-chip > span {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  background: #ffffff;
  font-weight: 800;
}

.user-chip strong,
.user-chip small {
  display: block;
  white-space: nowrap;
}

.user-chip strong {
  font-size: 0.9rem;
}

.user-chip small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.empty-workspace {
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(#eef1ec 1px, transparent 1px),
    linear-gradient(90deg, #eef1ec 1px, transparent 1px),
    #f8f9f6;
  background-size: 28px 28px;
}

.workspace {
  min-height: 0;
  overflow: hidden;
  padding: 28px;
  background: #f8f9f6;
}

.leads-workspace {
  overflow: auto;
}

.leads-workspace:has(.lead-detail) {
  overflow: hidden;
}

.settings-workspace {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
}

.settings-panel,
.settings-alert {
  width: min(720px, 100%);
}

.settings-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
}

.settings-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.settings-panel-head img {
  width: 24px;
  height: 24px;
  opacity: 0.72;
}

.settings-panel-head h2 {
  margin: 0;
  font-size: 1.12rem;
}

.connector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #edf0ec;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.connector-row-stack {
  display: grid;
  align-items: stretch;
}

.connector-row strong {
  display: block;
  font-size: 0.94rem;
}

.connector-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

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

.connector-form label {
  display: grid;
  gap: 6px;
  color: var(--steel);
  font-size: 0.82rem;
  font-weight: 800;
}

.connector-form input {
  width: 100%;
  height: 40px;
  border: 1px solid #dbe0da;
  border-radius: 6px;
  padding: 0 11px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.connector-form input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 137, 0.12);
}

.connector-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  grid-column: 1 / -1;
  gap: 10px;
}

.empty-state {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}

.empty-state img {
  width: 46px;
  height: 46px;
  opacity: 0.42;
}

.empty-state h2 {
  margin: 0;
  color: var(--steel);
  font-size: 1.25rem;
}

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

.lead-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: inherit;
  background: #ffffff;
  text-decoration: none;
}

.lead-row:hover {
  border-color: #c8d2ca;
  box-shadow: 0 10px 30px rgba(27, 38, 35, 0.07);
}

.lead-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef1ec;
}

.supplier-icon {
  background: #eef4ea;
}

.lead-icon img {
  width: 22px;
  height: 22px;
  opacity: 0.72;
}

.lead-row h2 {
  margin: 0;
  font-size: 1.05rem;
}

.lead-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.lead-detail {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(360px, 1fr) 300px;
  gap: 14px;
  overflow: hidden;
}

.lead-detail-leads {
  grid-template-columns: 320px minmax(520px, 1fr);
}

.lead-detail-leads > .timeline-panel {
  grid-column: 2;
  grid-row: 1;
}

.lead-detail-suppliers {
  grid-template-columns: 300px minmax(420px, 1fr) 360px;
}

.lead-detail-suppliers > .detail-column:first-child {
  grid-column: 1;
  grid-row: 1;
}

.lead-detail-suppliers > .timeline-panel {
  grid-column: 2;
  grid-row: 1;
}

.lead-detail-suppliers > .detail-column:last-child {
  grid-column: 3;
  grid-row: 1;
}

.website-card {
  margin-bottom: 10px;
}

.website-card a {
  color: var(--steel);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  word-break: break-word;
}

.website-card a:hover {
  color: var(--accent);
}

.detail-column,
.timeline-panel {
  min-height: 0;
  overflow: auto;
}

.detail-column {
  display: grid;
  align-content: start;
  gap: 12px;
}

.detail-panel,
.timeline-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.detail-panel {
  padding: 14px;
}

.detail-company-mark,
.timeline-icon {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef1ec;
}

.detail-company-mark {
  width: 42px;
  height: 42px;
}

.detail-company-mark img,
.detail-panel-head img {
  width: 20px;
  height: 20px;
  opacity: 0.72;
}

.detail-panel-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.detail-panel-head-spread {
  justify-content: space-between;
}

.detail-panel-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.detail-panel-head-tight {
  margin-top: 4px;
  margin-bottom: 0;
}

.detail-panel-head h3,
.timeline-head h2,
.timeline-card h3,
.contact-card h4 {
  margin: 0;
}

.detail-panel-head h3 {
  font-size: 0.98rem;
}

.compact-facts {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.compact-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf0ec;
  padding-bottom: 9px;
}

.compact-facts div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.compact-facts dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.compact-facts dd {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 800;
}

.address-list,
.contact-list {
  display: grid;
  gap: 10px;
}

.product-list {
  display: grid;
  gap: 8px;
}

.product-card {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #edf0ec;
  border-radius: 8px;
  padding: 0 8px 0 11px;
  background: #fbfcfa;
}

.product-card-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.product-card-main strong {
  font-size: 0.86rem;
  font-weight: 800;
}

.product-card-main small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.product-edit-panel {
  gap: 10px;
  margin-top: 0;
}

.product-edit-panel .form-row-actions {
  grid-template-columns: minmax(0, 1fr) auto;
}

.product-edit-panel form {
  min-width: 0;
}

.mini-action-danger {
  border-color: rgba(187, 51, 36, 0.22);
  color: var(--accent);
  background: rgba(187, 51, 36, 0.05);
}

.mini-action-danger:hover {
  background: rgba(187, 51, 36, 0.08);
}

.mini-action-danger img {
  filter: invert(24%) sepia(89%) saturate(1600%) hue-rotate(348deg) brightness(89%) contrast(92%);
  opacity: 0.82;
}

.address-card,
.contact-card {
  border: 1px solid #edf0ec;
  border-radius: 8px;
  background: #fbfcfa;
}

.address-card {
  padding: 11px;
}

.editable-card {
  position: relative;
}

.editable-card-plain {
  border: 0;
  background: transparent;
}

.edit-view {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.edit-view > div:first-child,
.contact-card > div:last-child {
  min-width: 0;
}

.edit-view strong {
  display: block;
  color: var(--steel);
  font-size: 0.86rem;
}

.edit-view p {
  margin: 4px 0 0;
  color: var(--steel);
  font-size: 0.84rem;
  line-height: 1.35;
}

.field-caption {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.inline-icon-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.icon-only {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--steel);
  background: transparent;
  cursor: pointer;
}

.icon-only:hover {
  border-color: var(--line);
  background: #ffffff;
}

.icon-only img {
  width: 15px;
  height: 15px;
  opacity: 0.72;
}

.icon-only-danger:hover {
  border-color: rgba(187, 51, 36, 0.25);
  background: rgba(187, 51, 36, 0.06);
}

.icon-only-danger img {
  opacity: 0.62;
}

.icon-only-danger:hover img {
  filter: invert(24%) sepia(89%) saturate(1600%) hue-rotate(348deg) brightness(89%) contrast(92%);
  opacity: 0.9;
}

.icon-only:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.edit-form {
  display: none;
  margin-top: 8px;
}

.editable-card.is-editing > .edit-view,
.editable-card.is-editing > div > .edit-view,
.editable-card.is-editing > .add-toggle {
  display: none;
}

.editable-card.is-editing > .edit-form,
.editable-card.is-editing > div > .edit-form,
.editable-card.is-editing .timeline-card > .edit-form {
  display: grid;
}

.form-row-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.add-card {
  margin-top: 10px;
  border: 1px dashed #dfe4dd;
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
}

.add-toggle {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--steel);
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
}

.add-toggle:hover {
  background: #f8f9f6;
}

.timeline-panel {
  padding: 16px;
}

.timeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.timeline-head h2 {
  font-size: 1.15rem;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
}

.timeline-item-outgoing,
.timeline-item-system {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.timeline-item-outgoing .timeline-icon,
.timeline-item-system .timeline-icon {
  grid-column: 2;
  grid-row: 1;
}

.timeline-item-outgoing .timeline-card,
.timeline-item-system .timeline-card {
  grid-column: 1;
  justify-self: end;
  text-align: left;
}

.timeline-item-incoming .timeline-card,
.timeline-item-outgoing .timeline-card,
.timeline-item-system .timeline-card {
  width: min(78%, 520px);
}

.timeline-item-incoming .timeline-card {
  justify-self: start;
}

.timeline-icon {
  width: 34px;
  height: 34px;
  margin-top: 2px;
}

.timeline-icon img {
  width: 17px;
  height: 17px;
  opacity: 0.72;
}

.timeline-card {
  border: 1px solid #e7ece6;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.timeline-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.note-add-card {
  position: relative;
  min-width: 118px;
}

.note-add-card .note-form {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(360px, 72vw);
  border: 1px solid #dfe5de;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(24, 35, 32, 0.14);
}

.timeline-card .note-form {
  margin-top: 10px;
  border-top: 1px solid #edf0ec;
  padding-top: 10px;
}

.timeline-item-outgoing .timeline-card,
.timeline-item-system .timeline-card {
  border-color: rgba(187, 51, 36, 0.18);
  background: #fffaf8;
}

.timeline-item-incoming .timeline-card {
  background: #ffffff;
}

.timeline-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.timeline-card-head span {
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timeline-card h3 {
  margin-top: 3px;
  font-size: 0.98rem;
}

.timeline-card time {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.timeline-card p {
  margin: 10px 0 8px;
  color: var(--steel);
  font-size: 0.9rem;
  line-height: 1.45;
}

.timeline-audio {
  width: 100%;
  height: 34px;
  margin: 2px 0 8px;
}

.transcript-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0 0 8px;
  padding: 0 10px;
  color: var(--steel);
  background: #ffffff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
}

.transcript-button:hover {
  background: #f7f8f5;
}

.transcript-button img {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

.timeline-card small,
.muted-copy {
  color: var(--muted);
}

.contact-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
}

.contact-card .edit-view {
  display: block;
  padding-right: 48px;
}

.contact-card .inline-icon-actions {
  position: absolute;
  top: 8px;
  right: 8px;
}

.contact-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--steel-light);
  font-weight: 800;
}

.contact-card h4 {
  font-size: 0.93rem;
}

.contact-card p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.contact-card a {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  margin-top: 6px;
  color: var(--steel);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.contact-card a img {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  opacity: 0.72;
}

.contact-card a span {
  min-width: max-content;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.contact-links {
  display: grid;
  gap: 4px;
  margin: 9px 0;
  overflow: visible;
}

.method-editor {
  display: grid;
  gap: 6px;
}

.method-editor > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.method-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 6px;
  align-items: center;
}

.method-row .icon-only {
  width: 30px;
  height: 30px;
}

.mini-link-button {
  width: max-content;
  border: 0;
  padding: 0;
  color: var(--steel);
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
}

.mini-link-button:hover {
  color: var(--accent);
}

.contact-menu {
  position: fixed;
  z-index: 50;
  min-width: 150px;
  border: 1px solid #d8ded7;
  border-radius: 6px;
  padding: 4px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(23, 32, 29, 0.18);
}

.contact-menu button {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 4px;
  padding: 0 9px;
  color: var(--steel);
  background: transparent;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 700;
  text-align: left;
}

.contact-menu button:hover {
  background: #f2f5f1;
}

.contact-menu img {
  width: 15px;
  height: 15px;
  opacity: 0.72;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 32, 29, 0.36);
  backdrop-filter: blur(3px);
}

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

.product-modal {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(23, 32, 29, 0.24);
}

.email-modal {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(23, 32, 29, 0.24);
  overflow: auto;
}

.transcript-modal {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(23, 32, 29, 0.24);
}

.transcript-list {
  display: grid;
  gap: 10px;
  overflow: auto;
}

.transcript-entry {
  border: 1px solid #edf0ec;
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfa;
}

.transcript-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.transcript-entry-head strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.transcript-entry-head span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.transcript-entry p {
  margin: 0;
  color: var(--steel);
  font-size: 0.9rem;
  line-height: 1.48;
}

.email-modal label,
.email-recipient-section {
  display: grid;
  gap: 7px;
}

.email-modal label span,
.email-field-head span {
  color: var(--steel);
  font-size: 0.84rem;
  font-weight: 800;
}

.email-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.email-recipient-list {
  display: grid;
  gap: 6px;
}

.email-recipient-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 6px;
  align-items: center;
}

.email-recipient-picker-row {
  grid-template-columns: minmax(0, 1fr) 30px;
}

.email-combo {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  border: 1px solid #dbe0da;
  border-radius: 6px;
  background: #ffffff;
}

.email-combo input {
  border: 0;
}

.email-combo-toggle {
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid #edf0ec;
  border-radius: 0 6px 6px 0;
  background: transparent;
  cursor: pointer;
}

.email-combo-toggle:hover {
  background: #f8f9f6;
}

.email-combo-toggle img {
  width: 15px;
  height: 15px;
  opacity: 0.68;
}

.email-modal input,
.email-modal textarea,
.email-picker {
  width: 100%;
  border: 1px solid #dbe0da;
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.email-modal input,
.email-picker {
  height: 38px;
  padding: 0 10px;
}

.email-modal .email-combo input {
  border: 0;
}

.email-suggestion-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 55;
  max-height: 160px;
  overflow: auto;
  border: 1px solid #d8ded7;
  border-radius: 6px;
  padding: 4px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(23, 32, 29, 0.14);
}

.email-suggestion-list[hidden] {
  display: none;
}

.email-suggestion-list button {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  padding: 0 9px;
  color: var(--steel);
  background: transparent;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 700;
  text-align: left;
}

.email-suggestion-list button:hover {
  background: #f2f5f1;
}

.email-modal textarea {
  height: clamp(180px, 28vh, 300px);
  min-height: 160px;
  max-height: 300px;
  resize: none;
  padding: 10px;
  font: inherit;
  line-height: 1.45;
}

.email-modal .form-row-actions {
  position: sticky;
  bottom: -16px;
  margin: 0 -16px -16px;
  border-top: 1px solid var(--line);
  padding: 12px 16px 16px;
  background: #ffffff;
}

.product-step {
  display: grid;
  gap: 12px;
}

.product-step[hidden] {
  display: none;
}

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

.modal-head h2 {
  margin: 0;
  font-size: 1rem;
}

.product-modal label {
  display: grid;
  gap: 6px;
  color: var(--steel);
  font-size: 0.84rem;
  font-weight: 800;
}

.product-modal input {
  width: 100%;
  height: 42px;
  border: 1px solid #dbe0da;
  border-radius: 6px;
  padding: 0 11px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.product-suggestions {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.product-suggestions button {
  min-height: 34px;
  display: grid;
  gap: 3px;
  border: 1px solid #edf0ec;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--steel);
  background: #fbfcfa;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: left;
}

.product-suggestions button[hidden] {
  display: none;
}

.product-suggestions small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.product-suggestions button:hover {
  border-color: #c7d0c7;
  background: #f2f5f1;
}

.compact-edit-form,
.add-mini-form {
  display: grid;
  gap: 9px;
}

.add-mini-form {
  margin-top: 0;
  border-top: 1px solid #edf0ec;
  padding: 12px;
}

.compact-edit-form.edit-form,
.add-mini-form.edit-form {
  display: none;
}

.editable-card.is-editing > .edit-form,
.editable-card.is-editing > div > .edit-form {
  display: grid;
}

.compact-edit-form label {
  display: grid;
  gap: 5px;
  color: var(--steel);
  font-size: 0.78rem;
  font-weight: 800;
}

.compact-edit-form input,
.compact-edit-form select,
.compact-edit-form textarea {
  width: 100%;
  border: 1px solid #dbe0da;
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.compact-edit-form input,
.compact-edit-form select {
  height: 34px;
  padding: 0 9px;
}

.compact-edit-form textarea {
  min-height: 74px;
  padding: 8px 9px;
  resize: vertical;
  line-height: 1.4;
  font: inherit;
}

.compact-edit-form input:focus,
.compact-edit-form select:focus,
.compact-edit-form textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 137, 0.12);
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-card {
  border: 1px solid #edf0ec;
  border-radius: 8px;
  background: #fbfcfa;
  padding: 10px 11px;
}

.task-card-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  cursor: pointer;
  outline: none;
}

.task-card-view:focus,
.task-card-view:hover {
  color: var(--steel);
}

.task-card-main {
  min-width: 0;
}

.task-card.is-completed {
  background: #f4f7f3;
}

.task-card.is-completed strong {
  color: #7b8780;
  text-decoration: line-through;
}

.task-card strong {
  display: block;
  color: var(--steel);
  font-size: 0.86rem;
  line-height: 1.35;
}

.task-card small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.task-card small img {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.task-menu [data-task-menu-delete] {
  color: #b7352b;
}

.compact-edit-form input[data-date-picker] {
  cursor: pointer;
}

.date-picker-menu {
  position: fixed;
  z-index: 60;
  width: 238px;
  border: 1px solid #d9dfd8;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(24, 35, 32, 0.16);
}

.date-picker-head,
.date-picker-weekdays,
.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: center;
  gap: 4px;
}

.date-picker-head {
  grid-template-columns: 28px 1fr 28px;
  margin-bottom: 8px;
}

.date-picker-head strong {
  color: var(--steel);
  font-size: 0.84rem;
  text-align: center;
  text-transform: capitalize;
}

.date-picker-head button,
.date-picker-days button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--steel);
  font: inherit;
  font-weight: 800;
}

.date-picker-head button {
  height: 28px;
  font-size: 1rem;
}

.date-picker-weekdays {
  margin-bottom: 4px;
}

.date-picker-weekdays span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.date-picker-days button,
.date-picker-days > span {
  height: 28px;
}

.date-picker-days button {
  font-size: 0.78rem;
}

.date-picker-head button:hover,
.date-picker-days button:hover,
.date-picker-days button.is-selected {
  background: #eef1ec;
}

.mini-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  gap: 8px;
}

.mini-action,
.danger-action {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.mini-action {
  border: 1px solid var(--line);
  color: var(--steel);
  background: #ffffff;
}

.mini-action-muted {
  color: var(--muted);
  background: #f8f9f6;
}

.danger-action {
  width: 100%;
  margin-top: 8px;
  border: 1px solid rgba(187, 51, 36, 0.24);
  color: var(--accent-dark);
  background: rgba(187, 51, 36, 0.06);
}

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

.mini-action:hover {
  background: #f7f8f5;
}

.danger-action:hover:not(:disabled) {
  background: rgba(187, 51, 36, 0.12);
}

.mini-action img,
.danger-action img {
  width: 14px;
  height: 14px;
}

.muted-copy {
  margin: 0;
  font-size: 0.88rem;
}

.lead-form {
  width: min(940px, 100%);
  display: grid;
  gap: 16px;
}

.form-section {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.section-heading img {
  width: 26px;
  height: 26px;
  opacity: 0.72;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.08rem;
}

.form-section label,
.field-grid label {
  display: grid;
  gap: 7px;
  color: var(--steel);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-section input,
.form-section textarea,
.form-section select {
  width: 100%;
  border: 1px solid #dbe0da;
  border-radius: 6px;
  color: var(--ink);
  background: #fdfdfb;
  outline: none;
}

.form-section input,
.form-section select {
  height: 44px;
  padding: 0 12px;
}

.form-section textarea {
  resize: vertical;
  min-height: 86px;
  padding: 11px 12px;
  line-height: 1.45;
}

.form-section input:focus,
.form-section textarea:focus,
.form-section select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 137, 0.14);
}

.form-section select:disabled {
  color: var(--muted);
  background: #f2f4f1;
}

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

.entry-block {
  display: grid;
  gap: 12px;
  border: 1px solid #e3e7e1;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entry-head strong {
  font-size: 0.9rem;
}

.entry-remove {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.entry-remove:hover {
  border-color: rgba(187, 51, 36, 0.35);
  background: rgba(187, 51, 36, 0.07);
}

.entry-remove img {
  width: 16px;
  height: 16px;
}

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

.address-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 140px minmax(0, 1fr);
}

.form-footer {
  display: flex;
  justify-content: flex-end;
}

.text-link {
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 780px) {
  .auth-page {
    padding: 18px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .brand-panel,
  .login-panel {
    padding: 28px;
  }

  .brand-panel h1 {
    max-width: none;
    font-size: 3rem;
  }

  .crm-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .sidebar-brand {
    padding: 0 4px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
  }

  .nav-item,
  .icon-button {
    min-height: 44px;
  }

  .sidebar-footer {
    margin-top: 12px;
  }

  .crm-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .header-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .workspace {
    padding: 18px;
  }

  .lead-detail {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .lead-detail-leads {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .lead-detail-leads > .timeline-panel {
    grid-column: 1;
    grid-row: 2;
  }

  .lead-detail-suppliers {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .lead-detail-suppliers > .detail-column:first-child,
  .lead-detail-suppliers > .timeline-panel,
  .lead-detail-suppliers > .detail-column:last-child {
    grid-column: 1;
    grid-row: auto;
  }

  .detail-column,
  .timeline-panel {
    overflow: visible;
  }

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

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

  .connector-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .empty-workspace {
    min-height: 360px;
  }
}
