/* 後台標準 UI（依 docs/通用模組文件/ui.html：滿版、不換行、緊湊、吸頂表頭、收合搜尋列、抽屜編輯） */
.std-h { display: flex; align-items: center; gap: .6rem; margin: .2rem 0 .7rem; flex-wrap: wrap; }
.std-h h1 { margin: 0; font-size: 1.4rem; }
.std-h .spacer { flex: 1; }
.stdbar { border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; margin-bottom: .5rem; }
.stdbar-head { display: flex; align-items: center; gap: .6rem; padding: .35rem .55rem; flex-wrap: wrap; }
.stdbar-toggle { border: 1px solid #cbd5e0; background: #f7fafc; border-radius: 6px; padding: .28rem .6rem; cursor: pointer; font-size: .82rem; }
.stdbar-quick { flex: 1 1 240px; }
.stdbar-quick input { width: 100%; padding: .32rem .5rem; border: 1px solid #cbd5e0; border-radius: 6px; }
.stdbar-count { font-size: .8rem; color: #718096; white-space: nowrap; }
.stdbar-actions { margin-left: auto; display: flex; gap: .4rem; }
.stdbar-body { padding: .5rem .55rem .6rem; border-top: 1px solid #edf2f7; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .45rem .8rem; }
.stdbar-body .f { display: flex; flex-direction: column; gap: .15rem; }
.stdbar-body .f label { font-size: .74rem; color: #718096; }
.stdbar-body .f input, .stdbar-body .f select { padding: .32rem .5rem; border: 1px solid #cbd5e0; border-radius: 6px; }
.stdbar-body .f-row { display: flex; gap: .3rem; }
.stdbar-body .f-row > * { flex: 1 1 0; min-width: 0; }
.stdgrid th .th-sort { border: 0; background: transparent; color: inherit; font: inherit; padding: 0; cursor: pointer; white-space: nowrap; }
.stdgrid th .th-sort:hover { text-decoration: underline; }
.chips { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin: .4rem 0; }
.chips .spacer { flex: 1; }
.chip { border: 1px solid #cbd5e0; background: #fff; border-radius: 999px; padding: .18rem .65rem; font-size: .8rem; cursor: pointer; color: #1a202c; white-space: nowrap; }
.chip.on { background: #2b4a6b; border-color: #2b4a6b; color: #fff; }
.stdscroll { width: 100%; overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.stdgrid { width: 100%; border-collapse: collapse; font-size: .84rem; }
.stdgrid th, .stdgrid td { padding: .34rem .55rem; border-bottom: 1px solid #edf2f7; white-space: nowrap; text-align: left; vertical-align: middle; }
.stdgrid thead th { position: sticky; top: 0; background: #2b4a6b; color: #fff; font-weight: 600; font-size: .78rem; z-index: 1; }
.stdgrid tbody tr:hover { background: #f1f7ff; }
.stdgrid td.num, .stdgrid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.stdgrid td.wrap { white-space: normal; min-width: 220px; }
.stdgrid img.thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; background: #f6f6f6; vertical-align: middle; }
.btn, .btn-primary, .btn-secondary, .btn-danger { border: 1px solid #cbd5e0; background: #fff; border-radius: 6px; padding: .3rem .7rem; cursor: pointer; font-size: .82rem; color: #1a202c; text-decoration: none; display: inline-block; white-space: nowrap; }
.btn-primary { background: #1b6ec2; color: #fff; border-color: #1861ac; }
.btn-primary:hover { background: #165ea4; color: #fff; }
.btn-danger { background: #fff5f5; color: #c53030; border-color: #feb2b2; }
.btn:disabled, .btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.iconbtn { border: 0; background: transparent; cursor: pointer; padding: .12rem .28rem; border-radius: 5px; font-size: .95rem; }
.iconbtn:hover { background: #e2e8f0; }
.switch { position: relative; display: inline-block; width: 34px; height: 18px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e0; border-radius: 999px; cursor: pointer; transition: .15s; }
.switch span::before { content: ''; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: #38a169; }
.switch input:checked + span::before { transform: translateX(16px); }
.pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .74rem; background: #edf2f7; color: #2d3748; }
.pill-warn { background: #fff3cd; color: #7a5a00; } .pill-info { background: #cfe2ff; color: #084298; } .pill-ok { background: #d1e7dd; color: #0f5132; } .pill-bad { background: #f8d7da; color: #842029; } .pill-muted { background: #e2e3e5; color: #41464b; }
.admin-msg { padding: .5rem .8rem; border-radius: 8px; margin-bottom: .6rem; font-size: .88rem; }
.admin-msg--ok { background: #f0fff4; border: 1px solid #9ae6b4; color: #22543d; }
.admin-msg--err { background: #fff5f5; border: 1px solid #feb2b2; color: #822727; }
.admin-tabs { display: flex; gap: .2rem; border-bottom: 2px solid #e2e8f0; margin-bottom: .8rem; flex-wrap: wrap; }
.admin-tabs button, .admin-tabs a { border: 0; background: transparent; padding: .4rem .8rem; cursor: pointer; font-size: .88rem; color: #4a5568; border-bottom: 2px solid transparent; margin-bottom: -2px; text-decoration: none; }
.admin-tabs .on { color: #2b6cb0; border-bottom-color: #2b6cb0; font-weight: 600; }
.admin-tabs small { color: #a0aec0; margin-left: .2rem; }
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 900; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 92vw); background: #fff; box-shadow: -8px 0 30px rgba(0,0,0,.18); display: flex; flex-direction: column; z-index: 901; }
.drawer--wide { width: clamp(560px, 66.67vw, 1500px); }
.drawer-head { display: flex; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid #e2e8f0; }
.drawer-head h3 { margin: 0; font-size: 1.05rem; flex: 1; }
.drawer-body { flex: 1; overflow: auto; padding: .9rem 1rem; }
.drawer-foot { padding: .65rem 1rem; border-top: 1px solid #e2e8f0; display: flex; gap: .5rem; justify-content: flex-end; background: #fafbfc; }
.fgrid-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .55rem .9rem; }
.fgrid-admin .f { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: #4a5568; }
.fgrid-admin .f.full { grid-column: 1 / -1; }
.fgrid-admin .f input, .fgrid-admin .f select, .fgrid-admin .f textarea { padding: .36rem .5rem; border: 1px solid #cbd5e0; border-radius: 6px; font-size: .9rem; color: #1a202c; }
.fgrid-admin .f.chk { flex-direction: row; align-items: center; gap: .4rem; }
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: .9rem 1rem; margin-bottom: .8rem; }
.card h3 { font-size: .95rem; margin: 0 0 .6rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .8rem; }
.pager-admin { display: flex; gap: .4rem; align-items: center; justify-content: flex-end; padding: .4rem 0; font-size: .85rem; }
.img-grid { display: flex; flex-wrap: wrap; gap: .6rem; }
.img-card { width: 120px; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #fff; font-size: .75rem; }
.img-card img { width: 120px; height: 120px; object-fit: cover; display: block; }
.img-card.is-primary { border-color: #38a169; }
.img-card .acts { display: flex; justify-content: space-around; padding: .2rem; }
.img-card .acts .iconbtn { padding: .12rem .18rem; }
.img-card .replace { position: relative; overflow: hidden; display: inline-block; }
.img-card .replace input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.img-block { margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px dashed #e2e8f0; }
.img-block:last-child { border-bottom: 0; margin-bottom: 0; }
.img-block h3 { margin: 0 0 .4rem; display: flex; align-items: center; gap: .3rem; }
.img-block .upload { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .5rem 0; }
.img-block .upload label.btn { cursor: pointer; }
.img-block .upload input[type=file] { max-width: 100%; }
.h-help { display: inline-flex; align-items: center; gap: .3rem; }

/* 功能說明圖示＋modal（HelpIcon.razor）：標題旁的 ? 圓鈕，點了以約 2/3 寬的對話框顯示說明 */
.help-ico { display: inline-flex; align-items: center; justify-content: center; width: 1.15rem; height: 1.15rem; margin-left: .35rem; border-radius: 50%; border: 1px solid #94a3b8; background: #fff; color: #475569; font-size: .75rem; font-weight: 700; line-height: 1; cursor: pointer; vertical-align: middle; padding: 0; }
.help-ico:hover { background: #e2e8f0; color: #1e293b; }
h1 .help-ico, .std-h .help-ico { width: 1.3rem; height: 1.3rem; font-size: .8rem; }
.help-modal__backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.help-modal { font-size: 1rem; font-weight: 400; line-height: 1.6; color: #1e293b; text-align: left; white-space: normal; outline: 0; width: 66vw; max-width: 1100px; max-height: 80vh; background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); display: flex; flex-direction: column; overflow: hidden; }
.help-modal__head { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.2rem; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.help-modal__head h2 { margin: 0; font-size: 1.1rem; flex: 1; }
.help-modal__close { border: 0; background: transparent; font-size: 1.1rem; cursor: pointer; color: #64748b; padding: .2rem .4rem; border-radius: 6px; }
.help-modal__close:hover { background: #e2e8f0; }
/* 只開直向捲動：66vw 在縮放比例非整數的螢幕上寬度會帶小數，偶爾多出一條沒有作用的橫向捲軸 */
.help-modal__body { padding: 1rem 1.4rem; overflow-x: hidden; overflow-y: auto; overflow-wrap: break-word; line-height: 1.7; font-size: .95rem; }
.help-modal__body p { margin: 0 0 .6rem; }
.help-modal__body ul, .help-modal__body ol { margin: 0 0 .6rem; padding-left: 1.4rem; }
.help-modal__body li { margin-bottom: .3rem; }
.help-modal__body h4 { margin: 1rem 0 .35rem; padding-left: .55rem; border-left: 3px solid #1b6ec2; font-size: .98rem; font-weight: 700; color: #1e3a5f; }
.help-modal__body code { background: #f1f5f9; border-radius: 4px; padding: .05rem .3rem; font-size: .88em; color: #334155; }
.help-modal__foot { padding: .6rem 1.2rem; border-top: 1px solid #e2e8f0; text-align: right; }
@media (max-width: 800px) { .help-modal { width: 96vw; max-height: 90vh; } }
.bar { display: flex; align-items: center; gap: .5rem; font-size: .82rem; margin: .2rem 0; }
.bar__track { flex: 1; background: #edf2f7; border-radius: 4px; height: 14px; overflow: hidden; }
.bar__fill { background: #2b6cb0; height: 100%; }
.stat-admin { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: .7rem .9rem; display: flex; flex-direction: column; }
.stat-admin span { font-size: .76rem; color: #718096; }
.stat-admin strong { font-size: 1.4rem; color: #2b4a6b; }
.stat-admin.warn strong { color: #c05621; }
.mono { font-family: Consolas, monospace; font-size: .8rem; }
.muted { color: #718096; }
.ok { color: #22543d; } .bad { color: #822727; }
@media print {
    .admin-sidebar, .admin-topbar, .no-print { display: none !important; }
    .admin-content { padding: 0; }
    body { background: #fff; }
}
.admin-badge { display: inline-block; min-width: 18px; padding: 0 .35rem; border-radius: 999px; background: #e53e3e; color: #fff; font-size: .7rem; line-height: 18px; text-align: center; margin-left: .25rem; }
.xb-editor .ql-container { height: auto; display: flex; flex-direction: column; border-radius: 0 0 8px 8px; }
.xb-editor .ql-editor { height: auto; flex: 1 1 auto; min-height: 120px; font-size: .95rem; }
.xb-editor .ql-toolbar { border-radius: 8px 8px 0 0; }
.xb-editor .ql-toolbar .ql-formats { margin-right: 8px; }
.fgrid-admin .f .ql-toolbar select, .fgrid-admin .f .ql-tooltip input { padding: 0; border: 0; }

/* ───────── §15 即時客服工作台 ───────── */
.chatwb { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: .6rem; height: calc(100vh - 170px); min-height: 520px; }
.chatwb-list, .chatwb-main, .chatwb-side { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; display: flex; flex-direction: column; min-height: 0; }
.chatwb-side { overflow: auto; padding: .5rem; gap: .5rem; } .chatwb-side .card { margin: 0; }
.chatwb-tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid #e2e8f0; }
.chatwb-tabs button { flex: 1 1 auto; border: 0; background: transparent; padding: .45rem .3rem; font-size: .78rem; cursor: pointer; color: #4a5568; border-bottom: 2px solid transparent; }
.chatwb-tabs button.on { color: #1b6ec2; border-bottom-color: #1b6ec2; font-weight: 700; }
.chatwb-rows { overflow: auto; flex: 1; }
.chatwb-row { padding: .5rem .6rem; border-bottom: 1px solid #edf2f7; cursor: pointer; font-size: .82rem; }
.chatwb-row:hover { background: #f7fafc; } .chatwb-row.on { background: #ebf4ff; }
.chatwb-row__top { display: flex; gap: .3rem; align-items: center; } .chatwb-row__top .spacer { flex: 1; }
.chatwb-row__text { color: #4a5568; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: .15rem 0; }
.chatwb-row__meta { display: flex; gap: .4rem; align-items: center; font-size: .74rem; }
.chatwb-head { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; padding: .5rem .7rem; border-bottom: 1px solid #e2e8f0; font-size: .84rem; } .chatwb-head .spacer { flex: 1; }
.chatwb-empty { flex: 1; display: flex; align-items: center; justify-content: center; }
.chatwb-log { flex: 1; overflow: auto; padding: .7rem; display: flex; flex-direction: column; gap: .5rem; background: #f8fafc; }
.chatwb-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 80%; } .chatwb-msg small { color: #718096; font-size: .7rem; margin: 0 .2rem .1rem; }
.chatwb-bubble { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: .45rem .7rem; white-space: pre-wrap; line-height: 1.5; font-size: .86rem; }
.chatwb-msg--agent { align-self: flex-end; align-items: flex-end; } .chatwb-msg--agent .chatwb-bubble { background: #1b6ec2; color: #fff; border-color: #1b6ec2; }
.chatwb-msg--bot .chatwb-bubble { background: #fff7ed; border-color: #fed7aa; }
.chatwb-msg--system { align-self: center; align-items: center; } .chatwb-msg--system .chatwb-bubble { background: transparent; border: 0; color: #718096; font-size: .76rem; }
.chatwb-input { border-top: 1px solid #e2e8f0; padding: .5rem .7rem; display: flex; flex-direction: column; gap: .4rem; position: relative; }
.chatwb-input textarea { width: 100%; resize: vertical; font: inherit; font-size: .86rem; padding: .4rem .6rem; border: 1px solid #cbd5e0; border-radius: 6px; }
.chatwb-input__bar { display: flex; gap: .4rem; align-items: center; font-size: .76rem; } .chatwb-input__bar .spacer { flex: 1; }
.chatwb-canned { position: absolute; left: .7rem; right: .7rem; bottom: calc(100% - .2rem); max-height: 320px; overflow: auto; background: #fff; border: 1px solid #cbd5e0; border-radius: 8px; box-shadow: 0 -6px 20px rgba(0,0,0,.12); z-index: 5; font-size: .82rem; }
.chatwb-canned__head { display: flex; gap: .4rem; padding: .4rem; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; background: #fff; } .chatwb-canned__head input { flex: 1; padding: .3rem .5rem; border: 1px solid #cbd5e0; border-radius: 6px; }
.chatwb-canned__item { padding: .4rem .6rem; border-bottom: 1px solid #edf2f7; cursor: pointer; } .chatwb-canned__item:hover { background: #ebf4ff; } .chatwb-canned__item code { margin-left: .3rem; font-size: .74rem; }
.chatwb-order { padding: .35rem 0; border-bottom: 1px dashed #e2e8f0; font-size: .8rem; }
@media (max-width: 1100px) { .chatwb { grid-template-columns: 240px minmax(0,1fr); } .chatwb-side { display: none; } }
/* 手機（商家在手機回覆顧客）：單欄；選了對話就只看對話，有「返回」鈕 */
@media (max-width: 768px) {
  .chatwb { grid-template-columns: 1fr; height: calc(100vh - 120px); min-height: 420px; }
  .chatwb--open .chatwb-list { display: none; }
  .chatwb:not(.chatwb--open) .chatwb-main { display: none; }
  .chatwb-back { display: inline-block; }
  .chatwb-head { font-size: .8rem; }
  .chatwb-msg { max-width: 92%; }
}
.chatwb-back { display: none; }

/* §16 館選品與福委價：尚未加入館選品的列淡化 */
.stdgrid tr.row-muted td { color: #94a3b8; }
