/* ============================================================
   e等 Tag Design System v2（全平臺統一・系列化）— 規則見 skill edeng-tag-tab-system
   基準：總覽「開放性問卷處理」計數膠囊（已逾期／未處理／已處理）的質感 ——
     膠囊圓角・柔和淺底・同色系深字・無框線・無實心色塊
   外型：高 24・圓角 999・左右 10px・12.5px 粗體；狀態 tag 前置 13px icon（check 完成／schedule 等待／close 結束），有說明時後置 12px info
   色彩（同一明度帶的淺底＋深字，文字對比皆 ≥ 4.9:1，彼此調和不搶）：
     slate  #e6ebf0／#37546a  已處理・完成類、預設類別（數位課程、問題類型…）
     blue   #e4edf8／#2f5d94  已送審（進行中）
     indigo #ebe9f6／#4f4596  已彙送
     green  #e2f1ea／#1f6b4f  已上架・上架中・有效
     teal   #d8eff1／#12636e  成立，待上架（班次成立，待上架）
     amber  #fdf1d8／#9a5308  未處理・草稿・待編修・未彙送・符合 n／N
     orange #fbe8dc／#a5481a  待確認・審查中
     red    #fde4e0／#b42318  退回修正・已逾期
     gray   #eef0f3／#56616f  已下架・已結束・已停用・鎖定・關鍵字
     類別（不放 icon、不使用 amber／orange／red／green）：slate（預設）｜cyan #dff0f2／#1f6573｜blue｜violet #efe8f6／#6a3f8f｜pink #f8e6ee／#9b3366
   例外：總覽 .stat-inline .si（已逾期 1／未處理 1／已處理 1）維持原頁面樣式（本系列即以它為基準）
   既有元件以別名套用（不需改 HTML）：.cr-st .cr-badge .c-badge .spill .pill .tchip .tag .kw .kind .os-match、ai-cs 的 .chip
   ============================================================ */
:root{
  --tg-ic-check:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  --tg-ic-close:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
  --tg-ic-wait:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z'/%3E%3C/svg%3E");
  --tg-slate-b:#e6ebf0;--tg-slate-f:#37546a; --tg-blue-b:#e4edf8;--tg-blue-f:#2f5d94; --tg-indigo-b:#ebe9f6;--tg-indigo-f:#4f4596;
  --tg-green-b:#e2f1ea;--tg-green-f:#1f6b4f; --tg-amber-b:#fdf1d8;--tg-amber-f:#9a5308; --tg-orange-b:#fbe8dc;--tg-orange-f:#a5481a;
  --tg-red-b:#fde4e0;--tg-red-f:#b42318; --tg-gray-b:#eef0f3;--tg-gray-f:#56616f;
  --tg-cyan-b:#dff0f2;--tg-cyan-f:#1f6573; --tg-teal-b:#d8eff1;--tg-teal-f:#12636e; --tg-violet-b:#efe8f6;--tg-violet-f:#6a3f8f; --tg-pink-b:#f8e6ee;--tg-pink-f:#9b3366;
}

/* ---------- 外型（膠囊） ---------- */
html body :is(.sys-tag,.cr-st,.cr-badge,.cmeta .c-badge,.tbl .c-badge,.spill,span.pill,.tchip,.col-h .kind,span.kw,span.tag,.os-match,span.rtag),
html:has(link[href*="ai-cs.css"]) body .chip:not(.multi .chip){
  display:inline-flex !important;align-items:center;gap:4px;height:24px !important;min-height:0;padding:0 10px !important;
  border-radius:999px !important;border:0 !important;box-sizing:border-box;box-shadow:none !important;
  font-size:12.5px !important;font-weight:700 !important;line-height:1 !important;letter-spacing:.01em;white-space:nowrap;vertical-align:middle}
/* 有前置 icon 的狀態 tag：左內距略收，視覺置中 */
html body :is(.sys-tag,.cr-st,.cr-badge):has(> .mi:first-child),html body :is(.spill,span.pill:not(.plat):not(.open)){padding-left:8px !important}
/* icon（字型 icon 與 ::before 遮罩 icon 同尺寸，wght 600） */
html body :is(.sys-tag,.cr-st,.cr-badge,.tchip) .mi{font-size:13px !important;width:13px;line-height:1;flex:none;font-variation-settings:'FILL' 0,'wght' 600,'GRAD' 0,'opsz' 20 !important;font-weight:600}
html body .content :is(.sys-tag,.cr-st,.cr-badge,.tchip) .mi{font-size:calc(13px / 1.07) !important}
html body :is(.sys-tag,.cr-st,.cr-badge) .mi:last-child:not(:first-child){font-size:12px !important;opacity:.75;margin-left:1px}
html body .content :is(.sys-tag,.cr-st,.cr-badge) .mi:last-child:not(:first-child){font-size:calc(12px / 1.07) !important}
html body :is(.spill,span.pill)::before{content:"";width:13px !important;height:13px !important;border-radius:0 !important;flex:none;
  background:currentColor !important;-webkit-mask:var(--tg-ic,var(--tg-ic-check)) center/13px no-repeat;mask:var(--tg-ic,var(--tg-ic-check)) center/13px no-repeat}
html body :is(.spill,span.pill):is(.done,.live,.ok){--tg-ic:var(--tg-ic-check)}
html body :is(.spill,span.pill):is(.todo,.unsent,.draft,.review){--tg-ic:var(--tg-ic-wait)}
html body span.pill:is(.off,.ended){--tg-ic:var(--tg-ic-close)}
html body span.pill:is(.plat,.open)::before{display:none}   /* 類別 tag 不放 icon */

/* ---------- 狀態色 ---------- */
html body .sys-tag.t-slate{background:var(--tg-slate-b) !important;color:var(--tg-slate-f) !important}
html body :is(.sys-tag.t-blue){background:var(--tg-blue-b) !important;color:var(--tg-blue-f) !important}
html body :is(.sys-tag.t-indigo,.cr-st.st-sent){background:var(--tg-indigo-b) !important;color:var(--tg-indigo-f) !important}
html body :is(.sys-tag.t-emerald,.sys-tag.t-green,.cr-st.st-pub,span.pill.live,span.pill.ok,.spill.done){background:var(--tg-green-b) !important;color:var(--tg-green-f) !important}
/* 成立，待上架：藍綠（teal，接近類別色「組裝課程」），與「已上架」綠色明確區分（2026-10-16 使用者指定） */
html body :is(.sys-tag.t-teal,.sys-tag.t-emerald-soft,.cr-st.st-pub-wait){background:var(--tg-teal-b) !important;color:var(--tg-teal-f) !important}
html body :is(.sys-tag.t-amber,.cr-st.st-draft,.spill.todo,.spill.unsent,span.pill.draft,span.pill.todo,.os-match){background:var(--tg-amber-b) !important;color:var(--tg-amber-f) !important}
html body :is(.sys-tag.t-orange,.cr-st.st-confirm,span.pill.review){background:var(--tg-orange-b) !important;color:var(--tg-orange-f) !important}
html body :is(.sys-tag.t-red,.sys-tag.t-red-soft,.cr-st.st-ret){background:var(--tg-red-b) !important;color:var(--tg-red-f) !important}
html body :is(.sys-tag.t-gray,.cr-st.st-off,span.pill.off,span.pill.ended,.tchip.lock,span.kw){background:var(--tg-gray-b) !important;color:var(--tg-gray-f) !important}
/* ---------- 類別色（無 icon） ---------- */
html body :is(.sys-tag.c-primary,.sys-tag.c-slate,.c-badge.cat-a,.tchip.set,span.tag,span.pill.plat),
html:has(link[href*="ai-cs.css"]) body .chip:not(.multi .chip):not(.b):not(.p):not(.g):not(.o):not(.r){background:var(--tg-slate-b) !important;color:var(--tg-slate-f) !important}
html body :is(.sys-tag.c-cyan,.c-badge.cat-b,span.pill.open),
html:has(link[href*="ai-cs.css"]) body .chip.g:not(.multi .chip){background:var(--tg-cyan-b) !important;color:var(--tg-cyan-f) !important}
html body :is(.sys-tag.c-blue,span.tag.mooc),
html:has(link[href*="ai-cs.css"]) body .chip.b:not(.multi .chip){background:var(--tg-blue-b) !important;color:var(--tg-blue-f) !important}
html body :is(.sys-tag.c-violet,.c-badge.cat-c),
html:has(link[href*="ai-cs.css"]) body .chip.p:not(.multi .chip){background:var(--tg-violet-b) !important;color:var(--tg-violet-f) !important}
html body .sys-tag.c-pink,
html:has(link[href*="ai-cs.css"]) body :is(.chip.o,.chip.r):not(.multi .chip){background:var(--tg-pink-b) !important;color:var(--tg-pink-f) !important}

/* 可點的「＋待定義」tchip：同膠囊，虛線框＝可操作 */
/* 2026-10-29：「＋待定義」預設對齊 Figma 6163:54130——白底、#3f82b8 1px 虛線框（2/2）、#3f82b8 字 12.5 Bold、＋16px、左右 10、間距 4；hover／focus 改淡藍底＋實線框 */
html body .tchip:not(.set):not(.lock){border:1px dashed #3f82b8 !important;background:#fff !important;color:#3f82b8 !important;padding:0 10px !important;gap:4px !important;font-size:12.5px !important;font-weight:700 !important;cursor:pointer}
html body .tchip:not(.set):not(.lock) .mi{font-size:16px !important;width:16px;color:#3f82b8}
html body :is(.tbl tr:hover .tchip,.tchip:hover,.tchip:focus-visible):not(.set):not(.lock){background:var(--tg-blue-b) !important;border-style:solid !important}
/* 角色 tag（.kind）：同膠囊，顏色沿用各欄位角色色 */
html body .col-h .kind{border:0 !important}

/* 例外：總覽「開放性問卷處理」計數膠囊（.stat-inline .si：已逾期／未處理／已處理）依使用者要求維持原頁面樣式，不套 sys-tag（本系列的質感基準） */

/* ---------- 「已送審」送審類別 tag：全平臺唯一樣式＝加盟機關／總覽「待審查的課程」.badge-sent ----------
   實心 #2563eb＋反白字、膠囊（圓角 999）、11.5px／700、內距 3×9、icon Phosphor Bold（check 14／info 13，opacity .9）。
   課程審查 .cr-badge、.cr-st.st-review 與新做的 .sys-tag.t-sent 一律套用，不得另做膠囊淺底版本（2026-10-16 使用者指定） */
html body :is(.badge-sent,.cr-badge,.cr-st.st-review,.sys-tag.t-sent)[class]{display:inline-flex !important;align-items:center;gap:4px !important;
  height:auto !important;min-height:0;padding:3px 10px !important;border:0 !important;border-radius:999px !important;box-shadow:none !important;
  background:#2563eb !important;color:#fff !important;font-size:11.5px !important;font-weight:700 !important;line-height:1.5 !important;
  letter-spacing:normal;white-space:nowrap;vertical-align:baseline}
html body :is(.badge-sent,.cr-badge,.cr-st.st-review,.sys-tag.t-sent)[class] .mi{font-size:14px !important;width:auto;color:#fff;opacity:1;margin:0;line-height:1;font-weight:400}
html body :is(.badge-sent,.cr-badge,.cr-st.st-review,.sys-tag.t-sent)[class] .mi:last-child:not(:first-child),
html body :is(.badge-sent,.cr-badge,.cr-st.st-review,.sys-tag.t-sent)[class] .mi.info{font-size:13px !important;opacity:.9;margin-left:1px;cursor:help}
html body .badge-sent[class] .tip .mi.info{margin-left:0}

/* 總覽「權限檢視／完整選單」待辦表 .rtag（與 Figma Tag 組件一致）：待審核／待批改／待發布＝amber＋schedule、已逾期＝red＋close、進行中（.st）＝blue＋check、角色（課程管理者）＝blue 類別無 icon */
html body span.rtag.todo{background:var(--tg-amber-b) !important;color:var(--tg-amber-f) !important;--tg-ic:var(--tg-ic-wait)}
html body span.rtag.over{background:var(--tg-red-b) !important;color:var(--tg-red-f) !important;--tg-ic:var(--tg-ic-close)}
html body span.rtag.own{background:var(--tg-blue-b) !important;color:var(--tg-blue-f) !important;--tg-ic:var(--tg-ic-check)}
html body span.rtag:is(.todo,.over,.st){padding-left:8px !important}
html body span.rtag:is(.todo,.over,.st)::before{content:"";width:13px;height:13px;flex:none;background:currentColor;-webkit-mask:var(--tg-ic) center/13px no-repeat;mask:var(--tg-ic) center/13px no-repeat}

/* ============================================================
   2026-10-29｜規則：膠囊內文字一律「光學垂直置中」（全平臺）
   問題：中文（Noto Sans TC）＋英文數字（Inter）混排、line-height:1 時，字形落在行框內偏上／偏下，
        膠囊（固定高度）看起來不置中（例：開放性問卷處理「已處理 2｜未處理 1」「彙送人力學院｜● 未彙送」）。
   作法：文字段落做成 block 容器＋text-box: trim-both cap alphabetic（裁掉字型上下留白、以字高置中），
        由父層 inline-flex align-items:center 置中；不支援 text-box 的瀏覽器維持原 line-height:1。
   新增膠囊型計數／狀態元件時沿用 .gcnt > .gs 結構即自動置中，不需逐頁檢查。
   ============================================================ */
html body .gcnt{box-sizing:border-box;align-items:center !important}
html body .gcnt .gs{display:block !important;line-height:1 !important;white-space:nowrap;text-box:trim-both cap alphabetic}
html body .gcnt .gs b{display:inline;margin-left:5px;line-height:1 !important}
html body .gcnt .gs.st::before{display:inline-block !important;vertical-align:.08em;margin-right:6px}
html body .gcnt i{align-self:center}
/* 2026-10-29｜已處理計數：0＝維持原色；>0 數字用「已完成」綠（同 tag 已處理 --tg-green-f） */
html body .gbar .gcnt .gs.done.has b{color:var(--tg-green-f,#1f6b4f) !important}
