:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #d9dde3;
  --primary: #1f6feb;
  --primary-text: #ffffff;
  --danger: #c62828;
  --success-bg: #e6f4ea;
  --error-bg: #fdecea;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--primary); }
h1 { font-size: 1.5rem; margin: 0 0 16px; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }

/* 上方列 */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.role-switch { display: flex; align-items: center; gap: 8px; }
.role-switch label { color: var(--muted); font-size: .9rem; }
.role-switch select { min-height: 40px; padding: 4px 8px; font-size: 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
.role-badge, .tag { white-space: nowrap;
  display: inline-block; padding: 2px 10px; margin: 2px 4px 2px 0;
  background: #e8f0fe; color: #174ea6; border-radius: 999px; font-size: .9rem;
}
.user-menu { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-menu form { margin: 0; }
.user-name { color: var(--muted); }

/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 1rem; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-block { width: 100%; }

/* 卡片與表單 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.form-narrow { max-width: 480px; }
.field { margin-bottom: 16px; }
.field > label { display: block; margin-bottom: 4px; font-weight: 600; }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=file], .field input[type=date], .field input:not([type]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem;
}
.field ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.field ul label, .checkbox { display: inline-flex; align-items: center; gap: 6px; font-weight: normal; min-height: 36px; }
.field input[type=checkbox] { width: 20px; height: 20px; }
.help { display: block; color: var(--muted); }
.error { display: block; color: var(--danger); }
.field-error input { border-color: var(--danger); }
.form-errors { background: var(--error-bg); color: var(--danger); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 16px; }
.form-errors p { margin: 0; }
.muted { color: var(--muted); }

/* 訊息 */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.message { padding: 10px 14px; border-radius: var(--radius); background: var(--success-bg); }
.message-error { background: var(--error-bg); color: var(--danger); }

/* 登入 */
.login-box { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.login-box .card { text-align: left; }

/* 首頁功能卡 */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.feature-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px; min-height: 120px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
a.feature-card:hover { border-color: var(--primary); }
.feature-card strong { font-size: 1.15rem; }
.feature-card span { color: var(--muted); }

/* 表格 */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th { background: #fafbfc; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.row-muted td { color: var(--muted); }
.actions a { margin-right: 12px; }
.inline-form { display: inline; margin: 0; }
.link-button { border: none; background: none; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }
.link-danger { color: var(--danger); }
.danger-zone { margin-top: 12px; }

h2 { font-size: 1.15rem; margin: 24px 0 12px; }
.small { font-size: .9rem; }
.num { text-align: right !important; }

/* 搜尋列 */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-bar input {
  flex: 1; min-width: 0; min-height: 48px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 1.05rem;
}

/* 庫存（依料號分組） */
.row-warn td { background: #fff8e1; }
.warn-tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: #f9a825; color: #fff; font-size: .8rem; font-weight: normal; }

/* 匯入 */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; }
.stat span { color: var(--muted); }
.stat b { font-size: 1.6rem; }
.card-error { border-color: var(--danger); background: var(--error-bg); margin-bottom: 16px; }
.card-warn { border-color: #f9a825; background: #fff8e1; margin-bottom: 16px; }
.card-error h2, .card-warn h2 { margin-top: 0; }
.button-row { display: flex; gap: 12px; margin: 16px 0; }
.button-row form { margin: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }

.text-danger { color: var(--danger); }
.text-today { color: var(--primary); }
.pre { white-space: pre-wrap; }

/* 分頁籤 */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; }
.tab-active { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
.search-bar select { min-height: 48px; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; max-width: 100%; }

/* 訂單狀態 */
.status { white-space: nowrap; display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; vertical-align: middle; }
.status-pending { background: #eceff1; color: #455a64; }
.status-scheduled { background: #e8f0fe; color: #174ea6; }
.status-ready { background: #fff3cd; color: #8a6100; }
.status-shipped { background: #e6f4ea; color: #1e7e34; }
.status-cancelled { background: #f5f5f5; color: #9e9e9e; text-decoration: line-through; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #f8fafd; }

/* 打單畫面：左表單、右庫存 */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.order-main { display: flex; flex-direction: column; gap: 12px; }
.order-side { position: sticky; top: 12px; }
.form-section h2 { margin: 0 0 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.selected-item.field-error { border-color: var(--danger); }
.picker h2 { margin-top: 0; }
.picker input { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; }
.picker-results { max-height: 60vh; overflow-y: auto; margin-top: 8px; }
.picker-list { list-style: none; padding: 0; margin: 0; }
.picker-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.picker-info { flex: 1; min-width: 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; margin: 0; }

/* P/N 品項卡片 */
.add-line { border-style: dashed; }
.alloc-box.field-error { border-top-color: var(--danger); }
.qty-input { width: 90px; min-height: 40px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; text-align: right; }
.form-section .page-head h2 { margin: 0; }
.line-table td { vertical-align: top; }
.alloc-list { margin: 0; padding: 0; list-style: none; }

/* 打單：Excel 式 P/N 表格 */
.container-wide { max-width: 1560px; }
.container-wide .order-layout { grid-template-columns: minmax(0, 1fr) 320px; }
.grid-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.line-grid { border-collapse: collapse; width: max-content; min-width: 100%; table-layout: fixed; }
.line-grid th { background: #fafbfc; font-weight: 600; font-size: .85rem; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); border-right: 1px solid #eceff3; white-space: nowrap; }
.line-grid td { padding: 0; border-bottom: 1px solid #eceff3; border-right: 1px solid #eceff3; vertical-align: top; }
.line-grid td input[type=text]:not(.qty-input) { width: 100%; height: 38px; padding: 4px 8px; border: 2px solid transparent; background: transparent; font-size: .95rem; }
.line-grid td input[type=text]:not(.qty-input):focus { outline: none; border-color: var(--primary); background: #fff; }
.line-grid input.cell-error, .line-grid td.cell-error { background: var(--error-bg); }
.line-grid .col-no { width: 84px; text-align: center; color: var(--muted); font-size: .85rem; padding: 6px 4px; }
.row-no { font-weight: 600; }
.row-actions { display: flex; justify-content: center; align-items: center; gap: 2px; margin-top: 4px; }
.line-grid th.col-no { padding-top: 6px; }
.line-grid .col-pn { width: 210px; }
.line-grid .col-note { width: 150px; }
.line-grid .col-short { width: 96px; }
.line-grid .col-qty { width: 84px; }
.line-grid .col-alloc { width: 320px; padding: 4px 6px; }
.row-action { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; font-size: .8rem; padding: 3px 6px; cursor: pointer; }
.row-action:hover { border-color: var(--primary); color: var(--primary); }
.row-batch { display: block; margin: 2px auto 0; padding: 0 4px; font-size: .7rem; }
.split-row td { background: #f3e8fd; padding: 8px; font-size: .9rem; }
.split-row .qty-input { width: 70px; min-height: 32px; }
.line-grid .col-custom { width: 140px; }
.line-grid .col-date { width: 136px; }
.date-cell { position: relative; display: flex; align-items: center; }
.date-cell input[type=text] { flex: 1; min-width: 0; }
.date-button { border: none; background: none; cursor: pointer; padding: 0 6px; font-size: .9rem; opacity: .55; }
.date-button:hover { opacity: 1; }
.date-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.line-grid tr.row-active td { background: #f3f7fe; }
.line-grid tr.row-active td.col-no { box-shadow: inset 4px 0 0 var(--primary); color: var(--primary); font-weight: 600; }
.row-status { font-size: .7rem; color: var(--muted); }
.grid-error-row td { padding: 4px 8px; color: var(--danger); background: var(--error-bg); font-size: .85rem; }
.alloc-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; padding: 3px 0; font-size: .9rem; border-bottom: 1px dashed #eceff3; }
.alloc-chip:last-child { border-bottom: none; }
.alloc-chip .alloc-name { flex: 1 1 100%; overflow-wrap: anywhere; }
.alloc-chip .alloc-avail { margin-left: auto; }
.alloc-chip .qty-input { width: 56px; min-height: 30px; padding: 2px 6px; }
.alloc-hint { display: block; padding: 6px 2px; }
.imported-part { padding: 2px; color: #8a6100; }
.chip-remove { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: .95rem; padding: 4px 6px; border-radius: 4px; }
.chip-remove:hover { background: var(--error-bg); color: var(--danger); }
.closed-lines { margin-bottom: 12px; }
.grid-help { margin: 0 0 8px; }

/* 拆批 */
.tag-batch { background: #f3e8fd; color: #6a1b9a; }
.tag-item { background: #e3f2fd; color: #0d47a1; font-weight: 600; white-space: nowrap; }
.detail-lines tr.batch-child td { border-top-style: dashed; }
.tag-purchase { background: #fff3cd; color: #8a6100; }
.tag-short { background: var(--error-bg); color: var(--danger); }
.region-domestic { background: #e6f4ea; color: #1e7e34; }
.region-foreign { background: #e8f0fe; color: #174ea6; }
.region-other { background: #eceff1; color: #455a64; }
.purchase-flag input { width: 16px; height: 16px; margin: 0; }
.purchase-flag { display: inline-flex; white-space: nowrap; align-items: center; gap: 4px; font-size: .85rem; color: var(--muted); padding: 2px 6px; border-radius: 6px; cursor: pointer; margin-bottom: 2px; }
.purchase-flag.is-on { background: #fff3cd; color: #8a6100; font-weight: 600; }
.split-form .field input[type=number] { max-width: 160px; }
.split-form .field input[type=text] { max-width: 220px; }

/* 進貨／盤點 */
.sheet-grid { width: 100%; min-width: 640px; }
.sheet-grid .col-del { width: 40px; text-align: center; }
.sheet-grid .col-no { width: 48px; }
.sheet-meta { max-width: 640px; }
.preview-card { margin-bottom: 12px; }
.row-error td { background: var(--error-bg); }
.ack-check { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-weight: 600; white-space: nowrap; }
.ack-check input { width: 18px; height: 18px; }

/* 表頭固定：表格很長時在框內上下捲動，欄位標題一直留在框的最上面（所有表格） */
.table-wrap, .grid-wrap { max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); overflow: auto; }
.table thead th, .line-grid thead th { position: sticky; top: 0; z-index: 3; }
/* sticky 時表格框線不會跟著，用陰影畫表頭下緣 */
.table thead th { box-shadow: inset 0 -1px 0 var(--border); }
.line-grid thead th { box-shadow: inset 0 -1px 0 var(--border); }
.table thead .sticky-col { z-index: 4; }

.btn-danger { color: var(--danger); border-color: #e5a3a3; }
.btn-danger:hover { background: var(--error-bg); }

/* 拖曳欄位標題調整順序 */
th.col-draggable { cursor: grab; }
th.col-dragging { opacity: .4; }
th.col-drop { box-shadow: inset 3px 0 0 var(--primary); background: #e8f0fe; }
.col-order-bar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.col-order-bar[hidden] { display: none; }

/* 訂單／排程：自選顯示欄位 */
.col-picker { margin-bottom: 10px; }
.col-picker > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; }
.col-picker > summary::-webkit-details-marker { display: none; }
.col-picker-panel { margin-top: 8px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
/* 分類並排成好幾欄，每一欄由上往下列出欄位；窄螢幕自動換行 */
.col-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px 20px; margin-bottom: 8px; }
.col-picker fieldset { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; min-width: 0; }
.col-picker legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.col-picker label.checkbox { white-space: nowrap; min-height: 32px; display: inline-flex; align-items: center; gap: 4px; }
.m-line2 .m-field { display: inline-block; margin-right: 10px; }

/* 同一張單同一個 Item 拆出來的各批：淡紫底＋P/N 左邊紫色線連成一組；訂購數量是整個 Item 的合計 */
tr.batch-row > td:not(.pv-cell):not(.col-check) { background: #faf6fd; }
tr.batch-row > td.cell-pn, .line-grid tr.batch-row > td.col-no { box-shadow: inset 4px 0 0 #9575cd; }
/* 打單：拆批的 Item 仍是一列，出貨日等欄位顯示各批摘要，點一下打開拆批視窗 */
.line-grid td.cell-batches { padding: 4px 8px; cursor: pointer; font-size: .85rem; }
.line-grid td.cell-batches:hover { background: #efe6f8; }
.line-grid .batch-line { white-space: nowrap; }
.batch-dialog { width: min(920px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: inherit; }
.batch-dialog::backdrop { background: rgba(20, 30, 45, .35); }
.batch-dialog h2 { margin: 0 0 4px; font-size: 1.1rem; }
.batch-table { width: 100%; border-collapse: collapse; }
.batch-table th, .batch-table td { padding: 4px 6px; border-bottom: 1px solid #eceff3; text-align: left; vertical-align: middle; }
.batch-table input[type=text]:not(.qty-input) { width: 100%; min-width: 80px; min-height: 36px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; }
.batch-table .qty-input { width: 72px; min-height: 36px; }
.batch-actions { margin-top: 12px; align-items: center; }
.batch-sum { margin-right: auto; font-weight: 600; }
/* 訂單明細的 P/N 品項（樞紐分析表式）：Item／P/N、訂購數量是合併格 */
.pivot-lines td.pv-cell { vertical-align: top; background: #f6f8fb; border-right: 1px solid var(--border); white-space: normal; }
.pivot-lines tr.batch-row td.pv-cell { background: #f3ecfa; }
.pivot-lines tr.item-top > td { border-top: 2px solid #c5cdd8; }
tr.batch-next:not(.pv-top):not(.pv-sub) > td:not(.pv-cell) { border-top: 1px dashed #d1c4e9; }
.item-total { color: #6a1b9a; }
.m-item.batch-row { background: #faf6fd; box-shadow: inset 4px 0 0 #9575cd; }
.m-item.batch-next { border-top: 1px dashed #d1c4e9; }

/* 月盤進度 */
.progress { height: 8px; background: #eceff1; border-radius: 999px; overflow: hidden; margin: 6px 0 4px; }
.progress > div { height: 100%; background: #2e7d32; }
.done-mark { color: #1e7e34; font-weight: 600; white-space: nowrap; }
.todo-mark { color: var(--danger); font-weight: 600; }
.text-success { color: #1e7e34; }
.zone-tabs .tab small { margin-left: 2px; }
.count-progress .count-input { width: 90px; min-height: 40px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; text-align: right; }
.ship-day-form input { width: 100%; min-height: 40px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.ship-row { align-items: flex-start; }

/* 列印客戶排程表 */
.print-form { margin-bottom: 16px; }
.date-range { display: flex; align-items: center; gap: 6px; }
.date-range input { flex: 1; min-width: 0; }
.print-sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.print-head h2 { margin: 0 0 4px; }
.print-head p { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.print-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.print-table th, .print-table td { border: 1px solid #999; padding: 6px 8px; text-align: left; vertical-align: top; }
.print-table th { background: #f0f0f0; }
.print-table .blank-col { min-width: 90px; }
@media print {
  .topbar, .no-print, .messages { display: none !important; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
  .print-sheet { border: none; padding: 0; }
  .print-table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-table tr { page-break-inside: avoid; }
  .table-wrap, .grid-wrap { max-height: none; overflow: visible; }
  .table thead th, .line-grid thead th { position: static; }
  .tag { border: 1px solid #999; background: none; }
}

.option-list { list-style: none; padding: 0; margin: 0 0 12px; }
.option-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }

.table tr.group-start td { border-top: 2px solid #cfd5dd; }
.table tbody tr.group-start:first-child td { border-top: none; }
.row-today td { background: #eef4ff; }
.detail-lines td { white-space: normal; vertical-align: top; }
.row-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.row-buttons form { margin: 0; }
.batch-child td:first-child { padding-left: 28px; }

/* 訂單／排程篩選列 */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.filter-bar select, .filter-bar input[type=search], .filter-bar input[type=date] { min-height: 44px; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; background: var(--surface); }
.filter-bar input[type=search] { flex: 1; min-width: 180px; }
.filter-dates { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .9rem; }
.col-check { width: 36px; text-align: center; }
.bulk-bar { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; margin: 0; }

/* 表格太寬時的左右捲動提示 */
.scroll-frame { position: relative; }
.scroll-hint { display: none; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .85rem; color: var(--primary); }
.scroll-hint span { font-weight: 600; margin-right: auto; }
.scroll-frame.has-overflow > .scroll-hint { display: flex; }
.scroll-btn { min-height: 30px; padding: 2px 10px; }
.scroll-btn:disabled { opacity: .35; cursor: default; }
.scroll-shadow { position: absolute; top: 34px; bottom: 0; width: 28px; pointer-events: none; opacity: 0; transition: opacity .2s; z-index: 2; border-radius: var(--radius); }
.scroll-shadow-left { left: 0; background: linear-gradient(to right, rgba(31, 35, 40, .18), transparent); }
.scroll-shadow-right { right: 0; background: linear-gradient(to left, rgba(31, 35, 40, .18), transparent); }
.scroll-frame.more-left > .scroll-shadow-left, .scroll-frame.more-right > .scroll-shadow-right { opacity: 1; }
.scroll-frame.more-right .sticky-col { box-shadow: -8px 0 10px -8px rgba(31, 35, 40, .35); }
.table .sticky-col { position: sticky; right: 0; z-index: 1; background: var(--surface); }
.table thead .sticky-col { background: #fafbfc; }

/* T/T 付款提醒 */
.tt-banner { background: #fff3cd; border: 1px solid #f0c36d; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }
.tt-banner summary { cursor: pointer; font-weight: 600; color: #8a6100; }
.tt-banner ul { margin: 8px 0; padding-left: 20px; }
.purchase-banner .table-wrap { margin: 10px 0; background: var(--surface); }
.purchase-banner .button-row { margin-top: 6px; }
.tag-done { background: #e6f4ea; color: #1e7e34; }

/* 訂單／排程：列表、月曆切換與區塊 */
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; background: var(--surface); }
.view-option { padding: 6px 16px; color: var(--muted); text-decoration: none; font-weight: 600; }
.view-option + .view-option { border-left: 1px solid var(--border); }
.view-option.is-active { background: var(--primary); color: #fff; }
.list-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.sort-bar { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.sort-chip { padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; color: var(--text); text-decoration: none; background: var(--surface); }
.sort-chip.sorted { border-color: var(--primary); color: var(--primary); font-weight: 600; }

.calendar-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 6px; }
.calendar-nav h2 { margin: 0 8px; }
.calendar-unscheduled { margin-left: auto; font-size: .9rem; }
.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); }
.calendar th { padding: 6px; background: #fafbfc; border: 1px solid var(--border); font-weight: 600; }
.calendar th.weekend { color: var(--danger); }
.calendar td { vertical-align: top; border: 1px solid var(--border); height: 110px; padding: 4px 5px; }
.calendar td.other-month { background: #f7f8fa; }
.calendar td.other-month .calendar-date { color: #b0b7c3; }
.calendar td.is-today { background: #eef4ff; box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-date { font-weight: 700; font-size: .9rem; display: flex; align-items: baseline; gap: 4px; margin-bottom: 4px; }
.calendar-weekday { display: none; font-weight: normal; color: var(--muted); }
.calendar-count { margin-left: auto; font-size: .75rem; color: var(--muted); font-weight: normal; }
.calendar-entry { border-left: 4px solid var(--primary); background: #f3f6fa; border-radius: 4px; margin-bottom: 4px; font-size: .85rem; }
.calendar-entry summary { padding: 3px 6px; cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; }
.calendar-entry summary::-webkit-details-marker { display: none; }
.calendar-entry[open] { background: #fff; box-shadow: 0 2px 8px rgba(31, 35, 40, .15); position: relative; z-index: 3; }
.calendar-customer { font-weight: 600; }
.calendar-detail { padding: 4px 8px 8px; }
.calendar-detail ul { list-style: none; margin: 4px 0 0; padding: 0; }
.calendar-detail li { padding: 4px 0; border-top: 1px solid var(--border); }
.status-border-pending { border-left-color: #90a4ae; }
.status-border-scheduled { border-left-color: var(--primary); }
.status-border-ready { border-left-color: #f9a825; }
.status-border-shipped { border-left-color: #1e7e34; }
.status-border-cancelled { border-left-color: #bdbdbd; opacity: .7; }
.status-border-mixed { border-left-color: #6a1b9a; }

/* 排序 */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sortable a:hover { color: var(--primary); }
th.sortable a { color: inherit; text-decoration: none; display: block; }
th.sorted { color: var(--primary); }
.sort-arrow { font-size: .7rem; margin-left: 4px; }

/* 表頭 ▾ 篩選（像 Excel） */
.th-inner { display: flex; align-items: center; gap: 2px; }
.th-inner > a, .th-inner > span:first-child { flex: 1 1 auto; }
th.num .th-inner { justify-content: flex-end; }
.col-filter-btn { flex: none; border: 1px solid transparent; background: none; color: var(--muted); border-radius: 4px; padding: 0 4px; line-height: 1.4; cursor: pointer; font-size: .8rem; }
.col-filter-btn:hover { border-color: var(--border); color: var(--text); background: var(--surface); }
.col-filter-btn.is-on { background: var(--primary); color: var(--primary-text); }
.col-filter-pop { position: absolute; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.15); padding: 10px; font-size: .9rem; font-weight: normal; color: var(--text); }
.col-filter-pop .cf-title { font-weight: 600; margin-bottom: 6px; }
.col-filter-pop .cf-sorts { display: flex; flex-direction: column; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 8px; }
.col-filter-pop .cf-sort { padding: 4px 6px; border-radius: 4px; color: var(--text); text-decoration: none; }
.col-filter-pop .cf-sort:hover { background: var(--bg); }
.col-filter-pop .cf-range { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; }
.col-filter-pop .cf-range input { flex: 1 1 110px; min-width: 0; }
.col-filter-pop .cf-search { width: 100%; margin-bottom: 6px; }
.col-filter-pop .cf-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 4px; padding: 4px; }
.col-filter-pop .cf-item { display: flex; align-items: center; gap: 6px; padding: 3px 4px; min-height: 30px; cursor: pointer; }
.col-filter-pop .cf-item[hidden] { display: none; }
.col-filter-pop .cf-item:hover { background: var(--bg); }
.col-filter-pop .cf-label { flex: 1 1 auto; overflow-wrap: anywhere; }
.col-filter-pop .cf-count { color: var(--muted); font-size: .8rem; }
.col-filter-pop .cf-error { color: var(--danger); font-size: .85rem; min-height: 1em; margin: 4px 0; }
.col-filter-pop .cf-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.tag-filter { background: #e3edfd; color: #174ea6; }

/* 訂單明細 */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.detail-grid h2 { margin-top: 0; }
.dl { display: grid; grid-template-columns: 7.5em 1fr; gap: 6px 12px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.history-table td { white-space: normal; vertical-align: top; }

@media (max-width: 900px) {
  .order-layout { grid-template-columns: 1fr; }
  .order-side { position: static; order: -1; }
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  /* 手機：訂單、排程、庫存表每一列改成一張獨立的卡片，卡片之間留空隙 */
  .table-wrap:has(.line-table) { overflow: visible; max-height: none; background: transparent; border: none; border-radius: 0; }
  .line-table, .line-table tbody { display: block; }
  .line-table thead { display: none; }
  .line-table tr {
    display: block; margin-bottom: 12px; padding: 0 14px 8px;
    background: var(--surface); border: 1px solid #c9d0d9; border-left: 4px solid var(--primary);
    border-radius: var(--radius); box-shadow: 0 1px 3px rgba(31, 35, 40, .08);
  }
  .line-table tr.row-error { border-left-color: var(--danger); }
  .line-table tr.row-warn { border-left-color: #f9a825; }
  .line-table tr.row-today { border-left-color: var(--primary); }
  .line-table tr.group-start td { border-top: none; }
  .line-table td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: none; white-space: normal; text-align: right; background: transparent !important; }
  .line-table td::before { content: attr(data-label); color: var(--muted); text-align: left; flex-shrink: 0; }
  .line-table td:not([data-label])::before { content: ""; }
  /* 卡片第一格（料號、出貨日…）當作標題 */
  .line-table td:first-child { margin: 0 -14px 6px; padding: 10px 14px; background: #f3f6fa !important; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; font-size: 1.05rem; }
  .line-table td:first-child::before { font-size: .85rem; }
  .line-table td:first-child { flex-wrap: wrap; align-items: baseline; }
  .line-table td:first-child > div { flex-basis: 100%; text-align: right; }
  .line-table td.col-check { margin: 0; padding: 8px 0 0; background: transparent !important; border: none; justify-content: flex-start; }
  .line-table td.col-check + td { margin-top: 0; }
  .line-table .alloc-list { text-align: right; }
  .line-table td.hide-mobile { display: none; }
  .line-table td.actions { justify-content: flex-end; gap: 16px; padding-top: 8px; border-top: 1px dashed var(--border); margin-top: 4px; }
  .line-table .sticky-col { position: static; box-shadow: none !important; }
  .stock-available b { font-size: 1.5rem; }
  /* 手機的月曆改成只列出有出貨的日子 */
  .calendar, .calendar tbody, .calendar tr, .calendar td { display: block; width: 100%; }
  .calendar thead { display: none; }
  .calendar td { height: auto; border: none; border-bottom: 1px solid var(--border); padding: 8px 4px; }
  .calendar td:not(.has-entries) { display: none; }
  .calendar-weekday { display: inline; }
  .search-bar { flex-wrap: wrap; }

  .container { padding: 16px 12px 40px; }
  .user-name { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
}

/* 排程（樞紐分析表式）：出貨日／客戶／訂單合併成一格，組與組之間用粗細不同的線分開 */
.pivot-table td { vertical-align: top; }
.pivot-table td.pv-cell { background: #f6f8fb; border-right: 1px solid var(--border); white-space: normal; }
.pivot-table td.pv-day { min-width: 120px; background: #eef2f7; }
.pivot-table td.pv-customer { min-width: 140px; max-width: 220px; }
.pivot-table td.pv-order { min-width: 110px; }
.pivot-table td.pv-late { background: #fbe9e9; }
.pivot-table td.pv-today { background: #e3edfd; }
.pivot-table tr.pv-top > td { border-top: 3px solid #8fa1b8; }
.pivot-table tr.pv-sub > td { border-top: 1px solid #b8c3d1; }
.pivot-table tr.pv-done td:not(.pv-cell) { color: var(--muted); }
.pivot-table .pv-cell .tag { margin-top: 3px; }
.pivot-table .grp-check { float: right; margin: 2px 0 0 6px; }
.pivot-table .pv-pn { font-weight: 600; }
.pivot-table .alloc-list { margin: 0; padding: 0; list-style: none; }
.tag-today { background: var(--primary); color: #fff; }

/* 進貨：右側查現有料號 */
#lookup-q { width: 100%; margin-bottom: 8px; }
.lookup-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.lookup-item:hover { border-color: var(--primary); background: #f3f7fe; }
.lookup-none { padding: 8px 10px; border-radius: 6px; background: #fff8e1; font-size: .9rem; }

/* 排程手機版：分組標題由上往下，品項兩行 */
.pivot-mobile { display: none; }
@media (max-width: 720px) {
  .pivot-desktop { display: none; }
  .pivot-mobile { display: block; }
  .m-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .m-head .grp-check { order: 9; margin-left: auto; }
  .m-day { margin-top: 14px; padding: 8px 12px; border-radius: 8px 8px 0 0; background: #dfe6ef; font-size: 1.1rem; border-left: 5px solid #8fa1b8; }
  .m-day.m-late { background: #fbe9e9; border-left-color: var(--danger); }
  .m-day.m-today { background: #e3edfd; border-left-color: var(--primary); }
  .m-level1:not(.m-day) { margin-top: 14px; padding: 8px 12px; border-radius: 8px 8px 0 0; background: #dfe6ef; }
  .m-customer:not(.m-level1) { padding: 8px 12px 4px; background: #f1f4f8; border-top: 1px solid #c9d2de; }
  .m-order:not(.m-level1) { padding: 4px 12px 2px 22px; background: var(--surface); font-size: .95rem; border-top: 1px dashed #dbe3ee; }
  .m-edit { margin-left: auto; }
  .m-item { display: flex; gap: 8px; padding: 6px 12px 6px 22px; background: var(--surface); border-top: 1px solid #f0f2f5; }
  .m-done { opacity: .6; }
  .m-check { padding-top: 2px; }
  .m-main { flex: 1; min-width: 0; }
  .m-line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
  .m-pn { font-weight: 600; word-break: break-all; }
  .m-qty { white-space: nowrap; }
  .m-line2 .alloc-list { display: inline; margin: 0; padding: 0; list-style: none; }
  .m-line2 .alloc-list li { display: inline; }
  .m-line2 .alloc-list li + li::before { content: "、"; }
}

/* 替代料號、出庫、出貨日盤 */
.tag-sub { background: #e0f2f1; color: #00695c; }
.tag-picked { background: #e6f4ea; color: #1e7e34; }
.ship-count .pick-check { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; margin-right: 6px; }
.ship-count .pick-check input { width: 18px; height: 18px; margin: 0; }
.ship-count .pick-qty { width: 64px; }
.ship-count .pick-qty.is-off { opacity: .45; }
.ship-count .stock-count { width: 72px; }
.btn-link { border: none; background: none; padding: 0 2px; color: var(--danger); text-decoration: underline; cursor: pointer; font: inherit; }
.seg { display: inline-flex; gap: 4px; }
.note-input { max-width: 260px; }
.swap-dialog { width: min(1000px, 96vw); height: min(760px, 90vh); padding: 0; border: none; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.swap-dialog[open] { display: flex; flex-direction: column; }
.swap-dialog::backdrop { background: rgba(0,0,0,.4); }
.swap-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid #ddd; }
.swap-dialog iframe { flex: 1; width: 100%; border: none; }
/* 左側功能選單（同類功能放在同一個下拉選單） */
.nav-toggle { display: none; }
.page-with-nav { display: flex; align-items: flex-start; }
.page-with-nav > main { flex: 1 1 auto; min-width: 0; }
.side-nav { position: sticky; top: 0; flex: 0 0 200px; max-height: 100dvh; overflow-y: auto; padding: 12px 8px 24px; background: var(--surface); border-right: 1px solid var(--border); min-height: calc(100dvh - 60px); }
.side-nav a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text); text-decoration: none; }
.side-nav a:hover { background: #eef3fd; }
.side-nav a.is-active { background: #e8f0fe; color: #174ea6; font-weight: 600; }
.side-home { font-weight: 600; margin-bottom: 4px; }
.side-group { margin-top: 4px; }
.side-group summary { cursor: pointer; padding: 8px 12px; border-radius: 6px; font-size: .9rem; font-weight: 700; color: var(--muted); list-style: none; user-select: none; }
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary::after { content: "▾"; float: right; transition: transform .15s; }
.side-group:not([open]) summary::after { transform: rotate(-90deg); }
.side-group summary:hover { background: #f1f4f8; }
.side-group ul { list-style: none; margin: 0 0 4px; padding: 0 0 0 8px; }
.home-hint { color: var(--muted); }
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .page-with-nav { display: block; }
  .side-nav { display: none; }
  body.nav-open .side-nav { display: block; position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: 260px; max-height: none; box-shadow: 4px 0 20px rgba(0,0,0,.2); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.3); }
}
@media print {
  .side-nav, .nav-toggle { display: none !important; }
  .page-with-nav { display: block; }
}/* 出貨日盤：文字欄可以換行，表格不要太寬（出庫欄才不會被擠到右邊看不到） */
.ship-count td { white-space: normal; }
.ship-count td .pick-check, .ship-count td .tag { white-space: nowrap; }
.ship-count td.pv-item, .ship-count td.pv-customer { min-width: 150px; max-width: 240px; }
.ship-count .pick-check input { accent-color: var(--primary); }
/* 假勤：月曆（休假日紅字＋「(休) 名稱」） */
.att-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 460px); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .att-layout { grid-template-columns: 1fr; } }
.att-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.att-cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.att-cal-grid th { padding: 4px; font-size: .85rem; color: var(--muted); font-weight: 600; text-align: center; }
.att-cal-grid th.att-weekend { color: var(--danger); }
.att-day { height: 64px; padding: 4px; vertical-align: top; border: 1px solid var(--border); font-size: .8rem; background: var(--surface); }
.att-day .att-num { display: block; font-weight: 600; font-size: .95rem; color: var(--text); text-decoration: none; }
.att-day.is-other { background: #f8f9fb; }
.att-day.is-other .att-num { color: #b0b6bf; }
.att-day.is-off .att-num, .att-off { color: var(--danger); }
.att-day.is-off { background: #fff5f5; }
.att-off { font-weight: 600; display: block; line-height: 1.25; }
.att-makeup { color: #1e7e34; font-weight: 600; display: block; line-height: 1.25; }
.att-day.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.att-leave { display: block; margin-top: 2px; padding: 0 4px; border-radius: 4px; background: #e8f0fe; color: #174ea6; font-size: .75rem; }
.att-leave-annual { background: #e6f4ea; color: #1e7e34; }
.att-leave-comp { background: #f3e8fd; color: #6a1b9a; }
.att-leave-sick { background: #fff3cd; color: #8a6100; }
.att-leave-trip { background: #e0f2f1; color: #00695c; }

/* 團隊月曆：電腦看月曆，手機改成只列有人不在的日子 */
.team-cal .att-day { height: 92px; }
.team-cal .att-leave { white-space: normal; line-height: 1.3; padding: 1px 4px; }
.team-time { opacity: .8; font-size: .7rem; }
.team-reason { display: block; opacity: .8; font-size: .7rem; }
.team-cal-mobile { display: none; }
.team-day { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 8px 10px; margin-bottom: 8px; }
.team-day.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.team-day .att-leave { font-size: .85rem; padding: 3px 6px; margin-top: 4px; }
@media (max-width: 700px) {
  .team-cal-desktop { display: none; }
  .team-cal-mobile { display: block; }
}
.team-today-list { list-style: none; padding: 0; margin: 0; }
.team-today-list li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.team-today-list li:last-child { border-bottom: none; }
.att-picker .att-day { cursor: pointer; }
.att-picker .att-day:hover { outline: 2px solid #9ec0f7; }
.att-day.is-picked { background: #dbe8fd; }
.att-preview { font-size: 1.05rem; }
.hire-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.hire-form label { width: 100%; font-weight: 600; }
.hire-form input { min-height: 36px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); }

/* 填表格像 Excel：圈選多格、調整欄寬（static/js/grid_tools.js） */
.line-grid td.cell-selected, .line-grid td.cell-selected input[type=text] { background: #d6e4fc !important; }
.line-grid td.cell-selected { box-shadow: inset 0 0 0 1px #7aa7f0; }
.line-grid.grid-selecting input { user-select: none; caret-color: transparent; }
.grid-status { margin: 6px 0 0; padding: 4px 10px; border-radius: 6px; background: #eef3fd; color: #174ea6; display: inline-block; }
.line-grid th { position: sticky; }
.line-grid .col-resize { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 6; }
.line-grid .col-resize:hover, body.col-resizing .line-grid .col-resize:hover { background: rgba(31, 111, 235, .35); }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none !important; }
.line-grid.has-custom-widths { width: max-content; min-width: 0; }
@media print { .col-resize, .grid-status { display: none !important; } }
/* 進貨分配：預覽表格可以換行（不要右滑）；按「分配」跳出置中的視窗 */
.preview-card .table th, .preview-card .table td { white-space: normal; padding: 8px 10px; }
.preview-card .table td.num, .preview-card .table th.num { white-space: nowrap; }
.alloc-cell { min-width: 120px; }
.alloc-cell .btn { white-space: nowrap; }
.alloc-dialog { width: min(760px, calc(100% - 24px)); }
.alloc-dialog[open] { display: flex; flex-direction: column; gap: 6px; }
.alloc-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.alloc-panel-head h2 { margin: 0; }
.alloc-summary { margin: 0; font-size: 1.05rem; }
.alloc-filter { width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; }
.alloc-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.alloc-table { width: 100%; }
.alloc-table th, .alloc-table td { white-space: normal; vertical-align: top; padding: 8px 6px; }
.alloc-table .alloc-check-col { width: 32px; }
.alloc-table input[type=checkbox] { width: 20px; height: 20px; }
.alloc-table input.alloc-qty { width: 4.5em; min-height: 36px; text-align: right; }
.alloc-foot { margin: 0; }
.input-error { border-color: var(--danger) !important; background: var(--error-bg); }/* 打單：選扣貨庫存改成跳出視窗，P/N 表格用整個畫面寬度 */
.picker-dialog[open] { display: flex; flex-direction: column; gap: 8px; }
.picker-dialog .picker-results { flex: 1; min-height: 120px; max-height: none; overflow-y: auto; }
.line-grid .col-alloc .pick-open { margin-top: 4px; min-height: 30px; padding: 2px 10px; }
.last-use { margin: 4px 0; padding: 4px 6px; border-radius: 6px; background: #f1f8e9; }
.last-use .btn-link { color: var(--primary); font-weight: 600; }/* 使用說明附註：功能旁邊的「?」 */
.help-tip { display: inline-block; position: relative; vertical-align: middle; margin-left: 4px; font-weight: normal; }
.help-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--primary); border-radius: 50%; background: var(--surface, #fff); color: var(--primary); font-size: 13px; font-weight: 700; line-height: 1; cursor: help; }
.help-btn:hover, .help-tip.is-open .help-btn { background: var(--primary); color: #fff; }
.help-btn-static { display: inline-flex; cursor: default; }
.help-pop { position: fixed; z-index: 1000; width: min(320px, calc(100vw - 16px)); padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: #fffde7; color: #333; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: .9rem; font-weight: normal; line-height: 1.5; text-align: left; white-space: normal; }
.help-pop[hidden] { display: none; }
.help-pop b { display: block; margin-bottom: 4px; }
.help-pop p { margin: 0 0 6px; }
.help-edit { display: inline-block; margin-top: 2px; font-size: .85rem; }
.help-note-field textarea { width: 100%; }
.help-note-field { margin-bottom: 14px; }
@media print { .help-tip { display: none !important; } }