/* =========================================================================
   ORED 總後台主題：把設計系統套到 AdminLTE 3.2 / Bootstrap 4
   載入順序：fontawesome → adminlte.min.css → ored-theme.css（本檔要最後載入）
   規則：頁面裡不要寫死色碼，一律用下面的 var(--xxx) 或本檔提供的 class。
   ========================================================================= */

/* ---------- 1. Design tokens（與設計系統 tokens.json 同步） ---------- */
:root {
  /* 中性色 */
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-sunken: #eef1f0;
  --border: #d8dedc;
  --border-strong: #8a9592;
  --ink: #17211f;
  --ink-muted: #4f5b58;
  --ink-subtle: #646f6c;
  /* 主色：藍綠 */
  --primary: #0a6880;
  --primary-hover: #07526a;
  --primary-soft: #e0eff4;
  --on-primary: #ffffff;
  --sidebar: #0e2d38;
  --on-sidebar: #d4e5ec;
  --primary-light: #4fb3cc; /* 深色底上的主色：側邊欄目前項目指示線、圖表第二色 */
  /* 狀態色（文字色 + 底色成對使用） */
  --info: #1c5ea6;      --info-soft: #e3edf9;
  --success: #1d7536;   --success-soft: #e2f2e6;
  --warning: #935600;   --warning-soft: #fbefd8;
  --danger: #b1241c;    --danger-soft: #fbe3e0;
  --focus-ring: #1c5ea6;
  /* 字體 */
  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* 間距（4px 格線） */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  /* 圓角 */
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 10px;
  /* 尺寸 */
  --control-sm: 28px; --control-md: 36px;
  --row-compact: 32px; --row-default: 40px;
  --shadow-pop: 0 4px 16px rgba(16, 33, 31, .12), 0 1px 3px rgba(16, 33, 31, .08);
}

/* ---------- 2. 基礎 ---------- */
body { font-family: var(--font-sans); font-size: 14px; line-height: 22px; color: var(--ink); background: var(--bg); }
.content-wrapper, .main-footer { background: var(--bg); }
.main-footer { border-top: 1px solid var(--border); color: var(--ink-subtle); font-size: 12px; padding: var(--space-3) var(--space-6); }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4, h5, h6 { color: var(--ink); }
.text-muted { color: var(--ink-muted) !important; }
.text-subtle { color: var(--ink-subtle) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* 數字與代碼 */
.text-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.text-code { font-family: var(--font-mono); font-size: 12px; }
.num-negative { color: var(--danger); }

/* 字級 */
.page-title { font-size: 22px; line-height: 30px; font-weight: 600; margin: 0; }
.section-title { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0; }
.caption { font-size: 12px; line-height: 18px; color: var(--ink-subtle); }
.label-text { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--ink-muted); }

/* ---------- 3. 版面：頂部列與側邊欄 ---------- */
.main-header.navbar { background: var(--surface); border-bottom: 1px solid var(--border); min-height: 56px; }
.main-header .nav-link { color: var(--ink-muted); }
.main-header .nav-link:hover { color: var(--ink); }

.main-sidebar, .main-sidebar .sidebar { background: var(--sidebar) !important; }
.main-sidebar { box-shadow: none !important; }
.brand-link { border-bottom: 1px solid rgba(255, 255, 255, .08) !important; color: #fff !important; font-weight: 700; letter-spacing: .04em; display: flex !important; align-items: center; gap: var(--space-2); }
.brand-mark { width: 28px; height: 28px; border-radius: var(--radius-md); background: var(--primary); display: inline-block; flex-shrink: 0; margin-left: 4px; }
.nav-sidebar .nav-header { color: var(--on-sidebar); opacity: .6; font-size: 12px; padding: var(--space-4) var(--space-4) var(--space-1); }
.sidebar-dark-primary .nav-sidebar .nav-link { color: var(--on-sidebar); border-radius: var(--radius-md); font-size: 14px; }
.sidebar-dark-primary .nav-sidebar .nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
.sidebar-dark-primary .nav-sidebar .nav-treeview .nav-link.active {
  background: rgba(255, 255, 255, .12) !important; color: #fff !important; box-shadow: inset 3px 0 0 var(--primary-light, #4fb3cc) !important; font-weight: 500;
}
.sidebar-dark-primary .nav-sidebar .menu-open > .nav-link { background: transparent; color: #fff; }
.nav-sidebar .nav-icon { color: var(--on-sidebar); opacity: .85; }

.content-wrapper > .content-header { padding: var(--space-6) var(--space-6) var(--space-4); }
.content-wrapper > .content { padding: 0 var(--space-6) var(--space-6); }
.content-header .breadcrumb { background: none; padding: 0; margin: 0 0 var(--space-1); font-size: 12px; }
.breadcrumb-item, .breadcrumb-item + .breadcrumb-item::before { color: var(--ink-subtle); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- 4. 卡片 ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: none; background: var(--surface); margin-bottom: var(--space-4); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--space-3) var(--space-4); display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.card-header::after { display: none; }
.card-title { font-size: 16px; line-height: 24px; font-weight: 600; float: none; }
.card-body { padding: var(--space-4); }
.card-footer { background: var(--surface); border-top: 1px solid var(--border); padding: var(--space-3) var(--space-4); }

/* ---------- 5. 按鈕 ---------- */
.btn { font-size: 13px; font-weight: 500; line-height: 20px; height: var(--control-md); padding: 0 var(--space-3); border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn-sm { height: var(--control-sm); padding: 0 var(--space-2); font-size: 12px; }
.btn:focus, .btn.focus { box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover, .btn-primary:not(:disabled):not(.disabled):active { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn-default, .btn-secondary, .btn-outline-secondary { background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink); }
.btn-default:hover, .btn-secondary:hover, .btn-outline-secondary:hover { background: var(--surface-sunken); border-color: var(--border-strong); color: var(--ink); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-hover); }
.btn-outline-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: var(--control-sm); padding: 0; }

/* ---------- 6. 表單 ---------- */
label, .col-form-label { font-size: 13px; line-height: 20px; font-weight: 500 !important; color: var(--ink-muted); margin-bottom: var(--space-1); }
.required::after { content: " *"; color: var(--danger); }
.form-control, .custom-select { height: var(--control-md); font-size: 14px; color: var(--ink); background-color: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 0 var(--space-3); }
textarea.form-control { height: auto; padding: var(--space-2) var(--space-3); }
.form-control-sm, .custom-select-sm { height: var(--control-sm); font-size: 13px; padding: 0 var(--space-2); }
.form-control::placeholder { color: var(--ink-subtle); opacity: 1; }
.form-control:focus, .custom-select:focus { border-color: var(--focus-ring); box-shadow: 0 0 0 1px var(--focus-ring); }
.form-control[readonly], .form-control:disabled { background: var(--surface-sunken); }
.form-control.is-invalid { border-color: var(--danger); background-image: none; padding-right: var(--space-3); }
.invalid-feedback { color: var(--danger); font-size: 12px; line-height: 18px; }
.form-text { color: var(--ink-subtle); font-size: 12px; line-height: 18px; }
.form-group { margin-bottom: var(--space-4); }
.input-group-text { background: var(--surface-sunken); border-color: var(--border-strong); color: var(--ink-muted); font-size: 13px; }
.custom-control-input:checked ~ .custom-control-label::before { background-color: var(--primary); border-color: var(--primary); }
.custom-control-label { color: var(--ink); font-weight: 400 !important; }
.custom-control-label::before { border-color: var(--border-strong); }

/* ---------- 7. 表格 ---------- */
.table { color: var(--ink); font-size: 13px; line-height: 20px; margin-bottom: 0; }
.table thead th { background: var(--surface-sunken); color: var(--ink-muted); font-weight: 500; border-top: 0; border-bottom: 1px solid var(--border); padding: 6px var(--space-3); white-space: nowrap; vertical-align: middle; position: sticky; top: 0; z-index: 1; }
.table td { border-top: 1px solid var(--border); padding: 0 var(--space-3); height: var(--row-default); vertical-align: middle; white-space: nowrap; }
.table td.wrap { white-space: normal; }
.table-compact td { height: var(--row-compact); }
.table-hover tbody tr:hover { background: var(--surface-sunken); color: var(--ink); }
.table tbody tr.is-selected, .table tbody tr.is-selected:hover { background: var(--primary-soft); }
.table tfoot td { background: var(--surface-sunken); font-weight: 600; }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: auto; background: var(--surface); }
.card > .table-responsive, .card > .table-wrap { border: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.col-check { width: 40px; }

/* ---------- 8. 狀態徽章 ---------- */
.ored-badge { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 12px; line-height: 18px; font-weight: 500; padding: 1px var(--space-2); border-radius: var(--radius-sm); white-space: nowrap; }
.ored-badge::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.ored-badge-neutral { color: var(--ink-muted); background: var(--surface-sunken); }
.ored-badge-info { color: var(--info); background: var(--info-soft); }
.ored-badge-success { color: var(--success); background: var(--success-soft); }
.ored-badge-warning { color: var(--warning); background: var(--warning-soft); }
.ored-badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-count { background: var(--primary-soft); color: var(--primary); border-radius: var(--radius-sm); padding: 0 6px; font-size: 12px; font-weight: 500; }

/* ---------- 9. 分頁、頁籤、提示 ---------- */
.pagination { margin: 0; }
.page-link { color: var(--ink); border-color: var(--border); font-size: 13px; min-width: 32px; text-align: center; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.page-item.disabled .page-link { color: var(--ink-subtle); }
.page-item:first-child .page-link { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.page-item:last-child .page-link { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.status-tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); overflow-x: auto; scrollbar-width: none; }
.status-tabs::-webkit-scrollbar { display: none; }
.status-tabs a { padding: var(--space-2) 0 10px; color: var(--ink-muted); font-size: 14px; white-space: nowrap; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.status-tabs a:hover { color: var(--ink); }
.status-tabs a.active { color: var(--primary); font-weight: 600; box-shadow: inset 0 -2px 0 var(--primary); }
.alert { border-radius: var(--radius-md); border: 0; font-size: 13px; line-height: 20px; padding: var(--space-2) var(--space-3); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-success { background: var(--success-soft); color: var(--success); }
.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-title { font-size: 16px; font-weight: 600; }
.dropdown-menu { border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); font-size: 13px; }
.dropdown-item.active, .dropdown-item:active { background: var(--primary-soft); color: var(--primary); }

/* ---------- 10. ORED 專用區塊 ---------- */
/* KPI 卡 */
.ored-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); height: 100%; }
.ored-kpi-label { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--ink-muted); }
.ored-kpi-value { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--ink); }
.ored-kpi-delta { font-size: 12px; line-height: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ored-kpi-delta.is-good { color: var(--success); }
.ored-kpi-delta.is-bad { color: var(--danger); }
.ored-kpi-delta span { color: var(--ink-subtle); font-weight: 400; margin-left: var(--space-1); }

/* 篩選列 */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; padding: var(--space-3) var(--space-4); background: var(--surface); border-bottom: 1px solid var(--border); }
.filter-bar .form-group { margin: 0; }
.filter-bar label { font-size: 12px; margin-bottom: 2px; }
.bulk-bar { display: none; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--primary-soft); color: var(--ink); font-size: 13px; border-bottom: 1px solid var(--border); }
.bulk-bar.is-visible { display: flex; }
.list-footer { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); font-size: 13px; color: var(--ink-muted); flex-wrap: wrap; }

/* 資料欄位（明細頁的標籤 + 值） */
.data-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4) var(--space-6); margin: 0; }
.data-list dt { font-size: 12px; line-height: 18px; font-weight: 500; color: var(--ink-muted); margin-bottom: 2px; }
.data-list dd { margin: 0; font-size: 14px; line-height: 22px; color: var(--ink); }

/* 底部固定動作列（表單頁） */
.sticky-actions { position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-6); background: var(--surface); border-top: 1px solid var(--border); margin: 0 calc(-1 * var(--space-6)); }
.sticky-actions .spacer { margin-right: auto; color: var(--ink-subtle); font-size: 12px; align-self: center; }

/* 合計區 */
.totals { margin-left: auto; width: 320px; max-width: 100%; font-size: 14px; }
.totals .row-line { display: flex; justify-content: space-between; padding: var(--space-1) 0; }
.totals .row-line span:last-child { font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 1px solid var(--border); margin-top: var(--space-1); padding-top: var(--space-2); font-weight: 600; font-size: 16px; }

/* 簽核歷程 */
.timeline-ored { list-style: none; margin: 0; padding: 0; }
.timeline-ored li { position: relative; padding: 0 0 var(--space-4) 24px; }
.timeline-ored li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -4px; width: 2px; background: var(--border); }
.timeline-ored li:last-child::before { display: none; }
.timeline-ored li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 6px; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline-ored li.is-done::after { background: var(--success); border-color: var(--success); }
.timeline-ored li.is-current::after { background: var(--warning); border-color: var(--warning); }
.timeline-ored .who { font-weight: 500; font-size: 14px; }
.timeline-ored .when { font-size: 12px; color: var(--ink-subtle); }
.timeline-ored .note { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }

/* 待辦清單 */
.todo-list-ored { list-style: none; margin: 0; padding: 0; }
.todo-list-ored li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); border-top: 1px solid var(--border); font-size: 13px; }
.todo-list-ored li:first-child { border-top: 0; }
.todo-list-ored .grow { flex: 1; min-width: 0; }
.todo-list-ored .meta { color: var(--ink-subtle); font-size: 12px; }

/* 篩選列中佔滿剩餘寬度的欄位（例如關鍵字） */
.ored-filter-grow { flex: 1; min-width: 220px; }

/* 空狀態 */
.empty-state { text-align: center; padding: var(--space-8) var(--space-4); color: var(--ink-muted); }
.empty-state .fas { font-size: 28px; color: var(--ink-subtle); margin-bottom: var(--space-2); }

/* Toast */
.ored-toast-wrap { position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: 2000; display: flex; flex-direction: column; gap: var(--space-2); }
.ored-toast { background: var(--ink); color: #fff; border-radius: var(--radius-md); padding: var(--space-2) var(--space-4); font-size: 13px; box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: var(--space-2); }
.ored-toast .fas { color: #71c78e; }

/* ---------- 手機與窄螢幕 ---------- */
@media (max-width: 576px) {
  .content-wrapper > .content-header, .content-wrapper > .content { padding-left: var(--space-4); padding-right: var(--space-4); }
  .filter-bar .form-group { width: 100%; flex: 1 1 100% !important; }
  .filter-bar input[type="date"] { min-width: 0; flex: 1; }
  .sticky-actions { margin: 0 calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4); }
  .sticky-actions .spacer { display: none; }
}

/* ---------- 公司與分店階層列表 ---------- */
.company-toggle-column { width: 42px; min-width: 42px; padding-left: 12px !important; padding-right: 4px !important; text-align: center; }
.company-toggle { width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-subtle); }
.company-toggle:hover { background: var(--primary-soft); color: var(--primary); }
.company-toggle .fas { font-size: 10px; }
.company-sort { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; white-space: nowrap; }
.company-sort:hover, .company-sort.is-active { color: var(--primary); }
.company-sort .fas { width: 10px; color: var(--ink-subtle); font-size: 10px; }
.company-sort.is-active .fas { color: var(--primary); }
.text-num .company-sort { margin-left: auto; }
.company-row { cursor: pointer; }
.table .company-row td { height: 62px; background: var(--surface); }
.company-row:hover td { background: var(--surface-sunken); }
.company-name-cell { display: flex; min-width: 210px; align-items: center; gap: 10px; }
.company-name-cell > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.company-name-cell strong { color: var(--ink); font-weight: 650; }
.company-name-cell small { max-width: 340px; overflow: hidden; color: var(--ink-subtle); font-size: 11px; line-height: 17px; text-overflow: ellipsis; white-space: nowrap; }
.company-avatar { width: 32px; height: 32px; display: inline-flex; flex: 0 0 32px; align-items: center; justify-content: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.company-avatar.is-store { width: 28px; height: 28px; flex-basis: 28px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-muted); }
.company-store-count { display: inline-flex; margin-left: 8px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-muted); font-size: 11px; line-height: 18px; font-weight: 500; vertical-align: 1px; }
.table .company-store-row td { height: 54px; background: var(--surface-sunken); border-top-color: var(--border); }
.company-store-row:hover td { background: var(--primary-soft); }
.company-store-row td:nth-child(2) { position: relative; }
.company-store-row td:nth-child(2)::before { content: ""; position: absolute; left: 17px; top: -1px; bottom: -1px; border-left: 1px solid var(--border-strong); }
.company-store-row td:nth-child(2)::after { content: ""; position: absolute; left: 17px; top: 50%; width: 15px; border-top: 1px solid var(--border-strong); }
.company-store-row.is-last td:nth-child(2)::before { bottom: 50%; border-radius: 0 0 0 7px; }
.company-store-name { padding-left: 26px; }
.company-hq-badge { display: inline-flex; margin-right: 3px; padding: 0 5px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.company-revenue { font-weight: 600; font-variant-numeric: tabular-nums; }
.company-revenue.is-current { color: var(--primary); }
.company-period-switch { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-muted); }
.company-period-switch button { min-width: 58px; padding: 6px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-muted); font-size: 13px; font-weight: 600; }
.company-period-switch button:hover { color: var(--primary); }
.company-period-switch button.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 49, 48, .12); }
.company-no-store { height: 52px !important; padding-left: 32px !important; }
.company-total-revenue { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.company-trend-button { display: inline-flex; height: 28px; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--ink-muted); font-size: 11px; font-weight: 600; }
.company-trend-button:hover, .company-trend-button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.company-trend-button .fas { font-size: 10px; }
.table .company-trend-row td { padding: 0; border-top: 0; background: var(--surface-sunken); }
.company-trend-panel { margin: 14px 14px 14px 60px; padding: 16px 18px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.company-trend-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 4px; }
.company-trend-head > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.company-trend-summary { display: flex; gap: 26px; }
.company-trend-summary span { display: flex; min-width: 110px; flex-direction: column; align-items: flex-end; }
.company-trend-summary small { color: var(--ink-subtle); font-size: 11px; }
.company-trend-summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.company-trend-chart { height: 230px; }
.company-trend-state { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--ink-muted); }
.company-trend-state.is-error { color: var(--danger); }

@media (max-width: 768px) {
  #companyTable { min-width: 1040px; }
  .company-trend-panel { margin-left: 48px; }
}

/* ---------- 12. 列印（單據列印時隱藏介面） ---------- */
@media print {
  .main-header, .main-sidebar, .main-footer, .page-actions, .sticky-actions, .no-print { display: none !important; }
  .content-wrapper { margin-left: 0 !important; background: #fff; }
  .card { border: 0; }
}

/* 發票開立視窗：紙本／Email 寄送方式 */
.ored-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.ored-choice-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 78px;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.ored-choice-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.ored-choice-card input {
  margin-top: 4px;
}
.ored-choice-card span,
.ored-choice-card small {
  display: block;
}
.ored-choice-card strong {
  color: var(--ink);
}
.ored-choice-card small {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}
@media (max-width: 575.98px) {
  .ored-choice-grid { grid-template-columns: 1fr; }
}

/* 月費帳單：電子發票摘要與操作 */
.ored-invoice-cell {
  min-width: 220px;
  padding: 9px 0;
}
.ored-invoice-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}
.ored-invoice-summary .text-code {
  margin: 0 !important;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .025em;
}
.ored-invoice-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ored-invoice-actions .btn {
  min-width: 58px;
  padding-right: 9px;
  padding-left: 9px;
}
.ored-invoice-actions .btn i {
  width: 12px;
  font-size: 11px;
}
.ored-invoice-actions .btn-outline-danger {
  background: var(--surface);
}
.ored-invoice-actions .btn-outline-danger:hover {
  background: var(--danger-soft);
}

/* ---------- 儀表板 ---------- */
.dashboard-kpi-link { color: inherit; text-decoration: none; transition: border-color .16s ease, transform .16s ease; }
.dashboard-kpi-link:hover { color: inherit; text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); }
.dashboard-customer-summary { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; color: var(--ink-muted); font-size: 12px; line-height: 20px; text-decoration: none; }
.dashboard-customer-summary strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.dashboard-customer-summary .fas { margin-left: 2px; color: var(--ink-subtle); font-size: 9px; transition: transform .16s ease; }
.dashboard-customer-summary:hover { color: var(--primary); text-decoration: none; }
.dashboard-customer-summary:hover strong { color: var(--primary); }
.dashboard-customer-summary:hover .fas { color: var(--primary); transform: translateX(2px); }
.dashboard-kpis .ored-kpi { position: relative; min-height: 150px; padding-right: 58px; }
.dashboard-kpi-icon { position: absolute; top: var(--space-4); right: var(--space-4); width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.dashboard-kpi-icon.is-primary { color: var(--primary); background: var(--primary-soft); }
.dashboard-kpi-icon.is-success { color: var(--success); background: var(--success-soft); }
.dashboard-kpi-icon.is-warning { color: var(--warning); background: var(--warning-soft); }
.dashboard-kpi-icon.is-info { color: var(--info); background: var(--info-soft); }
.dashboard-kpi-icon.is-danger { color: var(--danger); background: var(--danger-soft); }
.revenue-rule-caption { display: grid; gap: 3px; line-height: 1.55; }
.revenue-rule-caption > span { display: block; }
.revenue-rule-caption strong { color: var(--ink); font-weight: 600; }
.dashboard-total-revenue { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }
.dashboard-page .dashboard-money { font-size: 22px; white-space: nowrap; }
.dashboard-chart { height: 286px; }
.dashboard-chart-card .card-body { padding-bottom: var(--space-3); }
.dashboard-page .card { border-radius: var(--radius-lg); overflow: hidden; }
.dashboard-page .card > .card-header:first-child {
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
}

.dashboard-payment-list { display: flex; flex-direction: column; padding-top: var(--space-2); padding-bottom: var(--space-2); }
.dashboard-payment-list > div { display: grid; grid-template-columns: minmax(100px, 1fr) auto; align-items: center; column-gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.dashboard-payment-list > div:last-child { border-bottom: 0; }
.dashboard-payment-list span { color: var(--ink-muted); }
.dashboard-payment-list strong { min-width: 76px; justify-self: end; font-size: 16px; font-variant-numeric: tabular-nums; text-align: right; }
.dashboard-payment-list small { grid-column: 2; min-width: 76px; justify-self: end; color: var(--ink-subtle); font-variant-numeric: tabular-nums; text-align: right; }
.dashboard-status-dot { display: inline-block; width: 8px; height: 8px; margin-right: var(--space-2); border-radius: 50%; background: var(--ink-subtle); }
.dashboard-status-dot.is-success { background: var(--success); }
.dashboard-status-dot.is-warning { background: var(--warning); }
.dashboard-status-dot.is-danger { background: var(--danger); }
.dashboard-payment-header-actions { display: flex; align-items: center; gap: var(--space-3); }
.dashboard-overdue-alert { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 999px; color: var(--danger); background: var(--danger-soft); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.dashboard-attention-list { display: flex; flex-direction: column; }
.dashboard-attention-item { min-height: 64px; padding: var(--space-2) var(--space-4); display: flex; align-items: center; gap: var(--space-3); border-bottom: 1px solid var(--border); color: var(--ink); text-decoration: none; }
.dashboard-attention-item:last-child { border-bottom: 0; }
.dashboard-attention-item:hover { background: var(--surface-sunken); color: var(--ink); text-decoration: none; }
.dashboard-attention-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; flex: 0 0 34px; align-items: center; justify-content: center; color: var(--ink-muted); background: var(--surface-sunken); }
.dashboard-attention-icon.is-danger { color: var(--danger); background: var(--danger-soft); }
.dashboard-attention-icon.is-warning { color: var(--warning); background: var(--warning-soft); }
.dashboard-attention-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.dashboard-attention-copy strong { font-size: 13px; font-weight: 600; }
.dashboard-attention-copy small { color: var(--ink-subtle); }
.dashboard-attention-value { display: inline-flex; align-items: center; gap: var(--space-3); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashboard-attention-value .fas { color: var(--ink-subtle); font-size: 10px; }
.dashboard-loading { padding: var(--space-6); color: var(--ink-subtle); text-align: center; }
.dashboard-rank { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink-muted); background: var(--surface-sunken); font-weight: 600; }
.dashboard-ranking-table tbody tr:first-child .dashboard-rank { color: var(--primary); background: var(--primary-soft); }
.dashboard-rank-money { color: var(--ink); font-weight: 600; }

.dashboard-feature-card { margin-top: var(--space-3); }
.dashboard-feature-period { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-sunken); }
.dashboard-feature-period button { min-width: 58px; padding: 6px 12px; border: 0; border-radius: 6px; color: var(--ink-muted); background: transparent; font-size: 12px; font-weight: 600; }
.dashboard-feature-period button:hover { color: var(--primary); }
.dashboard-feature-period button.active { color: var(--primary); background: var(--surface); box-shadow: 0 1px 3px rgba(15, 49, 48, .12); }
.dashboard-feature-card > .card-body { padding: var(--space-3) var(--space-4); }
.dashboard-feature-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); }
.dashboard-feature-tabs button { min-width: 0; padding: 13px 14px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--border); border-radius: 12px; color: var(--ink); background: var(--surface); text-align: left; transition: border-color .16s ease, background-color .16s ease, transform .16s ease; }
.dashboard-feature-tabs button:hover { border-color: var(--border-strong); background: var(--surface-sunken); transform: translateY(-1px); }
.dashboard-feature-tabs button.active { border-color: color-mix(in srgb, var(--primary) 42%, var(--border)); background: var(--primary-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent); }
.dashboard-feature-tabs button > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.dashboard-feature-tabs small { color: var(--ink-muted); font-size: 11px; font-weight: 600; }
.dashboard-feature-tabs strong { margin-top: 1px; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashboard-feature-tabs em { margin-top: 1px; color: var(--ink-subtle); font-size: 9px; font-style: normal; line-height: 1.45; }
.feature-tab-icon { width: 34px; height: 34px; display: inline-flex; flex: 0 0 34px; align-items: center; justify-content: center; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.feature-tab-icon.is-used { color: #7c65b5; background: #f0ecfa; }
.feature-tab-icon.is-repair { color: var(--warning); background: var(--warning-soft); }
.feature-tab-icon.is-attendance { color: var(--success); background: var(--success-soft); }
.feature-tab-icon.is-inventory { color: #597487; background: #edf3f6; }
.dashboard-feature-rules { margin-top: var(--space-3); padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-sunken); }
.dashboard-feature-rules-title { display: flex; align-items: center; gap: 9px; color: var(--primary); }
.dashboard-feature-rules-title > i { font-size: 13px; }
.dashboard-feature-rules-title > span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.dashboard-feature-rules-title strong { color: var(--ink); font-size: 12px; }
.dashboard-feature-rules-title small { color: var(--ink-subtle); font-size: 10px; }
.dashboard-feature-rule-grid { margin-top: 11px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dashboard-feature-rule-grid > div { min-width: 0; padding: 0 12px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--border); }
.dashboard-feature-rule-grid > div:first-child { padding-left: 0; }
.dashboard-feature-rule-grid > div:last-child { padding-right: 0; border-right: 0; }
.dashboard-feature-rule-grid strong { color: var(--ink); font-size: 11px; font-weight: 650; }
.dashboard-feature-rule-grid span { color: var(--ink-muted); font-size: 10px; line-height: 1.55; }
.dashboard-feature-status-rule { margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--border); color: var(--ink-subtle); font-size: 10px; }
.dashboard-feature-status-rule strong { color: var(--ink-muted); font-weight: 650; }
.dashboard-feature-ranking-head { min-height: 58px; padding: 10px var(--space-4); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-sunken); }
.dashboard-feature-ranking-head > div:first-child { display: flex; flex-direction: column; }
.dashboard-feature-legend { display: flex; align-items: center; gap: 12px; color: var(--ink-subtle); font-size: 10px; white-space: nowrap; }
.dashboard-feature-legend span::before { content: ''; width: 6px; height: 6px; margin-right: 5px; display: inline-block; border-radius: 50%; background: var(--ink-subtle); vertical-align: 1px; }
.dashboard-feature-legend .is-active::before { background: var(--success); }
.dashboard-feature-legend .is-occasional::before { background: var(--warning); }
.dashboard-feature-legend .is-inactive::before { background: var(--danger); }
.dashboard-feature-table-wrap { max-height: 520px; overflow-y: auto; }
.dashboard-feature-table { margin-bottom: 0; }
.dashboard-feature-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-sunken); }
.dashboard-feature-table tbody tr { cursor: pointer; }
.dashboard-feature-table td { vertical-align: middle; }
.dashboard-feature-table th:first-child, .dashboard-feature-table td:first-child { width: 70px; }
.dashboard-feature-pagination { min-height: 54px; padding: 9px var(--space-4); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); border-top: 1px solid var(--border); }
.dashboard-pagination-buttons { display: flex; align-items: center; gap: 4px; }
.dashboard-pagination-buttons button { min-width: 32px; height: 32px; padding: 0 8px; color: var(--ink-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 7px; font-size: 12px; font-weight: 600; }
.dashboard-pagination-buttons button:hover:not(:disabled) { color: var(--primary); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.dashboard-pagination-buttons button.active { color: var(--on-primary); background: var(--primary); border-color: var(--primary); }
.dashboard-pagination-buttons button:disabled { cursor: not-allowed; opacity: .42; }
.dashboard-pagination-buttons > span { min-width: 20px; color: var(--ink-subtle); text-align: center; }
.dashboard-rank.is-empty { color: var(--ink-subtle); background: transparent; }
.feature-usage-status { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.feature-usage-status i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--ink-subtle); }
.feature-usage-status.is-active { color: var(--success); }
.feature-usage-status.is-active i { background: var(--success); }
.feature-usage-status.is-occasional { color: var(--warning); }
.feature-usage-status.is-occasional i { background: var(--warning); }
.feature-usage-status.is-inactive { color: var(--danger); }
.feature-usage-status.is-inactive i { background: var(--danger); }
.feature-usage-detail { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.feature-usage-detail strong { font-size: 12px; font-weight: 650; }
.feature-usage-detail small, .feature-last-used { color: var(--ink-subtle); font-size: 10px; }
.feature-usage-detail.is-previous strong { color: var(--ink-muted); font-weight: 600; }
.feature-company-disabled { margin-left: 7px; padding: 2px 6px; border-radius: 8px; color: var(--ink-subtle); background: var(--surface-sunken); font-size: 9px; font-weight: 600; }

@media (max-width: 576px) {
  .dashboard-kpis .col-6 { padding-left: 6px; padding-right: 6px; }
  .dashboard-kpis { margin-left: -6px; margin-right: -6px; }
  .dashboard-kpis .ored-kpi { min-height: 138px; padding: var(--space-3); }
  .dashboard-kpi-icon { display: none; }
  .dashboard-kpis .ored-kpi-value { font-size: 22px; }
  .dashboard-money { font-size: 18px !important; }
  .dashboard-chart { height: 230px; }
  .dashboard-feature-tabs { display: flex; overflow-x: auto; }
  .dashboard-feature-tabs button { min-width: 150px; }
  .dashboard-feature-rule-grid { grid-template-columns: 1fr; gap: 8px; }
  .dashboard-feature-rule-grid > div { padding: 0 0 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .dashboard-feature-rule-grid > div:last-child { padding-bottom: 0; border-bottom: 0; }
  .dashboard-feature-ranking-head { align-items: flex-start; flex-direction: column; }
  .dashboard-feature-legend { overflow-x: auto; max-width: 100%; }
  .dashboard-feature-pagination { align-items: flex-start; flex-direction: column; }
  .dashboard-pagination-buttons { max-width: 100%; overflow-x: auto; }
}

/* ========================================================================
   13. 清新版總後台主題
   延續 super_admin 的白底、藍綠色與低對比層次；只覆寫外觀，不改功能。
   ======================================================================== */
:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-sunken: #f5f8f9;
  --border: #e3e8ed;
  --border-strong: #d5dde4;
  --ink: #17212b;
  --ink-muted: #596774;
  --ink-subtle: #7b8792;
  --primary: #148c9c;
  --primary-hover: #0f6f7d;
  --primary-soft: #e8f6f7;
  --on-primary: #ffffff;
  --sidebar: #ffffff;
  --on-sidebar: #596774;
  --primary-light: #148c9c;
  --success: #168262;
  --success-soft: #e8f6f0;
  --warning: #a66b1b;
  --warning-soft: #fff4e5;
  --danger: #b5474f;
  --danger-soft: #fff0f1;
  --info: #4e6bb3;
  --info-soft: #eef2ff;
  --focus-ring: #148c9c;
  --radius-sm: 7px;
  --radius-md: 9px;
  --radius-lg: 14px;
  --shadow-pop: 0 12px 32px rgba(23, 33, 43, .10), 0 2px 6px rgba(23, 33, 43, .05);
}

body {
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* 避免窄視窗時 AdminLTE 版面寬度溢出，產生整頁底部橫向捲軸。 */
html,
body {
  max-width: 100%;
  overflow-x: hidden !important;
}

.wrapper {
  max-width: 100%;
  overflow-x: hidden !important;
}

.content-wrapper,
.main-footer {
  background: var(--bg);
}

/* 白色側邊欄 */
.main-sidebar,
.main-sidebar .sidebar {
  background: var(--sidebar) !important;
}

.main-sidebar {
  border-right: 1px solid var(--border);
  box-shadow: none !important;
}

.brand-link {
  display: flex !important;
  align-items: center;
  gap: 11px;
  min-height: 64px;
  padding: 13px 22px !important;
  color: var(--ink) !important;
  border-bottom: 0 !important;
  font-size: 15px;
  letter-spacing: .01em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  margin-left: 0;
  place-items: center;
  background: var(--primary);
  border-radius: 10px;
  box-shadow: 0 7px 18px rgba(20, 140, 156, .18);
}

.brand-mark::after {
  color: #fff;
  content: "OR";
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
}

.brand-text {
  color: var(--ink);
  font-weight: 750;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  color: var(--ink-subtle);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
}

.main-sidebar {
  display: flex;
  flex-direction: column;
  overflow-x: hidden !important;
}

.main-sidebar > .sidebar {
  display: flex;
  height: auto !important;
  min-height: 0;
  padding: 0 14px 16px;
  flex: 1;
  flex-direction: column;
  overflow-x: hidden !important;
}

.main-sidebar > .sidebar > nav {
  width: 100%;
  min-width: 0;
  flex: 1;
}

.nav-sidebar .nav-header {
  padding: 20px 11px 7px;
  color: #9aa5af;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .1em;
  opacity: 1;
}

.sidebar-dark-primary .nav-sidebar .nav-link {
  min-height: 42px;
  margin: 2px 0;
  padding: 10px 11px;
  color: var(--ink-muted);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  transition: background-color .16s ease, color .16s ease, transform .16s ease;
}

.sidebar-dark-primary .nav-sidebar .nav-link:not(.active):hover,
.sidebar-dark-primary .nav-sidebar .nav-link:not(.active):focus-visible {
  background: #eef8f9 !important;
  color: var(--primary-hover) !important;
  transform: translateX(2px);
}

.sidebar-dark-primary .nav-sidebar .nav-link:not(.active):hover .nav-icon,
.sidebar-dark-primary .nav-sidebar .nav-link:not(.active):focus-visible .nav-icon {
  color: var(--primary);
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
.sidebar-dark-primary .nav-sidebar .nav-treeview .nav-link.active {
  background: var(--primary-soft) !important;
  color: var(--primary-hover) !important;
  box-shadow: none !important;
  font-weight: 700;
}

.nav-sidebar .nav-icon,
.sidebar-dark-primary .nav-sidebar .nav-link.active .nav-icon {
  color: currentColor;
  opacity: .9;
}

/* 和舊版一致的側欄帳號卡片 */
.ored-sidebar-footer {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 11px;
  padding: 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ored-account-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ored-account-status .connection-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: #2ca87e;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(44, 168, 126, .11);
}

.ored-account-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.ored-account-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ored-account-copy small {
  color: var(--ink-subtle);
  font-size: 10px;
  letter-spacing: .03em;
}

.ored-logout-button {
  width: 100%;
  min-height: 32px;
  background: #fff;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 650;
}

.ored-logout-button:hover {
  color: var(--danger);
  border-color: #eccdd0;
}

@media (min-width: 992px) {
  body:not(.sidebar-collapse) .main-sidebar {
    width: 250px;
  }

  body:not(.sidebar-collapse) .main-header,
  body:not(.sidebar-collapse) .content-wrapper,
  body:not(.sidebar-collapse) .main-footer {
    margin-left: 250px;
  }

  body.sidebar-collapse .ored-sidebar-footer {
    display: none;
  }
}

/* 頂部列與內容寬度 */
.main-header.navbar {
  min-height: 64px;
  padding-right: 22px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.main-header .nav-link {
  color: var(--ink-muted);
  border-radius: 8px;
}

.main-header .nav-link:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.content-wrapper > .content-header,
.content-wrapper > .content {
  width: min(100%, 1310px);
  /* margin-right: auto;
  margin-left: auto; */
}

.content-wrapper > .content-header {
  padding-top: 14px;
  padding-bottom: 10px;
  /* padding-top: 34px; */
  /* padding-bottom: 20px; */
}

.page-title {
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -.035em;
}

.caption {
  color: var(--ink-subtle);
}

/* 卡片與資料區塊 */
.card,
.ored-kpi,
.table-wrap {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 7px 24px rgba(23, 33, 43, .045);
}

.card-header {
  min-height: 54px;
  padding: 14px 18px;
}

.card-title {
  font-size: 16px;
  font-weight: 720;
}

.ored-kpi {
  padding: 18px 20px;
}

.ored-kpi-label {
  color: var(--ink-subtle);
  font-size: 12px;
  font-weight: 650;
}

.ored-kpi-value {
  font-size: 27px;
  font-weight: 720;
  letter-spacing: -.025em;
}

.filter-bar {
  padding: 16px 18px;
  background: var(--surface);
}

.card > .filter-bar:first-child {
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
  background-clip: padding-box;
}

.form-control,
.custom-select {
  border-color: var(--border-strong);
  border-radius: 9px;
}

.form-control:focus,
.custom-select:focus {
  border-color: #76bac3;
  box-shadow: 0 0 0 3px rgba(20, 140, 156, .10);
}

.btn {
  border-radius: 9px;
  font-weight: 650;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 5px 14px rgba(20, 140, 156, .14);
}

.btn-default,
.btn-secondary,
.btn-outline-secondary {
  border-color: var(--border-strong);
}

.status-tabs {
  gap: 22px;
}

.status-tabs a.active {
  color: var(--primary-hover);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.table thead th {
  padding: 9px 12px;
  background: #f8fafb;
  color: #7d8994;
  border-color: var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .035em;
}

.table td {
  height: 48px;
  border-color: var(--border);
}

.table-hover tbody tr:hover {
  background: #f8fbfc;
}

.ored-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.main-footer {
  color: var(--ink-subtle);
  border-color: var(--border);
}

/* 與 super_admin 一致的登入頁 */
.ored-login-body {
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(185, 227, 231, .38), transparent 27rem),
    radial-gradient(circle at 90% 90%, rgba(226, 237, 229, .55), transparent 30rem),
    #f4f7f8;
}

.ored-login-page {
  display: grid;
  min-height: 100vh;
  padding: 32px 18px;
  place-items: center;
}

.ored-login-card {
  width: min(440px, 100%);
  padding: 36px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(215, 225, 230, .9);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(23, 33, 43, .10);
  backdrop-filter: blur(12px);
}

.ored-login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.ored-login-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ored-login-brand-copy strong {
  color: var(--ink);
  font-size: 14px;
}

.ored-login-brand-copy small {
  color: var(--ink-subtle);
  font-size: 10px;
  letter-spacing: .05em;
}

.ored-login-heading {
  margin: 38px 0 26px;
}

.ored-login-heading p {
  margin: 0 0 8px;
  color: var(--primary-hover);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .12em;
}

.ored-login-heading h1 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -.03em;
}

.ored-login-heading > span {
  color: var(--ink-subtle);
  font-size: 13px;
}

.ored-login-card .alert {
  margin-bottom: 18px;
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.5;
}

.ored-login-form {
  display: grid;
  gap: 17px;
}

.ored-login-form .form-group {
  margin: 0;
}

.ored-login-form label:not(.custom-control-label) {
  margin-bottom: 7px;
  color: #465562;
  font-size: 12px;
  font-weight: 650;
}

.ored-login-form .form-control {
  height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border-color: var(--border);
  border-radius: 9px;
}

.ored-login-form .form-control:focus {
  border-color: #72b7c0;
  box-shadow: 0 0 0 3px rgba(20, 140, 156, .11);
}

.ored-login-form .pw-wrap {
  position: relative;
}

.ored-login-form .pw-wrap .form-control {
  padding-right: 64px;
}

.ored-login-form .pw-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  height: 34px;
  padding: 0 10px;
  background: transparent;
  color: var(--primary);
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
}

.ored-login-form .pw-toggle:hover {
  background: var(--primary-soft);
}

.ored-login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink-subtle);
  font-size: 11px;
}

.ored-login-options .custom-control-label {
  color: #596774;
  font-size: 12px;
}

.ored-login-form #btnLogin {
  height: 44px;
  margin-top: 5px;
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 9px;
  font-weight: 700;
  transition: background-color .15s ease, transform .15s ease;
}

.ored-login-form #btnLogin:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.ored-login-form #btnLogin:active {
  transform: translateY(1px);
}

.ored-security-note {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 25px 0 0;
  color: var(--ink-subtle);
  font-size: 11px;
}

.ored-security-note span {
  color: #2ca87e;
  font-size: 9px;
}

@media (max-width: 576px) {
  .ored-login-page {
    padding: 18px 12px;
  }

  .ored-login-card {
    padding: 28px 22px;
    border-radius: 14px;
  }

  .ored-login-options {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .content-wrapper > .content-header {
    padding-top: 24px;
  }
}

/* =====================================================================
   客戶管理（2026-11-19）：客戶總覽／客戶詳情／報表
   手機優先：業務多在外面用手機；≥992px 時列表改成表格排列
   ===================================================================== */
.cm-meta { font-size: 12px; color: var(--ink-subtle); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.cm-meta i { margin-right: 3px; }
.cm-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.cm-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.cm-kpi:hover, .cm-kpi.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.cm-kpi .k { font-size: 12px; color: var(--ink-muted); display: block; }
.cm-kpi .v { font-size: 24px; font-weight: 700; line-height: 32px; color: var(--ink); font-variant-numeric: tabular-nums; }
.cm-kpi .s { font-size: 12px; color: var(--ink-subtle); }
.cm-kpi.is-warn .v { color: var(--warning); } .cm-kpi.is-danger .v { color: var(--danger); } .cm-kpi.is-success .v { color: var(--success); }
@media (min-width: 768px) { .cm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.cm-toolbar { padding: 8px 0 6px; margin: 0 0 6px; }
.cm-search { position: relative; }
.cm-search input { height: 46px; padding-left: 40px; font-size: 16px; border-radius: 12px; }
.cm-search i { position: absolute; left: 14px; top: 15px; color: var(--ink-subtle); }
.cm-chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cm-chips::-webkit-scrollbar { display: none; }
.cm-chip { flex: none; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-muted); font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.cm-chip .n { font-size: 12px; color: var(--ink-subtle); }
.cm-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.cm-chip.active .n { color: rgba(255,255,255,.85); }
.cm-chip-label { flex: none; font-size: 12px; color: var(--ink-subtle); align-self: center; padding-right: 2px; }
.cm-sortbar { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-muted); margin: 6px 0 8px; gap: 8px; }
.cm-sortbar select { height: 34px; font-size: 14px; border-radius: 8px; max-width: 60%; }

/* 版本使用狀態膠囊 */
.vp { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 13px; font-size: 12px; font-weight: 600; background: var(--surface-sunken); color: var(--ink-subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vp b { font-weight: 700; }
.vp em { font-style: normal; font-weight: 500; opacity: .9; }
.vp::before { content: ""; width: 7px; height: 7px; border-radius: 4px; background: currentColor; opacity: .85; }
.vp.lv-active { background: var(--success-soft); color: var(--success); }
.vp.lv-light { background: var(--info-soft); color: var(--info); }
.vp.lv-dormant { background: var(--warning-soft); color: var(--warning); }
.vp.lv-stopped { background: var(--surface-sunken); color: var(--ink-subtle); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.vp.lv-none { background: transparent; color: #b9c0be; border: 1px dashed #d7dcda; }
.vp.lv-none::before { display: none; }
.vps { display: flex; gap: 6px; flex-wrap: wrap; }

/* 客戶列表：手機是卡片，桌機是表格列 */
.cm-list { display: flex; flex-direction: column; gap: 10px; }
.cm-item { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; color: var(--ink); text-decoration: none !important; }
.cm-item:active { background: var(--surface-sunken); }
.cm-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cm-item .nm { font-size: 16px; font-weight: 600; line-height: 22px; word-break: break-all; }
.cm-item .cd { font-size: 12px; color: var(--ink-subtle); font-weight: 500; margin-top: 2px; }
.cm-item .mid { margin: 10px 0 8px; }
.cm-item .bot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); flex-wrap: wrap; }
.cm-item .warn { font-size: 12px; color: var(--warning); margin-top: 6px; }
.cm-head { display: none; }
.ct-expired { color: var(--danger); font-weight: 600; } .ct-due30 { color: var(--danger); font-weight: 600; } .ct-due90 { color: var(--warning); font-weight: 600; } .ct-none { color: var(--ink-subtle); }
.mg { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.mg-legacy_only { background: #eef0ef; color: var(--ink-muted); } .mg-migrating { background: var(--warning-soft); color: var(--warning); }
.mg-migrated { background: var(--success-soft); color: var(--success); } .mg-new { background: var(--primary-soft); color: var(--primary); } .mg-idle { background: transparent; color: var(--ink-subtle); border: 1px solid var(--border); }
@media (min-width: 992px) {
  .cm-list { gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
  .cm-head, .cm-item { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(230px, 1.4fr) 180px 220px 76px; gap: 14px; align-items: center; }
  .cm-item .c-mig, .cm-item .c-ct { white-space: nowrap; }
  .cm-head { padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--ink-muted); background: var(--surface-sunken); border-bottom: 1px solid var(--border); }
  .cm-item { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 10px 16px; }
  .cm-item:hover { background: var(--primary-soft); }
  .cm-item .top, .cm-item .mid, .cm-item .bot { display: contents; }
  .cm-item .mid { margin: 0; }
  .cm-item .c-mig, .cm-item .c-ct, .cm-item .c-st { font-size: 13px; }
  .cm-item .warn { grid-column: 1 / -1; margin: -4px 0 0; }
  .cm-toolbar { position: static; }
}
.cm-empty { text-align: center; color: var(--ink-subtle); padding: 40px 0; }
.cm-more { display: block; width: 100%; height: 44px; margin: 12px 0; border-radius: 12px; }

/* 客戶詳情 */
.cd-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.cd-head h1 { font-size: 22px; line-height: 30px; margin: 0; word-break: break-all; }
.cd-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cd-back { display: inline-flex; align-items: center; gap: 6px; height: 36px; color: var(--ink-muted); font-size: 14px; margin-bottom: 4px; }
.cd-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.cd-card h2 { font-size: 15px; font-weight: 700; margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cd-ver { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.cd-ver:first-of-type { border-top: 0; padding-top: 0; }
.cd-ver .vn { font-size: 18px; font-weight: 800; color: var(--ink); line-height: 26px; }
.cd-ver .st { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cd-ver .nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.cd-ver .nums div { background: var(--surface-sunken); border-radius: 8px; padding: 6px 8px; }
.cd-ver .nums small { display: block; font-size: 11px; color: var(--ink-subtle); line-height: 16px; }
.cd-ver .nums b { font-size: 15px; font-variant-numeric: tabular-nums; }
.cd-ver .mods { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }
.cd-kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 10px; font-size: 14px; }
.cd-kv dt { color: var(--ink-subtle); font-weight: 500; } .cd-kv dd { margin: 0; font-weight: 500; }
.cd-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.cd-actions .btn { height: 44px; border-radius: 10px; }
.cd-chart { position: relative; height: 220px; }
.cd-sug { background: var(--warning-soft); color: var(--warning); border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.cd-sug .btn { height: 34px; flex: none; }
.cd-log { list-style: none; padding: 0; margin: 0; }
.cd-log li { padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
.cd-log li:first-child { border-top: 0; }
.cd-log .who { color: var(--ink-subtle); font-size: 12px; }
.cd-stores { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.cd-stores li { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; border-top: 1px solid var(--border); }
.cd-stores li:first-child { border-top: 0; }
.cd-note { font-size: 13px; color: var(--ink-muted); background: var(--surface-sunken); border-radius: 10px; padding: 10px 12px; }
.cd-danger { border-color: #f1c4c0; }
@media (min-width: 992px) { .cd-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; align-items: start; } .cd-actions { grid-template-columns: repeat(2, max-content); } }

/* 底部彈出視窗（手機）／一般對話框（桌機） */
@media (max-width: 575.98px) {
  .modal.cm-sheet .modal-dialog { margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: none; transform: translateY(100%); transition: transform .25s ease-out; }
  .modal.cm-sheet.show .modal-dialog { transform: none; }
  .modal.cm-sheet .modal-content { border-radius: 18px 18px 0 0; border: 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal.cm-sheet .modal-footer .btn { flex: 1; height: 46px; }
}
.cm-sheet input[type=date], .cm-sheet input, .cm-sheet select, .cm-sheet textarea { font-size: 16px; }
.cm-sheet input[type=date] { height: 44px; }

/* 報表 */
.rp-month { margin-bottom: 14px; }
.rp-month h3 { font-size: 14px; font-weight: 700; margin: 0 0 6px; display: flex; justify-content: space-between; }
.rp-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; color: var(--ink); text-decoration: none !important; }
.rp-row .l { min-width: 0; } .rp-row .l b { display: block; font-size: 15px; } .rp-row .l small { color: var(--ink-subtle); }
.rp-row .r { text-align: right; font-size: 13px; flex: none; }
.rp-bars { display: grid; gap: 8px; }
.rp-bar { display: grid; grid-template-columns: 90px 1fr 44px; gap: 8px; align-items: center; font-size: 13px; }
.rp-bar .t { height: 12px; background: var(--surface-sunken); border-radius: 6px; overflow: hidden; }
.rp-bar .t span { display: block; height: 100%; border-radius: 6px; background: var(--primary); }
.rp-bar b { text-align: right; font-variant-numeric: tabular-nums; }

/* 手機底部導覽（客戶總覽、報表、儀表板） */
.cm-tabbar { display: none; }
@media (max-width: 767.98px) {
  .cm-tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0,0,0,.04); }
  .cm-tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 56px; font-size: 11px; color: var(--ink-subtle); gap: 3px; text-decoration: none; }
  .cm-tabbar a i { font-size: 18px; }
  .cm-tabbar a.active { color: var(--primary); font-weight: 600; }
  body.has-tabbar .content-wrapper { padding-bottom: 72px; }
  body.has-tabbar .main-footer { margin-bottom: 64px; }
}
@media (min-width: 992px) {
  .cm-item .c-name { order: 1; } .cm-item .c-ver { order: 2; } .cm-item .c-mig { order: 3; } .cm-item .c-ct { order: 4; } .cm-item .c-st { order: 5; } .cm-item .warn { order: 6; }
}

/* 2026-11-19 調整 */
.alert-warning a { color: var(--warning); font-weight: 700; text-decoration: underline; }

/* =====================================================================
   開票（2026-11-19，原 ored/ops 併入）：開票總覽／新增開票／審核開立／作廢查詢
   手機是卡片、≥992px 變表格列；共用 JS 在 assets/js/invoicing.js
   ===================================================================== */
.iv-monthbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.iv-monthbar input { max-width: 180px; height: 40px; font-size: 16px; }
.iv-monthbar .btn { height: 40px; }
.iv-kv { font-size: 20px !important; }
.iv-list { display: flex; flex-direction: column; gap: 10px; }
.iv-head { display: none; }
.iv-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; }
.iv-item.is-voided { opacity: .65; }
.iv-item > * { min-width: 0; }
.iv-item .iv-c, .iv-item .iv-items, .iv-item .iv-pay-cell, .iv-item .iv-act { grid-column: 1 / -1; }
.iv-item .iv-c { grid-column: 1; }
.iv-item .iv-amt { grid-column: 2; grid-row: 1; font-size: 17px; font-weight: 700; text-align: right; white-space: nowrap; }
.iv-item .nm { font-size: 16px; font-weight: 600; line-height: 22px; word-break: break-all; }
.iv-item .cd { font-size: 12px; color: var(--ink-subtle); margin-top: 2px; }
.iv-code { margin-right: 6px; font-size: 12px; color: var(--ink-muted); background: var(--surface-sunken); padding: 1px 6px; border-radius: 4px; }
.iv-other { margin-right: 6px; font-size: 12px; color: var(--info); background: var(--info-soft); padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.iv-items { font-size: 13px; color: var(--ink-muted); }
.iv-it { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
.iv-it span:first-child { min-width: 0; word-break: break-all; }
.iv-st { grid-column: 1 / -1; font-size: 13px; }
.iv-st .text-code { font-weight: 600; }
.iv-pay-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.iv-pay, .iv-note { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 16px; height: 32px; padding: 0 12px; font-size: 13px; color: var(--ink-muted); display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.iv-pay.is-paid { background: var(--success-soft); border-color: transparent; color: var(--success); font-weight: 600; }
.iv-pay small { font-weight: 500; }
.iv-note { background: var(--warning-soft); border-color: transparent; color: var(--warning); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-note.is-empty { background: transparent; border-style: dashed; color: var(--ink-subtle); }
.iv-act { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.iv-act:empty { display: none; }
.iv-btns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.iv-manual { display: flex; gap: 6px; margin-top: 6px; }
.iv-manual input { max-width: 150px; }
.iv-remark { font-size: 13px; margin-top: 6px; }
.iv-money { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; font-size: 13px; }
.iv-money span { color: var(--ink-subtle); } .iv-money b { text-align: right; font-weight: 500; } .iv-money b.big { font-weight: 700; font-size: 15px; }
.iv-review .iv-item { grid-template-columns: 28px 1fr; }
.iv-review .iv-chk { grid-row: 1 / span 1; grid-column: 1; padding-top: 2px; }
.iv-review .iv-c { grid-column: 2; }
.iv-review .iv-items, .iv-review .iv-amtcol, .iv-review .iv-st, .iv-review .iv-act { grid-column: 1 / -1; }
.iv-voids .iv-item { grid-template-columns: 1fr auto; }
.iv-voids .iv-item > :nth-child(2) { grid-column: 1; } .iv-voids .iv-item > :nth-child(4), .iv-voids .iv-item > :nth-child(5), .iv-voids .iv-item > :nth-child(6) { grid-column: 1 / -1; }
.iv-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; position: sticky; top: 57px; z-index: 5; }
.iv-track { font-size: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
.iv-done { list-style: none; padding: 0; margin: 8px 0; } .iv-done li { padding: 4px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* 新增開票 */
.iv-search input { height: 46px; }
.iv-suggest { border: 1px solid var(--border); border-radius: 12px; margin-top: 6px; max-height: 320px; overflow-y: auto; background: var(--surface); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.iv-sug { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 12px 14px; font-size: 15px; color: var(--ink); }
.iv-sug:last-child { border-bottom: 0; } .iv-sug:hover, .iv-sug:focus { background: var(--primary-soft); }
.iv-sug .cd { font-size: 12px; color: var(--ink-subtle); flex: none; }
.iv-sug-empty { padding: 14px; font-size: 13px; color: var(--ink-muted); }
.iv-picked-main { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; background: var(--primary-soft); border-radius: 12px; padding: 12px 14px; }
.iv-picked-main .nm { font-size: 17px; font-weight: 700; }
.iv-picked-main .cd { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }
.iv-picked-act { display: flex; gap: 6px; }
.iv-row { display: grid; grid-template-columns: 1fr 120px 36px; gap: 6px; margin-bottom: 6px; }
.iv-row input { height: 44px; font-size: 16px; }
.iv-total { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 14px 0 6px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; }
.iv-total dt { font-weight: 500; color: var(--ink-muted); } .iv-total dd { margin: 0; text-align: right; }
.iv-total .big { font-size: 18px; font-weight: 700; color: var(--ink); }
.iv-submit .btn { min-width: 200px; height: 46px; }
@media (max-width: 575.98px) { .iv-submit .btn { width: 100%; } .iv-row { grid-template-columns: 1fr 96px 32px; } }
@media (min-width: 992px) {
  .iv-list { gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
  .iv-head, .iv-list .iv-item { display: grid; grid-template-columns: minmax(170px, 1.3fr) minmax(160px, 1.2fr) 120px minmax(150px, 1fr) 190px 150px; gap: 12px; align-items: start; }
  .iv-head { padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--ink-muted); background: var(--surface-sunken); border-bottom: 1px solid var(--border); }
  .iv-list .iv-item { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 10px 16px; }
  .iv-list .iv-item:hover { background: var(--surface-sunken); }
  .iv-list .iv-item > * { grid-column: auto !important; grid-row: auto !important; }
  .iv-item .iv-amt { text-align: right; font-size: 15px; }
  .iv-act { flex-direction: column; align-items: flex-end; }
  .iv-act:empty { display: block; }
  .iv-pay-cell { flex-direction: column; align-items: flex-start; }
  .iv-review .iv-head, .iv-review .iv-item { grid-template-columns: 28px minmax(200px, 1.4fr) minmax(160px, 1.2fr) 170px minmax(200px, 1.3fr) 80px; }
  .iv-voids .iv-head, .iv-voids .iv-item { grid-template-columns: minmax(170px, 1.3fr) 130px 120px minmax(160px, 1.2fr) 120px 130px; }
}
/* 客戶詳情：客戶資料、開票紀錄 */
.cd-profile-form h6 { font-size: 13px; font-weight: 700; color: var(--ink-muted); margin: 14px 0 8px; }
.cd-profile-form h6:first-of-type { margin-top: 0; }
.cd-inv { list-style: none; padding: 0; margin: 0; }
.cd-inv li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.cd-inv li:first-child { border-top: 0; padding-top: 0; }
.cd-inv .r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.cm-kpi .iv-kv { display: block; line-height: 30px; }
