/* ============================================================
   環友科技 報價單/驗收單產生器 — 介面樣式
   ============================================================ */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --border: #dfe5ee;
  --border-strong: #c6cfdd;
  --text: #182233;
  --muted: #5c6b82;
  --brand: #0b5cad;
  --brand-dark: #094a8c;
  --brand-soft: #e8f1fb;
  --accent: #0e7f6b;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #9a6700;
  --warn-soft: #fff6e0;
  --ok: #107a3d;
  --ok-soft: #e8f6ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 30, 54, .06), 0 4px 14px rgba(16, 30, 54, .05);
  --font: "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", "微軟正黑體", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

/* ---------------- 頂欄 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(16, 30, 54, .05);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.brand img { height: 36px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: .5px; }
.brand-text span { font-size: 12.5px; color: var(--muted); }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a {
  padding: 18px 18px 15px;
  text-decoration: none; color: var(--muted);
  font-weight: 600; font-size: 15px;
  border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--brand); }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------------- 版面 ---------------- */
#main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
.page.hidden, .hidden { display: none !important; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.layout-narrow { max-width: 980px; }
.layout-side .sticky { position: sticky; top: 78px; }
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .layout-side .sticky { position: static; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.card h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; font-size: 17px;
}
.step-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; flex: none;
}
.h-actions { margin-left: auto; }
.h-note { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 400; }
.card-desc { margin: -6px 0 14px; font-size: 13px; color: var(--muted); }

/* ---------------- 表單 ---------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.span-2 { grid-column: span 2; }
@media (max-width: 760px) { .span-2 { grid-column: span 1; } }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.field > span { color: var(--muted); font-weight: 600; }
.field .label-row { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 600; }
.req { color: var(--danger); font-style: normal; }
.hint { color: #8493a8; font-size: 12px; font-weight: 400; }
.warn-text { color: var(--warn); }

input, select, textarea {
  font: inherit; color: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}
textarea { resize: none; overflow: hidden; min-height: 38px; }
input[type="date"] { min-height: 38px; }
input.invalid, textarea.invalid { border-color: var(--danger); background: #fffafa; }

.filename-preview {
  padding: 8px 10px;
  background: var(--brand-soft);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  font-size: 13px; color: var(--brand-dark);
  word-break: break-all;
  min-height: 38px; display: flex; align-items: center;
}

/* ---------------- 按鈕 ---------------- */
.btn {
  font: inherit; font-weight: 600;
  border: 1px solid var(--border-strong);
  background: #fff; color: var(--text);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #f4f7fb; border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.primary:disabled { background: #9db8d4; border-color: #9db8d4; cursor: not-allowed; }
.btn.secondary { color: var(--brand); border-color: var(--brand); }
.btn.ghost { border-color: transparent; color: var(--brand); background: transparent; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.tiny { padding: 2px 9px; font-size: 12.5px; }
.btn.add-block {
  width: 100%; border-style: dashed; color: var(--brand);
  background: transparent; padding: 10px;
}
.btn.add-block:hover { background: var(--brand-soft); }
.icon-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 14px; color: var(--muted);
  padding: 4px 6px; border-radius: 6px; line-height: 1;
}
.icon-btn:hover { background: #eef2f8; color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.row-right { display: flex; justify-content: flex-end; margin: 6px 0 10px; }

/* ---------------- 窗口 chips ---------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.chip {
  font: inherit; font-size: 13px;
  border: 1px solid var(--border-strong);
  background: #fff; border-radius: 20px;
  padding: 5px 14px; cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .chip-sub { color: inherit; opacity: .7; font-size: 12px; }

/* ---------------- 報價項目編輯器 ---------------- */
.item-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: #fbfcfe;
}
.item-head { display: flex; align-items: flex-start; gap: 10px; }
.item-no {
  flex: none; width: 26px; height: 26px; margin-top: 5px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff;
  border-radius: 6px; font-weight: 700; font-size: 14px;
}
.item-head textarea { font-weight: 600; }
.item-tools { display: flex; flex: none; gap: 2px; margin-top: 5px; }
.mode-row { display: flex; align-items: center; gap: 14px; margin: 10px 0 4px; flex-wrap: wrap; }
.mode-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.segment { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.segment button {
  font: inherit; font-size: 13px; border: none; background: #fff;
  padding: 5px 14px; cursor: pointer; color: var(--muted);
}
.segment button.active { background: var(--brand); color: #fff; }
.mode-hint { font-size: 12px; color: #8493a8; }
.num-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; align-items: flex-end; }
.num-row .field { width: 110px; }
.num-row .field.grow { flex: 1; min-width: 140px; }
.amount-cell {
  font-variant-numeric: tabular-nums;
  color: var(--brand-dark); font-weight: 700;
  padding: 8px 2px; min-width: 90px; text-align: right;
}
.child-row {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 78px 78px 92px 96px auto;
  gap: 8px; align-items: start;
  padding: 8px 0 2px;
  border-top: 1px dashed var(--border);
}
.child-row.no-price { grid-template-columns: 44px minmax(0,1fr) 78px 78px auto; }
.child-row .cno { font-size: 13px; color: var(--muted); font-weight: 700; padding-top: 9px; text-align: center; }
.child-details { grid-column: 2 / -1; }
.child-tools { display: flex; gap: 2px; padding-top: 5px; }
.sub-label { font-size: 12.5px; color: var(--muted); margin-top: 10px; font-weight: 600; }
.item-details { margin-top: 10px; }

/* ---------------- 特惠價 ---------------- */
.special-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.radio input { width: auto; }
#q-special-value { width: 180px; }

/* ---------------- 備註範本 ---------------- */
.tpl-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tpl-card {
  border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
  background: #fff; cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.tpl-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.tpl-card h4 { margin: 0 0 4px; font-size: 14px; color: var(--brand-dark); }
.tpl-card p { margin: 0; font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-row { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.note-no { font-weight: 700; color: var(--muted); padding-top: 9px; text-align: right; }
.note-tools { display: flex; gap: 2px; padding-top: 5px; }

/* ---------------- 摘要側欄 ---------------- */
.summary { font-size: 14px; }
.summary .srow { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.summary .srow span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.summary .srow.grand { border-bottom: none; font-size: 17px; padding-top: 10px; }
.summary .srow.grand span:last-child { color: var(--brand-dark); font-weight: 800; }
.summary .srow.special span { color: var(--accent); }
.summary .s-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
.summary .s-error { color: var(--warn); font-size: 13px; background: var(--warn-soft); padding: 8px 10px; border-radius: 8px; margin-top: 8px; }
.summary .s-warn { color: var(--warn); font-size: 12.5px; margin-top: 8px; }
.summary .s-meta { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.missing { margin-top: 10px; font-size: 12.5px; color: var(--danger); }
.missing ul { margin: 4px 0 0; padding-left: 18px; }
.side-actions { display: flex; gap: 10px; margin-top: 14px; }
.side-actions .btn { flex: 1; }
.result {
  margin-top: 14px; padding: 12px 14px;
  border-radius: 10px; font-size: 13.5px;
  background: var(--ok-soft); border: 1px solid #bfe3cd;
}
.result h4 { margin: 0 0 6px; color: var(--ok); font-size: 14px; }
.result .r-file { word-break: break-all; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.result .r-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.result.error { background: var(--danger-soft); border-color: #f2c0bb; }
.result.error h4 { color: var(--danger); }

/* ---------------- 橫幅 / 提示 ---------------- */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-radius: 10px; margin-bottom: 16px;
  font-size: 13.5px; flex-wrap: wrap;
}
.banner.info { background: var(--brand-soft); border: 1px solid #c8ddf2; color: var(--brand-dark); }
.banner-actions { display: flex; gap: 8px; }

/* ---------------- 驗收單 ---------------- */
.steps { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.step {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 7px 16px; border-radius: 20px;
}
.step b {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--border); color: var(--muted); font-size: 12px;
}
.step.active { color: var(--brand-dark); border-color: var(--brand); }
.step.active b { background: var(--brand); color: #fff; }
.step.done b { background: var(--ok); color: #fff; }

.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .source-grid { grid-template-columns: 1fr; } }
.source-box { border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.source-box h3 { margin: 0 0 6px; font-size: 15px; }
.source-box > p { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.pick-list { margin-top: 10px; max-height: 300px; overflow: auto; }
.pick-item {
  width: 100%; text-align: left; font: inherit;
  border: 1px solid var(--border); background: #fff;
  border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; cursor: pointer;
}
.pick-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.pick-item .pi-name { font-weight: 600; font-size: 13.5px; }
.pick-item .pi-meta { font-size: 12px; color: var(--muted); }
.pick-empty { color: var(--muted); font-size: 13px; padding: 10px 2px; }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 10px;
  padding: 26px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13.5px; text-align: center;
  transition: border-color .12s, background .12s;
}
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dz-icon { font-size: 26px; color: var(--brand); }

.a-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: #fbfcfe; }
.a-parent-row { display: flex; gap: 10px; align-items: flex-start; }
.a-parent-row .a-no { font-weight: 700; color: var(--brand-dark); padding-top: 8px; min-width: 30px; text-align: center; }
.a-parent-row input[type="checkbox"] { width: 18px; height: 18px; margin-top: 11px; flex: none; }
.a-child { display: grid; grid-template-columns: 26px 44px minmax(0,1fr); gap: 8px; align-items: start; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.a-child input[type="checkbox"] { width: 16px; height: 16px; margin-top: 10px; }
.a-child .a-no { font-size: 12.5px; color: var(--muted); font-weight: 700; padding-top: 9px; text-align: center; }
.a-child-fields { display: flex; flex-direction: column; gap: 6px; }
.excluded { opacity: .45; }
.addons { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.addon {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; background: #fbfcfe;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.addon input { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.addon b { color: var(--brand-dark); }
.addon span { color: var(--muted); }

/* ---------------- 歷史紀錄 ---------------- */
.records-toolbar { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.chip-group { display: flex; gap: 6px; }
#r-search { max-width: 300px; }
.rec-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rec-table th {
  text-align: left; color: var(--muted); font-size: 12.5px;
  padding: 8px 10px; border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.rec-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.rec-table tr:hover td { background: #f8fafd; }
.rec-case { font-weight: 600; }
.rec-file { font-size: 12px; color: var(--muted); word-break: break-all; }
.rec-total { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.rec-actions { display: flex; gap: 4px; flex-wrap: wrap; white-space: nowrap; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 700;
  border-radius: 6px; padding: 2px 8px; white-space: nowrap;
}
.badge.quotation { background: var(--brand-soft); color: var(--brand-dark); }
.badge.acceptance { background: var(--ok-soft); color: var(--ok); }
.rec-empty { text-align: center; color: var(--muted); padding: 40px 0; }
.rec-empty .re-icon { font-size: 34px; margin-bottom: 8px; }

/* ---------------- 內容預覽 ---------------- */
.doc-preview {
  background: #fff; border: 1px solid var(--border);
  padding: 28px 32px; font-size: 13px; line-height: 1.6;
}
.doc-preview .dp-co { text-align: center; font-size: 18px; font-weight: 800; letter-spacing: 2px; }
.doc-preview .dp-addr { text-align: center; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.doc-preview .dp-title { text-align: right; font-size: 16px; font-weight: 700; margin: 8px 0; }
.doc-preview .dp-grid { display: grid; grid-template-columns: 1fr auto; gap: 2px 30px; margin-bottom: 10px; }
.doc-preview .dp-case { font-weight: 700; margin: 10px 0 6px; }
.doc-preview table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.doc-preview th, .doc-preview td { border: 1px solid #b9c3d2; padding: 4px 8px; }
.doc-preview th { background: #eef2f8; font-size: 12px; }
.doc-preview td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-preview tr.parent td { background: #fff8dc; font-weight: 700; }
.doc-preview tr.sub td { font-weight: 700; }
.doc-preview tr.total td { font-weight: 700; }
.doc-preview .dp-notes { margin-top: 10px; font-size: 12.5px; }
.doc-preview .dp-handler { margin-top: 18px; display: flex; justify-content: space-between; font-size: 12.5px; }
.preview-note { font-size: 12px; color: var(--muted); margin-top: 10px; text-align: center; }

/* ---------------- Modal ---------------- */
dialog#modal {
  border: none; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(10, 20, 40, .25);
  padding: 0; width: min(720px, 92vw);
  max-height: 88vh; display: flex; flex-direction: column;
}
dialog#modal:not([open]) { display: none; }
dialog::backdrop { background: rgba(15, 25, 45, .45); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: none; background: transparent; font-size: 16px; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: #eef2f8; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.modal-actions:empty { display: none; }
.param-field { margin-bottom: 12px; }

/* ---------------- Toast ---------------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #223047; color: #fff;
  border-radius: 10px; padding: 12px 18px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(10, 20, 40, .3);
  max-width: 380px;
  animation: toast-in .18s ease-out;
}
.toast.success { background: var(--ok); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.footer { text-align: center; color: #93a1b5; font-size: 12px; padding: 10px 0 30px; }

/* ---------------- AI 智慧填單 ---------------- */
:root { --ai: #6d28d9; --ai-soft: #f3eefc; }
.topbar-settings { margin-left: 12px; flex: none; }
.ai-card { border-left: 4px solid var(--ai); }
.ai-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 24px; padding: 0 6px; border-radius: 7px;
  background: var(--ai); color: #fff; font-size: 12.5px; font-weight: 800;
  letter-spacing: .5px; flex: none;
}
.dropzone.slim { padding: 12px 14px; flex-direction: row; justify-content: center; gap: 6px; margin-bottom: 10px; }
#ai-file-chips:empty { display: none; }
#ai-file-chips { margin: 0 0 10px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; background: var(--ai-soft);
  border: 1px solid #ded2f2; color: #4c1d95;
  border-radius: 8px; padding: 4px 10px;
}
.file-chip .fc-x { border: none; background: transparent; cursor: pointer; color: #7c5cbf; font-size: 13px; padding: 0 2px; }
.file-chip .fc-x:hover { color: var(--danger); }
#ai-text { margin-bottom: 10px; }
.ai-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai-actions .btn.primary { background: var(--ai); border-color: var(--ai); }
.ai-actions .btn.primary:hover { background: #5b21b6; }
.ai-actions .btn.primary:disabled { background: #c3b3e3; border-color: #c3b3e3; }
#ai-result { margin-top: 12px; border: 1px solid #ded2f2; background: var(--ai-soft); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; }
#ai-result h4 { margin: 0 0 6px; color: var(--ai); font-size: 14px; }
#ai-result ul { margin: 4px 0 8px; padding-left: 20px; }
#ai-result .q-warn { color: var(--warn); }
#ai-result .ai-total { font-weight: 700; color: var(--brand-dark); }
.ai-note { font-size: 12px; color: var(--muted); }
.provider-section { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.provider-section.hidden { display: none; }
.test-result { margin-top: 10px; font-size: 13px; }
.test-result.ok { color: var(--ok); }
.test-result.fail { color: var(--danger); }
.security-note {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: var(--warn-soft); color: var(--warn); font-size: 12.5px;
}

/* 清除已填資料按鈕 */
.reset-btn {
  width: 100%; margin-top: 10px;
  background: #fff; border: 1px solid var(--danger);
  color: var(--danger); font-size: 13.5px; font-weight: 600;
}
.reset-btn:hover {
  background: var(--danger-soft); border-color: var(--danger);
  color: var(--danger);
}

/* 提示詞範本編輯器 */
.prompt-details {
  margin-top: 12px; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; background: #fbfcfe;
}
.prompt-details summary {
  cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--brand-dark);
}
.prompt-details summary:hover { color: var(--brand); }
.prompt-details code {
  background: var(--brand-soft); border-radius: 4px; padding: 0 4px;
  font-size: 12px; color: var(--brand-dark);
}
.prompt-editor {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px; line-height: 1.5;
  height: 320px; overflow-y: auto !important; resize: vertical;
}

/* 載入中遮罩(產生時) */
.busy { position: relative; pointer-events: none; opacity: .6; }
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: -2px; margin-right: 6px;
}
.btn.secondary .spinner { border-color: rgba(11,92,173,.3); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
