/**
 * bt-revamp.css
 * BT-UI-REVAMP-001 — the site frame (logo home, 顯示設定 Aa) and the case page's four tabs.
 * Look only: the 銀行通 greens already in use (#1a5c52, #1F7A67, #2FAE9B), one primary button, even spacing.
 * The text size is a zoom on the page body (the pages size their text in px, so a root font-size would not reach them).
 */
:root {
  --bt-green-900: #1a5c52;
  --bt-green-700: #1F7A67;
  --bt-green-500: #2FAE9B;
  --bt-green-050: #eaf6f3;
  --bt-ink: #1f2d2a;
  --bt-muted: #5b6f6a;
  --bt-line: #e3ebe8;
  --bt-card: #ffffff;
  --bt-page: #f4f7f6;
  --bt-warn: #b45309;
  --bt-warn-bg: #fff7ed;
  --bt-bad: #b91c1c;
  --bt-bad-bg: #fef2f2;
  --bt-zoom: 1;
}
html[data-bt-font="small"] { --bt-zoom: 0.9; }
html[data-bt-font="large"] { --bt-zoom: 1.18; }
html[data-bt-font] body { zoom: var(--bt-zoom); }

/* ── the frame ─────────────────────────────────────────────── */
.bt-shell-bar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 12px;
  margin: -20px -16px 16px; padding: 10px 16px;
  background: var(--bt-card); border-bottom: 1px solid var(--bt-line);
}
.bt-shell-bar--page { margin: 0; padding: 10px max(16px, calc((100% - 1200px) / 2)); }
/* the installed app (BT-OPS-PWA-001) has its own fixed 56px strip on top: the bar and the tab row stay under it */
@media all and (display-mode: standalone), all and (display-mode: fullscreen) {
  .bt-shell-bar { top: calc(56px + env(safe-area-inset-top, 0px)); }
  .bt-rv-tabs { top: calc(113px + env(safe-area-inset-top, 0px)) !important; }
}
body.pwa-mode .bt-shell-bar { top: calc(56px + env(safe-area-inset-top, 0px)); }
body.pwa-mode .bt-rv-tabs { top: calc(113px + env(safe-area-inset-top, 0px)) !important; }
/* the 工作平台's own fixed top bar holds 顯示設定; its 銀行通 mark is the home link */
.bt-shell-inline { position: relative; top: auto; z-index: auto; display: inline-flex; margin: 0; padding: 0; border: 0; background: none; }
.bt-shell-inline .bt-shell-font-pop { right: 0; top: calc(100% + 8px); z-index: 1000; }
.bt-shell-brand { text-decoration: none; color: inherit; cursor: pointer; }
.bt-shell-logo {
  font-size: 20px; font-weight: 700; color: var(--bt-green-900); text-decoration: none; letter-spacing: 1px; white-space: nowrap;
}
.bt-shell-home { font-size: 13px; color: var(--bt-muted); text-decoration: none; padding-left: 12px; border-left: 1px solid var(--bt-line); white-space: nowrap; }
.bt-shell-home:hover, .bt-shell-logo:hover { color: var(--bt-green-700); }
.bt-shell-gap { flex: 1 1 auto; }
.bt-shell-font-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--bt-line); border-radius: 8px; background: var(--bt-card); color: var(--bt-ink); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.bt-shell-font-btn b { font-size: 16px; color: var(--bt-green-900); }
.bt-shell-font-pop {
  position: absolute; right: 16px; top: calc(100% + 6px); width: 230px; padding: 12px;
  background: var(--bt-card); border: 1px solid var(--bt-line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 60, 52, .12);
}
.bt-shell-font-pop[hidden] { display: none; }
.bt-shell-font-pop h4 { font-size: 13px; margin: 0 0 8px; color: var(--bt-ink); }
.bt-shell-seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--bt-line); border-radius: 8px; overflow: hidden; }
.bt-shell-seg button { min-height: 36px; border: 0; background: var(--bt-card); font: inherit; font-size: 14px; color: var(--bt-ink); cursor: pointer; }
.bt-shell-seg button + button { border-left: 1px solid var(--bt-line); }
.bt-shell-seg button[aria-pressed="true"] { background: var(--bt-green-700); color: #fff; font-weight: 600; }
.bt-shell-font-pop p { margin: 8px 0 0; font-size: 12px; color: var(--bt-muted); }
@media (max-width: 640px) {
  .bt-shell-home { display: none; }
  .bt-shell-font-btn span { display: none; }
  /* the 工作平台's top bar on a phone: its 銀 mark is the home link, the words beside it make room for 顯示設定 */
  .ws-topbar .bt-shell-brand > span:not(.ws-topbar-brand-logo) { display: none; }
  .ws-topbar .ws-topbar-actions { gap: 6px; }
  .ws-topbar .ws-topbar-user-name { display: none; }
  .ws-topbar .ws-topbar-actions :is(.ws-btn, .ws-topbar-user-role) { white-space: nowrap; padding-left: 8px; padding-right: 8px; }
}

/* ── the case page ─────────────────────────────────────────── */
body.bt-rv { background: var(--bt-page); }
body.bt-rv .id-wrap { max-width: 1080px; }
.bt-rv-head { margin: 4px 0 12px; }
.bt-rv-head h1 { font-size: 22px; font-weight: 700; color: var(--bt-green-900); margin: 0 0 6px; }
.bt-rv-case { font-size: 17px; font-weight: 700; color: var(--bt-ink); margin: 0 0 4px; overflow-wrap: anywhere; }
.bt-rv-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--bt-muted); }
.bt-rv-meta b { color: var(--bt-ink); font-weight: 600; }
.bt-rv-badge { display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--bt-green-050); color: var(--bt-green-900); font-weight: 600; }

.bt-rv-tabs {
  position: sticky; top: 57px; z-index: 50;
  display: flex; gap: 4px; margin: 0 0 14px; padding: 0 2px;
  background: var(--bt-page); border-bottom: 1px solid var(--bt-line);
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.bt-rv-tabs::-webkit-scrollbar { display: none; }
.bt-rv-tab {
  flex: 0 0 auto; scroll-snap-align: start; min-height: 44px; padding: 10px 18px;
  border: 0; border-bottom: 3px solid transparent; background: transparent; font: inherit; font-size: 15px; color: var(--bt-muted); cursor: pointer; white-space: nowrap;
}
.bt-rv-tab[aria-selected="true"] { color: var(--bt-green-700); border-bottom-color: var(--bt-green-700); font-weight: 700; }
.bt-rv-tab:focus-visible { outline: 2px solid var(--bt-green-500); outline-offset: -2px; }
[data-bt-tab][data-bt-hidden] { display: none !important; }

.bt-rv-card { background: var(--bt-card); border: 1px solid var(--bt-line); border-radius: 12px; padding: 18px 20px; margin-bottom: 12px; }
.bt-rv-card h2 { font-size: 16px; font-weight: 700; color: var(--bt-ink); margin: 0 0 12px; }
.bt-rv-card h2 small { font-size: 12px; font-weight: 400; color: var(--bt-muted); margin-left: 6px; }

/* 能不能做 */
.bt-rv-can { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bt-rv-fig { border: 1px solid var(--bt-line); border-radius: 10px; padding: 12px 14px; background: #fbfdfc; min-width: 0; }
.bt-rv-fig small { display: block; font-size: 12px; color: var(--bt-muted); }
.bt-rv-fig strong { display: block; font-size: 20px; font-weight: 700; color: var(--bt-ink); margin: 4px 0 2px; overflow-wrap: anywhere; }
.bt-rv-fig span { display: block; font-size: 12px; color: var(--bt-muted); overflow-wrap: anywhere; }
.bt-rv-fig[data-tone="warn"] { border-color: #fcd9a8; background: var(--bt-warn-bg); }
.bt-rv-fig[data-tone="warn"] strong { color: var(--bt-warn); }
.bt-rv-fig[data-tone="bad"] { border-color: #fca5a5; background: var(--bt-bad-bg); }
.bt-rv-fig[data-tone="bad"] strong { color: var(--bt-bad); }

/* 案件摘要: the page's own case overview grid, moved into the 總覽 card */
[data-bt-summary] .id-5p-overview { margin: 0; padding: 0; border: 0; background: none; }
[data-bt-summary] .id-5p-grid > div { background: #fbfdfc; border: 1px solid var(--bt-line); border-radius: 10px; padding: 10px 12px; }
[data-bt-summary] .id-5p-grid strong { color: var(--bt-ink); font-size: 15px; }

/* 目前進度 */
.bt-rv-steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); list-style: none; margin: 4px 0 0; padding: 0; counter-reset: s; }
.bt-rv-steps li { position: relative; text-align: center; font-size: 13px; color: var(--bt-muted); padding-top: 26px; min-width: 0; }
.bt-rv-steps li::before { content: ""; position: absolute; top: 4px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #cfd9d6; z-index: 1; }
.bt-rv-steps li::after { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 2px; background: #cfd9d6; }
.bt-rv-steps li:first-child::after { display: none; }
.bt-rv-steps li[data-done]::before, .bt-rv-steps li[data-done]::after, .bt-rv-steps li[data-now]::after { background: var(--bt-green-500); }
.bt-rv-steps li[data-now] { color: var(--bt-green-700); font-weight: 700; }
.bt-rv-steps li[data-now]::before { width: 20px; height: 20px; top: 1px; margin-left: -10px; background: var(--bt-green-700); box-shadow: 0 0 0 4px var(--bt-green-050); }
.bt-rv-steps li > span { display: block; }
.bt-rv-steps li .bt-rv-now-station { margin-top: 4px; padding: 2px 8px; display: inline-block; border-radius: 999px; background: var(--bt-green-050); color: var(--bt-ink); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.bt-rv-station { margin: 12px 0 0; font-size: 13px; color: var(--bt-muted); }
.bt-rv-station:empty { display: none; }
.bt-rv-station b { color: var(--bt-ink); }

/* 下一步 */
.bt-rv-next p { font-size: 15px; color: var(--bt-ink); margin: 0 0 12px; }
.bt-rv-primary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 28px;
  border: 0; border-radius: 8px; background: var(--bt-green-700); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.bt-rv-primary:hover { background: var(--bt-green-900); }

/* 待補資料 */
.bt-rv-todo { list-style: none; margin: 0; padding: 0; border: 1px solid var(--bt-line); border-radius: 10px; overflow: hidden; }
.bt-rv-todo li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; font-size: 14px; }
.bt-rv-todo li + li { border-top: 1px solid var(--bt-line); }
.bt-rv-todo li span { flex: 0 0 auto; font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--bt-bad-bg); color: var(--bt-bad); }
.bt-rv-todo-empty { font-size: 14px; color: var(--bt-muted); margin: 0; }

/* 收合區：送件與審核、案件紀錄、更多操作 */
.bt-rv-fold { border: 1px solid var(--bt-line); border-radius: 10px; background: #f8fbfa; margin-top: 12px; }
.bt-rv-fold > summary { list-style: none; cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.bt-rv-fold > summary::-webkit-details-marker { display: none; }
.bt-rv-fold > summary::after { content: "⌄"; color: var(--bt-muted); font-size: 18px; line-height: 1; }
.bt-rv-fold[open] > summary::after { transform: rotate(180deg); }
.bt-rv-fold > div { padding: 0 12px 12px; }
.bt-rv-next .bt-rv-fold[data-bt-submit] { margin-top: 14px; }
body.bt-rv .bt-rv-fold #case-submission-section:not(:empty) { border: 0; padding: 4px 4px 0; margin: 0; background: none; }
.bt-rv-more { text-align: right; margin-top: 4px; }
.bt-rv-more > details { display: inline-block; text-align: left; }
.bt-rv-more summary { list-style: none; cursor: pointer; color: var(--bt-green-700); font-size: 14px; font-weight: 600; padding: 8px 4px; }
.bt-rv-more summary::-webkit-details-marker { display: none; }
.bt-rv-more summary::after { content: " ⌄"; }
.bt-rv-more-menu { display: flex; flex-direction: column; gap: 6px; padding: 8px; margin-top: 4px; border: 1px solid var(--bt-line); border-radius: 10px; background: var(--bt-card); min-width: 200px; }
.bt-rv-more-menu button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--bt-line); border-radius: 8px; background: var(--bt-card); font: inherit; font-size: 14px; color: var(--bt-ink); cursor: pointer; text-align: left; }
.bt-rv-more-menu button:hover { border-color: var(--bt-green-500); color: var(--bt-green-700); }

/* the moved blocks keep their own look; the page's old status card and its duplicate head are not needed with the new head */
body.bt-rv .id-header { display: none; }
body.bt-rv .id-status-card { display: none; }
body.bt-rv .id-5p-head { display: none; }
/* BT-5P-FIX-013 §6 — the 初步評估 block no longer repeats the 總覽's 缺件 and 下一步: it points there (js/case-pre-assessment-ui.js),
   so nothing is hidden by CSS any more */

@media (max-width: 760px) {
  .bt-rv-fig strong { font-size: 17px; }
  .bt-rv-card { padding: 14px 14px; }
  .bt-rv-primary { display: flex; width: 100%; }
  .bt-rv-steps li { font-size: 12px; }
  .bt-rv-tabs { top: 57px; }
}
@media (max-width: 480px) {
  /* three figures one under another, the figure on the right of its label */
  .bt-rv-can { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .bt-rv-fig { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 10px 12px; }
  .bt-rv-fig small { grid-column: 1; grid-row: 1; font-size: 13px; color: var(--bt-ink); font-weight: 600; }
  .bt-rv-fig span { grid-column: 1; grid-row: 2; }
  .bt-rv-fig strong { grid-column: 2; grid-row: 1 / span 2; margin: 0; text-align: right; }
}

/* the workflow blocks the server describes (初步評估、收件清單、補件與估價、送件與審核、案件進度): their renderers leave the look
   to the page, which had none -- cards, headings, lists, buttons and fields here; their content is untouched */
body.bt-rv #case-pre-assessment-section:not(:empty),
body.bt-rv #case-intake-section:not(:empty),
body.bt-rv #case-missing-section:not(:empty),
body.bt-rv #case-submission-section:not(:empty) {
  background: var(--bt-card); border: 1px solid var(--bt-line); border-radius: 12px; padding: 16px 20px; margin-bottom: 12px; font-size: 14px; color: var(--bt-ink); line-height: 1.6;
}
body.bt-rv :is(#case-pre-assessment-section, #case-intake-section, #case-missing-section, #case-submission-section, #case-progress-timeline) :is(h2, h3) { font-size: 16px; font-weight: 700; color: var(--bt-green-900); margin: 0 0 10px; }
body.bt-rv :is(#case-pre-assessment-section, #case-intake-section, #case-missing-section, #case-submission-section, #case-progress-timeline) h4 { font-size: 14px; font-weight: 700; margin: 14px 0 6px; }
body.bt-rv :is(#case-pre-assessment-section, #case-intake-section, #case-missing-section, #case-submission-section) :is(ul, ol) { list-style: none; margin: 0 0 10px; padding: 0; border: 1px solid var(--bt-line); border-radius: 10px; overflow: hidden; }
body.bt-rv :is(#case-pre-assessment-section, #case-intake-section, #case-missing-section, #case-submission-section) li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; }
body.bt-rv :is(#case-pre-assessment-section, #case-intake-section, #case-missing-section, #case-submission-section) li + li { border-top: 1px solid var(--bt-line); }
body.bt-rv :is(#case-pre-assessment-section, #case-intake-section, #case-missing-section, #case-submission-section, #case-progress-timeline) button {
  min-height: 36px; padding: 6px 14px; margin: 4px 6px 4px 0; border: 1px solid var(--bt-green-500); border-radius: 8px; background: var(--bt-card); color: var(--bt-green-700); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
body.bt-rv :is(#case-pre-assessment-section, #case-intake-section, #case-missing-section, #case-submission-section) button:disabled { border-color: var(--bt-line); color: #9aa8a4; background: #f6f8f7; cursor: not-allowed; }
body.bt-rv :is(#case-pre-assessment-section, #case-intake-section, #case-missing-section, #case-submission-section) li button { margin: 0; min-height: 32px; padding: 2px 12px; }
body.bt-rv #case-submission-section label, body.bt-rv .csub-field { display: block; margin: 6px 0; }
body.bt-rv :is(#case-pre-assessment-section, #case-intake-section, #case-missing-section, #case-submission-section) input:not([type=checkbox]):not([type=radio]) {
  display: block; width: 100%; max-width: 420px; min-height: 38px; margin: 4px 0 8px; padding: 6px 10px; border: 1px solid #cfd9d6; border-radius: 8px; font: inherit; font-size: 14px;
}
body.bt-rv .cpre-meta, body.bt-rv .cpre-block { margin: 0 0 10px; }
body.bt-rv .cpre-meta-key, body.bt-rv .csub-record-key { color: var(--bt-muted); font-size: 13px; }
body.bt-rv #case-progress-timeline { padding: 4px 4px 0; font-size: 14px; }
body.bt-rv #case-progress-timeline dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 10px; }
body.bt-rv #case-progress-timeline dt { color: var(--bt-muted); }
body.bt-rv #case-progress-timeline dd { margin: 0; }
body.bt-rv #case-progress-timeline ol { margin: 0; padding-left: 18px; }
body.bt-rv #id-5p-attachments ul { list-style: none; margin: 0; padding: 0; }
body.bt-rv #id-5p-attachments li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--bt-line); font-size: 14px; }
body.bt-rv #id-5p-attachments li:last-child { border-bottom: 0; }
body.bt-rv #id-5p-attachments button { min-height: 32px; padding: 2px 12px; border: 1px solid var(--bt-green-500); border-radius: 8px; background: var(--bt-card); color: var(--bt-green-700); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
