:root {
  --red: #d71920;
  --red-dark: #a90e15;
  --red-soft: #fff0f1;
  --ink: #172033;
  --muted: #687386;
  --line: #dfe4ea;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --green: #11845b;
  --amber: #a86800;
  --blue: #2762d4;
  --shadow: 0 16px 45px rgba(24, 33, 50, .09);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Noto Sans JP", "Yu Gothic UI", sans-serif;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[v-cloak] { display: none; }

.shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: white;
  background: var(--red);
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(215,25,32,.22);
}
.brand strong { display: block; letter-spacing: .04em; }
.brand small { color: var(--muted); font-size: 10px; }
.role-chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: 12px; font-weight: 700; }

.layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar { padding: 22px 14px; border-right: 1px solid var(--line); background: #fff; }
.nav-label { margin: 0 10px 9px; color: #9aa3b1; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav { display: grid; gap: 5px; }
.nav a { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 11px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.nav a:hover { background: #f4f6f8; color: var(--ink); }
.nav a.active { color: var(--red); background: var(--red-soft); }
.nav-icon { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: rgba(104,115,134,.09); font-size: 11px; }
.nav a.active .nav-icon { color: white; background: var(--red); }

.content { width: 100%; max-width: 1440px; padding: 30px clamp(18px, 3vw, 44px) 54px; margin: 0 auto; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 5px; color: var(--red); font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(25px, 3vw, 38px); line-height: 1.2; letter-spacing: -.035em; }
.lead { max-width: 760px; margin: 8px 0 0; color: var(--muted); line-height: 1.7; font-size: 14px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 3px 14px rgba(24,33,50,.04); }
.card-pad { padding: 20px; }
.hero-card { padding: clamp(22px, 4vw, 42px); overflow: hidden; background: linear-gradient(135deg, #fff 0%, #fff5f5 100%); }
.card-title { margin: 0; font-size: 15px; }
.card-sub { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.metric { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.metric strong { display: block; margin-top: 9px; font-size: 30px; letter-spacing: -.04em; }
.metric-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--red); background: var(--red-soft); font-weight: 900; }

.btn { min-height: 42px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: white; cursor: pointer; font-size: 12px; font-weight: 800; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(24,33,50,.08); }
.btn-primary { color: white; border-color: var(--red); background: var(--red); }
.btn-primary:hover { background: var(--red-dark); }
.btn-soft { color: var(--red); border-color: #ffd1d3; background: var(--red-soft); }
.btn-danger { color: #b21c24; border-color: #ffc4c7; background: #fff4f4; }
.btn-lg { min-height: 60px; padding: 14px 20px; border-radius: 15px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 900; white-space: nowrap; }
.badge-green { color: var(--green); background: #eaf8f2; }
.badge-red { color: var(--red); background: var(--red-soft); }
.badge-amber { color: var(--amber); background: #fff6df; }
.badge-blue { color: var(--blue); background: #edf3ff; }
.badge-gray { color: var(--muted); background: #eff2f5; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; }
table { width: 100%; border-collapse: collapse; background: white; font-size: 12px; }
th { color: var(--muted); background: #f7f8fa; font-size: 10px; letter-spacing: .04em; text-align: left; }
th, td { padding: 13px 14px; border-bottom: 1px solid #edf0f3; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.tabs { display: flex; gap: 5px; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #f2f4f7; }
.tab { padding: 8px 12px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap; font-size: 11px; font-weight: 800; }
.tab.active { color: var(--red); background: white; box-shadow: 0 2px 7px rgba(24,33,50,.08); }
.field { display: grid; gap: 6px; }
.field label { color: var(--muted); font-size: 10px; font-weight: 800; }
.input { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; outline: 0; }
.input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.notice { padding: 13px 15px; border: 1px solid #ffd2d4; border-radius: 12px; color: #8f1e23; background: #fff6f6; font-size: 12px; line-height: 1.55; }
.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, monospace; }
.divider { height: 1px; margin: 18px 0; background: var(--line); }

.phone { width: min(100%, 410px); margin: 0 auto; padding: 10px; border-radius: 38px; background: #202431; box-shadow: var(--shadow); }
.phone-screen { min-height: 720px; overflow: hidden; border-radius: 30px; background: #f7f8fa; }
.phone-bar { display: flex; justify-content: space-between; padding: 13px 18px; color: var(--muted); background: white; font-size: 10px; font-weight: 800; }
.member-card { position: relative; margin: 16px; padding: 24px; overflow: hidden; border: 1px solid #e8e8e8; border-radius: 23px; background: white; box-shadow: 0 12px 35px rgba(24,33,50,.1); }
.member-card::before { position: absolute; inset: 0 0 auto; height: 5px; content: ""; background: var(--red); }
.qr { display: grid; grid-template-columns: repeat(13, 1fr); width: 190px; height: 190px; margin: 20px auto 10px; padding: 11px; border: 8px solid white; background: white; box-shadow: inset 0 0 0 1px var(--line); }
.qr i { display: block; background: #fff; }
.qr i.on { background: #151823; }
.progress { height: 6px; overflow: hidden; border-radius: 99px; background: #e3e7ec; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--red); transition: width .8s linear; }

.scan-frame { position: relative; display: grid; place-items: center; min-height: 330px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: radial-gradient(circle, #fff 0, #f5f7f9 70%); }
.scan-frame::before { position: absolute; width: 76%; height: 2px; content: ""; background: var(--red); box-shadow: 0 0 18px var(--red); animation: scan 2.2s ease-in-out infinite; }
@keyframes scan { 0%,100% { top: 18%; } 50% { top: 82%; } }
.scan-content { position: relative; z-index: 2; max-width: 520px; padding: 25px; text-align: center; }
.steps { display: grid; gap: 10px; }
.step { display: flex; gap: 10px; align-items: center; padding: 13px; border: 1px solid transparent; border-radius: 12px; color: var(--muted); }
.step-number { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 50%; background: #e8ebef; font-size: 11px; font-weight: 900; }
.step.active { color: var(--ink); border-color: #ffd2d4; background: white; }
.step.active .step-number { color: white; background: var(--red); }
.step.done .step-number { color: white; background: var(--green); }

.device-list { display: grid; gap: 9px; }
.device { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.device-dot { width: 11px; height: 11px; border: 3px solid white; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px #9dd5c2; }
.device-dot.offline { background: #98a1ae; box-shadow: 0 0 0 1px #cfd4db; }
.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; padding: 0 0 22px 25px; border-left: 2px solid #e4e8ed; }
.timeline-item::before { position: absolute; top: 0; left: -6px; width: 10px; height: 10px; content: ""; border-radius: 50%; background: var(--red); }
.timeline-item:last-child { padding-bottom: 0; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 360px; padding: 13px 16px; border-radius: 12px; color: white; background: #202431; box-shadow: var(--shadow); font-size: 12px; font-weight: 700; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 72px; z-index: 15; padding: 8px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-label { display: none; }
  .nav { display: flex; min-width: max-content; }
  .nav a { padding: 9px 11px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .topbar { padding: 10px 14px; }
  .brand small, .role-chip { display: none; }
  .content { padding: 22px 14px 42px; }
  .page-head { align-items: start; flex-direction: column; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid [style*="grid-column:span 2"] { grid-column: auto !important; }
  .nav a span:not(.nav-icon) { display: none; }
  .phone { padding: 7px; border-radius: 32px; }
  .phone-screen { min-height: 680px; border-radius: 26px; }
  .qr { width: 170px; height: 170px; }
  .button-row .btn { flex: 1; }
}
