/*
 * Admin Panel Design System
 * 完全取代 AdminLTE 2.x + Bootstrap 3.3.5
 * 不依賴任何外部框架，使用純 CSS 自製元件
 *
 * 目錄
 *  1.  CSS 變數（色彩、間距、版型）— 政府信任藍 #0066cc
 *  2.  Reset & Base
 *  3.  主框架佈局
 *  4.  頂部標題列（Header）— 藍底白字 + 全域搜尋框
 *  5.  左側選單（Sidebar）— 白底主題 + 左邊藍色邊線
 *  6.  主要內容區
 *  7.  頁尾
 *  8.  Box / Card 元件
 *  9.  Info Box 統計卡片
 * 10.  網格系統（Bootstrap 3 相容）
 * 11.  按鈕（含載入狀態）
 * 12.  表單
 * 13.  資料表格（含行選取狀態）
 * 14.  提示框（Alert）
 * 15.  徽章 & 標籤（淺底深字語意化）
 * 16.  進度條
 * 17.  Bootstrap Modal（供 bootbox 使用）
 * 18.  Dropdown（供使用者選單、datetimepicker）
 * 19.  Bootstrap Tabs
 * 20.  DataTables 樣式
 * 21.  Datetimepicker Widget
 * 22.  實用工具類別
 * 23.  分頁（Pagination）
 * 24.  登入頁面
 * 25.  空狀態（Empty State）
 * 26.  骨架屏（Skeleton Loading）
 * 27.  按鈕載入狀態
 * 28.  Inline Confirm（刪除二次確認）
 * 29.  Help Tip（欄位說明 tooltip）
 * 30.  搜尋面板增強
 * 31.  必填欄位星號
 * 32.  成功頁面
 * 33.  SimpleTable 分頁增強
 * 34.  列印樣式（@media print）
 * 35.  響應式設計
 */

/* ======================================================
   1. CSS 變數
   ====================================================== */
:root {
  /* 品牌色（政府信任藍） */
  --primary:        #0066cc;
  --primary-dark:   #004499;
  --primary-light:  #e6f0ff;

  /* 語意色 */
  --success:        #28a745;
  --success-light:  #d4edda;
  --warning:        #ffc107;
  --warning-light:  #fff3cd;
  --danger:         #dc3545;
  --danger-light:   #f8d7da;
  --info:           #17a2b8;
  --info-light:     #d1ecf1;
  --purple:         #8b5cf6;
  --purple-light:   #ede9fe;
  --aqua:           #06b6d4;

  /* 模組強調色（KPI 卡片區分） */
  --module-blue:    #0066cc;
  --module-green:   #22c55e;
  --module-amber:   #f59e0b;
  --module-purple:  #8b5cf6;
  --module-pink:    #ec4899;

  /* 側邊欄（白底主題） */
  --sidebar-w:      250px;
  --sidebar-bg:     #ffffff;
  --sidebar-text:   #212529;
  --sidebar-hover:  #f8f9fa;
  --sidebar-active: #0066cc;
  --sidebar-border: #dee2e6;

  /* 標題列（藍底白字） */
  --header-h:       56px;
  --header-bg:      #0066cc;
  --header-shadow:  0 2px 4px rgba(0,0,0,.1);

  /* 內容區 */
  --content-bg:     #f8f9fa;
  --card-bg:        #ffffff;
  --card-border:    #dee2e6;
  --card-radius:    8px;
  --card-shadow:    0 2px 4px rgba(0,0,0,.1);

  /* 文字 */
  --text:           #212529;
  --text-muted:     #6c757d;
  --text-light:     #adb5bd;

  /* 邊框 & 圓角 */
  --border:         #dee2e6;
  --radius:         6px;
  --radius-sm:      4px;
  --radius-lg:      10px;
}

/* ======================================================
   2. Reset & Base
   ====================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: "Microsoft JhengHei", "微軟正黑體", "Noto Sans TC",
               -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--content-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
button { font-family: inherit; }
h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.3; color: var(--text); }

/* hold-transition：頁面載入時暫時關閉所有動畫，防止閃爍 */
.hold-transition * { transition: none !important; }

/* ======================================================
   3. 主框架佈局
   ====================================================== */
.wrapper { min-height: 100vh; overflow-x: hidden; }

/* ======================================================
   4. 頂部標題列（Header）
   ====================================================== */
.main-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--header-bg);
  box-shadow: var(--header-shadow);
  z-index: 800;
  display: flex;
  align-items: stretch;
}

/* ─ Logo 區塊 ─ */
.main-header .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--primary-dark);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .05em;
  text-decoration: none;
  transition: background .2s;
  user-select: none;
  gap: 8px;
}
.main-header .logo:hover { background: #003377; text-decoration: none; color: #fff; }
.main-header .logo .logo-mini { display: none; }
.main-header .logo .logo-lg  { display: inline; }

/* ─ Navbar ─ */
.main-header .navbar,
.main-header .navbar-static-top {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  background: var(--header-bg);
}

/* ─ 全域搜尋框（Header 內嵌） ─ */
.global-search {
  flex: 1;
  max-width: 400px;
  margin: 0 24px;
}
.global-search input {
  width: 100%;
  height: 36px;
  border: none;
  border-radius: 4px;
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  background: rgba(255,255,255,0.2);
  color: #fff;
  transition: background .2s, color .2s;
}
.global-search input::placeholder { color: rgba(255,255,255,0.7); }
.global-search input:focus {
  background: rgba(255,255,255,0.95);
  color: var(--text);
  outline: none;
}
.global-search input:focus::placeholder { color: var(--text-light); }

/* ─ 漢堡選單按鈕 ─ */
.sidebar-toggle {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 9px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.8);
  transition: color .15s, background .15s;
  text-decoration: none;
}
.sidebar-toggle:hover {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  text-decoration: none;
}
.sidebar-toggle .icon-bar {
  display: block;
  width: 20px; height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.sidebar-toggle .sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ─ 右側使用者選單 ─ */
.navbar-custom-menu { margin-left: auto; }
.navbar-custom-menu .nav,
.navbar-custom-menu .navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Dropdown 容器 */
.dropdown { position: relative; }

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  font-size: 13px;
  background: none;
  border: none;
  transition: color .15s, background .15s;
  text-decoration: none;
  white-space: nowrap;
}
.dropdown-toggle:hover { color: #ffffff; background: rgba(255,255,255,0.15); text-decoration: none; }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: 0 10px 32px rgba(0,0,0,.12);
  min-width: 200px;
  z-index: 1050;
  padding: 6px 0;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu > li > a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 13px;
  transition: background .1s;
  text-decoration: none;
}
.dropdown-menu > li > a:hover { background: var(--content-bg); text-decoration: none; }
.dropdown-menu > .divider { height: 1px; background: var(--border); margin: 5px 0; }
.user-footer { padding: 8px 12px; }

/* ======================================================
   5. 左側選單（Sidebar）
   ====================================================== */
.main-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: 700;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1);
  scrollbar-width: thin;
  scrollbar-color: #dee2e6 transparent;
}
.main-sidebar::-webkit-scrollbar { width: 3px; }
.main-sidebar::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 2px; }

.main-sidebar section.sidebar { display: block; }

/* ─ 選單列表 ─ */
.sidebar-menu { padding: 12px 0 40px; }

.sidebar-menu > li > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 10px 28px;
  color: var(--sidebar-text);
  font-size: 13px;
  transition: color .15s, background .15s;
  text-decoration: none;
  position: relative;
  border-left: 3px solid transparent;
}
.sidebar-menu > li > a:hover {
  color: var(--text);
  background: var(--sidebar-hover);
  text-decoration: none;
}
.sidebar-menu > li.active > a,
.sidebar-menu > li > a.active {
  color: var(--primary-dark);
  background: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 500;
}
.sidebar-menu > li > a i {
  width: 16px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.sidebar-menu > li.active > a i,
.sidebar-menu > li > a.active i {
  color: var(--primary);
}
.sidebar-menu > li > a .pull-right {
  margin-left: auto;
  font-size: 11px;
  transition: transform .2s;
  color: var(--text-light);
}
.sidebar-menu > li.menu-open > a .pull-right { transform: rotate(-90deg); }

/* Section Header */
.sidebar-menu > li.header {
  padding: 16px 20px 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-light);
  cursor: default;
  pointer-events: none;
}

/* Treeview（管考系統子選單） */
.sidebar-menu > li.treeview { cursor: pointer; }
.sidebar-menu .collapse2 { display: none; }
.sidebar-menu .collapse2 > a {
  padding-left: 48px;
  font-size: 13px;
}

/* 選單區塊分隔 */
.sidebar-menu > li + li.header {
  margin-top: 8px;
  border-top: 1px solid var(--sidebar-border);
}

/* ======================================================
   6. 主要內容區
   ====================================================== */
.content-wrapper {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h) - 48px);
  padding-bottom: 24px;
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}

/* ─ 頁面標題列 ─ */
.content-header {
  padding: 18px 22px 8px;
}
.content-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.content-header h1 small {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ─ 麵包屑 ─ */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px 22px 0;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border-radius: 0;
  margin-bottom: 0;
}
.breadcrumb > li + li::before {
  content: '›';
  color: var(--text-light);
  margin-right: 2px;
}
.breadcrumb > li.active { color: var(--text-muted); }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }

/* ─ 內容區主體 ─ */
.content { padding: 14px 22px 20px; }

/* ─ 右側控制面板（不使用，隱藏） ─ */
.control-sidebar,
.control-sidebar-bg { display: none !important; }

/* ─ Sidebar 收合狀態 ─ */
body.sidebar-collapse .main-sidebar  { transform: translateX(-100%); }
body.sidebar-collapse .content-wrapper { margin-left: 0; }
body.sidebar-collapse .main-footer   { margin-left: 0; }
body.sidebar-collapse .main-header .logo { width: 56px; }
body.sidebar-collapse .main-header .logo .logo-lg   { display: none; }
body.sidebar-collapse .main-header .logo .logo-mini { display: inline; }

/* ======================================================
   7. 頁尾
   ====================================================== */
.main-footer {
  margin-left: var(--sidebar-w);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 12px 22px;
  font-size: 12px;
  color: var(--text-muted);
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}
.main-footer a { color: var(--primary); }

/* ======================================================
   8. Box / Card 元件
   ====================================================== */
.box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
  position: relative;
}

.box-header {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  min-height: 46px;
  border-bottom: 1px solid var(--card-border);
}
.box-header.with-border { border-bottom: 1px solid var(--card-border); }
.box-header.no-border   { border-bottom: none; }

.box-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
}

.box-tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.btn-box-tool {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: color .15s, background .15s;
}
.btn-box-tool:hover { color: var(--text); background: var(--content-bg); }

.box-body { padding: 18px 16px; }
.box-body.no-padding { padding: 0; }
.no-padding.box-body  { padding: 0; }

.box-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--card-border);
  background: #fafbfd;
  border-radius: 0 0 var(--card-radius) var(--card-radius);
}

/* Box 色彩變體（頂部 3px 彩色線條） */
.box-primary { border-top: 3px solid var(--primary); }
.box-success { border-top: 3px solid var(--success); }
.box-warning { border-top: 3px solid var(--warning); }
.box-danger  { border-top: 3px solid var(--danger);  }
.box-info    { border-top: 3px solid var(--info);    }
.box-default { border-top: 3px solid #dee2e6;        }

/* 可折疊 box */
.box.collapsed-box .box-body,
.box.collapsed-box .box-footer { display: none; }

/* ======================================================
   9. Info Box（統計卡片）
   ====================================================== */
.info-box {
  display: flex;
  align-items: stretch;
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
  min-height: 80px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}
.info-box-icon {
  width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: rgba(255,255,255,.95);
  flex-shrink: 0;
}
.info-box-content {
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.info-box-text {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.info-box-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

/* Info Box 背景色 */
.bg-aqua   { background: var(--aqua);    }
.bg-blue   { background: var(--primary); }
.bg-green  { background: var(--success); }
.bg-yellow { background: var(--warning); }
.bg-red    { background: var(--danger);  }
.bg-purple { background: var(--purple);  }
.bg-navy   { background: #1e3a8a;        }
.bg-teal   { background: #0d9488;        }
.bg-olive  { background: #65a30d;        }
.bg-maroon { background: #9f1239;        }
.bg-orange { background: #ea580c;        }
.bg-gray   { background: #64748b;        }
.bg-black  { background: #1e293b;        }

/* ======================================================
   10. 網格系統（Bootstrap 3 相容，12 欄）
   ====================================================== */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -10px;
  margin-right: -10px;
}
.row::after { content: ''; display: table; clear: both; }

[class*="col-"] {
  padding-left: 10px;
  padding-right: 10px;
  min-height: 1px;
  float: left;
}

/* col-xs-* (全尺寸) */
.col-xs-1  { width: 8.3333%;  }
.col-xs-2  { width: 16.6667%; }
.col-xs-3  { width: 25%;      }
.col-xs-4  { width: 33.3333%; }
.col-xs-5  { width: 41.6667%; }
.col-xs-6  { width: 50%;      }
.col-xs-7  { width: 58.3333%; }
.col-xs-8  { width: 66.6667%; }
.col-xs-9  { width: 75%;      }
.col-xs-10 { width: 83.3333%; }
.col-xs-11 { width: 91.6667%; }
.col-xs-12 { width: 100%;     }

/* col-sm-* (@768px) */
@media (min-width: 768px) {
  .col-sm-1  { width: 8.3333%;  }
  .col-sm-2  { width: 16.6667%; }
  .col-sm-3  { width: 25%;      }
  .col-sm-4  { width: 33.3333%; }
  .col-sm-5  { width: 41.6667%; }
  .col-sm-6  { width: 50%;      }
  .col-sm-7  { width: 58.3333%; }
  .col-sm-8  { width: 66.6667%; }
  .col-sm-9  { width: 75%;      }
  .col-sm-10 { width: 83.3333%; }
  .col-sm-11 { width: 91.6667%; }
  .col-sm-12 { width: 100%;     }
  .col-sm-offset-1  { margin-left: 8.3333%;  }
  .col-sm-offset-2  { margin-left: 16.6667%; }
  .col-sm-offset-3  { margin-left: 25%;      }
}

/* col-md-* (@992px) */
@media (min-width: 992px) {
  .col-md-1  { width: 8.3333%;  }
  .col-md-2  { width: 16.6667%; }
  .col-md-3  { width: 25%;      }
  .col-md-4  { width: 33.3333%; }
  .col-md-5  { width: 41.6667%; }
  .col-md-6  { width: 50%;      }
  .col-md-7  { width: 58.3333%; }
  .col-md-8  { width: 66.6667%; }
  .col-md-9  { width: 75%;      }
  .col-md-10 { width: 83.3333%; }
  .col-md-11 { width: 91.6667%; }
  .col-md-12 { width: 100%;     }
  .col-md-offset-1  { margin-left: 8.3333%;  }
  .col-md-offset-2  { margin-left: 16.6667%; }
  .col-md-offset-3  { margin-left: 25%;      }
  .col-md-offset-4  { margin-left: 33.3333%; }
}

/* col-lg-* (@1200px) */
@media (min-width: 1200px) {
  .col-lg-1  { width: 8.3333%;  }
  .col-lg-2  { width: 16.6667%; }
  .col-lg-3  { width: 25%;      }
  .col-lg-4  { width: 33.3333%; }
  .col-lg-5  { width: 41.6667%; }
  .col-lg-6  { width: 50%;      }
  .col-lg-7  { width: 58.3333%; }
  .col-lg-8  { width: 66.6667%; }
  .col-lg-9  { width: 75%;      }
  .col-lg-10 { width: 83.3333%; }
  .col-lg-11 { width: 91.6667%; }
  .col-lg-12 { width: 100%;     }
}

/* ======================================================
   11. 按鈕
   ====================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 15px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s;
  text-decoration: none;
  line-height: 1.45;
  white-space: nowrap;
  vertical-align: middle;
  background: none;
  font-family: inherit;
  user-select: none;
}
.btn:hover   { text-decoration: none; }
.btn:focus   { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.btn:active  { transform: scale(0.97); }

.btn-primary  { background: var(--primary);  color: #fff; border-color: var(--primary);  }
.btn-primary:hover  { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-default,
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-default:hover,
.btn-secondary:hover { background: #f8f9fa; border-color: #dee2e6; color: var(--text); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; border-color: #15803d; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #b45309; border-color: #b45309; color: #fff; }

.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger);  }
.btn-danger:hover  { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.btn-info    { background: var(--info);    color: #fff; border-color: var(--info);    }
.btn-info:hover    { background: #0369a1; border-color: #0369a1; color: #fff; }

.btn-flat    { border-radius: 0; }
.btn-xs      { padding: 3px 8px;  font-size: 11.5px; }
.btn-sm      { padding: 4px 11px; font-size: 12.5px; }
.btn-lg      { padding: 9px 22px; font-size: 15px;   }
.btn-block   { display: flex; width: 100%; justify-content: center; }

.btn[disabled], .btn.disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ======================================================
   12. 表單
   ====================================================== */
.form-group { margin-bottom: 16px; }
.form-group label,
.form-group .control-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
}
.form-horizontal .control-label {
  text-align: right;
  padding-top: 7px;
}

.form-control {
  display: block;
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.45;
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}
.form-control[disabled],
.form-control[readonly] {
  background: #f8f9fa;
  color: var(--text-muted);
  cursor: not-allowed;
}
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }

.input-group { display: flex; align-items: stretch; }
.input-group .form-control { flex: 1; border-radius: 0; min-width: 0; }
.input-group-addon {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: #f8f9fa;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}
.input-group > .form-control:first-child  { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > .form-control:last-child   { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group-addon:first-child { border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group-addon:last-child  { border-left:  0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

.form-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.form-inline .form-group { margin-bottom: 0; }
.form-inline .form-control { width: auto; }

.help-block {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.has-error  .form-control { border-color: var(--danger);  }
.has-error  .control-label, .has-error  .help-block { color: var(--danger);  }
.has-success .form-control { border-color: var(--success); }
.has-success .control-label, .has-success .help-block { color: var(--success); }
.has-warning .form-control { border-color: var(--warning); }
.has-warning .control-label, .has-warning .help-block { color: var(--warning); }

.checkbox, .radio { margin: 4px 0; }
.checkbox label, .radio label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 400;
  font-size: 13px;
  color: var(--text);
}

/* ======================================================
   13. 資料表格
   ====================================================== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 0;
}
.table th,
.table td {
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.table th {
  font-weight: 700;
  color: var(--text);
  background: #f8f9fa;
  font-size: 12px;
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.table-striped tbody tr:nth-child(even) { background: #f8f9fa; }
.table-hover tbody tr:hover            { background: #e6f0ff; transition: background .15s; }
/* 行選取狀態 */
.table tbody tr.st-selected {
  border-left: 3px solid var(--primary);
  background: var(--primary-light);
}
.table-bordered { border: 1px solid var(--border); }
.table-bordered th,
.table-bordered td { border: 1px solid var(--border); }
.table-condensed th,
.table-condensed td { padding: 5px 10px; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ======================================================
   14. 提示框（Alert）
   ====================================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
  line-height: 1.5;
}
.alert-success { background: var(--success-light); border-color: #bbf7d0; color: #15803d; }
.alert-warning { background: var(--warning-light); border-color: #fde68a; color: #92400e; }
.alert-danger,
.alert-error   { background: var(--danger-light);  border-color: #fecaca; color: #991b1b; }
.alert-info    { background: var(--info-light);    border-color: #bae6fd; color: #075985; }
.alert .close  {
  float: right;
  cursor: pointer;
  background: none;
  border: none;
  color: currentColor;
  font-size: 17px;
  line-height: 1;
  opacity: .6;
  margin-left: 8px;
}
.alert .close:hover { opacity: 1; }

/* ======================================================
   15. 徽章 & 標籤
   ====================================================== */
.badge,
.label {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

/* 語意化徽章 — 淺底深字 */
.badge              { background: #e2e3e5; color: #383d41; }
.label-default      { background: #e2e3e5; color: #383d41; }
.label-primary      { background: var(--primary-light); color: var(--primary-dark); }
.label-success      { background: var(--success-light); color: #155724; }
.label-warning      { background: var(--warning-light); color: #856404; }
.label-danger       { background: var(--danger-light);  color: #721c24; }
.label-info         { background: var(--info-light);    color: #0c5460; }
.label-purple       { background: var(--purple-light);  color: #5b21b6; }
.badge-primary      { background: var(--primary-light); color: var(--primary-dark); }
.badge-success      { background: var(--success-light); color: #155724; }
.badge-warning      { background: var(--warning-light); color: #856404; }
.badge-danger       { background: var(--danger-light);  color: #721c24; }
.badge-info         { background: var(--info-light);    color: #0c5460; }
.badge-grey         { background: #e2e3e5;              color: #383d41; }

/* 語意化徽章（政府系統常用狀態） */
.badge-pending      { background: #fff3cd; color: #856404; }  /* 待簽核 */
.badge-approved     { background: #d4edda; color: #155724; }  /* 已核准 */
.badge-rejected     { background: #f8d7da; color: #721c24; }  /* 已退回 */
.badge-processing   { background: #d1ecf1; color: #0c5460; }  /* 進行中 */
.badge-draft        { background: #e2e3e5; color: #383d41; }  /* 草稿 */

/* ======================================================
   16. 進度條
   ====================================================== */
.progress {
  background: #e2e8f0;
  border-radius: 99px;
  height: 16px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width .35s ease;
  min-width: 2em;
  border-radius: 99px;
}
.progress-bar-success { background: var(--success); }
.progress-bar-warning { background: var(--warning); }
.progress-bar-danger  { background: var(--danger);  }
.progress-bar-info    { background: var(--info);    }

@keyframes progress-stripes {
  from { background-position: 32px 0; }
  to   { background-position: 0 0; }
}
.progress-bar-striped {
  background-image: linear-gradient(
    45deg,
    rgba(255,255,255,.15) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,.15) 50%,
    rgba(255,255,255,.15) 75%, transparent 75%, transparent
  );
  background-size: 32px 32px;
}
.progress-bar-striped.active { animation: progress-stripes .5s linear infinite; }

/* ======================================================
   17. Bootstrap Modal（供 bootbox 使用）
   ====================================================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1050;
  overflow-y: auto;
  background: rgba(15, 23, 42, .5);
  padding: 20px;
}
.modal.in,
.modal.show { display: flex; align-items: flex-start; justify-content: center; }

.modal-dialog {
  margin: 40px auto;
  width: 100%;
  max-width: 560px;
  position: relative;
}
.modal-sm .modal-dialog { max-width: 360px; }
.modal-lg .modal-dialog { max-width: 820px; }

.modal-content {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: 0 25px 60px rgba(0,0,0,.25);
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); flex: 1; }
.modal-header .close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--text-muted); line-height: 1;
  padding: 0; transition: color .15s;
}
.modal-header .close:hover { color: var(--text); }
.modal-body { padding: 20px; font-size: 13.5px; color: var(--text); line-height: 1.6; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #fafbfd;
}

/* backdrop（modal 自帶半透明背景，此元素隱藏） */
.modal-backdrop { display: none; }

/* fade 動畫 */
.fade { opacity: 0; transition: opacity .15s linear; }
.fade.in { opacity: 1; }

/* ======================================================
   18. Dropdown（Bootstrap 相容）
   ====================================================== */
.open > .dropdown-menu { display: block; }
.caret {
  display: inline-block;
  width: 0; height: 0;
  border-top: 4px solid currentColor;
  border-right: 4px solid transparent;
  border-left:  4px solid transparent;
  vertical-align: middle;
  margin-left: 4px;
}

/* ======================================================
   19. Bootstrap Tabs & Nav
   ====================================================== */
.nav { display: flex; list-style: none; flex-wrap: wrap; }
.nav-tabs {
  border-bottom: 2px solid var(--border);
  gap: 2px;
  margin-bottom: 16px;
}
.nav-tabs > li > a {
  display: block;
  padding: 8px 16px;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, background .15s;
  text-decoration: none;
}
.nav-tabs > li > a:hover { color: var(--primary); background: var(--content-bg); }
.nav-tabs > li.active > a {
  color: var(--primary);
  background: #fff;
  border-color: var(--border) var(--border) #fff;
  font-weight: 700;
}
.tab-content > .tab-pane { display: none; }
.tab-content > .tab-pane.active { display: block; }
/* 非 tab-pane 的直接子元素保持可見（相容 AdminLTE 用法） */
.tab-content > :not(.tab-pane) { display: block; }

/* ── 帶邊框的 Tab 容器 ── */
.nav-tabs-custom {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
}
.nav-tabs-custom > .nav-tabs {
  border-radius: var(--card-radius) var(--card-radius) 0 0;
  padding: 0 16px;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.nav-tabs-custom > .tab-content { padding: 16px; }

/* ── nav-justified ── */
.nav-justified { justify-content: space-between; }
.nav-justified > li { flex: 1; text-align: center; }

/* ======================================================
   20. DataTables
   ====================================================== */
.dataTables_wrapper { font-size: 13px; }

.dataTables_length,
.dataTables_filter {
  margin-bottom: 12px;
  color: var(--text);
}
.dataTables_length label,
.dataTables_filter label { color: var(--text); font-size: 13px; }

.dataTables_filter input {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-left: 6px;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.dataTables_filter input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}
.dataTables_length select {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0 4px;
  font-size: 13px;
}
.dataTables_info {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
}

/* ─ DataTables 分頁（Bootstrap 整合版，生成 .pagination） ─ */
.dataTables_paginate { display: flex; justify-content: flex-end; margin-top: 8px; }
.dataTables_paginate .pagination {
  display: flex;
  gap: 2px;
  list-style: none;
  flex-wrap: wrap;
}
.dataTables_paginate .pagination > li > a,
.dataTables_paginate .pagination > li > span {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  display: block;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.dataTables_paginate .pagination > li > a:hover { background: var(--content-bg); color: var(--primary); }
.dataTables_paginate .pagination > li.active > a,
.dataTables_paginate .pagination > li.active > span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.dataTables_paginate .pagination > li.disabled > a {
  color: var(--text-light);
  cursor: not-allowed;
  background: #f8f9fa;
}

/* ─ 排序指示器 ─ */
.sorting, .sorting_asc, .sorting_desc { cursor: pointer; position: relative; padding-right: 22px !important; }
.sorting::after, .sorting_asc::after, .sorting_desc::after {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--text-light);
}
.sorting::after     { content: '⇅'; }
.sorting_asc::after { content: '↑'; color: var(--primary); }
.sorting_desc::after { content: '↓'; color: var(--primary); }

/* ======================================================
   21. Bootstrap Datetimepicker Widget
   ====================================================== */
.bootstrap-datetimepicker-widget {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: 0 10px 32px rgba(0,0,0,.12);
  padding: 8px;
  z-index: 1060;
  position: absolute;
  font-size: 13px;
}
.bootstrap-datetimepicker-widget table th,
.bootstrap-datetimepicker-widget table td {
  padding: 5px 7px;
  text-align: center;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.bootstrap-datetimepicker-widget table td:hover { background: var(--primary-light); color: var(--primary); }
.bootstrap-datetimepicker-widget table td.active { background: var(--primary); color: #fff; }
.bootstrap-datetimepicker-widget .prev,
.bootstrap-datetimepicker-widget .next { cursor: pointer; color: var(--primary); }
.bootstrap-datetimepicker-widget .picker-switch { font-weight: 700; }

/* ======================================================
   22. 實用工具類別
   ====================================================== */
.pull-right { float: right; }
.pull-left  { float: left;  }
.clearfix::after { content: ''; display: table; clear: both; }

.text-left   { text-align: left;   }
.text-center { text-align: center; }
.text-right  { text-align: right;  }

.text-muted   { color: var(--text-muted);  }
.text-default { color: var(--text);        }
.text-primary { color: var(--primary);     }
.text-success { color: var(--success);     }
.text-warning { color: var(--warning);     }
.text-danger  { color: var(--danger);      }
.text-info    { color: var(--info);        }

.no-margin  { margin:  0 !important; }
.no-padding { padding: 0 !important; }
.margin-b-0 { margin-bottom: 0 !important; }

.hidden, .hide { display: none !important; }
.show   { display: block  !important; }
.invisible { visibility: hidden; }

.fw-bold   { font-weight: 700; }
.fw-normal { font-weight: 400; }
.fs-sm     { font-size: 12px;  }

.d-flex          { display: flex; }
.align-items-center { align-items: center; }
.justify-content-end { justify-content: flex-end; }

/* 選取捲軸美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::selection { background: var(--primary-light); color: var(--primary-dark); }

/* ── sr-only（無障礙） ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── BlockUI overlay ── */
.blockUI.blockOverlay { background: rgba(255,255,255,.7) !important; }
.blockUI.blockMsg { border-radius: var(--card-radius) !important; border: 1px solid var(--border) !important; }

/* ── Select2 微調 ── */
.select2-container .select2-selection--single { height: 32px; line-height: 30px; }
.select2-container--default .select2-selection--single { border-color: var(--border); border-radius: var(--radius-sm); }
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.select2-dropdown { border-color: var(--border); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.1); }

/* ── Bootstrap Switch 微調 ── */
.bootstrap-switch { border-radius: var(--radius); border-color: var(--border); }

/* ── Toastr 微調 ── */
#toast-container > .toast { border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.14); }
#toast-container > .toast-success { background-color: var(--success); }
#toast-container > .toast-error   { background-color: var(--danger);  }
#toast-container > .toast-warning { background-color: var(--warning); }
#toast-container > .toast-info    { background-color: var(--info);    }

/* ── Box loading overlay ── */
.overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  border-radius: var(--card-radius);
}
.overlay .fa-refresh { font-size: 22px; color: var(--primary); animation: fa-spin 1s linear infinite; }

/* ======================================================
   23. 分頁（獨立 Pagination 元件）
   ====================================================== */
.pagination {
  display: flex;
  gap: 2px;
  list-style: none;
  flex-wrap: wrap;
  padding: 0;
}
.pagination > li > a,
.pagination > li > span {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  display: block;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.pagination > li > a:hover { background: var(--content-bg); color: var(--primary); }
.pagination > li.active > a,
.pagination > li.active > span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination > li.disabled > a  { color: var(--text-light); cursor: not-allowed; background: #f8f9fa; }

/* ======================================================
   24. 登入頁面
   ====================================================== */
body.login-page {
  background: linear-gradient(135deg, #003366 0%, #004499 50%, #0066cc 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  width: 400px;
  max-width: calc(100vw - 32px);
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  overflow: hidden;
}
.login-logo {
  text-align: center;
  padding: 32px 24px 24px;
  background: var(--primary);
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .04em;
}
.login-box-body { padding: 28px 28px 24px; }
.login-box-msg {
  text-align: center;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-muted);
}
/* 登入頁面輸入框圖示 */
.login-box .has-feedback { position: relative; }
.login-box .form-control-feedback {
  position: absolute;
  top: 50%; right: 12px;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}
.login-box .form-control { padding-right: 38px; }

/* ======================================================
   25. 空狀態（Empty State）
   ====================================================== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}
.empty-state .empty-text {
  font-size: 15px;
  margin-bottom: 4px;
  color: var(--text-muted);
}
.empty-state .empty-hint {
  font-size: 13px;
  color: var(--text-light);
}

/* ======================================================
   26. 骨架屏（Skeleton Loading）
   ====================================================== */
.skeleton {
  background: linear-gradient(90deg, #e9ecef 25%, #f8f9fa 50%, #e9ecef 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-row {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #e9ecef;
}
.skeleton-cell {
  height: 16px;
  border-radius: 4px;
  flex: 1;
}

/* ======================================================
   27. 按鈕載入狀態
   ====================================================== */
.btn-loading {
  pointer-events: none;
  opacity: 0.7;
}
.btn-loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #FFF;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ======================================================
   28. Inline Confirm（刪除二次確認）
   ====================================================== */
.inline-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: fadeInConfirm 0.15s ease;
}
.inline-confirm .confirm-text {
  font-size: 13px;
  color: var(--danger);
  font-weight: 500;
}
.inline-confirm .btn-confirm-yes {
  padding: 3px 10px;
  font-size: 12px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.inline-confirm .btn-confirm-yes:hover { background: #c82333; }
.inline-confirm .btn-confirm-no {
  padding: 3px 10px;
  font-size: 12px;
  background: #fff;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.inline-confirm .btn-confirm-no:hover { background: #f8f9fa; }
@keyframes fadeInConfirm {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ======================================================
   29. Help Tip（欄位說明 tooltip）
   ====================================================== */
.help-tip {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e9ecef;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  line-height: 16px;
  cursor: help;
  margin-left: 4px;
  position: relative;
}
.help-tip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #212529;
  color: #FFF;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  margin-bottom: 6px;
  z-index: 100;
}

/* ======================================================
   30. 搜尋面板增強
   ====================================================== */
.search-panel {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.search-input-main {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  margin-bottom: 12px;
}
.search-input-main:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,102,204,0.15);
}
/* 搜尋結果 highlight */
mark, .st-highlight {
  background: #fff3cd;
  color: inherit;
  padding: 1px 2px;
  border-radius: 2px;
}

/* ======================================================
   31. 必填欄位星號
   ====================================================== */
.required::after {
  content: ' *';
  color: var(--danger);
  font-weight: 600;
}

/* ======================================================
   32. 成功頁面
   ====================================================== */
.success-card {
  text-align: center;
  padding: 60px 40px;
  max-width: 500px;
  margin: 40px auto;
}
.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success-light);
  color: var(--success);
  font-size: 40px;
  line-height: 80px;
  margin: 0 auto 24px;
  border: 3px solid var(--success);
}
.case-number {
  font-size: 18px;
  color: var(--text);
  background: #f8f9fa;
  border-radius: 6px;
  padding: 12px 20px;
  margin: 20px 0;
  display: inline-block;
}

/* ======================================================
   33. SimpleTable 分頁增強
   ====================================================== */
.st-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  font-size: 13px;
  color: var(--text-muted);
}
.st-info { display: flex; align-items: center; gap: 8px; }
.st-page-size {
  height: 30px !important;
  font-size: 13px !important;
  padding: 2px 8px !important;
}

/* ======================================================
   34. 編輯內頁元件（從 View inline style 提取）
   ====================================================== */

/* 資料集欄位描述表格 */
.field-desc-table {
  border-collapse: collapse;
  width: 100%;
}
.field-desc-table td,
.field-desc-table th {
  border: 1px solid var(--border);
  text-align: left;
  padding: 8px 10px;
  font-size: 14px;
}
.field-desc-table th {
  background: #f8f9fa;
  font-weight: 600;
}
.field-desc-table tr:nth-child(even) {
  background-color: #f8f9fa;
}

/* CSV 預覽表格 */
.table-preview th { background-color: #f8f9fa; font-weight: 600; }
.status-ok   { color: var(--success); font-weight: 600; }
.status-err  { color: var(--danger); font-weight: 600; }

/* 表單按鈕靠右對齊 */
.form-actions-right { display: flex; justify-content: flex-end; gap: 8px; }

/* 編輯內頁的 Tab 導覽 */
.edit-tabs .nav-tabs > li > a { font-size: 14px; }

/* 編輯內頁的日期時間選單寬度 */
.edit-page .form-group .datetimepicker-input { max-width: 200px; }

/* textarea 高度自適應 */
textarea.form-control { height: auto; min-height: 80px; }

/* select 高度不限（多選） */
select[multiple].form-control { height: auto; min-height: 80px; }

/* ======================================================
   35. 列印樣式（@media print）
   ====================================================== */
@media print {
  /* 隱藏非列印元素 */
  .main-header,
  .main-sidebar,
  .sidebar-toggle,
  .no-print,
  .back-btn,
  .pagination,
  .st-footer,
  .btn,
  .search-panel,
  .box-tools,
  #sidebar-overlay { display: none !important; }

  /* 重設版面 */
  .content-wrapper {
    margin-left: 0 !important;
    margin-top: 0 !important;
    padding: 0 !important;
  }
  .main-footer {
    margin-left: 0 !important;
  }

  /* 卡片簡化 */
  .box, .card {
    box-shadow: none !important;
    border: 1px solid #000 !important;
    break-inside: avoid;
  }

  /* 文字與表格 */
  body {
    font-size: 12pt !important;
    color: #000 !important;
    background: #fff !important;
  }
  .table th, .table td {
    border: 1px solid #000 !important;
    padding: 6px 8px !important;
  }

  /* 徽章列印時改為純文字 */
  .badge, .label {
    background: none !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }

  /* 連結顯示 URL */
  a[href]::after { content: none; }
}

/* ======================================================
   35. 響應式設計
   ====================================================== */
@media (max-width: 1024px) {
  .main-sidebar { width: 60px; }
  .main-sidebar .sidebar-menu > li > a span,
  .main-sidebar .sidebar-menu > li.header { display: none; }
  .main-sidebar .sidebar-menu > li > a { padding: 12px 0; justify-content: center; border-left: none; }
  .main-sidebar .sidebar-menu > li > a i { margin: 0; }
  .main-sidebar .sidebar-menu > li > a .pull-right { display: none; }
  .main-sidebar .collapse2 { display: none !important; }
  .content-wrapper { margin-left: 60px; }
  .main-footer { margin-left: 60px; }
}

@media (max-width: 767px) {
  .main-header .logo { width: 56px; }
  .main-header .logo .logo-lg   { display: none; }
  .main-header .logo .logo-mini { display: inline; }

  .main-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
    z-index: 710;
  }
  .main-sidebar .sidebar-menu > li > a span,
  .main-sidebar .sidebar-menu > li.header { display: block; }
  .main-sidebar .sidebar-menu > li > a { padding: 10px 20px 10px 28px; justify-content: flex-start; border-left: 3px solid transparent; }
  .main-sidebar .sidebar-menu > li > a .pull-right { display: block; }

  body.sidebar-open .main-sidebar  { transform: translateX(0); }

  /* 行動遮罩由 JS 建立 #sidebar-overlay */
  #sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 699;
  }
  #sidebar-overlay.active { display: block; }

  .content-wrapper,
  .main-footer { margin-left: 0; }

  .content { padding: 10px 14px 16px; }
  .content-header { padding: 14px 14px 6px; }
  .breadcrumb { padding: 4px 14px 0; }

  /* Header 全域搜尋在行動裝置隱藏 */
  .global-search { display: none; }
}

@media (max-width: 575px) {
  .btn-xs-block { display: flex; width: 100%; justify-content: center; }
  [class*="col-"] { width: 100%; }
}

/* hidden-xs / visible-xs */
@media (max-width: 767px) {
  .hidden-xs  { display: none   !important; }
  .visible-xs { display: block  !important; }
}
@media (min-width: 768px) {
  .hidden-sm  { }
  .visible-xs { display: none !important; }
}
