/*
 * 漁電案件管理系統 全站樣式
 *
 * 所有顏色、字型、圓角都從下面的 token 取值，頁面不要再寫死色碼。
 * 改外觀先到 ui-kit.php 用右側面板調，調好的值改這裡的 :root。
 * 2026-10-05 起是 v2 外觀（白底頂欄側欄、中性灰、細框卡片）。
 */
:root {
  /* 色彩 */
  --fs-primary: #1a5276;
  --fs-primary-hover: #2471a3;
  --fs-primary-active: #143f5b;        /* 按下 */
  --fs-primary-tint: #eaf2fb;          /* 表格 hover、側欄選中底色 */
  --fs-accent: #f39c12;                /* 新增等主動作；白字只有 2.2:1，上面一律深字（約 7:1） */
  --fs-accent-hover: #d68910;
  --fs-accent-active: #b9770e;
  --fs-bg: #f5f5f5;
  --fs-surface: #ffffff;
  --fs-text: #262626;
  --fs-muted: #737373;
  --fs-input-border: #d4d4d4;
  --fs-label: #404040;
  --fs-link: var(--fs-primary);        /* 連結、外框按鈕、勾選框、分頁 */
  --fs-link-active: var(--fs-primary-active);

  /* 字型（Noto Sans TC 由 layout_header.php 載入） */
  --fs-font: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  --fs-font-size: 0.94rem;
  --fs-title-size: 1.25rem;
  --fs-table-size: 0.86rem;

  /* 形狀 */
  --fs-radius: 6px;                    /* 輸入框、側欄項目 */
  --fs-card-radius: 10px;
  --fs-btn-radius: 0.375rem;
  --fs-btn-sm-radius: 0.25rem;
  --fs-card-shadow: 0 0 0 1px rgba(10,10,10,.08), 0 1px 3px rgba(0,0,0,.05);
  --fs-btn-disabled-opacity: .45;

  /* 頁首標題底線、區塊小標（不用左側色條） */
  --fs-page-header-border: 1px solid rgba(10,10,10,.1);
  --fs-section-bg: transparent;
  --fs-section-fg: #262626;
  --fs-section-bar: 0 solid transparent;
  --fs-section-line: 1px solid rgba(10,10,10,.1);
  --fs-section-pad-x: 0;

  /* 頂欄 */
  --fs-navbar-bg: #ffffff;
  --fs-navbar-fg: #262626;
  --fs-navbar-shadow: 0 1px 0 rgba(10,10,10,.08);

  /* 側欄 */
  --fs-sidebar-bg: #ffffff;
  --fs-sidebar-fg: #404040;
  --fs-sidebar-section: #a3a3a3;
  --fs-sidebar-active-bg: var(--fs-primary-tint);
  --fs-sidebar-active-fg: var(--fs-primary);
  --fs-sidebar-border: rgba(10,10,10,.08);

  /* 卡片表頭 */
  --fs-card-header-bg: #ffffff;
  --fs-card-header-fg: #262626;
  --fs-card-header-border: rgba(10,10,10,.08);

  /* 表格表頭 */
  --fs-th-bg: #f5f5f5;
  --fs-th-fg: #404040;
}

html, body { height: 100%; }
body {
  font-family: var(--fs-font);
  background: var(--fs-bg);
  color: var(--fs-text);
  font-size: var(--fs-font-size);
}

/* ── Navbar ── */
.navbar-main {
  background: var(--fs-navbar-bg);
  box-shadow: var(--fs-navbar-shadow);
  min-height: 56px;
}
.navbar-main .navbar-brand {
  display: inline-flex; align-items: center;
  color: var(--fs-navbar-fg) !important;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .5px;
}
.brand-mark { width: 1.6em; height: 1.6em; color: var(--fs-accent); margin-right: 8px; flex-shrink: 0; }
.navbar-main .nav-link { color: var(--fs-navbar-fg) !important; }
.navbar-toggler { border-color: color-mix(in srgb, var(--fs-navbar-fg) 40%, transparent); }
.navbar-toggler-icon {
  background-image: none;
  -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='black' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") center / 100% no-repeat;
          mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='black' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") center / 100% no-repeat;
  background-color: color-mix(in srgb, var(--fs-navbar-fg) 90%, transparent);
}
.navbar-user {
  background: color-mix(in srgb, var(--fs-navbar-fg) 6%, transparent);
  color: var(--fs-navbar-fg);
  border: 1px solid color-mix(in srgb, var(--fs-navbar-fg) 15%, transparent);
}
.navbar-user:hover, .navbar-user:focus, .navbar-user.show {
  background: color-mix(in srgb, var(--fs-navbar-fg) 10%, transparent);
  color: var(--fs-navbar-fg);
}

/* ── Sidebar ── */
.sidebar {
  background: var(--fs-sidebar-bg);
  border-right: 1px solid var(--fs-sidebar-border);
  min-height: calc(100vh - 56px);
  width: 220px;
  flex-shrink: 0;
  padding-top: 1rem;
}
.sidebar .nav-link {
  color: var(--fs-sidebar-fg);
  padding: .6rem 1.2rem;
  border-radius: var(--fs-radius);
  margin: 2px 8px;
  display: flex; align-items: center; gap: 8px;
  transition: background .15s, color .15s;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
  background: var(--fs-sidebar-active-bg);
  color: var(--fs-sidebar-active-fg);
}
.sidebar .nav-link i { font-size: 1rem; width: 18px; text-align: center; }
.sidebar .sidebar-section {
  font-size: .7rem;
  color: var(--fs-sidebar-section);
  padding: .8rem 1.4rem .2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Main content ── */
.main-content { flex: 1; padding: 1.4rem; overflow-x: auto; min-width: 0; }
.page-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 1.2rem; padding-bottom: .8rem;
  border-bottom: var(--fs-page-header-border);
}
.page-header h1 {
  font-size: var(--fs-title-size); font-weight: 700;
  color: var(--fs-text); margin: 0;
}
.page-icon { font-size: 1.4rem; color: var(--fs-muted); }

/* ── Cards ── */
.card {
  border: none;
  box-shadow: var(--fs-card-shadow);
  border-radius: var(--fs-card-radius);
  background: var(--fs-surface);
}
.card-header {
  background: var(--fs-card-header-bg);
  color: var(--fs-card-header-fg);
  border-bottom: 1px solid var(--fs-card-header-border);
  font-weight: 600;
  border-radius: var(--fs-card-radius) var(--fs-card-radius) 0 0 !important;
  padding: .65rem 1rem;
}

/* ── 檢視頁欄位 ── */
.view-field { margin-bottom: .6rem; }
.view-label { display: block; font-size: .72rem; color: var(--fs-label); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.view-val   { display: block; font-size: .9rem; color: var(--fs-text); word-break: break-word; }
.section-card .card-header { font-size: .88rem; }

/* ── Tables ── */
.table-cases th {
  background: var(--fs-th-bg);
  color: var(--fs-th-fg);
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
  padding: .4rem .6rem;
  border-bottom: 1px solid rgba(10,10,10,.1);
}
.table-cases th a { color: inherit; }
.table-cases td {
  font-size: var(--fs-table-size); padding: .35rem .6rem; vertical-align: middle;
  white-space: nowrap; border-color: rgba(10,10,10,.06);
}
.table-cases tbody tr:hover { background: var(--fs-primary-tint); }
.table-responsive { max-height: 72vh; overflow-y: auto; }

/* 篩選卡片的小標、卡片內的分組 */
.panel-title { display: flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 600; margin-bottom: .6rem; }
.panel-title i { color: var(--fs-muted); }
.filter-group { background: var(--fs-bg); border-radius: var(--fs-radius); padding: .6rem .75rem; margin-bottom: .75rem; }
.filter-group-title { font-size: .8rem; font-weight: 600; margin-bottom: .4rem; }

/* 統計數字列（查詢結果、統計報表） */
.stat-strip { display: flex; flex-wrap: wrap; gap: .75rem 1.75rem; padding: .75rem 1rem; }
.stat-label { display: block; font-size: .75rem; color: var(--fs-muted); }
.stat-value { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: .8rem; font-weight: 400; color: var(--fs-muted); margin-left: .2rem; }
.stat-divider { padding-left: 1.75rem; border-left: 1px solid rgba(10,10,10,.1); }

.stat-lg { font-size: 1.6rem; line-height: 1.2; }
.stat-sub { font-size: .78rem; color: var(--fs-muted); }

/* 比例長條（寬度由資料決定，可寫 inline width） */
.bar { width: 65px; height: 6px; border-radius: 3px; background: rgba(10,10,10,.08); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--fs-primary); }

/* 分段切換（統計模式等互斥選項） */
.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: calc(var(--fs-btn-radius) + 2px); background: rgba(10,10,10,.06); }
.segmented .btn { --bs-btn-color: var(--fs-muted); --bs-btn-hover-color: var(--fs-text); --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent; }
.segmented .btn-check:checked + .btn { background: var(--fs-surface); color: var(--fs-text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* 正式報表文字（複製貼到公文用） */
.report-text { font-size: .92rem; line-height: 2; }
.report-text .rh { display: block; font-weight: 600; margin-top: .3rem; }
.report-text .sub { display: block; padding-left: 1.8rem; }

/* 子表（檢視頁的補正、會辦、案場表、編輯紀錄明細、表單的可增減列） */
.table-sub { --bs-table-bg: transparent; margin-bottom: 0; }
.table-sub > thead th {
  font-size: .78rem; font-weight: 600; color: var(--fs-muted); white-space: nowrap;
  background: transparent; border-bottom: 1px solid rgba(10,10,10,.12);
}
.table-sub > tbody td { border-color: rgba(10,10,10,.06); vertical-align: top; }
.table-sub > tbody tr.is-current > * { --bs-table-bg: var(--fs-primary-tint); }
.table-sub.align-middle > tbody td { vertical-align: middle; }
.table-sub.table-flush { margin: 0; }
.table-sub.table-flush > :not(caption) > * > *:first-child { padding-left: 1rem; }
.table-sub.table-flush > :not(caption) > * > *:last-child { padding-right: 1rem; }
.table-sub.table-hover > tbody td { vertical-align: middle; }
.col-no { width: 3rem; text-align: center; }
.col-remove { width: 2rem; }
.col-field { width: 11rem; }
.cell-pre { white-space: pre-wrap; }
.mw-8r { max-width: 8rem; }
.mw-12r { max-width: 12rem; }
.mw-22r { max-width: 22rem; }
.mw-26r { max-width: 26rem; }
.mw-40r { max-width: 40rem; }
.col-date { width: 9rem; }

/* 表頭固定（可捲動的明細表） */
.table-sticky > thead th { position: sticky; top: 0; z-index: 2; background: var(--fs-surface); }

/* 交叉表（行政區 × 物種）：保留淡格線方便對齊數字 */
.table-matrix { --bs-border-color: rgba(10,10,10,.08); }
.table-matrix > thead th { position: sticky; top: 0; z-index: 2; background: var(--fs-th-bg); color: var(--fs-th-fg); font-weight: 600; white-space: nowrap; }
.table-matrix > tbody th { font-weight: 600; min-width: 90px; }
.table-matrix .cell-total { background: rgba(10,10,10,.03); font-weight: 600; }
.table-matrix > tfoot > tr > * { background: rgba(10,10,10,.03); font-weight: 600; }

/* 編輯紀錄：固定欄寬，展開明細時整張表不重排 */
.table-history { table-layout: fixed; min-width: 56rem; }
.table-history .col-time { width: 9rem; }
.table-history .col-person { width: 7rem; }
.table-history .col-act { width: 4.5rem; }
.table-history .col-target { width: 14rem; }
.table-history > tbody > tr > td { overflow-wrap: anywhere; }
.table-history summary { cursor: pointer; }
.history-detail { table-layout: fixed; }
.history-detail td { overflow-wrap: anywhere; }
.col-check { width: 5rem; text-align: center; }

/* 時間軸式的紀錄（亮點計畫歷程備註）：細線分隔，不用左側色條 */
.note-list > .note-item { padding: .6rem 0; border-top: 1px solid rgba(10,10,10,.08); }
.note-list > .note-item:first-child { padding-top: 0; border-top: 0; }
.note-date { font-size: .78rem; color: var(--fs-muted); margin-bottom: .15rem; }
.cell-wrap { white-space: pre-wrap; min-width: 16em; }

/* 子表的展開列（備註等長文字收在每列下方） */
.col-toggle { width: 1%; white-space: nowrap; text-align: right; }
.table-sub > tbody tr.is-open > td { border-bottom-color: transparent; }
.table-sub > tbody tr.detail-row > td { background: color-mix(in srgb, var(--fs-text) 3%, transparent); padding: .5rem .75rem .75rem; }
.detail-list { margin: 0; }
.detail-list dt { font-size: .72rem; font-weight: 600; color: var(--fs-muted); }
.detail-list dd { margin: 0 0 .35rem; }
.detail-list dd:last-child { margin-bottom: 0; }
[data-detail-toggle] i { transition: transform .15s; }
[data-detail-toggle][aria-expanded="true"] i { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { [data-detail-toggle] i { transition: none; } }

/* 區塊內的小標＋右側動作（例：施工輔導 ＋新增） */
.sub-head { display: flex; align-items: center; margin-bottom: .25rem; }
.sub-head .btn { margin-left: auto; }

/* 表單底部固定的儲存列 */
.form-actions {
  position: sticky; bottom: 0; z-index: 99;
  display: flex; gap: .5rem; margin-bottom: 3rem; padding: .75rem 0;
  background: var(--fs-bg); border-top: 1px solid rgba(10,10,10,.1);
}

/* 多選：小方框標籤，勾選後變主色淡底 */
.choice-chip {
  display: inline-flex; align-items: center; gap: .3rem; cursor: pointer;
  font-size: .8rem; padding: .2em .55em; border-radius: 4px;
  background: var(--fs-surface); color: var(--fs-text);
  box-shadow: inset 0 0 0 1px rgba(10,10,10,.15);
}
.choice-chip .form-check-input { margin: 0; }
.choice-chip:has(input:checked) { background: var(--fs-primary-tint); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fs-primary) 35%, transparent); }

/* 列表欄位 */
.seq-tag {
  display: inline-block; font-size: .8rem; font-weight: 600; letter-spacing: .3px;
  padding: .15em .5em; border-radius: 4px;
  background: color-mix(in srgb, var(--fs-text) 8%, transparent); color: var(--fs-text);
}
.cell-trunc { max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-trunc-sm { max-width: 10em; }
.cell-small { font-size: .78rem; }
.cell-nowrap { white-space: nowrap; }
.sort-icon { font-size: .75rem; }
.empty-state { text-align: center; color: var(--fs-muted); padding: 1.5rem 0 !important; }
.empty-state i { font-size: 2rem; display: block; }
.col-actions { min-width: 90px; }

/* ── 狀態標籤 .tag ──
 * 淡底＋深字＋小圓點。顏色由 components.php 的 progressBadgeClass() 等函式決定，頁面不要自己挑。
 */
.tag {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: .78rem; font-weight: 500; line-height: 1.25;
  padding: .18em .55em; border-radius: 4px; white-space: nowrap;
  background: var(--tag-bg); color: var(--tag-fg);
  box-shadow: inset 0 0 0 1px var(--tag-ring);
}
.tag::before { content: ''; width: .45em; height: .45em; border-radius: 50%; background: var(--tag-dot); flex-shrink: 0; }
.tag-success { --tag-bg: #ecfdf3; --tag-fg: #067647; --tag-ring: rgba(6,118,71,.18);   --tag-dot: #17b26a; }
.tag-danger  { --tag-bg: #fef3f2; --tag-fg: #b42318; --tag-ring: rgba(180,35,24,.18);  --tag-dot: #f04438; }
.tag-warning { --tag-bg: #fffaeb; --tag-fg: #b54708; --tag-ring: rgba(181,71,8,.18);   --tag-dot: #f79009; }
.tag-caution { --tag-bg: #fefce8; --tag-fg: #a16207; --tag-ring: rgba(161,98,7,.18);   --tag-dot: #eab308; }
.tag-neutral { --tag-bg: #f5f5f5; --tag-fg: #525252; --tag-ring: rgba(10,10,10,.1);    --tag-dot: #a3a3a3; }
.tag-plain   { --tag-bg: #ffffff; --tag-fg: #525252; --tag-ring: rgba(10,10,10,.12); }
.tag-plain::before { display: none; }
/* 可以點的狀態標籤（例：選項的啟用／停用） */
.tag-btn { border: 0; cursor: pointer; }
.tag-btn:hover { box-shadow: inset 0 0 0 1px var(--tag-fg); }
.tag-btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--fs-primary) 35%, transparent); }

/* 星號切換（例：預設選項）：開＝重點色實心星 */
.star-toggle.is-on { --bs-btn-color: var(--fs-accent); --bs-btn-hover-color: var(--fs-accent-hover); }

/* 清單選單（選項設定的類別） */
.list-group-compact .list-group-item { font-size: .85rem; padding: .5rem .8rem; border-color: rgba(10,10,10,.06); }
.list-group-compact .list-group-item.active { background: var(--fs-primary-tint); color: var(--fs-primary); border-color: rgba(10,10,10,.06); font-weight: 600; }


/* ── Forms ── */
.form-label { font-weight: 600; font-size: .83rem; margin-bottom: .2rem; color: var(--fs-label); }
.form-control, .form-select {
  font-size: .88rem;
  border-color: var(--fs-input-border);
  border-radius: var(--fs-radius);
}
.form-control:focus, .form-select:focus {
  border-color: var(--fs-primary-hover);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--fs-primary-hover) 20%, transparent);
}
.form-check-input:checked { background-color: var(--fs-link); border-color: var(--fs-link); }
.form-section-title {
  background: var(--fs-section-bg);
  color: var(--fs-section-fg);
  font-weight: 700;
  font-size: .83rem;
  padding: .4rem var(--fs-section-pad-x);
  border-left: var(--fs-section-bar);
  border-bottom: var(--fs-section-line);
  border-radius: 4px;
  margin: 1.2rem 0 .8rem;
}

/* ── Buttons ──
 * 六種狀態：正常／懸停／按下／鍵盤焦點／停用／載入中（.is-loading，用 app.js 的 fsBtnLoading()）
 * 跟輸入框同高、字重 500、圖示與文字用 gap 對齊。
 */
.btn {
  --bs-btn-font-size: .875rem;
  --bs-btn-font-weight: 500;
  --bs-btn-padding-x: .875rem;
  --bs-btn-focus-box-shadow: 0 0 0 3px color-mix(in srgb, var(--fs-primary) 35%, transparent);
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  border-radius: var(--fs-btn-radius);
  transition: color .15s, background-color .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn-sm {
  --bs-btn-font-size: .8125rem;
  --bs-btn-padding-x: .625rem;
  gap: .25rem;
  border-radius: var(--fs-btn-sm-radius);
}
.btn:active:not(:disabled):not(.disabled), .btn.is-pressed { transform: scale(.97); }
.btn:disabled, .btn.disabled { opacity: var(--fs-btn-disabled-opacity); }
.btn:disabled { pointer-events: auto; cursor: not-allowed; }
.btn.is-loading, .btn.is-loading:disabled { opacity: 1; cursor: progress; }
.btn.is-loading .spinner-border { width: 1em; height: 1em; border-width: .15em; vertical-align: -.125em; }
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active:not(:disabled), .btn.is-pressed { transform: none; }
}
.btn-primary {
  --bs-btn-bg: var(--fs-primary);
  --bs-btn-border-color: var(--fs-primary);
  --bs-btn-hover-bg: var(--fs-primary-hover);
  --bs-btn-hover-border-color: var(--fs-primary-hover);
  --bs-btn-active-bg: var(--fs-primary-active);
  --bs-btn-active-border-color: var(--fs-primary-active);
  --bs-btn-disabled-bg: var(--fs-primary);
  --bs-btn-disabled-border-color: var(--fs-primary);
}
.btn-warning {
  --bs-btn-bg: var(--fs-accent);
  --bs-btn-border-color: var(--fs-accent);
  --bs-btn-color: #262626;
  --bs-btn-hover-bg: var(--fs-accent-hover);
  --bs-btn-hover-border-color: var(--fs-accent-hover);
  --bs-btn-hover-color: #171717;
  --bs-btn-active-bg: var(--fs-accent-active);
  --bs-btn-active-border-color: var(--fs-accent-active);
  --bs-btn-active-color: #171717;
  --bs-btn-disabled-bg: var(--fs-accent);
  --bs-btn-disabled-border-color: var(--fs-accent);
  --bs-btn-disabled-color: #262626;
}
.btn-primary, .btn-warning { box-shadow: 0 1px 2px rgba(16,24,40,.08), inset 0 -1px 0 rgba(0,0,0,.12); }
.btn-outline-primary {
  --bs-btn-color: var(--fs-link);
  --bs-btn-border-color: var(--fs-link);
  --bs-btn-hover-bg: var(--fs-link);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-border-color: var(--fs-link);
  --bs-btn-active-bg: var(--fs-link-active);
  --bs-btn-active-border-color: var(--fs-link-active);
  --bs-btn-active-color: #fff;
  --bs-btn-disabled-color: var(--fs-link);
  --bs-btn-disabled-border-color: var(--fs-link);
}
.btn-outline-secondary {
  --bs-btn-color: #404040; --bs-btn-bg: #fff; --bs-btn-border-color: #d4d4d4;
  --bs-btn-hover-color: #262626; --bs-btn-hover-bg: #f5f5f5; --bs-btn-hover-border-color: #c4c4c4;
  --bs-btn-active-color: #262626; --bs-btn-active-bg: #ebebeb; --bs-btn-active-border-color: #c4c4c4;
  --bs-btn-disabled-color: #404040; --bs-btn-disabled-bg: #fff; --bs-btn-disabled-border-color: #d4d4d4;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
/* 上面的 box-shadow 會蓋掉 Bootstrap 的焦點框，補回來 */
.btn:focus-visible { box-shadow: var(--bs-btn-focus-box-shadow); }
.btn-link { --bs-btn-color: var(--fs-link); --bs-btn-hover-color: color-mix(in srgb, var(--fs-link) 80%, black); --bs-btn-active-color: var(--fs-link-active); }

/* 無框按鈕、圖示按鈕 */
.btn-ghost {
  --bs-btn-color: var(--fs-muted); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--fs-text); --bs-btn-hover-bg: rgba(10,10,10,.05); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--fs-text); --bs-btn-active-bg: rgba(10,10,10,.09); --bs-btn-active-border-color: transparent;
}
.btn-ghost-danger { --bs-btn-hover-color: #b42318; --bs-btn-hover-bg: #fef3f2; --bs-btn-active-color: #b42318; --bs-btn-active-bg: #fee4e2; }
.btn-icon { width: 2rem; height: 2rem; padding: 0; }
.btn-icon.btn-sm { width: 1.75rem; height: 1.75rem; }
.row-actions { display: flex; gap: .125rem; }

a { color: var(--fs-link); }
.page-link { color: var(--fs-link); }
.page-item.active .page-link { background: var(--fs-link); border-color: var(--fs-link); color: #fff; }

/* ── 提示：toast（告知）與彈窗（要使用者選擇、或失敗）。用法寫在 assets/app.js ── */
/* toast：拿掉 SweetAlert2 預設外框，只留 .fs-toast 本體；不用膠囊圓角 */
.swal2-popup.fs-toast-shell { background: transparent !important; box-shadow: none !important; padding: 0 !important;
  width: auto !important; border: 0 !important; overflow: visible !important; }
.swal2-popup.fs-toast-shell .swal2-html-container { margin: 0 !important; padding: 0 !important; overflow: visible !important; }
/* 有側欄（md 以上，寬 220px）時對內容區置中。不能用 padding，toast 容器寬度固定，字會被擠成直排 */
@media (min-width: 768px) {
  body:has(.sidebar) .swal2-container.swal2-bottom:has(.fs-toast-shell) { translate: 110px 0; }
}
.fs-toast { display: flex; align-items: flex-start; gap: 10px; padding: 10px 18px; border-radius: var(--fs-card-radius);
  font-family: var(--fs-font); font-size: .9rem; line-height: 1.4; text-align: left; color: #fff;
  background: color-mix(in oklab, var(--fs-primary) 94%, transparent); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.fs-toast .bi { color: #7dd3a8; margin-top: .1em; }
.fs-toast b { display: block; font-weight: 500; }
.fs-toast small { display: block; margin-top: 1px; font-size: .8rem; opacity: .8; }

/* 彈窗 */
.swal2-popup.fs-dialog { font-family: var(--fs-font); border-radius: var(--fs-card-radius); width: 26rem; padding: 1.5rem 1.25rem 1.25rem; }
.fs-dialog .swal2-icon { transform: scale(.7); margin: 0 auto -.5rem; }
.fs-dialog .swal2-title { font-size: 1.15rem; font-weight: 700; color: var(--fs-text); padding-top: .5rem; }
.fs-dialog .swal2-html-container { font-size: var(--fs-font-size); color: var(--fs-muted); margin-top: .5rem; }
.fs-dialog .swal2-actions { gap: .5rem; margin-top: 1.25rem; }

/* ── 登入頁 ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-brand { text-align: center; margin-bottom: 1.25rem; }
.auth-brand .brand-mark { width: 3rem; height: 3rem; margin: 0 0 .5rem; }
.auth-brand h1 { font-size: 1.2rem; font-weight: 700; margin: 0; }
.auth-brand p { font-size: .85rem; color: var(--fs-muted); margin: .25rem 0 0; }

/* ── 列印 ── */
@media print {
  .no-print, .sidebar, .navbar-main { display: none !important; }
  .main-content { padding: 0 !important; }
  body { background: #fff !important; }
}

/* ── Mobile ── */
@media (max-width: 767.98px) {
  .sidebar { display: none !important; }
  .main-content { padding: .8rem; }
  .table-cases { min-width: 800px; }
}
