:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: .72rem 1rem;
  background: #111827;
  color: white;
  font-weight: 700;
}
button:disabled { opacity: .55; cursor: wait; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: .72rem .8rem;
  background: white;
}
textarea {
  line-height: 1.4;
  resize: vertical;
}
.auto-grow-textarea {
  min-height: 3rem;
  max-height: 12rem;
  overflow-y: auto;
}

.shell { width: min(980px, calc(100% - 24px)); margin: 0 auto; padding: 28px 0 64px; }
.hero { margin-bottom: 22px; }
.hero h1 { margin: 0; font-size: clamp(2rem, 7vw, 4rem); letter-spacing: -.05em; }
.hero p { margin: .4rem 0 0; color: #4b5563; font-size: 1.05rem; }

.panel {
  min-width: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 18px;
  margin: 14px 0;
  box-shadow: 0 8px 24px rgb(17 24 39 / .05);
}
.panel--attention {
  border: 2px solid #c96a00;
  background: #fffaf2;
  box-shadow: 0 0 0 3px rgb(201 106 0 / .10), 0 8px 24px rgb(17 24 39 / .05);
}
.panel--attention .disclosure > summary { color: #9a4500; }

.disclosure,
.disclosure__content { min-width: 0; }
.disclosure > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  font-size: 1.35rem;
  font-weight: 800;
  user-select: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after {
  content: "⌄";
  flex: 0 0 auto;
  font-size: 1.1em;
  line-height: 1;
  transition: transform .18s ease;
}
.disclosure[open] > summary::after { transform: rotate(180deg); }
.disclosure__content { padding-top: 16px; }

.create-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.create-form__field {
  display: grid;
  min-width: 0;
  gap: 6px;
}
.create-form__field--wide,
.create-form__wide { grid-column: 1 / -1; }
.create-form__label {
  color: #374151;
  font-size: .88rem;
  font-weight: 800;
}
.create-form__hint {
  color: #6b7280;
  font-size: .78rem;
  line-height: 1.35;
}
.create-form button { grid-column: 1 / -1; }

.lead-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-height: min(58vh, 36rem);
  overflow-y: auto;
  overscroll-behavior-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
.lead-card {
  min-width: 0;
  max-width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  background: #fafafa;
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}
.lead-card--action { border-color: #f59e0b; background: #fffbeb; }
.lead-card--paused { border-color: #e3b341; background: #fffdf2; }
.lead-card--closed { background: #f9fafb; }
.lead-card__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.lead-card__heading > * { min-width: 0; }
.lead-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lead-badge {
  display: inline-block;
  padding: .18rem .45rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  vertical-align: middle;
}
.lead-badge--paused {
  border: 1px solid #e3b341;
  background: #fff3cd;
  color: #7a4b00;
}
.lead-badge--reopened {
  border: 1px solid #94a3b8;
  background: #f1f5f9;
  color: #334155;
}
.reason,
.lead-details,
.lead-history {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}
.reason { margin: 0; color: #6b7280; font-size: .92rem; }
.reason--action { color: #92400e; font-weight: 700; }
.lead-details { margin: .45rem 0 0; color: #6b7280; font-size: .88rem; }
.lead-history {
  margin: .45rem 0 0;
  padding: .5rem .6rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: .84rem;
}
.lead-card__state-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.lead-card__actions { margin-top: 10px; min-width: 0; }
.lead-card__actions > summary {
  cursor: pointer;
  color: #374151;
  font-weight: 800;
  overflow-wrap: anywhere;
  user-select: none;
}
.lead-card__actions-content { padding-top: 8px; min-width: 0; }
.action-row--close { border-top: 1px solid #e5e7eb; padding-top: 10px; }
.action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 8px;
  min-width: 0;
  margin-top: 10px;
}
.list-pagination {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.list-pagination__status {
  color: #6b7280;
  font-size: .86rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.empty, .status { color: #6b7280; }
.status { text-align: center; font-size: .85rem; margin-top: 18px; }

.backup-panel h2 { margin: 0 0 12px; font-size: 1.2rem; }
.helper { color: #6b7280; margin: 0 0 12px; }
.backup-reminder { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #f3f4f6; color: #4b5563; font-size: .92rem; }
.backup-reminder--due { background: #fffbeb; color: #92400e; font-weight: 700; border: 1px solid #f59e0b; }
.backup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}
.backup-name-field {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.backup-name-field > span { color: #374151; font-weight: 700; font-size: .9rem; }
.file-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: .72rem 1rem;
  background: white;
  color: #111827;
  font-weight: 700;
  cursor: pointer;
}
.backup-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-name { color: #6b7280; font-size: .88rem; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .create-form, .action-row, .backup-actions, .lead-card__state-actions { grid-template-columns: 1fr; }
  .lead-card__heading { display: block; }
  .reason { margin-top: .35rem; }
  button { width: 100%; }
  .disclosure > summary { font-size: 1.45rem; }
  .lead-list { max-height: 58vh; }
  .list-pagination { grid-template-columns: 1fr 1fr; }
  .list-pagination__status { grid-column: 1 / -1; grid-row: 1; }
}
