/* ============================================================
   カルテアプリ 見た目の調整
   ============================================================ */

:root {
  --color-primary: #c56b8a;      /* メインカラー（サロンらしい落ち着いたピンク） */
  --color-primary-dark: #a5486a;
  --color-bg: #f7f3f4;
  --color-card: #ffffff;
  --color-text: #333333;
  --color-muted: #888888;
  --color-border: #e2dcde;
  --color-alert-bg: #fff3f3;     /* 注意事項の目立つ背景 */
  --color-alert-border: #e57373;
  --radius: 10px;
  --max-width: 720px;            /* 画面の最大幅 */
}

* { box-sizing: border-box; }

/* hidden属性は常に非表示にする（.modalなどdisplay指定に負けないように） */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Meiryo", system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

.view {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--color-muted);
}

/* ---------- カード ---------- */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 0 0 4px; }
.subtitle { color: var(--color-muted); margin: 0 0 16px; font-size: 0.9rem; }
/* ブランド名の下に添える小さな説明（例：お客様カルテ） */
.brand-tagline {
  margin: -2px 0 12px;
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 1px;
}

/* ---------- 入力欄 ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: var(--color-muted);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
.field textarea { min-height: 70px; resize: vertical; }

/* ---------- ボタン ---------- */
button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-family: inherit;
}
button.primary {
  background: var(--color-primary);
  color: #fff;
}
button.primary:hover { background: var(--color-primary-dark); }
button.ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
button.ghost:hover { background: #fbeef2; }
button.logout {
  background: transparent;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  padding: 6px 12px;
  font-size: 0.85rem;
}
button.small { padding: 6px 12px; font-size: 0.85rem; }
button.danger { background: #e57373; color: #fff; }
button:disabled { opacity: 0.5; cursor: default; }

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

/* ---------- 上部バー ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.app-topbar { flex-wrap: wrap; }
.user-label { color: var(--color-muted); font-size: 0.85rem; margin-left: 8px; }

/* ---------- ツールバー（検索＋新規） ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input {
  flex: 1;
  min-width: 160px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
}

/* ---------- 一覧 ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}
.list li.clickable { cursor: pointer; }
.list li.clickable:hover { border-color: var(--color-primary); }
.list-title { font-weight: bold; }
.list-sub { color: var(--color-muted); font-size: 0.85rem; }

.empty { color: var(--color-muted); text-align: center; padding: 20px; }

/* ---------- セクション見出し（右にボタン） ---------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

/* ---------- 注意事項エリア（目立たせる） ---------- */
.alert-box {
  background: var(--color-alert-bg);
  border: 1px solid var(--color-alert-border);
  border-left: 5px solid var(--color-alert-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 16px;
}
.alert-box h3 { color: #c62828; }
.alert-box p { margin: 0; white-space: pre-wrap; }

.memo-box { margin-top: 16px; }
.memo-box p { margin: 0; white-space: pre-wrap; color: #555; }

#customer-info p { margin: 4px 0; }
#customer-info .info-label { color: var(--color-muted); font-size: 0.85rem; margin-right: 8px; }

/* ---------- 来店記録 ---------- */
.visit-item .visit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.visit-date { font-weight: bold; }
.visit-staff { color: var(--color-primary); font-size: 0.85rem; }
.visit-field { margin: 4px 0; white-space: pre-wrap; }
.visit-field .info-label { color: var(--color-muted); font-size: 0.8rem; margin-right: 6px; }
.visit-actions { margin-top: 8px; display: flex; gap: 8px; }

/* ---------- 写真（来店記録に添付） ---------- */
.hint { color: var(--color-muted); font-size: 0.78rem; margin: 4px 0 0; }

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}
.photo-thumb {
  position: relative;
  width: 92px;
  height: 92px;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;      /* 正方形に切り取って表示 */
  border-radius: 8px;
  border: 1px solid var(--color-border);
  display: block;
  cursor: zoom-in;
}
.photo-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.7rem;
}
.photo-del:hover { background: #e57373; }
/* 保存済み写真への手書きボタン（左下） */
.photo-draw {
  position: absolute;
  bottom: -6px;
  left: -6px;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.7rem;
}
.photo-draw:hover { background: var(--color-primary, #c56b8a); }

/* 写真の拡大表示（画面いっぱいの黒背景。どこを押しても閉じる） */
.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  cursor: zoom-out;
}
.photo-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

/* ---------- ログイン画面の更新情報（ログインと同じ白い枠） ---------- */
.update-news {
  margin: 16px 0 0;
  padding: 20px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.update-news h2 {
  font-size: 0.9rem;
  color: var(--color-primary-dark);
  margin-bottom: 8px;
}
.update-news ul { margin: 0; padding-left: 18px; }
.update-news li { font-size: 0.85rem; color: #555; margin-bottom: 4px; }
.update-date {
  display: inline-block;
  color: var(--color-muted);
  font-size: 0.75rem;
  margin-right: 8px;
}

/* ---------- 新規登録画面の同意リンク ---------- */
.legal-agree {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin: 4px 0 12px;
  line-height: 1.7;
}
.legal-agree a {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ---------- 店の登録・参加 ---------- */
.setup-block { padding: 12px 0; }
.divider {
  text-align: center;
  color: var(--color-muted);
  margin: 8px 0;
  font-size: 0.85rem;
}

/* ---------- 招待コード表示 ---------- */
.invite-code-display {
  font-size: 1.4rem;
  font-weight: bold;
  letter-spacing: 2px;
  background: #faf4f6;
  border: 1px dashed var(--color-primary);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  color: var(--color-primary-dark);
}

/* ---------- スタッフ管理 ---------- */
.staff-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}
.badge.pending { background: #fff3cd; color: #8a6d3b; }
.badge.active { background: #e0f2e9; color: #2e7d52; }
.badge.disabled { background: #eee; color: #888; }
.badge.owner { background: #f3e5f5; color: #8e44ad; }

/* ---------- メッセージ ---------- */
.message { min-height: 20px; font-size: 0.85rem; margin-top: 8px; }
.message.error { color: #c62828; }
.message.success { color: #2e7d52; }

/* ---------- モーダル ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-content {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

@media (max-width: 480px) {
  h1 { font-size: 1.3rem; }
  .modal-content { padding: 16px; }
}

/* ============================================================
   予約機能（オーナー側）
   ============================================================ */

/* 上部ナビ（予約・メニュー・営業設定などのボタン群） */
.app-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 予約ページの公開URL */
.booking-url-row { display: flex; gap: 8px; margin-bottom: 8px; }
.booking-url-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.85rem;
  background: #faf7f8;
}
.booking-link {
  display: inline-block;
  color: var(--color-primary);
  text-decoration: underline;
  font-size: 0.85rem;
}

/* 予約カレンダー */
.reservation-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.reservation-toolbar select { padding: 8px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 0.9rem; }

.res-date-head {
  font-weight: bold;
  color: var(--color-primary-dark);
  border-bottom: 2px solid var(--color-border);
  padding: 6px 0 4px;
  margin: 14px 0 8px;
}
.res-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.res-item.canceled { border-left-color: #bbb; opacity: 0.7; }
.res-item.noshow { border-left-color: #e0a000; }
.res-item.visited { border-left-color: #2e7d52; }
.res-main { display: flex; gap: 12px; align-items: baseline; flex: 1; min-width: 200px; }
.res-time { font-weight: bold; font-size: 1.05rem; color: var(--color-primary-dark); }
.res-name { font-weight: bold; }
.res-sub { color: var(--color-muted); font-size: 0.82rem; }
.res-status {
  display: inline-block;
  font-size: 0.72rem;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: middle;
}
.res-status.booked { background: #fbeef2; color: var(--color-primary-dark); }
.res-status.visited { background: #e0f2e9; color: #2e7d52; }
.res-status.canceled { background: #eee; color: #888; }
.res-status.noshow { background: #fff3cd; color: #8a6d3b; }
.res-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* メニュー管理 */
.menu-admin-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* 営業設定：曜日ごとの営業時間 */
.hours-editor { display: flex; flex-direction: column; gap: 6px; }
.hours-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-bottom: 1px dashed var(--color-border);
}
.hours-day {
  width: 1.8em;
  text-align: center;
  font-weight: bold;
  background: #faf4f6;
  border-radius: 6px;
  padding: 2px 0;
}
.hours-closed { font-size: 0.82rem; display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.hours-times, .hours-break { font-size: 0.82rem; color: var(--color-muted); display: flex; align-items: center; gap: 4px; }
.hours-row input[type="time"] {
  padding: 5px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.85rem;
}
.hours-row input[type="checkbox"] { width: auto; }

/* 基本設定の注意書き */
.settings-note {
  background: var(--color-alert-bg);
  border: 1px solid var(--color-alert-border);
  border-left: 5px solid var(--color-alert-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: #c62828;
}

/* 臨時休業日 */
.closed-add-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.closed-add-row input { padding: 8px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 0.9rem; }
.closed-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ============================================================
   ネット予約ページ（来院客側 yoyaku.html）
   ============================================================ */
.yoyaku-body { background: var(--color-bg); }
.yoyaku-wrap { max-width: 560px; margin: 0 auto; padding: 16px; }
.yoyaku-header { text-align: center; margin-bottom: 16px; }
.yoyaku-header h1 { color: var(--color-primary-dark); }
.yoyaku-step h2 { display: flex; align-items: center; gap: 8px; }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.85rem;
}
.chosen-menu, .chosen-slot { font-weight: bold; color: var(--color-primary-dark); margin: 0 0 12px; }

/* メニュー選択 */
.menu-select-list { list-style: none; margin: 0; padding: 0; }
.menu-select-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--color-card);
}
.menu-select-item:hover { border-color: var(--color-primary); }
.menu-select-name { font-weight: bold; }
.menu-select-meta { color: var(--color-muted); font-size: 0.85rem; white-space: nowrap; }

/* 空き枠のボタン群 */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.slot-btn {
  background: var(--color-card);
  border: 1px solid var(--color-primary);
  color: var(--color-primary-dark);
  padding: 12px 4px;
  font-size: 1rem;
  font-weight: bold;
}
.slot-btn:hover { background: var(--color-primary); color: #fff; }

/* 完了・キャンセル */
.done-detail p { margin: 4px 0; }
.done-detail .info-label { color: var(--color-muted); font-size: 0.85rem; margin-right: 8px; }
.cancel-link { color: var(--color-primary); text-decoration: underline; font-size: 0.85rem; }
.yoyaku-footer { text-align: center; color: var(--color-muted); font-size: 0.8rem; margin-top: 20px; }

/* 課金（お支払いのお願い・契約状況・管理者一覧） */
.billing-reason {
  background: #fff6e5;
  border: 1px solid #f0c96b;
  color: #6b4e00;
  padding: 12px 14px;
  border-radius: 8px;
  margin: 12px 0;
  line-height: 1.6;
}
.billing-status { color: var(--color-muted); margin: 4px 0 12px; }
.admin-salon-row { display: block; }
.admin-salon-row .list-sub { color: var(--color-muted); font-size: 0.85rem; margin: 2px 0 8px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* パスワード欄の表示/非表示ボタン */
.password-wrap { position: relative; }
.password-wrap input { width: 100%; padding-right: 44px; }
.pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  padding: 4px 6px; line-height: 1; opacity: 0.55;
}
.pw-toggle:hover, .pw-toggle.revealed { opacity: 1; }
.forgot-link-row { text-align: right; margin: 6px 0 0; }
.forgot-link-row a { color: var(--color-primary); font-size: 0.9rem; text-decoration: underline; }
.settings-account-link { display: block; color: var(--color-primary-dark); font-weight: bold; font-size: 1.05rem; text-decoration: none; }
.settings-account-link:hover { text-decoration: underline; }
/* 設定トップのリンクが2つ並ぶときの区切り */
.settings-account-link + .settings-account-link { margin-top: 12px; padding-top: 12px; border-top: 1px solid #eee; }

/* Googleカレンダー連携：購読URLの欄 */
.feed-url-row { display: flex; gap: 8px; align-items: center; }
.feed-url-row input { flex: 1; min-width: 0; font-size: 0.85rem; color: #555; background: #f7f7f7; }
.feed-url-row button { white-space: nowrap; }
/* カレンダーURLの作り直し行 */
.feed-regen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; }
.feed-regen-row .hint { margin: 0; }
.feed-help { margin-top: 10px; font-size: 0.9rem; }
.feed-help summary { cursor: pointer; color: var(--color-primary-dark); }
.feed-help ol { margin: 8px 0 0; padding-left: 1.3em; line-height: 1.7; }

/* 写真の下準備（サムネイル） */
.photo-staging { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.photo-staging-item { width: 110px; }
.photo-staging-item img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--color-border); display: block; }
.photo-staging-actions { display: flex; gap: 4px; margin-top: 4px; }
.photo-staging-actions .photo-draw-btn { flex: 1; }
.photo-staging-actions .photo-del-btn { width: 34px; padding-left: 0; padding-right: 0; }

/* 写真お絵かき（手書き）画面 */
.draw-editor {
  position: fixed; inset: 0; z-index: 1000;
  background: #2b2b2b; display: flex; flex-direction: column;
}
.draw-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  padding: 8px 10px; background: #1f1f1f;
}
.draw-tools-left, .draw-tools-right { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.draw-sep { width: 1px; height: 24px; background: #555; margin: 0 4px; }
.draw-color {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; cursor: pointer;
  background: var(--c); padding: 0;
}
.draw-color.is-active { outline: 3px solid #ffd54f; outline-offset: 1px; }
.draw-size, .draw-btn {
  min-height: 34px; padding: 4px 10px; border-radius: 8px; border: 1px solid #666;
  background: #3a3a3a; color: #fff; cursor: pointer; font-size: 0.9rem;
}
.draw-size.is-active, .draw-btn.is-active { background: var(--color-primary); border-color: var(--color-primary); }
.draw-canvas-wrap {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 8px;
}
.draw-canvas-wrap canvas {
  position: absolute; max-width: 100%; max-height: 100%;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  border-radius: 6px;
}
#draw-canvas { touch-action: none; cursor: crosshair; } /* 描画中に画面がスクロールしないように */

/* 文字入力パネル（自前。標準プロンプトの代わり） */
.draw-text-panel {
  position: absolute; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55); padding: 20px;
}
.draw-text-box {
  width: 100%; max-width: 360px;
  background: #fff; border-radius: 12px; padding: 18px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.draw-text-label { display: block; font-weight: 700; color: #333; margin-bottom: 8px; }
.draw-text-input {
  width: 100%; box-sizing: border-box;
  padding: 12px 14px; font-size: 1.1rem;
  color: #222; background: #fff;
  border: 2px solid var(--color-primary, #c56b8a); border-radius: 8px;
}
.draw-text-input:focus { outline: none; border-color: #333; background: #fffdf7; }
.draw-text-actions { display: flex; gap: 10px; margin-top: 14px; }
.draw-text-actions button { flex: 1; min-height: 44px; }
.draw-text-hint { margin: 12px 2px 0; font-size: 0.85rem; color: #666; }
