:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #dfe3ea;
  --text: #20242c;
  --muted: #6d7480;
  --accent: #265f55;
  --accent-strong: #17473f;
  --warn: #9f5d05;
  --error: #b42318;
  --ok: #126b3a;
  --soft: #eef3f1;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

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

button.ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

button.ghost:hover {
  background: #f0f2f5;
}

.navlink {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.navlink:hover {
  background: #f0f2f5;
}

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

.auth-card {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 22px;
}

.auth-card h1 {
  margin-bottom: 6px;
}

.auth-card p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-tabs button {
  background: #eef3f1;
  color: var(--text);
}

.auth-tabs button.active {
  background: var(--accent);
  color: #ffffff;
}

.hidden {
  display: none !important;
}

.form-message {
  min-height: 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-message.error {
  color: var(--error);
}

.log-page {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.log-page .log-panel {
  max-height: calc(100vh - 150px);
}

button.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr) minmax(300px, 0.75fr);
  gap: 18px;
  padding: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #303640;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  min-height: 40px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(38, 95, 85, 0.18);
  border-color: var(--accent);
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.switch {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
}

.account-details,
.default-image-note {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.switch.inline {
  margin-top: 20px;
}

.switch input {
  width: 18px;
  min-height: 18px;
}

.preview {
  display: grid;
  align-content: start;
  gap: 18px;
}

.phone {
  width: min(100%, 330px);
  margin: 0 auto;
  padding: 10px;
  border-radius: 8px;
  background: #ded7ce;
}

.image-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.5;
  border-radius: 7px 7px 0 0;
  background: #f0f0f0;
  color: var(--muted);
  overflow: hidden;
  font-size: 13px;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-preview {
  min-height: 150px;
  padding: 18px 16px;
  background: #ffffff;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.button-preview {
  display: grid;
  place-items: center;
  min-height: 46px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  color: #075e54;
  font-size: 13px;
  font-weight: 800;
}

.button-preview.secondary {
  border-radius: 0 0 7px 7px;
  color: #242932;
  font-weight: 700;
}

.statusbar {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.summary {
  border-radius: 6px;
  background: var(--soft);
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.items {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font-size: 13px;
}

.item strong {
  overflow-wrap: anywhere;
}

.badge {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  background: #edf1f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.badge.error {
  background: #fff0ed;
  color: var(--error);
}

.badge.sending {
  background: #fff6e6;
  color: var(--warn);
}

.error-text {
  color: var(--error);
  overflow-wrap: anywhere;
}

.log-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.log-title h2 {
  margin-bottom: 0;
}

.log-panel {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0;
  padding: 12px;
  background: #101418;
  color: #dce7e2;
  white-space: pre-wrap;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

  .preview {
    grid-column: 1 / -1;
    grid-template-columns: minmax(280px, 330px) 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .toolbar,
  .toolbar button {
    width: 100%;
  }

  .shell,
  .preview {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }
}
