:root {
  --bg: #ffffff;
  --fg: #1c1b22;
  --muted: #6b6a73;
  --line: #e6e5ec;
  --grid-line: #cfcde0;   /* タイムラインの罫線（予定色と区別できるよう少し濃く） */
  --sat-fg: #185fa5;  --sat-bg: #eef4fb;   /* 土曜=青系 */
  --sun-fg: #a32d2d;  --sun-bg: #fbeef0;   /* 日曜・祝日=赤系 */
  --surface: #f6f5fb;

  /* 予定の種別カラー（テーマ差替ポイント） */
  --meeting-bg: #cecbf6;   --meeting-fg: #26215c;
  --busy-bg: #d3d1c7;      --busy-fg: #2c2c2a;
  --location-bg: #9fe1cb;  --location-fg: #04342c;
  --request-bg: #f4c0d1;   --request-fg: #4b1528;
  --fromreq-bg: #faf0f4;   --fromreq-fg: #8a6b78;
  --hidden-bg: #4a4a52;    --hidden-fg: #e9e9ee;

  --radius: 10px;
  --font: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--fg); background: var(--bg); }
a { color: inherit; }

.topbar { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar h1 { font-size: 18px; font-weight: 600; margin: 0; }
.weeknav { display: flex; align-items: center; gap: 8px; }
.datejump { display: inline-flex; align-items: center; gap: 4px; }
.datejump input[type=date] { padding: 5px 8px; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 14px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  color: inherit; text-decoration: none; cursor: pointer; font-size: 14px; }
.btn:hover { background: var(--surface); }
.rolebadge { display: inline-flex; align-items: center; padding: 4px 10px; font-size: 12px;
  font-weight: 500; color: var(--meeting-fg); background: var(--meeting-bg); border-radius: 999px; }

/* トップバーのモード色（一般/プレビュー中がひと目で分かる） */
.topbar.mode-general { background: var(--location-bg); }
.topbar.mode-preview { background: var(--fromreq-bg); }
.modetag { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px;
  background: #fff; color: var(--fg); border: 1px solid var(--line); }

/* 名前クリックのアカウントメニュー（プルダウン） */
.usermenu { position: relative; }
.usermenu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font-size: 14px; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu[open] > summary { background: var(--surface); }
.usermenu .caret { font-style: normal; font-size: 11px; color: var(--muted); }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + 4px); min-width: 210px; z-index: 20;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.usermenu-head { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; }
.usermenu-item { display: block; padding: 10px 12px; border-radius: var(--radius);
  text-decoration: none; color: var(--fg); font-size: 14px; }
.usermenu-item:hover { background: var(--surface); }
.usermenu-item.is-current { font-weight: 500; color: var(--meeting-fg); }
.usermenu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.adminmenu .usermenu-panel { right: auto; left: 0; }
.unknown-note { margin: 12px 16px; padding: 14px 16px; background: var(--surface);
  border-radius: var(--radius); font-size: 14px; line-height: 1.7; }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted);
  padding: 8px 16px; }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }

/* イベントの見た目（種別別） */
.ev { border-radius: 6px; padding: 4px 6px; font-size: 12px; line-height: 1.35; margin-bottom: 4px; }
.ev .time { font-size: 11px; opacity: .8; display: block; }
.ev .evloc { font-size: 11px; opacity: .85; }
.tl-col .ev .evloc { font-size: 10px; }
.ev.normal { background: var(--surface); color: var(--fg); }
.ev.relabel, .ev.meeting { background: var(--meeting-bg); color: var(--meeting-fg); }
.ev.busy { background: var(--busy-bg); color: var(--busy-fg); }
.ev.location { background: var(--location-bg); color: var(--location-fg); }
.ev.request { background: var(--request-bg); color: var(--request-fg); }
.ev.fromrequest { background: var(--fromreq-bg); color: var(--fromreq-fg); border: 1px dashed #e6c4d3; }
.ev.hidden { background: var(--hidden-bg); color: var(--hidden-fg); }

/* PCタイムライン */
.tl { border-top: 1px solid var(--line); overflow-x: auto; }
.tl-row { display: grid; grid-template-columns: 52px repeat(7, 1fr); }
.tl-headrow .tl-gutter { background: var(--surface); border-bottom: 1px solid var(--line); }
.tl-dayhead { padding: 8px; text-align: center; font-size: 13px; font-weight: 600;
  background: var(--surface); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tl-dayhead .tl-add { display: block; width: fit-content; margin: 5px auto 0; padding: 4px 12px;
  font-size: 12px; font-weight: 500; color: var(--request-fg); background: var(--request-bg);
  border-radius: 999px; text-decoration: none; }
.tl-dayhead .tl-add:hover { filter: brightness(0.96); }
/* 曜日ヘッダ: 土=青系 / 日・祝=赤系 */
.tl-dayhead.sat { color: var(--sat-fg); background: var(--sat-bg); }
.tl-dayhead.sun { color: var(--sun-fg); background: var(--sun-bg); }
.tl-dayhead .holname { display: block; font-size: 10px; font-weight: 400; color: var(--sun-fg); }
.list .day.sat h2 { color: var(--sat-fg); }
.list .day.sun h2 { color: var(--sun-fg); }
.list .day .holname { font-size: 11px; font-weight: 400; color: var(--sun-fg); margin-left: 6px; }
.tl-alldayrow { border-bottom: 1px solid var(--line); }
.tl-alldayrow .tl-gutter { font-size: 11px; color: var(--muted); text-align: right;
  padding: 4px 6px; border-right: 1px solid var(--line); }
.tl-alldaycol { border-left: 1px solid var(--line); padding: 4px; min-height: 26px; }
.tl-alldaycol .ev { margin-bottom: 4px; }
.tl-body { display: grid; grid-template-columns: 52px repeat(7, 1fr); position: relative; }
.tl-body .tl-gutter { border-right: 1px solid var(--line); }
.tl-hour { font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px;
  box-sizing: border-box; border-top: 1px solid transparent; }
.tl-col { position: relative; border-left: 1px solid var(--grid-line); }
.tl-line { box-sizing: border-box; border-top: 1px solid var(--grid-line); }
.tl-col .ev { position: absolute; overflow: hidden; margin: 0; box-sizing: border-box;
  font-size: 11px; padding: 2px 5px; border: 1px solid rgba(0, 0, 0, .12); }
.tl-col .ev .time { font-size: 10px; }

/* スマホリスト */
.list { display: none; padding: 8px 12px; }
.list .day { margin-bottom: 16px; }
.list .day h2 { font-size: 15px; margin: 8px 0; padding-bottom: 4px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; }
.list-add { margin-left: auto; padding: 4px 12px; font-size: 12px; font-weight: 500;
  color: var(--request-fg); background: var(--request-bg); border-radius: 999px; text-decoration: none; }
.list-add:hover { filter: brightness(0.96); }
.list .empty { color: var(--muted); font-size: 13px; }

/* 認証ページ */
.auth { max-width: 420px; margin: 8vh auto; padding: 0 20px; }
.auth h1 { font-size: 20px; }
.intro { margin: 0 0 20px; padding: 14px 16px; background: var(--surface); border-radius: var(--radius);
  font-size: 13px; line-height: 1.7; }
.intro h2 { margin: 0 0 8px; font-size: 16px; }
.intro p { margin: 0 0 6px; }
.auth form { display: grid; gap: 12px; margin: 16px 0; }
.auth label { display: grid; gap: 4px; font-size: 14px; }
.auth input, .auth select, .auth textarea { width: 100%; box-sizing: border-box;
  padding: 12px; min-height: 50px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 16px; font-family: inherit; background: #fff; }
.auth textarea { min-height: 84px; }
.auth .error { color: #a32d2d; }
main.auth:not(.review) form button { width: 100%; box-sizing: border-box; font-size: 16px; font-weight: 500;
  padding: 14px 22px; min-height: 52px; border: 0; border-radius: var(--radius); cursor: pointer;
  background: var(--meeting-fg); color: #fff; }
main.auth:not(.review) form button:hover { opacity: .92; }

/* 大きく押しやすいボタン */
.btn-lg { display: inline-block; font-size: 16px; font-weight: 500; padding: 14px 22px;
  min-height: 52px; border: 0; border-radius: var(--radius); cursor: pointer;
  background: var(--meeting-fg); color: #fff; text-align: center; text-decoration: none; }
.btn-lg:hover { opacity: .92; }
.btn-lg.full { width: 100%; }
.btn-lg.secondary { background: var(--surface); color: var(--fg); border: 1px solid var(--line); }

/* 打診レビュー画面 */
.review { max-width: 720px; }
.review-item { padding: 12px; margin-bottom: 12px; }
.review-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.review-form input[type=text] { flex: 1; min-width: 180px; min-height: 48px; padding: 12px;
  font-size: 16px; border: 1px solid var(--line); border-radius: var(--radius); box-sizing: border-box; }

@media (max-width: 720px) {
  .tl { display: none; }
  .list { display: block; }
}

/* 浮遊ヘルプ */
.helpfab { position: fixed; right: 16px; bottom: 16px; z-index: 50; }
.helpfab > summary {
  list-style: none; cursor: pointer; width: 48px; height: 48px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--meeting-fg); color: #fff; font-size: 22px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.helpfab > summary::-webkit-details-marker { display: none; }
.helpfab-panel {
  position: absolute; right: 0; bottom: 60px; width: min(320px, 86vw);
  background: #fff; color: var(--busy-fg); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,.28); font-size: 13px; line-height: 1.6; }
.helpfab-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.helpfab-close { font-size: 20px; line-height: 1; color: var(--muted); background: none;
  border: 0; cursor: pointer; padding: 0 4px; }
.helpfab-sub { font-weight: 700; margin-top: 8px; }
.helpfab-panel ol { margin: 6px 0 0; padding-left: 18px; }
