/* Leads screen — local fake-data view. No live database is connected. */

:root {
  --text: #171614;
  --text-quiet: #3d3a36;
  --bg: #f3efe6;
  --surface: #fffdf8;
  --line: #8a8378;
  --line-soft: #c5bdb0;
  --banner-bg: #f3dd7a;
  --banner-text: #1a1608;
  --selected-bg: #ebe4d4;
  --focus: #171614;
  --error-bg: #fdeaea;
  --error-text: #6b1212;
  --aid-bg: #e7eef6;
  --aid-text: #152033;
  --edge: 0.28rem;
  font-family: Inter, Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  font-size: 1rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

body.hide-toolbar .list-pane .search-block,
body.hide-toolbar .list-pane .sort-block {
  display: none;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-200%);
  background: var(--surface);
  color: var(--text);
  padding: 0.4rem 0.7rem;
  border: 2px solid var(--text);
  z-index: 20;
}

.skip-link:focus {
  transform: none;
}

.page-header,
.fake-banner,
.testing-aid,
.workspace {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.page-header {
  padding-top: 1rem;
  padding-bottom: 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
}

.app-name,
.access-note,
.placeholder-note,
.pane-title,
.sort-block p,
.search-block label {
  margin: 0;
}

.app-name {
  font-weight: 650;
  letter-spacing: 0.01em;
}

.access-note,
.placeholder-note {
  color: var(--text-quiet);
  font-size: 0.95rem;
}

.page-header h1 {
  margin: 0.65rem 0 0.35rem;
  font-size: 1.85rem;
  line-height: 1.2;
  font-weight: 700;
}

.fake-banner {
  background: var(--banner-bg);
  color: var(--banner-text);
  border-bottom: 1px solid #8a6d12;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.fake-banner p {
  margin: 0;
  max-width: 70rem;
}

.testing-aid {
  background: var(--aid-bg);
  color: var(--aid-text);
  border-bottom: 1px dashed #5c6b7a;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  font-size: 0.95rem;
}

.testing-aid[hidden] {
  display: none;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-height: 0;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.list-pane,
.detail-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  min-height: 0;
  overflow: auto;
  padding: 1rem 1rem 1.25rem;
}

.pane-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-quiet);
  margin-bottom: 0.85rem;
}

.search-block label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#search {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--text);
  background: #fff;
  color: var(--text);
  font: inherit;
}

.sort-block {
  margin: 0.85rem 0 0.6rem;
}

.sort-block p {
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.sort-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

button {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--text);
  padding: 0.35rem 0.65rem;
  min-height: 2.25rem;
  cursor: pointer;
}

button[aria-pressed="true"] {
  background: var(--selected-bg);
  font-weight: 650;
  box-shadow: inset 0.28rem 0 0 var(--text);
}

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

.list-count {
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.list-body p,
.detail-body p {
  margin: 0 0 0.75rem;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
}

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

.lead-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.6rem;
  row-gap: 0.15rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-left: var(--edge) solid transparent;
  background: #fff;
  padding: 0.7rem 0.75rem 0.75rem;
  margin: 0 0 0.5rem;
  color: inherit;
  cursor: pointer;
}

.lead-row th,
.lead-row td {
  display: block;
  font-weight: 400;
  padding: 0;
  text-align: left;
}

.leads-table tbody {
  display: block;
}

.lead-row th[scope="row"] {
  flex: 1 1 8rem;
  min-width: 0;
  font-weight: 700;
  font-size: 1.05rem;
}

.lead-row .name-cluster {
  display: flex;
  align-items: baseline;
  gap: 0.45rem 0.7rem;
  min-width: 0;
  max-width: 100%;
}

.lead-row .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-row .selected-label {
  flex: 0 0 auto;
}

.lead-row .status-cell {
  flex: 0 0 auto;
  max-width: 100%;
}

.lead-row .email-line,
.lead-row .quiet-line {
  flex: 1 1 100%;
}

.status-label {
  display: inline-block;
  border: 1px solid var(--text);
  border-radius: 0.2rem;
  padding: 0.1rem 0.4rem;
  font-weight: 650;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--text);
  background: transparent;
  white-space: nowrap;
  cursor: default;
}

.status-label:hover,
.status-label:focus,
.status-label:active {
  border-color: var(--text);
  background: transparent;
  color: var(--text);
}

.status-missing {
  border-style: dashed;
  font-weight: 600;
}

@media (forced-colors: active) {
  .status-label {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
  }

  .status-missing {
    border-style: dashed;
  }
}

.lead-row .email-line,
.lead-row .quiet-line {
  color: var(--text-quiet);
}

.lead-row .email-line {
  margin-top: 0.15rem;
}

.lead-row .quiet-line {
  margin-top: 0.15rem;
  font-size: 0.95rem;
}

.selected-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--text);
  padding: 0.05rem 0.35rem;
}

.lead-row.is-selected {
  border-color: var(--text);
  border-left-color: var(--text);
  background: var(--selected-bg);
}

.missing {
  color: var(--text-quiet);
  font-style: italic;
}

.state-panel {
  border: 1px solid var(--line);
  padding: 0.9rem 1rem;
  background: #fff;
}

.state-panel.error {
  background: var(--error-bg);
  border-color: var(--error-text);
  color: var(--error-text);
}

.state-panel p {
  margin: 0 0 0.75rem;
}

.state-panel p:last-child {
  margin-bottom: 0;
}

.back-control {
  display: none;
  margin-bottom: 0.75rem;
}

.detail-placeholder {
  color: var(--text-quiet);
}

.detail-heading-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0 0 1rem;
}

.detail-heading-line .pane-title {
  margin-bottom: 0;
}

.detail-lead-name {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-heading-line .status-label {
  flex: 0 0 auto;
  align-self: baseline;
}

.detail-section {
  margin: 0 0 1.35rem;
}

.detail-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--line-soft);
}

.detail-section dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(8rem, 14rem) minmax(0, 1fr);
  gap: 0.45rem 1rem;
}

.detail-section dt {
  font-weight: 650;
  margin: 0;
}

.detail-section dd {
  margin: 0;
  overflow-wrap: anywhere;
}

:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

/* Live-data mode only: signed-in bar and sign-in screen */
.session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  color: var(--text-quiet);
  font-size: 0.95rem;
}

.session-bar[hidden] {
  display: none;
}

.session-email {
  overflow-wrap: anywhere;
}

body.signin-mode .workspace {
  display: block;
}

body.signin-mode .list-pane,
body.signin-mode .detail-pane {
  display: none;
}

.signin-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.25rem;
  max-width: 34rem;
}

.signin-pane h2 {
  margin: 0 0 0.6rem;
  font-size: 1.35rem;
}

.signin-pane p {
  margin: 0 0 1rem;
}

.signin-pane label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.signin-pane input[type="email"] {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--text);
  background: #fff;
  color: var(--text);
  font: inherit;
  margin-bottom: 0.75rem;
}

.signin-message {
  margin-top: 1rem;
}

.signin-message:empty {
  display: none;
}

.signin-message p {
  margin: 0;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.7rem 0.85rem;
}

button:disabled {
  cursor: default;
  opacity: 1;
  color: var(--text-quiet);
  border-style: dashed;
}

@media (max-width: 50rem) {
  .workspace {
    display: block;
    overflow: visible;
  }

  .list-pane,
  .detail-pane {
    overflow: visible;
  }

  body:not(.detail-open) .detail-pane {
    display: none;
  }

  body.detail-open .list-pane {
    display: none;
  }

  body.detail-open .back-control {
    display: inline-block;
  }

  .detail-section dl {
    grid-template-columns: 1fr;
    gap: 0.15rem 0;
  }

  .detail-section dt {
    margin-top: 0.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
