:root {
  --ink: #15233d;
  --muted: #63718a;
  --line: #dbe3ef;
  --paper: #f7f8f5;
  --surface: #ffffff;
  --blue: #2157d9;
  --blue-dark: #143fae;
  --blue-soft: #eaf0ff;
  --mint: #dff7ed;
  --green: #177657;
  --amber: #9a6500;
  --danger: #b93737;
  --shadow: 0 18px 60px rgba(21, 35, 61, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Sans", sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.hidden { display: none !important; }

.site-header {
  min-height: 76px;
  padding: 12px max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(247, 248, 245, .92);
  border-bottom: 1px solid rgba(21, 35, 61, .1);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; line-height: 1.15; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--blue); color: #fff; font-weight: 800; font-size: 19px; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); margin-top: 5px; font-size: 11px; letter-spacing: .08em; }
.site-header nav { display: flex; align-items: center; gap: 28px; }
.site-header nav a { text-decoration: none; font-size: 14px; font-weight: 700; }
.site-header nav a:hover { color: var(--blue); }

.role-gate { padding-block: 88px 96px; }
.eyebrow, .mini-label { color: var(--blue); font-size: 11px; letter-spacing: .2em; font-weight: 800; text-transform: uppercase; }
.role-gate h1 { margin: 16px 0 14px; font-size: clamp(34px, 4.8vw, 52px); line-height: 1.2; letter-spacing: -.045em; text-wrap: balance; line-break: strict; }
.lead { max-width: 650px; font-size: clamp(16px, 2vw, 19px); color: var(--muted); margin: 0; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 42px; }
.role-card { min-height: 270px; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; display: flex; flex-direction: column; align-items: flex-start; box-shadow: var(--shadow); transition: transform .2s, border-color .2s, box-shadow .2s; }
.role-card:hover { transform: translateY(-3px); border-color: #91a9dc; box-shadow: 0 22px 64px rgba(21,35,61,.13); }
.role-card .role-number { padding: 5px 10px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: 13px; font-weight: 800; }
.role-card strong { margin-top: 24px; font-size: clamp(22px, 2.5vw, 29px); line-height: 1.35; letter-spacing: -.025em; }
.role-card > span:not(.role-number) { margin-top: 10px; color: var(--muted); }
.role-card b { margin-top: auto; padding-top: 24px; color: var(--blue); font-size: 14px; }
.admin-role { background: var(--ink); color: #fff; border-color: var(--ink); }
.admin-role .role-number { color: #c8d8ff; background: rgba(255,255,255,.12); }
.admin-role > span:not(.role-number) { color: rgba(255,255,255,.72); }
.admin-role b { color: #c8d8ff; }
.button { min-height: 50px; padding: 0 24px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 12px; text-decoration: none; font-weight: 750; cursor: pointer; transition: transform .2s, background .2s, border-color .2s; }
.button:hover { transform: translateY(-2px); }
.button:focus-visible, input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(33, 87, 217, .28); outline-offset: 3px; }
.button.primary { background: var(--blue); color: #fff; box-shadow: 0 12px 28px rgba(33, 87, 217, .22); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { background: transparent; border-color: #b7c2d5; }

.flow-section, .note-section { padding-block: 110px; }
.section-heading { max-width: 820px; margin-bottom: 42px; }
.section-heading > span { color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.section-heading h2 { font-size: clamp(28px, 3.5vw, 40px); line-height: 1.3; letter-spacing: -.035em; margin: 12px 0 0; text-wrap: balance; line-break: strict; }
.flow-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.flow-list li { display: grid; grid-template-columns: 90px 1fr; gap: 24px; align-items: start; padding: 28px 0; border-bottom: 1px solid var(--line); }
.flow-list li > span { color: var(--blue); font-weight: 800; font-size: 13px; }
.flow-list h3 { margin: -3px 0 6px; font-size: 22px; }
.flow-list p { margin: 0; color: var(--muted); }

.safety-band { background: var(--ink); color: #fff; padding-block: 100px; }
.safety-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 80px; }
.light-heading > span { color: #9bb9ff; }
.light-heading h2 { color: #fff; }
.safety-points { border-top: 1px solid rgba(255,255,255,.2); }
.safety-points p { margin: 0; padding: 22px 0; border-bottom: 1px solid rgba(255,255,255,.2); display: grid; grid-template-columns: 120px 1fr; gap: 20px; }
.safety-points strong { color: #bcd0ff; }
.safety-points span { color: rgba(255,255,255,.75); }
.note-card { max-width: 820px; padding: 30px 34px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.note-card p { margin: 0; color: var(--muted); }
.note-card p + p { margin-top: 18px; }
footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 13px; }
footer .shell { display: flex; justify-content: space-between; gap: 24px; }

.app-page { min-height: 100vh; background: #f4f6fa; }
.app-shell { padding-block: 64px 100px; max-width: 940px; }
.page-title { margin-bottom: 36px; }
.page-title h1, .dashboard-heading h1, .login-card h1 { margin: 8px 0 8px; font-size: clamp(32px, 5vw, 46px); line-height: 1.24; letter-spacing: -.04em; text-wrap: balance; line-break: strict; }
.page-title p, .dashboard-heading p, .login-card p { margin: 0; color: var(--muted); }
.panel, .login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 5vw, 40px); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 22px; }
.login-card { max-width: 560px; margin: 60px auto; }
.login-card form { margin-top: 28px; }

/* 発行側: 業務手順書として読める、装飾を抑えた操作面 */
.admin-page { background: #f8f9fb; }
.admin-shell { width: min(1040px, calc(100% - 48px)); margin-inline: auto; padding-block: 54px 96px; }
.admin-auth { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: start; }
.admin-manual-head { padding-top: 8px; }
.admin-manual-head h1 { margin: 10px 0 12px; font-size: clamp(30px, 4vw, 42px); line-height: 1.3; letter-spacing: -.035em; }
.admin-manual-head > p { margin: 0; color: var(--muted); max-width: 620px; }
.admin-procedure { list-style: none; margin: 34px 0 0; padding: 0; border-top: 1px solid var(--line); }
.admin-procedure li { display: grid; grid-template-columns: 38px 1fr; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.admin-procedure li > span { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #aebbd0; border-radius: 50%; color: var(--blue); font-weight: 800; font-size: 13px; }
.admin-procedure strong, .admin-procedure small { display: block; }
.admin-procedure small { margin-top: 3px; color: var(--muted); font-size: 13px; }
.admin-login-box { background: #fff; border: 1px solid var(--line); padding: 30px; }
.admin-login-box h2 { margin: 0; font-size: 23px; }
.admin-login-box > p { margin: 4px 0 22px; color: var(--muted); }
.admin-login-box .button { margin-top: 14px; box-shadow: none; }
.admin-page .panel { border-radius: 4px; box-shadow: none; }
.admin-page .dashboard-heading h1 { font-size: clamp(28px, 4vw, 38px); }
.admin-page .pairing-panel { display: block; }
.admin-page .pairing-panel .step-label { margin-bottom: 18px; }
.admin-page .pairing-panel form { margin-top: 26px; max-width: 760px; }
.admin-page .pairing-result { margin-top: 22px; border-radius: 4px; display: grid; grid-template-columns: 1fr; gap: 18px; align-items: stretch; }
.admin-page .pairing-result small { color: var(--muted); }
.issued-code, .issued-link { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid #c7d3e8; }
.issued-code > span, .issued-link > span { grid-column: 1 / -1; color: var(--muted); font-size: 13px; font-weight: 700; }
.issued-code strong { font: 800 28px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; }
.issued-link a { min-width: 0; overflow-wrap: anywhere; color: var(--blue); font-size: 14px; }
.issued-code button, .issued-link button { border: 1px solid #9eb0cd; border-radius: 7px; background: #fff; color: var(--blue); padding: 8px 12px; font-weight: 750; cursor: pointer; }
.admin-page .device-section { margin-top: 62px; }
.admin-page .section-row p { margin: 6px 0 0; color: var(--muted); }
.admin-page .device-card { border-radius: 4px; }

/* 利用者側: 顧客が安心して一つの操作に集中できる画面 */
.customer-page { background: linear-gradient(180deg, #eef3ff 0, #f7f9fd 390px, #f4f6fa 100%); }
.customer-header { background: rgba(255,255,255,.9); }
.customer-help { color: var(--muted); font-size: 13px; }
.internal-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.customer-shell { max-width: 900px; padding-top: 60px; }
.customer-title { text-align: center; margin-bottom: 26px; }
.customer-title h1 { font-size: clamp(34px, 5vw, 48px); }
.customer-title p { font-size: 17px; }
.customer-steps { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 20px; border: 1px solid #ccd7ea; background: rgba(255,255,255,.76); border-radius: 14px; overflow: hidden; }
.customer-steps span { min-height: 64px; padding: 14px 18px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.customer-steps span + span { border-left: 1px solid #dbe3ef; }
.customer-steps b { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--blue-soft); color: var(--blue); }
.customer-steps span.active { background: #fff; color: var(--ink); font-weight: 750; }
.customer-steps span.active b { background: var(--blue); color: #fff; }
.customer-steps span.complete { color: var(--green); }
.customer-steps span.complete b { background: var(--mint); color: var(--green); }
.customer-code-panel { border-color: #cbd8ee; box-shadow: 0 24px 70px rgba(21,35,61,.11); }
.customer-code-panel.verified { border-color: #9ed8c4; box-shadow: 0 24px 70px rgba(23,118,87,.09); }
.customer-code-panel.failed { border-color: #e3b9b9; }
.link-check { display: flex; align-items: center; gap: 18px; padding: 20px; border-radius: 14px; background: #f5f8ff; }
.link-check h2 { margin: 0; font-size: 20px; line-height: 1.45; }
.link-check .form-message { margin-top: 4px; min-height: 0; }
.loader { width: 28px; height: 28px; flex: 0 0 auto; border: 3px solid #cad7f3; border-top-color: var(--blue); border-radius: 50%; animation: spin .9s linear infinite; }
.verified .loader { border: 0; background: var(--mint); display: grid; place-items: center; animation: none; }
.verified .loader::after { content: "✓"; color: var(--green); font-weight: 900; }
.failed .loader { animation: none; border-color: #e7c8c8; border-top-color: var(--danger); }
#retry-invite { margin-top: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }
.manual-code { margin-top: 18px; color: var(--muted); font-size: 13px; }
.manual-code summary { cursor: pointer; font-weight: 700; }
.manual-code .code-form { margin-top: 16px; }
.customer-assurance { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.step-label { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font-size: 12px; color: var(--blue); font-weight: 800; letter-spacing: .12em; }
.step-label span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); }
label { display: block; font-size: 13px; font-weight: 750; margin-bottom: 8px; }
input { width: 100%; min-height: 52px; padding: 11px 14px; border: 1px solid #b9c4d6; border-radius: 11px; color: var(--ink); background: #fff; }
.code-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 14px; }
.code-form label { grid-column: 1 / -1; margin-bottom: -6px; }
#pair-code { font-size: 24px; letter-spacing: .18em; text-transform: uppercase; font-weight: 800; }
.form-message { min-height: 1.6em; margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.form-message.error { color: var(--danger); }
.form-message.success { color: var(--green); }
.command-heading { display: flex; justify-content: space-between; gap: 24px; align-items: start; }
.command-heading h2, .guidance-card h2, .pairing-panel h2, .device-section h2 { margin: 0; font-size: 24px; line-height: 1.35; }
.command-heading p { margin: 6px 0 0; color: var(--muted); }
.status-chip { flex: 0 0 auto; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 750; }
.status-chip.waiting { background: #fff1c8; color: var(--amber); }
.status-chip.connected { background: var(--mint); color: var(--green); }
.short-steps { margin: 24px 0; padding-left: 24px; color: var(--muted); }
.short-steps li::marker { color: var(--blue); font-weight: 800; }
.setup-instructions { margin-bottom: 28px; }
.setup-instructions li + li { margin-top: 10px; }
.bridge-description { margin: 22px 0 0; color: var(--muted); }
.bridge-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.bridge-actions .button:disabled { opacity: .55; cursor: default; transform: none; }
.setup-panel .bridge-actions .button { min-width: min(100%, 360px); }
.setup-panel > .text-button { display: block; margin-top: 14px; padding-left: 0; }
.command-box { position: relative; background: #0d1b30; color: #dce8ff; border-radius: 14px; padding: 22px 90px 22px 20px; overflow: auto; }
.command-box code { font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.command-box button { position: absolute; top: 12px; right: 12px; border: 1px solid #526782; border-radius: 9px; background: #172b48; color: #fff; padding: 7px 12px; cursor: pointer; }
.alternate { margin-top: 18px; color: var(--muted); font-size: 13px; }
.alternate summary { cursor: pointer; }
.alternate-buttons { display: flex; gap: 8px; margin-top: 12px; }
.alternate-buttons button, .text-button, .pairing-result button { border: 0; background: transparent; color: var(--blue); font-weight: 750; cursor: pointer; padding: 5px; }
.guidance-card { display: grid; grid-template-columns: 18px 1fr; gap: 16px; padding: 24px; background: var(--blue-soft); border-radius: 16px; margin-bottom: 22px; }
.guidance-card p { margin: 8px 0 0; color: var(--muted); }
.guidance-kicker { color: var(--blue) !important; font-size: 11px; font-weight: 800; letter-spacing: .15em; margin: 0 0 6px !important; }
.pulse-dot { width: 12px; height: 12px; margin-top: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 7px rgba(33,87,217,.12); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(33,87,217,0); } }
.timeline { margin-top: 26px; border-top: 1px solid var(--line); }
.timeline-item { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: start; padding: 18px 0; border-bottom: 1px solid var(--line); }
.timeline-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 800; }
.timeline-item h3 { margin: 0; font-size: 15px; }
.timeline-item p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.timeline-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.terminal-support-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(250px, .65fr); gap: 14px; margin-top: 26px; }
.terminal-mirror { min-width: 0; overflow: hidden; border-radius: 14px; background: #0d1b30; color: #dce8ff; }
.terminal-title { min-height: 44px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #2a3c57; font-size: 12px; font-weight: 750; }
.terminal-live { color: #81d8b9; }
#terminal-output { height: 260px; margin: 0; padding: 16px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #dce8ff; }
.support-panel { padding: 20px; border: 1px solid #c7d5ee; border-radius: 14px; background: #f5f8ff; }
.support-label { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.support-panel h3 { margin: 10px 0 8px; font-size: 17px; line-height: 1.5; }
.support-panel p { margin: 0; color: var(--muted); font-size: 13px; }
.privacy-note { display: grid; gap: 4px; margin-top: 24px; padding: 18px 20px; border-left: 3px solid var(--green); background: #f1faf6; color: var(--muted); font-size: 13px; }
.privacy-note strong { color: var(--green); }

.dashboard-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.pairing-panel { display: grid; grid-template-columns: .8fr 1.2fr; gap: 34px; align-items: end; }
.pairing-panel .step-label { grid-column: 1 / -1; margin-bottom: -12px; }
.pairing-panel p { margin: 8px 0 0; color: var(--muted); }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
.pairing-result { grid-column: 1 / -1; padding: 24px; border-radius: 16px; background: var(--blue-soft); display: flex; align-items: center; gap: 18px; }
.pairing-result > span { font-size: 12px; color: var(--muted); }
.pairing-result strong { font: 800 28px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; }
.pairing-result button { margin-left: auto; }
.device-section { margin-top: 48px; }
.section-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.device-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: grid; grid-template-columns: 1fr auto; gap: 20px; }
.device-card + .device-card { margin-top: 12px; }
.device-name { display: flex; align-items: center; gap: 10px; }
.device-name h3 { margin: 0; font-size: 18px; }
.device-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.device-message { color: var(--muted); margin: 14px 0 0; font-size: 14px; }
.device-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-content: start; }
.device-actions button { border: 1px solid #b8c6dc; background: #fff; border-radius: 9px; padding: 8px 12px; color: var(--ink); font-size: 12px; font-weight: 750; cursor: pointer; }
.device-actions button:hover { border-color: var(--blue); color: var(--blue); }
.empty-state { padding: 40px; text-align: center; border: 1px dashed #bbc6d7; border-radius: 16px; color: var(--muted); }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 1120px); }
  .site-header { padding-inline: 14px; min-height: 68px; }
  .site-header nav { gap: 14px; }
  .brand small { display: none; }
  .role-gate { padding-block: 58px 68px; }
  .role-grid { grid-template-columns: 1fr; }
  .role-card { min-height: 235px; padding: 26px; }
  .flow-section, .note-section { padding-block: 76px; }
  .flow-list li { grid-template-columns: 48px 1fr; gap: 12px; }
  .safety-grid { grid-template-columns: 1fr; gap: 20px; }
  .safety-points p { grid-template-columns: 92px 1fr; }
  .app-shell { padding-top: 38px; }
  .admin-shell { width: min(100% - 28px, 1040px); padding-top: 34px; }
  .admin-auth { grid-template-columns: 1fr; gap: 30px; }
  .customer-help { display: none; }
  .customer-steps { grid-template-columns: 1fr; }
  .customer-steps span + span { border-left: 0; border-top: 1px solid #dbe3ef; }
  .code-form, .pairing-panel { grid-template-columns: 1fr; }
  .code-form label, .pairing-panel .step-label, .pairing-result { grid-column: 1; }
  .code-form .button, .inline-form .button { width: 100%; }
  .inline-form { flex-direction: column; }
  .pairing-result { align-items: flex-start; flex-direction: column; }
  .pairing-result button { margin-left: 0; }
  .issued-code, .issued-link { grid-template-columns: 1fr; }
  .device-card { grid-template-columns: 1fr; }
  .device-actions { justify-content: flex-start; }
  .command-heading { flex-direction: column; }
  .bridge-actions { display: grid; }
  .terminal-support-grid { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 30px 1fr; }
  .timeline-status { grid-column: 2; }
  footer .shell { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
