:root {
  --bg: #f6f6f6;
  --panel: #ffffff;
  --border: #d6d6d6;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #b91c1c;
  --accent-dark: #991b1b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  padding: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
}

label.full {
  grid-column: 1 / -1;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.75rem;
  background: #fff;
}

textarea {
  resize: vertical;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 0.95rem;
  border-radius: 8px;
  cursor: pointer;
}

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

button.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

button.secondary:hover {
  background: #f3f4f6;
}

.hidden {
  display: none !important;
}

.attachments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.attachment-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  background: #fafafa;
}

.attachment-box h3 {
  margin-top: 0;
  font-size: 1rem;
}

.preview-wrap {
  margin-top: 0.75rem;
}

.preview-wrap img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 0.6rem;
}

.audio-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.small {
  font-size: 0.9rem;
  color: var(--muted);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.list-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.lead-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lead-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  background: #fff;
}

.lead-company {
  font-weight: bold;
}

.lead-contact,
.lead-meta {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.lead-item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-self: flex-start;
}

audio {
  width: 100%;
  margin-top: 0.75rem;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

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