/*
 * 本番認証系（/login/, /pricing/, /portal/, /password/*, /payment/*）の
 * 共通スタイル。
 *
 * css/style.css を読み込んだうえで、この2〜3種類の画面に固有の
 * クラスだけを追加する。既存クラスは上書きしない。
 *
 * ただし style.css を読まないページ（/production-app/ の一部）からも
 * 読まれるため、使うトークンの既定値はこのファイル自身が持つ（下記）。
 *
 * 320px から積み上げるモバイルファースト。
 * 375 / 768 / 1024 / 1440px で横スクロールが出ないことを前提に組む。
 *
 * 色・フォント・角丸・余白は css/style.css のカスタムプロパティを使い、
 * 個別の色をここで新しく作らない（コーポレートサイトと見た目を揃えるため）。
 */

/*
 * 配色（白 × 深緑 × 空色）。
 *
 * 認証系のHTMLは style.css と auth.css の2枚しか読み込まない。テーマを
 * 当てるために24ページへ link を足して回るより、共通CSSの側で1回
 * 取り込むほうが、あとから増えるページも自動で揃う。
 *
 * @import はこのファイルの位置に展開されるため、HTMLで先に読まれた
 * style.css の :root を上書きできる。他の規則より前に置くこと。
 */
@import url("../css/theme.css");

/*
 * このファイルが使うトークンの土台。
 *
 * ------------------------------------------------------------------
 * なぜ必要か（2026-08-13 の障害）
 * ------------------------------------------------------------------
 * このファイルの規則は --c-main / --radius-button / --font-en などを
 * 参照している。これらを定義しているのは css/style.css だけで、上の
 * theme.css は色トークン（--color-*）を上書きするだけの層なので持って
 * いない。つまり auth.css は「style.css も一緒に読まれていること」を
 * 暗黙の前提にしていた。
 *
 * ところが /production-app/ のうち receipt-ocr と voice-recorder は
 * style.css を読まず、auth.css と自前の style.css の2枚だけを読む。
 * この2つでは --c-main が未定義のままで、.auth-button の
 *   background-color: var(--c-main);  → 解決できず transparent
 *   color: var(--color-white);        → theme.css があるので #ffffff
 * となり、白地に白文字のボタン（＝見えないボタン）になった。
 *
 * theme.css を入れる前は --color-white も未定義で、文字色は継承した
 * 黒のままだった。だから「配色を替えたら消えた」という形で出た。
 * 原因は配色ではなく、この依存関係が保証されていなかったこと。
 *
 * ------------------------------------------------------------------
 * ここで定義する理由（各アプリ側に足さない理由）
 * ------------------------------------------------------------------
 * トークンを必要としているのは auth.css の規則そのものなので、
 * 保証も auth.css が持つのが筋。読み込む側（HTML）の作り方に依存させる
 * と、ページが増えるたび同じ穴が空く。
 *
 * theme.css 側には置かない。あちらは public/event/theme.css と値が対に
 * なっている色の上書き層で、「片方だけ変えない」という制約がある。
 * 角丸やフォントの定義を混ぜると、その対が色の話でなくなる。
 *
 * ------------------------------------------------------------------
 * 二重定義になるページで値が変わらないこと
 * ------------------------------------------------------------------
 * auth.css を読む24ページのうち20ページは style.css も読む（認証系11
 * ページと、card-mail / card-ocr / note-post / short-script /
 * threads-post / x-post の9ページ）。そこでは同じトークンが2回
 * 宣言される。右辺は style.css と同一にしてあるため
 * 結果は変わらない。値を変えるときは css/style.css を直し、ここを
 * 合わせる（tests/unit/css-tokens.mjs が一致を見ている）。
 *
 * style.css が @media の中で上書きしているトークン（--container-padding
 * --header-height --section-space --content-space）は、ここに書くと
 * 後勝ちで幅ごとの値を潰すため置かない。同テストが検出する。
 *
 * 自前の配色を持つアプリ（audio-transcriber / meeting-minutes）は
 * auth.css より後に style.css を読むので、あちらの定義が勝つ。
 */
:root {
  /* 色は theme.css / style.css の --color-* を指すだけ。新しい色は作らない。 */
  --c-main: var(--color-navy);
  --c-main-dark: var(--color-navy-dark);
  --c-accent: var(--color-gold);
  --c-bg: var(--color-white);
  --c-bg-sub: var(--color-off-white);
  --c-text: var(--color-text);
  --c-text-muted: var(--color-text-muted);
  --c-border: var(--color-border);
  --c-border-strong: var(--color-border-strong);

  --font-ja: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --font-en: "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-num: "Inter", "Roboto Mono", ui-monospace, monospace;

  --radius-card: 6px;
  --radius-tag: 4px;
  --radius-button: 4px;
}

/*
 * hidden 属性の保証。
 * このファイルには display を持つクラスがあり、作者スタイルは
 * UA の [hidden]{display:none} より優先されるため hidden が効かなくなる。
 */
[hidden] {
  display: none !important;
}

/* 見た目には出さず、支援技術へは伝える。 */
.auth-visually-hidden {
  position: absolute;
  overflow: hidden;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

/* ---------- 画面全体 ---------- */

.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--c-bg);
}

.auth-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  padding: 32px 16px 40px;
}

/*
 * 上端から詰めるレイアウト（Portal 用）。
 *
 * 既定の縦センタリングは、入力欄が数個のログイン系画面のためのもの。
 * 一覧が縦に伸びる画面に当てると、内容が画面の高さより低いあいだ
 * 上に大きな空白ができ、ヘッダーバーが宙に浮く。
 *
 * 上余白は 0 にして、帯そのものをビューポート上端へ接させる。
 * 文字の逃げは .auth-portal-bar の内側の余白で作る。
 */
.auth-main--top {
  justify-content: flex-start;
  padding-top: 0;
}

/* ログイン・パスワード系のカード幅。要件どおり最大420px。 */
.auth-shell {
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
}

/* 料金プランとPortalは項目が多いため広くとる。 */
.auth-shell--wide {
  max-width: 960px;
}

.auth-shell--medium {
  max-width: 640px;
}

/* ---------- ブランド ---------- */

.auth-brand {
  margin-bottom: 24px;
  text-align: center;
}

.auth-brand__link {
  display: inline-block;
  color: inherit;
  text-decoration: none;
}

.auth-brand__link:hover {
  text-decoration: underline;
}

.auth-brand__name {
  color: var(--c-main);
  font-family: var(--font-en), var(--font-ja);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.3;
}

.auth-brand__owner {
  margin-top: 6px;
  color: var(--c-text-muted);
  font-size: 0.75rem;
  line-height: 1.6;
}

/* ---------- カード ---------- */

.auth-card {
  padding: 24px 20px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  background-color: var(--c-bg);
}

.auth-card__title {
  margin-bottom: 4px;
  font-size: 1.125rem;
  line-height: 1.5;
}

.auth-card__lead {
  margin-bottom: 20px;
  color: var(--c-text-muted);
  font-size: 0.8125rem;
  line-height: 1.8;
}

/* ---------- 入力欄 ---------- */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field__label {
  color: var(--c-text);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5;
}

.auth-field__control {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.auth-field__input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-button);
  background-color: var(--c-bg);
  font-size: 1rem;
  line-height: 1.5;
}

.auth-field__input:focus-visible {
  outline: 2px solid var(--c-main);
  outline-offset: 1px;
}

/* 入力に問題があることを、枠線だけでなくメッセージでも伝える。 */
.auth-field__input[aria-invalid='true'] {
  border-color: #a3221f;
}

.auth-field__toggle {
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-button);
  background-color: var(--c-bg-sub);
  color: var(--c-main);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.auth-field__toggle:hover {
  background-color: var(--c-border);
}

.auth-field__hint {
  color: var(--c-text-muted);
  font-size: 0.75rem;
  line-height: 1.7;
}

/* ---------- チェックボックス ---------- */

.auth-checkbox {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.8125rem;
  line-height: 1.6;
  cursor: pointer;
}

.auth-checkbox__input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

/* ---------- ボタン ---------- */

.auth-button {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--c-main);
  border-radius: var(--radius-button);
  background-color: var(--c-main);
  color: var(--color-white);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.auth-button:hover:not(:disabled) {
  background-color: var(--c-main-dark);
  border-color: var(--c-main-dark);
}

.auth-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.auth-button--ghost {
  margin-top: 10px;
  border-color: var(--c-border-strong);
  background-color: transparent;
  color: var(--c-main);
}

.auth-button--ghost:hover:not(:disabled) {
  background-color: var(--c-bg-sub);
  border-color: var(--c-border-strong);
}

/* ---------- メッセージ ---------- */

/*
 * 色だけに頼らない。
 * 先頭に「エラー」「完了」などの語を必ず出す（ui.js が入れる）。
 */
.auth-message {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 11px 12px;
  border: 1px solid var(--c-border-strong);
  border-left-width: 4px;
  border-radius: var(--radius-tag);
  background-color: var(--c-bg-sub);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.auth-message:focus-visible {
  outline: 2px solid var(--c-main);
  outline-offset: 2px;
}

.auth-message__label {
  flex: 0 0 auto;
  font-weight: 700;
}

.auth-message__label::after {
  content: '：';
}

.auth-message__body {
  flex: 1 1 200px;
}

/* コントラスト比 4.5:1 以上になる濃さを選ぶ。 */
.auth-message[data-kind='error'] {
  border-color: #a3221f;
  background-color: #fdf3f2;
  color: #7a1917;
}

.auth-message[data-kind='success'] {
  border-color: #1f6b3a;
  background-color: #f1f8f3;
  color: #175530;
}

.auth-message[data-kind='info'] {
  border-color: var(--c-main);
  background-color: var(--c-bg-sub);
  color: var(--c-text);
}

/* ---------- リンク群 ---------- */

.auth-links {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--c-border);
}

.auth-links__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.auth-links__list a {
  color: var(--c-main);
}

/* 公開前のリンクは、リンクに見せない。 */
.auth-links__pending {
  color: var(--c-text-muted);
}

.auth-divider {
  margin: 20px 0 16px;
  padding-top: 18px;
  border-top: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: 0.8125rem;
  font-weight: 700;
}

/* ---------- 料金プラン ---------- */

.auth-plans {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.auth-plan {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  background-color: var(--c-bg);
}

.auth-plan__name {
  font-size: 1.0625rem;
  line-height: 1.5;
}

.auth-plan__price {
  margin-top: 8px;
  color: var(--c-main);
  font-family: var(--font-num), var(--font-ja);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.auth-plan__interval {
  margin-left: 6px;
  color: var(--c-text-muted);
  font-size: 0.8125rem;
  font-weight: 400;
}

.auth-plan__features {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
  font-size: 0.8125rem;
  line-height: 1.7;
}

.auth-plan__features li {
  padding-left: 18px;
  position: relative;
}

.auth-plan__features li::before {
  content: '・';
  position: absolute;
  left: 0;
  color: var(--c-accent);
}

.auth-plan__action {
  margin-top: 20px;
}

/* 契約条件の要約。表で並べる。 */
.auth-terms {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  background-color: var(--c-bg);
}

.auth-terms__title {
  margin-bottom: 12px;
  font-size: 1rem;
}

.auth-terms__list {
  display: grid;
  gap: 10px;
  font-size: 0.8125rem;
  line-height: 1.8;
}

.auth-terms__list dt {
  font-weight: 700;
}

.auth-terms__list dd {
  color: var(--c-text-muted);
}

/* ---------- Portal ---------- */

/*
 * ヘッダーバー。
 *
 * ログイン後の作業画面なので、ブランドブロックは置かず、
 * 画面名・肩書き・ログアウトを1本の帯にまとめる。
 * アプリの一覧を画面の上のほうへ持ち上げるための構成。
 *
 * メールアドレスは帯から外し、アカウント情報パネル（.auth-account）へ移した。
 * 帯に残るのは左＝開閉トグル、右＝ログアウトの2つだけ。
 *
 * 折り返しは flex-wrap に任せ、幅ごとの分岐を持たない。
 */
.auth-portal-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  /* 上余白は .auth-main--top が 0 にした分をここで受け持つ。 */
  padding-top: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
}

.auth-portal-bar__identity {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.auth-portal-bar__title {
  font-family: var(--font-en);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
}

/*
 * アカウント情報の開閉トグル。
 *
 * 見出し（h1）の内側に置く。button の子孫は読み上げ上ひとかたまりに
 * 潰れるため、逆向きに h1 を button の中へ入れると見出しが消える。
 *
 * 帯の中では地の文に見せたいので、枠と背景を落として文字だけにする。
 * font: inherit で h1 の書体をそのまま受け取る。
 */
.auth-portal-bar__toggle {
  display: flex;
  gap: 6px;
  align-items: center;
  /* 指で押せる高さを確保する。文字だけでは 25px ほどにしかならない。 */
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.auth-portal-bar__toggle:focus-visible {
  outline: 2px solid var(--c-main);
  outline-offset: 2px;
}

/*
 * 逆三角。開いているあいだは 180 度回して、上向きにする。
 * 状態は aria-expanded だけが持ち、CSS はそれを見る。
 * JS が付け外しする専用クラスを作らないため、表示と支援技術がずれない。
 */
.auth-portal-bar__chevron {
  flex: 0 0 auto;
  color: var(--c-text-muted);
  transition: transform 0.15s ease;
}

.auth-portal-bar__toggle[aria-expanded='true'] .auth-portal-bar__chevron {
  transform: rotate(180deg);
}

/*
 * 帯の右側。API設定トグルとログアウトを並べる。
 * トグルは見出しの内側ではないので、ここでは書体を自前で指定する。
 */
.auth-portal-bar__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  align-items: center;
}

.auth-portal-bar__toggle--api {
  color: var(--c-main);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.4;
}

.auth-portal-bar__logout {
  flex: 0 0 auto;
  width: auto;
  margin-top: 0;
  padding: 7px 14px;
  font-size: 0.8125rem;
}

/*
 * 未設定などの注意を促す帯。
 * 色だけに頼らず、鍵の図と本文の両方で意味を伝える。
 */
.auth-portal-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 12px 16px;
  border: 1px solid var(--c-accent);
  border-radius: var(--radius-card);
  background-color: var(--c-bg-sub);
}

.auth-portal-banner__icon {
  flex: 0 0 auto;
  color: var(--color-gold-text);
}

.auth-portal-banner__body {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.7;
}

/*
 * 導線はページ移動ではなく、同じ画面のパネルを開く操作。
 * したがって a ではなく button にし、見た目だけリンクに寄せる。
 */
.auth-portal-banner__action {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-main);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.auth-portal-banner__action:focus-visible {
  outline: 2px solid var(--c-main);
  outline-offset: 2px;
}

/*
 * アプリのページ式グリッド。
 *
 * ------------------------------------------------------------------
 * PCでも幅を広げない
 * ------------------------------------------------------------------
 * 幅は min(360px, 100%) で固定し、全画面幅で中央へ置く。
 * PCでもスマホと同じ見た目になり、左右に余白が出る。**これは仕様である。**
 *
 * 画面幅ごとに列数を変えると、同じ人が同じアプリを別の位置で覚えることになる。
 * 並べ替え（第2便）を入れる画面では、位置が幅で変わるほうが害が大きい。
 * 詳細は docs/specs/apps-grid-spec-v1.md §3。
 * ------------------------------------------------------------------
 */
.auth-apps {
  width: min(360px, 100%);
  margin-inline: auto;
}

/* 2列×4行＝8枠で1ページ。列数は画面幅で変えない。 */
.auth-apps__page {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-app-card {
  display: flex;
  /* グリップを右上へ重ねるための基準。 */
  position: relative;
}

/* ---------- 並べ替え ---------- */

/*
 * グリップ（移動ハンドル）。実アプリの枠にだけ、右上へ常時出す。
 *
 * touch-action: none は必須。
 * これが無いと、指を動かした瞬間にブラウザがスクロールを始め、
 * pointermove がこちらへ来なくなる。JS の preventDefault だけでは足りない。
 */
.auth-app-card__grip {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 「外す」と同じ 44px。左右で的の大きさが違うと押し分けにくい。 */
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0 12px 0 12px;
  background-color: transparent;
  color: var(--c-text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}

.auth-app-card__grip:hover {
  background-color: var(--c-bg-sub);
  color: var(--c-main);
}

.auth-app-card__grip:focus-visible,
.auth-app-card__remove:focus-visible {
  outline: 2px solid var(--c-main);
  outline-offset: 1px;
}

/*
 * お気に入りから外す。グリップと対称の左上へ置く。
 * 押下領域は 44px。見た目の「×」は小さいが、指の的は大きくとる。
 */
.auth-app-card__remove {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px 0 12px 0;
  background-color: transparent;
  color: var(--c-text-muted);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}

.auth-app-card__remove:hover {
  background-color: var(--c-bg-sub);
  color: #a3221f;
}

/*
 * 掴んでいるあいだの「穴」。
 * 本体はゴーストが持っていくので、ここは空いた場所として見せる。
 */
.auth-app-card--dragging .auth-app-card__link {
  border-style: dashed;
  background-color: var(--c-bg-sub);
  opacity: 0.35;
}

.auth-app-card--dragging .auth-app-card__grip {
  visibility: hidden;
}

/* キーボードで動かしているあいだ、どれを動かしているかを示す。 */
.auth-app-card--moving .auth-app-card__link {
  border-color: var(--c-main);
  box-shadow: 0 0 0 2px var(--c-main);
}

/*
 * ポインターに追従する複製。
 *
 * pointer-events: none が要る。
 * これが無いと、指の下にあるのが常にこの複製になり、
 * 挿入先の枠を拾えなくなる（自分自身の上にしか落とせなくなる）。
 */
.auth-app-card--ghost {
  position: fixed;
  z-index: 100;
  opacity: 0.85;
  pointer-events: none;
  transform: rotate(1.5deg);
}

/*
 * カード全体をリンクにする。
 * 角丸はモックに合わせて 12px。フォームのカード（--radius-card: 6px）
 * より大きく取り、押せる面であることを形でも示す。
 */
.auth-app-card__link {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  padding: 20px 14px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background-color: var(--c-bg);
  color: inherit;
  text-align: center;
  text-decoration: none;
}

.auth-app-card__link:hover {
  border-color: var(--c-border-strong);
  background-color: var(--c-bg-sub);
}

/*
 * アイコン。
 *
 * 中には「名前の1文字目」と、任意で画像が入る。
 * 画像が読めたときだけ ...--image-ready が付き、文字が隠れる。
 * 読めなければ文字が残る＝色付きの角丸に1文字、が代替表示になる。
 */
.auth-app-card__icon {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 44px;
  height: 44px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background-color: var(--c-bg-sub);
  color: var(--c-main);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1;
}

.auth-app-card__icon-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* 読み込めるまでは出さない。壊れた画像の枠を見せないため。 */
  opacity: 0;
}

.auth-app-card__icon--image-ready .auth-app-card__icon-image {
  opacity: 1;
}

.auth-app-card__icon--image-ready .auth-app-card__icon-letter {
  visibility: hidden;
}

.auth-app-card__name {
  font-size: 0.9375rem;
  line-height: 1.5;
}

.auth-app-card__desc {
  color: var(--c-text-muted);
  font-size: 0.75rem;
  line-height: 1.7;
}

/*
 * 空き枠（準備中）。
 *
 * 破線と「準備中」の語の両方で示す。
 * 形だけに頼ると、枠線の違いが見えない人には空きだと分からない。
 * リンクにしないため、押せる見た目（背景・カーソル）も与えない。
 */
.auth-app-card__placeholder {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  border: 1px dashed var(--c-border-strong);
  border-radius: 12px;
  background-color: transparent;
  color: var(--c-text-muted);
  text-align: center;
}

.auth-app-card__plus {
  flex: 0 0 auto;
}

.auth-app-card__pending {
  font-size: 0.75rem;
  line-height: 1.5;
}

/* ---------- ページ送り ---------- */

.auth-apps__pager {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
}

.auth-apps__arrow {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: 50%;
  background-color: var(--c-bg);
  color: var(--c-main);
  cursor: pointer;
}

.auth-apps__arrow:hover:not(:disabled) {
  background-color: var(--c-bg-sub);
  border-color: var(--c-border-strong);
}

/* 端では押せない。押せないことを見た目でも示す。 */
.auth-apps__arrow:disabled {
  opacity: 0.4;
  cursor: default;
}

.auth-apps__arrow:focus-visible,
.auth-apps__dot:focus-visible {
  outline: 2px solid var(--c-main);
  outline-offset: 2px;
}

.auth-apps__dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

/*
 * ドット。
 * 見た目は小さいが、押せる面は 44px 確保する（透明な余白で稼ぐ）。
 */
.auth-apps__dot {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background-color: transparent;
  cursor: pointer;
}

.auth-apps__dot::before {
  display: block;
  width: 8px;
  height: 8px;
  margin-inline: auto;
  border-radius: 50%;
  background-color: var(--c-border-strong);
  content: '';
}

.auth-apps__dot[aria-current='true']::before {
  background-color: var(--c-main);
}

/* ---------- 見出し ---------- */

.auth-apps__heading,
.auth-catalog__heading {
  margin-bottom: 12px;
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ---------- 全アプリ一覧（カタログ） ---------- */

/*
 * お気に入りと同じ幅・同じ中央寄せにする。
 * 上下に並ぶ2つのグリッドで幅が違うと、同じ画面に見えない。
 */
.auth-catalog {
  width: min(360px, 100%);
  margin-block: 28px 0;
  margin-inline: auto;
}

/* 2列。埋め枠は置かないので、行数は件数で決まる。 */
.auth-catalog__page {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-catalog__empty {
  padding: 20px 0;
  color: var(--c-text-muted);
  font-size: 0.8125rem;
  line-height: 1.8;
  text-align: center;
}

/*
 * カタログのカードは、お気に入りの枠に「お気に入りに追加」を足した形。
 * 下にボタンが付くぶん、リンク側の下余白を詰める。
 */
.auth-app-card--catalog {
  flex-direction: column;
}

.auth-app-card--catalog .auth-app-card__link {
  padding-bottom: 12px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  border-bottom-width: 0;
}

/* 押下領域 44px。文字は小さいが的は大きくとる。 */
.auth-app-card__add {
  min-height: 44px;
  padding: 4px 8px;
  border: 1px solid var(--c-border);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background-color: var(--c-bg-sub);
  color: var(--c-main);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

.auth-app-card__add:hover {
  background-color: var(--c-border);
}

.auth-app-card__add:focus-visible {
  outline: 2px solid var(--c-main);
  outline-offset: 2px;
}

/* ---------- お気に入りを初期状態に戻す ---------- */

.auth-apps__message {
  margin-top: 14px;
}

.auth-apps__reset {
  margin-top: 14px;
  text-align: center;
}

/*
 * 取り消せる操作ではないが、日常的に押すものでもない。
 * 目立たせず、しかし探さずに見つかる位置へ置く。
 */
.auth-apps__reset-button {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--c-text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
}

.auth-apps__reset-button:hover {
  color: var(--c-main);
}

.auth-apps__reset-button:focus-visible {
  outline: 2px solid var(--c-main);
  outline-offset: 2px;
}

.auth-apps__confirm {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-tag);
  background-color: var(--c-bg-sub);
  text-align: left;
}

.auth-apps__confirm-text {
  font-size: 0.8125rem;
  line-height: 1.7;
}

.auth-apps__confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.auth-apps__confirm-actions .auth-button {
  width: auto;
  margin-top: 0;
  padding: 9px 16px;
  font-size: 0.8125rem;
}

/* 取り消せない操作。色だけに頼らず「戻す」という語でも示す。 */
.auth-apps__danger {
  border-color: #a3221f;
  background-color: #a3221f;
  color: var(--color-white);
}

.auth-apps__danger:hover:not(:disabled) {
  border-color: #7a1917;
  background-color: #7a1917;
}

/*
 * アカウント情報。ヘッダーバー直下の開閉パネル。
 *
 * 普段は閉じているため、アプリの一覧を押し下げない。
 * 上の余白は帯の margin-bottom が作るので、ここでは持たない。
 */
.auth-account {
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  background-color: var(--c-bg);
}

.auth-account__title {
  margin-bottom: 8px;
  font-size: 0.875rem;
  line-height: 1.5;
}

/*
 * 項目名と値を縦に積む。
 * 1行に繋ぐと、長いメールアドレスと契約状態の区切りが読み取りにくい。
 */
.auth-account__list {
  display: grid;
  gap: 10px;
  font-size: 0.8125rem;
  line-height: 1.8;
}

.auth-account__list dt {
  font-weight: 700;
}

.auth-account__list dd {
  color: var(--c-text-muted);
  word-break: break-all;
}

/* ---------- APIキー設定パネル ---------- */

/*
 * アカウント情報と同じ枠（.auth-account）を土台にして、
 * 中身だけをここで組む。2枚のパネルの見た目を揃えるため。
 */
.auth-api-panel__note {
  margin-bottom: 8px;
  color: var(--c-text-muted);
  font-size: 0.75rem;
  line-height: 1.8;
}

.auth-api-panel__note a {
  color: var(--c-main);
}

/*
 * Google Workspace の紹介。
 * キーの取得手順とは別の話なので、区切り線で分ける。
 *
 * 本文は details で畳んである（portal-spec-v1.md §7-6）。
 */
.auth-api-panel__promo {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
}

/*
 * 「くわしく見る」の押下領域。
 *
 * UA 既定のままだと高さが約30pxで、この画面の他の操作子にそろえた
 * 44px に届かない。上下の余白で伸ばしている。
 *
 * **display は list-item のまま残す。** flex にすれば行の中央へ揃えられるが、
 * 開閉の三角（::marker）が消え、押せば開くことが「くわしく見る」という
 * 字面からしか分からなくなる。触れる手がかりを減らさないほうを採った。
 */
.auth-api-panel__promo summary {
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
}

.auth-api-panel__promo summary:focus-visible {
  outline: 2px solid var(--c-main);
  outline-offset: 2px;
}

.auth-api-panel__promo-title {
  margin-bottom: 6px;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.auth-api-panel__promo-body,
.auth-api-panel__promo-note {
  color: var(--c-text-muted);
  font-size: 0.75rem;
  line-height: 1.8;
}

.auth-api-panel__promo-note {
  margin-top: 6px;
}

.auth-api-panel__promo-body a {
  color: var(--c-main);
}

/*
 * 紹介であることは、表示から落ちてはならない項目。
 * 地の文より小さくせず、途中で改行もさせない。
 */
.auth-api-panel__promo-tag {
  font-weight: 700;
  white-space: nowrap;
}

.auth-api-panel__save {
  margin-top: 14px;
}

/*
 * 保存済みの表示。値そのものは出さず、前後4文字だけ見せる。
 * 全体を出すと、肩越しに見られたときにそのまま持ち出される。
 */
.auth-api-panel__masked {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin-top: 14px;
  font-size: 0.8125rem;
  line-height: 1.8;
}

.auth-api-panel__masked-label {
  flex: 0 0 auto;
  font-weight: 700;
}

.auth-api-panel__masked-value {
  min-width: 0;
  color: var(--c-text-muted);
  font-family: var(--font-num), monospace;
  word-break: break-all;
}

.auth-api-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

/* 帯の中では全幅ボタンにしない。横に並べる。 */
.auth-api-panel__actions .auth-button {
  width: auto;
  margin-top: 0;
  padding: 9px 16px;
  font-size: 0.8125rem;
}

/* 削除は取り消せないので、押す前に一度受け止める。 */
.auth-api-panel__confirm {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-tag);
  background-color: var(--c-bg-sub);
}

.auth-api-panel__confirm-text {
  font-size: 0.8125rem;
  line-height: 1.7;
}

/*
 * 取り消せない操作。色だけに頼らず「削除する」という語でも示す。
 * コントラスト比 4.5:1 以上になる濃さを選ぶ。
 */
.auth-api-panel__danger {
  border-color: #a3221f;
  background-color: #a3221f;
  color: var(--color-white);
}

.auth-api-panel__danger:hover:not(:disabled) {
  border-color: #7a1917;
  background-color: #7a1917;
}

.auth-api-panel__message {
  margin-top: 14px;
}

.auth-badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--c-accent);
  border-radius: var(--radius-tag);
  color: var(--color-gold-text);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.6;
}

/* ---------- 読み込み中 ---------- */

.auth-loading {
  padding: 32px 0;
  color: var(--c-text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ---------- フッター ---------- */

.auth-footer {
  padding: 24px 16px 32px;
  border-top: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: 0.75rem;
  line-height: 1.8;
  text-align: center;
}

.auth-footer a {
  color: inherit;
}

/* ---------- 画面幅 ---------- */

/*
 * アプリのグリッドは画面幅で列数を変えない（常に2列）。
 * 幅ごとの分岐をここに書かないこと（.auth-apps のコメントを参照）。
 */

@media (min-width: 768px) {
  .auth-main {
    padding: 48px 24px 56px;
  }

  /* 一括指定で上余白が戻るため、ここでも 0 に戻す。 */
  .auth-main--top {
    padding-top: 0;
  }

  .auth-card {
    padding: 32px 28px;
  }

  .auth-plans {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* 過度なアニメーションは使わない。切り替えの明滅だけ抑える。 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 法務ページ（/legal/） ---------- */

/*
 * 白基調で読みやすい本文幅にする。
 * 条文が続くため、カード枠で囲わず地の文として組む。
 * スマホ優先で、320px でも読める字送りを保つ。
 */
.auth-legal {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
}

.auth-legal__meta {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: 0.8125rem;
  line-height: 1.8;
}

.auth-legal__body {
  font-size: 0.9375rem;
  line-height: 2;
}

.auth-legal__body h2 {
  margin-top: 40px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-border);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.auth-legal__body h2:first-child {
  margin-top: 0;
}

.auth-legal__body h3 {
  margin-top: 28px;
  margin-bottom: 8px;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.auth-legal__body p {
  margin-bottom: 16px;
}

/* 条項の番号付きリスト。ぶら下げて番号を揃える。 */
.auth-legal__body ol {
  margin: 0 0 16px;
  padding-left: 1.8em;
  list-style: decimal;
}

.auth-legal__body ul {
  margin: 0 0 16px;
  padding-left: 1.8em;
  list-style: disc;
}

.auth-legal__body li {
  margin-bottom: 8px;
}

.auth-legal__body a {
  color: var(--c-main);
}

/*
 * 特商法の表。320px では横スクロールさせず、
 * 見出しと内容を積み上げて読ませる。
 */
.auth-legal__table {
  width: 100%;
  margin-bottom: 24px;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.9;
}

.auth-legal__table th,
.auth-legal__table td {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  text-align: left;
}

.auth-legal__table th {
  border-bottom: 0;
  background-color: var(--c-bg-sub);
  font-weight: 700;
}

.auth-legal__table tr + tr th {
  border-top: 0;
}

.auth-legal__table td {
  border-top: 0;
}

@media (min-width: 768px) {
  .auth-legal__table th,
  .auth-legal__table td {
    display: table-cell;
    width: auto;
    border-top: 1px solid var(--c-border);
  }

  .auth-legal__table th {
    width: 34%;
    border-bottom: 1px solid var(--c-border);
    border-right: 0;
  }

  /*
   * 行の境界は上の行の下罫線が引くため、2行目以降の上罫線を落とす。
   * ここで tr を限定せず td 全体から上罫線を外すと、1行目の td にも
   * 効いてしまい、表の上辺が th の幅（34%）で途切れて右上角が開く。
   */
  .auth-legal__table tr + tr th,
  .auth-legal__table tr + tr td {
    border-top: 0;
  }
}

/* ---------- 申込み前の同意（/pricing/） ---------- */

.auth-consent {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  background-color: var(--c-bg);
}

.auth-consent__title {
  margin-bottom: 12px;
  font-size: 1rem;
}

/*
 * 申込み前の警告。色だけに頼らず、見出し語と枠線でも伝える。
 * コントラスト比 4.5:1 以上を確保する。
 */
.auth-consent__warning {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid #a3221f;
  border-left-width: 4px;
  border-radius: var(--radius-tag);
  background-color: #fdf3f2;
  color: #7a1917;
  font-size: 0.875rem;
  line-height: 1.9;
}

.auth-consent__warning-label {
  flex: 0 0 auto;
  font-weight: 700;
}

.auth-consent__warning-label::after {
  content: '：';
}

.auth-consent__warning-body {
  flex: 1 1 200px;
}

/* 契約条件の確認表。セクションごとに見出しを立てる。 */
.auth-consent__section {
  margin-bottom: 20px;
}

.auth-consent__section-title {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.875rem;
  font-weight: 700;
}

.auth-consent__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  line-height: 1.8;
}

.auth-consent__table th,
.auth-consent__table td {
  padding: 7px 4px;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
}

.auth-consent__table th {
  width: 40%;
  color: var(--c-text-muted);
  font-weight: 400;
}

/* 強調する値。太字と色の両方で示す。 */
.auth-consent__table td[data-emphasis='true'] {
  color: #a3221f;
  font-weight: 700;
}

/* チェックボックス群。 */
.auth-consent__items {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--c-border);
}

.auth-consent__item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.8125rem;
  line-height: 1.8;
  cursor: pointer;
}

.auth-consent__checkbox {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 3px;
}

.auth-consent__item a {
  color: var(--c-main);
}

.auth-consent__required {
  margin-left: 4px;
  color: #a3221f;
  font-size: 0.75rem;
  font-weight: 700;
}

.auth-consent__actions {
  margin-top: 24px;
}

.auth-consent__selected {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-tag);
  background-color: var(--c-bg-sub);
  font-size: 0.8125rem;
  line-height: 1.7;
}
