:root {
  --pink:        #e4005a;
  --pink-dark:   #c00049;
  --pink-mid:    #ef6b98;
  --rail:        #fbd7e3;
  --ring:        #f6a9c5;
  --ink:         #2f3437;
  --muted:       #8a9199;
  --line:        #e7eaed;
  --bg:          #ffffff;
  --card-radius:  6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px 80px; }

/* ---------- ヘッダー ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
  background: #fff;
}
.site-header .inner {
  max-width: 860px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 16px;
}
.brand {
  font-weight: 700; font-size: 18px; color: var(--pink);
  text-decoration: none; letter-spacing: .02em;
}
.site-header .spacer { flex: 1; }
.avatar { width: 30px; height: 30px; border-radius: 50%; vertical-align: middle; }
.userbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--pink); border-radius: 4px; cursor: pointer;
  padding: 8px 18px; font-size: 14px; font-weight: 700;
  background: #fff; color: var(--pink); text-decoration: none;
  font-family: inherit; transition: background .15s, border-color .15s;
}
.btn:hover { background: #fff3f7; border-color: var(--pink-dark); color: var(--pink-dark); }
/* 副次的なボタンは枠線を弱める */
.btn.ghost { border-color: var(--ring); font-weight: 600; }
.btn.ghost:hover { background: #fff3f7; }
.btn.small { padding: 4px 12px; font-size: 12px; }
.btn.gray { border-color: #d5d9dd; color: #62696f; }
.btn.gray:hover { background: #f4f6f7; border-color: #c3c9ce; color: #4a5157; }
.btn.danger { border-color: #d9534f; color: #c0392b; }
.btn.danger:hover { background: #fdf3f2; border-color: #c0392b; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- 日付見出し ---------- */
.day-head {
  display: flex; align-items: center; gap: 14px;
  margin: 44px 0 10px;
}
.day-head::before {
  content: ""; width: 5px; height: 30px; background: var(--pink); border-radius: 2px;
}
.day-head h2 { font-size: 26px; margin: 0; font-weight: 700; letter-spacing: .01em; }
.day-head .add-day {
  margin-left: auto; opacity: 0; transition: opacity .15s;
}
.day-block:hover .add-day { opacity: 1; }

/* ---------- タイムライン ---------- */
.timeline { position: relative; padding-left: 0; }
.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 78px 56px 1fr;
  align-items: start;
  padding-bottom: 18px;
}
/* 縦のレール */
.tl-item .rail {
  position: relative;
  justify-self: center;
  width: 100%; height: 100%;
  min-height: 60px;
}
.tl-item .rail::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: -18px;
  width: 6px; margin-left: -3px; background: var(--rail);
}
.tl-item:last-child .rail::before { bottom: 50%; }
.tl-item:first-child .rail::before { top: 12px; }

.badge {
  position: absolute; left: 50%; top: 4px; transform: translateX(-50%);
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--pink);
  box-shadow: 0 0 0 3px var(--rail);
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.badge svg { width: 18px; height: 18px; fill: var(--pink); }

/* 時刻 */
.tl-time { text-align: right; padding-right: 4px; padding-top: 2px; }
.tl-time .hm { font-size: 22px; font-weight: 700; color: var(--pink); line-height: 1.25; }
.tl-time .approx { font-size: 13px; color: var(--pink); line-height: 1.3; }

/* カード */
.card {
  position: relative;
  background: #fff; color: var(--ink);
  border: 1.5px solid var(--pink);
  border-radius: var(--card-radius);
  padding: 18px 22px 20px;
  margin-top: 2px;
}
/* 枠線に合わせた吹き出しの矢印（外側=枠色、内側=背景色を1px重ねる） */
.card::before,
.card::after {
  content: ""; position: absolute; top: 13px;
  border-style: solid; border-width: 9px 9px 9px 0;
}
.card::before {
  left: -10px;
  border-color: transparent var(--pink) transparent transparent;
}
.card::after {
  left: -8px;
  border-color: transparent #fff transparent transparent;
}
.card h3 {
  margin: 0 0 12px; font-size: 19px; font-weight: 700; color: var(--ink);
  padding-bottom: 12px; border-bottom: 1px solid var(--rail);
}
.card p { margin: 0; font-size: 14.5px; color: #4a5157; white-space: pre-wrap; }
.card .card-actions {
  margin-top: 14px; display: flex; gap: 8px; opacity: 0; transition: opacity .15s;
}
.tl-item:hover .card-actions { opacity: 1; }
.card-actions button {
  background: #fff; color: var(--pink); border: 1px solid var(--ring);
  border-radius: 3px; padding: 3px 11px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.card-actions button:hover { background: #fff3f7; }

/* 予定を差し込むボタン（項目の間） */
.insert-row {
  grid-column: 1 / -1;
  display: flex; justify-content: center;
  height: 0; opacity: 0; transition: opacity .15s;
}
.tl-gap { position: relative; height: 14px; }
.tl-gap:hover .insert-btn { opacity: 1; }
.insert-btn {
  position: absolute; left: 106px; top: -6px;
  opacity: 0; transition: opacity .15s;
  background: #fff; color: var(--pink); border: 1px dashed var(--ring);
  border-radius: 14px; padding: 2px 14px; font-size: 12px; cursor: pointer;
  font-family: inherit; white-space: nowrap; z-index: 3;
}
.insert-btn:hover { background: #fff3f7; }

.empty-day {
  margin-left: 78px; padding: 22px 0 8px; color: var(--muted); font-size: 14px;
}

/* ---------- 一覧 ---------- */
.plan-list { list-style: none; padding: 0; margin: 0; }
.plan-list li {
  border: 1px solid var(--line); border-radius: 6px;
  padding: 16px 20px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 14px;
}
.plan-list h3 { margin: 0 0 3px; font-size: 17px; }
.plan-list h3 a { color: var(--ink); text-decoration: none; }
.plan-list h3 a:hover { color: var(--pink); }
.plan-list .meta { font-size: 12.5px; color: var(--muted); }
.plan-list .grow { flex: 1; min-width: 0; }

.tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 10px; vertical-align: 1px;
}
.tag.public  { background: #e6f6ec; color: #1a7f45; }
.tag.shared  { background: #fff1e0; color: #a75c00; }
.tag.private { background: #eef0f2; color: #6b7278; }
.tag.role    { background: #fdeaf2; color: var(--pink); }

/* ---------- フォーム ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input[type=text], .field input[type=date], .field input[type=time],
.field input[type=email], .field select, .field textarea {
  width: 100%; padding: 9px 11px; font-size: 14px; font-family: inherit;
  border: 1px solid #d5d9dd; border-radius: 4px; background: #fff; color: var(--ink);
}
.field textarea { min-height: 96px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.row2 { display: flex; gap: 14px; }
.row2 > * { flex: 1; }

.panel {
  border: 1px solid var(--line); border-radius: 8px; padding: 24px; margin-bottom: 28px;
}
.panel h2 { margin: 0 0 18px; font-size: 17px; }

.notice {
  background: #fdeaf2; border-left: 4px solid var(--pink);
  padding: 12px 16px; border-radius: 0 4px 4px 0; font-size: 14px; margin-bottom: 24px;
}
.err { background: #fdecec; border-left-color: #d33; color: #a12020; }

/* アイコン選択 */
.icon-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-pick label { cursor: pointer; }
.icon-pick input { position: absolute; opacity: 0; }
.icon-pick span {
  width: 40px; height: 40px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--line);
}
.icon-pick span svg { width: 18px; height: 18px; fill: #7a828a; }
.icon-pick input:checked + span { border-color: var(--pink); border-width: 2px; box-shadow: 0 0 0 3px var(--rail); }
.icon-pick input:checked + span svg { fill: var(--pink); }

/* モーダル */
.modal-bg {
  position: fixed; inset: 0; background: rgba(20,22,25,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px; overflow: auto; z-index: 50;
}
.modal-bg[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 8px; padding: 28px; width: 100%; max-width: 520px;
}
.modal h2 { margin: 0 0 20px; font-size: 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

.share-list { list-style: none; padding: 0; margin: 0 0 18px; }
.share-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.share-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.hero { text-align: center; padding: 70px 0 50px; }
.hero h1 { font-size: 32px; margin: 0 0 14px; }
.hero p { color: var(--muted); margin: 0 0 30px; }

.plan-desc { color: var(--muted); font-size: 14.5px; margin: 6px 0 0; white-space: pre-wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 18px 0 6px; }
.toolbar .spacer { flex: 1; }

@media (max-width: 560px) {
  .tl-item { grid-template-columns: 62px 46px 1fr; }
  .tl-time .hm { font-size: 18px; }
  .day-head h2 { font-size: 21px; }
  .insert-btn { left: 84px; }
  .empty-day { margin-left: 62px; }
}

/* ---------- Laravel版 追加 ---------- */
.site-header .userbox form { margin: 0; }
.site-header .uname { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice + .notice { margin-top: -14px; }
.day-block { scroll-margin-top: 20px; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline-form { display: inline; margin: 0; }
.share-row-form { display: flex; gap: 8px; align-items: center; }
.share-row-form select { padding: 4px 8px; font-size: 13px; border: 1px solid #d5d9dd; border-radius: 4px; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; font-size: 13px; padding: 8px 10px; border: 1px solid #d5d9dd; border-radius: 4px; background: #f8f9fa; }
.danger-zone { border-color: #f2c9c9; }
.danger-zone h2 { color: #b32d2d; }

/* ---------- 時間を占有する予定（飛行機・電車など） ---------- */
.time-range { display: flex; align-items: center; gap: 8px; }
.time-range input[type=time] { flex: 1; min-width: 0; }
.time-range .tilde { color: var(--muted); font-size: 13px; }

/* 開始→終了の時刻表示 */
.tl-time .to { color: var(--ring); font-size: 13px; line-height: 1.1; margin: 1px 0; }
.tl-time .hm.end { font-size: 18px; color: var(--pink-mid); }

/* レール上の占有バー */
.tl-item .rail .occupied {
  position: absolute; left: 50%; top: 40px; bottom: -18px;
  width: 14px; margin-left: -7px; border-radius: 7px;
  background: repeating-linear-gradient(
    135deg, var(--ring), var(--ring) 5px, var(--rail) 5px, var(--rail) 10px
  );
  z-index: 1;
}
.tl-item.ranged:last-child .rail .occupied { bottom: 0; }

/* カード内の区間バッジ */
.card .span-badge {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--ring); color: var(--ink);
  border-radius: 4px; padding: 4px 12px; font-size: 13px;
  margin-bottom: 12px; font-variant-numeric: tabular-nums;
}
.card .span-badge .dur {
  background: #fff; color: var(--pink); border: 1px solid var(--ring);
  border-radius: 10px; padding: 1px 9px; font-size: 12px; font-weight: 700;
}

/* 時間の重なり警告 */
.card .conflict {
  background: #fff; color: #b3261e; border: 1px solid #e8a9a4;
  border-radius: 4px; padding: 7px 12px; font-size: 13px; font-weight: 600;
  margin-bottom: 12px;
}

@media (max-width: 560px) {
  .tl-time .hm.end { font-size: 15px; }
  .time-range { flex-wrap: wrap; }
}

/* ---------- 種類（アイコン）ごとの入力 ---------- */
.icon-pick label { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 54px; }
.icon-pick em { font-style: normal; font-size: 10.5px; color: var(--muted); line-height: 1.2; text-align: center; }
.icon-pick input:checked ~ em { color: var(--pink); font-weight: 700; }

.detail-field[hidden] { display: none; }

/* カード内の経路表示（羽田空港 → 那覇空港） */
.card .route {
  font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 10px;
  padding-bottom: 10px; border-bottom: 1px solid var(--rail);
}

/* 種類ごとの項目一覧 */
.card .detail-list {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 14px;
  margin: 12px 0 0; font-size: 13.5px;
}
.card .detail-list dt { color: var(--muted); white-space: nowrap; }
.card .detail-list dd { margin: 0; color: var(--ink); }

.card .span-badge .lbl { font-size: 11px; color: var(--muted); }

@media (max-width: 560px) {
  .icon-pick label { width: 46px; }
  .icon-pick em { font-size: 9.5px; }
  .card .span-badge { flex-wrap: wrap; gap: 6px; }
}

/* 移動手段は経路が見出しになる */
.card h3.route-title { font-size: 18px; }
#title-field[hidden] { display: none; }

/* ---------- ヘッダー：スマホはバーガーメニュー ---------- */
.mobile-only { display: none; }

.burger {
  width: 42px; height: 38px; padding: 0;
  background: #fff; border: 1.5px solid var(--ring); border-radius: 4px;
  cursor: pointer; display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
}
.burger span {
  display: block; width: 18px; height: 2px; background: var(--pink);
  border-radius: 1px; transition: transform .18s, opacity .18s;
}
.burger.is-open { border-color: var(--pink); }
.burger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-menu {
  border-top: 1px solid var(--line);
  padding: 6px 20px 14px;
  background: #fff;
}
.nav-menu[hidden] { display: none; }
.nav-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.nav-user .avatar { width: 36px; height: 36px; }
.nav-user-text { min-width: 0; }
.nav-name { font-weight: 700; font-size: 14px; }
.nav-email {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-menu a,
.nav-menu button {
  display: block; width: 100%; text-align: left;
  padding: 13px 2px; font-size: 15px; font-family: inherit;
  color: var(--ink); text-decoration: none;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.nav-menu form { margin: 0; }
.nav-menu a:active { color: var(--pink); }
.nav-menu button { color: var(--muted); border-bottom: 0; }

@media (max-width: 640px) {
  .desktop-only { display: none !important; }
  .mobile-only  { display: block; }
  .burger       { display: flex; }

  .site-header .inner { padding: 10px 16px; }
  .brand { font-size: 16px; }
  .wrap  { padding: 0 16px 60px; }

  /* spacer が効くとボタンが1つずつ折り返してしまう */
  .toolbar { gap: 8px; margin: 14px 0 6px; }
  .toolbar .spacer { display: none; }
  .toolbar .btn { flex: 0 1 auto; }

  .modal { padding: 20px; }
  .row2 { flex-direction: column; gap: 0; }
  .panel { padding: 18px; }
}

/* ---------- 一覧：行全体をクリック可能にする ---------- */
.plan-list li {
  position: relative;
  transition: border-color .15s, box-shadow .15s;
}
/* タイトルのリンクを行全体に広げる（見出しは読み上げ用のリンク文言として残す） */
.plan-list h3 a::after {
  content: ""; position: absolute; inset: 0; border-radius: 6px;
}
.plan-list li:hover {
  border-color: var(--ring);
  box-shadow: 0 1px 6px rgba(228, 0, 90, .12);
}
.plan-list li:has(a:focus-visible) {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--rail);
}
.plan-list h3 a:focus-visible { outline: none; }
/* タグはリンクの上に出す（クリックは行全体に通す） */
.plan-list .tag { position: relative; z-index: 1; pointer-events: none; }
