/* ============================================
   國泰 CI 樣式 - Cathay-Tech Design System v3
   統一全站設計規範（cathaysec.com.tw 官網風格）
   ============================================ */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  /* 國泰官網配色 */
  --g1: #26A889;        /* 主色-國泰綠（官網青綠）*/
  --g2: #1E8A6F;        /* 主色-深綠 hover */
  --g-text: #0D5C47;    /* 深綠文字 */
  --g-light: #EBF7E8;   /* 淺綠背景（官網）*/
  --yellow: #FFCA28;
  --orange: #E87C07;
  --red: #E00B00;
  --c1: #141413;        /* 主要文字（官網極深）*/
  --c2: #333333;        /* 次要文字 */
  --c3: #888888;        /* 輔助文字 */
  --c4: #BEBEBE;        /* 邊框 */
  --bg: #FAF9F5;        /* 頁面背景（官網暖灰白）*/
  --bg2: #F5F5F5;       /* 次背景 */
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.03);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.10), 0 4px 16px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Noto Sans TC", "微軟正黑體", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--c1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
  font-size: 15px;
}


/* ===== 1. Navigation ===== */
.navbar {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 0 32px;
  display: flex;
  align-items: center;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--c1);
  text-decoration: none;
  margin-right: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.5px;
}
.navbar-brand .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--g1);
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(38,168,137,0.15);
}
.nav-links { display: flex; gap: 0; list-style: none; }
.nav-links a {
  text-decoration: none;
  color: var(--c2);
  padding: 15px 16px;
  font-size: 16px;
  font-weight: 400;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.nav-links a:hover { color: var(--g1); }
.nav-links a.active {
  color: var(--g1);
  font-weight: 500;
  border-bottom-color: var(--g1);
}


/* ===== 2. Layout ===== */
.container { max-width: 1360px; margin: 0 auto; padding: 32px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }


/* ===== 3. Cards ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: box-shadow var(--transition);
  border: 1px solid rgba(0,0,0,0.03);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--c3);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.card-status-ok { border-left: 4px solid var(--g1); }
.card-status-warn { border-left: 4px solid var(--orange); }
.card-status-error { border-left: 4px solid var(--red); }


/* ===== 4. KPI Cards ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  border-left: 4px solid var(--c4);
  border-top: none;
  transition: all var(--transition);
  cursor: pointer;
  border-right: 1px solid rgba(0,0,0,0.03);
  border-bottom: 1px solid rgba(0,0,0,0.03);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-card.ok { border-left-color: var(--g1); }
.kpi-card.warn { border-left-color: var(--orange); }
.kpi-card.error { border-left-color: var(--red); }
.kpi-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 42px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -2px;
}
.kpi-value.ok { color: var(--g1); }
.kpi-value.warn { color: var(--orange); }
.kpi-value.error { color: var(--red); }
.kpi-label {
  font-size: 13px;
  color: var(--c3);
  margin-top: 8px;
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* KPI Row（TWGCB 風格：4 欄 grid） */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-num { font-size: 36px; font-weight: 700; font-family: "JetBrains Mono", monospace; color: var(--c1); }
.kpi-ok .kpi-num { color: var(--g1); }
.kpi-error .kpi-num { color: var(--red); }

/* Mini KPI（detail 頁面用） */
.mini-kpi { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.mini-kpi-item { background: var(--white); border-radius: var(--radius-sm); padding: 12px 20px; box-shadow: var(--shadow-sm); text-align: center; min-width: 100px; }
.mini-kpi-num { font-size: 22px; font-weight: 700; font-family: "JetBrains Mono", monospace; }
.mini-kpi-label { font-size: 12px; color: var(--c3); }


/* ===== 5. Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.2px;
}
.badge-ok, .badge-pass { background: var(--g-light); color: var(--g-text); }
.badge-warn { background: #FFF3E0; color: #B8660B; }
.badge-error, .badge-fail { background: #FFEBEE; color: var(--red); }
/* 等級標籤 */
.badge-a { background: #E3F2FD; color: #1565C0; }
.badge-b { background: #FFF8E1; color: #F57F17; }
.badge-c { background: #FFF3E0; color: #E65100; }
.badge-d { background: #FFEBEE; color: #B71C1C; }


/* ===== 6. Buttons ===== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Noto Sans TC", sans-serif;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--g1); color: var(--white); }
.btn-primary:hover { background: var(--g2); box-shadow: 0 4px 12px rgba(38,168,137,0.25); }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: #e0e0e0; color: #333; }
.btn-secondary:hover { background: #d0d0d0; }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #C62828; box-shadow: 0 4px 12px rgba(224,11,0,0.25); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-fix { background: var(--orange); color: white; padding: 6px 16px; font-size: 13px; border: none; border-radius: var(--radius-xs); cursor: pointer; font-weight: 600; }
.btn-fix:hover { background: #d06c00; }
.btn-fix:disabled { background: #ccc; cursor: not-allowed; }
.btn-fixed { background: var(--g1); color: white; padding: 6px 16px; font-size: 13px; border: none; border-radius: var(--radius-xs); cursor: default; }
.btn-skip { background: #e0e0e0; color: #555; padding: 6px 16px; font-size: 13px; border: none; border-radius: var(--radius-xs); cursor: pointer; }
.btn-exception { background: #FFF3E0; color: #E65100; padding: 6px 16px; font-size: 13px; border: 1px solid #FFB74D; border-radius: var(--radius-xs); cursor: pointer; }


/* ===== 7. Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
th {
  text-align: left;
  padding: 14px 16px;
  background: var(--bg);
  color: var(--c3);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--c4);
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  vertical-align: middle;
}
tr:hover td { background: rgba(38,168,137,0.03); }

/* data-table（Dashboard 主表格） */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 12px; border-bottom: 2px solid #e0e0e0; font-size: 13px; color: var(--c3); text-transform: none; letter-spacing: 0; }
.data-table td { padding: 12px; border-bottom: 1px solid #f0f0f0; font-size: 14px; font-family: inherit; }
.data-table tr:hover { background: #f9f9f9; }

/* matrix-table（TWGCB 燈號矩陣） */
.matrix-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix-table th { padding: 10px 12px; text-align: center; font-size: 12px; color: var(--c3); font-weight: 600; background: #fafafa; border-bottom: 2px solid #e0e0e0; white-space: nowrap; position: sticky; top: 0; z-index: 2; text-transform: none; letter-spacing: 0; }
.matrix-table th.col-fixed { text-align: left; background: var(--bg2); position: sticky; z-index: 3; }
.matrix-table th.cat-header { background: var(--g-light); color: var(--g-text); font-size: 12px; font-weight: 700; }
.matrix-table td { padding: 8px 12px; border-bottom: 1px solid #f0f0f0; text-align: center; vertical-align: middle; font-family: inherit; }
.matrix-table td.col-fixed { text-align: left; background: white; border-right: 2px solid #e0e0e0; }
.matrix-table td.col-reason { text-align: left; font-size: 12px; color: var(--c2); max-width: 200px; }
.matrix-table td.host-cell { text-align: left; font-weight: 600; font-size: 12px; white-space: nowrap; padding-left: 8px; }
.matrix-table tr:hover td { background: #fafffe; }
.matrix-table tr:hover td.col-fixed { background: #f5faf5; }

/* check-table（TWGCB 檢查項目表） */
table.check-table { width: 100%; border-collapse: collapse; }
table.check-table th { padding: 10px 16px; text-align: left; font-size: 12px; color: var(--c3); font-weight: 600; background: #fafafa; border-bottom: 1px solid #e8e8e8; white-space: nowrap; text-transform: none; letter-spacing: 0; }
table.check-table td { padding: 10px 16px; font-size: 13px; border-bottom: 1px solid #f5f5f5; vertical-align: top; font-family: inherit; }
table.check-table tr:hover { background: #fafffe; }
table.check-table tr.row-fail { background: #FFF9F9; }

/* settings-table（TWGCB 設定表） */
.settings-table { width: 100%; border-collapse: collapse; }
.settings-table th { padding: 10px 12px; text-align: left; font-size: 12px; color: var(--c3); border-bottom: 2px solid #e0e0e0; text-transform: none; letter-spacing: 0; }
.settings-table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; font-family: inherit; }
.settings-table tr:hover { background: #fafafa; }

/* sign-table（報表簽核表格） */
.sign-table { width: 100%; border-collapse: collapse; margin-top: 30px; }
.sign-table th, .sign-table td { border: 1px solid #ccc; padding: 10px 16px; text-align: center; }
.sign-table th { background: var(--bg2); font-size: 13px; color: #666; width: 25%; text-transform: none; letter-spacing: 0; }
.sign-table td { height: 60px; font-size: 14px; font-family: inherit; }


/* ===== 8. Forms ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--c2);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #E0E0E0;
  border-radius: var(--radius-xs);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--white);
  font-family: "Noto Sans TC", sans-serif;
  color: var(--c1);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--g1);
  box-shadow: 0 0 0 3px rgba(38,168,137,0.12);
}
.input-field {
  padding: 10px 14px;
  border: 1.5px solid #E0E0E0;
  border-radius: var(--radius-xs);
  font-size: 14px;
  box-sizing: border-box;
  font-family: "Noto Sans TC", sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-field:focus {
  outline: none;
  border-color: var(--g1);
  box-shadow: 0 0 0 3px rgba(38,168,137,0.12);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }


/* ===== 9. Tabs ===== */
.tab-row { display: flex; gap: 0; margin-bottom: 0; }
.tab-btn { padding: 10px 24px; border: none; background: #e8e8e8; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--c2); transition: all var(--transition); }
.tab-btn:first-child { border-radius: var(--radius-sm) 0 0 0; }
.tab-btn:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.tab-btn:hover:not(.active) { background: #f0f0f0; }
.tab-btn.active { background: white; color: var(--g2); border-bottom: 3px solid var(--g1); }

/* OS Tabs（TWGCB 作業系統切換） */
.os-tabs { display: flex; gap: 0; margin-bottom: 0; }
.os-tab { padding: 12px 28px; border: none; background: #e8e8e8; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--c2); border-bottom: 3px solid transparent; transition: all var(--transition); }
.os-tab:first-child { border-radius: var(--radius-sm) 0 0 0; }
.os-tab:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.os-tab.active { background: white; color: var(--g2); border-bottom-color: var(--g1); }
.os-tab:hover:not(.active) { background: #f0f0f0; }
.os-tab-count { display: inline-block; background: #e0e0e0; color: var(--c2); padding: 1px 8px; border-radius: 10px; font-size: 11px; margin-left: 4px; }
.os-tab.active .os-tab-count { background: var(--g1); color: white; }

/* Admin Tabs */
.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 20px; }
.admin-tab { padding: 10px 24px; border: none; background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--c3); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.admin-tab:hover { color: var(--c2); }
.admin-tab.active { color: var(--g1); border-bottom-color: var(--g1); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }


/* ===== 10. Toggle Switch ===== */
.toggle { position: relative; width: 44px; height: 24px; display: inline-block; }
.toggle input { display: none; }
.toggle .toggle-slider {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc; border-radius: 24px; cursor: pointer; transition: 0.3s;
}
.toggle .toggle-slider:before {
  content: ""; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--g1); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Toggle with label */
.toggle-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--c2); cursor: pointer; white-space: nowrap; }
.toggle-label input { display: none; }
.toggle-label .toggle-slider { position: relative; width: 44px; height: 24px; background: #ccc; border-radius: 24px; transition: 0.3s; display: inline-block; }
.toggle-label .toggle-slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle-label input:checked + .toggle-slider { background: var(--g1); }
.toggle-label input:checked + .toggle-slider:before { transform: translateX(20px); }


/* ===== 11. Modal ===== */
.modal-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  justify-content: center;
  align-items: center;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal, .modal-box, .modal-content {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-lg { max-width: 900px; }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 24px; color: var(--c1); }


/* ===== 12. Progress / Rate Bars ===== */
.progress-bar {
  width: 100%; height: 6px;
  background: rgba(0,0,0,0.05);
  border-radius: 3px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-fill.ok { background: var(--g1); }
.progress-fill.warn { background: var(--orange); }
.progress-fill.error { background: var(--red); }

/* Rate Bar（TWGCB 合格率長條） */
.rate-bar { height: 24px; border-radius: 12px; background: #f0f0f0; overflow: hidden; margin: 6px 0; }
.rate-bar-fill { height: 100%; border-radius: 12px; transition: width 0.5s; display: flex; align-items: center; padding-left: 8px; font-size: 12px; font-weight: 600; color: white; }
.rate-cell { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 12px; }

/* Level Bar（等級分佈） */
.level-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.level-label { width: 120px; font-weight: 600; font-size: 14px; }
.level-bar-wrap { flex: 1; }
.level-rate { width: 60px; text-align: right; font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 16px; }

/* Category Bar（小進度條） */
.cat-bar { width: 80px; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 4px; }


/* ===== 13. Status Lights（16px 統一） ===== */
.light { display: inline-block; width: 16px; height: 16px; border-radius: 50%; cursor: pointer; }
.light-pass { background: var(--g1); box-shadow: 0 0 4px rgba(38,168,137,0.3); }
.light-fail { background: var(--red); box-shadow: 0 0 4px rgba(224,11,0,0.3); }
.light-exception { background: var(--orange); box-shadow: 0 0 4px rgba(232,124,7,0.3); }
.light-na { background: #e0e0e0; }
.light-skip { background: #ccc; }
.light-cat { width: 14px; height: 14px; }


/* ===== 14. Step Wizard ===== */
.steps { display: flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step-num { width: 36px; height: 36px; border-radius: 50%; background: #e0e0e0; color: #888; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.step.active .step-num { background: var(--g1); color: white; }
.step.done .step-num { background: var(--g2); color: white; }
.step-label { font-size: 12px; color: var(--c3); }
.step.active .step-label { color: var(--g2); font-weight: 600; }
.step-line { width: 80px; height: 2px; background: #e0e0e0; margin: 0 8px; margin-bottom: 20px; }


/* ===== 15. Harden Items ===== */
.harden-item { border: 1px solid #e8e8e8; border-radius: 10px; padding: 20px; margin-bottom: 12px; }
.harden-item.item-pass { border-left: 4px solid var(--g1); background: #FAFFF9; }
.harden-item.item-fail { border-left: 4px solid var(--red); }
.harden-item.item-skip { border-left: 4px solid #ccc; opacity: 0.6; }
.harden-item.item-exception { border-left: 4px solid var(--orange); background: #FFFAF5; }
.harden-item.item-fixed { border-left: 4px solid var(--g1); background: #E8F5E9; }
.item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item-id { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--c3); }
.item-name { font-size: 16px; font-weight: 700; }
.item-detail { font-size: 13px; color: var(--c2); margin: 8px 0; }
.item-cmd { background: #f8f8f8; padding: 8px 12px; border-radius: var(--radius-xs); font-family: "JetBrains Mono", monospace; font-size: 12px; margin: 8px 0; word-break: break-all; }
.item-actions { display: flex; gap: 8px; margin-top: 12px; }
.item-result { margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-xs); font-size: 13px; }
.result-ok { background: #E8F5E9; color: #2E7D32; }
.result-err { background: #FFEBEE; color: #C62828; }


/* ===== 16. Check Items ===== */
.check-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid #f0f0f0; }
.check-item:hover { background: #f9f9f9; }
.check-status { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.check-pass { background: #E8F5E9; color: #2E7D32; }
.check-fail { background: #FFEBEE; color: #C62828; }
.check-info { flex: 1; }
.check-id { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--c3); }
.check-name { font-weight: 600; font-size: 14px; }
.check-detail { font-size: 12px; color: var(--c2); margin-top: 2px; }

/* Category Card（TWGCB 類別卡片） */
.cat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 16px; overflow: hidden; }
.cat-header { padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f0f0f0; }
.cat-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.cat-stats { display: flex; gap: 12px; align-items: center; }
.cat-rate { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 16px; }

/* Matrix Category Rows（可摺疊） */
.cat-row { cursor: pointer; }
.cat-row td { background: #f8f8f8 !important; border-bottom: 2px solid #e0e0e0; padding: 10px 12px; }
.cat-row:hover td { background: #f0f5f0 !important; }
.cat-toggle { display: inline-block; width: 20px; font-size: 14px; color: var(--c2); transition: transform 0.2s; }
.cat-toggle.open { transform: rotate(90deg); }
.cat-name { font-weight: 700; font-size: 14px; color: var(--c1); }
.cat-count { font-size: 11px; color: var(--c3); margin-left: 6px; }
.detail-row { display: none; }
.detail-row.show { display: table-row; }
.detail-row td.col-fixed { padding-left: 32px; }
.host-header { font-size: 11px; min-width: 70px; }
.host-header a { color: var(--g2); text-decoration: none; font-weight: 700; }
.host-header a:hover { text-decoration: underline; }


/* ===== 17. Report Styles ===== */
.report-container { background: white; padding: 40px; max-width: 1200px; margin: 0 auto; font-family: "Noto Sans TC", sans-serif; }
.report-header { text-align: center; border-bottom: 3px solid var(--g2); padding-bottom: 20px; margin-bottom: 24px; }
.report-logo { font-size: 32px; font-weight: 900; color: var(--g2); letter-spacing: 4px; }
.report-logo-sub { font-size: 14px; color: #666; margin-top: 4px; letter-spacing: 2px; }
.report-title { font-size: 22px; font-weight: 700; margin-top: 16px; color: var(--c1); }
.report-date { font-size: 13px; color: var(--c3); margin-top: 8px; }
.report-meta { display: flex; justify-content: space-between; margin-bottom: 20px; font-size: 13px; }
.summary-row { display: flex; gap: 24px; margin: 16px 0; flex-wrap: wrap; }
.summary-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.legend { display: flex; gap: 20px; margin: 12px 0; font-size: 12px; color: #666; align-items: center; }
.legend .light { width: 14px; height: 14px; }


/* ===== 18. Filter Bar ===== */
.filter-bar { display: flex; gap: 10px; padding: 14px 20px; background: white; border-radius: 0 0 var(--radius) var(--radius); margin-bottom: 12px; box-shadow: var(--shadow-sm); flex-wrap: wrap; align-items: center; }


/* ===== 19. Git / Admin ===== */
.git-file { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; font-family: "JetBrains Mono", monospace; }
.git-file-status { display: inline-block; width: 20px; height: 20px; border-radius: 4px; text-align: center; line-height: 20px; font-size: 11px; font-weight: 700; color: white; }
.git-added { background: var(--g1); }
.git-modified { background: var(--orange); }
.git-deleted { background: var(--red); }
.git-unknown { background: var(--c3); }
.commit-line { padding: 6px 0; border-bottom: 1px solid #f5f5f5; display: flex; gap: 10px; }
.commit-hash { color: var(--g2); font-weight: 600; min-width: 70px; font-family: "JetBrains Mono", monospace; }
.commit-date { color: var(--c3); font-size: 12px; font-family: "JetBrains Mono", monospace; min-width: 90px; }
.commit-msg { color: var(--c1); flex: 1; }
.commit-note { background: var(--g-light); color: var(--g-text); padding: 2px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; white-space: nowrap; }
.commit-note:hover { background: #d4edda; }
.commit-note-add { color: var(--c4); font-size: 11px; cursor: pointer; white-space: nowrap; }
.commit-note-add:hover { color: var(--g1); }
.log-viewer { background: #1a1a1a; color: #e0e0e0; font-family: "JetBrains Mono", monospace; font-size: 12px; padding: 16px; border-radius: var(--radius-sm); max-height: 400px; overflow-y: auto; line-height: 1.8; }


/* ===== 20. Alerts / Notifications ===== */
@keyframes uid0-flash {
  0%, 100% { background: #FFEBEE; box-shadow: none; }
  50% { background: var(--red); color: var(--white); box-shadow: 0 0 24px rgba(224,11,0,0.2); }
}
.uid0-alert {
  animation: uid0-flash 1.2s ease-in-out infinite;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  text-align: center;
  font-size: 15px;
}
.remediation { background: #FFF8E1; border-left: 4px solid var(--orange); padding: 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-top: 8px; font-family: "JetBrains Mono", monospace; font-size: 13px; word-break: break-all; }
.cmd-text { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--c2); background: #f8f8f8; padding: 4px 8px; border-radius: 4px; display: inline-block; max-width: 400px; word-break: break-all; }
.fix-result { margin-top: 4px; font-size: 11px; padding: 4px 8px; border-radius: 4px; }
.fix-ok { background: #E8F5E9; color: #2E7D32; }
.fix-err { background: #FFEBEE; color: #C62828; }
.exception-tag { display: inline-block; background: #FFF3E0; color: #E65100; padding: 1px 6px; border-radius: 4px; font-size: 11px; margin: 1px; }


/* ===== 21. Loading ===== */
.skeleton {
  background: linear-gradient(90deg, #EFEEEA 25%, var(--bg) 50%, #EFEEEA 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
  min-height: 40px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner { width: 20px; height: 20px; border: 3px solid #ddd; border-top: 3px solid var(--g1); border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner-sm { width: 16px; height: 16px; border: 3px solid #ddd; border-top: 3px solid var(--g1); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ===== 22. Utility Classes ===== */
.no-data { text-align: center; padding: 56px 24px; color: var(--c3); background: var(--bg); border-radius: var(--radius); font-size: 15px; }
.no-data-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.15; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-muted-sm { font-size: 12px; color: var(--c3); }
.metric-value { font-family: "JetBrains Mono", monospace; font-size: 28px; font-weight: 500; }
.metric-label { font-size: 11px; color: var(--c3); text-transform: uppercase; letter-spacing: 0.5px; }
.code-inline { font-family: "JetBrains Mono", monospace; font-size: 12px; background: #f8f8f8; padding: 2px 6px; border-radius: 4px; }
.back-link { color: var(--g2); text-decoration: none; font-size: 14px; }
.back-link:hover { text-decoration: underline; }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }


/* ===== 23. Charts ===== */
.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 28px; }
.chart-container { position: relative; min-height: 140px; max-height: 200px; }


/* ===== 24. Host Grid ===== */
.host-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }


/* ===== 25. Filter Rules ===== */
.rule-card { display: flex; justify-content: space-between; align-items: center; padding: 16px; }


/* ===== 26. Scrollbar ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--c3); }


/* ===== 27. Selection ===== */
::selection { background: rgba(38,168,137,0.15); }


/* ===== 28. Admin Nav ===== */
.admin-nav-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--c1);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--g1);
  display: inline-block;
}
.admin-tab {
  font-size: 14px;
}

/* ===== 29. Print Styles ===== */
@media print {
  .no-print, .navbar, nav, header { display: none !important; }
  body { background: white; margin: 0; }
  .report-container { box-shadow: none; padding: 20px; }
  .matrix-table { font-size: 10px; }
  .matrix-table th, .matrix-table td { padding: 4px 2px; }
  .light { width: 14px; height: 14px; }
  @page { size: landscape; margin: 10mm; }
}


/* ===== 29. Hamburger Button ===== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
  z-index: 110;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--c1);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ===== 30. Responsive — Tablet (768px) ===== */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .navbar { padding: 0 16px; flex-wrap: wrap; position: relative; }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(0,0,0,0.06);
    padding: 8px 0;
    order: 10;
  }
  .nav-links.nav-open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
  }
  .nav-links a.active { border-bottom-color: var(--g1); }
  #app-version { display: none; }
  .container { padding: 16px; }
  .chart-grid { grid-template-columns: 1fr; }
  .kpi-grid, .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .host-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-2col { grid-template-columns: 1fr; }
  .admin-kpi { grid-template-columns: repeat(2, 1fr) !important; }
  .os-tabs { flex-wrap: wrap; }
  .os-tab { flex: 1; min-width: 0; font-size: 13px; padding: 10px 8px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .input-field { min-width: 0 !important; }
  .card { padding: 16px; }
  h2 { font-size: 18px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }
  .matrix-table { font-size: 11px; }
  .matrix-table th, .matrix-table td { padding: 6px 4px; }
  .modal { width: 95%; padding: 20px; max-height: 90vh; }
}

/* ===== 31. Responsive — Phone (480px) ===== */
@media (max-width: 480px) {
  .container { padding: 12px; }
  .navbar-brand { font-size: 14px; }
  .navbar-brand img { height: 24px !important; }
  .kpi-grid, .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .admin-kpi { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .card { padding: 12px; border-radius: 12px; }
  .os-tab { font-size: 12px; padding: 8px 6px; }
  .os-tab-count { font-size: 10px; padding: 1px 5px; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .btn-sm { padding: 4px 8px; font-size: 11px; }
  h2 { font-size: 16px; }
  .badge { font-size: 11px; padding: 3px 8px; }
  table { font-size: 12px; min-width: 400px; }
  .toggle-label { font-size: 12px; }
  .filter-bar { gap: 8px; }
}


/* ========== 自訂 tooltip (品牌綠色, hover 約 1s 出現) ========== */
.ct-tip {
    position: relative;
    display: inline-block;
}
.ct-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--g2, #00736b);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 115, 107, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transition-delay: 0s;
    z-index: 1000;
}
.ct-tip::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 6px solid transparent;
    border-top-color: var(--g2, #00736b);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transition-delay: 0s;
    z-index: 1000;
}
.ct-tip:hover::after,
.ct-tip:hover::before,
.ct-tip:focus-within::after,
.ct-tip:focus-within::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0.8s;
}
