/* Asset & Security Governance Platform - main styles 資產與資安治理平台主樣式
   極簡、大按鈕、指令明確（MES 風格）。
   規範：不使用 style="..." 屬性，樣式一律放在這裡（CSP 禁止 inline style）。
   Rule: no style="..." attributes in templates; all styling lives here (CSP forbids inline styles). */

:root {
  --bg: #dde1e7;   /* 底色：更深的灰，讓白色卡片更突出 Background: a darker grey so the white cards stand out */
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #586474;   /* 輔助文字：在更深的灰底上也要有 4.5:1 的對比 Secondary text: 4.5:1 even on the darker grey page */
  --line: #c3cad4;
  --primary: #1d5fd1;
  --primary-dark: #174ba5;
  --success: #2f9e5b;
  --danger: #c93636;
  --danger-dark: #a52a2a;
  --radius: 14px;
  /* 頂部列：石墨色（深灰）加淺色文字 Top bar: graphite with light text */
  --header-bg: #1f2933;
  --header-border: #1f2933;
  --header-text: #ffffff;
  --header-muted: #b4bdc8;
  --header-divider: rgba(255, 255, 255, 0.22);
  --header-hover-bg: rgba(255, 255, 255, 0.1);
  --header-hover-text: #ffffff;
  --header-active-bg: rgba(255, 255, 255, 0.2);
  --header-active-text: #ffffff;
  --header-btn-border: rgba(255, 255, 255, 0.5);
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 1.05rem;
}

/* 頂部列 Top bar */
.app-header { background: var(--header-bg); border-bottom: 1px solid var(--header-border); }
.app-header-inner {
  padding: 0.9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.app-title { font-size: 1.35rem; font-weight: 700; color: var(--header-text); text-decoration: none; white-space: nowrap; }
.app-header-left { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; min-width: 0; }
.app-user { display: flex; align-items: center; gap: 0.9rem; font-size: 1rem; color: var(--header-muted); flex-shrink: 0; white-space: nowrap; }   /* 不被擠壓，email 與登出不會重疊 Never squeezed, so the email and Log out cannot overlap */

/* 滿版：不限制最大寬度，只留左右內距 Full width: no max-width, only side padding */
.app-main { padding: 1.5rem 1.5rem 3rem; }

/* 大按鈕 Big action buttons */
.action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 96px; width: 100%; padding: 1rem;
  font-size: 1.25rem; font-weight: 600; text-decoration: none;
  border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  transition: background-color 0.15s, border-color 0.15s, transform 0.05s;
}
.action-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.action-btn:active:not(:disabled) { transform: scale(0.99); }
.action-btn:focus-visible { outline: 3px solid rgba(29, 95, 209, 0.35); outline-offset: 2px; }
.action-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.action-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.action-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.action-danger { color: var(--danger); border-color: var(--danger); }
.action-danger:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: #fff; }

/* 資產清單 Asset list */
.list-card {
  margin-top: 1.5rem; padding: 1.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.list-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }
.list-toolbar { display: flex; align-items: stretch; gap: 1rem; margin-bottom: 1rem; }
.toolbar-search-form { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: nowrap; gap: 0.5rem; }   /* 寬螢幕：新增、搜尋、篩選、匯出全部同一列 Wide screens: everything on one row */
@media (max-width: 1299px) { .toolbar-search-form { flex-wrap: wrap; } }   /* 視窗不夠寬才換行 Wrap only when there is no room */
.toolbar-search { flex: 1 1 14rem; width: auto; min-width: 10rem; }   /* 吃掉剩下的寬度，不再佔滿一整列（否則其他東西會被擠到第二行）Takes the rest; it must not claim a full row, or the rest is pushed to a second line */
.toolbar-status { flex: 0 0 7.5rem; width: 7.5rem; }   /* 狀態與類型：只放得下四五個字 Status and type: room for four or five characters */
.stocktake-answer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }   /* 盤點頁：確認／問題／說明排一列 Stocktake page: confirm / problem / note on one row */
.stocktake-answer label { margin: 0; white-space: nowrap; }
.stocktake-answer .form-control { flex: 1 1 14rem; min-width: 12rem; }
.stocktake-shortcuts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }   /* 有問題的那一列：處理的捷徑 Shortcuts to deal with a problem, in its row */
.stocktake-inline { display: flex; gap: 0.5rem; align-items: center; }
.stocktake-inline .form-control { min-width: 16rem; }
.stocktake-hint { display: flex; align-items: center; }
.filter-tag { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0.4rem 0.2rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 1rem; font-weight: 600; color: var(--text); }   /* 篩選標籤 A filter tag */
.filter-tag a { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; color: var(--muted); text-decoration: none; }
.filter-tag a:hover { background: #e6e9ee; color: var(--text); }
.toolbar-department { flex: 0 0 11rem; width: 11rem; }   /* 部門：放得下七個字的名稱，更長的由下拉自己截斷 Department: fits a seven-character name; longer ones are cut by the select itself */
.toolbar-yesno { flex: 0 0 9.5rem; width: 9.5rem; }   /* 「列管：全部」「ISMS：全部」窄的下拉 Narrow dropdowns such as "Controlled: All" */
.list-filters { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 1rem; }
.list-filter { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 0.95rem; color: var(--muted); }
.list-filter .form-select { width: auto; min-width: 8.5rem; font-size: 1rem; }
.list-hint { margin: 0 0 0.75rem; padding: 0.5rem 0.9rem; border-radius: 8px; background: #eaf1ff; color: var(--primary-dark); }
.list-hint a { font-weight: 600; }
.status-active { color: var(--muted); }
.custodian-link { color: inherit; text-decoration: none; }   /* 點保管人 = 看他名下所有資產（離職交接）Click a custodian to see their assets (handover) */
.custodian-link:hover { color: var(--primary); text-decoration: underline; }
.toolbar-search-btn { min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; padding: 0 1rem; font-size: 1rem; font-weight: 600; }   /* 搜尋列不需要大：標準 44px、字體 1rem The search row does not need to be large: standard 44px, 1rem text */
.toolbar-search-form .form-control, .toolbar-search-form .form-select { min-height: 44px; font-size: 1rem; }   /* 搜尋框與下拉和按鈕同高 The search box and dropdowns are as tall as the buttons */
.cell-sub { font-size: 0.85rem; line-height: 1.3; color: var(--muted); }   /* 品名下面的規格小字 Spec under the name */
.toolbar-export .dropdown-menu { font-size: 1.05rem; }
.selection-link { padding: 0 0 0 0.75rem; font-size: 1rem; font-weight: 600; vertical-align: baseline; }
@media (max-width: 575px) { .list-toolbar { flex-direction: column; } }
.cell-empty { color: var(--muted); }   /* 沒填的欄位顯示「—」 Empty cells show a dash */
.list-empty { padding: 2.5rem 0; text-align: center; color: var(--muted); }

/* 登入頁 Login */
.login-box {
  max-width: 460px; margin: 6vh auto 0; padding: 2.5rem 2rem; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.login-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.5rem; }
.login-sub { color: var(--muted); margin-bottom: 1.75rem; }
.login-btn { min-height: 64px; flex-direction: row; }
.login-note { margin: 0.9rem 0 0; color: var(--muted); font-size: 0.95rem; }
.login-dev { display: inline-block; margin-top: 1.5rem; color: var(--muted); font-size: 0.95rem; }

/* 示範資料提示 Demo data notice */
.demo-note {
  margin-bottom: 1rem; padding: 0.5rem 0.9rem; border-radius: 8px;
  background: #fff6e0; color: #8a5a00; font-size: 0.95rem;
}

/* 清單表格 Asset table */
.asset-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.asset-table td, .asset-table th { padding: 0.6rem 0.75rem; }
.asset-table .col-name { width: 17rem; max-width: 17rem; overflow-wrap: anywhere; }   /* 品名欄：固定一個稍窄的寬度，長的品名與規格換行，空間讓給其他欄 The name column has a fixed, slightly narrower width; long names and specs wrap, leaving room for the other columns */
.asset-table .col-check { width: 3rem; text-align: center; }
.asset-table .form-check-input { width: 1.35rem; height: 1.35rem; cursor: pointer; }
.asset-table tr.is-selected > td { background: #eaf1ff; }
.asset-link { font-weight: 600; text-decoration: none; }

/* 勾選後的批次動作列 Batch action bar */
.selection-bar {
  position: sticky; top: 0.5rem; z-index: 5; margin-bottom: 1rem; padding: 0.9rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: #eaf1ff; border: 2px solid var(--primary); border-radius: var(--radius);
}
.selection-bar[hidden] { display: none; }
.selection-count { font-size: 1.15rem; font-weight: 700; color: var(--primary-dark); }
.selection-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.selection-btn { width: auto; min-height: 48px; padding: 0 1.25rem; flex-direction: row; font-size: 1.1rem; }
.selection-clear { min-height: 48px; }

/* 資產頁 Asset page */
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--primary); }
.detail-head { margin-bottom: 0; }
.detail-header { align-items: center; margin-bottom: 1rem; }
.detail-no { color: var(--muted); font-size: 1.05rem; }
.asset-no-chip {
  display: inline-flex; align-items: center; padding: 0.2rem 0.85rem;
  background: #eaf1ff; border-radius: 8px; color: var(--primary-dark);
  font-size: 1.3rem; font-weight: 700; letter-spacing: 0.02em;
}
.detail-head-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; }   /* 財產編號標籤與品名同一列 The asset number chip and the name share one line */
.detail-name { font-size: 1.9rem; font-weight: 700; margin: 0; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.kv-list { margin: 0; }
.kv-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.kv-row:first-child { padding-top: 0; }
.kv-row:last-child { padding-bottom: 0; border-bottom: 0; }
.kv-block { margin-top: 0.9rem; padding: 0.6rem 1rem; background: #eaf5ee; border-radius: 10px; }   /* 列管資產與相關欄位：圓角淡綠區塊（輔助文字在這個底色上仍有 4.5:1 的對比）Controlled asset and its fields: a rounded light-green block (the muted text keeps 4.5:1 on it) */
.kv-block .kv-row { border-bottom-color: #d3e6da; }
.kv-block-title { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.35rem; padding-bottom: 0.6rem; border-bottom: 2px solid #b9d9c4; font-size: 1.05rem; font-weight: 700; color: #1d6b3b; }   /* 小標題：圖示 + 深綠粗體字 + 下方較粗的線（深綠在淡綠底上對比 5.8:1）Subtitle: icon, dark-green bold text, a heavier rule below (dark green on the light green is 5.8:1) */
.kv-block .kv-row:first-of-type { padding-top: 0.6rem; }
.kv-block-note { margin: 0; color: var(--muted); }
.kv-row dt { margin: 0; color: var(--muted); font-weight: 500; font-size: 0.95rem; line-height: 1.6; }
.kv-row dd { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }

/* 導覽：和標題區分開（細線隔開、較小的粗細、圓角底色），但字比一般內文大，好點擊 */
.app-nav { display: flex; align-items: center; gap: 0.25rem; padding-left: 1.5rem; border-left: 2px solid var(--header-divider); }
.app-nav-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem; border-radius: 10px;
  font-size: 1.1rem; font-weight: 500; color: var(--header-muted); text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.app-nav-link:hover { background: var(--header-hover-bg); color: var(--header-hover-text); }
.app-nav-link.is-active { background: var(--header-active-bg); color: var(--header-active-text); }
.app-nav-link.is-disabled { opacity: 0.55; cursor: not-allowed; }
.app-nav-link.is-disabled:hover { background: transparent; color: var(--header-muted); }
@media (max-width: 767px) { .app-nav { padding-left: 0; border-left: 0; } }

/* 設定頁 Settings pages */
.manage-tabs { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.manage-tab {
  padding: 0.6rem 1.25rem; border-radius: var(--radius); text-decoration: none; font-weight: 600;
  color: var(--muted); border: 2px solid transparent;
}
.manage-tab:hover { color: var(--primary); }
.manage-tab.is-active { background: var(--surface); border-color: var(--line); color: var(--text); }
/* 設定頁的表格：平常唯讀（.cell-view），按「編輯」該列才顯示欄位（.cell-edit）；新增列預設收起
   Settings tables: read-only (.cell-view) until Edit is pressed, then the row shows its fields (.cell-edit); the add row starts collapsed */
.manage-toolbar { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.manage-company { margin-left: auto; align-self: center; font-size: 0.95rem; font-weight: 600; color: var(--muted); }   /* 現在處理的公司 The company being worked on */
.grant-checks { display: flex; flex-direction: column; gap: 1rem; min-width: 24rem; }   /* 權限勾選：每種身分一組 One group of ticks per kind */
.grant-group { border: 0; padding: 0; margin: 0; }
.grant-group legend { float: none; display: inline-block; width: auto; font-size: 1rem; font-weight: 600; margin: 0 0 0.4rem; padding: 0.15rem 0.7rem; color: var(--text); background: #c9d9f2; border-radius: 4px; }   /* 標題：淺底色小標籤 Title: a small tag on a light background */
.grant-options { display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; max-height: 9rem; overflow-y: auto; }   /* 部門多的時候在框內捲動 Scrolls inside when there are many departments */
.grant-options label { white-space: nowrap; cursor: pointer; }
.grant-kind-label { font-weight: 600; }   /* 唯讀時的身分標題 The kind title in the read-only view */
.manage-hint { font-size: 0.95rem; color: var(--muted); margin: 1rem 0 0; }
.manage-sub { font-size: 0.95rem; color: var(--muted); }   /* 姓名下方的 email Email under a name */
.manage-table .cell-edit { display: none; }
.manage-table tr.is-editing .cell-view { display: none; }
.manage-table tr.is-editing .form-control.cell-edit,
.manage-table tr.is-editing .form-select.cell-edit { display: block; min-width: 160px; }
.manage-table tr.is-editing .btn.cell-edit { display: inline-block; }
.manage-table tr.is-editing div.cell-edit { display: block; }
.manage-table tr.is-editing form.manage-delete { display: inline-block; margin-right: 1rem; }   /* 移除與儲存／取消隔開，避免誤按 */
.manage-table tr.is-editing label.cell-edit { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.manage-table tr.is-editing > td { background: #f2f6fc; }
.manage-table .form-check-input { width: 1.35rem; height: 1.35rem; cursor: pointer; }
.manage-table .manage-add-row { display: none; }
.manage-table .manage-add-row.is-open { display: table-row; }
.manage-add-row > td { background: #f2f6fc; }
.manage-table .manage-add-row .form-control,
.manage-table .manage-add-row .form-select { min-width: 160px; }

/* 表單 Forms */
/* 新增資產表單：滿版、左右排版。左右兩張等高的卡片；欄位用 12 欄格線（.span-N）
   Add-asset form: full width, left / right layout. two equal-height cards, "Asset details" on the left; fields sit on a 12-column grid (.span-N) */
.form-title { margin-bottom: 0.25rem; }
.form-title + form { margin-top: 0.75rem; }   /* 標題後直接接表單時留點空 Space when the form follows the title directly */
.form-intro { margin: 0 0 0.75rem; color: var(--muted); }
.change-note { flex: 0 1 auto; margin: 0 0 0 auto; padding: 0.4rem 0.8rem; border-radius: 8px; background: #fff6e0; color: #8a5a00; font-size: 0.95rem; text-align: right; }   /* 與欄位同一列、靠右，淡黃底 Same row as the fields, pushed right, pale yellow */
.change-fields + .kv-form { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }   /* 上面的選擇條件與下面的欄位區塊隔開 Set the choices above apart from the sections below */
.form-intro-note { margin-left: 1rem; white-space: nowrap; }
.form-columns { display: grid; gap: 1rem; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: stretch; }   /* 兩張卡片等高 Both cards share the same height */
.form-panel { padding: 1rem 1.25rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.form-panel-title {
  margin: 0 0 0.9rem; padding: 0.15rem 0 0.15rem 0.7rem;
  border-left: 4px solid var(--primary); font-size: 1rem; font-weight: 700; color: var(--text);
}
.form-grid { display: grid; gap: 0.75rem 1rem; grid-template-columns: repeat(12, minmax(0, 1fr)); }
/* 輸入框下方的建議清單（保管人）Suggestion list under an input (custodian) */
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 1000;
  margin: 0; padding: 0.25rem; list-style: none; max-height: 16rem; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 16px rgba(31, 41, 51, 0.15);
}
.combo-list li { padding: 0.55rem 0.75rem; border-radius: 6px; cursor: pointer; font-size: 1rem; }
.combo-list li:hover, .combo-list li.is-active { background: #eaf1ff; color: var(--primary-dark); }
.form-field { grid-column: span 12; }
.form-field.span-2 { grid-column: span 2; }
.form-field.span-3 { grid-column: span 3; }
.form-field.span-4 { grid-column: span 4; }
.form-field.span-5 { grid-column: span 5; }
.form-field.span-6 { grid-column: span 6; }
.form-field.span-7 { grid-column: span 7; }
.form-field.span-8 { grid-column: span 8; }
.form-field textarea.form-control { min-height: 2.4rem; resize: vertical; }
@media (max-width: 1199px) {
  .form-columns { grid-template-columns: 1fr; }   /* 窄螢幕：左右改成上下 Narrow: left / right becomes top / bottom */
}
@media (max-width: 767px) {
  .form-field[class*="span-"] { grid-column: span 12; }
}
.form-label { font-weight: 600; color: var(--muted); font-size: 0.95rem; margin-bottom: 0.15rem; }
/* 必填：標籤後面一個紅色星號（不加底色、不改邊框）Required: a red asterisk after the label (no fill, no border change) */
.form-required { color: var(--danger); }
.form-error { margin-top: 0.25rem; color: var(--danger); font-size: 0.95rem; }
.form-hint { margin-top: 0.25rem; color: var(--muted); font-size: 0.95rem; }
.form-check-field { align-self: end; }
.form-check-field .form-check-label { font-size: 1.05rem; }
/* 變更類型頁最上面的一排（資產類型、列管資產、ISMS、說明）：一排排列，放不下才換行；下面的區塊用資產頁的版型
   The top row of the change-type page (type, controlled, ISMS, note): one row, wrapping only when there is no room; the sections below use the asset page's layout */
.change-fields { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-start; }
.change-field { flex: 0 1 11rem; min-width: 9rem; }
.change-field.is-medium { flex-basis: 15rem; }
.change-field.is-check { flex: 0 0 auto; }   /* 勾選欄位依文字長度、不換行 A checkbox is as wide as its text and never wraps */
.change-field.is-check .check-tile span { white-space: nowrap; }
.info-grid > .kv-block { margin-top: 0; }   /* 變更類型頁：淡綠區塊自己是一欄 Change-type page: the green block is a column of its own */
.kv-form .kv-row { align-items: center; }
.kv-form .kv-row dd .form-control, .kv-form .kv-row dd .form-select { font-size: 0.95rem; }
.kv-form .kv-row dd .form-check-input { width: 1.25rem; height: 1.25rem; margin: 0; cursor: pointer; }
.kv-hint { display: block; margin-top: 0.1rem; font-size: 0.8rem; font-weight: 400; line-height: 1.3; color: #4a74b2; }   /* 欄位名稱下面的小字說明：比名稱小一號、藍色，和灰色的名稱分開（在白底上對比 4.7:1）A small note under the field name: blue, apart from the grey name (4.7:1 on white) */
.check-tile { display: flex; align-items: center; gap: 0.6rem; min-height: 2.4rem; cursor: pointer; font-size: 1rem; }   /* 不加框，只和輸入框等高，才會對齊 No frame; only as tall as the inputs so the row lines up */
.check-tile .form-check-input { width: 1.25rem; height: 1.25rem; margin: 0; cursor: pointer; }
.form-sheet { padding: 1.25rem 1.5rem 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }   /* 新增資產：一張白底表單 Add asset: one white sheet */
.type-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 2rem; padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.type-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.type-pill { min-height: 44px; display: inline-flex; align-items: center; padding: 0 1.25rem; font-size: 1rem; }
.type-controlled .form-check { margin: 0; }
.type-controlled .form-check-label { font-size: 1.05rem; }
.type-controlled .form-hint { margin-top: 0; }
.extra-panel { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.extra-panel[hidden], .extra-block[hidden] { display: none; }
.extra-title { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 700; color: var(--text); }
.extra-block:not([hidden]) ~ .extra-block:not([hidden]) { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }   /* 前面有顯示的段落才加分隔線 A divider only when a visible section comes before */
.form-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.form-actions { display: flex; flex-direction: row-reverse; justify-content: flex-start; align-items: center; gap: 0.75rem; flex-wrap: wrap; }   /* 反向：DOM 第一個（新增資產）顯示在最右 */
.form-submit { width: auto; min-height: 44px; padding: 0 1.5rem; flex-direction: row; gap: 0.5rem; font-size: 1rem; border-width: 1px; border-radius: var(--bs-btn-border-radius, 0.375rem); }   /* 與旁邊的標準按鈕同圓角、同邊框 Same radius and border as the standard buttons beside it */
.detail-status { font-size: 0.9rem; vertical-align: middle; }
.asset-table tr.is-inactive td { color: var(--muted); }
/* 已撤銷的異動：整列變淡；狀態那格維持清楚（字略粗），才讀得到「已撤銷」
   A revoked change: the row is dimmed; the status cell stays clear (slightly bold) so "Revoked" is easy to read */
.asset-table tr.is-revoked td { color: var(--muted); }
.asset-table tr.is-revoked td.status-cell { color: var(--text); font-weight: 600; }
.asset-table tr.is-revoked a { color: var(--muted); }

/* 提示訊息：浮在畫面上方中央，消失時不會把下面的內容推動 Flash messages float at the top so content does not jump when they go away */
.app-messages {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 1080;
  width: min(560px, calc(100% - 2rem));
}
.app-messages .alert { box-shadow: 0 4px 16px rgba(31, 41, 51, 0.15); }

/* 設定清單的「狀態」欄：啟用 = 勾勾 Status column of settings lists: active = tick */
.manage-status-on { color: var(--success); font-size: 1.25rem; }
.manage-status-off { color: var(--muted); }

/* Excel 匯入 Excel import */
.import-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 3fr) minmax(0, 7fr); align-items: start; }
@media (max-width: 991px) { .import-layout { grid-template-columns: 1fr; } }
.form-import { margin-right: 0.75rem; }
.import-actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.25rem; }
.import-steps { padding-left: 1.25rem; margin-bottom: 1rem; }
.import-steps li { margin-bottom: 0.5rem; }
.import-rules { padding-left: 1.25rem; margin: 0; color: var(--muted); }
.import-summary { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.import-stat {
  display: flex; flex-direction: column; min-width: 9rem; padding: 0.6rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted);
}
.import-stat-num { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.import-stat.has-errors .import-stat-num { color: var(--danger); }
.import-note { margin: 0 0 1rem; color: var(--muted); }
.import-units { margin-bottom: 1rem; }
.import-unit-table { max-width: 560px; margin-bottom: 0; }
.import-table-card { margin-top: 0; }
.import-table-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.import-table-head .list-title { margin-bottom: 0; }
.import-filter a { color: var(--muted); text-decoration: none; }
.import-filter a:hover { color: var(--primary); }
.asset-table tr.is-error > td { background: #fff8f8; }
.import-result { min-width: 16rem; }
.import-ok-icon { color: var(--success); }
.import-error-icon, .import-error { color: var(--danger); }
.import-warning-icon, .import-warning { color: #b7791f; }
.import-error, .import-warning { display: inline; margin-left: 0.4rem; font-size: 0.95rem; }
.import-error::after, .import-warning::after { content: ""; display: block; }

/* 資產頁：由上到下 標題與狀態標籤 → 一張「詳細資料」卡（四個區塊、兩欄）→ 全寬的頁簽
   Asset page, top to bottom: title with status chips -> one "Details" card (four sections, two columns) -> full-width tabs */
.detail-stack { display: grid; gap: 1rem; min-width: 0; }
.detail-stack .list-card { margin-top: 0; }
.detail-tab-actions { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.35rem auto; }   /* 頁籤那一列的右邊 The right end of the tab row */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(21rem, 100%), 1fr)); gap: 1.5rem 2rem; align-items: start; }   /* 寬螢幕四個區塊並排；放不下就自動變兩欄、一欄（區塊少時各自平分）Four sections side by side on a wide screen; fewer columns when they do not fit (fewer sections share the width) */
.info-title { margin: 0 0 0.75rem; font-size: 1.05rem; font-weight: 600; }   /* 區塊標題：粗體字，不加分隔線（四個區塊並排，不需要）Section title: bold, no rule (the sections sit side by side) */
.edit-hint { display: none; margin: 0 0 1rem; padding: 0.5rem 0.9rem; border-radius: 8px; background: #fff6e0; color: #8a5a00; font-size: 0.95rem; }   /* 編輯中的提示 The editing notice */
.edit-scope.is-editing p.edit-hint { display: block; }
/* 資產頁：詳細資料的編輯（平常唯讀，按編輯才開放）、右側欄位、資料修改紀錄
   Asset page: editing the details (read-only until Edit), the right column, the edit log */
.detail-card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.detail-card-head .list-title { margin-bottom: 0; }
.edit-scope .cell-edit { display: none; }
.edit-scope.is-editing .cell-view { display: none; }
.edit-scope.is-editing .btn.cell-edit { display: inline-block; }
.edit-scope.is-editing span.cell-edit { display: block; }
.edit-scope .kv-row.edit-only { display: none; }
.edit-scope.is-editing .kv-row.edit-only { display: grid; }
.edit-scope.is-editing .kv-row { align-items: center; }
.edit-scope .kv-row dd .form-control, .edit-scope .kv-row dd .form-select { font-size: 0.95rem; }

/* 異動頁（移轉、更換保管人、報廢、出售）Transaction page */
.action-columns { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.action-count { margin-left: 0.5rem; font-size: 1rem; font-weight: 500; color: var(--muted); }
.action-assets { max-height: 22rem; overflow: auto; }   /* 批次時資產很多，在卡片內捲動 */
.form-submit-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.form-submit-danger:hover:not(:disabled) { background: var(--danger-dark); border-color: var(--danger-dark); color: #fff; }



/* 字體大小（三層）Type sizes (three levels)
   內文與表格 1.05rem；表單欄位、標準按鈕 1rem；小按鈕與標籤 0.95rem（Bootstrap 預設的小尺寸是 0.875rem，太小，所以提高）
   Body and tables 1.05rem; form controls and standard buttons 1rem; small buttons and labels 0.95rem
   (Bootstrap's own small size is 0.875rem, which looked too small here) */
.btn-sm { --bs-btn-font-size: 0.95rem; }
.form-control, .form-select { font-size: 1rem; }

/* 按鈕尺寸（三層，大小與字體成比例）Button sizes (three levels; size and text scale together)
   大 Large    48px / 1.1rem：首頁「新增資產」與清單勾選後的動作列
   標準 Page   44px / 1rem  ：頁首右上角的操作（儲存、取消、新增並繼續、匯入、匯出、核准…）
   小 Small    btn-sm       ：表格裡每列的按鈕（編輯、撤銷、儲存…） */
.btn-page, .detail-action, .form-continue, .form-cancel, .form-import, .approve-btn {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0 1.25rem; font-size: 1rem; font-weight: 600; white-space: nowrap;
}

/* 簽核 Approvals */
.approval-card { margin-top: 0; margin-bottom: 1rem; }
.approval-group + .approval-group { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.approval-group-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.approval-group-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.approval-count { margin-left: 0.5rem; font-size: 0.95rem; font-weight: 500; color: var(--muted); }
.approve-form { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.approve-field { width: min(360px, 100%); }
.approval-done { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); }
.approval-done .fa-check-circle { color: var(--success); }

/* 異動紀錄查詢 History lookup */
.history-card { margin-top: 0; margin-bottom: 1rem; }
.history-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; }
.history-field { min-width: 10rem; }
.history-field-grow { flex: 1 1 14rem; }
.history-buttons { display: flex; gap: 0.5rem; }
.history-batch { margin-left: 0.5rem; font-size: 0.9rem; color: var(--muted); text-decoration: none; }
.history-batch:hover { color: var(--primary); }
.history-pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }
.history-page-no { color: var(--muted); }

/* 資產頁右側的頁簽（異動紀錄／資料修改紀錄）Tabs on the right of the asset page */
.detail-tabs { display: flex; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.detail-tab {
  margin-bottom: -1px; padding: 0.6rem 1.1rem; background: none; border: 0; border-bottom: 3px solid transparent;
  font-size: 1.05rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.detail-tab:hover { color: var(--primary); }
.detail-tab.active { color: var(--text); border-bottom-color: var(--primary); }
.detail-tab:focus-visible { outline: 3px solid rgba(29, 95, 209, 0.35); outline-offset: -3px; }
.tab-count { margin-left: 0.4rem; font-size: 0.95rem; font-weight: 500; color: var(--muted); }

/* 修改紀錄：每一次修改一組，組與組之間加較粗的線 Edit log: one group per edit, a heavier rule between groups */
.edit-log-table > tbody + tbody > tr:first-child > td { border-top: 2px solid var(--line); }
.edit-log-table > tbody > tr > td[rowspan] { vertical-align: top; }
.edit-log-table td, .edit-log-table th { padding: 0.35rem 0.75rem; font-size: 0.95rem; }   /* 修改紀錄的列比一般表格緊密 Denser rows than the other tables */
.edit-log-table th { padding-top: 0.5rem; padding-bottom: 0.5rem; }

/* 簽核狀態欄的細節（批次編號、核准日期）Sign-off details under the status (batch number, approval date) */
.approval-meta { font-size: 0.9rem; color: var(--muted); }
.approval-meta a, .approval-meta-link { color: var(--muted); text-decoration: none; }
.approval-meta a:hover, .approval-meta-link:hover { color: var(--primary); text-decoration: underline; }

/* 登出按鈕：顏色跟著頂欄 The Log out button follows the top bar */
.app-user .btn { font-size: 1rem; }   /* 登出按鈕：比一般小按鈕大一點，與旁邊的 email 協調 Log out: a bit larger than a normal small button, to sit with the email */
.app-user .btn-outline-secondary { color: var(--header-text); border-color: var(--header-btn-border); }
.app-user .btn-outline-secondary:hover { background: var(--header-hover-bg); color: var(--header-hover-text); border-color: var(--header-btn-border); }

.import-templates { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.4rem; }
.rel-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); gap: 1rem; align-items: start; }   /* 三張大卡片一列；窄螢幕自動換行 Three big cards in a row; they wrap on a narrow screen */
.rel-card { padding: 0.9rem 1rem 1rem; border: 1px solid var(--line); border-radius: 12px; }   /* 整張卡片是該種關係的淡色底（運行於藍、儲存綠、相依於橘褐），裡面的列是白底 The whole card is a pale tint of its kind (blue, green, amber); the rows inside are white */
.rel-card-runs_on { background: #eaf1ff; border-color: #bcd0f3; --rel-title: #1d4fa8; }
.rel-card-stores { background: #eaf5ee; border-color: #b9d9c4; --rel-title: #1d6b3b; }
.rel-card-depends_on { background: #fdf1e3; border-color: #f0d3ae; --rel-title: #8a4b0b; }
.rel-card-title { display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.75rem; padding-bottom: 0.6rem; border-bottom: 2px solid currentColor; color: var(--rel-title); font-size: 1.1rem; font-weight: 700; }   /* 圖示 + 同色深字 + 下方同色線（深色字在淡底上對比 5.8:1 以上）Icon, dark text of the same colour, a rule below (5.8:1 or more on the tint) */
.rel-card-title .tab-count { margin-left: auto; padding: 0 0.6rem; border-radius: 999px; background: #fff; color: var(--rel-title); font-size: 0.9rem; font-weight: 700; }
.rel-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 0 0 0.75rem; color: var(--muted); font-size: 0.9rem; }   /* 箭頭的圖例 The legend of the arrows */
.rel-legend i, .rel-dir { margin-right: 0.4rem; }
.rel-dir { margin-right: 0; color: var(--rel-title); font-size: 1.1rem; }   /* 每一列開頭的方向箭頭，與卡片同色 The direction arrow at the start of a row, in the card's colour */
.rel-none { margin: 0.75rem 0 0; color: #3f4b5a; }
.rel-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }   /* 白底托盤 A white tray */
.rel-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem 0.45rem 0.75rem; }
.rel-item + .rel-item { border-top: 1px solid var(--line); }
.rel-item form { margin: 0 0 0 auto; }
.rel-other { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; min-width: 0; overflow-wrap: anywhere; }
.rel-more { margin-top: 0.4rem; }
.rel-more summary { cursor: pointer; color: var(--rel-title); font-size: 0.95rem; font-weight: 600; }
.rel-more .rel-list { margin-top: 0.25rem; }
.rel-type { flex: 0 0 auto; padding: 0.05rem 0.6rem; border-radius: 999px; background: #e8ebf0; color: #3f4b5a; font-size: 0.85rem; font-weight: 600; }   /* 資產類型標籤：每種類型一個淡色，文字對比都在 4.5:1 以上 Type tag: a pale colour per type, text contrast above 4.5:1 */
.rel-type-hardware { background: #e4ecf9; color: #1f4a8a; }
.rel-type-software { background: #ede7fa; color: #55329b; }
.rel-type-data { background: #e3f3e8; color: #1d6b3b; }
.rel-type-service { background: #fdecdb; color: #8a4b0b; }
.rel-remove { width: 1.8rem; height: 1.8rem; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.rel-remove:hover { background: #fdecec; color: var(--danger); }
.rel-remove:focus-visible { outline: 3px solid rgba(29, 95, 209, 0.35); }
.relation-hint { margin-top: 0.4rem; font-size: 0.95rem; }
.relation-add { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.25rem; }
.relation-kind { flex: 0 0 9rem; width: 9rem; }
.relation-target { flex: 1 1 14rem; min-width: 0; }
.relation-add .combo { flex: 1 1 14rem; min-width: 0; }   /* 建議清單元件包住輸入框後，寬度改由外層決定 The combobox wrapper decides the width once it wraps the input */
