/*
 * 校園公告系統 - 共用介面主題（前台、後台共用）
 * 建立在 AdminLTE 3 之上，只覆寫外觀，不影響功能
 */

:root {
  /* 品牌色：按鈕、連結、選取狀態 */
  --brand: #1d4e89;
  --brand-dark: #153a66;
  --brand-soft: #e8f0fa;
  /* 左側選單 */
  --sidebar-bg: #0f2742;
  --sidebar-hover: rgba(255, 255, 255, .08);
  --sidebar-active: #1d4e89;
  /* 頁面底色、卡片、框線、文字 */
  --bg: #f3f5f8;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1f2937;
  --muted: #64748b;
  /* 「極重要」等警示用色（*-soft 為淡底色） */
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --info-soft: #e8f0fa;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 39, 66, .06), 0 2px 8px rgba(15, 39, 66, .05);
}

/* ---------- 基本 ---------- */
body,
.main-header .navbar-nav .nav-link,
.brand-link,
.nav-sidebar .nav-link p {
  font-family: "Noto Sans TC", "Source Sans Pro", -apple-system, "Segoe UI", "Microsoft JhengHei", sans-serif;
}
body { color: var(--text); font-size: 15px; letter-spacing: .01em; }
.content-wrapper { background: var(--bg); }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

/* ---------- 上方導覽列 ---------- */
.main-header.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  min-height: 56px;
}
.main-header .nav-link { color: var(--muted) !important; font-weight: 500; }
.main-header .nav-link:hover { color: var(--brand) !important; }
.main-header .nav-link i { margin-right: .3rem; }
.main-header .nav-link[data-widget] i { margin-right: 0; }

/* ---------- 左側選單 ---------- */
.main-sidebar,
.main-sidebar.sidebar-dark-primary { background: var(--sidebar-bg); }
.brand-link {
  display: flex !important;
  align-items: center;
  gap: .65rem;
  height: 56px;
  padding: 0 1rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
}
.brand-link .brand-icon {
  flex: 0 0 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.brand-link .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-weight: 700 !important;
  color: #fff;
  font-size: 1rem;
}
.brand-link .brand-text small { font-weight: 400; color: rgba(255, 255, 255, .6); font-size: .72rem; }
.sidebar-collapse .brand-link .brand-text { display: none; }

.nav-sidebar .nav-header {
  color: rgba(255, 255, 255, .45) !important;
  font-size: .72rem !important;
  font-weight: 600;
  letter-spacing: .08em;
  padding: 1.1rem 1rem .4rem !important;
}
.nav-sidebar > .nav-item > .nav-link {
  color: rgba(255, 255, 255, .82) !important;
  border-radius: 8px;
  margin: 1px .5rem;
  width: calc(100% - 1rem) !important;
  padding: .5rem .75rem;
  display: flex;
  align-items: center;
}
.nav-sidebar > .nav-item > .nav-link > i,
.nav-sidebar > .nav-item > .nav-link > .nav-icon {
  width: 1.4rem;
  margin-right: .55rem;
  text-align: center;
  font-size: .9rem;
  opacity: .85;
}
.nav-sidebar > .nav-item > .nav-link p { margin: 0; font-size: .92rem; }
.nav-sidebar > .nav-item > .nav-link:hover { background: var(--sidebar-hover) !important; color: #fff !important; }
.nav-sidebar > .nav-item > .nav-link.active {
  background: var(--sidebar-active) !important;
  color: #fff !important;
  box-shadow: none !important;
}

/* ---------- 頁面標題 ---------- */
.content-header { padding: 1.25rem .5rem .5rem; }
.content-header h1 {
  font-size: 1.45rem !important;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.content-header h1::before {
  content: "";
  width: 4px;
  height: 1.3em;
  border-radius: 2px;
  background: var(--brand);
}
.content-header h1 b { font-weight: 700; }

/* ---------- 卡片 ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card > .card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: .85rem 1.25rem;
  color: var(--text) !important;
}
.card > .card-header { display: flex; align-items: center; gap: .75rem; }
/* AdminLTE 用 float + clearfix 排版標題列；改成 flex 後要關掉 clearfix，否則會多一個空白項目 */
.card > .card-header::after { display: none; }
.card > .card-header .card-title { float: none; flex: 1 1 auto; margin: 0; }
.card > .card-header .card-tools { float: none; margin: 0 0 0 auto; }
.card-title { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.card-title i { color: var(--brand); margin-right: .4rem; }
.card > .card-footer {
  background: #fafbfc;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: .65rem 1.25rem;
}
.card .btn-tool { color: var(--muted) !important; }

/* AdminLTE 彩色標題、上框線統一為品牌色 */
.card[class*="card-"]:not(.card-outline) > .card-header { background: var(--surface) !important; color: var(--text) !important; }
.card[class*="card-"]:not(.card-outline) > .card-header .card-title { color: var(--text) !important; }
.card.card-outline { border-top: 3px solid var(--brand) !important; }

/* 公告卡片 */
.ann-card .card-body { padding: 0; }
.ann-card .card-footer { text-align: right; }

/* ---------- 表格 ---------- */
.card .table { margin-bottom: 0; color: var(--text); }
.card .table-bordered,
.card .table-bordered td,
.card .table-bordered th { border-left: 0; border-right: 0; }
.card .table-bordered { border-top: 0; border-bottom: 0; }
.card .table thead th {
  background: #f8fafc;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border) !important;
  border-top: 0;
  padding: .7rem 1rem;
  white-space: nowrap;
}
.card .table td {
  padding: .8rem 1rem;
  border-top: 1px solid var(--border);
  vertical-align: middle !important;
}
.card .table-striped tbody tr:nth-of-type(odd) { background: transparent; }
.card .table tbody tr:hover { background: #f5f9ff; }
.card .table td a { color: var(--text); font-weight: 500; }
.card .table td a:hover { color: var(--brand); text-decoration: none; }
.card .table td a.btn { font-weight: 500; }
.card .table .ann-title-en { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; margin-top: .15rem; }
.card .table .ann-date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 重要程度標籤 */
.badge-imp {
  display: inline-block;
  margin-top: .3rem;
  padding: .2em .6em;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge-imp-1 { background: var(--danger-soft); color: var(--danger); }
.badge-imp-2 { background: var(--info-soft); color: var(--brand); }

/* 表格內操作按鈕 */
.table-actions { display: flex; flex-wrap: nowrap; gap: .35rem; justify-content: center; }
.table-actions form { display: inline; margin: 0; }
.table-actions .btn { white-space: nowrap; }

/* ---------- 按鈕 ---------- */
.btn { border-radius: 7px; font-weight: 500; }
.btn i { margin-right: .3rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-default { background: var(--surface); border-color: #cfd8e3; color: var(--text); }
.btn-default:hover { background: #f1f5f9; border-color: #b8c4d3; }
.btn-more {
  font-size: .85rem;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}
.btn-more:hover { color: var(--brand-dark); text-decoration: none; }
.btn-more i { margin-left: .25rem; transition: transform .15s; }
.btn-more:hover i { transform: translateX(3px); }

/* ---------- 表單 ---------- */
.form-control,
.custom-select,
.select2-container--default .select2-selection--single,
.select2-container--bootstrap4 .select2-selection {
  border-radius: 7px !important;
  border-color: #cfd8e3;
}
.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(29, 78, 137, .15);
}
.form-group > label, .card-body > label { font-weight: 600 !important; color: var(--text); font-size: .92rem; }
.custom-control-label { font-weight: 400 !important; }
.form-errors { border-radius: 8px; }
.form-errors ul { margin: .4rem 0 0; padding-left: 1.2rem; }
/* select2 下拉選單：外掛會用 inline 樣式寫死寬高，必須用 !important 才能覆寫 */
.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single { height: calc(2.25rem + 2px) !important; padding: .375rem .75rem !important; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 1.5 !important; padding-left: 0 !important; color: var(--text); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 100% !important; top: 0 !important; right: .5rem !important; }

/* ---------- 後台公告表單（新增公告） ---------- */
.ann-form .form-card > .card-header { padding: .75rem 1.25rem; }
.ann-form .form-card .card-body { padding: 1.25rem; }
/* fieldset 標題：Bootstrap 預設為 1.5rem，統一縮小（.form-card 用於不在 .ann-form 表單內的卡片） */
.ann-form legend, .form-card legend { font-size: .92rem; font-weight: 600; color: var(--text); margin-bottom: .5rem; width: auto; }
.ann-form .req { color: var(--danger); margin-left: .1rem; }
.ann-form .optional { font-size: .75rem; font-weight: 400; color: var(--muted); margin-left: .25rem; }
.form-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.form-label-row legend, .form-label-row label { margin-bottom: .5rem; }
.char-count { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.char-count.is-over { color: #b45309; font-weight: 600; }
.ann-form .note-editor.note-frame { border-color: #cfd8e3; border-radius: 8px; overflow: hidden; }
.ann-form .note-toolbar { background: #f8fafc; border-bottom: 1px solid var(--border); }

/* 右側設定欄：大螢幕時捲動固定（top 預留上方導覽列高度） */
@media (min-width: 992px) {
  .form-side { position: sticky; top: 72px; }
}
.unit-display {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  font-weight: 500;
}
.unit-display i { color: var(--muted); }

/* 單選／多選膠囊：隱藏原生 radio/checkbox，以相鄰的 span 呈現狀態（仍可用鍵盤操作） */
.choice-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.choice-pill { margin: 0; cursor: pointer; font-weight: 400 !important; }
.choice-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-pill span {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .75rem; border: 1px solid #cfd8e3; border-radius: 999px;
  font-size: .85rem; color: var(--text); background: var(--surface);
  transition: background .15s, border-color .15s, color .15s;
}
.choice-pill span i { color: var(--muted); font-size: .8rem; }
.choice-pill:hover span { border-color: var(--brand); }
.choice-pill input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.choice-pill input:checked + span i { color: #fff; }
.choice-pill input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 重要等級：三段式切換，選中時依等級上色（一般＝品牌藍、重要＝橘、極重要＝紅） */
.segmented { display: flex; border: 1px solid #cfd8e3; border-radius: 8px; overflow: hidden; }
.segmented-item { flex: 1; margin: 0; cursor: pointer; font-weight: 400 !important; }
.segmented-item + .segmented-item { border-left: 1px solid #cfd8e3; }
.segmented-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented-item span { display: block; text-align: center; padding: .45rem .25rem; font-size: .88rem; color: var(--text); background: var(--surface); }
.segmented-item:hover span { background: #f1f5f9; }
.segmented-item input:checked + span { color: #fff; font-weight: 600; }
.segmented-item.imp-3 input:checked + span { background: var(--brand); }
.segmented-item.imp-2 input:checked + span { background: #b45309; }
.segmented-item.imp-1 input:checked + span { background: var(--danger); }
.segmented-item input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -3px; }

/* 公告期間 */
.date-range { display: flex; align-items: center; gap: .4rem; }
.date-range .form-control { min-width: 0; }
.date-range > span { color: var(--muted); }
.date-presets { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.date-presets button, .link-btn {
  border: 0; background: none; padding: .15rem .5rem; border-radius: 6px;
  font-size: .8rem; color: var(--brand); cursor: pointer;
}
.date-presets button { background: var(--brand-soft); }
.date-presets button:hover, .link-btn:hover { background: #dbe7f7; }

/* 送出按鈕區 */
.form-actions { background: #fafbfc; padding: 1rem 1.25rem; }
.form-actions .btn-primary { padding: .6rem 1rem; font-size: 1rem; }

/* 附件：拖曳區與檔案清單 */
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: .3rem; margin: 0;
  padding: 1.5rem 1rem; border: 2px dashed #cfd8e3; border-radius: 10px;
  background: #fafbfc; text-align: center; cursor: pointer; font-weight: 400 !important;
  transition: border-color .15s, background .15s;
}
.file-drop i { font-size: 1.8rem; color: var(--brand); opacity: .8; }
.file-drop strong { font-size: .95rem; color: var(--text); }
.file-drop strong u { color: var(--brand); }
.file-drop span { font-size: .8rem; color: var(--muted); }
/* 拖曳區本身是 card-body 內的 <label>，需覆寫全站「標籤粗體」的規則 */
.ann-form .file-drop, .ann-form .file-drop span { font-weight: 400 !important; }
.ann-form .file-drop strong { font-weight: 600 !important; }
.file-drop:hover, .file-drop.is-over { border-color: var(--brand); background: var(--brand-soft); }
.file-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.file-list:empty { display: none; }
.file-row { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: 8px; }
.file-row .file-icon { flex: 0 0 36px; height: 36px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.file-row-main { flex: 1; min-width: 0; }
.file-row-main small { display: block; margin-top: .2rem; color: var(--muted); font-size: .75rem; }
.file-remove { flex: 0 0 auto; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.file-remove:hover { background: var(--danger-soft); color: var(--danger); }

/* 修改公告：既有附件與新增附件的區隔、公告資訊 */
.file-section-title { font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .5rem; }
.file-list-existing { margin-top: 0; }
.file-row-main small a { color: var(--brand); }
.file-new-tag { display: inline-block; background: #e6f4ea; color: #1e7b3c; border-radius: 4px; padding: 0 .35rem; font-weight: 600; }
.ann-info-list { margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px dashed var(--border); display: grid; gap: .35rem; }
.ann-info-list div { display: flex; justify-content: space-between; font-size: .82rem; }
.ann-info-list dt { font-weight: 400; color: var(--muted); }
.ann-info-list dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- 後台公告檢視（admin/ann_v）：預覽標示、狀態、操作 ---------- */
.preview-label { font-size: .8rem; color: var(--muted); margin: 0 0 .5rem .25rem; }
.preview-label i { margin-right: .3rem; }
.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: 1rem; }
.status-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .75rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.status-badge i { font-size: .6rem; }
.status-badge.is-active { background: #e6f4ea; color: #1e7b3c; }      /* 公告中：綠 */
.status-badge.is-upcoming { background: var(--brand-soft); color: var(--brand); } /* 尚未開始：藍 */
.status-badge.is-ended { background: #eef2f6; color: var(--muted); }   /* 已結束：灰 */
.status-badge.is-upcoming i, .status-badge.is-ended i { font-size: .8rem; }
.status-sub { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 電子報狀態：左側色條區分狀態 */
.mail-status { padding: .75rem .9rem; border-radius: 8px; background: #f8fafc; border-left: 3px solid #cbd5e1; margin-bottom: 1.1rem; }
.mail-status-title { font-weight: 600; font-size: .9rem; }
.mail-status-title i { margin-right: .4rem; }
.mail-status p { margin: .3rem 0 0; font-size: .8rem; color: var(--muted); line-height: 1.6; }
.mail-status.is-pending { border-left-color: var(--brand); }
.mail-status.is-pending .mail-status-title { color: var(--brand); }
.mail-status.is-sent { border-left-color: #1e7b3c; background: #f3faf5; }
.mail-status.is-sent .mail-status-title { color: #1e7b3c; }
.view-actions { display: grid; gap: .5rem; }
.view-actions .btn-block + .btn-block { margin-top: 0; }
.view-actions .btn.disabled { opacity: .55; cursor: not-allowed; }
.danger-zone { background: #fffafa; border-top: 1px solid #f5dcdc; text-align: center; }
.danger-zone .btn-link { font-size: .85rem; font-weight: 500; }

/* ---------- 後台部門資料管理：嵌入語法與預覽 ---------- */
.embed-notes { list-style: none; margin: .6rem 0 0; padding: 0; font-size: .8rem; color: var(--muted); display: grid; gap: .25rem; }
.embed-notes i { width: 1.1rem; color: #94a3b8; }
/* 預覽寬度切換按鈕（桌面／平板／手機） */
.device-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.device-toggle button { border: 0; background: var(--surface); color: var(--muted); padding: .3rem .7rem; cursor: pointer; }
.device-toggle button + button { border-left: 1px solid var(--border); }
.device-toggle button:hover { color: var(--brand); }
.device-toggle button.is-active { background: var(--brand); color: #fff; }
/* 預覽舞台：灰底上放一個模擬的瀏覽器視窗，寬度切換時置中縮放 */
.embed-stage { background: #eef2f6; padding: 1.25rem; }
.mock-browser {
  margin: 0 auto; max-width: 100%; background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 6px 24px rgba(15, 39, 66, .12); transition: max-width .25s ease;
}
.mock-browser-bar { display: flex; align-items: center; gap: .35rem; padding: .55rem .8rem; background: #f1f5f9; border-bottom: 1px solid var(--border); }
.mock-browser-bar > span { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.mock-browser-bar > span:nth-child(1) { background: #f87171; }
.mock-browser-bar > span:nth-child(2) { background: #fbbf24; }
.mock-browser-bar > span:nth-child(3) { background: #34d399; }
.mock-browser-url { flex: 1; margin-left: .6rem; padding: .15rem .7rem; background: #fff; border: 1px solid var(--border); border-radius: 999px; font-size: .75rem; color: var(--muted); }
/* 模擬單位網站的頁首（示意用，非嵌入內容） */
.mock-site-head { padding: .8rem 1rem; background: #5b2c6f; color: #fff; font-weight: 700; font-size: .95rem; }
.mock-site-head small { display: block; font-weight: 400; font-size: .75rem; opacity: .8; }
#embed-preview { display: block; width: 100%; border: 0; }
.embed-stage-note { margin: .75rem 0 0; font-size: .78rem; color: var(--muted); text-align: center; }

/* ---------- 系統管理者：公告管理的範圍標示、篩選列、唯讀提示 ---------- */
.admin-scope-tag {
  display: inline-flex; align-items: center; gap: .3rem; margin-left: .6rem; vertical-align: middle;
  padding: .15rem .6rem; border-radius: 999px; background: #fff4e0; color: #9a5b00; font-size: .75rem; font-weight: 600;
}
.ann-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 1rem; margin-bottom: .75rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; }
.ann-filter label { margin: 0; font-size: .85rem; color: var(--muted); font-weight: 500 !important; }
.ann-filter select { width: auto; min-width: 140px; }
.ann-filter #filter-uni { min-width: 220px; }
.ann-filter-count { margin-left: auto; font-size: .82rem; color: var(--muted); }
.readonly-note { padding: .65rem .8rem; margin-bottom: 1rem; border-radius: 8px; background: #fff8eb; border: 1px solid #f6dfb3; color: #8a5300; font-size: .82rem; line-height: 1.6; }
.readonly-note i { margin-right: .35rem; }

/* ---------- 已寄出公告的限時開放修改（App\Support\AnnouncementLock） ---------- */
/* 公告列表：標題旁的「開放修改至 HH:MM」標籤 */
.unlock-tag { display: inline-flex; align-items: center; gap: .3rem; margin-left: .4rem; padding: .1rem .5rem; border-radius: 999px; background: #fff4e0; color: #9a5b00; font-size: .72rem; font-weight: 600; white-space: nowrap; }
/* 公告檢視：所屬單位看到的開放提示 */
.unlock-note { padding: .65rem .8rem; margin-bottom: 1rem; border-radius: 8px; background: #fff8eb; border: 1px solid #f6dfb3; color: #8a5300; font-size: .82rem; line-height: 1.6; }
.unlock-note i { margin-right: .35rem; }
/* 公告檢視：系統管理者的開放／關閉面板 */
.unlock-panel { background: #fffbf2; border-top: 1px solid #f6dfb3; }
.unlock-panel-title { font-weight: 600; font-size: .88rem; color: #8a5300; margin-bottom: .35rem; }
.unlock-panel-title i { margin-right: .35rem; }
.unlock-panel-hint { font-size: .8rem; color: var(--muted); line-height: 1.6; margin: 0 0 .6rem; }
.unlock-form { display: flex; gap: .5rem; }
.unlock-form select { flex: 1; }
/* 修改頁：開放修改中的橫幅（到期後轉紅） */
.unlock-banner { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; margin-bottom: 1rem; border-radius: 10px; background: #fff8eb; border: 1px solid #f6dfb3; color: #8a5300; }
.unlock-banner > i { font-size: 1.2rem; margin-top: .1rem; }
.unlock-banner strong { display: block; font-size: .92rem; }
.unlock-banner span { font-size: .82rem; }
.unlock-banner.is-expired { background: var(--danger-soft); border-color: #f1b8b2; color: var(--danger); }

/* ---------- 未發布公告提醒（App\Support\UnitActivity）：後台首頁卡片、部門管理篩選與標籤 ---------- */
.dash-range-sm a { padding: .2rem .6rem; font-size: .8rem; }
.dash-range-sm a small { opacity: .75; margin-left: .15rem; }
.idle-card { border-top: 3px solid #d97706; }
.idle-card .card-title i { color: #d97706; }
.idle-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.idle-stat { padding: .7rem .9rem; border-radius: 8px; background: #f8fafc; border: 1px solid var(--border); }
.idle-stat strong { display: block; font-size: 1.6rem; line-height: 1.2; }
.idle-stat span { font-size: .8rem; color: var(--muted); }
.idle-stat.is-stale strong { color: #b45309; }   /* 超過門檻：橘 */
.idle-stat.is-never strong { color: #64748b; }   /* 從未發布：灰 */
.idle-subtitle { font-size: .8rem; font-weight: 600; color: var(--muted); margin: .25rem 0 .4rem; }
.idle-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 1.5rem; }
.idle-list li { display: flex; align-items: baseline; gap: .6rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); font-size: .88rem; }
.idle-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.idle-name small { margin-left: .4rem; color: var(--muted); font-weight: 400; }
.idle-last { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.idle-days { font-weight: 700; color: #b45309; white-space: nowrap; font-variant-numeric: tabular-nums; }
.idle-never { display: flex; flex-wrap: wrap; gap: .35rem; }
.idle-never span { padding: .15rem .55rem; border-radius: 999px; background: #eef2f6; color: var(--muted); font-size: .78rem; }
.idle-never span.more { background: none; }
/* 部門管理：篩選列與最後發布標籤 */
.dep-filter { gap: .5rem .6rem; }
.dep-filter-label { font-size: .85rem; color: var(--muted); }
.idle-tag { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.idle-tag.is-stale { background: #fff4e0; color: #9a5b00; }
.idle-tag.is-never { background: #eef2f6; color: var(--muted); }

/* ---------- 部門管理：停用標籤、申請人查詢結果 ---------- */
/* 卡片底部改用 flex 排版時，關掉 AdminLTE 的 clearfix 偽元素（否則會被當成第三個項目，使按鈕無法靠右） */
.card-footer.d-flex::after { display: none; }
.disabled-tag { display: inline-flex; align-items: center; gap: .3rem; margin-left: .4rem; padding: .1rem .55rem; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: .75rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.applicant-name { min-height: 1.2em; font-size: .85rem; color: #1e7b3c; font-weight: 500; }
.applicant-name i { margin-right: .3rem; }

/* ---------- DataTables ---------- */
.dataTables_wrapper { padding: .75rem 1rem; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select { border-radius: 7px; border: 1px solid #cfd8e3; }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.page-link { color: var(--brand); }

/* ---------- 點閱次數 ---------- */
.ann-stats { margin-top: .3rem; }
.ann-views {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ann-views i { font-size: .8rem; opacity: .8; }
.ann-views small { font-size: .74rem; font-weight: 400; }
.ann-views-pill {
  flex: 0 0 auto;
  padding: .3rem .75rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .85rem;
  font-weight: 600;
}
.ann-views-pill i { opacity: 1; }

/* ---------- AI 摘要 ---------- */
.btn-ai {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border: 1px solid #c9d8ef;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-ai:hover { background: #dbe7f7; border-color: var(--brand); }
.btn-ai:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-ai.is-open { background: var(--brand); border-color: var(--brand); color: #fff; }
.ai-summary {
  margin-top: .6rem;
  padding: .75rem .9rem;
  border-radius: 8px;
  background: #f5f8fd;
  border: 1px solid #dbe5f3;
  border-left: 3px solid var(--brand);
  font-size: .9rem;
  line-height: 1.75;
  color: var(--text);
  font-weight: 400;
}
.ai-summary-head { font-size: .78rem; font-weight: 700; color: var(--brand); margin-bottom: .25rem; }
.ai-summary-head i { margin-right: .3rem; }
.ai-summary-note { margin-top: .4rem; font-size: .75rem; color: var(--muted); }
.ai-detail { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.ai-detail .ai-summary { margin-top: .75rem; }

/* ---------- 公告內容頁（文章式版面） ---------- */
.ann-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); padding: .25rem .5rem; }
.ann-breadcrumb a { color: var(--muted); }
.ann-breadcrumb a:hover { color: var(--brand); text-decoration: none; }
.ann-breadcrumb a i { margin-right: .3rem; }
.ann-breadcrumb .fa-chevron-right { font-size: .65rem; opacity: .6; }

.ann-article {
  margin: 0 0 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.ann-article-head { padding: 1.5rem 1.75rem 1.25rem; border-bottom: 1px solid var(--border); }
.ann-article-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.ann-tag {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .7rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: .78rem; font-weight: 600;
}
.ann-tag-imp1 { background: var(--danger-soft); color: var(--danger); }
.ann-tag-imp2 { background: #fff4e0; color: #9a5b00; }
.ann-article-title { font-size: 1.6rem; font-weight: 700; line-height: 1.5; color: var(--text); margin: 0; letter-spacing: .01em; }
.ann-article-en { font-size: 1rem; color: var(--muted); margin: .4rem 0 0; line-height: 1.5; }
.ann-article-meta { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: 1.1rem 0 0; padding: 0; font-size: .86rem; color: var(--muted); }
.ann-article-meta li { display: inline-flex; align-items: center; gap: .4rem; }
.ann-article-meta li > i { color: #94a3b8; }
.ann-article-meta .ann-views { font-size: .86rem; }
.ann-article-audience { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .9rem; }
.ann-audience-label { font-size: .8rem; color: var(--muted); margin-right: .2rem; }
.ann-audience { padding: .15rem .6rem; border: 1px solid var(--border); border-radius: 6px; font-size: .8rem; color: var(--text); background: #fafbfc; }

.ann-article-body {
  padding: 1.5rem 1.75rem;
  font-size: 1.02rem;
  line-height: 1.95;
  color: #263241;
  word-break: break-word;
}
.ann-article-body p { margin: 0 0 1em; }
.ann-article-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
/* 從 Word / Google 文件貼上的內容常帶固定寬度與不換行設定，一律收進正文寬度內 */
.ann-article-body { overflow-x: auto; min-width: 0; }
.ann-article-body * { max-width: 100%; box-sizing: border-box; }
.ann-article-body [style*="white-space:pre"],
.ann-article-body [style*="white-space: pre"] { white-space: pre-wrap !important; }
.ann-article-body [style*="white-space:nowrap"],
.ann-article-body [style*="white-space: nowrap"] { white-space: normal !important; }
.ann-article-body [style*="width"]:not(img):not(table):not(td):not(th) { width: auto !important; }
.ann-article-body img { max-width: 100% !important; height: auto !important; border-radius: 8px; }
.ann-article-body table { width: 100% !important; max-width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95rem; }
.ann-article-body table td, .ann-article-body table th { border: 1px solid var(--border); padding: .45rem .7rem; width: auto !important; min-width: 4em; }
.ann-article-body table p { margin: 0; }
.ann-article-body ul, .ann-article-body ol { padding-left: 1.5em; }

.ann-files-block { padding: 1.25rem 1.75rem; border-top: 1px solid var(--border); background: #fafbfc; }
.ann-files-block h2 { font-size: .95rem; font-weight: 700; margin: 0 0 .85rem; display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.ann-files-block h2 > i { color: var(--brand); font-size: .85rem; }
.ann-files-block h2 small { font-size: .8rem; font-weight: 400; color: var(--muted); margin-left: .25rem; }
.ann-files-count { font-size: .75rem; font-weight: 600; color: var(--muted); background: #eef2f6; border-radius: 999px; padding: .05rem .5rem; }
.ann-files-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: .65rem; }
.ann-file {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem .8rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.ann-file:hover { border-color: #b9cbe3; box-shadow: 0 2px 10px rgba(29, 78, 137, .07); }
.ann-file-thumb { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 8px; overflow: hidden; background: #f1f5f9; display: block; }
.ann-file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ann-file .file-icon { flex-basis: 44px; height: 44px; border-radius: 10px; font-size: 1.2rem; }
.ann-file-info { flex: 1 1 auto; min-width: 0; }
.ann-file-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: .9rem; font-weight: 600; line-height: 1.4; color: var(--text); word-break: break-all;
}
.ann-file-name:hover { color: var(--brand); text-decoration: none; }
.ann-file-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; margin-top: .2rem; font-size: .75rem; color: var(--muted); }
.ann-file-meta span + span:not(.ann-file-badge)::before { content: "·"; margin-right: .5rem; color: #c3ccd8; }
.ann-file-badge { background: var(--brand); color: #fff; border-radius: 4px; padding: 0 .4rem; font-weight: 600; font-size: .7rem; line-height: 1.6; }
.ann-file-badge + span::before { content: none !important; }
.ann-file-actions { flex: 0 0 auto; display: flex; gap: .3rem; }
.ann-file-actions a {
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); border: 1px solid transparent; font-size: .82rem;
}
.ann-file-actions a:hover { background: var(--brand-soft); color: var(--brand); border-color: #c9d8ef; text-decoration: none; }
.file-icon { flex: 0 0 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; background: #f1f5f9; color: var(--muted); }
.file-pdf { background: #fdecea; color: #c0392b; }
.file-word { background: #e8f0fa; color: #1d4e89; }
.file-excel { background: #e6f4ea; color: #1e7b3c; }
.file-ppt { background: #fff1e6; color: #b45309; }
.file-image { background: #f3e8fd; color: #7e3fb5; }

.ann-article-foot { display: flex; justify-content: space-between; gap: .5rem; padding: .9rem 1.75rem; border-top: 1px solid var(--border); }

@media (max-width: 767.98px) {
  .ann-article { border-radius: 10px; }
  .ann-article-head, .ann-article-body, .ann-files-block, .ann-article-foot { padding-left: 1.1rem; padding-right: 1.1rem; }
  .ann-article-head { padding-top: 1.4rem; }
  .ann-article-title { font-size: 1.3rem; }
  .ann-article-body { padding-top: 1.4rem; padding-bottom: 1.4rem; font-size: 1rem; }
}

/* ---------- 後台首頁 ---------- */
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.dash-tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.dash-tile:hover { border-color: var(--brand); color: var(--text); text-decoration: none; transform: translateY(-2px); }
.dash-tile .dash-icon {
  flex: 0 0 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.dash-tile strong { display: block; font-size: 1rem; }
.dash-tile span { color: var(--muted); font-size: .85rem; }

/* ---------- 後台首頁：點閱統計 ---------- */
.dash-quick { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.dash-filter {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1rem;
}
.dash-scope { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.dash-scope i { color: var(--brand); }
.dash-scope-tag {
  font-size: .78rem; font-weight: 600; color: var(--brand);
  background: var(--brand-soft); border-radius: 999px; padding: .15rem .6rem;
}
.dash-range { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.dash-range a {
  padding: .3rem .85rem; border-radius: 7px; font-size: .85rem; font-weight: 500;
  color: var(--muted); text-decoration: none;
}
.dash-range a:hover { color: var(--brand); text-decoration: none; }
.dash-range a.active { background: var(--brand); color: #fff; }

.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.dash-kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.25rem;
}
.dash-kpi-label { font-size: .85rem; color: var(--muted); font-weight: 500; }
.dash-kpi-value { font-size: 1.9rem; font-weight: 700; color: var(--text); line-height: 1.25; margin-top: .2rem; }
.dash-kpi-note { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.dash-kpi-hero { border-top: 3px solid var(--brand); }
.dash-kpi-hero .dash-kpi-value { font-size: 2.6rem; color: var(--brand); }

.dash-card { width: 100%; }
.card-header .dash-card-note { font-size: .78rem; color: var(--muted); margin-left: auto; }

.dash-rank { list-style: none; margin: 0; padding: 0; }
.dash-rank li { display: flex; align-items: center; gap: .85rem; padding: .6rem 0; border-top: 1px solid var(--border); }
.dash-rank li:first-child { border-top: 0; padding-top: 0; }
.dash-rank-no {
  flex: 0 0 26px; height: 26px; border-radius: 7px; background: #f1f5f9; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700;
}
.dash-rank li:nth-child(-n+3) .dash-rank-no { background: var(--brand-soft); color: var(--brand); }
.dash-rank-main { flex: 1 1 auto; min-width: 0; }
.dash-rank-title { font-size: .9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-rank-title a { color: var(--text); }
.dash-rank-title a:hover { color: var(--brand); }
.dash-rank-meta { font-size: .75rem; color: var(--muted); margin: .1rem 0 .3rem; }
.dash-bar { height: 6px; background: #edf2f8; border-radius: 3px; overflow: hidden; }
/* 長條顏色與圖表相同（#2f6db5）：品牌色 #1d4e89 用在大面積長條上太暗，經驗證工具檢查後改用此色 */
.dash-bar span { display: block; height: 100%; background: #2f6db5; border-radius: 0 3px 3px 0; }
.dash-rank-value { flex: 0 0 auto; font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; }
.dash-rank-value small { font-size: .72rem; color: var(--muted); font-weight: 400; margin-left: .15rem; }

.dash-chart { position: relative; width: 100%; }
.dash-table { margin-top: .75rem; }
.dash-table summary { font-size: .82rem; color: var(--brand); cursor: pointer; font-weight: 500; }
.dash-table table { margin-top: .5rem; font-size: .85rem; }
.dash-table td, .dash-table th { padding: .35rem .5rem !important; }

.dash-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem;
  padding: 2.25rem 1rem; color: var(--muted);
}
.dash-empty i { font-size: 1.6rem; color: #b8c4d3; margin-bottom: .25rem; }
.dash-empty strong { color: var(--text); font-size: .95rem; }
.dash-empty span { font-size: .82rem; max-width: 320px; }

/* ---------- 登入頁 ---------- */
.login-page { background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--brand) 100%); }
.login-box { width: 400px; max-width: calc(100% - 32px); }
.login-box .card { border: 0; border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
/* 登入頁標題維持「圖示在上、文字置中」：覆寫全站 .card > .card-header 的橫向 flex 排列 */
.login-box .card > .card-header { display: block; border-bottom: 0; padding-top: 2rem; }
.login-box .card-header a { color: var(--text); text-decoration: none; }
.login-box .card-header .login-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: .75rem;
}
.login-box .card-header small { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; margin-top: .25rem; }
.login-box .card-body { padding: 1rem 2rem 2rem; }
.login-box-msg { color: var(--muted); font-size: .9rem; }
.login-box .input-group-text { background: #f8fafc; border-color: #cfd8e3; color: var(--muted); }
.login-box .btn-primary { padding: .5rem 1.5rem; }
/* reCAPTCHA v3 說明文字（Google 規定：隱藏右下角標章時須顯示此說明；目前標章保留，文字作為補充） */
.recaptcha-note { font-size: .75rem; color: var(--muted); text-align: center; margin: 0 0 1rem; line-height: 1.6; }
.recaptcha-note a { color: var(--muted); text-decoration: underline; }
/* 顯示／隱藏密碼按鈕：沿用 input-group-text 外觀，加上可點擊的提示 */
.pw-toggle { cursor: pointer; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--brand); background: var(--brand-soft); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* ---------- 頁尾 ---------- */
.main-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
  padding: .85rem 1.25rem;
}
.main-footer a { color: var(--muted); }

/* ---------- SweetAlert ---------- */
.swal2-popup { border-radius: 14px !important; font-family: inherit; }

/* ---------- 手機 ---------- */
@media (max-width: 575.98px) {
  .content-header h1 { font-size: 1.2rem !important; }
  .card .table td, .card .table thead th { padding: .6rem .65rem; }
  .ann-meta { grid-template-columns: 1fr; }
  .ann-card .table th:first-child { width: 92px !important; }
  .ann-card .table td:first-child { font-size: .8rem; }
}

.embed-code { font-family: Consolas, "Courier New", monospace; font-size: .82rem; }

/* ---------- 被外站嵌入（iframe）時 ---------- */
/* html 上的 is-embedded 由 ui.js 偵測到被 iframe 嵌入時加上 */
.is-embedded .main-header,
.is-embedded .main-sidebar,
.is-embedded .main-footer,
.is-embedded .content-header,
.is-embedded .phpdebugbar { display: none !important; }
.is-embedded .content-wrapper { margin-left: 0 !important; padding-top: .75rem; min-height: 0 !important; }
.is-embedded body { background: var(--bg); }

/* ---------- 列印 ---------- */
@media print {
  .main-header, .main-sidebar, .main-footer, .card-footer, .card-tools, .phpdebugbar, .ann-breadcrumb, .ann-article-foot { display: none !important; }
  .ann-article { border: 0; box-shadow: none; max-width: none; }
  .content-wrapper { margin-left: 0 !important; background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* 後台上方導覽列：登入的部門｜員工姓名（admin/layout/vie_header） */
.nav-user { white-space: nowrap; }
.nav-user .nav-user-sep { margin: 0 .4rem; color: var(--border); }

/* ===== 後台：操作紀錄（admin/audit_log） ===== */
.audit-filter input[type=date] { width: auto; }
.audit-filter input[type=search] { width: auto; min-width: 200px; }
.audit-table td { vertical-align: middle; }
.audit-time { white-space: nowrap; }
.audit-time small { color: var(--muted); }
.audit-user { white-space: nowrap; }
.audit-detail { word-break: break-word; }
.audit-ip { white-space: nowrap; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 動作標籤：依分類上色（登入／公告／部門／系統） */
.audit-action { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: #eef2f6; color: var(--muted); }
.audit-action.is-login, .audit-action.is-logout { background: #eef2f6; color: #475569; }
.audit-action.is-ann { background: var(--brand-soft); color: var(--brand); }
.audit-action.is-dep { background: #f3ecfb; color: #6b3fa0; }
.audit-action.is-epaper, .audit-action.is-od { background: #e6f4ea; color: #1e7b3c; }
/* 結果：失敗、被拒絕 */
.audit-result { display: block; margin-top: .2rem; font-size: .72rem; font-weight: 700; }
.audit-result.is-fail { color: var(--danger); }
.audit-result.is-denied { color: #9a5b00; }
.audit-table tr.is-fail td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.audit-table tr.is-denied td:first-child { box-shadow: inset 3px 0 0 #e0a100; }
.audit-only { margin-left: .3rem; font-size: .8rem; color: var(--muted); }
.audit-only:hover { color: var(--brand); }
.audit-pager .pagination { margin: 0; }
.audit-empty { text-align: center; padding: 2.5rem 1rem; }
.audit-empty i { font-size: 2rem; color: var(--muted); margin-bottom: .6rem; display: block; }

/* ===== 配送到電子報（admin/partials/epaper-option、ann_v 的 .epaper-panel） ===== */
.epaper-option { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.epaper-check { display: flex; gap: .6rem; align-items: flex-start; margin: 0; cursor: pointer; font-weight: normal !important; }
.epaper-check input { margin-top: .3rem; width: 1rem; height: 1rem; flex: 0 0 auto; }
.epaper-check b { display: block; font-size: .92rem; }
.epaper-check b i { margin-right: .35rem; color: var(--brand); }
.epaper-check small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.5; margin-top: .1rem; }
.epaper-check.is-disabled { cursor: not-allowed; opacity: .65; }
.epaper-detail { margin-top: .6rem; padding: .6rem .75rem; background: #f8fafc; border-radius: 8px; font-size: .8rem; line-height: 1.7; color: #374151; }
.epaper-detail span:first-child:not(.text-danger) { display: inline-block; min-width: 4.2rem; color: var(--muted); }
.epaper-option-status { font-size: .85rem; color: #374151; }
.epaper-option-status i { margin-right: .35rem; color: var(--brand); }
.epaper-panel { padding: .75rem .9rem; border-radius: 8px; background: #f8fafc; border-left: 3px solid #cbd5e1; margin-bottom: 1.1rem; }
.epaper-panel-title { font-weight: 600; font-size: .9rem; }
.epaper-panel-title i { margin-right: .4rem; }
.epaper-panel p { margin: .3rem 0 .5rem; font-size: .8rem; color: var(--muted); line-height: 1.6; }
.epaper-panel.is-y { border-left-color: #1e7b3c; }
.epaper-panel.is-p, .epaper-panel.is-s { border-left-color: var(--brand); }
.epaper-panel.is-f { border-left-color: var(--danger); }
/* 每月次數標籤與「為什麼有次數限制？」說明 */
.epaper-quota { margin-left: .4rem; padding: .05rem .5rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: .72rem; font-style: normal; font-weight: 600; vertical-align: 1px; }
.epaper-quota.is-full { background: var(--danger-soft); color: var(--danger); }
.epaper-reason { margin-top: .5rem; font-size: .78rem; }
/* 「為什麼有次數限制？」：淡黃底色＋邊框，讓使用者注意到；右側箭頭表示可展開 */
.epaper-reason summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem; border-radius: 8px; background: #fff6e0; border: 1px solid #f3d48f; color: #8a5a00; font-weight: 600; transition: background .15s; }
.epaper-reason summary::-webkit-details-marker { display: none; }
.epaper-reason summary::after { content: '\25BE'; margin-left: auto; font-size: .8rem; transition: transform .15s; }
.epaper-reason summary:hover { background: #ffefc7; }
.epaper-reason[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.epaper-reason[open] summary::after { transform: rotate(180deg); }
.epaper-reason[open] .epaper-reason-body { margin-top: 0; border-top: none; border-top-left-radius: 0; border-top-right-radius: 0; }
.epaper-reason-body { margin-top: .45rem; padding: .65rem .8rem; border-radius: 8px; background: #fffaf0; border: 1px solid #f6e3b8; color: #4b5563; line-height: 1.7; }
.epaper-reason-body p { margin: 0 0 .4rem; }
.epaper-reason-body b { color: #7a4b00; }
.epaper-quota-input { max-width: 200px; }

/* ===== 中文／英文公告（後台表單卡片標題、前台語言切換） ===== */
.lang-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.4rem; padding: 0 .35rem; margin-right: .5rem; border-radius: 5px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .5px; vertical-align: 1px; }
.lang-badge.is-en { background: #0f766e; }
.char-count span { font-weight: 600; color: var(--text, #1f2937); }
.char-count.is-over span { color: inherit; }
/* 前台公告內容頁：中文／English 切換 */
/* 與標題區的距離：上方 1.25rem（手機 1rem），左右置中；
 * 下方內文的上內距縮小，避免切換鈕與內文之間空太多 */
.lang-switch { display: flex; width: fit-content; margin: 1.25rem auto 0; padding: 3px; border-radius: 999px; background: #eef2f7; }   /* 左右置中 */
.lang-switch + .ann-lang-pane { padding-top: 1rem; }
@media (max-width: 767.98px) { .lang-switch { margin-top: 1rem; } }   /* 手機版上方間距略小 */
.lang-switch button { border: 0; background: transparent; padding: .3rem 1rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.lang-switch button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.ann-lang-pane[hidden] { display: none !important; }
@media print { .lang-switch { display: none; } .ann-lang-pane[hidden] { display: block !important; } }
.ann-en-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 1rem; color: var(--text, #1f2937); }
/* 後台公告檢視：英文內容預覽
 * 外框左右內距與中文內文（.ann-article-body：1.75rem）相同，標籤、英文標題、內文三者左側對齊；
 * 裡面的 .ann-article-body 不再重複左右內距 */
.ann-en-preview { margin: 0; padding: 1.25rem 1.75rem 0; border-top: 1px dashed var(--border); }
.ann-en-preview-label { display: flex; align-items: center; font-size: .82rem; font-weight: 600; color: #0f766e; margin-bottom: .6rem; }
.ann-en-preview .ann-en-title { margin-bottom: .25rem; }
.ann-en-preview .ann-article-body { padding: .75rem 0 1.5rem; }

/* ===== 前台公告列表（昨日、前日、分類、單位、身分頁）手機版 ===== */
/* 日期不換行（避免 2026-10- / 08 斷成兩行）；只套用在列表頁（.ann-list），首頁表格同樣 id，不可用欄位序號指定 */
.ann-list .ann-date-cell { white-space: nowrap; }
/* 標題下方的「日期．單位」：只在手機（寬度 < 480px，表格的日期、單位欄隱藏時）顯示 */
.ann-row-meta { display: none; margin-top: .2rem; font-size: .78rem; color: var(--muted); }
@media (max-width: 479.98px) {
  .ann-row-meta { display: block; }
  .ann-list td { text-align: left !important; }
  /* 手機版收窄表格兩側留白（DataTables 外框的欄位內距） */
  .dataTables_wrapper:has(.ann-list) > .row > [class*="col-"] { padding-left: 0; padding-right: 0; }
  .dataTables_wrapper:has(.ann-list) .dataTables_filter input { width: 100%; max-width: 220px; }
  /* 分頁列：置中、按鈕縮小，放不下時換行，不超出卡片 */
  .dataTables_wrapper:has(.ann-list) .dataTables_paginate .pagination { justify-content: center !important; flex-wrap: wrap; margin-top: .5rem; }
  .dataTables_wrapper:has(.ann-list) .dataTables_paginate .page-link { padding: .35rem .6rem; font-size: .85rem; }
  .dataTables_wrapper:has(.ann-list) .dataTables_info { text-align: center; padding-top: .25rem; }
}
/* 昨日／前日公告頁：標題列的日期（本頁公告日期相同，只顯示一次） */
.page-date { display: inline-flex; align-items: center; gap: .35rem; margin-left: .6rem; font-size: .85rem; font-weight: 500; color: var(--muted); }
@media (max-width: 479.98px) { .page-date { display: flex; margin: .25rem 0 0; } }
