:root {
  --bg0: #1a1512;
  --bg1: #241e19;
  --ink: #f3ebe3;
  --muted: #b7a99a;
  --line: #3a312a;
  --accent: #d27a3a;
  --accent-ink: #1a120c;
  --danger: #e07070;
  --ok: #7cbc7a;
  --radius: 14px;
  --font: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 10% -10%, #4a2f1f55, transparent 60%),
    radial-gradient(700px 400px at 100% 0%, #2a3a3550, transparent 55%),
    linear-gradient(160deg, var(--bg0), #120f0d 70%);
}

.shell {
  width: min(640px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.head h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  letter-spacing: -0.02em;
}

.head p {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.panel {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg1) 88%, black);
  backdrop-filter: blur(8px);
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.login-panel .hint { margin: 0 0 0.75rem; }

.qr-wrap {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.qr-wrap img {
  background: #fff;
  border-radius: 12px;
  padding: 0.5rem;
}

.hidden { display: none !important; }

a.button-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  color: var(--ink);
  text-decoration: none;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.92rem;
}

.hint { color: var(--muted); font-size: 0.8rem; }

.row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem;
}

.grow { min-width: 0; }

input, select, textarea, button {
  font: inherit;
  color: var(--ink);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #120f0d;
  padding: 0.7rem 0.8rem;
}

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

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  cursor: pointer;
}

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

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.status {
  min-height: 1.4rem;
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }

.target-picker { display: grid; gap: 0.55rem; }

.target-picker-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.target-list {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #120f0d;
  padding: 0.35rem;
}

.target-list.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.target-item {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  min-height: 64px;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #1a1512;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-weight: 500;
}

.target-item:hover,
.target-item.active {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  background: color-mix(in srgb, var(--accent) 16%, #1a1512);
}

.target-item .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.target-item .meta {
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-item .badge {
  color: var(--accent);
  font-size: 0.68rem;
}

@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; }
  .target-picker-head { grid-template-columns: 1fr; }
  .target-list.cols-3 { grid-template-columns: 1fr; }
}
