/* FullTimeTaxi — 版面與元件 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--menu);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 頂欄 ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 0 var(--sp-6);
  height: 60px;
  background: var(--face);
  border-bottom: 1px solid var(--stroke-divider);
}

.brand { display: flex; align-items: center; gap: var(--sp-3); }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: var(--text-white-primary);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { color: var(--text-secondary); font-size: 12px; }

.topbar-actions { display: flex; align-items: center; gap: var(--sp-3); }
.host-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--data-table);
  border: 1px solid var(--stroke-divider);
  border-radius: var(--radius-full);
  padding: var(--sp-05) var(--sp-25);
}

/* ── 版面 ── */
.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: var(--sp-6);
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-6);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 84px;
  background: var(--face);
  border: 1px solid var(--stroke-divider);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
}

.nav-group + .nav-group { margin-top: var(--sp-5); }
.nav-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 0 var(--sp-3) var(--sp-2);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
}
.nav-link:hover { background: var(--menu); text-decoration: none; }
.nav-link.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}
.nav-link .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--stroke-outline);
  flex: none;
}
.nav-link.active .dot { background: var(--brand); }

.content { min-width: 0; }

/* ── 區塊 ── */
.block { display: none; }
.block.active { display: block; animation: fade 0.16s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.block > h1 {
  margin: 0 0 var(--sp-1);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.block-lead {
  margin: 0 0 var(--sp-5);
  color: var(--text-secondary);
  font-size: 13.5px;
}

.card {
  background: var(--face);
  border: 1px solid var(--stroke-divider);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.card > h2, .card > h3 {
  margin: 0 0 var(--sp-3);
  font-size: 15px;
  font-weight: 650;
}
.card > h3 { font-size: 14px; }
.card p { margin: 0 0 var(--sp-2); }
.card p:last-child { margin-bottom: 0; }

.card-muted { background: var(--menu); }

/* 定義清單：標籤 / 值 */
.facts { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--sp-2) var(--sp-4); margin: 0; }
.facts dt { color: var(--text-secondary); font-size: 13px; }
.facts dd { margin: 0; font-size: 13.5px; }

/* 清單 */
.list { margin: 0; padding-left: 18px; }
.list li { margin-bottom: var(--sp-15); }
.list li:last-child { margin-bottom: 0; }
.list-tight li { margin-bottom: var(--sp-1); }

/* 程式碼 / 目錄樹 */
pre.tree {
  margin: 0;
  padding: var(--sp-4);
  background: var(--data-table);
  border: 1px solid var(--stroke-divider);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  color: var(--text-primary);
}

code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--data-table);
  border: 1px solid var(--stroke-divider);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

/* 狀態徽章 */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-done    { background: var(--success-light); color: #127a3a; }
.badge-wip     { background: var(--warning-light); color: #995c07; }
.badge-todo    { background: var(--data-table); color: var(--text-secondary); }
.badge-blocked { background: var(--danger-light); color: #a32c18; }

/* 版本記錄 */
.version { border-left: 2px solid var(--stroke-outline); padding-left: var(--sp-4); margin-bottom: var(--sp-5); }
.version:last-child { margin-bottom: 0; }
.version-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.version-tag { font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--brand); }
.version-date { color: var(--text-tertiary); font-size: 12px; }
.version-label { font-weight: 600; font-size: 12.5px; margin: var(--sp-2) 0 var(--sp-1); }

/* 按鈕 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 36px;
  padding: 0 var(--sp-5);
  border: none;
  border-radius: var(--radius-full);
  background: var(--brand);
  color: var(--text-white-primary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease;
}
.btn:hover { background: var(--brand-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--stroke-outline);
  height: 32px;
  padding: 0 var(--sp-4);
}
.btn-ghost:hover { background: var(--menu); color: var(--text-primary); }

/* ── 登入頁 ── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--menu);
}
.login-wrap { width: 100%; max-width: 380px; padding: var(--sp-6); }
.login-card {
  background: var(--face);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-deep);
  padding: var(--sp-8) var(--sp-6);
}
.login-head { text-align: center; margin-bottom: var(--sp-6); }
.login-head .brand-mark { width: 44px; height: 44px; font-size: 19px; margin-bottom: var(--sp-3); }
.login-title { font-size: 17px; font-weight: 650; margin: 0 0 var(--sp-1); }
.login-sub { color: var(--text-secondary); font-size: 12.5px; margin: 0; }

label.form-label { display: block; font-size: 12.5px; color: var(--text-secondary); margin-bottom: var(--sp-2); }
input.form-input {
  width: 100%;
  height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--stroke-outline);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  background: var(--face);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
input.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weaken); }
.login-card .btn { width: 100%; height: 40px; margin-top: var(--sp-4); }

.form-error {
  margin-bottom: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: var(--danger-light);
  color: #a32c18;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.login-foot { text-align: center; color: var(--text-tertiary); font-size: 11.5px; margin-top: var(--sp-4); }

/* ── 營運資料表（四張表，原樣列出） ── */
.ops-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: var(--sp-2);
}

.ops-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-3);
  background: var(--data-table);
  border-radius: var(--radius-md);
}

.ops-stat-num { font-size: 20px; font-weight: 720; font-variant-numeric: tabular-nums; }
.ops-stat-label { font-size: 11.5px; color: var(--text-secondary); }

.ops-count { margin: var(--sp-3) 0 0; font-size: 11.5px; color: var(--text-tertiary); }

.ops-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--stroke-module);
  border-radius: var(--radius-md);
}

.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ops-table th,
.ops-table td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--stroke-divider);
  white-space: nowrap;
  vertical-align: top;
}

.ops-table th {
  background: var(--data-table);
  font-weight: 650;
  color: var(--text-secondary);
  font-size: 11.5px;
}

.ops-table tbody tr:last-child td { border-bottom: none; }
.ops-table tbody tr:hover td { background: var(--menu); }
.ops-table td.num { font-variant-numeric: tabular-nums; }
.ops-table td.empty { color: var(--text-tertiary); text-align: center; padding: var(--sp-5); }
.ops-table code { font-size: 11.5px; }
.ops-dim { color: var(--text-tertiary); font-size: 11px; }

/* ── 營銷資料：社交媒體貼文 ── */
.post-figure { margin: 0; }
.post-figure img {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--stroke-outline);
  background: var(--container);
}
.post-figure figcaption {
  margin-top: var(--sp-2);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}
.post-copy {
  margin: 0;
  padding: var(--sp-4);
  background: var(--data-table);
  border: 1px solid var(--stroke-module);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
  user-select: all;
}
.post-copy + p { margin-top: var(--sp-4); }
.asset-row { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin: var(--sp-4) 0; }
.asset-fig { width: 132px; margin: 0; }
.asset-fig img {
  display: block;
  width: 132px;
  height: 132px;
  border-radius: 10px;
  border: 1px solid var(--stroke-outline);
  background: var(--data-table);
}
.asset-fig figcaption {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── 熱圖（營運總覽） ── */
.heatmap {
  position: relative;
  height: 520px;
  border: 1px solid var(--stroke-outline);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--data-table);
  z-index: 0;
}
.heatmap.leaflet-container { font-family: var(--font-sans); }
/* 底圖去飽和，令熱度色階突出（圖磚本身仍是 OSM 標準圖，不改來源） */
.heatmap .leaflet-tile-pane { filter: grayscale(0.82) brightness(1.04) contrast(0.96); }
.heatmap .leaflet-control-attribution {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.82);
}
.heatmap.leaflet-container .heat-fallback { display: none; }
.heat-fallback {
  margin: 0;
  padding: var(--sp-4);
  font-size: 12.5px;
  color: var(--text-secondary);
}
.heat-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  font-size: 12.5px;
  color: var(--text-secondary);
}
.heat-key { display: inline-flex; align-items: center; gap: var(--sp-15); }
.heat-key i {
  display: inline-block;
  width: 30px;
  height: 8px;
  border-radius: var(--radius-full);
}
.heat-key-origin i {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), #f59e0b 42%, #e04b30 72%, #c8102e);
}
.heat-key-destination i {
  background: linear-gradient(90deg, rgba(0, 109, 158, 0.18), #38bdf8 42%, #0b7d9e 72%, #00405c);
}
.heat-clusters {
  list-style: none;
  margin: var(--sp-2) 0 0;
  padding: 0;
  display: grid;
  gap: var(--sp-05) var(--sp-4);
}
.heat-clusters li {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.heat-clusters li strong { color: var(--text-primary); font-weight: 600; }
.heat-clusters li code { font-size: 11px; color: var(--text-tertiary); }
.heat-clusters li.empty { color: var(--text-tertiary); }
.heat-count {
  color: var(--brand);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ── 窄螢幕 ── */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; padding: var(--sp-4); }
  .sidebar { position: static; }
  .nav-group { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
  .nav-group-title { width: 100%; }
  .facts { grid-template-columns: 1fr; gap: var(--sp-1); }
  .facts dt { margin-top: var(--sp-2); }
}
