:root {
  color-scheme: light dark;
  --bg: var(--tg-theme-bg-color, #f5f7fb);
  --panel: var(--tg-theme-secondary-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #172033);
  --muted: var(--tg-theme-hint-color, #687086);
  --line: rgba(104, 112, 134, 0.22);
  --accent: var(--tg-theme-button-color, #1473e6);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive_text_color, #b42318);
  --ok: #0f7a45;
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

.shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding:
    calc(18px + env(safe-area-inset-top))
    16px
    calc(24px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 46%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

.form {
  display: grid;
  gap: 14px;
}

.section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
}

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

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  padding: 12px;
  font-size: 16px;
}

textarea {
  min-height: 136px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.message {
  min-height: 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.message[data-tone="error"] {
  color: var(--danger);
}

.message[data-tone="success"] {
  color: var(--ok);
}

.message[data-tone="partial"] {
  color: #9a5b00;
}

.actions {
  display: grid;
  padding-top: 4px;
}

button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  font-weight: 750;
}

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

@media (max-width: 520px) {
  .shell {
    padding-left: 12px;
    padding-right: 12px;
  }

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

  h1 {
    font-size: 25px;
  }
}
