:root {
  --bg: #0b0b0c;
  --card: #161618;
  --card-2: #1d1d20;
  --line: #2a2a2e;
  --text: #f2f2f3;
  --muted: #8b8b93;
  --accent: #d9412e;
  --accent-hi: #ef5340;
  --green: #3ddc84;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1100px 600px at 50% -10%, #1a1113 0%, var(--bg) 60%);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 40px 36px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}

.card.wide { max-width: 760px; text-align: left; }

.logo {
  width: 74px; height: 74px;
  margin: 0 auto 22px;
  border-radius: 20px;
  background: linear-gradient(160deg, var(--accent-hi), #a82a1c);
  display: grid; place-items: center;
  font-size: 34px; font-weight: 700;
  box-shadow: 0 10px 26px rgba(217, 65, 46, .3);
}

h1 { margin: 0 0 6px; font-size: 27px; letter-spacing: -.4px; font-weight: 650; }
h1 .accent { color: var(--accent-hi); }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 26px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 14px 20px;
  background: var(--accent); color: #fff;
  border: 0; border-radius: 11px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: background .15s, transform .06s;
}
.btn:hover { background: var(--accent-hi); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--card-2); border: 1px solid var(--line); }
.btn.ghost:hover { background: #26262a; }
.btn.on { background: #2b7a4b; }
.btn.on:hover { background: #329057; }

.err {
  background: rgba(217, 65, 46, .1);
  border: 1px solid rgba(217, 65, 46, .35);
  color: #f3a79c;
  padding: 11px 14px; border-radius: 10px;
  font-size: 13.5px; margin-bottom: 20px;
}

/* ---- app ---- */
.top {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 20px; margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.top .logo { width: 44px; height: 44px; margin: 0; border-radius: 12px; font-size: 20px; }
.top h1 { font-size: 19px; margin: 0; }
.top .who { margin-left: auto; color: var(--muted); font-size: 12.5px; text-align: right; }
.top .who a { color: var(--muted); }

.row { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }

.state {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600;
}
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #55555d; flex: none;
}
.dot.live {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(61, 220, 132, .6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}
.uptime { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.row .btn { width: auto; margin-left: auto; padding: 11px 24px; }

.logs {
  background: #0a0a0b;
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 400px;
  overflow-y: auto;
  padding: 14px 16px;
  font: 12.5px/1.65 ui-monospace, "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.logs .l { display: flex; gap: 12px; }
.logs time { color: #4d4d55; flex: none; }
.logs .m { flex: 1; }
.logs .err .m { color: #f0897a; }
.logs .sys .m { color: #8fb8ff; }
.logs .hit .m { color: var(--green); font-weight: 600; }
.logs .empty { color: var(--muted); }

.foot { margin-top: 14px; color: var(--muted); font-size: 12px; display: flex; gap: 8px; }
.foot .sp { margin-left: auto; }

/* ---- multi-user panel ---- */
.top .who { margin-left: auto; text-align: right; }
.role { color: var(--accent-hi); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.btn.small { width: auto; padding: 8px 15px; font-size: 13px; margin-left: 14px; flex: none; }

.panel-box {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 20px 22px;
  margin-bottom: 18px;
}
.box-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.box-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.counts { margin-left: auto; color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.hint code { background: #0a0a0b; padding: 2px 6px; border-radius: 5px; font-size: 11.5px; }

.switch { margin-left: auto; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.track {
  width: 42px; height: 24px; border-radius: 12px;
  background: #3a3a40; position: relative; transition: background .18s;
}
.knob {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .18s;
}
.switch input:checked + .track { background: #2b7a4b; }
.switch input:checked + .track .knob { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.switch-label { font-size: 13px; font-weight: 600; min-width: 26px; }

.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.field-row { display: flex; gap: 10px; }
.field-row input {
  flex: 1; padding: 10px 13px;
  background: #0a0a0b; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; font-family: inherit;
}
.field-row input:focus { outline: none; border-color: var(--accent); }
.field-row .btn { margin-left: 0; }
.field-msg { font-size: 12.5px; margin-top: 8px; min-height: 16px; }
.field-msg.good { color: var(--green); }
.field-msg.bad { color: #f0897a; }

@media (max-width: 560px) {
  .top { flex-wrap: wrap; }
  .btn.small { margin-left: 0; }
  .row .btn { width: 100%; margin-left: 0; margin-top: 12px; }
  .row { flex-wrap: wrap; }
}

/* ---- plain-language activity feed ---- */
.feed {
  background: #0a0a0b;
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 280px;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 13.5px;
}
.feed .empty { color: var(--muted); }
.fe { display: flex; gap: 12px; padding: 4px 0; align-items: baseline; }
.fe time { color: #4d4d55; flex: none; font-size: 11.5px; font-family: ui-monospace, Consolas, monospace; }
.fe .m { flex: 1; }
.fe.found .m { color: var(--text); font-weight: 600; }
.fe.sent .m { color: var(--green); font-weight: 600; }
.fe.note .m { color: var(--muted); font-size: 12.5px; }
.fe.fail .m { color: #f0897a; font-weight: 600; }
.readonly { margin-left: auto; color: var(--muted); font-size: 12.5px; }

/* ---- test-code modal ---- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .68);
  display: grid; place-items: center;
  padding: 24px; z-index: 50;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 30px;
  max-width: 420px; width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
.modal-card h3 { margin: 0 0 10px; font-size: 18px; font-weight: 650; }
.modal-actions { display: flex; gap: 10px; margin: 20px 0 12px; }
.modal-actions .btn { flex: 1; margin: 0; }
.modal-cancel { width: 100%; margin-left: 0; }

/* ---- user list ---- */
.table-wrap { overflow-x: auto; }
.utable { width: 100%; border-collapse: collapse; font-size: 14px; }
.utable th {
  text-align: left; padding: 0 12px 10px;
  color: var(--muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.utable td { padding: 12px; border-bottom: 1px solid #202024; }
.utable tr:last-child td { border-bottom: 0; }
.utable td.muted { color: var(--muted); font-size: 13px; }
.pill {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.pill.on { background: rgba(61, 220, 132, .13); color: var(--green); }
.pill.off { background: #26262b; color: var(--muted); }
