:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --ink: #1f2933;
  --muted: #637083;
  --line: #d9dfd7;
  --panel: #ffffff;
  --accent: #0f8f73;
  --accent-strong: #08705c;
  --warning: #b45309;
  --danger: #b42318;
  --ok: #0f766e;
  --shadow: 0 18px 50px rgba(31, 41, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  min-height: 100vh;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: #fffaf1;
  border-right: 1px solid var(--line);
  padding: 28px;
}

.brand-row,
.contacts-toolbar,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
}

.status-pill,
.summary,
.result-box {
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  min-width: 74px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.65);
}

.composer-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

input[type="file"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

input[type="file"] {
  padding: 11px;
}

textarea {
  min-height: 180px;
  resize: vertical;
  padding: 14px;
  line-height: 1.5;
}

input[type="file"]:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 143, 115, 0.22);
  outline-offset: 2px;
}

.photo-preview {
  min-height: 124px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-position: center;
  background-size: cover;
}

.photo-note {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.primary-button,
.icon-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary-button {
  min-height: 46px;
  flex: 1;
  gap: 9px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

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

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-button {
  width: 46px;
  height: 46px;
  background: #e7efe7;
  color: var(--ink);
}

.icon-button:hover {
  background: #dce8dd;
}

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

.mini-button {
  min-height: 34px;
  gap: 7px;
  padding: 0 11px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.mini-button.secondary {
  width: 34px;
  padding: 0;
  background: #e7efe7;
  color: var(--ink);
}

.mini-button:hover {
  background: var(--accent-strong);
}

.mini-button.opened-button {
  background: #6f7f3f;
}

.mini-button.opened-button:hover {
  background: #5f6d35;
}

.mini-button.secondary:hover {
  background: #dce8dd;
}

.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.contacts-area {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 28px;
  min-width: 0;
}

.batch-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px 16px;
}

.batch-panel strong,
.batch-panel span {
  display: block;
}

.batch-panel strong {
  margin-bottom: 3px;
  font-size: 16px;
}

.batch-panel span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  width: 58px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf3ee;
  color: #344052;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  overflow-wrap: anywhere;
  color: #2b3545;
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.empty-row td {
  height: 160px;
  color: var(--muted);
  text-align: center;
}

.batch-row td {
  background: #f6f8f3;
  color: #344052;
  font-size: 13px;
  font-weight: 850;
}

.batch-row span {
  margin-left: 8px;
  color: var(--accent-strong);
}

.locked-row {
  opacity: 0.58;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.badge.sent {
  background: #dff7ef;
  color: var(--ok);
}

.badge.opened,
.badge.copied {
  background: #dff7ef;
  color: var(--ok);
}

.badge.failed {
  background: #fde8e5;
  color: var(--danger);
}

.badge.pending {
  background: #fff3d6;
  color: var(--warning);
}

.badge.locked {
  background: #eef2f7;
  color: var(--muted);
}

.result-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px 16px;
}

.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .composer {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .contacts-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .batch-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .composer,
  .contacts-area {
    padding: 18px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 19px;
  }

  th,
  td {
    padding: 12px 10px;
  }
}
