/* ============================================================
   我的行事曆（會員自助）— v2 快速版
   命名前綴 mcal-，避免與既有 .mc-* 樣式衝突
   ============================================================ */

.mcal{ display:flex; flex-direction:column; gap:14px; margin-top:8px; }

/* ---------- 頂部身份卡 ---------- */
.mcal-hero{
  position:relative; overflow:hidden;
  background:linear-gradient(135deg,var(--navy-900) 0%,var(--navy-700) 62%,#2B5C86 100%);
  color:#fff; border-radius:var(--radius);
  padding:20px 18px 18px;
}
.mcal-hero::after{
  content:""; position:absolute; right:-46px; top:-46px; width:180px; height:180px;
  border-radius:50%; background:radial-gradient(circle,rgba(209,137,25,.34),transparent 68%);
  pointer-events:none;
}
.mcal-hero-top{ display:flex; align-items:center; gap:12px; position:relative; z-index:1; }
.mcal-av{
  width:52px; height:52px; border-radius:50%; flex:0 0 52px; object-fit:cover;
  border:2px solid rgba(255,255,255,.55); background:rgba(255,255,255,.14);
  display:flex; align-items:center; justify-content:center;
  font-size:18px; font-weight:700; color:#fff;
}
.mcal-hero-id{ min-width:0; flex:1 }
.mcal-hero-id b{ display:block; font-size:17px; font-weight:700; line-height:1.35; }
.mcal-hero-id span{ display:block; font-size:11.5px; letter-spacing:.12em; color:rgba(255,255,255,.62); margin-top:2px; }
.mcal-pill{
  display:inline-flex; align-items:center; gap:5px; white-space:nowrap;
  font-size:11.5px; font-weight:600; padding:5px 10px; border-radius:999px;
  background:rgba(255,255,255,.14); color:#fff;
}
.mcal-pill i{ width:6px; height:6px; border-radius:50%; background:#8FE3B5; box-shadow:0 0 0 3px rgba(143,227,181,.18) }
.mcal-pill.off{ background:rgba(255,255,255,.08); color:rgba(255,255,255,.72) }
.mcal-pill.off i{ background:#D8B288; box-shadow:0 0 0 3px rgba(216,178,136,.16) }

.mcal-share{
  position:relative; z-index:1; margin-top:14px; display:flex; gap:8px; align-items:center;
  background:rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.14);
  border-radius:11px; padding:9px 10px;
}
.mcal-share code{
  flex:1; min-width:0; font-size:11.5px; color:rgba(255,255,255,.82);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-family:ui-monospace,Menlo,monospace;
}
.mcal-share button{
  border:0; background:var(--gold); color:#fff; font-size:11.5px; font-weight:700;
  padding:6px 11px; border-radius:8px;
}
.mcal-share button.ghost{ background:rgba(255,255,255,.16); }
.mcal-share{ flex-wrap:wrap }
.mcal-share code{ flex:1 1 120px }
.mcal-share-btns{ display:flex; gap:6px; width:100% }
.mcal-share-btns button{ flex:1; padding:9px 4px; font-size:12px; white-space:nowrap }
.mcal-share-btns button.share{
  flex:1.4;
  background:linear-gradient(180deg,#E0A445,var(--gold));
  box-shadow:0 6px 14px -8px rgba(209,137,25,.9);
}
@media(min-width:760px){
  .mcal-share-btns{ width:auto; flex:0 0 auto }
  .mcal-share-btns button{ flex:0 0 auto; padding:7px 12px }
}
.mcal-share-note{
  position:relative; z-index:1; margin-top:8px; font-size:11px; line-height:1.65;
  color:rgba(255,255,255,.58);
}
.mcal-share-note b{ color:#E8C88E; font-weight:600; letter-spacing:.04em }

/* ---------- 三個數字 ---------- */
.mcal-stats{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.mcal-stat{
  background:var(--surface); border:1px solid var(--line); border-radius:12px;
  padding:11px 12px; text-align:center;
}
.mcal-stat b{ display:block; font-size:20px; line-height:1.2; color:var(--navy-900); font-weight:700 }
.mcal-stat span{ display:block; font-size:11px; color:var(--muted); margin-top:3px; letter-spacing:.04em }
.mcal-stat.hot b{ color:var(--gold) }

/* ---------- 本週條 ---------- */
.mcal-week{
  display:grid; grid-template-columns:repeat(7,1fr); gap:5px;
  background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:8px;
}
.mcal-day{
  border:1px solid transparent; background:transparent; border-radius:9px;
  padding:7px 2px 6px; text-align:center; cursor:pointer; transition:background .15s,border-color .15s;
}
.mcal-day span{ display:block; font-size:10.5px; color:var(--muted) }
.mcal-day b{ display:block; font-size:14px; color:var(--ink); font-weight:600; margin-top:1px }
.mcal-day em{ display:block; font-size:9.5px; font-style:normal; color:var(--gold); margin-top:2px; height:12px }
.mcal-day.today{ background:var(--navy-50) }
.mcal-day.today b{ color:var(--navy-800) }
.mcal-day.on{ border-color:var(--gold); background:var(--gold-dim) }
.mcal-day.has em{ font-weight:700 }

/* ---------- 分頁 ---------- */
.mcal-tabs{
  display:flex; gap:4px; background:var(--navy-50); border-radius:11px; padding:4px;
  position:sticky; top:calc(var(--head-h) + 4px); z-index:5;
}
.mcal-tab{
  flex:1; border:0; background:transparent; border-radius:8px; padding:9px 4px;
  font-size:13px; font-weight:600; color:var(--muted); transition:background .15s,color .15s;
}
.mcal-tab.on{ background:var(--surface); color:var(--navy-900); box-shadow:0 1px 6px -3px rgba(11,33,53,.4) }
.mcal-tab u{ text-decoration:none; font-size:10.5px; color:var(--gold); font-weight:700; margin-left:3px }

.mcal-pane{ display:none; animation:mcalIn .18s ease both }
.mcal-pane.on{ display:block }
@keyframes mcalIn{ from{opacity:0; transform:translateY(4px)} to{opacity:1; transform:none} }

/* ---------- 卡片 ---------- */
.mcal-card{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:15px 15px 16px;
}
.mcal-card + .mcal-card{ margin-top:12px }
.mcal-h{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:11px }
.mcal-h h3{ font-size:14.5px; font-weight:700; color:var(--navy-900) }
.mcal-h .tip{ font-size:11.5px; color:var(--muted) }
.mcal-note{ font-size:12px; color:var(--muted); line-height:1.7 }

/* ---------- 預約紀錄 ---------- */
.mcal-bk{
  display:flex; gap:11px; padding:11px 0; border-top:1px dashed var(--line);
}
.mcal-bk:first-of-type{ border-top:0 }
.mcal-when{
  flex:0 0 62px; text-align:center; background:var(--navy-50); border-radius:10px;
  padding:6px 2px; height:fit-content;
}
.mcal-when b{ display:block; font-size:15px; color:var(--navy-800); line-height:1.25 }
.mcal-when span{ display:block; font-size:10.5px; color:var(--muted) }
.mcal-bk-main{ flex:1; min-width:0 }
.mcal-bk-main h4{ font-size:13.5px; font-weight:600; color:var(--ink); display:flex; align-items:center; gap:6px; flex-wrap:wrap }
.mcal-bk-main p{ font-size:11.5px; color:var(--muted); margin-top:2px; word-break:break-all }
.mcal-bk-acts{ display:flex; gap:6px; margin-top:8px; flex-wrap:wrap }
.mcal-mini{
  border:1px solid var(--line); background:#fff; color:var(--navy-800);
  font-size:11.5px; font-weight:600; padding:5px 10px; border-radius:8px;
}
.mcal-mini.ok{ border-color:rgba(20,104,74,.35); color:var(--green) }
.mcal-mini.no{ border-color:rgba(192,69,62,.32); color:var(--red) }
.mcal-mini[disabled]{ opacity:.5 }

.mcal-tag{ font-size:10.5px; font-weight:700; padding:2px 7px; border-radius:999px; letter-spacing:.02em }
.mcal-tag.pending{ background:#FFF3DE; color:#A4660B }
.mcal-tag.confirmed{ background:#E4F4EC; color:var(--green) }
.mcal-tag.declined,.mcal-tag.cancelled{ background:#F5EFEC; color:#96685F }
.mcal-tag.done{ background:var(--navy-50); color:var(--navy-700) }
.mcal-tag.synced{ background:#EAF1FF; color:#2E5EA8 }

.mcal-empty{ text-align:center; padding:26px 10px; color:var(--muted); font-size:12.5px }

/* ---------- 表單 ---------- */
.mcal-form{ display:grid; gap:12px }
.mcal-row{ display:grid; gap:5px }
.mcal-row label{ font-size:11.5px; font-weight:600; color:var(--navy-800); letter-spacing:.02em }
.mcal-row .hint{ font-size:11px; color:var(--muted); font-weight:400 }
.mcal-in{
  width:100%; border:1px solid var(--line); background:#fff; border-radius:9px;
  padding:9px 11px; font-size:13.5px; color:var(--ink); transition:border-color .15s,box-shadow .15s;
}
.mcal-in:focus{ outline:0; border-color:var(--gold); box-shadow:0 0 0 3px var(--gold-dim) }
textarea.mcal-in{ min-height:62px; resize:vertical; line-height:1.6 }
.mcal-2{ display:grid; grid-template-columns:1fr 1fr; gap:9px }
.mcal-3{ display:grid; grid-template-columns:repeat(3,1fr); gap:9px }
.mcal-wd{ display:flex; gap:6px; flex-wrap:wrap }
.mcal-wd label{
  display:inline-flex; align-items:center; justify-content:center;
  width:36px; height:34px; border:1px solid var(--line); border-radius:9px;
  font-size:12.5px; font-weight:600; color:var(--muted); cursor:pointer; user-select:none;
}
.mcal-wd input{ position:absolute; opacity:0; width:0; height:0 }
.mcal-wd label.on{ border-color:var(--gold); background:var(--gold-dim); color:#8A5A0B }

.mcal-switch{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:2px 0 }
.mcal-switch b{ font-size:13px; color:var(--ink) }
.mcal-switch span{ font-size:11px; color:var(--muted) }
.mcal-toggle{
  width:46px; height:27px; border-radius:999px; border:0; background:#D8D4CB; position:relative;
  flex:0 0 46px; transition:background .18s;
}
.mcal-toggle i{
  position:absolute; top:3px; left:3px; width:21px; height:21px; border-radius:50%;
  background:#fff; transition:transform .18s; box-shadow:0 1px 3px rgba(0,0,0,.18);
}
.mcal-toggle.on{ background:var(--gold) }
.mcal-toggle.on i{ transform:translateX(19px) }

.mcal-savebar{
  position:sticky; bottom:calc(var(--tab-h) + 10px); z-index:4;
  display:flex; align-items:center; gap:10px; justify-content:space-between;
  background:rgba(255,255,255,.92); backdrop-filter:blur(8px);
  border:1px solid var(--line); border-radius:11px; padding:9px 12px; margin-top:12px;
}
.mcal-savebar span{ font-size:11.5px; color:var(--muted) }
.mcal-savebar span.ok{ color:var(--green); font-weight:600 }
.mcal-btn{
  border:0; border-radius:9px; padding:9px 16px; font-size:13px; font-weight:700;
  background:var(--navy-900); color:#fff;
}
.mcal-btn.gold{ background:var(--gold) }
.mcal-btn.line{ background:#fff; color:var(--navy-900); border:1px solid var(--line) }
.mcal-btn[disabled]{ opacity:.55 }

/* ---------- Google 卡 ---------- */
.mcal-g{ display:flex; align-items:center; gap:10px; margin-bottom:10px }
.mcal-g-ico{
  width:36px; height:36px; border-radius:10px; flex:0 0 36px; background:var(--navy-50);
  display:flex; align-items:center; justify-content:center;
}
.mcal-g-ico svg{ width:19px; height:19px; fill:none; stroke:var(--navy-700); stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round }
.mcal-g-b{ flex:1; min-width:0 }
.mcal-g-b b{ display:block; font-size:13.5px; color:var(--ink) }
.mcal-g-b span{ display:block; font-size:11.5px; color:var(--muted); word-break:break-all }
.mcal-steps{ display:grid; gap:7px; margin:12px 0 2px; counter-reset:s }
.mcal-step{
  display:flex; gap:8px; font-size:12px; color:var(--muted); line-height:1.6;
}
.mcal-step b{
  flex:0 0 18px; height:18px; border-radius:50%; background:var(--navy-50); color:var(--navy-700);
  font-size:10.5px; font-weight:700; display:flex; align-items:center; justify-content:center; margin-top:2px;
}
.mcal-alert{
  font-size:12px; line-height:1.65; padding:9px 11px; border-radius:9px; margin-top:10px;
  background:#FFF8EC; color:#8A5A0B; border:1px solid #F3E1BF;
}
.mcal-alert.err{ background:#FDF0EF; color:#9C3A34; border-color:#F2D3D0 }

/* ---------- 骨架 ---------- */
.mcal-skel{ display:grid; gap:10px }
.mcal-skel i{
  display:block; height:76px; border-radius:12px;
  background:linear-gradient(100deg,#EFEDE7 30%,#F7F5F0 45%,#EFEDE7 60%);
  background-size:220% 100%; animation:mcalSk 1.1s linear infinite;
}
.mcal-skel i:nth-child(1){ height:104px }
@keyframes mcalSk{ from{background-position:120% 0} to{background-position:-60% 0} }

@media(prefers-reduced-motion:reduce){
  .mcal-pane,.mcal-skel i{ animation:none }
}

@media(min-width:760px){
  .mcal-2{ grid-template-columns:1fr 1fr }
  .mcal-bk-main h4{ font-size:14px }
  .mcal-tabs{ position:static }
}

/* ============================================================
   v3：月曆主畫面・3 步引導・設定抽屜
   ============================================================ */

/* ---- 3 步引導 ---- */
.mcal-steps3{ display:grid; gap:8px }
.mcal-steps3.done-row{ grid-template-columns:1fr; }
.mcal-step3{
  display:flex; align-items:center; gap:10px;
  background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:11px 12px;
}
.mcal-step3.ok{ border-color:rgba(20,104,74,.25); background:#F4FAF7 }
.mcal-step3 .num{
  flex:0 0 24px; width:24px; height:24px; border-radius:50%;
  background:var(--navy-50); color:var(--navy-700); font-weight:700; font-size:12px;
  display:flex; align-items:center; justify-content:center;
}
.mcal-step3.ok .num{ background:var(--green); color:#fff }
.mcal-step3 .tx{ flex:1; min-width:0 }
.mcal-step3 .tx b{ font-size:13px; color:var(--ink) }
.mcal-step3 .tx span{ display:block; font-size:11px; color:var(--muted); line-height:1.5 }
.mcal-step3 .mcal-mini{ flex:0 0 auto }

/* ---- 月曆 ---- */
.mcal-cal{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:14px 14px 12px }
.mcal-cal-h{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px }
.mcal-cal-h b{ font-size:15.5px; color:var(--navy-900); font-weight:700 }
.mcal-cal-h .tip{ font-size:11px; color:var(--muted) }
.mcal-nav{ display:flex; gap:6px; align-items:center }
.mcal-nav button{
  min-width:30px; height:30px; padding:0 9px; border-radius:8px;
  border:1px solid var(--line); background:#fff; color:var(--navy-800);
  font-size:13px; font-weight:600;
}
.mcal-cal-wd{ display:grid; grid-template-columns:repeat(7,1fr); text-align:center; font-size:10.5px; color:var(--muted); padding:4px 0 2px }
.mcal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:2px }
.mcal-cell{
  position:relative; border:0; background:transparent; border-radius:9px;
  min-height:46px; padding:7px 0 14px; cursor:pointer; text-align:center;
  transition:background .12s;
}
.mcal-cell b{ font-size:13px; font-weight:600; color:var(--ink); line-height:1 }
.mcal-cell .dots{ position:absolute; left:0; right:0; bottom:5px; display:flex; gap:3px; justify-content:center; height:5px }
.mcal-cell .dots i{ width:5px; height:5px; border-radius:50%; background:var(--gold) }
.mcal-cell .dots i.warn{ background:var(--red) }
.mcal-cell.dim{ cursor:default }
.mcal-cell.dim b{ color:#C8C3B8 }
.mcal-cell.dim .dots{ display:none }
.mcal-cell.today{ background:var(--navy-50) }
.mcal-cell.today b{ color:var(--navy-800) }
.mcal-cell.sel{ background:var(--gold-dim); box-shadow:inset 0 0 0 1.5px var(--gold) }

.mcal-daypanel{ border-top:1px dashed var(--line); margin-top:10px; padding-top:4px }
.mcal-daypanel-h{ display:flex; align-items:baseline; justify-content:space-between; padding:6px 2px 2px }
.mcal-daypanel-h b{ font-size:13.5px; color:var(--navy-900) }
.mcal-daypanel-h span{ font-size:11px; color:var(--muted) }

/* ---- 設定按鈕 / 抽屜 ---- */
.mcal-gear{
  display:flex; align-items:center; gap:8px; width:100%;
  background:var(--surface); border:1px dashed var(--line); border-radius:12px;
  padding:12px 14px; font-size:13px; font-weight:600; color:var(--navy-800);
}
.mcal-gear span{ flex:1; text-align:left }
.mcal-gear u{ text-decoration:none; font-size:11px; color:var(--muted) }

.mcal-fab{
  position:fixed; right:16px; bottom:calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); z-index:40;
  width:52px; height:52px; border-radius:50%; border:0;
  background:var(--navy-900); color:#fff; font-size:21px; line-height:1;
  box-shadow:0 12px 26px -12px rgba(11,33,53,.6);
}
.mcal-fab[aria-label]:active{ transform:scale(.96) }
@media(min-width:760px){ .mcal-fab{ bottom:24px } }

.mcal-sheet-mask{ position:fixed; inset:0; background:rgba(11,33,53,.45); z-index:50; animation:mcalFade .18s ease both }
@keyframes mcalFade{ from{opacity:0} to{opacity:1} }
.mcal-sheet{
  position:fixed; left:0; right:0; bottom:0; z-index:51;
  background:var(--bg); border-radius:18px 18px 0 0;
  max-height:88vh; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:14px 16px calc(20px + env(safe-area-inset-bottom));
  animation:mcalUp .22s ease both;
}
@keyframes mcalUp{ from{ transform:translateY(46px); opacity:0 } to{ transform:none; opacity:1 } }
.mcal-sheet-h{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px }
.mcal-sheet-h b{ font-size:15px; color:var(--navy-900) }
.mcal-sheet-h button{ border:0; background:var(--navy-50); color:var(--navy-700); width:30px; height:30px; border-radius:50%; font-size:15px }
@media(min-width:760px){
  .mcal-sheet{ left:50%; transform:translateX(-50%); width:600px; border-radius:18px; bottom:28px }
  @keyframes mcalUp{ from{ transform:translate(-50%,46px); opacity:0 } to{ transform:translate(-50%,0); opacity:1 } }
}
@media(prefers-reduced-motion:reduce){
  .mcal-sheet,.mcal-sheet-mask{ animation:none }
}

/* ============================================================
   v4：給第一次進來的人——說明卡、區塊標題、第一人稱
   ============================================================ */

/* 頂部說明句 */
.mcal-hero-sub{
  position:relative; z-index:1; margin-top:12px;
  font-size:12.5px; line-height:1.7; color:rgba(255,255,255,.88);
}
.mcal-share-lb{
  flex:0 0 auto; font-size:11px; font-weight:700; letter-spacing:.04em;
  color:rgba(255,255,255,.72); background:rgba(255,255,255,.12);
  padding:3px 8px; border-radius:999px;
}

/* 「這頁是做什麼的」說明卡 */
.mcal-how{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:15px 15px 13px;
}
.mcal-how-t{ font-size:14.5px; font-weight:700; color:var(--navy-900) }
.mcal-how-d{ font-size:12px; color:var(--muted); margin-top:4px; line-height:1.7 }
.mcal-how-d b{ color:var(--ink) }
.mcal-flow{ display:flex; flex-direction:column; margin-top:12px }
.mcal-flow-i{ display:flex; gap:10px; position:relative; padding-bottom:14px }
.mcal-flow-i:last-child{ padding-bottom:0 }
.mcal-flow-i::before{
  content:""; position:absolute; left:13px; top:30px; bottom:2px; width:2px;
  background:var(--line); border-radius:2px;
}
.mcal-flow-i:last-child::before{ display:none }
.mcal-flow-n{
  flex:0 0 27px; width:27px; height:27px; border-radius:50%;
  background:var(--gold-dim); color:#8A5A0B; font-weight:700; font-size:12px;
  display:flex; align-items:center; justify-content:center;
  position:relative; z-index:1;
}
.mcal-flow-t{ flex:1; min-width:0; padding-top:3px }
.mcal-flow-t b{ display:block; font-size:13px; color:var(--ink); line-height:1.4 }
.mcal-flow-t span{ display:block; font-size:11.5px; color:var(--muted); margin-top:2px; line-height:1.55 }

/* 區塊標題（告訴使用者這一區是幹嘛的） */
.mcal-sec{ padding:2px 2px 0 }
.mcal-sec-b{ display:flex; align-items:center; gap:8px }
.mcal-sec-b .idx{
  flex:0 0 20px; width:20px; height:20px; border-radius:6px;
  background:var(--gold); color:#fff; font-size:11px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
}
.mcal-sec-b b{ font-size:14.5px; font-weight:700; color:var(--navy-900) }
.mcal-sec p{ font-size:11.5px; color:var(--muted); margin-top:4px; line-height:1.65; padding-left:28px }

/* 等我處理的行程（集中清單，不用點月曆） */
.mcal-inbox{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:14px 14px 12px;
}
.mcal-inbox-h{ display:flex; align-items:baseline; justify-content:space-between; gap:10px }
.mcal-inbox-h b{ font-size:14.5px; font-weight:700; color:var(--navy-900) }
.mcal-inbox-h span{ font-size:11.5px; color:var(--muted) }
.mcal-inbox-tag{
  display:inline-block; font-size:11px; font-weight:700; letter-spacing:.04em;
  margin:12px 0 2px; padding:4px 9px; border-radius:6px;
}
.mcal-inbox-tag.pend{ background:#FDF3F0; color:#9C3A34 }
.mcal-inbox-tag.ok{ background:#F1F7F4; color:#14684A }
.mcal-irow{ display:flex; gap:11px; padding:11px 0; border-top:1px dashed var(--line) }
.mcal-irow:first-of-type{ border-top:0 }
.mcal-iwhen{
  flex:0 0 86px; background:var(--navy-50); border-radius:10px;
  padding:7px 4px; text-align:center; height:fit-content;
}
.mcal-iwhen b{ display:block; font-size:12px; font-weight:700; color:var(--navy-800); line-height:1.35 }
.mcal-iwhen span{ display:block; font-size:10.5px; color:var(--muted); margin-top:2px }
.mcal-imain{ flex:1; min-width:0 }
.mcal-imain h4{ font-size:13.5px; font-weight:600; color:var(--ink); display:flex; align-items:center; gap:6px; flex-wrap:wrap }
.mcal-imain p{ font-size:11.5px; color:var(--muted); margin-top:2px; word-break:break-all }
