:root {
  color-scheme: light;
  --ink: #16211f;
  --ink-soft: #243534;
  --muted: #5d6e70;
  --line: #d8e2df;
  --paper: #eff4f2;
  --panel: #fbfdfc;
  --white: #ffffff;
  --green: #176b53;
  --green-dark: #0f4b3c;
  --mint: #dff0ea;
  --lime: #e1f18a;
  --coral: #d86f59;
  --gold: #b88629;
  --blue: #356f98;
  --blue-soft: #e9f2f8;
  --gold-soft: #f7efd9;
  --red-soft: #faece7;
  --shadow: 0 14px 36px rgba(19, 35, 31, 0.08);
  --shadow-soft: 0 8px 22px rgba(19, 35, 31, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f8faf9 0, var(--paper) 340px);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
input {
  font: inherit;
}

input {
  min-height: 44px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 10px;
  padding: 11px 13px;
  color: var(--white);
  background: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: translateY(calc(-100% - 18px));
}

.skip-link:focus {
  transform: translateY(0);
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 111, 159, 0.55);
  outline-offset: 2px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px;
  color: var(--white);
  background: var(--ink-soft);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
  font-size: 17px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ink);
  background: var(--lime);
  border-radius: 8px;
  font-size: 13px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav a {
  padding: 11px 12px;
  color: #dbe5df;
  border-radius: 8px;
  font-weight: 750;
}

.side-nav a.active,
.side-nav a:hover {
  color: var(--white);
  background: rgba(225, 241, 138, 0.12);
}

.side-note {
  margin-top: auto;
  padding: 14px;
  background: rgba(12, 24, 22, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
}

.side-note span,
.eyebrow,
.hint,
dt,
.next-action span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.side-note span {
  display: block;
  margin-bottom: 8px;
  color: var(--lime);
}

.side-note p {
  margin: 0;
  color: #dbe5df;
  line-height: 1.45;
}

.logout-button {
  width: 100%;
  min-height: 40px;
  margin-top: 12px;
  color: var(--ink);
  background: var(--lime);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
}

.app-shell {
  margin-left: 232px;
  padding: 24px clamp(18px, 3vw, 40px) 38px;
}

.section-head {
  display: flex;
  align-items: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.1;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.crm-workspace {
  display: grid;
  grid-template-columns: minmax(620px, 1.14fr) minmax(390px, 0.86fr);
  gap: 18px;
  align-items: start;
}

.pipeline-panel,
.lead-detail {
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.pipeline-panel {
  border-top-color: #c8ddd6;
}

.lead-detail {
  background: var(--panel);
}

.section-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.pipeline-tools {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.search-box {
  display: grid;
  gap: 5px;
  min-width: min(330px, 100%);
}

.search-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.search-box input {
  width: 100%;
  min-height: 44px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-box input:focus {
  outline: 2px solid rgba(31, 122, 76, 0.18);
  border-color: var(--green);
}

.hint {
  padding: 7px 10px;
  color: var(--green-dark);
  background: var(--mint);
  border: 1px solid #cfe2db;
  border-radius: 8px;
  white-space: nowrap;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 10px;
  align-items: stretch;
  overflow-x: auto;
}

.pipeline-column {
  position: relative;
  display: grid;
  min-height: min(660px, calc(100vh - 246px));
  grid-template-rows: auto minmax(0, 1fr);
  padding: 10px;
  overflow: hidden;
  background: #f5f8f7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pipeline-column::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--stage-accent, var(--green));
  content: "";
}

.pipeline-column[data-stage="seller"] {
  --stage-accent: var(--gold);
}

.pipeline-column[data-stage="new"] {
  --stage-accent: var(--blue);
}

.pipeline-column[data-stage="qualified"] {
  --stage-accent: var(--green);
}

.pipeline-column header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-height: 72px;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--line);
}

.pipeline-column header p,
.pipeline-card p,
.column-empty {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.4;
}

.pipeline-column header p {
  margin-top: 4px;
  font-size: 12px;
}

.pipeline-column header strong {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.pipeline-column[data-stage="seller"] header strong {
  color: #735012;
  background: var(--gold-soft);
  border-color: #e4d2a7;
}

.pipeline-column[data-stage="new"] header strong {
  color: #245472;
  background: var(--blue-soft);
  border-color: #c9dce9;
}

.pipeline-column[data-stage="qualified"] header strong {
  color: var(--green-dark);
  background: var(--mint);
  border-color: #cfe2db;
}

.column-cards {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding-top: 10px;
  overflow-y: auto;
}

.pipeline-card {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 118px;
  padding: 10px 10px 8px;
  color: var(--ink);
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pipeline-card:hover,
.pipeline-card.active {
  border-color: var(--green);
  background: var(--white);
  box-shadow: 0 0 0 2px rgba(23, 107, 83, 0.12), var(--shadow-soft);
}

.pipeline-card.deleted {
  background: #f4f1ef;
  border-style: dashed;
}

.pipeline-card.deleted:hover,
.pipeline-card.deleted.active {
  border-color: #b99389;
  box-shadow: 0 0 0 2px rgba(135, 61, 46, 0.1), var(--shadow-soft);
}

.card-select {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 0;
  padding: 0;
  color: inherit;
  text-align: inherit;
  background: transparent;
  border: 0;
}

.pipeline-card strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.card-select span,
.card-select b {
  color: var(--muted);
  font-size: 13px;
}

.card-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 8px;
}

.card-meta em {
  overflow-wrap: anywhere;
  font-style: normal;
}

.card-meta time {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.card-select b {
  color: var(--ink);
}

.assigned-chip {
  width: max-content;
  max-width: 100%;
  padding: 4px 7px;
  overflow-wrap: anywhere;
  color: var(--green-dark);
  background: var(--mint);
  border: 1px solid #cfe2db;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 850;
}

.deleted-label {
  width: max-content;
  padding: 4px 7px;
  color: #873d2e;
  background: var(--red-soft);
  border: 1px solid #ebcec5;
  border-radius: 7px;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.card-select p {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 0;
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.card-move {
  display: flex;
  gap: 6px;
}

.detail-button,
.delete-button {
  min-height: 44px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.detail-button {
  color: var(--green-dark);
  background: var(--mint);
  border: 1px solid #cfe2db;
}

.detail-button:hover:not(:disabled) {
  border-color: var(--green);
}

.delete-button {
  color: #873d2e;
  background: var(--red-soft);
  border: 1px solid #ebcec5;
}

.delete-button:hover:not(:disabled) {
  border-color: var(--coral);
}

.delete-button.restore {
  color: var(--green-dark);
  background: var(--mint);
  border-color: #cfe2db;
}

.delete-button.restore:hover:not(:disabled) {
  border-color: var(--green);
}

.delete-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.move-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--green-dark);
  background: var(--mint);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.move-button:hover:not(:disabled) {
  border-color: var(--green);
}

.move-button:disabled {
  color: #97a39d;
  cursor: default;
  background: transparent;
  border-color: var(--line);
}

.column-empty {
  padding: 12px 2px;
  font-size: 13px;
  font-weight: 700;
}

.status,
.quality {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 850;
}

.status {
  color: var(--white);
  background: var(--blue);
}

.status.hot {
  background: var(--coral);
}

.status.seller {
  background: var(--gold);
}

.status.qualified {
  background: var(--green);
}

.badge-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.quality {
  color: var(--green-dark);
  background: var(--mint);
  border: 1px solid #cfe2db;
}

.quality.medium {
  color: #6d4c0b;
  background: #fff3d4;
}

.quality.low {
  color: #8f351f;
  background: var(--red-soft);
}

.detail-grid,
.property-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.detail-grid div,
.property-grid div,
.next-action {
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.next-action {
  background: #f1f7f5;
  border-color: #d0e1db;
}

.detail-grid div:nth-child(3),
.detail-grid div:nth-child(4),
.property-grid div:nth-child(3),
.property-grid div:nth-child(4) {
  grid-column: 1 / -1;
}

.property-grid,
.next-action {
  margin-top: 10px;
}

.lead-detail {
  position: sticky;
  top: 18px;
}

dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.missing-fields {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.next-action p {
  margin: 8px 0 0;
  line-height: 1.52;
}

.empty-state {
  min-height: 160px;
  padding: 18px;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-weight: 750;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-shell {
  width: min(460px, 100%);
}

.auth-card {
  display: grid;
  gap: 22px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-brand {
  color: var(--ink);
}

.auth-card h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.05;
}

.auth-form,
.user-form {
  display: grid;
  gap: 12px;
}

.auth-form label,
.user-form label {
  display: grid;
  gap: 6px;
}

.auth-form label span,
.user-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.primary-button {
  min-height: 44px;
  padding: 0 14px;
  color: var(--white);
  background: var(--green);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: #873d2e;
  font-size: 13px;
  font-weight: 750;
}

.supervisor-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(480px, 1.22fr);
  gap: 18px;
  align-items: start;
}

.supervisor-panel {
  position: static;
}

.section-head-small {
  margin-top: 18px;
}

.table-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

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

.list-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.list-row strong,
.list-row span {
  overflow-wrap: anywhere;
}

.list-row span,
.list-row small,
.list-row time {
  color: var(--muted);
  font-size: 13px;
}

.list-row small {
  color: var(--green-dark);
  font-weight: 800;
}

.deleted-admin-row {
  background: #f4f1ef;
  border-style: dashed;
}

.supervisor-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.supervisor-stats div {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.supervisor-stats strong {
  font-size: 24px;
}

.supervisor-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reminder-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reminder-recipients {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .sidebar {
    position: static;
    width: auto;
    gap: 16px;
  }

  .app-shell {
    margin-left: 0;
    padding-top: 18px;
  }

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

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

  .pipeline-column {
    min-height: 380px;
  }

  .lead-detail {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    background: var(--paper);
  }

  .sidebar {
    padding: 14px;
  }

  .brand {
    font-size: 16px;
  }

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

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

  .detail-grid,
  .property-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 12px 10px 26px;
  }

  .pipeline-panel,
  .lead-detail {
    padding: 12px;
  }

  .pipeline-board {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .pipeline-column {
    min-height: 0;
    padding: 9px;
  }

  .column-cards {
    max-height: none;
    overflow: visible;
  }

  .pipeline-card {
    min-height: 0;
  }

  .card-select {
    gap: 7px;
    padding-block: 2px;
  }

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

  .card-move {
    justify-content: flex-start;
  }

  .pipeline-tools,
  .search-box {
    width: 100%;
  }

  .pipeline-tools {
    align-items: stretch;
    justify-content: flex-start;
  }

  .badge-stack {
    justify-content: flex-start;
  }

  .side-note {
    display: none;
  }

  .side-nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

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

  .supervisor-stats {
    grid-template-columns: 1fr;
  }
}
