/* ── 響應式斷點：小螢幕（≤390px iPhone 12）────────────────────── */
@media (max-width: 390px) {
  .m-upload-hero-title { font-size: 20px; }
  .m-upload-single-btn { font-size: 16px; padding: 14px 28px; }
  .m-flight-info-panel { padding: 10px 12px; }
}

/* ── 響應式斷點：中螢幕（≥430px iPhone 14/16 Pro Max）──────────── */
@media (min-width: 430px) and (max-width: 640px) {
  .m-upload-hero-icon { width: 100px; height: 100px; border-radius: 30px; }
  .m-upload-hero-icon svg { width: 52px; height: 52px; }
  .m-upload-hero-title { font-size: 24px; }
  .m-flight-info-panel { padding: 14px 20px; }
}

/* ══════════════════════════════════════════
   VISUAL REDESIGN OVERRIDES (2026/04)
══════════════════════════════════════════ */
:root {
  --border-new: rgba(60,60,67,.15);
  --success-new: #30d158;
  --danger-new: #ff3b30;
  --card-shadow: 0 2px 16px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
}
/* Nav */
.m-nav {
  height: calc(58px + env(safe-area-inset-bottom,0px)) !important;
  background: var(--nav-bg) !important;
  backdrop-filter: saturate(180%) blur(32px) !important;
  -webkit-backdrop-filter: saturate(180%) blur(32px) !important;
  border-top: 0.5px solid rgba(0,0,0,.14) !important;
}
.m-nav-btn { font-size: 10px !important; font-weight: 500 !important; padding: 6px 2px 4px !important; }
.m-nav-btn svg { width: 24px !important; height: 24px !important; }
.m-views { bottom: calc(58px + env(safe-area-inset-bottom,0px)) !important; }
/* Calendar cells */
.m-cal-scroll .cal-cell {
  border-radius: 11px !important; min-height: 0 !important;
  border: 1px solid var(--hairline) !important;
}
.m-cal-scroll .cal-day-num { font-size: 11px !important; }
.m-cal-scroll .cal-duty    { font-size: 8.5px !important; }
.cal-grid { gap: 2px !important; }
/* Today highlight */
.m-cal-scroll .cal-cell.cal-today .cal-day-num {
  background: var(--accent); color: #fff !important;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
/* Modal sheet */
.m-modal-sheet {
  border-radius: 22px 22px 0 0 !important;
  box-shadow: 0 -4px 32px rgba(0,0,0,.14) !important;
}
/* Upload btn */
.m-upload-overlay-btn { border-radius: 16px !important; font-size: 17px !important; box-shadow: 0 6px 22px rgba(0,122,255,.28) !important; }
/* ── Tinder swipe view ── */
#m-view-swipe { background: var(--bg); }
#m-view-swipe.active { display: flex; flex-direction: column; }
.swipe-subhdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: var(--nav-bg);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 0.5px solid var(--border); flex-shrink: 0;
}
.swipe-subhdr-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--accent);
  font-family: var(--sans); font-size: 15px; font-weight: 500; cursor: pointer; position: relative;
}
.pub-back-title {
  font-family: var(--sans); font-size: 16px; font-weight: 600; color: var(--text);
  position: absolute; left: 50%; transform: translateX(-50%);
}
.swipe-subhdr.pub-back-hdr { position: relative; }
.swipe-matches-badge {
  position: absolute; top: -2px; right: -10px;
  background: var(--danger); color: #fff; border-radius: 10px;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 11px; font-weight: 700; display: none;
  align-items: center; justify-content: center;
}
.swipe-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px 16px 0; overflow: hidden; }
.swipe-stack { position: relative; width: 100%; max-width: 400px; }
.sw-card {
  position: absolute; top: 0; left: 0; right: 0;
  background: var(--surface); border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.07);
  padding: 18px 18px 16px; touch-action: none; cursor: grab;
  will-change: transform; transform-origin: center 115%;
  user-select: none; -webkit-user-select: none;
}
.sw-card:active { cursor: grabbing; }
.sw-card.sw-top   { z-index: 10; }
.sw-card.sw-back1 { z-index: 5;  transform: scale(.95) translateY(14px); pointer-events: none; }
.sw-card.sw-back2 { z-index: 1;  transform: scale(.90) translateY(28px); pointer-events: none; }
.sw-hint { position: absolute; top: 18px; padding: 5px 13px; border-radius: 10px; font-size: 16px; font-weight: 800; opacity: 0; pointer-events: none; border: 2.5px solid; letter-spacing: .5px; }
.sw-hint-skip { right: 18px; color: var(--danger); border-color: var(--danger); }
.sw-hint-like { left: 18px;  color: var(--success); border-color: var(--success); }
.sw-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sw-rank { padding: 4px 12px; border-radius: 10px; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.sw-rank-CA { background: rgba(0,122,255,.12); color: var(--accent); }
.sw-rank-AP { background: rgba(94,92,230,.12); color: var(--purple); }
.sw-rank-DP { background: rgba(255,159,10,.14); color: var(--duty-long-text); }
.sw-rank-CP { background: rgba(48,209,88,.12); color: var(--duty-short-text); }
.sw-month { font-size: 13px; color: var(--text-dim); }
.sw-cal { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: 14px; }
.sw-cal-dh { text-align: center; font-family: var(--mono); font-size: 9px; font-weight: 700; color: var(--text-dim); padding: 0 0 4px; }
.sw-cal-dh:first-child { color: var(--danger); } .sw-cal-dh:last-child { color: var(--accent); }
.sw-cal-cell { border-radius: 7px; min-height: 48px; display: flex; flex-direction: column; align-items: center; padding: 3px 1px 2px; }
.sw-cal-num { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--text-4); line-height: 1.3; }
.sw-cal-cell.sw-has .sw-cal-num { color: var(--text); font-weight: 700; }
.sw-cal-lbl { font-family: var(--mono); font-size: 12px; text-align: center; color: var(--text-2); line-height: 1.25; margin-top: 2px; word-break: break-all; }
.sw-dc-flight  { background: rgba(0,122,255,.1); } .sw-dc-standby { background: rgba(255,159,10,.14); }
.sw-dc-ground  { background: rgba(48,209,88,.12); } .sw-dc-leave   { background: rgba(142,142,147,.1); }
.sw-note { margin-top: 12px; padding: 10px 12px; background: rgba(0,122,255,.05); border-radius: 10px; border-left: 3px solid rgba(0,122,255,.3); font-family: var(--sans); font-size: 13px; color: var(--text-2); line-height: 1.55; }
.swipe-actions { display: flex; align-items: center; justify-content: center; gap: 52px; padding: 16px 0 20px; flex-shrink: 0; }
.sw-act-btn { width: 66px; height: 66px; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .12s; box-shadow: 0 4px 18px rgba(0,0,0,.14); }
.sw-act-btn:active { transform: scale(.88); }
.sw-skip { background: var(--surface); color: var(--danger); border: 2.5px solid var(--danger); }
.sw-like { background: var(--success); color: #fff; }
.sw-empty { display: none; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 20px; }
.sw-empty.show { display: flex; }
.sw-empty-icon { font-size: 56px; }
.sw-empty-title { font-size: 18px; font-weight: 700; }
.sw-empty-sub   { font-size: 14px; color: var(--text-dim); line-height: 1.6; }

/* ── Swipe filter/compare/matches shared sheet styles ── */
.sw-filter-sec { margin-bottom: 18px; }
.sw-filter-label { font-size: 13px; color: var(--text-dim); font-weight: 600; margin-bottom: 8px; }
.sw-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sw-chip { padding: 7px 16px; border-radius: 20px; border: 1.5px solid var(--hairline); background: var(--surface2); font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--text-dim); cursor: pointer; transition: all .15s; }
.sw-chip.active { border-color: var(--accent); background: rgba(0,122,255,.08); color: var(--accent); }
.sw-apply-btn { width: 100%; padding: 15px; border-radius: 14px; border: none; background: var(--accent); color: #fff; font-family: var(--sans); font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 4px; }
.sw-cmp-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 0.5px solid var(--border); }
.sw-cmp-row:last-of-type { border-bottom: none; }
.sw-cmp-who { font-size: 14px; color: var(--text-dim); }
.sw-cmp-hrs { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--text); }
.sw-cmp-diff { text-align: center; padding: 12px 16px; border-radius: 14px; font-size: 15px; font-weight: 600; margin: 14px 0 20px; }
.sw-cmp-diff.pos { background: rgba(255,59,48,.08); color: var(--danger); }
.sw-cmp-diff.neg { background: rgba(48,209,88,.1); color: var(--success); }
.sw-cmp-diff.zero { background: rgba(0,122,255,.08); color: var(--accent); }
.sw-cmp-btns { display: flex; gap: 10px; }
.sw-cmp-btn { flex: 1; padding: 14px; border-radius: 14px; border: none; font-family: var(--sans); font-size: 15px; font-weight: 600; cursor: pointer; }
.sw-cmp-cont { background: rgba(142,142,147,.12); color: var(--text); }
.sw-cmp-send { background: var(--accent); color: #fff; }
.sw-match-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 0.5px solid var(--border); cursor: pointer; }
.sw-match-item:last-child { border-bottom: none; }
.sw-mi-rank { font-size: 15px; font-weight: 600; } .sw-mi-dates { font-size: 13px; color: var(--text-dim); margin-top: 3px; }
.sw-mi-hrs { font-family: var(--mono); font-size: 15px; color: var(--text-dim); }
.sw-matches-empty { text-align: center; color: var(--text-dim); font-size: 14px; padding: 32px 0; line-height: 1.7; }

/* ── Publish view ── */
#m-view-publish { background: var(--bg); }
#m-view-publish.active { display: flex; flex-direction: column; }

/* ── Messages view ── */
#m-view-messages { background: var(--bg); }
#m-view-messages.active { display: flex; flex-direction: column; }
.conv-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.conv-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: var(--surface);
  border-bottom: 0.5px solid var(--hairline); cursor: pointer;
  transition: background .12s;
}
.conv-item:active { background: rgba(0,0,0,.04); }
.conv-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff; font-family: var(--sans);
}
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 16px; font-weight: 600; color: var(--text); }
.conv-preview {
  font-size: 13px; color: var(--text-dim); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-preview.unread { color: var(--text-2); font-weight: 500; }
.conv-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.conv-time { font-size: 12px; color: var(--text-dim); }
.unread-badge {
  background: var(--danger); color: #fff; border-radius: 10px;
  min-width: 20px; height: 20px; padding: 0 6px;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
/* Chat panel */
.chat-panel {
  position: fixed; inset: 0; z-index: 300; background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.chat-panel.open { transform: none; }
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, var(--safe-t));
  background: var(--nav-bg);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 0.5px solid var(--border); flex-shrink: 0;
}
.chat-back {
  background: none; border: none; color: var(--accent);
  padding: 4px; cursor: pointer; display: flex; align-items: center;
}
.chat-peer-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.chat-title-wrap { flex: 1; }
.chat-title { font-size: 17px; font-weight: 600; color: var(--text); line-height: 1.2; }
.chat-sub { font-size: 12px; color: var(--text-dim); }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch;
}
.chat-date-sep {
  text-align: center; font-size: 12px; color: var(--text-dim);
  padding: 4px 0 10px;
}
.bw { display: flex; flex-direction: column; }
.bw.mine   { align-items: flex-end; }
.bw.theirs { align-items: flex-start; }
.bubble {
  max-width: 78%; padding: 11px 15px; border-radius: 20px;
  font-family: var(--sans); font-size: 15px; line-height: 1.45; word-break: break-word;
}
.bubble.mine   { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.bubble.theirs { background: var(--surface); color: var(--text); border-bottom-left-radius: 5px; box-shadow: 0 1px 6px rgba(0,0,0,.1); }
.bubble-time { font-size: 11px; color: var(--text-dim); margin-top: 4px; padding: 0 4px; }
.chat-input-row {
  display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px;
  padding-bottom: calc(10px + var(--safe-b));
  background: var(--nav-bg);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: 0.5px solid var(--border); flex-shrink: 0;
}
.chat-input {
  flex: 1; min-height: 38px; max-height: 110px;
  border: 1.5px solid var(--hairline); border-radius: 20px;
  padding: 9px 16px; font-family: var(--sans); font-size: 16px;
  color: var(--text); background: var(--surface2);
  outline: none; resize: none; line-height: 1.4;
}
.chat-input:focus { border-color: var(--accent); background: var(--surface); }
.chat-send {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,122,255,.3);
  transition: transform .12s;
}
.chat-send:active { transform: scale(.9); }
.pub-month-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.pub-month-tab {
  padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--hairline);
  background: var(--nav-bg); font-family: var(--sans);
  font-size: 13px; font-weight: 500; color: var(--text-dim); cursor: pointer; transition: all .15s;
}
.pub-month-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pub-sel-btn {
  padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--hairline);
  background: var(--surface); font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--text-dim); cursor: pointer; transition: all .15s;
}
.pub-sel-btn:active { background: rgba(0,122,255,.08); border-color: var(--accent); color: var(--accent); }
.pub-textarea {
  width: 100%; min-height: 100px; padding: 12px 14px;
  border: 1.5px solid var(--hairline); border-radius: 12px;
  font-family: var(--sans); font-size: 16px; color: var(--text);
  background: var(--surface); outline: none; resize: none; line-height: 1.55;
}
.pub-textarea:focus { border-color: var(--accent); }
.pub-cal-hidden { opacity: .28; }
.pub-cal-hidden .cal-day-num { text-decoration: line-through; }
.pub-submit-btn {
  width: 100%; display: flex; align-items: center; justify-content: center;
  padding: 16px; border-radius: 16px; border: none;
  background: var(--accent); color: #fff; font-family: var(--sans);
  font-size: 17px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 22px rgba(0,122,255,.28); transition: opacity .15s;
}
.pub-submit-btn:active { opacity: .8; }
