:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #69707d;
  --line: #d9dee7;
  --accent: #145a4f;
  --accent-strong: #0d4038;
  --accent-soft: #e4f3ef;
  --danger: #b42318;
  --warn: #9a5b00;
  --ok: #11733d;
  --shadow: 0 18px 60px rgb(32 38 46 / 12%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 90%), rgb(246 247 249 / 92%)),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100%, 780px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 18px;
  display: grid;
  align-items: center;
}

.tool-panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 34px);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.status-pill {
  flex: none;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.card-form,
.mailbox-panel,
.extra-info-panel,
.result-panel {
  display: grid;
  gap: 14px;
}

.mailbox-panel,
.extra-info-panel,
.result-panel {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.input-row,
.copy-row {
  display: grid;
  gap: 10px;
}

.input-row {
  grid-template-columns: minmax(0, 1fr) 118px;
}

.copy-row {
  grid-template-columns: minmax(0, 1fr) 48px;
}

input {
  min-width: 0;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(20 90 79 / 14%);
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease, opacity 140ms ease;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.primary-button,
.fetch-button {
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

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

.fetch-button {
  width: 100%;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef1f5;
  color: var(--ink);
  font-size: 20px;
}

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

.button-icon {
  line-height: 1;
}

.field-block {
  display: grid;
  gap: 8px;
}

.result-panel {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.info-box {
  display: grid;
  gap: 10px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.info-box h2 {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.info-box pre,
.info-text {
  margin: 0;
  min-height: 42px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.info-box pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.code-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
}

.code-value {
  min-height: 58px;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: clamp(30px, 8vw, 48px);
  font-weight: 900;
  letter-spacing: 0;
}

.mail-meta {
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}

.mail-meta div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
}

.mail-meta dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mail-meta dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.message-box {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.message-box.warn {
  color: var(--warn);
}

.message-box.ok {
  color: var(--ok);
}

@media (max-width: 560px) {
  .app-shell {
    padding: 18px 12px;
    align-items: start;
  }

  .panel-header,
  .input-row {
    grid-template-columns: 1fr;
  }

  .panel-header {
    display: grid;
  }

  .status-pill {
    width: fit-content;
  }

  .primary-button {
    width: 100%;
  }
}
