/* =========================================================
   Adapt - Shared styles (v2)
   Design constraints:
     - Pure white background
     - Red only on primary buttons, focus accents, key borders
     - No decorative icons / shapes / gradients / tinted backgrounds
     - Color usage allowed only on borders
   Typography:
     - Zen Kaku Gothic New (display) + Noto Sans JP (body)
     - JetBrains Mono for login_id / technical values
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@400;500;700;900&family=Noto+Sans+JP:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #ffffff;
  --ink: #0a0e1a;
  --ink-soft: #2a2f3d;
  --ink-muted: #5a6070;
  --ink-mute-2: #9aa0ac;
  --line: #e3e3e0;
  --line-strong: #c8c8c5;
  --red: #c4432b;
  --red-hover: #a83418;
  --success: #2d6a4f;
  --danger:  #a52a2a;
  --warning: #b5651d;

  --onetouch: #d4380d;
  --medadapt: #0891b2;

  --radius: 2px;
  --radius-lg: 4px;

  --shadow-sm: 0 1px 2px rgba(10,14,26,.03);
  --shadow:    0 2px 6px rgba(10,14,26,.04);
  --shadow-lg: 0 8px 24px rgba(10,14,26,.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body { min-height: 100vh; }

a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: var(--line-strong); }
a:hover { color: var(--red); text-decoration-color: var(--red); }

.display {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

/* ---------- ヘッダー ---------- */
.hdr {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.hdr__brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.hdr__brand:hover { color: var(--ink); }
.hdr__brand-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hdr__nav { display: flex; align-items: center; gap: 20px; }
.hdr__nav a, .hdr__nav button {
  font-size: 13px;
  color: var(--ink-soft);
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 2px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s, color .15s;
}
.hdr__nav a:hover, .hdr__nav button:hover { color: var(--red); border-bottom-color: var(--red); }
.hdr__nav a.active { border-bottom-color: var(--ink); color: var(--ink); }
/* コンテンツ最上部のログイン中ユーザー表示（クリック不可・静的表示） */
/* 左端揃え（ヘッダーのAdaptロゴと同じ縦ライン） */
.who-bar {
  padding: 18px 28px 0;
  display: flex;
  justify-content: flex-start;
}
.hdr__who {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  line-height: 1.4;
}
.hdr__who-name {
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--ink-soft);
}
.hdr__who-sep {
  color: var(--ink-mute-2);
  margin: 0 6px;
}

/* ---------- カード ---------- */
.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.panel-title {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  margin: 0 0 18px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
  letter-spacing: 0.01em;
}

/* ---------- フォーム ---------- */
label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0 0 6px 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
input[type=text], input[type=password], input[type=email], input[type=tel],
textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 11px 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(196,67,43,.10);
}
.field { margin-bottom: 18px; }
.hint { font-size: 11px; color: var(--ink-muted); margin-top: 5px; line-height: 1.5; }
.req { color: var(--red); font-weight: 700; }

/* ---------- パスワード表示トグル ---------- */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 60px; }
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 5px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.pw-toggle:hover { color: var(--red); border-color: var(--red); }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--red); color: #fff; border-color: var(--red);
}
.btn--primary:hover { background: var(--red-hover); border-color: var(--red-hover); color: #fff; }
.btn--ghost {
  background: var(--bg); color: var(--ink); border-color: var(--line-strong);
}
.btn--ghost:hover { border-color: var(--red); color: var(--red); }
.btn--dark {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.btn--dark:hover { background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { font-size: 12px; padding: 8px 12px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------- メッセージ（白背景＋色枠のみ） ---------- */
.msg {
  padding: 12px 14px 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.65;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
}
.msg--err  { border-left-color: var(--danger);  color: var(--danger); }
.msg--ok   { border-left-color: var(--success); color: var(--ink); }
.msg--info { border-left-color: var(--ink);     color: var(--ink); }
.msg--warn { border-left-color: var(--warning); color: var(--ink); }
.msg strong { font-weight: 700; }

/* ---------- レイアウト ---------- */
.container {
  padding: 8px 28px 96px;
}
.auth-wrap {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: start center;
  padding: 56px 20px 80px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
}
.auth-title {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: 28px;
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
}
.auth-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 32px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.auth-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}

/* ---------- ランチャー ---------- */
.launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 4px;
}
.app-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  text-decoration: none;
  color: inherit;
}
.app-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.app-card[data-disabled="true"] { opacity: 0.55; }
.app-card[data-disabled="true"]:hover { box-shadow: none; }

.app-card__head { display: flex; align-items: center; justify-content: flex-start; gap: 14px; }
.app-card__icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.app-card__head .app-card__name { flex: 1; }
.app-card__badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--ink-muted);
}
.badge--linked   { border-color: var(--success); color: var(--success); }
.badge--unlinked { border-color: var(--line-strong); color: var(--ink-muted); }

.app-card__name {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.005em;
}
.app-card__desc { font-size: 12px; color: var(--ink-muted); margin: 0; line-height: 1.65; }
.app-card__actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.app-card__meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-mute-2);
  letter-spacing: 0.04em;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* ---------- テーブル ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--ink);
  background: var(--bg);
}
td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* ---------- モーダル ---------- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(10,14,26,0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.modal__title {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: 20px;
  margin: 0 0 6px 0;
}
.modal__sub {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 0 0 22px 0;
  line-height: 1.65;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- ページイントロ ---------- */
.page-intro {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ink);
}
.page-intro h1 {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 900;
  font-size: 34px;
  margin: 0 0 10px 0;
  letter-spacing: -0.015em;
}
.page-intro p {
  color: var(--ink-muted);
  font-size: 13px;
  margin: 0;
  max-width: 680px;
  line-height: 1.75;
}
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 14px 0;
}

.row { display: flex; gap: 14px; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--ink-muted); font-size: 12px; }
.stack > * + * { margin-top: 18px; }
.text-center { text-align: center; }

.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 100px;
  background: var(--c, var(--ink-mute-2));
  vertical-align: middle;
  margin-right: 6px;
}

@media (max-width: 640px) {
  .hdr { padding: 0 18px; height: 56px; }
  .hdr__brand { font-size: 18px; }
  .hdr__nav { gap: 14px; }
  .who-bar { padding: 16px 18px 0; }
  .hdr__who { font-size: 10px; }
  .auth-card { padding: 32px 22px; }
  .auth-title { font-size: 23px; }
  .container { padding: 6px 18px 64px; }
  .page-intro h1 { font-size: 26px; }
  .app-card { padding: 20px 22px; }
}

/* ---------- 狭幅モバイル（Pixel 7 等 412px 帯）専用 ---------- */
@media (max-width: 480px) {
  /* ヘッダー：ロゴサブを隠して nav を横スクロール可能化 */
  .hdr { padding: 0 12px; height: 50px; }
  .hdr__brand { font-size: 16px; gap: 6px; flex-shrink: 0; }
  .hdr__brand-sub { display: none; }
  .hdr__nav {
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    min-width: 0;
  }
  .hdr__nav::-webkit-scrollbar { display: none; }
  .hdr__nav a, .hdr__nav button {
    font-size: 11.5px;
    padding: 4px 1px;
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* who-bar：モバイルでは非表示（情報量を削る） */
  .who-bar { display: none; }

  /* 本文コンテナ */
  .container { padding: 12px 14px 56px; }

  /* page-intro：余白圧縮、見出し縮小、セクションラベル削除 */
  .page-intro { margin-bottom: 14px; padding-bottom: 12px; }
  .page-intro .section-label { display: none; }
  .page-intro h1 {
    font-size: 18px;
    margin: 0 0 6px 0;
    overflow-wrap: anywhere;
    line-height: 1.3;
  }
  .page-intro p {
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }
  .page-intro .btn { font-size: 12px; padding: 7px 14px; }
  .page-intro > div[style] { margin-top: 8px !important; }

  /* セクションラベル「モジュール」も削除 */
  section > .section-label { display: none; }

  /* ランチャーカードを 1 列固定 + 余白を削って収める */
  .launcher-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 0;
  }
  .app-card { padding: 14px 16px; }
  .app-card__head { gap: 10px; }
  .app-card__icon { width: 36px; height: 36px; }
  .app-card__name { font-size: 14.5px; overflow-wrap: anywhere; }
  .app-card__badge { font-size: 9.5px; padding: 2px 6px; }
  .app-card__desc {
    font-size: 11.5px;
    line-height: 1.5;
    margin: 4px 0 6px;
    overflow-wrap: anywhere;
  }
  .app-card__actions { gap: 5px; margin-top: 4px; }
  .app-card__actions .btn { font-size: 11.5px; padding: 6px 10px; }
  .app-card__meta {
    font-size: 10px;
    margin-top: 6px;
    overflow-wrap: anywhere;
  }

  /* 認証画面 */
  .auth-card { padding: 28px 18px; }

  /* モーダル */
  .modal { padding: 22px; }

  /* ---------- テーブル：縦書き化防止 + 横スクロール ---------- */
  /* card 内の table は block 化して横スクロール可能に */
  .card table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    white-space: nowrap;
    border-collapse: collapse;
  }
  .card table thead,
  .card table tbody { display: table; width: 100%; min-width: max-content; }
  .card table th,
  .card table td {
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 11.5px;
  }
  /* スクロールバー: ヒント表示用に薄く */
  .card table::-webkit-scrollbar { height: 6px; }
  .card table::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 4px; }
}
