/* Notion 風格的頁面位置、表格、標題（D-148）。只用 tokens.css 的變數；在所有樣式之後載入，覆蓋 base.css、components.css。 */

/* 頁面位置：標題上方一行，字級比內文大一級、深色字，分隔線淡色（對照 Notion）。返回連結（.back-link）在這裡不是膠囊按鈕 */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-bottom: var(--space-2);
  color: var(--color-text);
  font-size: var(--font-size-crumbs);
  line-height: 1.5;
}

.crumbs a,
.crumbs .back-link {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  margin: 0;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  color: var(--color-text);
  font-size: inherit;
  font-weight: 400;
  text-decoration: none;
}

.crumbs a:hover,
.crumbs .back-link:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.crumbs [aria-current="page"] {
  padding: 2px 6px;
  color: var(--color-text);
}

.crumbs > span[aria-hidden="true"] {
  color: var(--color-border-strong);
}

/* 窄螢幕：連結維持足夠的點擊高度 */
@media (max-width: 767.98px) {
  .crumbs a,
  .crumbs .back-link {
    min-height: var(--control-height);
  }
}

/* 頁面標題：放大加粗，和下方內容拉開 */
.page-title {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
}

.page-header {
  margin-bottom: var(--space-2);
}

@media (max-width: 767.98px) {
  .page-title {
    font-size: 26px;
  }
}

/* 表格：Notion 資料庫的樣子。欄與欄之間細直線、列之間細橫線、列高放寬、整列 hover 淺灰 */
.table th,
.table td {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.table th + th,
.table td + td {
  border-left: 1px solid var(--color-border);
}

.table thead th {
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--font-size-small);
  font-weight: 400;
}

.table tbody tr:hover {
  background: var(--color-row-hover);
}

/* 欄位標題的線條圖示：種類由 <tr> 的 data-i<欄序> 決定（_components.html 的 col_kind），圖形在同源的 icons.svg；
   欄位最多 10 欄，超過的欄不畫圖示 */
.table thead th::before {
  content: "";
  display: none;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  background-color: var(--color-text-secondary);
  mask-position: center;
  mask-size: contain;
  mask-repeat: no-repeat;
}

.table thead th.num::before {
  margin-right: 4px;
}

.table thead tr[data-i1="text"] > th:nth-child(1)::before,
.table thead tr[data-i2="text"] > th:nth-child(2)::before,
.table thead tr[data-i3="text"] > th:nth-child(3)::before,
.table thead tr[data-i4="text"] > th:nth-child(4)::before,
.table thead tr[data-i5="text"] > th:nth-child(5)::before,
.table thead tr[data-i6="text"] > th:nth-child(6)::before,
.table thead tr[data-i7="text"] > th:nth-child(7)::before,
.table thead tr[data-i8="text"] > th:nth-child(8)::before,
.table thead tr[data-i9="text"] > th:nth-child(9)::before,
.table thead tr[data-i10="text"] > th:nth-child(10)::before {
  display: inline-block;
  mask-image: url("/static/icons.svg#text");
}

.table thead tr[data-i1="date"] > th:nth-child(1)::before,
.table thead tr[data-i2="date"] > th:nth-child(2)::before,
.table thead tr[data-i3="date"] > th:nth-child(3)::before,
.table thead tr[data-i4="date"] > th:nth-child(4)::before,
.table thead tr[data-i5="date"] > th:nth-child(5)::before,
.table thead tr[data-i6="date"] > th:nth-child(6)::before,
.table thead tr[data-i7="date"] > th:nth-child(7)::before,
.table thead tr[data-i8="date"] > th:nth-child(8)::before,
.table thead tr[data-i9="date"] > th:nth-child(9)::before,
.table thead tr[data-i10="date"] > th:nth-child(10)::before {
  display: inline-block;
  mask-image: url("/static/icons.svg#date");
}

.table thead tr[data-i1="status"] > th:nth-child(1)::before,
.table thead tr[data-i2="status"] > th:nth-child(2)::before,
.table thead tr[data-i3="status"] > th:nth-child(3)::before,
.table thead tr[data-i4="status"] > th:nth-child(4)::before,
.table thead tr[data-i5="status"] > th:nth-child(5)::before,
.table thead tr[data-i6="status"] > th:nth-child(6)::before,
.table thead tr[data-i7="status"] > th:nth-child(7)::before,
.table thead tr[data-i8="status"] > th:nth-child(8)::before,
.table thead tr[data-i9="status"] > th:nth-child(9)::before,
.table thead tr[data-i10="status"] > th:nth-child(10)::before {
  display: inline-block;
  mask-image: url("/static/icons.svg#status");
}

.table thead tr[data-i1="person"] > th:nth-child(1)::before,
.table thead tr[data-i2="person"] > th:nth-child(2)::before,
.table thead tr[data-i3="person"] > th:nth-child(3)::before,
.table thead tr[data-i4="person"] > th:nth-child(4)::before,
.table thead tr[data-i5="person"] > th:nth-child(5)::before,
.table thead tr[data-i6="person"] > th:nth-child(6)::before,
.table thead tr[data-i7="person"] > th:nth-child(7)::before,
.table thead tr[data-i8="person"] > th:nth-child(8)::before,
.table thead tr[data-i9="person"] > th:nth-child(9)::before,
.table thead tr[data-i10="person"] > th:nth-child(10)::before {
  display: inline-block;
  mask-image: url("/static/icons.svg#person");
}

.table thead tr[data-i1="number"] > th:nth-child(1)::before,
.table thead tr[data-i2="number"] > th:nth-child(2)::before,
.table thead tr[data-i3="number"] > th:nth-child(3)::before,
.table thead tr[data-i4="number"] > th:nth-child(4)::before,
.table thead tr[data-i5="number"] > th:nth-child(5)::before,
.table thead tr[data-i6="number"] > th:nth-child(6)::before,
.table thead tr[data-i7="number"] > th:nth-child(7)::before,
.table thead tr[data-i8="number"] > th:nth-child(8)::before,
.table thead tr[data-i9="number"] > th:nth-child(9)::before,
.table thead tr[data-i10="number"] > th:nth-child(10)::before {
  display: inline-block;
  mask-image: url("/static/icons.svg#number");
}

.table thead tr[data-i1="relation"] > th:nth-child(1)::before,
.table thead tr[data-i2="relation"] > th:nth-child(2)::before,
.table thead tr[data-i3="relation"] > th:nth-child(3)::before,
.table thead tr[data-i4="relation"] > th:nth-child(4)::before,
.table thead tr[data-i5="relation"] > th:nth-child(5)::before,
.table thead tr[data-i6="relation"] > th:nth-child(6)::before,
.table thead tr[data-i7="relation"] > th:nth-child(7)::before,
.table thead tr[data-i8="relation"] > th:nth-child(8)::before,
.table thead tr[data-i9="relation"] > th:nth-child(9)::before,
.table thead tr[data-i10="relation"] > th:nth-child(10)::before {
  display: inline-block;
  mask-image: url("/static/icons.svg#relation");
}

/* 狀態標籤：前面一個同色小圓點 */
.tag::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

/* 整列都能點（D-155；app.js）：有主要連結的列顯示手指游標 */
.table tbody tr:has(td:first-child a[href]:not(.btn)),
.ws-tasks .table tbody tr:has(.row-actions a[href]),
.workbench-list .table tbody tr:has(td:nth-child(3) a[href]) {
  cursor: pointer;
}

/* 下拉選單：自己畫箭頭，離右邊界固定 14px（瀏覽器內建的箭頭在膠囊形欄位裡太靠右；D-156） */
select.input {
  padding-right: 34px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-text-secondary) 50%),
    linear-gradient(135deg, var(--color-text-secondary) 50%, transparent 50%);
  background-position:
    right 19px center,
    right 14px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

/* 篩選列的膠囊形選單另有自己的內距（crm.css），這裡補回箭頭的空間 */
.filter-bar select.input {
  padding-right: 38px;
}

/* 手機寬度（D-161）：導覽預設收合成一列（☰ 與名稱），按 ☰ 才展開成直排；
   沒有 JavaScript（沒有 js-nav）時維持原本全部展開的兩行 */
@media (max-width: 767.98px) {
  .js-nav .nav-toggle {
    display: block;
    position: absolute;
    top: 6px;
    left: var(--space-2);
    background: none;
  }

  .js-nav .shell > nav {
    min-height: 48px;
    padding-left: 52px;
    justify-content: center;
  }

  .js-nav:not(.nav-open) .shell > nav .nav-link,
  .js-nav:not(.nav-open) .sidebar-user {
    display: none;
  }

  .js-nav.nav-open .sidebar-main {
    flex-direction: column;
    align-items: stretch;
  }

  .js-nav.nav-open .shell > nav {
    padding-bottom: var(--space-3);
  }
}

/* 表格捲動區當定位基準：列內的 .visually-hidden（絕對定位）才會留在捲動區裡，
   不會把手機寬度的整頁撐寬（D-161） */
.table-wrap,
.gantt-scroll {
  position: relative;
}

/* 案件階段標籤依大階段上色（D-165；class 由 app.js 依標籤文字加上） */
.tag.stage-plan {
  background: var(--color-stage-plan-tint);
  color: var(--color-stage-plan);
}

.tag.stage-sign {
  background: var(--color-stage-sign-tint);
  color: var(--color-stage-sign);
}

.tag.stage-run {
  background: var(--color-stage-run-tint);
  color: var(--color-stage-run);
}
