*, *::before, *::after { box-sizing: border-box; }

:root {
  --blue: #2b8ff5;
  --blue-d: #1a6fd0;
  --ink: #1c1c1e;
  --ink-2: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6f9;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 24px 16px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.phone {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgb(17 24 39 / 8%);
  padding: 22px;
}

.view.hidden { display: none; }

.brand { text-align: center; margin-bottom: 22px; }

.logo {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue), #6fb3ff);
  color: #fff;
  font-weight: 600;
  letter-spacing: .06em;
  font-size: 13px;
}

h1 { font-size: 19px; margin: 14px 0 0; font-weight: 600; }

.field { display: block; margin-bottom: 13px; }

.field > span {
  display: block;
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.field > span em { font-style: normal; opacity: .65; }

input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  color: inherit;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(43 143 245 / 15%);
}

button {
  font: inherit;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 10px 14px;
  transition: filter .15s, background .15s, opacity .15s;
}

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

.primary {
  width: 100%;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}
.primary:not(:disabled):hover { background: var(--blue-d); }
.primary.big { padding: 14px; font-size: 16px; margin-top: 6px; }

.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
  font-size: 13px;
  padding: 8px 11px;
}
.ghost:hover { color: var(--ink); border-color: #d1d5db; }

.msg { min-height: 20px; font-size: 13px; margin: 10px 0 0; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }
.msg.info { color: var(--ink-2); }

.hint { font-size: 12px; color: var(--ink-2); text-align: center; margin: 10px 0 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.who { font-weight: 600; }
.sub { font-size: 12px; color: var(--ink-2); word-break: break-all; }

.status {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.status.in { background: #f0fdf4; border-color: #bbf7d0; }
.status.out { background: #fef2f2; border-color: #fecaca; }
.status.wait { background: #fffbeb; border-color: #fde68a; }

.status-main { font-weight: 600; }
.status.in .status-main { color: var(--ok); }
.status.out .status-main { color: var(--err); }
.status.wait .status-main { color: var(--warn); }
.status-sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; }

.row { display: flex; gap: 10px; }
.grow { flex: 1; }

.btnrow { display: flex; gap: 8px; margin-bottom: 13px; }

.debug { margin-top: 18px; font-size: 12px; }
.debug summary { cursor: pointer; color: var(--ink-2); }
.debug pre {
  margin: 8px 0 0;
  padding: 10px;
  max-height: 220px;
  overflow: auto;
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 8px;
  font: 11px/1.5 ui-monospace, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}
