:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #eef2f9;
  --text: #162031;
  --muted: #66748a;
  --border: #d9e0ec;
  --primary: #1d4ed8;
  --primary-dark: #163fae;
  --success: #0f766e;
  --danger: #b91c1c;
  --warning: #b45309;
  --shadow: 0 10px 30px rgba(22, 32, 49, 0.08);
  font-family: Inter, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.brand-subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.content {
  padding: 1rem;
  max-width: 1600px;
  margin: 0 auto;
}

.panel,
.auth-card,
.lead-card,
.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.panel,
.auth-card {
  padding: 1rem;
}

.panel-gap {
  margin-bottom: 1rem;
}

.panel-header,
.column-heading,
.lead-meta,
.toolbar,
.detail-layout,
.status-row,
.card-links,
.topbar-actions,
.inline-form {
  display: flex;
  gap: 0.75rem;
}

.panel-header,
.column-heading,
.lead-meta,
.toolbar,
.status-row,
.card-links,
.inline-form {
  align-items: center;
  justify-content: space-between;
}

.toolbar {
  flex-wrap: wrap;
}

.status-row {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.stack,
.card-stack,
.flash-stack,
.note-list,
.stack-compact {
  display: grid;
  gap: 0.75rem;
}

.stack-compact {
  gap: 0.5rem;
}

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

.column-panel {
  min-height: 24rem;
}

.column-heading {
  margin-bottom: 0.75rem;
}

.counter,
.user-chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.95rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.badge-new {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-in_progress {
  background: #ede9fe;
  color: #6d28d9;
}

.badge-contacted {
  background: #ccfbf1;
  color: #0f766e;
}

.badge-won {
  background: #dcfce7;
  color: #15803d;
}

.badge-irrelevant {
  background: #fee2e2;
  color: #b91c1c;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field-inline {
  min-width: 12rem;
}

.field-grow {
  flex: 1 1 18rem;
}

.field-label {
  color: var(--muted);
}

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

input,
select,
textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.button {
  border: none;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.button-primary {
  background: var(--primary);
  color: #fff;
}

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

.button-secondary {
  background: var(--surface-alt);
  color: var(--text);
}

.lead-card,
.note-card {
  padding: 0.9rem;
}

.lead-title {
  margin: 0;
}

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

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

.detail-list div {
  padding: 0.7rem;
  border-radius: 14px;
  background: var(--surface-alt);
}

.detail-list dt {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.detail-list dd {
  margin: 0;
}

.message-preview,
.empty-state,
.muted {
  color: var(--muted);
}

.message-panel {
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface-alt);
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.detail-layout {
  align-items: start;
  gap: 1rem;
}

.detail-layout > :first-child {
  flex: 2 1 42rem;
}

.detail-layout > :last-child {
  flex: 1 1 20rem;
}

.auth-card {
  width: min(100%, 28rem);
  margin: 10vh auto 0;
}

.flash {
  border-radius: 14px;
  padding: 0.85rem 1rem;
}

.flash-success {
  background: #dcfce7;
  color: #166534;
}

.flash-error {
  background: #fee2e2;
  color: #991b1b;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 1100px) {
  .columns-grid,
  .detail-layout,
  .detail-list {
    grid-template-columns: 1fr;
  }

  .detail-layout,
  .panel-header,
  .toolbar,
  .card-links,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .topbar,
  .content {
    padding: 0.85rem;
  }

  .button,
  input,
  select,
  textarea {
    min-height: 2.8rem;
  }

  .field-inline,
  .field-grow {
    min-width: 0;
    width: 100%;
  }
}
