/* THE LEGAL 共通テーマ（v3.34・遺産整理ボード isan.t-brn.com と同一トーン）
   tailwind.css の「後」に読み込む上書きレイヤー。
   新しい見た目はすべてここに集約し、tailwind.css は再ビルドしない（v3.23凍結）。
   基準: isan-seiri/webapp/app/static/app.css / pages.css（紺 #1F395E・角丸8/12px・カード）。 */

:root { --navy: #1F395E; --navy-h: #2a4c78; }

/* ── ヘッダー（遺産整理 app.css の .app-header 一式と同一仕様） ── */
.app-header {
  background: var(--navy); color: #fff;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
}
.app-header__home { color: inherit; text-decoration: none; }
.app-header__home:hover { text-decoration: underline; }
.app-header__version { font-size: 12px; opacity: .8; margin-left: 8px; }
.app-header__user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.app-header__user form { display: contents; }
.app-header__link { color: #cdd8ea; text-decoration: none; }
.app-header__link:hover { text-decoration: underline; }
.app-header__logout {
  background: transparent; color: #fff; border: 1px solid #ffffff66; border-radius: 4px;
  padding: 4px 8px; cursor: pointer; font-family: inherit;
}

/* ── ボタン ── */
.btn-primary {
  background: var(--navy); color: #fff; border: 0; border-radius: 8px;
  padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.btn-primary:hover { background: var(--navy-h); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary {
  background: #e5e9ef; color: #4b5563; border: 0; border-radius: 8px;
  padding: 9px 14px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.btn-secondary:hover { background: #d7dce4; }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger {
  background: #fdecec; color: #c02626; border: 0; border-radius: 8px;
  padding: 9px 14px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.btn-danger:hover { background: #f8dcdc; }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; }

/* ── 入力部品 ── */
.tl-input, .tl-select, .tl-textarea {
  width: 100%; border: 1px solid #dfe3e9; border-radius: 8px; padding: 8px 10px;
  font-size: 14px; font-family: inherit; color: #1f2937; background: #fff;
}
.tl-textarea { resize: vertical; }
.tl-input:focus, .tl-select:focus, .tl-textarea:focus {
  outline: 2px solid rgba(31, 57, 94, .35); outline-offset: 0; border-color: var(--navy);
}
.tl-input:disabled, .tl-select:disabled, .tl-textarea:disabled { background: #f3f5f8; color: #9aa3ae; }

/* ── カード・メッセージ ── */
.card {
  background: #fff; border: 1px solid #dfe3e9; border-radius: 12px;
  padding: 16px 18px; box-shadow: 0 1px 2px rgba(16, 38, 68, .04);
}
.card-warn { background: #fdf6e3; border: 1px solid #efe0b0; border-radius: 12px; padding: 12px 16px; }
.msg-error {
  color: #c02626; background: #fdecec; border: 1px solid #f0b3b3; border-radius: 8px;
  padding: 8px 12px; font-size: 13px;
}
.msg-ok { color: #1c7c46; background: #eafaf0; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
/* 大きな状態パネル（文字色は上書きしない・内側の任意テキストを想定） */
.card-ok { background: #eafaf0; border: 1px solid #bfe8cf; border-radius: 12px; padding: 12px 16px; }
.card-error { background: #fdecec; border: 1px solid #f0b3b3; border-radius: 12px; padding: 12px 16px; }

/* ── バッジ ── */
.tl-badge {
  display: inline-block; background: #e5e9ef; color: #6b7280; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 9px; vertical-align: middle;
}
.tl-badge-navy { background: #eaf0f7; color: var(--navy); }
.tl-badge-red { background: #fdecec; color: #c02626; }

/* ── テーブル横スクロール容器 ── */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }

/* ── ログイン画面（遺産整理と同一体裁） ── */
.login-wrap { max-width: 360px; margin: 48px auto; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.login-form input { padding: 8px 10px; border: 1px solid #dfe3e9; border-radius: 8px; font-size: 14px; font-family: inherit; }
.login-form button {
  background: var(--navy); color: #fff; border: 0; border-radius: 8px; padding: 10px;
  cursor: pointer; font-size: 14px; font-weight: 700; font-family: inherit;
}
.login-form button:hover { background: var(--navy-h); }
.login-error { color: #b00020; background: #fdecef; padding: 8px 12px; border-radius: 8px; font-size: 13px; }

/* ── Googleログイン（v3.41・機能ONのときだけ描画される） ── */
.login-sep {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 12px; color: #94a3b8; font-size: 12px;
}
.login-sep::before, .login-sep::after {
  content: ""; flex: 1; height: 1px; background: #e5e9ef;
}
.login-google {
  display: block; text-align: center; text-decoration: none;
  border: 1px solid #dfe3e9; border-radius: 8px; padding: 10px;
  font-size: 14px; font-weight: 700; color: var(--navy); background: #fff;
}
.login-google:hover { background: #f3f6fa; }
.login-note { margin-top: 8px; font-size: 12px; color: #64748b; text-align: center; }

/* ── フィードバック（不具合・要望）ウィジェット＝遺産整理と同一 ── */
.fb-fab {
  position: fixed; bottom: 16px; right: 16px; z-index: 40;
  background: var(--navy); color: #fff; border: 0; border-radius: 999px;
  padding: 10px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit; box-shadow: 0 4px 14px rgba(16, 38, 68, .28);
}
.fb-fab:hover { background: var(--navy-h); }
.fb-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(16, 38, 68, .42);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.fb-modal {
  background: #fff; border-radius: 14px; box-shadow: 0 18px 48px rgba(16, 38, 68, .34);
  width: 100%; max-width: 440px; max-height: 86vh; overflow-y: auto; padding: 18px 20px 16px;
}
.fb-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #eef1f4; padding-bottom: 12px; margin-bottom: 12px;
}
.fb-modal-head h4 { font-size: 16px; margin: 0; color: #1f2937; font-weight: 700; }
.fb-close {
  border: 0; background: #e5e9ef; color: #6b7280; border-radius: 8px; width: 30px; height: 30px;
  font-size: 18px; line-height: 1; cursor: pointer; font-family: inherit;
}
.fb-close:hover { background: #d7dce4; }
.fb-close-text {
  border: 0; background: #e5e9ef; color: #6b7280; border-radius: 8px; padding: 6px 10px;
  font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.fb-close-text:hover { background: #d7dce4; }
.fb-field { display: block; margin-bottom: 10px; }
.fb-lbl { display: block; font-size: 12px; font-weight: 700; color: #6b7280; margin-bottom: 4px; }
.fb-req { color: #c02626; }
.fb-select, .fb-textarea {
  width: 100%; border: 1px solid #dfe3e9; border-radius: 8px; padding: 8px 10px;
  font-size: 14px; font-family: inherit; color: #1f2937;
}
.fb-textarea { resize: vertical; min-height: 96px; }
.fb-count { font-size: 11px; color: #9aa3ae; text-align: right; margin-bottom: 8px; display: block; }
.fb-ctxnote { font-size: 12px; color: #6b7280; margin: 0 0 8px; }
.fb-done { font-size: 13px; color: #1c7c46; background: #eafaf0; border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; }
.fb-err { font-size: 13px; color: #c02626; background: #fdecec; border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; }
.fb-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.fb-cancel {
  background: #e5e9ef; color: #4b5563; border: 0; border-radius: 8px; padding: 9px 16px;
  font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.fb-cancel:hover { background: #d7dce4; }
.fb-submit {
  background: var(--navy); color: #fff; border: 0; border-radius: 8px; padding: 9px 18px;
  font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.fb-submit:hover { background: var(--navy-h); }
.fb-submit:disabled { opacity: .5; cursor: default; }

/* ── スマホ対応（max-width:640px・PC>640pxは不変） ── */
@media (max-width: 640px) {
  /* ヘッダー（遺産整理v1.1のスマホ仕様と同一） */
  .app-header {
    flex-wrap: wrap; gap: 6px 10px; align-items: baseline;
    padding: 10px 12px; position: relative;
  }
  .app-header__title { font-size: 15px; padding-right: 96px; }
  .app-header__version { display: none; }
  .app-header__user { flex-wrap: wrap; gap: 8px 12px; font-size: 13px; width: 100%; }
  .app-header__logout { position: absolute; top: 8px; right: 12px; margin-left: 0; }
  .hide-sm { display: none !important; }

  /* 本文余白を詰める */
  main.max-w-4xl { padding-left: 12px; padding-right: 12px; padding-top: 16px; }

  /* フォームの多カラムを縦積み（維持したいgridには .keep-cols を付ける） */
  main .grid:not(.keep-cols) { grid-template-columns: 1fr !important; }

  /* タップ標的の確保（小型ボタンは表の密度優先で36px） */
  .btn-primary, .btn-secondary, .btn-danger { min-height: 44px; }
  .btn-sm { min-height: 36px; }

  /* iOSは16px未満の入力欄にフォーカスすると画面を自動ズームし「横に突き出た」状態になる → 16pxで抑止 */
  .tl-input, .tl-select, .tl-textarea,
  .login-form input,
  .fb-select, .fb-textarea { font-size: 16px; }
  input[type="file"] { width: 100%; }

  /* テーブルは容器で横スクロール（中身は縮めない） */
  .tablewrap table { min-width: 560px; }

  /* 確認モーダル等をほぼ全画面に（容器に .modal-sheet を付ける） */
  .modal-sheet {
    max-width: none !important; width: 100% !important; margin: 0 !important;
    max-height: 94vh !important; border-radius: 16px 16px 0 0 !important;
    align-self: flex-end;
  }

  /* フィードバックをボトムシート風に（遺産整理v1.1と同じ） */
  .fb-fab { bottom: 12px; right: 12px; }
  .fb-overlay { align-items: flex-end; padding: 0; }
  .fb-modal { max-width: none; max-height: 88vh; border-radius: 16px 16px 0 0; }
}
