.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #ccc;
}

.btn--sub {
  margin-left: 8px;
  background: #ffffff;
}
.note {
  color: #000000;
  font-size: 0.9em;
}

/* ヘッダー */
.app-header {
  background-color: #c8d4ec;
  border-bottom: 1px solid #ddd;
}

/* ユーザー（アイコン＋名前） */
.app-header__user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  margin-left: 12px;
}

.app-header__username {
  font-size: 12px;
  color: #333;
  line-height: 1;
  max-width: 90px;          /* 長い名前対策 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右側エリア全体（既存のままでOK） */
.app-header__left,
.app-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ログアウト + ユーザー情報を縦並び */
.app-header__account {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* 右寄せ */
  gap: 6px;
}

/* アイコン＋ユーザー名 */
.app-header__user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

/* button_to が作る form の余白を消す（ズレ防止） */
.app-header__account form {
  margin: 0;
}

/* ログアウトボタン */
.app-header__button {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
}

.app-header__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.app-header__logo {
  height: 28px; 
  width: auto;
  display: block;
}

.app-header__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.app-header__link {
  color: #333;
  text-decoration: none;
  margin-left: 12px;
}

.app-header__link:hover {
  text-decoration: underline;
}

.app-header__logo {
  color: #111;
  text-decoration: none;
  font-weight: bold;
}

.app-header__avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
  margin-left: 12px;
}

/* 全体 */
body {
  margin: 0;
  color: #222;
  background-color:#FFF3E3;
}

/* 本文エリア */
.app-main {
  padding: 24px 0;
  min-height: calc(100vh - 120px); 
}

/* 画面の横幅 */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.card {
  background: #cad0eb;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
/* タグ */
.tag-item a {
  display: inline-block;
  padding: 6px 10px;
  background-color: #e8eee7;
  border: 1px solid #3e41ee;
  border-radius: 9999px;
  text-decoration: none;
}

.tag-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 900px) {
  .tag-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .tag-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* 1列→2列 */
    gap: 6px;
  }

  .tag-item a {
    display: block;       /* カラム幅いっぱいにして揃える */
    text-align: center;
    padding: 6px 8px;
    font-size: 13px;
  }
}

/* タグ入力オートコンプリート */
.tag-autocomplete {
  position: relative;
}

.tag-autocomplete__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  padding: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.tag-autocomplete__item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.tag-autocomplete__item:hover {
  background: #f3f6ff;
}

/* フッター */
.app-footer {
  border-top: 1px solid #e5e5e5;
  background: #c8d4ec;
  padding: 16px 0;
}

.app-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.app-footer__links a {
  color: #333;
  text-decoration: none;
  margin-right: 12px;
}

.app-footer__links a:hover {
  text-decoration: underline;
}

.app-footer__copy {
  color: #666;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.page-title {
  margin: 0;
  font-size: 20px;
}

.btn--primary {
  border: 1px solid #3e41ee;
  background: #ffffff;
}

.search-form {
  margin-top: 12px;
}

.search-form__row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-form__input {
  flex: 1;
  min-width: 240px;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.conditions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.conditions__label {
  color: #333;
  font-size: 0.9em;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 9999px;
  background: #fff;
  font-size: 0.9em;
}

.chip--muted {
  opacity: 0.7;
}

.chip__x {
  text-decoration: none;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 9999px;
  padding: 0 8px;
  line-height: 1.4;
}

.tag-section {
  margin-top: 16px;
}

.tag-section__title {
  font-weight: bold;
  margin-bottom: 8px;
}

.memo-list {
  display: grid;
  gap: 12px;
}

.memo-card {
  background: #cad0eb;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.memo-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.memo-card__date {
  color: #333;
  font-size: 0.9em;
}

.memo-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.memo-card__actions form {
  margin: 0;
  display: inline-block;
}
.memo-card__symptom {
  display: block;
  margin-top: 8px;
  font-weight: bold;
  line-height: 1.4;
  word-break: break-word;
}

.memo-card__sub {
  margin-top: 8px;
  font-size: 0.95em;
  line-height: 1.4;
}

.memo-card__badges {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip--draft {
  background: #fff7d6;
  border-color: #d9b44a;
  color: #6b5300;
}

.chip--published {
  background: #e7f6ea;
  border-color: #68b37a;
  color: #1f5d2d;
}

.chip--draft .chip__x,
.chip--published .chip__x {
  background: rgba(255, 255, 255, 0.7);
}

.memo-card__tags {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* スマホ表示向け */
@media (max-width: 600px) {
  .memo-card {
    padding: 14px;
  }

  .memo-card__head {
    flex-direction: column;
    align-items: stretch;
  }

  .memo-card__actions {
    justify-content: flex-end;
  }
}

/* スマホ表示ヘッダー */
@media (max-width: 600px) {
  .app-main {
    padding-bottom: 160px; /* 大きめに確保 */
  }
}

@media (max-width: 600px) {
  .app-header__nav {
    align-items: flex-start;
    gap: 8px;
  }

  .app-header__right {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .app-header__user {
    margin-left: 0;
  }

  .app-header__username {
    max-width: 72px;
    font-size: 11px;
  }

  .app-header__avatar {
    width: 36px;
    height: 36px;
  }
}
/* スマホ表示フッター */
@media (max-width: 600px) {
  .app-footer {
    padding: 10px 0;
  }

  .app-footer__inner {
    align-items: flex-start;
    gap: 8px;
  }

  .app-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .app-footer__links a {
    margin-right: 0;     /* 既存 margin を打ち消す */
    font-size: 12px;
  }

  .app-footer__copy {
    font-size: 11px;
  }
}
/*フッター内のコピー表記をスマホだけ非表示/2行目に落とす*/
@media (max-width: 600px) {
  .app-footer__inner {
    flex-direction: column;
  }
}

/* スマホ表示検索フォーム */
@media (max-width: 600px) {
  .search-form__row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-form__input {
    min-width: 0;
    width: 100%;
  }

  .search-form__actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;      /* 折り返し */
    gap: 8px;
    justify-content: flex-start;
  }

  .search-form__actions .btn {
    width: auto;
    flex: 0 0 auto;
    text-align: center;
    margin: 0;
    padding: 8px 10px;
    font-size: 13px;
  }
}

/* スマホ表示条件チップ/タグ一覧 */
@media (max-width: 600px) {
  .conditions {
    gap: 6px;
  }

  .chip {
    font-size: 0.85em;
    padding: 5px 8px;
  }

  .tag-item a,
  .tag-link {
    display: block;
    text-align: center;
    padding: 6px 8px;
    font-size: 13px;
  }
}

/* スマホ表示メモカード */
@media (max-width: 600px) {
  .memo-card {
    padding: 12px;
  }

  .memo-card__actions {
    justify-content: flex-start; 
    gap: 6px;
  }

  .favorite-btn {
    padding: 6px 8px;
  }
}
/* フォーム画面（新規/編集） */
@media (max-width: 600px) {
  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .form-actions .btn {
    width: 100%;
    text-align: center;
  }

  .form-step__meta {
    flex-direction: column;
    gap: 6px;
  }

  .form-step__badge {
    min-width: auto;
    width: fit-content;
  }
}
/* 認証画面（ログイン/新規登録/編集） */
@media (max-width: 600px) {
  .auth-card {
    margin: 12px auto;
    padding: 12px;
  }

  .auth-actions .btn {
    width: 100%;
    text-align: center;
  }

  .avatar-row {
    align-items: flex-start;
  }
}

.tag-link {
  display: inline-block;
  padding: 6px 10px;
  background-color: #cdf1bf;
  border: 1px solid #3e41ee;
  border-radius: 9999px;
  text-decoration: none;
}

.empty-state {
  margin: 0;
}

.alert {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid #e5e5e5;
  background: #fff;
}

.alert--error {
  border-color: #e57373;
  background: #fff5f5;
}

.alert__title {
  font-weight: bold;
  margin-bottom: 6px;
}

.alert__list {
  margin: 0;
  padding-left: 18px;
}

.form-card {
  background: #cad0eb;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 16px;
}

.form-card__head {
  margin-bottom: 12px;
}

.form-card__title {
  margin: 0 0 6px;
  font-size: 18px;
}

.form-card__desc {
  margin: 0;
}

.form-steps {
  display: grid;
  gap: 12px;
}

.form-step {
  background: rgba(255,255,255,0.55);
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 12px;
}

.form-step--optional {
  opacity: 0.95;
}

.form-step__meta {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.form-step__badge {
  min-width: 64px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 9999px;
  border: 1px solid #ccc;
  background: #fff;
  font-size: 0.85em;
}

.form-step__title {
  font-weight: bold;
}

.form-step__hint {
  margin-top: 2px;
  color: #333;
  font-size: 0.9em;
  opacity: 0.9;
}

.form-field__label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
}

.form-field__textarea,
.form-field__input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.form-field__help {
  margin: 6px 0 0;
}

.form-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== new/edit ページ見出し ===== */

.page-head {
  margin-bottom: 12px;
}

.page-head--with-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.page-title {
  margin: 0 0 6px;
  font-size: 20px;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 危険ボタン */
.btn--danger {
  border: 1px solid #d9534f;
  background: #fff;
  color: #d9534f;
}

/* 一覧上部のアクション（新規作成ボタン置き場） */
.index-actions {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 12px;
}

.btn--primary {
  background: #4b6cb7;
  border-color: #4b6cb7;
  color: #fff;
}

/* 検索フォーム */
.search-form__row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-form__input {
  flex: 1;
  min-width: 240px;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}

.search-form__actions {
  display: flex;
  gap: 8px;
}

.btn--primary {
  background: #4b6cb7;
  border-color: #4b6cb7;
  color: #fff;
}

/* スマホでボタンが詰まらないように */
@media (max-width: 600px) {
  .search-form__actions {
    width: 100%;
  }
  .search-form__actions .btn {
    flex: 1;
    text-align: center;
  }
}

/* 固定フッターバナー */
.app-footer--fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;

  /* 上に影をつける*/
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.08);
}

/* 固定フッターの高さ分だけ、本文の下に余白を足す */
.app-main {
  padding-bottom: 90px; /* ←フッターの高さに合わせて調整 */
}

/* スマホ向けの折り返し対応 */
.app-footer__inner {
  flex-wrap: wrap;
}

.app-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 認証フォーム */
.auth-card {
  background: #cad0eb;          /* cardと合わせる */
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 20px;
  max-width: 520px;
  margin: 24px auto;
}

.auth-title {
  margin: 0 0 16px;
  font-size: 1.4rem;
}

.auth-form .auth-field {
  margin-bottom: 12px;
}

.auth-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}

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

/* 既存btnに追加：主ボタン */
.btn--primary {
  background: #3e41ee;
  border: 1px solid #3e41ee;
  color: #fff;
}

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

.text-link {
  text-decoration: none;
}
.text-link:hover {
  text-decoration: underline;
}

/* エラーメッセージ枠 */
.auth-errors {
  background: #fff;
  border: 1px solid #e5a3a3;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.auth-errors ul {
  margin: 0;
  padding-left: 18px;
}

/* 認証画面共通 */
.auth-card {
  max-width: 520px;
  margin: 24px auto;
  background: #cad0eb;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 16px;
}

.auth-title {
  margin: 0 0 12px 0;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.auth-field {
  margin-bottom: 12px;
}

.auth-field label {
  display: block;
  margin-bottom: 6px;
}

/* remember_me を横並びに */
.auth-field--inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-field--inline label {
  margin: 0;
}

/* ボタン位置 */
.auth-actions {
  margin-top: 12px;
}

/* エラー表示 */
.auth-errors {
  background: #fff;
  border: 1px solid #e5a3a3;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.auth-errors ul {
  margin: 0;
  padding-left: 18px;
}

/* 既存 .btn に primary を追加 */
.btn--primary {
  background: #3e41ee;
  border: 1px solid #3e41ee;
  color: #fff;
}

/* 新規登録/パスワードをお忘れの方 */
.auth-link {
  display: inline-block;
  margin-top: 8px;
  text-decoration: none;
}

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

/* ユーザー情報編集 */
.auth-label {
  display: inline-block;
  margin-bottom: 6px;
  font-weight: 600;
}

.auth-input {
  width: 100%;
  max-width: 520px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #bbb;
  box-sizing: border-box;
}

.auth-file {
  width: 100%;
  max-width: 520px;
}

.help-text {
  margin: 6px 0 0;
  font-size: 0.9em;
  color: #333;
  opacity: 0.85;
}

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

.avatar-preview {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
}

.avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,0.15);
}

.auth-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-divider {
  margin: 22px 0;
  border: none;
  border-top: 1px solid rgba(0,0,0,0.12);
}

/* 危険操作 */
.btn--danger {
  background: #fff;
  border: 1px solid #cc3a3a;
  color: #b30000;
}

.danger-zone {
  padding: 12px;
  border: 1px solid rgba(204,58,58,0.25);
  border-radius: 10px;
  background: rgba(204,58,58,0.06);
}

.danger-title {
  margin: 0 0 8px;
}

/* button_to が生成する form の余白対策 */
.memo-card__actions {
  border-color: #888;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* お気に入りボタン */
.favorite-btn {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 9999px;
  padding: 6px 10px;
  cursor: pointer;
  line-height: 1;
}

.favorite-btn--on {
  border-color: #d1a800;
}

.favorite-btn:focus-visible {
  outline: 2px solid #3e41ee;
  outline-offset: 2px;
}

.search-form__advanced {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search-form__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.search-form__field label {
  font-size: 12px;
  color: #333;
}

.search-form__select,
.search-form__date {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 600px) {
  .search-form__advanced {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .search-form__field {
    min-width: 0;
  }

  .search-form__select,
  .search-form__date {
    width: 100%;
    box-sizing: border-box;
  }
}

/* ===== Global Loading ===== */
.global-loading {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none; /* 初期非表示 */
}

.global-loading.is-active {
  display: block;
}

.global-loading__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(1px);
}

.global-loading__content {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
}

.global-loading__spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid #d7def8;
  border-top-color: #3e41ee;
  animation: global-loading-spin 0.8s linear infinite;
}

.global-loading__text {
  margin: 0;
  font-size: 13px;
  color: #333;
}

@keyframes global-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Googleアカウントでログイン */
.auth-divider {
  margin: 14px 0;
  text-align: center;
  position: relative;
}

.auth-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid #ddd;
  z-index: 0;
}

.auth-divider span {
  position: relative;
  z-index: 1;
  background: #fff3e3; /* body背景に合わせる */
  padding: 0 8px;
  color: #666;
  font-size: 12px;
}

.auth-google-btn {
  width: 100%;
  text-align: center;
}