:root {
  color-scheme: light;
  --bg: #f4f6f4;
  --panel: #ffffff;
  --ink: #18211d;
  --muted: #657168;
  --line: #cdd6cf;
  --accent: #1d6f83;
  --accent-dark: #145263;
  --warn: #8f211d;
  --ok: #1d6f3e;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.header {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  color: var(--accent);
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 4px;
}

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

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

h2 {
  font-size: 17px;
}

.status {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 9px 12px;
  white-space: nowrap;
}

.status.ok {
  border-color: #9ccba7;
  color: var(--ok);
}

.status.warn {
  border-color: #d8aaa7;
  color: var(--warn);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}

.sectionTitle {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 16px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 16px;
}

label {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
}

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 111, 131, 0.12);
  outline: none;
}

.tableWrap {
  overflow-x: auto;
}

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

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

th {
  background: #eef3ef;
  color: #2a352f;
  font-size: 13px;
}

th:nth-child(1),
td:nth-child(1) {
  width: 138px;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4) {
  width: 118px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 56px;
}

td input {
  min-height: 38px;
}

.remove {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--warn);
  cursor: pointer;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.remove:hover {
  border-color: #e3bbb9;
  background: #fff4f3;
}

.totals {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  padding: 12px 16px;
}

.totals span {
  color: var(--muted);
}

.totals strong {
  color: var(--ink);
  margin-left: 6px;
}

.sendGrid label:last-child {
  grid-column: 1 / -1;
}

.recipientField {
  display: grid;
  gap: 8px;
}

.checkboxLine {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
  min-height: 24px;
}

.checkboxLine input {
  min-height: 0;
  width: auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 750;
  min-height: 42px;
  padding: 0 16px;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary {
  background: var(--accent);
  color: #fff;
}

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

.secondary,
.iconText {
  background: #e6ece8;
  color: #20312a;
}

.secondary:hover,
.iconText:hover {
  background: #d9e3dd;
}

.messages {
  margin-top: 16px;
}

.message {
  border-radius: 8px;
  margin-top: 8px;
  padding: 12px 14px;
}

.message.error {
  background: #fff1f0;
  border: 1px solid #e2aaa7;
  color: var(--warn);
}

.message.success {
  background: #eff9f1;
  border: 1px solid #a8d6af;
  color: var(--ok);
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 20px, 1120px);
    margin-top: 18px;
  }

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

  .status {
    white-space: normal;
  }

  .actions {
    display: grid;
  }
}

.loginPage {
  min-height: 100vh;
}

.loginShell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 20px;
  place-items: center;
}

.loginPanel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  max-width: 380px;
  padding: 24px;
  width: 100%;
}

.loginPanel h1 {
  font-size: 28px;
}

.loginLogo {
  height: auto;
  width: 170px;
}

.loginError {
  background: #fff1f0;
  border: 1px solid #e2aaa7;
  border-radius: 8px;
  color: var(--warn);
  display: none;
  margin: 0;
  padding: 10px 12px;
}
