:root {
  --bg: #faf8f4;
  --ink: #1a1a18;
  --muted: #6b6a64;
  --line: #e6e1d6;
  --accent: #c47a2c;
  --accent-soft: #f3e4d2;
  --sent: #6b6a64;
  --replied: #2f6fed;
  --queued: #c47a2c;
  --interested: #2f7a4b;
  --font: "IBM Plex Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.mark {
  width: 18px;
  height: 16px;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 8px / 4px 8px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 7px 4px / 4px 12px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 14px 0 / 4px 16px no-repeat;
}

.brand strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.tag {
  color: var(--muted);
  font-size: 0.85rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.linkish {
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.linkish:hover {
  color: var(--accent);
}

.sep {
  opacity: 0.45;
}

.layout {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 2rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

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

.title-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 1.85rem;
  letter-spacing: -0.03em;
  font-weight: 650;
}

.mode-badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.stats {
  margin: 0.55rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.table-wrap {
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.75rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 0.85rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.empty {
  color: var(--muted);
  padding: 1.5rem 0.4rem !important;
}

.status {
  font-weight: 600;
  font-size: 0.88rem;
}
.status.sent {
  color: var(--sent);
}
.status.replied {
  color: var(--replied);
}
.status.queued {
  color: var(--queued);
}
.status.interested,
.status.converted {
  color: var(--interested);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
  align-items: end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.field-grow {
  flex: 1;
  min-width: 12rem;
}
.field select,
.field input {
  font: inherit;
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  min-width: 11rem;
}
.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.filter {
  font: inherit;
  font-size: 0.82rem;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
}
.filter.active,
.filter:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--accent-soft);
}

.status-select {
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  color: var(--ink);
  max-width: 11rem;
}

a.phone {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}
a.phone:hover {
  color: var(--accent);
}

.side-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.side h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.step {
  margin-bottom: 1.1rem;
}

.step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.bubble {
  background: #f1eee7;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #2a2a26;
}

.bubble .var {
  color: var(--accent);
  font-weight: 600;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  display: inline-block;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle span {
  position: absolute;
  inset: 0;
  background: #d9d3c6;
  border-radius: 999px;
  transition: 0.15s;
}
.toggle span::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.15s;
}
.toggle input:checked + span {
  background: var(--accent);
}
.toggle input:checked + span::after {
  transform: translateX(18px);
}

.window {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 1.25rem 0 1rem;
}
.window strong {
  color: var(--ink);
  font-weight: 600;
}
.clock {
  color: var(--accent);
}
.live {
  font-size: 0.78rem;
  margin-left: 0.25rem;
}
.live.open {
  color: var(--interested);
}
.live.closed {
  color: var(--queued);
}

.btn-primary {
  width: 100%;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  cursor: pointer;
}
.btn-primary:hover {
  filter: brightness(0.96);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  width: 100%;
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  background: transparent;
  font: inherit;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  min-height: 1.2em;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  background: #fff;
  width: min(360px, 92vw);
}
dialog::backdrop {
  background: rgba(26, 26, 24, 0.35);
}
dialog h3 {
  margin: 0 0 0.75rem;
}
dialog label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}
dialog input {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}
.dialog-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.dialog-actions .btn-primary,
.dialog-actions .btn-ghost {
  width: auto;
  flex: 1;
  margin: 0;
}
