* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: light;
  font-family: Inter, Arial, sans-serif;
  background: #ffffff;
  color: #241f18;

  /* Design system tokens — Czernex Reach 1.0 (light, warm-white, restrained orange) */
  --bg: #ffffff;
  --bg-soft: #fbf7f1;
  --surface: #ffffff;
  --surface-soft: #faf6f0;
  --surface-strong: #f3ece1;
  --border: #ece4d8;
  --border-strong: #ddd0bd;
  --text: #241f18;
  --muted: #8a8071;
  --muted-strong: #5c5347;

  --orange: #e0722c;
  --orange-strong: #c1601f;
  --orange-soft: rgba(224, 114, 44, 0.10);
  --orange-soft-strong: rgba(224, 114, 44, 0.18);
  --orange-glow: rgba(224, 114, 44, 0.22);

  --blue: #386bc4;
  --blue-soft: rgba(56, 107, 196, 0.10);
  --teal: #16825d;
  --teal-soft: rgba(22, 130, 93, 0.10);
  --amber: #a56513;
  --amber-soft: rgba(165, 101, 19, 0.12);
  --red: #b5392f;
  --red-soft: rgba(181, 57, 47, 0.10);
  --purple: #7a4cc4;
  --purple-soft: rgba(122, 76, 196, 0.10);

  --shadow-sm: 0 1px 2px rgba(40, 28, 12, 0.05);
  --shadow-md: 0 10px 28px rgba(40, 28, 12, 0.07);
  --shadow-lg: 0 18px 44px rgba(40, 28, 12, 0.10);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --input-height: 42px;
  --sidebar-width: 252px;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

h1 {
  color: var(--text);
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--orange-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

small {
  color: var(--muted);
}

/* ==========================================================================
   App shell layout
   ========================================================================== */

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  display: flex;
  flex: 0 0 var(--sidebar-width);
  flex-direction: column;
  gap: 18px;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 10px;
}

.brand-mark {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--orange);
}

.brand-mark-icon {
  width: 26px;
  height: 26px;
}

.brand-mark--lg {
  width: 44px;
  height: 44px;
}

.brand-mark--lg .brand-mark-icon {
  width: 34px;
  height: 34px;
}

.auth-brand {
  display: flex;
  margin-bottom: 14px;
}

.brand-name {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-button,
.nav-button-static {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-strong);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.nav-icon {
  flex-shrink: 0;
  color: currentColor;
}

.nav-button:hover {
  background: var(--surface-strong);
  color: var(--text);
  transform: none;
}

.nav-button.active {
  border-color: var(--orange-soft-strong);
  background: var(--orange-soft);
  color: var(--orange-strong);
}

.nav-button-static {
  cursor: default;
  opacity: 0.55;
}

.nav-button-static[disabled] {
  cursor: not-allowed;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
}

.account-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.account-email-row {
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.account-panel strong {
  color: var(--text);
}

#logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(181, 57, 47, 0.28);
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

#logout-button:hover {
  border-color: var(--red);
  background: rgba(181, 57, 47, 0.16);
}

.version-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(36, 31, 24, 0.32);
}

.app-main {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
}

/* ==========================================================================
   Topbar: global search + Czernex AI shell
   ========================================================================== */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.global-search-wrapper {
  flex: 1 1 260px;
  min-width: 0;
}

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--input-height);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  color: var(--muted-strong);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.topbar-search:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
  background: var(--surface);
}

.topbar-search-icon {
  flex-shrink: 0;
  color: var(--muted);
}

.global-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.global-search-input:focus {
  outline: none;
  box-shadow: none;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 2px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.global-search-section-heading {
  margin: 6px 8px 2px;
  color: var(--orange-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.global-search-section-heading:first-child {
  margin-top: 2px;
}

.global-search-result {
  display: grid;
  gap: 2px;
  min-height: auto;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 400;
}

.global-search-result strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.global-search-result span {
  color: var(--muted);
  font-size: 12px;
}

.global-search-result:hover,
.global-search-result.is-highlighted {
  background: var(--surface-strong);
  transform: none;
}

.global-search-loading,
.global-search-footer {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.global-search-empty {
  display: grid;
  gap: 6px;
  padding: 14px 10px;
  text-align: center;
}

.global-search-empty strong {
  color: var(--text);
  font-size: 14px;
}

.global-search-empty span {
  color: var(--muted);
  font-size: 13px;
}

.global-search-empty button {
  justify-self: center;
}

.czernex-ai-bar {
  position: relative;
  display: flex;
  flex: 1 1 340px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 8px 0 16px;
  border: 1px solid var(--orange-soft-strong);
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--orange-soft) 0%, rgba(255, 255, 255, 0) 65%), var(--surface);
  box-shadow: 0 0 0 4px var(--orange-glow), var(--shadow-sm);
  transition: box-shadow 0.16s ease, border-color 0.16s ease;
}

.czernex-ai-bar:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 5px var(--orange-glow), var(--shadow-md);
}

.czernex-ai-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--orange-strong);
}

.czernex-ai-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}

.czernex-ai-input::placeholder {
  color: var(--muted);
  font-weight: 500;
}

.czernex-ai-input:focus {
  outline: none;
  box-shadow: none;
}

.czernex-ai-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(155deg, var(--orange) 0%, #f2a25f 100%);
  color: #fff;
}

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

.czernex-ai-preview {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--orange-soft-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-weight: 400;
}

.czernex-ai-preview-status {
  color: var(--muted-strong);
  font-size: 13px;
}

.czernex-ai-preview-status.is-error {
  color: var(--red);
}

.czernex-ai-preview-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}

.czernex-ai-preview-field dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.czernex-ai-preview-field dd {
  margin-top: 2px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.czernex-ai-preview-summary {
  color: var(--muted-strong);
  font-size: 13px;
  font-style: italic;
}

.czernex-ai-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==========================================================================
   Shared inputs, selects, buttons
   ========================================================================== */

form {
  display: grid;
  gap: 14px;
}

#lead-form {
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input {
  min-height: var(--input-height);
  padding: 11px 12px;
  font-size: 14px;
}

select {
  min-height: var(--input-height);
  padding: 10px 12px;
  font-size: 14px;
}

textarea {
  padding: 11px 12px;
}

input::placeholder {
  color: var(--muted);
  opacity: 1;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
}

button {
  min-height: 38px;
  margin-top: 0;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--orange);
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

button:hover {
  background: var(--orange-strong);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

#lead-form button[type="submit"],
.auth-form button[type="submit"] {
  background: var(--orange);
  color: #ffffff;
}

#form-message {
  min-height: 20px;
  color: var(--teal);
  font-size: 14px;
}

/* ==========================================================================
   Cards / panels
   ========================================================================== */

.dashboard {
  max-width: 1400px;
  padding: 24px 28px 40px;
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-heading {
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

#lead-count {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.lead-card {
  min-width: 0;
  display: grid;
  gap: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.lead-card:hover {
  border-color: var(--border-strong);
}

.lead-card.target-lead {
  border-color: var(--orange-soft-strong);
  box-shadow: 0 0 0 3px var(--orange-soft);
}

.lead-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.lead-card h3 {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.3;
}

.lead-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ==========================================================================
   Badges / status badges / score presentation
   ========================================================================== */

.badge-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.badge,
.score-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.badge {
  background: var(--surface-strong);
  color: var(--muted-strong);
  text-transform: uppercase;
}

.status-new {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  color: var(--muted-strong);
}

.status-analyzed {
  border-color: rgba(56, 107, 196, 0.32);
  background: var(--blue-soft);
  color: var(--blue);
}

.status-ready {
  border-color: rgba(22, 130, 93, 0.32);
  background: var(--teal-soft);
  color: var(--teal);
}

.status-contacted {
  border-color: rgba(165, 101, 19, 0.34);
  background: var(--amber-soft);
  color: var(--amber);
}

.status-replied {
  border-color: rgba(122, 76, 196, 0.32);
  background: var(--purple-soft);
  color: var(--purple);
}

.score-badge {
  border-color: rgba(56, 107, 196, 0.30);
  background: var(--blue-soft);
  color: var(--blue);
}

.potential-score-badge {
  border-color: var(--orange-soft-strong);
  background: var(--orange-soft);
  color: var(--orange-strong);
}

.fit-score-badge {
  border-color: rgba(165, 101, 19, 0.30);
  background: var(--amber-soft);
  color: var(--amber);
}

.confidence-score-badge {
  border-color: rgba(22, 130, 93, 0.30);
  background: var(--teal-soft);
  color: var(--teal);
}

.score-badge-missing {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  color: var(--muted);
}

.score-fallback-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted-strong);
}

.lead-contact {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.5;
}

.lead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   Buttons: secondary / text / semantic action buttons
   ========================================================================== */

.text-button,
.secondary-button,
.ai-button,
.message-button,
.contact-button,
.copy-button {
  min-height: 36px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 800;
}

.text-button,
.secondary-button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted-strong);
}

.text-button:hover,
.secondary-button:hover {
  border-color: var(--orange);
  color: var(--orange-strong);
  background: var(--orange-soft);
}

.edit-button {
  color: var(--blue);
}

.delete-button {
  border-color: rgba(181, 57, 47, 0.28);
  background: var(--red-soft);
  color: var(--red);
}

.delete-button:hover {
  border-color: var(--red);
  background: rgba(181, 57, 47, 0.16);
  color: var(--red);
}

.ai-button {
  align-self: flex-start;
  margin-top: 14px;
  border: 1px solid var(--orange-soft-strong);
  background: var(--orange-soft);
  color: var(--orange-strong);
}

.ai-button:hover {
  border-color: var(--orange);
  background: var(--orange-soft-strong);
}

.message-button {
  align-self: flex-start;
  margin-top: 12px;
  border: 1px solid rgba(56, 107, 196, 0.30);
  background: var(--blue-soft);
  color: var(--blue);
}

.message-button:hover {
  border-color: var(--blue);
  background: rgba(56, 107, 196, 0.16);
}

.copy-button {
  margin-top: 12px;
  border: 1px solid rgba(22, 130, 93, 0.32);
  background: var(--teal);
  color: #ffffff;
}

.contact-button {
  align-self: flex-start;
  margin-top: 0;
  border: 1px solid var(--orange-soft-strong);
  background: var(--orange);
  color: #ffffff;
}

.contact-button:hover {
  background: var(--orange-strong);
}

/* ==========================================================================
   Discovery / Companies / Messages shared view layout
   ========================================================================== */

.discovery-view,
.companies-view,
.messages-view,
.dashboard-view,
.settings-view {
  max-width: 1400px;
  padding: 24px 28px 40px;
}

.discovery-panel,
.companies-panel,
.messages-panel {
  display: grid;
  gap: 18px;
}

.discovery-search-panel,
.messages-toolbar,
.companies-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.messages-toolbar label,
.companies-toolbar label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

#messages-count,
#companies-count {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.discovery-search-field {
  position: relative;
  min-width: 0;
}

.discovery-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: grid;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.discovery-suggestion-option {
  width: 100%;
  min-height: 36px;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
  text-align: left;
}

.discovery-suggestion-option:hover,
.discovery-suggestion-option.active {
  background: var(--orange-soft);
  color: var(--orange-strong);
  transform: none;
}

.discovery-filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.discovery-filter-bar label,
.discovery-more-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

.discovery-more-filters {
  padding-top: 6px;
}

.discovery-more-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.discovery-status {
  min-height: 22px;
  color: var(--muted-strong);
  font-size: 14px;
}

.discovery-status.loading {
  color: var(--blue);
}

.discovery-status.success {
  color: var(--teal);
}

.discovery-status.error {
  color: var(--red);
}

.discovery-results {
  display: grid;
  gap: 12px;
}

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

.discovery-card,
.message-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.message-card h3 {
  color: var(--text);
  font-size: 20px;
  margin-bottom: 6px;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.messages-message {
  margin-top: 0;
}

.message-updated-at {
  color: var(--muted);
  font-size: 12px;
}

/* ==========================================================================
   Wiadomości 1.0 (ROUND C6) - workspace layout, list rows, detail extras
   ========================================================================== */

.messages-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 2px;
}

.messages-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 35%) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.message-row {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.message-row:hover {
  border-color: var(--orange-soft-strong);
  background: var(--orange-soft);
  transform: none;
}

.message-row.active {
  border-color: var(--orange);
  background: var(--orange-soft);
  box-shadow: 0 0 0 2px var(--orange-soft);
}

.message-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.message-row-top h3 {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.message-row-preview {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.message-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 11px;
}

.messages-detail {
  min-width: 0;
}

.message-score-block {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-context-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.message-context-block h4 {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.message-context-block p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.message-facts {
  border-left: 3px solid var(--teal);
}

.message-inference {
  border-left: 3px solid var(--amber);
}

.messages-back-to-list {
  display: none;
  align-self: flex-start;
  margin-bottom: 8px;
}

.message-editor-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.message-char-counter {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.message-char-counter.over-limit {
  color: var(--red);
  font-weight: 800;
}

.discovery-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.discovery-card h3 {
  color: var(--text);
  font-size: 20px;
  margin-bottom: 6px;
}

.discovery-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.discovery-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.discovery-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
}

.discovery-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  color: var(--muted-strong);
}

.discovery-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.discovery-add-button {
  background: var(--teal);
  color: #ffffff;
}

.discovery-in-leads-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid rgba(22, 130, 93, 0.32);
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 14px;
  font-weight: 800;
}

.discovery-note {
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
}

/* ==========================================================================
   Discovery 1.0 (ROUND C3)
   ========================================================================== */

.discovery-subtitle {
  max-width: 640px;
  margin-top: 8px;
  color: var(--muted-strong);
  line-height: 1.55;
}

.discovery-subtitle-muted {
  color: var(--muted);
  font-size: 13px;
}

.discovery-search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

#discovery-search-input,
#company-directory-search,
#lead-search {
  padding-left: 40px;
}

.companies-summary-grid {
  margin-bottom: 2px;
}

.leads-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 2px;
}

.lead-primary-action {
  align-self: flex-start;
  margin-top: 12px;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.company-lead-link {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.company-lead-link strong {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.company-lead-link p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.discovery-active-criteria {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.discovery-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 6px 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

.discovery-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.discovery-chip-remove:hover {
  background: var(--border);
  color: var(--text);
  transform: none;
}

.discovery-results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
}

.discovery-source-breakdown {
  color: var(--muted);
  font-size: 13px;
}

.discovery-source-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.discovery-skeleton-card {
  height: 132px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(
    100deg,
    var(--surface-soft) 30%,
    var(--surface-strong) 50%,
    var(--surface-soft) 70%
  );
  background-size: 200% 100%;
  animation: discovery-skeleton-shimmer 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .discovery-skeleton-card {
    animation: none;
  }
}

@keyframes discovery-skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ==========================================================================
   Empty / loading / error presentation
   ========================================================================== */

.empty-state {
  display: grid;
  gap: 8px;
  padding: 36px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--muted-strong);
  font-size: 15px;
}

.empty-state span {
  line-height: 1.6;
}

.error-state {
  color: var(--red);
}

/* ==========================================================================
   Dashboard 1.0
   ========================================================================== */

.dashboard-grid-outer {
  display: grid;
  gap: 20px;
}

.dashboard-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-stat-card {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.dashboard-stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dashboard-stat-value {
  margin-top: 8px;
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.dashboard-section-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.dashboard-panel {
  display: grid;
  gap: 14px;
}

.dashboard-attention-list,
.dashboard-companies-list,
.dashboard-activity-list {
  display: grid;
  gap: 10px;
}

.dashboard-row-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.dashboard-row-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 12px;
}

.dashboard-row-top h3 {
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
}

.dashboard-score-group {
  justify-content: flex-start;
}

.dashboard-row-actions {
  display: flex;
  justify-content: flex-end;
}

.dashboard-panel-action {
  justify-self: start;
}

.dashboard-activity-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 13px;
}

.dashboard-activity-time {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.dashboard-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* ==========================================================================
   Settings
   ========================================================================== */

.settings-view {
  display: grid;
  gap: 20px;
}

.settings-panel-heading {
  padding: 20px 24px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.settings-panel {
  display: grid;
  gap: 16px;
}

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

.settings-info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.settings-info-row dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.settings-info-row dd {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}

.settings-form {
  display: grid;
  gap: 10px;
}

.settings-form label {
  margin-top: 6px;
  color: var(--muted-strong);
  font-size: 14px;
}

.settings-form small {
  color: var(--muted);
}

.password-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-field input {
  flex: 1 1 auto;
  min-width: 0;
}

.password-toggle {
  flex: 0 0 auto;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--orange-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.password-toggle:hover {
  background: transparent;
  color: var(--orange);
  transform: none;
}

.settings-hint {
  margin: -2px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.settings-hint strong {
  display: block;
  margin-bottom: 2px;
  color: var(--muted-strong);
  font-size: 12px;
}

/* ==========================================================================
   AI analysis / generated message / source metadata
   ========================================================================== */

.ai-analysis,
.generated-message,
.source-metadata {
  position: relative;
  margin-top: 13px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

.ai-analysis {
  background: var(--teal-soft);
  color: var(--muted-strong);
  white-space: pre-wrap;
}

.ai-analysis::before,
.generated-message::before {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ai-analysis::before {
  content: "Analiza AI";
  color: var(--teal);
}

.ai-analysis.is-collapsed {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
}

.source-metadata {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--blue-soft);
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.45;
}

.source-metadata p {
  margin: 0;
}

.source-metadata-label {
  color: var(--blue);
  font-weight: 800;
}

.source-metadata-title {
  color: var(--text);
  font-weight: 700;
}

.source-metadata-row,
.source-metadata a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.source-metadata a {
  color: var(--teal);
}

.source-metadata-warning {
  color: var(--amber);
}

.analysis-toggle {
  align-self: flex-start;
  margin-top: 8px;
  border-color: transparent;
  background: transparent;
  color: var(--teal);
}

.generated-message {
  background: var(--blue-soft);
}

.generated-message::before {
  content: "Wiadomość";
  color: var(--blue);
}

.generated-message p {
  margin: 0;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
}

.message-editor {
  min-height: 140px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
  resize: vertical;
}

.message-edit-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.inline-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.inline-edit-form label {
  gap: 6px;
  font-size: 12px;
}

.inline-edit-form input {
  padding: 10px 11px;
  font-size: 14px;
}

.edit-controls {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-controls button[type="submit"] {
  margin: 0;
}

/* ==========================================================================
   Pipeline filters
   ========================================================================== */

.lead-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.filter-button span {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  color: var(--muted-strong);
  text-align: center;
  font-size: 11px;
}

.filter-button:hover {
  border-color: var(--orange);
  color: var(--orange-strong);
}

.filter-button.active {
  border-color: var(--orange-soft-strong);
  background: var(--orange-soft);
  color: var(--orange-strong);
}

.filter-button.active span {
  background: var(--orange-soft-strong);
  color: var(--orange-strong);
}

/* ==========================================================================
   Landing page (logged-out): navbar, hero, login card, feature preview
   ========================================================================== */

body.auth-required > :not(#auth-view):not(script) {
  display: none !important;
}

.auth-view {
  min-height: 100vh;
  background: var(--bg);
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.landing-nav-brand {
  margin-bottom: 0;
  align-items: center;
  gap: 10px;
}

.landing-nav-brand h1 {
  font-size: 19px;
  font-weight: 800;
}

.landing-nav-toggle {
  display: none;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.landing-nav-toggle:hover {
  background: var(--surface-strong);
  transform: none;
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
}

.landing-nav-links a {
  color: var(--muted-strong);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.landing-nav-links a:hover {
  color: var(--text);
}

.landing-nav-cta {
  min-height: 38px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: #ffffff;
}

.landing-nav-cta:hover {
  background: #000000;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: start;
  gap: 48px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 64px 40px 56px;
}

.landing-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.landing-hero-headline {
  color: var(--text);
  font-size: 44px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.landing-hero-description {
  max-width: 56ch;
  color: var(--muted-strong);
  font-size: 16px;
  line-height: 1.6;
}

.landing-benefits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  list-style: none;
}

.landing-benefits li {
  position: relative;
  padding-left: 26px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.landing-benefits li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--orange-soft);
  color: var(--orange-strong);
  font-size: 11px;
  font-weight: 800;
}

.landing-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.btn-cta-primary,
.btn-cta-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

.btn-cta-primary {
  border: 1px solid transparent;
  background: linear-gradient(155deg, var(--orange) 0%, #f2a25f 100%);
  color: #ffffff;
}

.btn-cta-primary:hover {
  background: var(--orange-strong);
}

.btn-cta-secondary {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-cta-secondary:hover {
  background: var(--surface-strong);
}

.auth-card {
  width: 100%;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.auth-card-title {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

.auth-card-intro {
  margin: 0 0 20px;
  color: var(--muted-strong);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  margin-top: 6px;
  color: var(--muted-strong);
  font-size: 14px;
}

.auth-form small {
  color: var(--muted);
}

.auth-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 600;
}

.auth-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
}

.auth-link {
  min-height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--orange-strong);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-link:hover {
  background: transparent;
  color: var(--orange);
  transform: none;
}

.auth-switch {
  margin: 14px 0 0;
  color: var(--muted-strong);
  font-size: 14px;
  text-align: center;
}

.auth-switch .auth-link {
  font-size: 14px;
}

.auth-demo-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.auth-message {
  min-height: 22px;
  margin: 4px 0 0;
  font-size: 14px;
}

.auth-message.error {
  color: var(--red);
}

.auth-message.success {
  color: var(--teal);
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px 64px;
}

.landing-feature-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.landing-feature-card h3 {
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 16px;
  font-weight: 800;
}

.landing-feature-card p {
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.5;
}

.landing-showcase {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 40px 80px;
  text-align: center;
}

.landing-showcase-title {
  margin-bottom: 14px;
  font-size: 30px;
  font-weight: 800;
}

.landing-showcase-description {
  color: var(--muted-strong);
  font-size: 15px;
  line-height: 1.6;
}

/* ==========================================================================
   Responsive: desktop ~1440px / tablet ~820px / mobile ~390px
   ========================================================================== */

@media (max-width: 960px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.sidebar-open .sidebar-overlay {
    display: block;
  }

  .app-main {
    width: 100%;
  }

  .topbar {
    padding: 16px 20px 16px 64px;
  }

  .dashboard {
    grid-template-columns: 1fr;
    padding: 20px 20px 32px;
  }

  .discovery-view,
  .companies-view,
  .messages-view,
  .dashboard-view,
  .settings-view {
    padding: 20px 20px 32px;
  }

  .messages-toolbar,
  .companies-toolbar,
  .discovery-search-panel {
    grid-template-columns: 1fr;
  }

  .discovery-filter-bar,
  .discovery-more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

  .messages-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .landing-nav {
    padding: 16px 20px;
  }

  .landing-nav-toggle {
    display: inline-flex;
  }

  .landing-nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 20px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
  }

  .landing-nav-links.is-open {
    display: flex;
  }

  .landing-nav-links a {
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
  }

  .landing-nav-links a:last-child {
    border-bottom: 0;
  }

  .landing-nav-cta {
    text-align: center;
  }

  .landing-nav {
    position: relative;
  }

  .landing-hero {
    grid-template-columns: 1fr;
    padding: 40px 20px 40px;
  }

  .landing-hero-headline {
    font-size: 34px;
  }

  .landing-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 20px 48px;
  }

  .landing-showcase {
    padding: 0 20px 56px;
  }
}

@media (max-width: 700px) {
  .messages-workspace {
    grid-template-columns: 1fr;
  }

  .messages-back-to-list {
    display: inline-flex !important;
  }

  .messages-workspace.is-showing-detail .messages-list {
    display: none;
  }

  .messages-workspace:not(.is-showing-detail) .messages-detail {
    display: none;
  }

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

  /* In a column-direction flex container, `flex-basis` sizes the main axis,
     which is now height, not width - the wide-screen "flex: 1 1 340px"/
     "flex: 1 1 260px" basis values would otherwise stretch both bars (and
     anything absolutely positioned against them, like the Global Search and
     Czernex AI preview panels) to hundreds of pixels tall. */
  .global-search-wrapper,
  .czernex-ai-bar {
    flex: 0 0 auto;
  }

  .czernex-ai-bar {
    min-height: 44px;
  }

  h1 {
    font-size: 28px;
  }

  .panel {
    padding: 16px;
  }

  .panel-heading,
  .lead-card-top {
    flex-direction: column;
  }

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

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

  .edit-controls {
    grid-column: auto;
  }

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

  .settings-info-row {
    flex-direction: column;
    gap: 2px;
  }

  .settings-info-row dd {
    text-align: left;
  }

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

  .discovery-filter-bar,
  .discovery-more-grid {
    grid-template-columns: 1fr;
  }

  .landing-benefits {
    grid-template-columns: 1fr;
  }

  .landing-hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .landing-features {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 14px 14px 14px 58px;
  }

  .dashboard,
  .discovery-view,
  .companies-view,
  .messages-view,
  .dashboard-view,
  .settings-view {
    padding: 16px 14px 28px;
  }

  .auth-card {
    padding: 22px;
  }

  .landing-nav {
    padding: 14px 16px;
  }

  .landing-nav-brand h1 {
    font-size: 17px;
  }

  .landing-hero {
    padding: 32px 16px 32px;
  }

  .landing-hero-headline {
    font-size: 28px;
  }

  .landing-hero-description {
    font-size: 14px;
  }

  .auth-form-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
