/* マイページの全ページ共通のスタイル(色・ヘッダー・ボタン・カードなどの部品)。
   layout.tsのlayout()が最初に読み込み、画面ごとのスタイル
   (project.css・brief-wizard.css・billing.css・auth.css)がこの後に続く */

/* 色・角丸・影・文字の種類の値は、編集オーバーレイと共通のtheme.cssに置く */
@import url("theme.css");

* {
  box-sizing: border-box;
}

/* 本文が短い画面でもフッターを画面の下端に置く(フッターの下に背景が
   見えないように)。本文(main)を伸ばして余りの高さを埋める */
body {
  display:flex;
  flex-direction:column;
  min-height:100vh;
  min-height:100dvh;
  font-family:var(--font-family);
  margin:0;
  color:var(--text);
  background:var(--background);
  font-size:15px;
  line-height:1.7;
}

/* アイコン(src/shared/presentation/icon.tsのicon()で描画するSVG)。
   大きさは周りの文字に合わせ、色は文字色(currentColor)に従う */
.icon {
  width:1.15em;
  height:1.15em;
  flex:0 0 auto;
  vertical-align:-0.2em;
}

/* ── ヘッダー ── */

header.app {
  position:sticky;
  top:0;
  z-index:10;
  background:rgba(255, 255, 255, .92);
  backdrop-filter:saturate(1.4) blur(8px);
  border-bottom:1px solid var(--border);
}

.app-header-inner {
  display:flex;
  align-items:center;
  gap:20px;
  max-width:1200px;
  margin:0 auto;
  padding:10px 20px;
}

header.app a.brand {
  display:inline-flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  font-size:17px;
  letter-spacing:.02em;
  color:var(--text);
  text-decoration:none;
  white-space:nowrap;
}

.brand-logo {
  display:block;
  width:32px;
  height:32px;
}

.app-nav {
  display:flex;
  align-items:center;
  gap:4px;
  margin-left:auto;
}

.app-nav-link {
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:7px 12px;
  border:0;
  border-radius:999px;
  background:none;
  color:var(--text-muted);
  font:inherit;
  font-size:14px;
  font-weight:600;
  text-decoration:none;
  white-space:nowrap;
  cursor:pointer;
}

.app-nav-link:hover {
  background:var(--primary-soft);
  color:var(--primary);
}

/* ログイン中の利用者(頭文字の丸とメールアドレス) */
.app-user {
  display:flex;
  align-items:center;
  gap:8px;
  padding-left:12px;
  border-left:1px solid var(--border);
}

/* 頭文字の丸とメールアドレス(アカウント画面へのリンク) */
.app-user-link {
  display:flex;
  align-items:center;
  gap:8px;
  text-decoration:none;
}

.app-user-avatar {
  display:inline-grid;
  place-items:center;
  width:30px;
  height:30px;
  border-radius:50%;
  background:var(--brand-gradient);
  color:#fff;
  font-size:13px;
  font-weight:700;
}

.app-user-email {
  max-width:200px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--text-muted);
  font-size:13px;
}

/* ── 本文 ── */

/* bodyが縦並びのフレックスなので、width:100%が無いと中身の幅に縮む */
main {
  flex:1 0 auto;
  width:100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

/* 一覧・案件詳細のように、横幅を広く使う画面 */
main:has(.page-wide) {
  max-width:1200px;
}

h1 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 0 4px;
}

h2 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 28px;
}

a {
  color: var(--primary);
}

label {
  display:block;
  font-weight:600;
  font-size:13px;
  margin: 14px 0 4px;
}

input, textarea, select {
  width:100%;
  padding:9px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface);
  font:inherit;
  color:inherit;
}

input:focus, textarea:focus, select:focus {
  outline:2px solid var(--primary-soft);
  border-color:var(--primary);
}

textarea {
  min-height: 70px;
  resize: vertical;
}

.button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  background:var(--primary);
  color:var(--primary-text);
  border:1px solid transparent;
  padding:9px 18px;
  border-radius:999px;
  font:inherit;
  font-size:14px;
  font-weight:700;
  line-height:1.4;
  cursor:pointer;
  text-decoration:none;
  white-space:nowrap;
  box-shadow:0 2px 6px var(--primary-shadow);
  transition:background .12s, box-shadow .12s, transform .06s;
}

.button:hover {
  background:var(--primary-hover);
}

.button:active {
  transform:translateY(1px);
}

.button.secondary {
  background:var(--surface);
  color:var(--text);
  border-color:var(--border);
  box-shadow:var(--shadow-small);
}

.button.secondary:hover {
  border-color:var(--border-strong);
  background:var(--surface-tint);
}

/* 元に戻せない操作(案件の削除など)のボタン */
.button.danger {
  background:var(--danger);
  box-shadow:0 2px 6px rgba(211, 52, 71, .25);
}

.button:disabled {
  opacity:0.5;
  cursor:not-allowed;
}

.muted {
  color:var(--text-muted);
  font-size:13px;
}

.card {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow-small);
  padding:20px;
  margin:12px 0;
}

.list a {
  display:block;
  padding:14px 16px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  margin:8px 0;
  text-decoration:none;
  color:var(--text);
  box-shadow:var(--shadow-small);
}

.list a:hover {
  border-color:var(--border-strong);
  background:var(--surface-tint);
}

.row {
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

/* アカウント画面: 枠の中の見出し(枠の上端との間を空けすぎない) */
.account-section-heading {
  margin-top:0;
}

/* アカウント画面の退会の欄(中の確認ダイアログを含む): 文の途中では
   改行せず、句読点(、。)の後で改行する。句読点の間が1行に収まらない
   ときだけ、途中で折り返す */
.account-deletion-section {
  word-break:keep-all;
  overflow-wrap:anywhere;
}

/* 退会の確認ダイアログ: 有料プランの「キャンセル」「○月○日に退会する」
   「今すぐ退会する」の3つのボタンが1行に並ぶ幅にする(後ろにある
   .confirm-dialogの幅より優先させるため、両方のクラスで指定する) */
.confirm-dialog.account-deletion-dialog {
  width:min(600px, calc(100vw - 32px));
}

/* 今すぐ退会する最終確認のパスワードの入力欄(本文は中央寄せだが、入力欄の
   ラベルは左に揃える) */
.account-deletion-password {
  margin-top:8px;
  text-align:left;
}

/* 今の契約の状態(解約済み・退会の予約中など)の案内 */
.status-notice {
  border-color:var(--warning);
  background:var(--warning-soft);
}

.error {
  background:var(--danger-soft);
  border:1px solid #f5c2c9;
  color:#8f1d2c;
  padding:10px 14px;
  border-radius:10px;
  margin:12px 0;
}

/* 状態を表す小さなラベル。色の種類はsuccess・warn・danger・primaryの4つ */
.badge {
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-size:12px;
  font-weight:700;
  line-height:1.6;
  padding:1px 10px;
  border-radius:99px;
  background:var(--surface-sunken);
  color:var(--text-muted);
  white-space:nowrap;
}

.badge.success {
  background:var(--success-soft);
  color:var(--success);
}

.badge.warn {
  background:var(--warning-soft);
  color:var(--warning);
}

.badge.danger {
  background:var(--danger-soft);
  color:var(--danger);
}

.badge.primary {
  background:var(--primary-soft);
  color:var(--primary);
}

dl.brief {
  display:grid;
  grid-template-columns: 170px 1fr;
  gap:0;
  margin:0;
  font-size:14px;
}

dl.brief dt,
dl.brief dd {
  padding:10px 0;
  border-bottom:1px solid var(--border);
}

dl.brief dt {
  color:var(--text-muted);
  font-weight:600;
}

dl.brief dd {
  margin:0;
  white-space:pre-wrap;
  /* メールアドレス・URLなど、区切りの無い長い値も枠の中で折り返す */
  overflow-wrap:anywhere;
}

dl.brief dt:last-of-type,
dl.brief dd:last-of-type {
  border-bottom:0;
}

/* ── 小さな調整用のクラス ──
   .error/.card/h2の既定マージンを上書きするものがあるため、
   それらの定義より後に置くこと。 */

/* 横並び(.row)の要素を両端に寄せる(見出し＋ボタン等) */
.row-between {
  justify-content:space-between;
}

/* 案件詳細: 公開停止フォーム */
.unpublish-form {
  margin:0;
}

/* ヘッダーのログアウトフォーム */
.logout-form {
  margin:0;
}

/* ── 数字を大きく見せる枠の並び(料金プランの契約の要約など) ── */

.stat-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));
  gap:14px;
  margin-bottom:8px;
}

.stat {
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:18px 20px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow-small);
}

.stat-label {
  color:var(--text-muted);
  font-size:13px;
  font-weight:600;
}

.stat-value {
  font-size:26px;
  font-weight:800;
  line-height:1.3;
}

.stat-value small {
  margin-left:2px;
  font-size:14px;
  font-weight:600;
}

.stat-value-small {
  font-size:18px;
}

/* 値の下に添える補足(次回更新日の欄の「○○ 23:59:59まで」など) */
.stat-note {
  color:var(--text-muted);
  font-size:12px;
}

/* ── 確認ダイアログ ── */

/* 元に戻せない操作の確認などに使う、汎用の確認ダイアログ(<dialog>)。
   タイトルと×のヘッダー、中央寄せの本文とボタンからなる */
.confirm-dialog {
  width:min(480px, calc(100vw - 32px));
  border:0;
  border-radius:var(--radius);
  padding:0;
  overflow:hidden;
  box-shadow:0 8px 24px rgba(0, 0, 0, .25);
}

.confirm-dialog::backdrop {
  background:rgba(0, 0, 0, .35);
}

.confirm-dialog-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px 10px 20px;
  background:var(--background);
  border-bottom:1px solid var(--border);
}

.confirm-dialog-header h2 {
  margin:0;
  font-size:16px;
}

.confirm-dialog-close {
  display:inline-grid;
  place-items:center;
  width:32px;
  height:32px;
  padding:0;
  background:none;
  border:0;
  border-radius:50%;
  color:var(--text-muted);
  cursor:pointer;
}

.confirm-dialog-close:hover {
  background:var(--primary-soft);
  color:var(--primary);
}

.confirm-dialog-close .icon {
  width:20px;
  height:20px;
}

.confirm-dialog-body {
  padding:24px 20px 20px;
  text-align:center;
}

/* 何をするかの確認文(太字)。長い案件名でも折り返す */
.confirm-dialog-message {
  margin:0 0 8px;
  font-weight:700;
  overflow-wrap:anywhere;
}

.confirm-dialog-body .muted {
  margin:0;
}

/* ボタンは中央寄せで、キャンセルを左・実行を右に置く */
.confirm-dialog-actions {
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:12px;
  margin-top:20px;
}

/* ── 画面の見出し・戻るリンク ── */

/* 画面の見出し(h1と補足)と、右側の主な操作ボタン */
.page-head {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:12px;
  margin-bottom:24px;
}

.page-head-note {
  margin:0;
}

.back-link {
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--text-muted);
  font-size:14px;
  font-weight:600;
  text-decoration:none;
}

.back-link:hover {
  color:var(--primary);
}

/* 中身が無いときの案内(アイコンと文) */
.empty-state {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  padding:48px 16px;
  color:var(--text-faint);
  text-align:center;
}

.empty-state .icon {
  width:40px;
  height:40px;
}

/* アイコンだけのボタン(拡大・縮小など) */
.button.icon-button {
  width:38px;
  height:38px;
  padding:0;
}

/* ── フッター(規約・表記のページとお問い合わせ先へのリンク) ── */

.app-footer {
  border-top:1px solid var(--border);
  background:var(--surface);
  padding:20px;
  text-align:center;
  color:var(--text-muted);
  font-size:13px;
}

.app-footer-links {
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:6px 20px;
}

.app-footer-links a {
  color:var(--text-muted);
  text-decoration:none;
}

.app-footer-links a:hover {
  color:var(--primary);
  text-decoration:underline;
}

.app-footer-copyright {
  margin:10px 0 0;
  color:var(--text-faint);
  font-size:12px;
}

/* ── ヘッダーの狭い画面での表示 ── */

@media (max-width: 720px) {
  .app-header-inner {
    gap:8px;
    padding:8px 12px;
  }

  .app-user-email {
    display:none;
  }

  .app-user {
    padding-left:4px;
    border-left:0;
  }

  .app-nav-link {
    padding:6px 8px;
  }
}

@media (max-width: 560px) {
  /* ナビゲーションがある(ログイン中の)ときだけ、
     ロゴの文字を隠して場所を空ける */
  .app-header-inner:has(.app-nav) a.brand {
    font-size:0;
  }

  .app-nav {
    gap:0;
  }

  .app-nav-link {
    font-size:12px;
  }

  /* 横幅に収まらないため、アカウント画面へは頭文字の丸から行く */
  .app-nav-account {
    display:none;
  }
}

/* 選択肢のボタン(ヒアリングのウィザードと、公開サイトの通報のフォームで使う)。
   チェックボックス・ラジオボタンを隠し、ラベル全体を押せるカードにする */
.choices {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(200px,1fr));
  gap:12px;
}

.choice {
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  gap:3px;
  min-height:68px;
  padding:16px 34px;
  border:2px solid var(--border);
  border-radius:14px;
  background:#fff;
  cursor:pointer;
  font-size:15px;
  font-weight:600;
  color:var(--text);
  line-height:1.4;
  /* 日本語を単語の途中で折り返さない(「獲｜得」のような折り返しを防ぐ) */
  word-break:auto-phrase;
  transition:
    transform .06s ease, border-color .12s, background .12s,
    box-shadow .12s;
}

.choice-sub {
  font-weight:400;
  font-size:12px;
  color:var(--text-muted);
}

.choice:hover {
  border-color:var(--border-strong);
  box-shadow:0 3px 10px rgba(0,0,0,.07);
}

.choice:active {
  transform:scale(.98);
}

.choice input {
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.choice:has(input:checked) {
  border-color:var(--primary);
  background:var(--primary-soft);
  box-shadow:0 0 0 1px var(--primary) inset;
}

/* 選んだ選択肢の右上に出すチェック印(選ぶまでは隠しておく)。文字と重ならない
   よう、選択肢の左右の余白の中に収まる大きさの丸にする */
.choice > .icon {
  display:none;
  position:absolute;
  top:8px;
  right:8px;
  width:20px;
  height:20px;
  padding:3px;
  border-radius:50%;
  background:var(--primary);
  color:#fff;
}

.choice:has(input:checked) > .icon {
  display:block;
}

/* 人による操作かを確かめるウィジェット(Turnstile)。フォームの入力欄との間を空ける */
.human-check {
  margin-top:16px;
}

/* 公開サイトの通報のページ。読みやすい幅にし、理由の選択肢は小さめに並べる */
.report-card {
  max-width:720px;
  margin:0 auto;
}

.report-reasons {
  grid-template-columns:repeat(auto-fill,minmax(180px,1fr));
}

.report-reasons .choice {
  min-height:52px;
  font-size:14px;
}

.report-actions {
  margin-top:20px;
}

