/* ==========================================================================
   Event & Trip Radar - 質感深色/淺色雙主題儀表板樣式表
   ========================================================================== */

:root {
  --font-sans: "Inter", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 20px 55px rgba(0, 0, 0, 0.45);
}

/* 預設質感深色主題 */
:root,
[data-theme="dark"] {
  --bg-body: #090d16;
  --bg-surface: #111827;
  --bg-surface-2: #162033;
  --bg-surface-hover: #1d2942;
  --bg-glass: rgba(17, 24, 39, 0.84);
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.32);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.14);

  --hot-bg: linear-gradient(135deg, #ef4444, #f97316);
  --hot-soft: rgba(239, 68, 68, 0.16);
  --hot-text: #fca5a5;

  --gold: #f59e0b;
  --gold-soft: rgba(245, 158, 11, 0.16);
  --gold-border: rgba(245, 158, 11, 0.65);

  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.15);
  --yellow: #eab308;
  --yellow-soft: rgba(234, 179, 8, 0.15);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.16);

  --holiday-bg: rgba(244, 63, 94, 0.13);
  --holiday-text: #fda4af;
}

/* 清新淺色主題 */
[data-theme="light"] {
  --bg-body: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-2: #f8fafc;
  --bg-surface-hover: #eef2f7;
  --bg-glass: rgba(255, 255, 255, 0.9);
  --border-subtle: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.22);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent: #0284c7;
  --accent-strong: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.1);

  --hot-bg: linear-gradient(135deg, #dc2626, #ea580c);
  --hot-soft: rgba(220, 38, 38, 0.1);
  --hot-text: #dc2626;

  --gold: #d97706;
  --gold-soft: rgba(217, 119, 6, 0.12);
  --gold-border: rgba(217, 119, 6, 0.65);

  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.12);
  --yellow: #ca8a04;
  --yellow-soft: rgba(202, 138, 4, 0.13);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.12);

  --holiday-bg: rgba(225, 29, 72, 0.08);
  --holiday-text: #be123c;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 26px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.mobile-only {
  display: none;
}

/* ==========================================================================
   按鈕與共用元件
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-ghost:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8125rem;
}

.btn-xs {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1rem;
}

.icon-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.text-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
}

.text-btn:hover {
  background: var(--accent-soft);
}

/* ==========================================================================
   PIN 碼解鎖覆蓋層
   ========================================================================== */
.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.18), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(244, 63, 94, 0.15), transparent 45%),
    var(--bg-body);
}

.pin-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 28px;
  border-radius: var(--radius-xl);
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.pin-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pin-radar-icon {
  font-size: 1.75rem;
}

.pin-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.pin-title {
  margin: 0 0 8px;
  font-size: 1.65rem;
  font-weight: 800;
}

.pin-subtitle {
  margin: 0 0 22px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.pin-subtitle code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-surface-2);
  color: var(--accent);
  font-weight: 700;
}

.pin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pin-form input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.15rem;
  text-align: center;
  letter-spacing: 0.25em;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
  outline: none;
  transition: border-color var(--transition);
}

.pin-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pin-error {
  min-height: 22px;
  margin: 10px 0 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--red);
}

.pin-footnote {
  margin-top: 14px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ==========================================================================
   頂部導覽列
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 1.5rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.view-switcher {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.view-tab {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.view-tab.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.35);
}

.origin-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}

.origin-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.origin-select {
  background: transparent;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  outline: none;
}

.origin-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* ==========================================================================
   工作區雙欄佈局 & 左側篩選側欄
   ========================================================================== */
.workspace {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: calc(100vh - 60px);
}

.sidebar {
  position: sticky;
  top: 59px;
  height: calc(100vh - 59px);
  overflow-y: auto;
  padding: 18px 16px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.filter-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.filter-heading {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hint-pill {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 700;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 9px 30px 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 0.85rem;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

/* 開關列 */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  position: relative;
}

.switch-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hot-dot {
  color: #ef4444;
  font-weight: 900;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}

.switch-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform var(--transition);
}

.switch-input:checked + .switch-slider {
  background: var(--accent);
}

.switch-input:checked + .switch-slider::after {
  transform: translateX(16px);
}

/* 關注清單 */
.watchlist-form {
  display: flex;
  gap: 6px;
}

.watchlist-form input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  outline: none;
}

.watchlist-form input:focus {
  border-color: var(--gold);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.watch-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold-border);
}

.watch-chip button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 0.75rem;
  opacity: 0.8;
}

.watchlist-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.preset-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.preset-chip {
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.71rem;
  padding: 2px 7px;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition);
}

.preset-chip:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* 活動類別勾選清單 */
.category-checklist {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.81rem;
  transition: all var(--transition);
}

.cat-item:hover {
  background: var(--bg-surface-hover);
}

.cat-item.checked {
  border-color: rgba(56, 189, 248, 0.35);
  background: var(--accent-soft);
}

.cat-item-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.cat-item-left input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.cat-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-surface);
}

/* 地區膠囊 */
.region-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.region-pill {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.region-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.meta-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.meta-info {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   主內容區 & KPI 摘要列
   ========================================================================== */
.main-content {
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-value {
  margin: 4px 0 2px;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.kpi-hot .kpi-value {
  color: #f87171;
}

.kpi-urgent .kpi-value {
  color: #fb923c;
}

.kpi-budget .kpi-value {
  color: var(--green);
}

/* ==========================================================================
   視圖一：日曆時間軸視圖（支援跨日連續色塊橫條）
   ========================================================================== */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  min-width: 128px;
  text-align: center;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-dot.holiday {
  background: #f43f5e;
}

.legend-dot.hot {
  background: #f97316;
}

.legend-dot.collision {
  background: #eab308;
}

/* 月份快速跳轉列 */
.month-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.month-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.month-pill:hover {
  background: var(--bg-surface-hover);
}

.month-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.month-pill-badge {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
}

.month-pill.active .month-pill-badge {
  background: rgba(255, 255, 255, 0.26);
}

/* 季節背景提示橫幅 */
.seasonal-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(244, 114, 182, 0.14), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(244, 114, 182, 0.35);
  font-size: 0.82rem;
  font-weight: 600;
}

.seasonal-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

/* 日曆網格容器 */
.calendar-board {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
}

.calendar-weekdays div {
  padding: 9px 10px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.calendar-weekdays div.weekend {
  color: var(--accent);
}

.calendar-weeks {
  display: flex;
  flex-direction: column;
}

/* 每一週列：底層為 7 格日格，上層疊加跨日橫條軌道 */
.calendar-week-row {
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 112px;
}

.calendar-week-row:last-child {
  border-bottom: none;
}

.week-day-cells {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  position: relative;
  min-height: 112px;
}

.day-cell {
  border-right: 1px solid var(--border-subtle);
  padding: 6px 8px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.day-cell:last-child {
  border-right: none;
}

.day-cell.outside {
  opacity: 0.36;
  background: rgba(15, 23, 42, 0.2);
}

[data-theme="light"] .day-cell.outside {
  background: rgba(148, 163, 184, 0.08);
}

.day-cell.is-holiday {
  background: var(--holiday-bg);
}

.day-cell.is-today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.day-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.day-cell.is-weekend .day-num {
  color: var(--accent);
}

.day-cell.is-holiday .day-num {
  color: var(--holiday-text);
}

.holiday-pill {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(244, 63, 94, 0.22);
  color: var(--holiday-text);
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 跨日連續活動條軌道容器 */
.week-events-layer {
  position: relative;
  margin-top: -82px;
  padding: 0 3px 8px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 24px;
  gap: 4px 3px;
  pointer-events: none;
  min-height: 82px;
}

.cal-event-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  height: 23px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.14s ease, filter 0.14s ease;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.cal-event-bar:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  z-index: 4;
}

.cal-event-bar.is-watch {
  box-shadow: 0 0 0 2px var(--gold), 0 3px 10px rgba(245, 158, 11, 0.45);
}

.cal-event-bar .bar-badge {
  font-size: 0.63rem;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.cal-event-bar .bar-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-tier-tier1 {
  border-left: 5px solid #fbbf24 !important;
}

.cal-tier-legacy {
  border-left: 5px solid #c084fc !important;
}

.cal-tier-tier2 {
  border-left: 5px solid #93c5fd !important;
}

/* 雙維度圖例條 & NPB 子篩選 */
.dual-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 9px 13px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.74rem;
}

.dual-legend-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.dual-legend-title {
  font-weight: 700;
  color: var(--text-secondary);
}

.city-dot {
  padding: 2px 8px;
  border-radius: 999px;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.7rem;
}

.tier-legend {
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--bg-surface-2);
  font-weight: 700;
  font-size: 0.7rem;
}

.tier-legend-1 {
  border-left: 4px solid #fbbf24;
  color: #fbbf24;
}

.tier-legend-legacy {
  border-left: 4px solid #c084fc;
  color: #c084fc;
}

.tier-legend-2 {
  border-left: 4px solid #93c5fd;
  color: #93c5fd;
}

[data-theme="light"] .tier-legend-1 {
  color: #b45309;
}

[data-theme="light"] .tier-legend-legacy {
  color: #7e22ce;
}

[data-theme="light"] .tier-legend-2 {
  color: #1d4ed8;
}

.subfilter-box {
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.08);
  border: 1px dashed rgba(59, 130, 246, 0.35);
}

.subfilter-box .sub-switch {
  padding: 4px 6px;
  font-size: 0.74rem;
  background: transparent;
  border: none;
}

/* 本月活動明細標題 */
.month-events-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 12px;
}

.month-events-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.count-badge {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ==========================================================================
   視圖二：城市看板視圖
   ========================================================================== */
.city-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.city-toolbar-info h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.city-toolbar-info p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
}

.sort-select {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.city-board-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.region-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.region-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-subtle);
}

.region-group-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.city-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.city-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.city-section-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.city-venue-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   活動卡片設計（共用）
   ========================================================================== */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(345px, 1fr));
  gap: 16px;
}

.event-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.event-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.event-card.watch-highlight {
  border: 1.5px solid var(--gold-border);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25), var(--shadow-md);
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.25;
}

.badge-hot {
  background: var(--hot-bg);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

.badge-cat {
  color: #ffffff;
}

.badge-watch {
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold-border);
}

.badge-leave-free {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.badge-leave-low {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.badge-collision-danger {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-collision-combo {
  background: var(--yellow-soft);
  color: var(--yellow);
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.badge-official {
  background: rgba(16, 185, 129, 0.14);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-custom {
  background: rgba(168, 85, 247, 0.16);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

[data-theme="light"] .badge-custom {
  color: #7e22ce;
}

.badge-tier1 {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.5);
}

.badge-legacy {
  background: rgba(192, 132, 252, 0.18);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.5);
}

.badge-tier2 {
  background: rgba(147, 197, 253, 0.16);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.45);
}

[data-theme="light"] .badge-tier1 {
  color: #b45309;
}

[data-theme="light"] .badge-legacy {
  color: #7e22ce;
}

[data-theme="light"] .badge-tier2 {
  color: #1d4ed8;
}

.card-tier-tier1 {
  border-left: 5px solid #fbbf24 !important;
}

.card-tier-legacy {
  border-left: 5px solid #c084fc !important;
}

.card-tier-tier2 {
  border-left: 5px solid #93c5fd !important;
}

.badge-dome-hl {
  background: rgba(14, 165, 233, 0.18);
  color: var(--accent);
  border: 1px solid rgba(14, 165, 233, 0.45);
}

.budget-disclaimer {
  margin-top: 10px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.card-title-row {
  cursor: pointer;
}

.card-title {
  margin: 0 0 3px;
  font-size: 1.03rem;
  font-weight: 800;
  line-height: 1.35;
}

.card-title:hover {
  color: var(--accent);
}

.card-venue {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* 關鍵時間軸區塊 */
.card-timeline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 0.77rem;
}

.timeline-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tl-label {
  font-size: 0.69rem;
  color: var(--text-muted);
  font-weight: 600;
}

.tl-val {
  font-weight: 700;
}

.tl-urgent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #f87171;
  font-weight: 800;
  animation: pulseUrgent 1.8s infinite;
}

@keyframes pulseUrgent {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* 交通與商旅價格趨勢燈號 */
.trend-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.trend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  font-size: 0.78rem;
}

.trend-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.trend-title {
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-pill {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 0.74rem;
}

.status-green {
  background: var(--green-soft);
  color: var(--green);
}

.status-yellow {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.status-red {
  background: var(--red-soft);
  color: var(--red);
}

/* 預算小計條 */
.budget-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(14, 165, 233, 0.05));
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.budget-label {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.budget-amount {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--accent);
}

/* 小圈子朋友狀態按鈕列 */
.group-status-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.status-btn {
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.status-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

.status-btn.active-interested {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}

.status-btn.active-ticketed {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--green);
  color: var(--green);
}

.status-btn.active-booked {
  background: rgba(168, 85, 247, 0.22);
  border-color: #a855f7;
  color: #c084fc;
}

[data-theme="light"] .status-btn.active-booked {
  color: #7e22ce;
}

.card-friends-marks {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 0.71rem;
}

.friend-mark-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* 卡片底部動作列 */
.card-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.card-actions-left {
  display: flex;
  gap: 6px;
}

/* ==========================================================================
   彈窗 (Modal) 與詳情試算
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(5px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-lg {
  max-width: 780px;
}

.modal-sm {
  max-width: 480px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 800;
}

.detail-subtitle {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.detail-box {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}

.detail-box h4 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.calc-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.calc-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.calc-field select,
.calc-field input[type="number"] {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  font-size: 0.84rem;
}

.calc-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}

.calc-line {
  display: flex;
  justify-content: space-between;
}

.calc-total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
  display: flex;
  justify-content: space-between;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent);
}

.deep-links-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.deep-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
}

.deep-link-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.venue-tip-box {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.collision-box {
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.collision-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  margin-right: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.collision-item-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.84rem;
  font-weight: 700;
}

.inline-form {
  display: flex;
  gap: 8px;
}

.inline-form input,
.form-group textarea {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
  font-size: 0.84rem;
}

.form-help {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 4px 0;
}

.detail-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.detail-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.add-event-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.add-event-form input,
.add-event-form select {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
  font-size: 0.84rem;
}

#raw-announcement-input,
#json-preview-area {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  font-size: 0.82rem;
  resize: vertical;
}

.add-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
}

.btn-danger-ghost {
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--red);
}

.btn-danger-ghost:hover {
  filter: brightness(1.08);
}

/* ==========================================================================
   Toast 通知 & 空狀態
   ========================================================================== */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  box-shadow: var(--shadow-md);
  font-size: 0.84rem;
  font-weight: 600;
  animation: toastIn 0.22s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  color: var(--text-secondary);
}

/* ==========================================================================
   響應式設計 (平板 & 手機)
   ========================================================================== */
@media (max-width: 1024px) {
  .mobile-only {
    display: inline-flex;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 86vw;
    height: 100vh;
    z-index: 120;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .sidebar-header h2 {
    margin: 0;
    font-size: 1rem;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(2, 6, 23, 0.65);
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .brand-sub {
    display: none;
  }

  .topbar-center {
    order: 3;
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .view-switcher {
    width: 100%;
  }

  .view-tab {
    flex: 1;
    text-align: center;
  }

  .origin-label {
    display: none;
  }

  .main-content {
    padding: 14px 12px 40px;
  }

  .events-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid-2,
  .detail-grid-3,
  .detail-grid-4 {
    grid-template-columns: 1fr;
  }

  .calendar-week-row,
  .week-day-cells,
  .day-cell {
    min-height: 88px;
  }

  .week-events-layer {
    margin-top: -62px;
    min-height: 62px;
  }

  .holiday-pill {
    display: none;
  }
}

/* ==========================================================================
   頂部地區篩選控制面板、日曆折疊按鈕 & 單日活動彈窗
   ========================================================================== */
.top-region-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.region-bar-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
}

.region-bar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.region-bar-label {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
}

.top-region-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.region-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.region-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.region-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
}

.region-chip .chip-check {
  font-size: 0.78rem;
  font-weight: 900;
}

.region-chip .chip-count {
  font-size: 0.72rem;
  opacity: 0.85;
}

.region-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.jp-subcity-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px dashed var(--border-subtle);
}

.subcity-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.jp-subcity-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.subcity-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.subcity-pill.active {
  background: rgba(79, 70, 229, 0.22);
  border-color: #6366f1;
  color: #c7d2fe;
}

[data-theme="light"] .subcity-pill.active {
  background: rgba(79, 70, 229, 0.12);
  border-color: #4f46e5;
  color: #3730a3;
}

.subcity-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* 日曆單日超量折疊按鈕 */
.cal-more-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 22px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px dashed var(--accent);
  background: rgba(15, 23, 42, 0.86);
  color: #7dd3fc;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.14s ease;
}

[data-theme="light"] .cal-more-btn {
  background: rgba(240, 249, 255, 0.96);
  color: #0369a1;
}

.cal-more-btn:hover {
  background: var(--accent);
  color: #ffffff;
  border-style: solid;
}

.day-cell.has-events {
  cursor: pointer;
}

.day-cell.has-events:hover {
  background: rgba(56, 189, 248, 0.06);
}

/* 單日完整活動清單彈窗 */
.day-modal-content {
  width: min(720px, 95vw);
}

.day-modal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 68vh;
  overflow-y: auto;
  padding-right: 4px;
}

.day-modal-item {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.day-modal-item:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.day-modal-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.day-modal-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.day-modal-budget {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
}

.day-modal-title {
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.35;
}

.day-modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

@media (max-width: 720px) {
  .top-region-bar {
    padding: 10px 12px;
  }

  .region-chip {
    padding: 5px 9px;
    font-size: 0.75rem;
  }
}
