/* 全站語意規範：狀態標籤、提示橫幅、數字排版（在 bravo-tables.css 之後、bravo-dialog.css 之前載入，沿用既有 token，不改任何流程）。
   五種語意色：ok 綠＝成功／已完成／已核准／已發行；info 藍＝處理中／審核中／進行中；
   warn 橘＝待處理／待確認／需要注意；bad 紅＝失敗／退回／拒絕／異常；mute 灰＝草稿／未啟用／已停用／中性。
   顏色之外一律保留文字，並加小圖示，色盲或黑白列印也看得懂。 */
html[data-ui]{
  --tone-ok-bg:#e6f3ec;--tone-ok-fg:#1d6a43;--tone-ok-bd:#b5dcc5;
  --tone-info-bg:#e8eff8;--tone-info-fg:#2a5590;--tone-info-bd:#b9cbe4;
  --tone-warn-bg:#fdf0dc;--tone-warn-fg:#8a5200;--tone-warn-bd:#ecc98e;
  --tone-bad-bg:#fbe9ea;--tone-bad-fg:#9b2c35;--tone-bad-bd:#ebb9bd;
  --tone-mute-bg:#f0f1f3;--tone-mute-fg:#5c6670;--tone-mute-bd:#d9dde2;
}
html[data-ui][data-scheme=dark]{
  --tone-ok-bg:#16301f;--tone-ok-fg:#7fd3a6;--tone-ok-bd:#2a5a3d;
  --tone-info-bg:#182841;--tone-info-fg:#9dc0f1;--tone-info-bd:#2c4a73;
  --tone-warn-bg:#382c14;--tone-warn-fg:#f1c46c;--tone-warn-bd:#6a5420;
  --tone-bad-bg:#3b1c21;--tone-bad-fg:#f2939b;--tone-bad-bd:#6c2f37;
  --tone-mute-bg:#262628;--tone-mute-fg:#c4c7cc;--tone-mute-bd:#3a3a3d;
}

/* ---------- 狀態標籤（Status Badge） ---------- */
html[data-ui][data-ui][data-ui] body :is(.badge,.trace-badge):where(:not(:is(h2,h3,h4) .badge):not(.sidebar .badge):not(.new-note)){
  display:inline-flex;align-items:center;gap:5px;border:1px solid var(--tone-mute-bd);border-radius:999px;padding:2px 10px 2px 9px;
  font-size:.75rem;font-weight:600;line-height:1.5;margin:2px 0;white-space:nowrap;
  background:var(--tone-mute-bg);color:var(--tone-mute-fg);font-variant-numeric:tabular-nums;
  --tone-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6h7' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E")
}
html[data-ui][data-ui][data-ui] body :is(.badge,.trace-badge):where(:not(:is(h2,h3,h4) .badge):not(.sidebar .badge):not(.new-note))::before{
  content:'';display:none;flex:none;width:12px;height:12px;background:currentColor;
  -webkit-mask:var(--tone-icon) center/contain no-repeat;mask:var(--tone-icon) center/contain no-repeat
}
/* 綠：成功、已完成、已核准、已發行 */
html[data-ui][data-ui][data-ui] body :is(.tone-ok,.badge.success,.badge.ok,.badge.status-approved,.badge.status-issued,.badge.status-closed,.trace-badge.is-green,.badge.correction-status.is-applied,.badge.correction-decision.is-applied){
  background:var(--tone-ok-bg);color:var(--tone-ok-fg);border-color:var(--tone-ok-bd);
  --tone-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.4 6.3l2.4 2.3 4.8-5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
}
/* 藍：處理中、審核中、進行中 */
html[data-ui][data-ui][data-ui] body :is(.tone-info,.badge.info,.badge.status-review,.trace-badge.is-blue,.badge.correction-status.is-review){
  background:var(--tone-info-bg);color:var(--tone-info-fg);border-color:var(--tone-info-bd);
  --tone-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='4.2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M6 3.6V6l1.7 1' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E")
}
/* 橘：待處理、待確認、需要注意 */
html[data-ui][data-ui][data-ui] body :is(.tone-warn,.badge.warning,.trace-badge.is-orange,.badge.correction-status.is-pending){
  background:var(--tone-warn-bg);color:var(--tone-warn-fg);border-color:var(--tone-warn-bd);
  --tone-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2.4v4.2' stroke='black' stroke-width='1.9' stroke-linecap='round'/%3E%3Ccircle cx='6' cy='9.2' r='1' fill='black'/%3E%3C/svg%3E")
}
/* 紅：失敗、退回、拒絕、異常 */
html[data-ui][data-ui][data-ui] body :is(.tone-bad,.badge.danger,.badge.status-rejected,.badge.status-returned,.trace-badge.is-red,.badge.correction-status.is-rejected,.badge.correction-decision.is-rejected){
  background:var(--tone-bad-bg);color:var(--tone-bad-fg);border-color:var(--tone-bad-bd);
  --tone-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 3l6 6M9 3l-6 6' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E")
}
/* 灰：草稿、未啟用、已停用、中性（含舊的 neutral，原本偏藍，現在回到中性） */
html[data-ui][data-ui][data-ui] body :is(.tone-mute,.badge.neutral,.badge.muted-badge,.badge.status-draft,.trace-badge.is-gray){
  background:var(--tone-mute-bg);color:var(--tone-mute-fg);border-color:var(--tone-mute-bd)
}
html[data-ui][data-ui][data-ui] a.badge.danger{text-decoration:none}
/* 只有「有語意色」的標籤才帶圖示；灰色中性標籤與件數徽章不加，避免畫面雜訊 */
html[data-ui][data-ui][data-ui] body :is(.tone-ok,.tone-info,.tone-warn,.tone-bad,.badge.success,.badge.ok,.badge.info,.badge.warning,.badge.danger,.badge.status-approved,.badge.status-issued,.badge.status-closed,.badge.status-review,.badge.status-returned,.badge.status-rejected,.trace-badge.is-green,.trace-badge.is-blue,.trace-badge.is-orange,.trace-badge.is-red,.badge.correction-status.is-applied,.badge.correction-status.is-review,.badge.correction-status.is-pending,.badge.correction-status.is-rejected,.badge.correction-decision.is-rejected,.badge.correction-decision.is-applied)::before{display:inline-block}
/* 儀表板上的件數徽章與側欄徽章不是狀態，維持原樣 */
@media print{html[data-ui] .badge{border-color:currentColor}}

/* ---------- 提示橫幅（Alert Banner）：Info／Success／Warning／Error ---------- */
html[data-ui][data-ui][data-ui] :is(.alert,.notice,.info-strip):not(.toast-stack *){
  --tone-bg:var(--tone-info-bg);--tone-fg:var(--tone-info-fg);--tone-bd:var(--tone-info-bd);
  --tone-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M10 9v5M10 6v.6' stroke='black' stroke-width='1.9' stroke-linecap='round'/%3E%3C/svg%3E");
  display:flex;align-items:flex-start;gap:10px;margin:10px 0;padding:10px 14px;border:1px solid var(--tone-bd);border-radius:10px;
  background:var(--tone-bg);color:var(--tone-fg);font-size:.875rem;line-height:1.6;font-weight:500;box-shadow:none
}
html[data-ui][data-ui][data-ui] :is(.alert,.notice,.info-strip):not(.toast-stack *)::before{
  content:'';flex:none;width:18px;height:18px;margin-top:2px;background:currentColor;
  -webkit-mask:var(--tone-icon) center/contain no-repeat;mask:var(--tone-icon) center/contain no-repeat
}
html[data-ui][data-ui][data-ui] :is(.alert,.notice,.info-strip):is(.success):not(.toast-stack *){
  --tone-bg:var(--tone-ok-bg);--tone-fg:var(--tone-ok-fg);--tone-bd:var(--tone-ok-bd);
  --tone-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M6.4 10.4l2.6 2.6 4.6-5' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
}
html[data-ui][data-ui][data-ui] :is(.alert,.notice,.info-strip):is(.warning):not(.toast-stack *){
  --tone-bg:var(--tone-warn-bg);--tone-fg:var(--tone-warn-fg);--tone-bd:var(--tone-warn-bd);
  --tone-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 2.8L18 16.5H2z' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M10 8v4M10 14.2v.5' stroke='black' stroke-width='1.9' stroke-linecap='round'/%3E%3C/svg%3E")
}
html[data-ui][data-ui][data-ui] :is(.alert,.notice,.info-strip):is(.error,.danger):not(.toast-stack *){
  --tone-bg:var(--tone-bad-bg);--tone-fg:var(--tone-bad-fg);--tone-bd:var(--tone-bad-bd);
  --tone-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M7 7l6 6M13 7l-6 6' stroke='black' stroke-width='1.9' stroke-linecap='round'/%3E%3C/svg%3E")
}
html[data-ui][data-ui][data-ui] :is(.alert,.notice,.info-strip):not(.toast-stack *) :is(a,strong,b){color:inherit;font-weight:600}
html[data-ui][data-ui][data-ui] .notice-body{flex:1;min-width:0}
html[data-ui][data-ui][data-ui] .notice-title{display:block;font-weight:600}
html[data-ui][data-ui][data-ui] .notice-close{flex:none;margin:-2px -6px 0 0;width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:8px;background:transparent;color:inherit;font:inherit;font-size:1.125rem;line-height:1;cursor:pointer;opacity:.75}
html[data-ui][data-ui][data-ui] .notice-close:hover{opacity:1;background:color-mix(in srgb,currentColor 12%,transparent)}
html[data-ui][data-ui][data-ui] .notice-close:focus-visible{outline:2px solid currentColor;outline-offset:1px}
html[data-ui][data-ui][data-ui] [hidden].alert,html[data-ui] .notice[hidden]{display:none}

/* ---------- 數字：等寬數字、數值欄靠右 ---------- */
html[data-ui] :is(td,th,time,.num,.stat,.metric,input[type=number],[data-count],.sidebar-version-info b){font-variant-numeric:tabular-nums}
html[data-ui][data-ui][data-ui] :is(th,td).num{text-align:right;white-space:nowrap}
html[data-ui][data-ui][data-ui] th.num .th-icon{margin-right:4px}
html[data-ui][data-ui][data-ui] th.num{padding-right:14px}
html[data-ui][data-ui][data-ui] td.num{padding-right:14px}
html[data-ui][data-ui][data-ui] tfoot :is(td,th).num{font-weight:600}
html[data-ui][data-ui][data-ui] td.num .unit{margin-left:2px;color:var(--muted);font-size:.75rem}

/* ---------- 快速跳頁（Ctrl/⌘ + K）補強：搜尋狀態、手機全螢幕 ---------- */
html[data-ui][data-ui][data-ui] .quick-jump-list .quick-jump-note{padding:10px 18px;font-size:.8125rem;color:var(--muted);cursor:default}
html[data-ui][data-ui][data-ui] .quick-jump-list .quick-jump-empty{padding:14px 18px;font-size:.8125rem;color:var(--muted);cursor:default}
html[data-ui][data-ui][data-ui] .quick-jump-list li small{max-width:55%;overflow:hidden;text-overflow:ellipsis}
html.quick-jump-open{overflow:hidden}
@media(max-width:760px){
  html[data-ui][data-ui][data-ui] .quick-jump{padding:0}
  html[data-ui][data-ui][data-ui] .quick-jump-panel{width:100%;max-height:none;height:100dvh;border-radius:0}
  html[data-ui][data-ui][data-ui] .quick-jump-list{flex:1;min-height:0}
  html[data-ui][data-ui][data-ui] .quick-jump-list li{min-height:48px}
  html[data-ui][data-ui][data-ui] .quick-jump-foot{display:none}
  html[data-ui][data-ui][data-ui] .quick-jump-trigger{display:inline-flex;min-width:44px;min-height:44px;justify-content:center;margin-right:0}
  html[data-ui][data-ui][data-ui] .quick-jump-trigger svg{width:20px;height:20px}
  html[data-ui][data-ui][data-ui] .quick-jump-trigger span,html[data-ui][data-ui][data-ui] .quick-jump-trigger kbd{display:none}
}
