@import url("https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;500;700;800&display=swap");

/* =========================================================================
   lpadmin — AGAヘアクリニック 管理画面スタイル
   ブランドトーン: メディカルブルー #1492e0 / ディープネイビー #113e88
   アクセント(予約CTA由来のオレンジ) #e37600 / フォント M PLUS Rounded 1c (丸ゴ・Google Fonts)
   実サイト https://agahairclinic.or.jp の site.css から抽出したトークンに準拠
   デザイン方針: 余白広め・大きめ角丸・柔らかい影・軽やかで洗練された印象
   ========================================================================= */

:root {
  --blue:        #1492e0;
  --blue-dark:   #0a82c7;
  --blue-soft:   #eaf5fd;
  --navy:        #123a7a;
  --navy-2:      #1a4b9d;
  --accent:      #f07d1a;   /* CTA(オレンジ) やや明るめに */
  --accent-lite: #ff9532;
  --danger:      #e51c4f;
  --danger-bg:   #fef2f5;
  --success:     #10a56f;
  --success-bg:  #ecfaf4;
  --warn:        #a8620a;
  --warn-bg:     #fff8ee;
  --warn-bd:     #f6d9a8;
  --ink:         #232a33;
  --ink-soft:    #7b8794;
  --line:        #eef2f7;
  --line-2:      #e3e9f0;
  --surface:     #ffffff;
  --surface-2:   #f7fafd;
  --page:        #f0f4f9;
  --radius:      14px;
  --radius-sm:   9px;
  --radius-pill: 999px;
  --shadow-sm:   0 1px 2px rgba(18, 58, 122, .05);
  --shadow:      0 2px 8px rgba(18, 58, 122, .06), 0 1px 3px rgba(18, 58, 122, .05);
  --shadow-lift: 0 10px 30px rgba(18, 58, 122, .12);
  --ease:        cubic-bezier(.4, 0, .2, 1);
  --font: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Yu Gothic", YuGothic, "Hiragino Sans", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  margin: 0;
  background:
    radial-gradient(1200px 400px at 100% -10%, rgba(20, 146, 224, .06), transparent 60%),
    var(--page);
  color: var(--ink);
  line-height: 1.65;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-dark); }

/* ---------- ヘッダー ---------- */
header.top {
  background: linear-gradient(105deg, var(--navy) 0%, var(--navy-2) 55%, var(--blue) 130%);
  color: #fff;
  padding: 0 26px;
  min-height: 62px;
  display: flex;
  gap: 22px;
  align-items: center;
  box-shadow: 0 4px 20px rgba(18, 58, 122, .18);
  position: sticky;
  top: 0;
  z-index: 50;
}
header.top strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .03em;
  display: flex;
  align-items: center;
  gap: 11px;
}
header.top strong::before {                 /* ブランドマーク */
  content: "AGA";
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--navy);
  background: linear-gradient(#fff, #eef4fb);
  padding: 4px 7px;
  border-radius: 6px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
header.top a {
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: color .16s var(--ease), background .16s var(--ease);
}
header.top a:hover { color: #fff; background: rgba(255, 255, 255, .14); }
header.top .badge { margin-left: 2px; }

/* ---------- レイアウト ---------- */
main {
  padding: 30px 26px 72px;
  max-width: 1120px;
  margin: 0 auto;
}
main h2 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  margin: 34px 0 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
main h2::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--blue), var(--navy-2));
}
main h2:first-of-type { margin-top: 4px; }
main h3 { font-size: 15px; font-weight: 700; color: var(--navy); margin: 24px 0 12px; }

/* ---------- カードテーブル ---------- */
table.list {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.list th,
table.list td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}
table.list th {
  background: transparent;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding-top: 16px;
  padding-bottom: 12px;
}
table.list tr:last-child td { border-bottom: none; }
/* 折り返し制御: 本番リンク・日時・操作ボタン列は1行に保つ (LP名と状態バッジは折り返し可)。
   操作列はボタン5個(プレビュー/編集/公開/複製/削除)が収まるよう少しコンパクトにする */
table.list td:nth-child(2),
table.list td:nth-child(3),
table.list td:last-child { white-space: nowrap; }
table.list td:last-child .btn { padding: 8px 13px; }
/* 区切りの無い長いLP名(アンダースコアのみ等)でも列を押し広げず折り返す */
table.list td:first-child { overflow-wrap: anywhere; }
table.list tbody tr { transition: background .14s var(--ease); }
table.list tbody tr:hover { background: var(--surface-2); }
table.list td:first-child a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 700;
  font-size: 14.5px;
}
table.list td:first-child a:hover { color: var(--blue-dark); }

/* ---------- バッジ ---------- */
.badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent-lite), var(--accent));
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 3px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  vertical-align: middle;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(240, 125, 26, .28);
}
.badge.lock { background: linear-gradient(135deg, #f2506f, var(--danger)); box-shadow: 0 2px 5px rgba(229, 28, 79, .28); }
.badge.ok { background: linear-gradient(135deg, #3cbf7c, #1e9e5c); box-shadow: 0 2px 5px rgba(30, 158, 92, .25); }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 17px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--navy);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s var(--ease), background .16s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease), color .16s var(--ease);
}
.btn:hover { border-color: transparent; color: var(--blue-dark); background: var(--blue-soft); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn.primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(20, 146, 224, .32);
}
.btn.primary:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(20, 146, 224, .42); filter: brightness(1.04); }
.btn.danger {
  background: linear-gradient(135deg, #f2506f 0%, var(--danger) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(229, 28, 79, .28);
}
.btn.danger:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(229, 28, 79, .4); filter: brightness(1.04); }
/* 行内の小さい削除(🗑️)は、絵文字がグレー描画で赤地に埋もれるため明るい枠線スタイルにする。ホバーで濃い赤に。 */
.btn.danger.sm {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #f3b1c1;
  box-shadow: none;
}
.btn.danger.sm:hover {
  background: linear-gradient(135deg, #f2506f 0%, var(--danger) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(229, 28, 79, .32);
}
.btn:disabled,
.btn[disabled] {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

/* ---------- 通知ボックス ---------- */
.warn-box,
.err-box {
  padding: 15px 18px;
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
}
.warn-box {
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  color: var(--warn);
}
.err-box {
  background: var(--danger-bg);
  border: 1px solid #f6c2ce;
  color: #c31844;
}
.warn-box .btn,
.err-box .btn { margin-left: auto; }

/* ---------- エディタ ---------- */
.editor-wrap {
  display: flex;
  gap: 0;
  height: calc(100vh - 62px - 48px);
  min-height: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-top: 18px;
}
.tree {
  width: 268px;
  flex: 0 0 268px;
  overflow: auto;
  border-right: 1px solid var(--line);
  font-size: 13px;
  padding: 14px 10px;
  background: var(--surface-2);
}
.tree a {
  display: block;
  padding: 7px 11px;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-sm);
  word-break: break-all;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.tree a:hover { background: var(--blue-soft); color: var(--blue-dark); }
.tree a.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(20, 146, 224, .3);
}
.tree a.active.draft::after { color: #fff; }
.tree a.draft::after { content: "●"; color: var(--accent); margin-left: 6px; font-size: 8px; vertical-align: middle; }
.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pane .bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  background: #fff;
  flex-wrap: wrap;
}
.pane .bar #curfile { font-weight: 700; color: var(--navy); }
.pane .bar #status { color: var(--success); font-size: 12px; font-weight: 600; margin-left: auto; }
.CodeMirror {
  flex: 1;
  height: auto;
  font-size: 13px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.6;
}

/* ---------- 画像ドロップ ---------- */
.drop {
  border: 2px dashed #cdd9e6;
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin: 14px;
  background: var(--surface-2);
  transition: border-color .16s var(--ease), background .16s var(--ease), color .16s var(--ease);
}
.drop code { color: var(--navy); background: var(--blue-soft); padding: 2px 7px; border-radius: 5px; font-weight: 600; }
.drop input[type="text"] {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  min-width: 0;
}
.drop.over { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); }

/* ---------- リスト・差分 ---------- */
ul.plain { list-style: none; padding: 0; margin: 12px 0; }
ul.plain li {
  padding: 11px 15px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 8px;
  word-break: break-all;
  box-shadow: var(--shadow-sm);
}
.diff-del { color: var(--danger); }
.diff-add { color: var(--success); }

/* ---------- フォーム入力 ---------- */
input[type="text"] {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  color: var(--ink);
  min-width: 240px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input[type="text"]:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(20, 146, 224, .14);
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 720px) {
  header.top { flex-wrap: wrap; padding: 10px 16px; min-height: 0; gap: 10px; }
  main { padding: 20px 14px 52px; }
  .editor-wrap { flex-direction: column; height: auto; }
  .tree { width: 100%; flex: 0 0 auto; max-height: 210px; border-right: none; border-bottom: 1px solid var(--line); }
  table.list th:nth-child(2), table.list td:nth-child(2) { display: none; }
}

/* ===== ファイルマネージャ ===== */
.fm { display: flex; height: calc(100vh - 62px - 48px); min-height: 440px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-top: 18px; }
.fm-tree { width: 280px; flex: 0 0 280px; border-right: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; }
.fm-tree-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink-soft); }
#tree { overflow: auto; flex: 1; padding: 6px 4px; }
.tnode { display: flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--ink); user-select: none; white-space: nowrap; }
.tnode:hover { background: var(--blue-soft); }
.tnode.tfile.active { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: #fff; }
.tnode.tfile.active .tl { color: #fff; }
.tnode.draft .tl::after { content: " ●"; color: var(--accent); font-size: 9px; }
.tnode .tw { width: 12px; font-size: 9px; color: var(--ink-soft); }
.tnode .ti { font-size: 13px; }
.tnode .tl { overflow: hidden; text-overflow: ellipsis; }
.tnode.drop-over { outline: 2px dashed var(--blue); outline-offset: -2px; background: var(--blue-soft); }
.tnode.troot .tl { font-weight: 600; }
.fm-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.fm-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; flex-wrap: wrap; }
.fm-bar .curfile { font-weight: 700; color: var(--navy); font-size: 13px; }
.fm-bar .fm-actions { display: flex; gap: 6px; }
.fm-bar .status { margin-left: auto; font-size: 12px; color: var(--success); font-weight: 600; }
.fm-bar .status.err { color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.fm-view { flex: 1; position: relative; min-height: 0; }

/* ---------- ファイル内検索バー ---------- */
.findbar { position: absolute; top: 8px; right: 24px; z-index: 20; display: none; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 5px 8px;
  box-shadow: 0 6px 18px rgba(35, 42, 51, .14); }
.findbar input { border: none; outline: none; font-size: 13px; width: 190px; color: var(--ink); }
.findbar .fcount { font-size: 12px; color: var(--ink-soft); min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.findbar .fnav, .findbar .fclose { border: none; background: none; cursor: pointer; color: var(--ink-soft); font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.findbar .fnav:hover, .findbar .fclose:hover { background: var(--line); color: var(--ink); }
.cm-find-match { background: rgba(255, 214, 102, .45); }
.fm-view .CodeMirror { height: 100%; }
.imgview { height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: repeating-conic-gradient(#f4f7fb 0% 25%, #fff 0% 50%) 50% / 20px 20px; }
.imgview img { max-width: 90%; max-height: 80%; object-fit: contain; box-shadow: var(--shadow-lift); background: #fff; }
.imgview .imgmeta { font-size: 12px; color: var(--ink-soft); }
.infoview, .emptyview { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); font-size: 13px; padding: 20px; text-align: center; }
@media (max-width: 720px) {
  .fm { flex-direction: column; height: auto; }
  .fm-tree { width: 100%; flex: 0 0 auto; max-height: 220px; border-right: none; border-bottom: 1px solid var(--line); }
}

/* ---------- Zip で新規LP ---------- */
.zip-new { display: flex; align-items: center; gap: 12px; margin: 8px 0 4px; }
.zip-new .zip-status { font-size: 12px; color: var(--ink-soft); }

/* 入れ子LPグループ表示・ソート(2026-07-13) */
.list tr.group-head td { background:#eef3f8; font-size:13px; color:#113e88; padding-top:10px; }
.list tr.nested td:first-child { padding-left:24px; }
.list th a { color:inherit; text-decoration:none; }
.list th a:hover { text-decoration:underline; }
.list th a.sort-active { color:#1492e0; }

/* 簡易ログイン */
.login-page { display: flex; justify-content: center; padding: 90px 16px 0; }
/* 2FA コード入力画面: 本体フォームの下に再送/やり直しボタンを縦に並べる */
.login-page.otp { flex-direction: column; align-items: center; gap: 10px; }
.login-sub { width: 100%; max-width: 360px; display: flex; justify-content: center; }
.login-box { width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--line, #d8e0ea); border-radius: 10px; padding: 28px 26px 26px; box-shadow: 0 8px 28px rgba(18, 58, 122, .10); display: flex; flex-direction: column; gap: 14px; }
.login-box h1 { margin: 0 0 4px; font-size: 19px; }
.login-box label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.login-box input { border: 1px solid var(--line, #c9d4e0); border-radius: 6px; padding: 9px 10px; font-size: 14px; }
.login-box .btn { margin-top: 6px; justify-content: center; }
.login-error { margin: 0; padding: 9px 11px; border-radius: 6px; background: #fdecec; color: #b3261e; font-size: 13px; }
header.top .logout-form { margin-left: auto; }
header.top .logout-form button { background: none; border: 1px solid rgba(255, 255, 255, .45); border-radius: 6px; color: #fff; font-size: 12px; padding: 6px 10px; cursor: pointer; }
header.top .logout-form button:hover { background: rgba(255, 255, 255, .12); }
.login-notice { margin: 0; padding: 9px 11px; border-radius: 6px; background: #eef4fd; color: #123a7a; font-size: 13px; }
