:root {
  --bg: #0f1220; --card: #181c2f; --line: #2a3050; --txt: #e8ebf7; --muted: #8b93b5;
  --acc: #6c8cff; --ok: #3ddc97; --bad: #ff5d73; --warn: #ffb84d; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--txt); min-height: 100vh;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.center { display: grid; place-items: center; padding: 16px; }
h1 { font-size: clamp(1.25rem, 4vw, 1.6rem); margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.center-text { text-align: center; }
.wrap { max-width: 960px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 1200px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.login { width: min(380px, 100%); text-align: center; padding: 28px 22px; }
.login .lock { font-size: 2.2rem; }
.login form { margin-top: 18px; display: grid; gap: 12px; }

input, select {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 10px; font-size: 16px;
  background: #0d1020; color: var(--txt); border: 1px solid var(--line);
}
input:focus, select:focus { outline: 2px solid var(--acc); outline-offset: 1px; }
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer;
  background: #232944; color: var(--txt); border: 1px solid var(--line);
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #0b1030; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.go { background: var(--ok); border-color: var(--ok); color: #06281a; }
.btn.stop { background: var(--bad); border-color: var(--bad); color: #2b0610; }
.btn.block { width: 100%; }
.msg { min-height: 1.4em; margin: 0; color: var(--bad); font-size: .92rem; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.bot { display: grid; gap: 12px; margin: 0; }
.bot .name { font-weight: 700; font-size: 1.1rem; word-break: break-word; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; border: 1px solid var(--line); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.on { color: var(--ok); border-color: var(--ok); }
.badge.on::before { background: var(--ok); }
.badge.off { color: var(--muted); }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 1.7rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.filter { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 720px) { .filter { grid-template-columns: 200px 1fr 110px auto auto; align-items: center; } }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.check input { width: 18px; min-height: 0; height: 18px; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: .88rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: #141831; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.ua { max-width: 240px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.detail { word-break: break-word; }
.tag { padding: 2px 9px; border-radius: 6px; font-weight: 600; font-size: .8rem; white-space: nowrap; border: 1px solid var(--line); }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.bad { color: var(--bad); border-color: var(--bad); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.mute { color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #232944; border: 1px solid var(--line); padding: 11px 18px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--bad); color: var(--bad); }

/* ── 입장 요청 / 승인 ── */
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 18px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#req-box { display: grid; gap: 10px; }
.code { font-size: 2.2rem; font-weight: 800; letter-spacing: .3em; padding-left: .3em; margin: 4px 0; color: var(--acc); }
.small { font-size: .85rem; }
.notice { background: #1d2547; border: 1px solid var(--acc); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: .92rem; }
h2.sub { margin-top: 20px; }
.reqlist { display: grid; gap: 10px; }
.req { display: grid; gap: 12px; background: #12162a; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.req .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.req .codebox { font-weight: 800; font-size: 1.35rem; letter-spacing: .2em; color: var(--acc); }
.req .ua-line { margin-top: 4px; word-break: break-all; }
.req .act { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.req .act .btn:nth-of-type(n) { width: 100%; }
@media (min-width: 760px) {
  .req { grid-template-columns: 1fr auto; align-items: center; }
  .req .act { grid-template-columns: 110px 120px 80px 80px; }
}
