/* Waltor Vision 品牌風格 */
:root {
  --universe-blue: #2A3653;
  --sky-blue: #3C6392;
  --gray-blue: #96AFC5;
  --deep-universe: #0F0F1B;
  --dark-gray: #333333;
  --light-gray: #D9D9D9;
  --white: #FFFFFF;
  --sidebar-width: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: #F4F6F9;
  color: var(--dark-gray);
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--universe-blue);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/static/universe-light-2.jpg') center center / cover no-repeat;
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/static/space-grain.png') repeat;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}

.sidebar > * { position: relative; z-index: 1; }

.sidebar-logo {
  padding: 14px 20px 12px;
  border-bottom: 1px solid rgba(150,175,197,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-logo-img {
  width: 100%;
  max-width: 180px;
  display: block;
}

.sidebar-nav {
  flex: 0 0 auto;
  padding: 10px 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-height: 0;
  max-height: 100%;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  color: var(--gray-blue);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover, .nav-item.active {
  color: var(--white);
  background: rgba(150,175,197,0.12);
  border-left-color: var(--gray-blue);
}

.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

/* ── 影子登入警示橫幅 ── */
.impersonate-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: linear-gradient(90deg, #c0392b, #e74c3c);
  color: #fff;
  padding: 10px 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.impersonate-banner strong { font-weight: 600; }
.impersonate-stop {
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 12px;
  transition: background 0.15s;
}
.impersonate-stop:hover { background: rgba(255,255,255,0.35); }
body:has(.impersonate-banner) .main { padding-top: 44px; }
body:has(.impersonate-banner) .sidebar { padding-top: 44px; }

/* ── 側邊欄可展開群組 ── */
.nav-group { display: flex; flex-direction: column; }
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  color: var(--gray-blue);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.nav-group-toggle:hover { color: var(--white); background: rgba(150,175,197,0.08); }
.nav-group-toggle .icon { font-size: 16px; width: 20px; text-align: center; }
.nav-group-arrow { margin-left: auto; font-size: 10px; transition: transform 0.2s; }
.nav-group.open .nav-group-arrow { transform: rotate(180deg); }
.nav-group-items { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.nav-group.open .nav-group-items { max-height: 200px; }
.nav-item.nav-sub { padding-left: 52px; font-size: 13px; }
.nav-item.nav-sub .icon { font-size: 13px; }

/* ── 側邊欄迷你月曆（固定貼齊 footer 上方） ── */
.sidebar-calendar {
  display: block;
  margin: auto 14px 0;
  padding: 8px 6px 6px;
  text-decoration: none;
  border-top: 1px solid rgba(150,175,197,0.18);
  transition: background 0.15s;
  flex-shrink: 0;
}
.sidebar-calendar:hover { background: rgba(150,175,197,0.08); }
.cal-title {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.85);
  margin-bottom: 6px;
  font-weight: 500;
}
.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 8px;
  color: rgba(150,175,197,0.55);
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  text-align: center;
}
.cal-cell {
  font-size: 9px;
  color: rgba(255,255,255,0.65);
  aspect-ratio: 1;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.cal-cell.empty { visibility: hidden; }
.cal-cell.today {
  background: #FFFFFF;
  color: var(--universe-blue);
  font-weight: 700;
}

.sidebar-footer {
  padding: 14px 24px;
  border-top: 1px solid rgba(150,175,197,0.2);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--sky-blue);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 600;
}

.user-name { color: var(--white); font-size: 13px; }
.user-email { color: var(--gray-blue); font-size: 11px; }

.logout-btn {
  display: block;
  color: var(--gray-blue);
  font-size: 12px;
  text-decoration: none;
  padding: 6px 0;
}
.logout-btn:hover { color: var(--white); }

/* ── Main Content ── */
.main {
  margin-left: var(--sidebar-width);
  padding: 32px 36px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--universe-blue);
}

.page-subtitle {
  font-size: 13px;
  color: #888;
  margin-top: 2px;
}

.quick-links {
  display: flex;
  gap: 8px;
  align-items: center;
}
.quick-link {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--universe-blue);
  background: var(--white);
  border: 1px solid rgba(42, 54, 83, 0.1);
  transition: all .15s ease;
  text-decoration: none;
}
.quick-link:hover {
  color: #fff;
  background: var(--universe-blue);
  border-color: var(--universe-blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(42, 54, 83, 0.18);
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 16px 14px;
  border: 1px solid #E8ECF2;
  min-width: 0;
}

@media (max-width: 1400px) {
  .stats-row { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

.stat-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--universe-blue); }
.stat-sub   { font-size: 12px; color: #aaa; margin-top: 2px; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  padding: 8px 12px;
  border: 1px solid #DDE2EB;
  border-radius: 8px;
  font-size: 13px;
  background: var(--white);
  color: var(--dark-gray);
  outline: none;
  transition: border 0.15s;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--sky-blue);
}

.filter-bar input { min-width: 200px; }

/* ── Project Cards Grid ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #E8ECF2;
  text-decoration: none;
  display: block;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--gray-blue);
}

.project-card:hover {
  box-shadow: 0 4px 20px rgba(42,54,83,0.12);
  transform: translateY(-1px);
  border-color: var(--gray-blue);
}

.project-card.stage-需求::before     { background: #D9D9D9; }
.project-card.stage-提案中::before   { background: #B5C2CE; }
.project-card.stage-製作分鏡::before { background: #96AFC5; }
.project-card.stage-製作執行中::before { background: #6F8DAE; }
.project-card.stage-後期::before     { background: #3C6392; }
.project-card.stage-交付完成::before { background: #324C77; }
.project-card.stage-請款中::before   { background: #2A3653; }
.project-card.stage-結案::before     { background: #0F0F1B; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.card-num {
  font-size: 11px;
  color: #aaa;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.stage-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 500;
  background: #EEF2F7;
  color: var(--universe-blue);
}

.stage-badge.需求       { background: #F2F3F5; color: #8A95A7; }
.stage-badge.提案中     { background: #E8EDF2; color: #5A6A80; }
.stage-badge.製作分鏡   { background: #D8E2EC; color: #3C6392; }
.stage-badge.製作執行中 { background: #B5C7DA; color: #2A3653; }
.stage-badge.後期       { background: #7F9BBD; color: #FFFFFF; }
.stage-badge.交付完成   { background: #3C6392; color: #FFFFFF; }
.stage-badge.請款中     { background: #2A3653; color: #FFFFFF; }
.stage-badge.結案       { background: #0F0F1B; color: #FFFFFF; }

.client-proj-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #F8F9FB;
  text-decoration: none;
  color: var(--dark-gray);
  transition: background 0.15s;
}
.client-proj-link:hover { background: #EEF2F7; }
.client-proj-num {
  font-size: 12px;
  color: #888;
  font-weight: 500;
  min-width: 56px;
}
.client-proj-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--universe-blue);
}

.quote-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #F8F9FB;
  border-radius: 8px;
  font-size: 13px;
}
.quote-version {
  font-weight: 600;
  color: var(--universe-blue);
  min-width: 32px;
}
.quote-latest {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--universe-blue);
  color: white;
  border-radius: 10px;
}
.quote-amount {
  flex: 1;
  color: var(--dark-gray);
  font-weight: 500;
}
.quote-date {
  color: #aaa;
  font-size: 12px;
}

/* ── Tabs ───────────────────────────── */
.tab-header {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 2px solid #EEF2F7;
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
}
.tab-btn:hover { color: var(--universe-blue); }
.tab-btn.active {
  color: var(--universe-blue);
  border-bottom-color: var(--universe-blue);
}

/* ── 檔案流水列表 ───────────────────── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #F8F9FB;
  border-radius: 8px;
  font-size: 13px;
}
.file-kind {
  display: inline-block;
  font-size: 12px;
  padding: 5px 16px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.05em;
  color: white;
}
.file-kind-合約 { background: #3C6392; }     /* Sky Blue */
.file-kind-報價單 { background: var(--universe-blue); }  /* Universe Blue */

/* /files 一案一列 */
.proj-name-btn {
  background: none;
  border: none;
  color: var(--universe-blue);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(42, 54, 83, 0.2);
  text-underline-offset: 3px;
}
.proj-name-btn:hover {
  text-decoration-color: var(--universe-blue);
}

.doc-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.doc-head {
  display: flex;
  gap: 8px;
  align-items: center;
}
.doc-link {
  text-decoration: none;
  font-size: 16px;
}
.doc-link-off {
  color: #D5D9E0;
  font-size: 16px;
}
.doc-meta {
  font-size: 12px;
  color: #5A6A80;
}
.doc-meta-sm {
  font-size: 11px;
  color: #8A95A7;
}
.inline-date-input {
  padding: 3px 6px;
  border: 1px solid #E0E4EA;
  border-radius: 4px;
  font-size: 12px;
  color: #2A3653;
  background: #fff;
  font-family: inherit;
}
.inline-date-input:hover { border-color: #3C6392; }
.amt-mismatch {
  margin-top: 4px;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: #FFF4E0;
  color: #A6741E;
  font-size: 11px;
  line-height: 1.4;
  border: 1px solid #F2E2BC;
  cursor: help;
}
.edit-amt-btn {
  margin-left: 6px;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: #9BA5B3;
  cursor: pointer;
  font-size: 11px;
}
.edit-amt-btn:hover { color: #3C6392; }

.stages-btn {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid #D5DCE6;
  border-radius: 6px;
  background: #fff;
  color: #3C6392;
  font-size: 12px;
  cursor: pointer;
}
.stages-btn:hover {
  background: #F4F7FB;
  border-color: #3C6392;
}
.empty-cell {
  color: #C5CBD6;
  font-size: 13px;
}

/* 開立發票彈窗的客戶/金額資訊 */
.ii-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #3C6392;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.ii-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
  font-size: 13px;
  border-bottom: 1px dotted #E4E9F0;
}
.ii-info-row:last-child { border-bottom: none; }
.ii-info-label { color: #8A95A7; }
.ii-info-value {
  color: #2A3653;
  font-weight: 500;
  text-align: right;
  user-select: all;
}
.ii-empty {
  color: #8A95A7;
  font-size: 12px;
  padding: 6px 0;
}

.amount-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
}
.amount-total { color: var(--universe-blue); font-weight: 600; font-size: 14px; }
.amount-sub, .amount-tax {
  color: #888; font-size: 11px; font-weight: 400;
}
.file-ver {
  font-weight: 600;
  color: var(--universe-blue);
  min-width: 32px;
}
.file-name {
  flex: 1;
  color: var(--dark-gray);
}
.file-amount {
  color: var(--universe-blue);
  font-weight: 500;
}
.file-date {
  color: #aaa;
  font-size: 12px;
  min-width: 90px;
  text-align: right;
}

.is-latest {
  color: #ff4d4f;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  white-space: nowrap;
}
.status-signed   { background: #F6FFED; color: #389E0D; }
.status-verbal   { background: #FFF8E1; color: #B07A1D; border: 1px dashed #E8C770; padding: 2px 9px; }
.status-unsigned { background: #FFF7E6; color: #D46B08; }

.status-select-pill {
  border: none;
  cursor: pointer;
  font: inherit;
  padding-right: 22px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%238A95A7'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.status-select-pill.status-verbal { padding-right: 22px; }

.search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search-wrap input { padding-right: 34px; }
.search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #888;
  padding: 4px 6px;
  opacity: 0.7;
}
.search-btn:hover { opacity: 1; }

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 13px;
}
.pager-btn {
  padding: 6px 14px;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  color: var(--universe-blue);
  text-decoration: none;
}
.pager-btn:hover { background: #F8F9FB; }
.pager-info { color: #888; }

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #F8F9FB;
  border-radius: 8px;
}
.contact-name {
  font-weight: 600;
  color: var(--universe-blue);
  font-size: 14px;
}
.contact-title {
  font-size: 11px;
  color: #888;
  padding: 1px 8px;
  background: #EEF2F7;
  border-radius: 10px;
}
.contact-primary {
  font-size: 11px;
  padding: 1px 8px;
  background: var(--universe-blue);
  color: white;
  border-radius: 10px;
}
.contact-meta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
  color: #888;
  flex-wrap: wrap;
}

.proj-quote-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #F8F9FB;
  transition: background 0.15s;
}
.proj-quote-row:hover { background: #EEF2F7; }
.proj-quote-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--dark-gray);
  min-width: 0;
}
.quote-select {
  padding: 4px 8px;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  background: white;
  font-size: 12px;
  color: var(--universe-blue);
  cursor: pointer;
  width: 100%;
  max-width: 180px;
}
.quote-select:hover { border-color: var(--sky-blue); }

/* ── 客戶詳細頁：左資料卡 + 右大表格 ── */
.client-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
}
.stack-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stack-info .info-item-label {
  font-size: 11px;
  color: #999;
  margin-bottom: 2px;
}
.stack-info .info-item-value {
  font-size: 14px;
  color: var(--dark-gray);
  line-height: 1.5;
  word-break: break-word;
}
.client-proj-table td { vertical-align: middle; }
.client-proj-table .td-link {
  color: var(--universe-blue);
  text-decoration: none;
}
.client-proj-table .td-link:hover { text-decoration: underline; }
.client-proj-table .td-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 220px;
}
.client-proj-table .td-dim { color: #ccc; font-size: 12px; }

@media (max-width: 900px) {
  .client-layout { grid-template-columns: 1fr; }
}

.card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--universe-blue);
  margin-bottom: 12px;
  line-height: 1.4;
}

.card-pm {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
}

.progress-bar {
  height: 5px;
  background: #EEF2F7;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sky-blue), var(--gray-blue));
  border-radius: 10px;
  transition: width 0.4s ease;
}

.progress-fill.done { background: #52c41a; }

.card-pct {
  font-size: 11px;
  color: #aaa;
  text-align: right;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.stage-select {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 20px;
  border: 1px solid #DDE2EB;
  background: #EEF2F7;
  color: var(--universe-blue);
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.stage-select:hover { border-color: var(--sky-blue); }

.stage-select-需求       { background: #F2F3F5; color: #8A95A7; border-color: #E0E4EA; }
.stage-select-提案中     { background: #E8EDF2; color: #5A6A80; border-color: #CFD8E2; }
.stage-select-製作分鏡   { background: #D8E2EC; color: #3C6392; border-color: #B5C7DA; }
.stage-select-製作執行中 { background: #B5C7DA; color: #2A3653; border-color: #7F9BBD; }
.stage-select-後期       { background: #7F9BBD; color: #FFFFFF; border-color: #5A7C9F; }
.stage-select-交付完成   { background: #3C6392; color: #FFFFFF; border-color: #324C77; }
.stage-select-請款中     { background: #2A3653; color: #FFFFFF; border-color: #1F2840; }
.stage-select-結案       { background: #0F0F1B; color: #FFFFFF; border-color: #000000; }

/* ── Project Detail ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sky-blue);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 20px;
}
.back-btn:hover { text-decoration: underline; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

.card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid #E8ECF2;
  padding: 24px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--universe-blue);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #EEF2F7;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Task List ── */
.task-list { display: flex; flex-direction: column; gap: 8px; }

/* ── 專案詳情頁子任務（1/3 深色 + 2/3 淺色） ─────────────────── */
.card-tasks .task-list {
  display: flex;
  flex-direction: column;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
}
.card-tasks--bare {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}
.card-tasks--bare .card-title {
  padding-left: 4px;
  padding-right: 4px;
}
.detail-right-col {
  align-self: start;
}
.info-sticky {
  position: sticky;
  top: 16px;
  padding: 16px 18px !important;
}
.info-sticky .card-title {
  font-size: 13px;
  margin-bottom: 10px;
  padding-bottom: 8px;
}
.info-sticky .info-grid {
  margin-bottom: 8px !important;
  gap: 10px !important;
}
.info-sticky .info-item-label {
  font-size: 10px;
}
.info-sticky .info-item-value {
  font-size: 13px;
}
.info-sticky .progress-bar {
  height: 6px !important;
  margin-bottom: 10px !important;
}
.info-sticky .form-group {
  margin-bottom: 8px !important;
}
.info-sticky .form-label {
  font-size: 11px;
  margin-bottom: 4px;
}
.info-sticky .form-control {
  font-size: 12px;
  padding: 6px 8px;
}
.info-sticky textarea.form-control {
  min-height: 38px;
  height: 38px;
}
.info-sticky .btn-primary {
  padding: 6px 12px;
  font-size: 12px;
}
.info-sticky .info-section-divider {
  margin: 10px -18px 10px !important;
}
.info-sticky .info-subtitle {
  font-size: 12px;
  margin-bottom: 6px;
}
.info-sticky .post-update-list--compact .post-update-item {
  padding: 6px 8px;
}
.info-section-divider {
  height: 1px;
  background: #EEF2F7;
  margin: 20px -24px 16px;
}
.info-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--universe-blue);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.post-update-list--compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.post-update-list--compact .post-update-item {
  padding: 8px 10px;
  gap: 10px;
}
.post-update-list--compact .pu-date { font-size: 11px; }
.post-update-list--compact .pu-title { font-size: 12px; }
.post-update-list--compact .pu-meta { font-size: 10px; gap: 6px; }
.post-update-list--compact .pu-badge { font-size: 10px; padding: 2px 6px; }
.detail-grid .task-item {
  display: grid;
  grid-template-columns: 270px 1fr;
  border: 1px solid #E3E8EF !important;
  border-radius: 10px !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  overflow: hidden;
  background: #F4F6FA;
  font-size: 13px;
  min-height: 56px;
  box-shadow: 0 1px 2px rgba(15, 15, 27, 0.04);
}
.detail-grid .task-item:hover { background: #F4F6FA; }
.detail-grid .task-item.done .task-left {
  background: #F5F7FA;
}
.detail-grid .task-item.done .task-name {
  color: #96AFC5;
  text-decoration: none;
  opacity: 1;
}
.detail-grid .task-item.done .task-left .drag-handle {
  color: #C7D0DC;
}
.detail-grid .task-item.done .task-left .task-check.done-check {
  background: #96AFC5;
  border-color: #96AFC5;
  color: white;
}
.detail-grid .task-item.done .task-due,
.detail-grid .task-item.done .task-assignee,
.detail-grid .task-item.done .task-note-inline { opacity: 0.6; }

.task-left {
  background: url('/static/universe-light-2.jpg') center / cover no-repeat, #2A3653;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  position: relative;
}
.task-left > * { position: relative; z-index: 1; }
.task-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(15,15,27,0.25), rgba(42,54,83,0.15));
  pointer-events: none;
}
.task-left .drag-handle {
  color: #96AFC5;
  cursor: grab;
  font-size: 14px;
  user-select: none;
  flex-shrink: 0;
}
.task-left .drag-handle:active { cursor: grabbing; }
.task-left .task-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid #96AFC5;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  transition: all 0.15s;
}
.task-left .task-check.done-check {
  background: white;
  border-color: white;
  color: #2A3653;
}
.task-left .task-name {
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-right {
  padding: 0 14px;
  display: grid;
  grid-template-columns: 90px 64px 1fr auto;
  align-items: center;
  column-gap: 10px;
  background: #F4F6FA;
  min-width: 0;
}
.task-field {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-field-label {
  font-size: 11px;
  color: #8A95A7;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.detail-grid .task-due {
  color: #2A3653;
  font-weight: 500;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px dashed transparent;
}
.detail-grid .task-due:hover {
  background: #F7F9FC;
  border-color: #E9EEF5;
}
.detail-grid .task-assignee {
  color: #2A3653;
  font-weight: 500;
  font-size: 12px;
  background: none;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px dashed transparent;
  cursor: pointer;
}
.detail-grid .task-assignee:hover {
  background: #F7F9FC;
  border-color: #E9EEF5;
}
.detail-grid .task-name {
  cursor: text;
}
.inline-edit-input {
  font: inherit;
  font-size: 12px;
  color: #2A3653;
  border: 1px solid #3C6392;
  border-radius: 4px;
  padding: 2px 6px;
  background: white;
  outline: none;
  max-width: 100%;
}
.task-note-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.task-note-wrap .task-note-inline {
  flex: 1;
  min-width: 0;
}
.task-note-updated {
  font-size: 10px;
  color: #96AFC5;
  letter-spacing: 0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  white-space: nowrap;
  width: 50px;
}
.task-note-inline {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: #5A6A80;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: text;
  line-height: 1.35;
  border: 1px dashed transparent;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  word-break: break-word;
}
.task-note-inline.note-dense {
  font-size: 11px;
  line-height: 1.3;
}
.task-note-inline.note-denser {
  font-size: 10px;
  line-height: 1.25;
}
.task-note-inline:empty::before {
  content: attr(data-placeholder);
  color: #B5BCC9;
  font-style: italic;
}
.task-note-inline:hover {
  background: #F7F9FC;
  border-color: #E9EEF5;
}
.task-note-inline[contenteditable="true"] {
  background: white;
  border-color: #3C6392;
  border-style: solid;
  outline: none;
  white-space: normal;
  overflow: visible;
}

.detail-grid .task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.task-drag-ghost { opacity: 0.4; background: #EEF2F7 !important; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #bbb;
  transition: all 0.15s;
}
.icon-btn:hover { background: #EEF2F7; color: var(--dark-gray); }
.icon-btn.delete:hover { color: #ff4d4f; background: #fff1f0; }
.icon-btn.next-star { color: #ccc; font-size: 14px; }
.icon-btn.next-active { color: #faad14; font-size: 14px; }

.drive-link {
  font-size: 18px;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
  display: inline-block;
  margin-left: 8px;
  flex-shrink: 0;
}
.drive-link:hover { opacity: 1; transform: scale(1.15); }

.next-task-block {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(60,99,146,0.08);
  border-radius: 8px;
  border-left: 3px solid var(--sky-blue);
}
.next-task-label { font-size: 10px; color: var(--sky-blue); font-weight: 600; letter-spacing: 0.05em; margin-bottom: 4px; }
.next-task-layout {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.next-task-lines {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.next-task-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--universe-blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.next-task-note {
  font-size: 11px;
  color: #96AFC5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.next-task-due {
  font-size: 11px;
  color: #96AFC5;
  white-space: nowrap;
  flex-shrink: 0;
}
.next-task-cell {
  font-size: 12px;
  min-width: 180px;
  max-width: 340px;
}
.next-task-cell .next-task-name { color: var(--dark-gray); }
.proj-table .td-due {
  white-space: nowrap;
  font-size: 12px;
  color: #96AFC5;
  width: 110px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--universe-blue);
  color: white;
}
.btn-primary:hover { background: var(--sky-blue); }

.btn-outline {
  background: none;
  border: 1px solid #DDE2EB;
  color: var(--dark-gray);
}
.btn-outline:hover { border-color: var(--sky-blue); color: var(--sky-blue); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Forms / Inputs ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; color: #666; margin-bottom: 5px; font-weight: 500; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #DDE2EB;
  border-radius: 8px;
  font-size: 13px;
  color: var(--dark-gray);
  outline: none;
  transition: border 0.15s;
  background: white;
}
.form-control:focus { border-color: var(--sky-blue); }
textarea.form-control { resize: vertical; min-height: 70px; }

/* ── Todo List ── */
.todo-list { display: flex; flex-direction: column; gap: 8px; }

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: white;
  border-radius: 8px;
  border: 1px solid #EEF2F7;
  font-size: 13px;
}

.todo-item.done { opacity: 0.5; }
.todo-item.done .todo-content { text-decoration: line-through; }

.todo-content { flex: 1; font-weight: 500; }
.todo-meta { font-size: 11px; color: #aaa; display: flex; gap: 10px; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,15,27,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--universe-blue);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--universe-blue) 0%, var(--sky-blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 48px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(15,15,27,0.3);
}

.login-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--universe-blue);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.login-sub {
  font-size: 12px;
  color: #aaa;
  letter-spacing: 0.1em;
  margin-bottom: 36px;
}

.login-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: 8px;
}

.login-desc {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 32px;
  line-height: 1.6;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid #DDE2EB;
  border-radius: 10px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark-gray);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.google-btn:hover { border-color: var(--sky-blue); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.google-icon {
  width: 20px; height: 20px;
}

/* ── Project Info Pairs ── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-item {}
.info-item-label { font-size: 11px; color: #aaa; margin-bottom: 3px; }
.info-item-value { font-size: 14px; color: var(--dark-gray); font-weight: 500; }

/* ── Edit Form ── */
.inline-form { display: flex; flex-direction: column; gap: 12px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 8px;
    background: var(--universe-blue);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 99;
  }
  .page-header { padding-top: 48px; }
}

@media (min-width: 769px) {
  .mobile-menu-btn { display: none; }
  .sidebar-overlay { display: none !important; }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ── PM Chips ── */
.pm-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.pm-chip {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #DDE2EB;
  background: white;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.pm-chip:hover { border-color: var(--sky-blue); color: var(--sky-blue); }
.pm-chip.active { background: var(--universe-blue); color: white; border-color: var(--universe-blue); }

/* ── View Toggle ── */
.view-btn {
  background: var(--white);
  border: 1px solid #DDE2EB;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 15px;
  cursor: pointer;
  color: #aaa;
  transition: all 0.15s;
  line-height: 1;
}
.view-btn:hover { color: var(--universe-blue); border-color: var(--sky-blue); }
.view-btn.active { background: var(--universe-blue); color: white; border-color: var(--universe-blue); }

/* ── Project Table ── */
.table-wrap {
  background: white;
  border-radius: 12px;
  border: 1px solid #E8ECF2;
  overflow: hidden;
}

.proj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.proj-table thead tr {
  background: #2A3653;
  border-bottom: 1px solid #2A3653;
}

.proj-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 0;
  white-space: nowrap;
}

.proj-table tbody tr {
  border-bottom: 1px solid #F0F2F6;
  transition: background 0.12s;
}

.proj-table tbody tr:last-child { border-bottom: none; }
.proj-table tbody tr:hover { background: #F8FAFD; }

.proj-table td {
  padding: 12px 14px;
  color: var(--dark-gray);
  vertical-align: middle;
}

.td-num { color: #aaa; font-size: 12px; white-space: nowrap; }
.td-name { font-weight: 600; color: var(--universe-blue); }
.td-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.td-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 220px;
}
.td-mini-progress {
  flex-shrink: 0;
  width: 60px;
  height: 4px;
  background: #E8ECF2;
  border-radius: 2px;
  overflow: hidden;
  display: inline-block;
}
.td-mini-progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3C6392, #2A3653);
  border-radius: 2px;
  transition: width 0.3s;
}
.td-mini-progress-fill.done {
  background: #52c41a;
}
.td-status .status-link {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
}
.status-chip {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: none;
  padding: 0;
  border: none;
}
.status-chip.ok {
  color: #2D7A4B;
}
.status-chip.verbal {
  color: #B07A1D;
}
.status-chip.pending {
  color: var(--sky-blue);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #aaa;
  font-size: 14px;
}

.empty-state .emoji { font-size: 36px; margin-bottom: 10px; }

/* status badge */
.status-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}
.status-待處理 { background: #FFF7E6; color: #D46B08; }
.status-進行中 { background: #E6F4FF; color: #0958D9; }
.status-完成   { background: #F6FFED; color: #389E0D; }
.status-擱置   { background: #F5F5F5; color: #999; }

/* ── Dashboard ── */
.dash-top-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.dash-agent-full { margin-bottom: 16px; }
.dash-top-kpi {
  background: #fff;
  border: 1px solid #EEF0F4;
  border-radius: 12px;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: block;
}
a.dash-top-kpi:hover {
  border-color: var(--gray-blue);
  box-shadow: 0 4px 20px rgba(42,54,83,0.08);
}
.dash-top-kpi-label {
  font-size: 13px;
  color: #8A95A7;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.dash-top-kpi-value {
  font-size: 40px;
  font-weight: 600;
  color: var(--universe-blue);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.dash-top-kpi-value.dash-money {
  font-size: 26px;
  letter-spacing: 0;
}
.dash-top-kpi-sub {
  font-size: 12px;
  color: #B5BCC9;
  margin-top: 8px;
}

.dash-agent {
  background: url('/static/universe-light-1.jpg?v=5') center center / cover no-repeat, #0F0F1B;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 40px 28px 120px;
  position: relative;
  overflow: hidden;
  min-height: 380px;
}
.dash-agent::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/static/space-grain.png') repeat;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}
.dash-agent > * { position: relative; z-index: 1; }
.dash-agent-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.dash-agent-title {
  font-size: 16px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: 0.02em;
}
.dash-agent-date {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  font-variant-numeric: tabular-nums;
}
.agent-sec { padding: 10px 0; border-bottom: 1px dotted rgba(255,255,255,0.08); }
.agent-sec:last-child { border-bottom: none; }
.agent-sec-title {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  margin-bottom: 6px;
}
.agent-list {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
  font-size: 13px;
  color: rgba(255,255,255,0.82);
  line-height: 1.8;
}
.agent-list li { padding: 0; }
.agent-list li::marker { color: rgba(255,255,255,0.45); }
.agent-empty {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  padding-left: 2px;
}
.agent-dim  { color: rgba(255,255,255,0.55); }
.agent-date { color: #A8C4E0; font-variant-numeric: tabular-nums; font-weight: 500; }
.dash-agent .icon-btn { color: rgba(255,255,255,0.7); }
.dash-agent .icon-btn:hover { color: #FFFFFF; }

.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 6px;
}
.dash-kpi {
  background: #fff;
  border: 1px solid #EEF0F4;
  border-radius: 12px;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: block;
}
.dash-kpi:hover {
  border-color: var(--gray-blue);
  box-shadow: 0 4px 20px rgba(42,54,83,0.08);
  transform: translateY(-1px);
}
.dash-kpi-label {
  font-size: 12px;
  color: #8A95A7;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.dash-kpi-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--universe-blue);
  line-height: 1;
}
.dash-kpi-sub {
  font-size: 11px;
  color: #B5BCC9;
  margin-top: 8px;
}

.dash-finance-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.dash-fin {
  background: #F7F9FC;
  border-radius: 10px;
  padding: 14px 16px;
}
.dash-fin-label {
  font-size: 12px;
  color: #8A95A7;
  margin-bottom: 6px;
}
.dash-fin-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--universe-blue);
}
.dash-fin-sub {
  font-size: 11px;
  color: #B5BCC9;
  margin-top: 6px;
}
.dash-fin-sub-xs {
  font-size: 10px;
  color: #C5CCD7;
  margin-top: 2px;
  letter-spacing: 0.2px;
}
.dash-track-hint {
  margin-left: 8px;
  font-size: 11px;
  color: #8A95A7;
  font-weight: 400;
}

/* 損益池 */
.profit-pool-wrap {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
  align-items: center;
  padding-top: 8px;
}
.profit-pool-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.profit-pool-alloc {
  padding: 16px 18px;
  background: #F7F9FC;
  border-radius: 12px;
  border: 1px solid #EAEEF5;
}
.pool-alloc-title {
  font-size: 12px;
  color: #5A6A80;
  font-weight: 500;
  margin-bottom: 10px;
}
.pool-alloc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.pool-alloc-label {
  font-size: 11px;
  color: #8A95A7;
}
.pool-alloc-val {
  font-size: 14px;
  font-weight: 600;
  color: #2A3653;
  margin-top: 2px;
}
.pool-alloc-body {
  font-size: 12px;
  color: #5A6A80;
  line-height: 1.7;
}
@media (max-width: 900px) {
  .profit-pool-wrap { grid-template-columns: 1fr; }
}

/* 三欄明細大卡 */
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
.details-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.details-head {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #EAEEF5;
}
.details-title {
  font-size: 14px;
  font-weight: 600;
  color: #2A3653;
}
.details-sub {
  font-size: 11px;
  color: #8A95A7;
  margin-top: 2px;
}
.expense-item-overdue {
  background: #FFF8F5 !important;
}
.expense-item-overdue .expense-name {
  color: #C53030;
}
@media (max-width: 1100px) {
  .details-grid { grid-template-columns: 1fr; gap: 24px; }
}
.dash-expense-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.dash-print-row {
  margin-top: 24px;
  padding: 18px 20px;
  background: #F7F9FC;
  border-radius: 10px;
  border: 1px dashed #D5DCE6;
}
.dash-print-row .dash-fin-label {
  font-size: 14px;
  font-weight: 600;
  color: #2A3653;
}
.dash-print-row .dash-fin-sub {
  font-size: 12px;
  color: #8A95A7;
  margin-top: 2px;
}
.print-btn-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.print-btn {
  display: block;
  text-decoration: none;
  background: #fff;
  border: 1px solid #D5DCE6;
  border-radius: 8px;
  padding: 14px 16px;
  transition: all 0.15s;
  color: inherit;
}
.print-btn:hover {
  border-color: #3C6392;
  background: #F4F7FB;
  transform: translateY(-1px);
}
.print-btn-title {
  font-size: 14px;
  font-weight: 600;
  color: #2A3653;
}
.print-btn-desc {
  font-size: 12px;
  color: #8A95A7;
  margin-top: 3px;
}
@media (max-width: 900px) {
  .print-btn-row { grid-template-columns: 1fr; }
}
.dash-expense-col {
  background: #F7F9FC;
  border-radius: 10px;
  padding: 14px 16px;
}
.dash-expense-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.expense-list { display: flex; flex-direction: column; gap: 2px; }
.expense-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #EEF0F4;
}
.expense-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--dark-gray);
}
.expense-type {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #EEF2F7;
  color: var(--universe-blue);
  font-weight: 400;
  vertical-align: middle;
}
.expense-note { font-size: 11px; color: #8A95A7; margin-top: 2px; }
.expense-amount {
  font-size: 13px;
  font-weight: 600;
  color: var(--universe-blue);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.expense-total {
  text-align: right;
  padding: 8px 10px 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--universe-blue);
  font-variant-numeric: tabular-nums;
}

.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.dash-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 420px;
  overflow-y: auto;
}
.dash-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.dash-list-item:hover { background: #F7F9FC; }
.dash-list-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--dark-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-list-sub {
  font-size: 11px;
  color: #B5BCC9;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-list-date {
  font-size: 12px;
  color: #8A95A7;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.stage-dist { display: flex; flex-direction: column; gap: 10px; }
.stage-dist-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center;
  gap: 12px;
}
.stage-dist-bar-wrap {
  background: #F0F2F6;
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
}
.stage-dist-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s;
}
.stage-fill-需求       { background: #D9D9D9; }
.stage-fill-提案中     { background: #B5C2CE; }
.stage-fill-製作分鏡   { background: #96AFC5; }
.stage-fill-製作執行中 { background: #6F8DAE; }
.stage-fill-後期       { background: #3C6392; }
.stage-fill-交付完成   { background: #324C77; }
.stage-fill-請款中     { background: #2A3653; }
.stage-fill-結案       { background: #0F0F1B; }
.stage-dist-count { text-align: right; color: #8A95A7; font-variant-numeric: tabular-nums; font-weight: 500; }

/* 週任務卡片 */
.dash-week-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.card-title-sub {
  margin-left: 8px;
  font-size: 11px;
  color: #B5BCC9;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.task-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.task-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.task-item:hover {
  background: #F7F9FC;
  border-color: #E9EEF5;
}
.task-item-done { opacity: 0.7; }
.task-item-done .task-name { text-decoration: line-through; color: #8A95A7; }
.task-date {
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
  line-height: 1.3;
}
.task-weekday {
  font-size: 13px;
  font-weight: 600;
  color: var(--universe-blue);
}
.task-mmdd {
  font-size: 12px;
  color: var(--sky-blue);
  font-weight: 500;
  margin-top: 2px;
}
.task-main { min-width: 0; }
.task-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--dark-gray);
  line-height: 1.4;
}
.task-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #8A95A7;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.task-proj { color: var(--universe-blue); font-weight: 500; }
.task-dim  { color: #B5BCC9; }
.task-note {
  margin-top: 4px;
  font-size: 11px;
  color: #8A95A7;
  background: #F7F9FC;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1.5;
}
.empty-soft { color: #C0C6D1; padding: 24px 0; text-align: center; font-size: 13px; }

.line-summary {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.9;
  color: #2A3653;
  padding: 4px 2px 8px;
}
.line-meta {
  font-size: 11px;
  color: #B5BCC9;
  border-top: 1px dashed rgba(42, 54, 83, 0.1);
  padding-top: 8px;
  margin-top: 4px;
}

.line-group-block {
  padding: 10px 0;
  border-top: 1px solid rgba(42, 54, 83, 0.08);
}
.line-group-block:first-of-type { border-top: none; padding-top: 4px; }
.line-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.line-group-name {
  font-size: 13px;
  font-weight: 600;
  color: #2A3653;
}

@media (max-width: 1200px) {
  .dash-week-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1200px) {
  .dash-top-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-finance-row { grid-template-columns: repeat(2, 1fr); }
  .dash-two-col { grid-template-columns: 1fr; }
  .dash-top-row { grid-template-columns: 1fr; }
  .dash-week-grid { grid-template-columns: 1fr; }
  .dash-expense-row { grid-template-columns: 1fr; }
  .dash-bounty-grid { grid-template-columns: 1fr; }
}

/* ── 任務布告欄 ────────────────────────────────────────── */

.dash-bounty-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.bounty-card {
  border: 1px solid #E8ECF2;
}
.bounty-item {
  grid-template-columns: 56px 1fr auto;
  background: #FAFBFD;
  border: 1px solid #EDEFF4;
}
.bounty-item:hover {
  background: #F3F6FA;
}
.btn-claim {
  align-self: center;
  background: var(--universe-blue);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-claim:hover:not(:disabled) {
  background: var(--sky-blue);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(42,54,83,0.2);
}
.btn-claim:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── 支出進項 ────────────────────────────────────────── */

.expense-card {
  background: var(--white);
  border: 1px solid #E8ECF2;
  border-radius: 14px;
  margin-bottom: 14px;
  overflow: hidden;
}
.expense-card-head {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: #F7F9FC;
  border-bottom: 1px solid #E8ECF2;
  user-select: none;
}
.expense-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #2A3653;
}
.expense-count {
  margin-left: 8px;
  font-weight: 400;
  color: #8A95A7;
  font-size: 12px;
}
.expense-card-total {
  margin-left: auto;
  font-size: 15px;
  font-weight: 600;
  color: #2A3653;
  font-variant-numeric: tabular-nums;
}
.expense-card[data-status="待出帳"] .expense-card-head { background: #F2F3F5; }
.expense-card[data-status="可出帳"] .expense-card-head { background: #D8E2EC; }
.expense-card[data-status="可出帳"] .expense-card-title,
.expense-card[data-status="可出帳"] .expense-card-total { color: #2A3653; }
.expense-card[data-status="已出帳"] .expense-card-head { background: #2A3653; }
.expense-card[data-status="已出帳"] .expense-card-title,
.expense-card[data-status="已出帳"] .expense-card-total,
.expense-card[data-status="已出帳"] .expense-count { color: #FFFFFF; }

/* ── 內部支出四張卡片 · 華特品牌藍色系階層 ─────────────────── */
/* 全部用 Gray Blue / Sky Blue / Universe Blue 的深淺，左側 4px accent bar 區分 */
.expense-card--pending,
.expense-card--approved,
.expense-card--paid,
.expense-card--template {
  border-left-width: 4px;
  border-left-style: solid;
}

/* ① 員工代墊款：Gray Blue Alt（最淺，待處理） */
.expense-card--pending { border-left-color: #9EACB9; border-color: #E8ECF2; border-left-color: #9EACB9; }
.expense-card--pending .expense-card-head {
  background: #F4F6FA;
  border-bottom-color: #E8ECF2;
}
.expense-card--pending .expense-card-title { color: #2A3653; }
.expense-card--pending .expense-card-total { color: #5A6A80; }

/* ② 本期出帳：Gray Blue（中階，已審） */
.expense-card--approved { border-color: #C6D4E2; border-left-color: #96AFC5; }
.expense-card--approved .expense-card-head {
  background: #E4ECF5;
  border-bottom-color: #C6D4E2;
}
.expense-card--approved .expense-card-title { color: #2A3653; }
.expense-card--approved .expense-card-total { color: #3C6392; }

/* ③ 本期已出帳：Universe Blue 深色（完成） */
.expense-card--paid { border-color: #2A3653; border-left-color: #0F0F1B; }
.expense-card--paid .expense-card-head {
  background: linear-gradient(135deg, #2A3653 0%, #0F0F1B 100%);
  border-bottom-color: #0F0F1B;
}
.expense-card--paid .expense-card-title,
.expense-card--paid .expense-count { color: #FFFFFF; }
.expense-card--paid .expense-card-total { color: #96AFC5; }

/* ④ 經常性支出範本：Sky Blue（設定） */
.expense-card--template { border-color: #E8ECF2; border-left-color: #3C6392; }
.expense-card--template .expense-card-head {
  background: #FAFBFD;
  border-bottom-color: #E8ECF2;
}
.expense-card--template .expense-card-title { color: #2A3653; }
.expense-card--template .expense-card-total { color: #3C6392; }

.expense-card-body { padding: 4px 20px 12px; }

.expense-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.expense-table th {
  text-align: left;
  padding: 10px 8px;
  color: #0F0F1B;
  font-weight: 600;
  border-bottom: 1px solid #E8ECF2;
  font-size: 11px;
  letter-spacing: 0.5px;
}
.expense-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #F2F3F5;
  color: #2A3653;
}
.expense-table tbody tr:hover { background: #FAFBFD; cursor: pointer; }
.expense-table tbody tr:last-child td { border-bottom: none; }

.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.type-vendor { background: #E8EDF2; color: #3C6392; }
.type-internal { background: #F2F3F5; color: #5A6A80; }

.items-badge {
  margin-left: 6px;
  font-size: 11px;
  color: #8A95A7;
}

.group-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: #EEF2F8;
  color: #3C6392;
  font-weight: 500;
}

.next-payout-chip {
  display: inline-block;
  margin-left: 10px;
  color: #8A95A7;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.expense-table tr.group-row {
  background: #F8FAFD;
  cursor: pointer;
}
.expense-table tr.group-row:hover {
  background: #EEF3F9;
}
.expense-table tr.group-row td strong {
  color: #2A3653;
}

/* 行內展開明細 */
.expense-table tr.detail-row > td {
  background: #FAFBFD;
  padding: 14px 18px;
  border-top: none;
}
.detail-panel {
  font-size: 13px;
  color: #4A5670;
}
.detail-panel .inline-table {
  margin: 0;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #E8ECF2;
  table-layout: fixed;
  width: 100%;
}
.detail-panel .inline-table th,
.detail-panel .inline-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.detail-panel .inline-table tr.detail-section-row > td {
  background: #F2F5FA;
  color: #5A6A80;
  font-size: 12px;
  padding: 8px 12px;
  border-top: 1px solid #E8ECF2;
  white-space: normal;
}
.detail-panel .inline-table tr.detail-section-row:first-child > td {
  border-top: none;
}
.detail-panel .inline-table tr.detail-section-row strong {
  color: #2A3653;
  font-size: 13px;
  margin-left: 4px;
}
.detail-rec {
  margin-bottom: 12px;
}
.detail-rec:last-child { margin-bottom: 0; }
.detail-rec-head {
  font-size: 12px;
  color: #5A6A80;
  margin-bottom: 6px;
  padding: 4px 0;
}
.detail-rec-head strong {
  color: #2A3653;
  font-size: 14px;
}
.detail-loading {
  color: #8A95A7;
  font-size: 12px;
  padding: 6px 0;
}

/* 抽屜內文字放大一點 */
.drawer .group-rec-date { font-size: 13px; }
.drawer .group-rec-total { font-size: 18px; }
.drawer .group-summary { font-size: 14px; }
.drawer .group-summary strong { font-size: 18px; }
.drawer .btn-payout {
  padding: 10px 22px;
  font-size: 14px;
}

.group-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #F4F7FB;
  border-radius: 8px;
  margin-bottom: 14px;
  color: #4A5670;
  font-size: 13px;
}
.group-summary strong {
  color: #2A3653;
  font-size: 16px;
}

.btn-batch, .btn-payout {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #3C6392;
  background: #3C6392;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn-batch:hover, .btn-payout:hover {
  background: #2A3653;
  border-color: #2A3653;
}

.group-rec {
  border: 1px solid #E4E9F0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fff;
}
.group-rec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #E4E9F0;
}
.group-rec-date {
  font-size: 12px;
  color: #8A95A7;
}
.group-rec-total {
  font-size: 15px;
  font-weight: 600;
  color: #2A3653;
  margin-top: 2px;
}

.status-select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #E0E4EA;
  font-size: 12px;
  background: #FFFFFF;
  cursor: pointer;
}

/* 彈窗 */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(15, 15, 27, 0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1200;
}
.modal {
  background: #FFFFFF;
  border-radius: 14px;
  padding: 24px;
  width: 520px;
  max-width: 90vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(15, 15, 27, 0.2);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0; font-size: 16px; color: #2A3653; }

.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 12px;
  color: #5A6A80;
  margin-bottom: 4px;
  font-weight: 500;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #E0E4EA;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  background: #FFFFFF;
  color: #2A3653;
}
.form-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px;
}

.btn-primary {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: #2A3653;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-primary:hover { background: #1F2840; }
.btn-secondary {
  padding: 8px 18px;
  border: 1px solid #2A3653;
  border-radius: 8px;
  background: #FFFFFF;
  color: #2A3653;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-secondary:hover { background: #F7F9FC; }
.btn-ghost {
  padding: 6px 12px;
  border: 1px solid #E0E4EA;
  border-radius: 6px;
  background: #FFFFFF;
  color: #5A6A80;
  font-size: 12px;
  cursor: pointer;
}
.btn-ghost:hover { background: #F7F9FC; }

/* 抽屜 */
.drawer-bg {
  position: fixed; inset: 0;
  background: rgba(15, 15, 27, 0.4);
  display: flex; justify-content: flex-end;
  z-index: 100;
}
.drawer {
  background: #FFFFFF;
  width: 620px;
  max-width: 92vw;
  height: 100%;
  padding: 24px;
  overflow-y: auto;
  box-shadow: -20px 0 60px rgba(15, 15, 27, 0.2);
}

/* ── Card gradient：第一排深字 ── */
.project-card.row-light { border-color: transparent; }
.project-card.row-light .card-num,
.project-card.row-light .card-name,
.project-card.row-light .card-pm { color: var(--universe-blue); }
.project-card.row-light .card-pct { color: rgba(42,54,83,0.6); }
.project-card.row-light .progress-bar { background: rgba(42,54,83,0.18); }
.project-card.row-light .progress-fill { background: var(--universe-blue); }
.project-card.row-light .next-task-block {
  background: rgba(42,54,83,0.08);
  border-left-color: var(--universe-blue);
}
.project-card.row-light .next-task-label,
.project-card.row-light .next-task-name { color: var(--universe-blue); }
.project-card.row-light .next-task-note,
.project-card.row-light .next-task-due { color: rgba(42,54,83,0.65); }
.project-card.row-light:hover { box-shadow: 0 4px 20px rgba(42,54,83,0.2); border-color: transparent; }

/* ── Card gradient：第二排起淺字 ── */
.project-card.card-dark { border-color: transparent; }
.project-card.card-dark .card-num { color: rgba(255,255,255,0.7); }
.project-card.card-dark .card-name { color: #FFFFFF; }
.project-card.card-dark .card-pm { color: rgba(255,255,255,0.75); }
.project-card.card-dark .card-pct { color: rgba(255,255,255,0.65); }
.project-card.card-dark .progress-bar { background: rgba(255,255,255,0.22); }
.project-card.card-dark .progress-fill { background: rgba(255,255,255,0.9); }
.project-card.card-dark .next-task-block {
  background: rgba(255,255,255,0.12);
  border-left-color: rgba(255,255,255,0.65);
}
.project-card.card-dark .next-task-label { color: rgba(255,255,255,0.85); }
.project-card.card-dark .next-task-name { color: #FFFFFF; }
.project-card.card-dark .next-task-note { color: rgba(255,255,255,0.7); }
.project-card.card-dark .next-task-due { color: rgba(255,255,255,0.7); }
.project-card.card-dark:hover { box-shadow: 0 4px 24px rgba(0,0,0,0.28); border-color: transparent; }

/* ── 後期資訊列表 ────────────────────────────────────── */

.post-update-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.post-update-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: #FAFBFD;
  border: 1px solid #EDEFF4;
  transition: all 0.15s;
}
.post-update-item:hover {
  background: #F1F4F9;
  border-color: #D9E0EC;
  transform: translateY(-1px);
}
.pu-date {
  text-align: center;
  color: var(--universe-blue);
  line-height: 1.2;
  padding: 4px 0;
  border-right: 1px solid #E3E7EE;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.pu-date-top {
  font-size: 13px;
  color: #8A95A7;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.pu-date-bottom {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.pu-date.pu-date-solo .pu-date-top {
  font-size: 18px;
  color: var(--universe-blue);
  font-weight: 700;
  letter-spacing: 1px;
}
.pu-main { min-width: 0; }
.pu-title { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 4px; }
.pu-meta { font-size: 12px; color: #8A95A7; display: flex; flex-wrap: wrap; gap: 10px; }
.pu-progress {
  font-weight: 600;
  color: var(--universe-blue);
  font-variant-numeric: tabular-nums;
}
.pu-action {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pu-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.pu-badge.done { background: #e8f5ea; color: #3b7a4b; }
.pu-badge.progress { background: #fff4d9; color: #8a6b1f; }
.pu-badge.pending { background: #eef1f6; color: #8A95A7; }

/* ── 後期更新 Modal ─────────────────────────────────────── */

.pu-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,15,27,0.55);
  z-index: 800;
}
.pu-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(15,15,27,0.4);
  width: 92%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  z-index: 810;
}
.pu-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #EDEFF4;
}
.pu-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--universe-blue);
}
.pu-modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #8A95A7;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.pu-modal-close:hover { background: #F1F4F9; color: #333; }
.pu-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
}
.pu-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid #EDEFF4;
}

/* ── 後期詳細頁 ────────────────────────────────────────── */

.post-detail-wrap {
  max-width: 980px;
  margin: 0 auto;
}
.post-detail-header {
  background: var(--white);
  border: 1px solid #E8ECF2;
  border-radius: 14px;
  padding: 28px 32px;
  margin-bottom: 20px;
}
.post-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: #666;
  margin-bottom: 10px;
}
.post-detail-meta .sep { color: #C8CEDA; }
.post-detail-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--universe-blue);
  margin-bottom: 14px;
}
.post-detail-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--sky-blue);
  text-decoration: none;
  margin-top: 4px;
}
.post-detail-link:hover { text-decoration: underline; }

.post-item-list {
  background: var(--white);
  border: 1px solid #E8ECF2;
  border-radius: 14px;
  padding: 24px 28px;
}
.post-item {
  display: grid;
  grid-template-columns: 36px 32px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #F1F4F9;
  align-items: flex-start;
}
.post-item:last-child { border-bottom: none; }
.post-item-order {
  font-size: 18px;
  font-weight: 700;
  color: var(--universe-blue);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
}
.post-item-check {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid #C8CEDA;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-size: 16px;
  color: transparent;
  transition: all 0.15s;
  margin-top: 1px;
}
.post-item-check:hover { border-color: var(--sky-blue); }
.post-item-check.done {
  background: var(--universe-blue);
  border-color: var(--universe-blue);
  color: #fff;
}
.post-item-text {
  font-size: 16px;
  line-height: 1.7;
  color: #333;
}
.post-item-text.done {
  text-decoration: line-through;
  color: #8A95A7;
}
.post-item-note {
  font-size: 14px;
  color: #666;
  margin-top: 4px;
  line-height: 1.7;
  padding-left: 14px;
  border-left: 3px solid #E3E7EE;
  white-space: pre-wrap;
}
.post-item-note.done { color: #A8B0BD; }
.post-item-done-meta {
  font-size: 11px;
  color: #8A95A7;
  margin-top: 4px;
}

.post-progress-bar {
  margin-top: 20px;
  padding: 14px 18px;
  background: #F4F6FA;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.post-progress-label {
  font-size: 13px;
  color: #666;
  font-weight: 600;
}
.post-progress-track {
  flex: 1;
  height: 8px;
  background: #E3E7EE;
  border-radius: 4px;
  overflow: hidden;
}
.post-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sky-blue), var(--universe-blue));
  transition: width 0.4s;
}
.post-progress-text {
  font-size: 13px;
  color: var(--universe-blue);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── 後期項目：編輯 + footer ────────────────────────────── */

.post-item-body { min-width: 0; }
.post-item-text, .post-item-note {
  cursor: text;
  padding: 2px 4px;
  border-radius: 5px;
  transition: background 0.15s;
}
.post-item-text:hover, .post-item-note:hover {
  background: #F4F6FA;
}
.post-item-note.empty {
  color: #B5BCC9;
  font-style: italic;
  padding-left: 14px;
  border-left: 3px dashed #E3E7EE;
}

.post-item-edit-input {
  width: 100%;
  border: 2px solid var(--sky-blue);
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit;
  color: #333;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}
.post-item-edit-input.multi {
  min-height: 70px;
  resize: vertical;
  line-height: 1.7;
}

.post-item-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
  min-height: 14px;
}
.post-item-updated-meta {
  font-size: 11px;
  color: #B5BCC9;
  font-variant-numeric: tabular-nums;
}
.post-item-done-meta {
  font-size: 11px;
  color: #3b7a4b;
  font-variant-numeric: tabular-nums;
}

/* ── 連結編輯 ────────────────────────────────────── */

.post-detail-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.post-link-edit-btn {
  background: transparent;
  border: 1px solid #E3E7EE;
  color: #8A95A7;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s;
  padding: 0;
}
.post-link-edit-btn:hover {
  background: #F4F6FA;
  color: var(--universe-blue);
  border-color: var(--sky-blue);
}
.post-link-add-btn {
  background: transparent;
  border: 1px dashed #C8CEDA;
  color: #8A95A7;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.post-link-add-btn:hover {
  border-color: var(--sky-blue);
  color: var(--universe-blue);
  background: #F4F6FA;
}
.post-link-edit-input {
  flex: 1;
  min-width: 300px;
  border: 2px solid var(--sky-blue);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: #333;
  outline: none;
  font-family: inherit;
}

/* ── 專案紀錄列表：連結按鈕 ─────────────────────── */

.pu-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  background: #F1F4F9;
  cursor: pointer;
  font-size: 14px;
  border: 1px solid #E3E7EE;
  transition: all 0.15s;
}
.pu-link-btn:hover {
  background: #DCE5EF;
  border-color: var(--sky-blue);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(60,99,146,0.2);
}

/* ── 收款條件 Modal Table ────────────────────────── */

.stages-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.stages-table thead th {
  background: #F4F6FA;
  color: #5A6476;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #E3E7EE;
  white-space: nowrap;
}
.stages-table tbody td {
  padding: 8px;
  border-bottom: 1px solid #F1F4F9;
  vertical-align: middle;
}
.stages-table tfoot td {
  padding: 10px 8px;
  background: #FAFBFD;
  border-top: 1px solid #E3E7EE;
}
.stages-table .col-pct    { width: 90px;  text-align: right; white-space: nowrap; position: relative; }
.stages-table .col-amt    { width: 110px; text-align: right; white-space: nowrap; }
.stages-table .col-name   { min-width: 260px; }
.stages-table .col-status { width: 82px;  white-space: nowrap; }
.stages-table .col-inv    { width: 120px; white-space: nowrap; font-variant-numeric: tabular-nums; color: #555; }
.stages-table .col-recv   { width: 145px; white-space: nowrap; }
.stages-table .col-act    { width: 150px; white-space: nowrap; text-align: right; }

.stage-inline-input.pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-right: 22px;
}
/* 移除 number input 的上下箭頭（若瀏覽器仍顯示） */
.stage-inline-input::-webkit-outer-spin-button,
.stage-inline-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.stage-inline-input[type="number"] {
  -moz-appearance: textfield;
}
.pct-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #8A95A7;
  pointer-events: none;
}

#stagesList { overflow-x: auto; }
#stagesModal .modal { max-height: 88vh; overflow-y: auto; }

.stage-inline-input {
  border: 1px solid transparent;
  background: transparent;
  padding: 5px 8px;
  font-size: 13px;
  border-radius: 6px;
  width: 100%;
  color: #333;
  transition: all 0.15s;
  font-family: inherit;
}
.stage-inline-input:hover {
  background: #F4F6FA;
}
.stage-inline-input:focus {
  background: #fff;
  border-color: var(--sky-blue);
  outline: none;
  box-shadow: 0 0 0 2px rgba(60,99,146,0.1);
}
.stage-inline-input.amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stage-inline-input.date {
  font-size: 12px;
  padding: 5px 6px;
}
.stage-locked {
  color: #333;
  font-variant-numeric: tabular-nums;
  padding: 5px 8px;
  display: inline-block;
}
.stage-locked-dim {
  color: #C0C6D1;
  padding: 5px 8px;
  display: inline-block;
}

.stage-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.stage-status.pending {
  background: #FFF4D9;
  color: #8A6B1F;
}
.stage-status.issued {
  background: #E3F0FF;
  color: var(--universe-blue);
}

.btn-stage-issue,
.btn-stage-void,
.btn-stage-del {
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-stage-issue {
  background: var(--universe-blue);
  color: #fff;
}
.btn-stage-issue:hover {
  background: var(--sky-blue);
  transform: translateY(-1px);
}
.btn-stage-void {
  background: #fff;
  color: #C8463C;
  border: 1px solid #EAAFA8;
}
.btn-stage-void:hover {
  background: #FCEEEC;
}
.btn-stage-del {
  background: transparent;
  color: #B5BCC9;
  padding: 4px 8px;
  margin-left: 4px;
}
.btn-stage-del:hover {
  color: #C8463C;
  background: #FCEEEC;
}

/* ── 開案 Modal ──────────────────────────────────────── */

.np-modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(15,15,27,0.55);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.np-modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(15,15,27,0.4);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.np-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #EDEFF4;
}
.np-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--universe-blue);
}
.np-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
}
.np-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid #EDEFF4;
}

/* ── 員工儀表板 ────────────────────────────────────── */

.emp-dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 900px) {
  .emp-dash-grid-2 { grid-template-columns: 1fr; }
}

.emp-labor-hint {
  background: #FFF4D9;
  color: #8A6B1F;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 10px;
  font-weight: 500;
}
.emp-labor-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
}
.emp-labor-row {
  display: grid;
  grid-template-columns: 50px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 10px;
  border-radius: 8px;
  background: #FAFBFD;
  border: 1px solid #EDEFF4;
  transition: background 0.15s;
}
.emp-labor-row:hover { background: #F3F6FA; }
.emp-labor-date {
  font-size: 12px;
  color: #5A6476;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}
.emp-labor-main { min-width: 0; }
.emp-labor-payee {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}
.emp-labor-amt {
  font-size: 12px;
  color: #8A95A7;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.emp-labor-status { white-space: nowrap; }
.emp-labor-pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #E3E7EE;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}
.emp-labor-pdf:hover {
  background: #F1F4F9;
  border-color: var(--sky-blue);
}

.lb-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.lb-pill.lb-pending { background: #FFF4D9; color: #8A6B1F; }
.lb-pill.lb-ready   { background: #E3F0FF; color: var(--universe-blue); }
.lb-pill.lb-done    { background: #E8F5EC; color: #2F855A; }

/* 子任務排序按鈕（純圖示、置中、加粗） */
.task-sort-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Symbol", system-ui, sans-serif;
}
