:root {
  --status-pending-fg: #8A5300;  --status-pending-bg: #F8EBD3;  /* 待核准 */
  --status-review-fg:  #2B5A87;  --status-review-bg:  #E4EDF6;  /* 會計審核 */
  --status-approved-fg:#0E6E45;  --status-approved-bg:#E1F0E7;  /* 已核准 */
  --status-paid-fg:    #0E6E45;  --status-paid-bg:    #E1F0E7;  /* 已出帳 */
  --status-rejected-fg:#9B2F24;  --status-rejected-bg:#F6E3DF;  /* 已退回 */
  --status-draft-fg:   #5F646B;  --status-draft-bg:   #EEEFF1;  /* 草稿 */

  --touch-min: 44px;        /* 所有可點擊元素最小高度 */
  --input-height: 48px;     /* 手機表單欄位 */
  --bp-tablet: 760px;       /* 沿用 main 既有斷點 */
  --bp-desktop: 1180px;

  --brand: #3A4A44;          /* 未指定租戶時的中性預設 */
  --brand-strong: #2B3833;   /* 白字按鈕底色 */
  --brand-tint: #EEF1EF;

  --bg: #F7F5F0;  --surface: #FFFFFF;  --surface-2: #ECE8DF;
  --ink: #272727; --muted: #625E56;    --line: #E6E2D9;  --line-strong: #272727;
  --primary-bg: var(--brand-strong); --primary-fg: #FFFFFF;
  --neutral-btn-bg: #272727;         --neutral-btn-fg: #FFFFFF;
  --radius-sm: 4px; --radius: 6px; --radius-lg: 8px;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-display: "Noto Serif TC", "PingFang TC", serif;
  --font-num: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: none;

  --paper: var(--bg); --white: var(--surface); --card: var(--surface);
  --brand-2: var(--brand-strong); --accent: var(--status-pending-fg);
  --success: var(--status-approved-fg); --warning: var(--status-pending-fg); --danger: var(--status-rejected-fg);
  font-family: var(--font-body);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
.app-shell { width: 100%; min-height: 100dvh; background: var(--paper); padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.app-frame { min-width: 0; }
.desktop-sidebar, .desktop-context, .desktop-request-table, .desktop-create, .metric-grid { display: none; }
.topbar { position: sticky; top: 0; z-index: 5; height: 68px; display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: rgba(244,247,245,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand-logo { display: block; width: 190px; max-width: calc(100% - 110px); height: 42px; object-fit: contain; object-position: left center; }
.product-name { padding-left: 10px; border-left: 1px solid #cbd7d3; color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.icon-button { margin-left: auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--brand); font-weight: 800; }
.help-button { margin-left: auto; width: 36px; height: 36px; border: 1px solid #b9cbc6; border-radius: 50%; color: var(--brand); background: white; font-weight: 900; }
.help-button + .icon-button { margin-left: 0; }
.tour-button { min-height: 36px; margin-left: auto; padding: 7px 11px; border: 1px solid #b9cbc6; border-radius: var(--radius-lg); color: var(--brand); background: white; font-weight: 800; white-space: nowrap; }
.tour-button + .help-button { margin-left: 0; }
main { max-width: 720px; margin: auto; padding: 20px 16px 32px; }
.eyebrow { margin: 0 0 5px; color: var(--brand-2); font-size: 0.8125rem; font-weight: 800; letter-spacing: .06em; }
h1 { margin: 0; font-size: 1.625rem; letter-spacing: -.02em; }
h2 { margin: 0; font-size: 1.25rem; }
h3 { margin: 0; font-size: 1rem; }
p { line-height: 1.55; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 0.875rem; }
.status-chip { white-space: nowrap; padding: 7px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; }
.status-chip.pending { color: var(--warning); background: #fff0d7; }
.status-chip.review { color: #2a5f8a; background: #e6f2fb; }
.status-chip.approved, .status-chip.paid { color: var(--success); background: #dff2e9; }
.hero { padding: 22px; color: white; background: var(--bg); border-radius: var(--radius-lg); box-shadow: none; }
.hero p { margin: 6px 0 20px; color: var(--muted); }
.hero .amount { display: block; margin: 2px 0; font-size: 2rem; font-weight: 800; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; }
.hero small { color: var(--muted); }
.hero-action { color: var(--brand); background: white; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 24px 2px 10px; }
.section-title button { border: 0; background: transparent; color: var(--brand-2); font-weight: 700; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; box-shadow: none; }
.card + .card { margin-top: 10px; }
.request-card { width: 100%; text-align: left; color: inherit; transition: border-color .16s, transform .16s, box-shadow .16s; }
button.request-card { appearance: none; }
button.request-card:hover, button.request-card:focus-visible { border-color: #9cb8b1; transform: translateY(-1px); box-shadow: none; }
.card-head { display: flex; justify-content: space-between; gap: 12px; }
.card p { margin: 5px 0; color: var(--muted); font-size: 0.875rem; }
.card .request-amount { font-weight: 800; font-size: 1.1875rem; color: var(--ink); }
.meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-action { position: relative; min-height: 92px; padding: 16px 38px 16px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); text-align: left; background: white; color: var(--ink); transition: border-color .16s, transform .16s; }
.quick-action::after { content: "→"; position: absolute; right: 15px; top: 50%; color: var(--brand-2); font-weight: 900; transform: translateY(-50%); }
.quick-action:hover, .quick-action:focus-visible { border-color: #91afa8; transform: translateY(-1px); }
.quick-action b { display: block; margin-bottom: 6px; }
.quick-action span { color: var(--muted); font-size: 0.75rem; }
.quick-action.primary { color: white; background: var(--brand); border-color: var(--brand); }
.quick-action.primary span { color: var(--primary-fg); }
.quick-action.primary::after { color: white; }
.form-card { background: white; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.form-grid, .line-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.line-grid { grid-template-columns: 1.4fr .8fr 1fr; }
.section-title.compact { margin-top: 6px; }
.line-item { min-width: 0; margin: 0 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.line-item legend { padding: 0 7px; color: var(--muted); font-size: 0.8125rem; font-weight: 800; }
.line-item .field { min-width: 0; margin-bottom: 11px; }
.line-item select { display: block; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.line-footer, .total-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.line-footer button { border: 0; background: transparent; color: var(--danger); }
.total-box { margin: 12px 0 18px; padding: 15px; border-radius: var(--radius-lg); background: var(--surface-2); }
.total-box strong { font-size: 1.3125rem; }
.check-field { display: flex; align-items: flex-start; gap: 10px; margin: 13px 0; line-height: 1.5; font-size: 0.875rem; }
.check-field input { width: 22px; min-height: 22px; flex: 0 0 auto; margin-top: 1px; }
.check-field input[role="switch"] { appearance: none; width: 42px; height: 24px; min-height: 24px; border: 1px solid #667085; border-radius: var(--radius-lg); background: #667085; padding: 2px; cursor: pointer; }
.check-field input[role="switch"]::before { content: ''; display: block; width: 18px; height: 18px; border-radius: 50%; background: white; transition: transform .15s; }
.check-field input[role="switch"]:checked { background: var(--brand-strong); border-color: var(--brand-strong); }
.check-field input[role="switch"]:checked::before { transform: translateX(16px); }
.check-field input[role="switch"]:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 3px; }

@media (max-width: 520px) { .form-grid, .line-grid { grid-template-columns: 1fr; gap: 0; } }
.field { display: block; margin-bottom: 17px; }
.field > span { display: block; margin: 0 0 7px; font-size: 0.875rem; font-weight: 750; }
.required::after { content: " *"; color: var(--danger); }
input, select, textarea { width: 100%; min-height: 48px; padding: 12px 13px; color: var(--ink); background: #fbfcfb; border: 1px solid #ccd8d4; border-radius: var(--radius-lg); outline: none; }
/* Keep the native select interaction, with a consistently inset indicator. */
select:not([multiple]):not([size]), select[size="1"]:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}
select:not([multiple]):not([size]), select[size="1"]:not([multiple]),
.people-detail .profile-row select:not([multiple]):not([size]),
.people-detail .profile-row select[size="1"]:not([multiple]) { padding-right: 40px; }
@media (forced-colors: active) {
  select:not([multiple]):not([size]), select[size="1"]:not([multiple]) { appearance: auto; background-image: none; }
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: none; }
.money-input { position: relative; }
.money-input::before { content: "NT$"; position: absolute; left: 13px; top: 14px; color: var(--muted); font-weight: 700; }
.money-input input { padding-left: 48px; font-weight: 800; }
.upload-box { display: grid; place-items: center; min-height: 100px; padding: 15px; border: 1.5px dashed #9db5af; border-radius: var(--radius-lg); background: #f5faf8; color: var(--brand-2); text-align: center; }
.upload-box small { display: block; color: var(--muted); margin-top: 4px; }
.file-input { position: absolute; width: 1px; height: 1px; min-height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.receipt-list { margin: 10px 0 14px; padding: 0; list-style: none; color: var(--muted); font-size: 0.8125rem; }
.receipt-list li { padding: 7px 10px; overflow-wrap: anywhere; border-radius: 8px; background: var(--bg); }
.receipt-list li + li { margin-top: 5px; }
.file-thumbnail { display: inline-block; width: 48px; height: 48px; margin: 4px 8px 4px 0; object-fit: cover; vertical-align: middle; border-radius: 6px; border: 1px solid var(--line, #e5e7eb); }
.upload-note { margin-bottom: 15px; }
.button { min-height: 48px; padding: 12px 18px; border: 0; border-radius: var(--radius-lg); font-weight: 800; }
.button.primary { color: white; background: var(--brand); }
.button.success { color: white; background: var(--brand-strong); }
.button.danger { color: var(--danger); background: #fae9e9; }
.button.secondary { color: var(--ink); background: #e8eeec; }
.button.full { width: 100%; }
.button-row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 18px; }
.back-button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0 0 14px; padding: 7px 10px; border: 0; border-radius: var(--radius-lg); color: var(--brand-2); background: #e8eeec; font-weight: 800; }
.next-task, .delete-request { margin-top: 12px; }
.detail-list { margin: 0; }
.detail-row { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border: 0; }
.detail-row dt { color: var(--muted); font-size: 0.8125rem; }
.detail-row dd { margin: 0; font-weight: 650; }
.receipt { display: flex; gap: 12px; align-items: center; margin-top: 14px; padding: 12px; background: var(--bg); border-radius: var(--radius-lg); }
.receipt-icon { width: 44px; height: 52px; display: grid; place-items: center; border-radius: 8px; background: white; border: 1px solid var(--line); }
.receipt p { margin: 0; color: var(--ink); font-weight: 700; }
.receipt span { color: var(--muted); font-size: 0.75rem; }
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; top: 16px; bottom: 16px; left: 12px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 20px 36px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline i { position: absolute; left: 5px; top: 3px; width: 16px; height: 16px; border: 3px solid white; border-radius: 50%; background: var(--success); box-shadow: none; }
.timeline b { display: block; font-size: 0.875rem; }
.timeline span { color: var(--muted); font-size: 0.75rem; }
.approval-panel { margin-top: 14px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.inline-help { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: 4px; border: 1px solid #a7bbb5; border-radius: 50%; color: var(--brand); background: white; font-weight: 900; vertical-align: middle; }
.signature-wrap { position: relative; margin: 12px 0; }
#signatureCanvas { width: 100%; height: 150px; background: white; border: 1px dashed #9aa9a5; border-radius: var(--radius-lg); touch-action: none; }
.clear-signature { position: absolute; top: 9px; right: 9px; padding: 6px 9px; border: 0; border-radius: 8px; background: #eef2f0; color: var(--muted); font-size: 0.75rem; }
.stamp-preview { display: flex; align-items: center; gap: 14px; margin: 12px 0; }
.stamp { width: 74px; height: 74px; display: grid; place-items: center; padding: 8px; border: 3px double #b13d35; border-radius: 50%; color: #b13d35; font-family: serif; font-weight: 900; text-align: center; transform: rotate(-7deg); background: rgba(255,255,255,.55); }
.stamp-preview p { margin: 0; color: var(--ink); font-weight: 700; }
.stamp-preview small { color: var(--muted); }
.audit-box { padding: 14px; border-radius: var(--radius-lg); background: var(--surface-2); font-size: 0.8125rem; }
.audit-box strong { display: block; margin-bottom: 4px; }
.audit-request .timeline { margin-top: 18px; }
.audit-request + .audit-request { margin-top: 14px; }
.success-screen { text-align: center; padding: 28px 5px; }
.success-icon { width: 76px; height: 76px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 50%; color: white; background: var(--success); font-size: 2.125rem; }
.success-screen .amount { font-size: 1.875rem; font-weight: 850; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 6px; }
.bottom-nav { position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.bottom-nav[hidden] { display: none; }
.nav-item { position: relative; display: grid; place-items: center; gap: 2px; min-height: 51px; border: 0; color: var(--muted); background: transparent; font-size: 0.6875rem; }
.nav-item > span { font-size: 1.25rem; line-height: 1; }
.nav-item.active { color: var(--brand); font-weight: 800; }
.nav-item i { position: absolute; top: 1px; right: calc(50% - 22px); min-width: 17px; height: 17px; padding: 2px; border-radius: 999px; color: white; background: #c24b43; font-size: 0.625rem; font-style: normal; }
.sheet-backdrop { position: fixed; z-index: 20; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: rgba(15,30,28,.46); }
.sheet-backdrop[hidden] { display: none; }
.bottom-sheet { width: min(520px, 100%); padding: 11px 18px 20px; border-radius: var(--radius-lg); background: white; box-shadow: none; }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 17px; border-radius: var(--radius-lg); background: #cbd4d1; }
.bottom-sheet > p { margin: 5px 0 15px; color: var(--muted); font-size: 0.8125rem; }
.role-option { width: 100%; padding: 14px 12px; border: 0; border-top: 1px solid var(--line); text-align: left; background: white; }
.role-option b, .role-option span { display: block; }
.role-option span { margin-top: 3px; color: var(--muted); font-size: 0.75rem; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 92px; width: max-content; max-width: calc(100% - 32px); padding: 11px 15px; border-radius: var(--radius-lg); color: white; background: var(--brand-strong); opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.legal-list { display: grid; gap: 10px; margin-top: 14px; }
.legal-card h2 { font-size: 1.0625rem; }
.source-link { display: inline-block; margin: 8px 0 14px; color: var(--brand-2); font-weight: 750; }
.document-link { display: block; margin-top: 14px; text-align: center; text-decoration: none; }
.help-backdrop { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(15,30,28,.56); }
.help-backdrop[hidden] { display: none; }
.help-dialog { position: relative; width: min(480px, 100%); padding: 24px; border-radius: var(--radius-lg); background: white; box-shadow: none; }
.help-dialog > p:not(.eyebrow) { color: var(--muted); }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eef2f0; font-size: 1.5rem; }
.tour-picker-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(15,30,28,.62); }
.tour-picker-backdrop[hidden], .tour-layer[hidden] { display: none; }
.tour-picker { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 36px); overflow-y: auto; padding: 24px; border-radius: var(--radius-lg); background: white; box-shadow: none; }
.tour-picker > p:not(.eyebrow), .tour-card > p:not(.eyebrow) { color: var(--muted); }
.tour-choices { display: grid; gap: 9px; margin-top: 18px; }
.tour-choice { width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); text-align: left; background: white; }
.tour-choice b, .tour-choice span { display: block; }
.tour-choice span { margin-top: 4px; color: var(--muted); font-size: 0.75rem; }
.tour-layer { position: fixed; z-index: 60; inset: 0; pointer-events: none; }
.tour-focus { position: fixed; z-index: 1; left: var(--target-left); top: var(--target-top); width: var(--target-width); height: var(--target-height); border: 4px solid #f4b942; border-radius: var(--radius-lg); background: transparent; box-shadow: none; }
.tour-card { position: fixed; z-index: 2; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); width: min(520px, calc(100% - 28px)); padding: 20px; border-radius: var(--radius-lg); background: white; box-shadow: none; transform: translateX(-50%); pointer-events: auto; }
.tour-layer.card-at-top .tour-card { top: 82px; bottom: auto; }
.tour-controls { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; margin-top: 16px; }
.tour-target { border-radius: var(--radius-lg); }
.notification-list { display: grid; gap: 10px; }
.notification-card { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 12px; width: 100%; color: var(--ink); text-align: left; }
.notification-card span > b, .notification-card span > small { display: block; }
.notification-card span > small { margin-top: 4px; color: var(--muted); }
.notification-card > i { color: var(--brand-2); font-size: 0.75rem; font-style: normal; }
.notification-dot { width: 9px; height: 9px; border-radius: 50%; background: #b7c2bf; }
.notification-card.unread .notification-dot { background: #c24b43; box-shadow: none; }
.uat-preview { display: grid; gap: 14px; }
.uat-preview .page-head { margin-bottom: 4px; }
.uat-form { display: grid; gap: 4px; }
.uat-request, .uat-notification { box-shadow: none; }
.uat-notification { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 12px; }
.uat-notification span > b, .uat-notification span > small { display: block; }
.uat-notification span > small { margin-top: 4px; color: var(--muted); }
.uat-notification > i { color: var(--brand-2); font-size: 0.75rem; font-style: normal; }
.uat-preview [aria-disabled="true"] { cursor: default; }
@media (max-width: 520px) { .product-name { display: none; } .tour-button { padding-inline: 8px; font-size: 0.75rem; } }
.auth-screen { min-height: calc(100dvh - 150px); display: grid; place-items: center; }
.auth-card { width: min(100%, 460px); padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: none; }
.auth-card > p:not(.eyebrow) { color: var(--muted); }
.auth-card form { margin-top: 20px; }
.text-button, .inline-link { margin-top: 12px; padding: 8px 0; border: 0; color: var(--brand-2); background: transparent; font-weight: 750; }
.setup-steps { padding-left: 22px; color: var(--muted); line-height: 1.8; }
.secret-code { margin: 16px 0; padding: 14px; border-radius: var(--radius-lg); background: var(--surface-2); }
.secret-code span, .secret-code strong { display: block; }
.secret-code strong { margin-top: 5px; overflow-wrap: anywhere; letter-spacing: .08em; }
.recovery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.recovery-grid code { padding: 9px; border: 1px solid var(--line); border-radius: var(--radius-lg); text-align: center; background: var(--surface-2); }
.onboarding-step { margin: 14px 0; padding: 14px; border-radius: var(--radius-lg); background: var(--surface-2); }
.onboarding-step p { margin: 5px 0 0; color: var(--muted); }
.confirm-row { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0; }
.confirm-row input { width: 22px; min-height: 22px; margin: 0; }
.temporary-password { margin-bottom: 14px; padding: 16px; border: 1px solid #e1c386; border-radius: var(--radius-lg); background: #fff7e5; }
.temporary-password b, .temporary-password code { display: block; }
.temporary-password code { margin: 10px 0; padding: 9px; border-radius: 8px; background: white; overflow-wrap: anywhere; }
.user-list { padding: 0 16px; }
.user-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-row b, .user-row span { display: block; }
.user-row span { margin-top: 4px; color: var(--muted); font-size: 0.75rem; }
.user-row .button { min-height: 40px; padding: 8px 12px; white-space: nowrap; }

@media (min-width: 760px) {
  body { background: var(--bg); }
  .app-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    width: 100%;
    min-height: 100dvh;
    padding-bottom: 0;
    background: var(--bg);
  }
  .app-shell.is-gated { display: block; }
  .app-shell.is-gated .desktop-sidebar { display: none; }
  .app-shell.is-gated .app-frame { min-height: 100dvh; }
  .desktop-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    padding: 26px 18px 20px;
    color: white;
    background: var(--bg);
    box-shadow: none;
  }
  .sidebar-brand { padding: 0 8px 26px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
  .sidebar-brand img { display: block; width: 188px; height: 44px; padding: 5px 8px; border-radius: var(--radius-lg); background: white; object-fit: contain; }
  .sidebar-brand div { margin-top: 15px; }
  .sidebar-brand b, .sidebar-brand span { display: block; }
  .sidebar-brand b { font-size: 1.0625rem; }
  .sidebar-brand span { margin-top: 3px; color: var(--muted); font-size: 0.75rem; }
  .desktop-nav { display: grid; gap: 6px; margin-top: 26px; }
  .desktop-nav-item {
    position: relative;
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: center;
    min-height: 48px;
    padding: 10px 12px;
    border: 0;
    border-radius: var(--radius-lg);
    color: var(--muted);
    text-align: left;
    background: transparent;
  }
  .desktop-nav-item > span { font-size: 1.125rem; text-align: center; }
  .desktop-nav-item > b { font-size: 0.875rem; }
  .desktop-nav-item:hover { color: white; background: rgba(255, 255, 255, .07); }
  .desktop-nav-item.active { color: white; background: rgba(255, 255, 255, .13); }
  .desktop-nav-item i {
    position: absolute;
    right: 12px;
    min-width: 19px;
    height: 19px;
    padding: 2px 5px;
    border-radius: 999px;
    color: white;
    background: var(--status-rejected-fg);
    font-size: 0.625rem;
    font-style: normal;
    text-align: center;
  }
  .sidebar-user { display: flex; align-items: center; gap: 11px; margin-top: auto; padding: 16px 9px 2px; border-top: 1px solid rgba(255, 255, 255, .12); }
  .sidebar-avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--brand); background: var(--surface-2); font-weight: 850; }
  .sidebar-user b, .sidebar-user div > span { display: block; }
  .sidebar-user b { font-size: 0.8125rem; }
  .sidebar-user div > span { margin-top: 3px; color: var(--muted); font-size: 0.6875rem; }
  .app-frame { min-height: 100dvh; }
  .topbar {
    height: 72px;
    padding: 0 32px;
    background: rgba(255, 255, 255, .93);
    border-color: #d9e3e0;
  }
  .topbar .brand-logo { display: none; }
  .product-name { padding: 0; border: 0; color: var(--ink); font-size: 1rem; font-weight: 850; }
  .desktop-context { display: inline; margin-left: 10px; padding-left: 18px; border-left: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; }
  .help-button { margin-left: auto; }
  main { max-width: 1340px; margin: 0 auto; padding: 34px 36px 56px; }
  .bottom-nav { display: none; }
  .dashboard-heading { align-items: center; margin-bottom: 24px; }
  .dashboard-heading h1 { font-size: 1.875rem; }
  .desktop-create { display: inline-flex; align-items: center; justify-content: center; }
  .metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
  .metric-card { appearance: none; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); text-align: left; background: white; box-shadow: none; transition: border-color .16s, transform .16s, box-shadow .16s; }
  .metric-card:hover, .metric-card:focus-visible { border-color: #91afa8; transform: translateY(-2px); box-shadow: none; }
  .metric-card span, .metric-card small { display: block; }
  .metric-card span { color: var(--muted); font-size: 0.75rem; font-weight: 750; }
  .metric-card strong { display: block; margin: 11px 0 6px; font-size: 1.5625rem; letter-spacing: -.02em; }
  .metric-card strong em { color: var(--muted); font-size: 0.8125rem; font-style: normal; }
  .metric-card .metric-status { color: var(--brand-2); font-size: 1.25rem; }
  .metric-card small { color: var(--muted); }
  .metric-card i { display: block; margin-top: 11px; color: var(--brand-2); font-size: 0.75rem; font-style: normal; font-weight: 800; }
  .dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; align-items: stretch; }
  .dashboard-grid .hero { min-height: 100%; padding: 26px 28px; }
  .dashboard-actions { padding: 22px; }
  .dashboard-actions > p { margin: 7px 0 18px; }
  .dashboard-actions .quick-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-actions .quick-action { min-height: 86px; padding: 13px; }
  .mobile-request-card { display: none; }
  .desktop-request-table { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: none; }
  .request-table-head, .request-table-row { display: grid; grid-template-columns: minmax(240px, 1.8fr) minmax(150px, 1fr) 140px 150px 110px; gap: 18px; align-items: center; }
  .request-table-head { padding: 12px 20px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 0.6875rem; font-weight: 800; letter-spacing: .03em; }
  .request-table-row { width: 100%; min-height: 82px; padding: 15px 20px; border: 0; color: var(--ink); text-align: left; background: white; }
  .request-table-row + .request-table-row { border-top: 1px solid var(--line); }
  .request-table-row:hover { background: var(--bg); }
  .request-table-row span, .request-table-row small { display: block; }
  .request-table-row small { margin-top: 4px; color: var(--muted); font-size: 0.6875rem; }
  .request-table-row strong { font-size: 1rem; }
  .request-table-row .table-action { color: var(--brand-2); font-size: 0.75rem; font-weight: 800; text-align: right; }
  .detail-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 22px; align-items: start; }
  .detail-sidebar { position: sticky; top: 94px; }
  .detail-sidebar .section-title { margin-top: 20px; }
  .detail-sidebar .approval-panel { margin-top: 0; }
  .form-card { padding: 24px; }
  #requestForm { max-width: 1040px; }
  .legal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-screen { min-height: calc(100dvh - 130px); }
  .auth-card { width: min(100%, 500px); }
}

@media (min-width: 1180px) {
  .app-shell { grid-template-columns: 232px minmax(0, 1fr); }
  .desktop-sidebar { padding-inline: 22px; }
  main { padding-inline: 46px; }
}

@media (min-width: 760px) and (max-width: 980px) {
  .app-shell { grid-template-columns: 232px minmax(0, 1fr); }
  .desktop-sidebar { padding-inline: 13px; }
  .sidebar-brand img { width: 170px; }
  main { padding-inline: 24px; }
  .dashboard-grid, .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
  .request-table-head, .request-table-row { grid-template-columns: minmax(180px, 1.6fr) minmax(130px, 1fr) 120px 120px; }
  .request-table-head span:last-child, .request-table-row .table-action { display: none; }
}

.request-track-fields { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.request-track-fields > legend { font-weight: 700; margin-bottom: 12px; }
.request-selector-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 8px 0 16px; }
.request-selector-search input { min-width: 0; width: 100%; }
.request-selector-search button { padding: 10px 14px; }
@media (max-width: 759px) {
  .request-selector-search > select { grid-column: 1 / -1; min-width: 0; width: 100%; }
  .request-selector-search > button { white-space: nowrap; }
  .request-selector-search > [role=status] { grid-column: 1 / -1; }
}
#tenantPicker { display: grid; gap: 6px; min-width: 0; margin: 16px 0; font-size: 0.75rem; }
#tenantPicker > span:first-child { color: var(--muted); }
#tenantPicker[hidden] { display: none; }
.tenant-select-control { position: relative; display: block; min-width: 0; }
#tenantSelect { appearance: none; width: 100%; min-width: 0; height: 44px; padding: 7px 32px 7px 10px; font: inherit; font-size: 0.875rem; font-weight: 600; border: 1px solid #a6b5ad; border-radius: 6px; background: var(--surface); color: var(--ink); text-overflow: ellipsis; cursor: pointer; }
#tenantSelect:disabled { cursor: default; opacity: .7; }
.tenant-chevron { position: absolute; right: 12px; top: 50%; transform: translateY(-60%); font-size: 1.375rem; line-height: 1; pointer-events: none; color: var(--ink); }
#mobileTenantSlot { padding: 0 16px; }
@media (min-width: 760px) {
  #mobileTenantSlot { display: none; }
}

.monthly-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 20px; }
.monthly-controls label { display: grid; gap: 6px; }
.monthly-controls input { min-width: 0; max-width: 100%; padding: 12px; font: inherit; }
#monthlyWorkspace { overflow-wrap: anywhere; }
#monthlyWorkspace .metric-card { min-width: 0; }
#monthlyWorkspace .metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; margin: 16px 0; }
#monthlyWorkspace .metric-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; }
#monthlyWorkspace .metric-card strong { display: block; margin-top: 8px; font-size: 1.5rem; }

.report-home { display: grid; gap: 12px; margin-bottom: 20px; overflow-wrap: anywhere; }
.report-home .report-todo { display: grid; gap: 8px; text-align: left; width: 100%; color: var(--ink); }
.report-todo strong { font-size: 1.625rem; }
.report-home ul { padding-left: 20px; }
.report-home .back-button { white-space: normal; text-align: left; max-width: 100%; }
.audit-filters { display: grid; gap: 12px; margin-bottom: 16px; }
.audit-filters input, .audit-filters select { width: 100%; min-width: 0; }
@media (min-width: 760px) { .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .audit-filters > p, .audit-filters > .button-row { grid-column: 1 / -1; } }

.audit-filter-panel > summary { padding: 16px; cursor: pointer; font-weight: 700; }

.audit-event { margin: 16px 0; overflow-wrap: anywhere; }

.request-confirmation { width: min(92vw, 480px); max-height: 85dvh; overflow: auto; border: 0; border-radius: var(--radius-lg); padding: 24px; color: var(--ink); box-sizing: border-box; }
.request-confirmation::backdrop { background: rgb(0 0 0 / 45%); }
.request-confirmation p { overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.6; }
.request-confirmation [data-confirm-status] { color: #9b2929; }

.settings-table-scroll { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; }
.settings-table { width: 100%; min-width: 640px; border-collapse: collapse; text-align: left; }
.settings-table th, .settings-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.settings-table th { background: var(--surface-2); font-size: 0.8125rem; }
.settings-table td:first-child { min-width: 180px; overflow-wrap: anywhere; }
[role=tab][data-settings-tab][aria-selected="true"] { background: #293c34; color: #fff; border-color: #293c34; }
.settings-table input[type="number"] { width: 90px; padding: 8px; }
.item-type-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.item-type-tags .tag { padding: 1px 8px; border: 1px solid var(--line); border-radius: 12px; font-size: 0.8125rem; line-height: 1.5; }
.item-type-choices { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
.item-type-choices legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[data-new-item] .item-type-choices legend { position: static; width: auto; height: auto; clip: auto; font-weight: 600; margin-bottom: 4px; }
.settings-table input[type="checkbox"] { width: 20px; height: 20px; }
.settings-table form { margin: 0; }
.settings-table [role="status"]:empty { display: none; }
.settings-table [role="status"] { max-width: 240px; }

.department-policy-table input[type="checkbox"] { min-height: 20px; }

/* Persistent identity actions remain reachable outside the home screen. */
.account-dock {position:fixed;left:12px;bottom:calc(72px + env(safe-area-inset-bottom));z-index:15;width:210px;padding:8px;background:#fff;color:var(--ink);border:1px solid var(--line);border-radius: var(--radius-lg);box-shadow: none;}
.account-dock[hidden],.account-menu[hidden] {display:none;}
#accountToggle {display:flex;align-items:center;gap:10px;width:100%;padding:8px;border:0;background:transparent;color:inherit;text-align:left;min-height:44px;}
.account-identity {min-width:0;flex:1;}.account-identity b,.account-identity>span {display:block;overflow-wrap:anywhere;}.account-identity b {font-size:0.875rem;}.account-identity>span {font-size:0.75rem;}
.account-menu {position:absolute;bottom:calc(100% + 8px);left:0;width:100%;padding:6px;background:#fff;color:var(--ink);border:1px solid var(--line);border-radius:8px;box-shadow: none;}
.account-menu button {display:block;width:100%;text-align:left;background:transparent;border:0;min-height:44px;padding:10px;}
.account-menu button:hover,#accountToggle:hover {background:var(--surface-2);}
.account-dock button:focus-visible {outline:3px solid #347d6a;outline-offset:1px;}
.account-form,.account-permissions,[data-account-preferences] .card {padding:24px;margin:18px 0;max-width:760px;}
.account-form p,.account-permissions p {overflow-wrap:anywhere;}
@media(min-width:760px){.account-dock{left:14px;bottom:18px;width:192px;}.desktop-sidebar{padding-bottom:100px;}}
@media(max-width:759px){
  .app-shell:not(.is-gated) main{padding-bottom:160px;}
  .account-dock{left:0;bottom:calc(64px + env(safe-area-inset-bottom));width:100%;display:flex;align-items:center;padding:4px 12px;border-radius:0;}
  #accountToggle{flex:1;min-width:0;width:auto;}
  .account-identity b,.account-identity>span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .account-menu{left:12px;width:210px;}
}

/* Request analysis keeps long labels within mobile cards. */
.request-analytics .request-table-wrap { overflow-x: auto; }
.request-analytics table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.request-analytics th, .request-analytics td { padding: 10px 6px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.request-analytics details { margin: 12px 0; overflow-wrap: anywhere; }
.request-analytics summary { cursor: pointer; font-weight: 600; }
/* 零用金月報：手機改成逐張卡片，欄名放在每格前面。 */
@media (max-width: 640px) {
  .petty-cash-report table.petty-cash-rows thead { display: none; }
  .petty-cash-report table.petty-cash-rows tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .petty-cash-report table.petty-cash-rows td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .petty-cash-report table.petty-cash-rows td::before { content: attr(data-label); color: var(--muted); text-align: left; flex: none; }
  .case-monthly-report table.petty-cash-rows tfoot { display: none; }
}
/* 案件月報：項目標題帶小計，表尾列小計。 */
.case-monthly-report h3 { margin: 16px 0 6px; font-size: 1rem; }
.case-monthly-report h3 small { margin-left: 8px; color: var(--muted); font-weight: 400; }
.case-monthly-report tfoot td { font-weight: 600; }
/* 管理儀表板（#554）：可點的長條與洞察卡；手機 390px 不橫向捲動。 */
.drill-bars ol { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.drill-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-md, 8px); color: var(--ink); text-align: left; background: none; cursor: pointer; }
.drill-bar:hover, .drill-bar:focus-visible { border-color: var(--line); background: var(--surface-2, #f6f8f7); }
.drill-bar-label { min-width: 0; overflow-wrap: anywhere; font-weight: 650; }
.drill-bar-value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.drill-bar-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.drill-bar-track span { display: block; height: 100%; border-radius: 4px; background: var(--brand-2); }
.insight-list { display: grid; gap: 12px; margin: 20px 0; }
.insight-card header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.insight-card h3 { margin: 0; font-size: 1rem; }
.insight-badge { padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 750; background: var(--line); }
.insight-badge.is-alert { color: #8a3b12; background: #fde9dc; }
.insight-badge.is-clear { color: #1f5f4a; background: #e3f2ec; }
.insight-badge.is-muted { color: var(--muted); }
.insight-items { display: grid; gap: 8px; margin: 8px 0 0; padding-left: 18px; }
.insight-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 0; }
.insight-links .text-action { overflow-wrap: anywhere; text-align: left; }
@media(max-width:767px){ .drill-bar-value { white-space: normal; } }
/* Ledger: paper, fine rules and readable figures; tenant logos stay dynamic. */
body, .app-shell, .app-frame { background: var(--bg); }
h1, .dashboard-heading h1, .page-head h1 { font-family: var(--font-display); font-weight: 600; }
h1 { font-size: 1.875rem; }
.dashboard-heading h1 { font-family: var(--font-body); font-weight: 400; }
button, .button, a.button, summary { min-height: var(--touch-min); }
button, input, select, textarea { max-width: 100%; }
input:not([type=checkbox]):not([type=radio]), select { min-height: var(--input-height); }
:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 3px; }
.topbar { background: var(--bg); backdrop-filter: none; }
.icon-button, .help-button { width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--radius); }
.tour-button, .inline-help { min-height: 44px; }
.inline-help { width: 44px; border-radius: var(--radius); }
.nav-icon { width: 22px; height: 22px; vertical-align: middle; }
.nav-item, .desktop-nav-item { color: var(--muted); }
.nav-item.active { color: var(--ink); }
.button.primary, .quick-action.primary, .success-icon { background: var(--brand-strong); color: var(--primary-fg); border-color: var(--brand-strong); }
.button.secondary, .button.ghost { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.card, .form-card, .approval-panel, .auth-card { border-radius: var(--radius-lg); box-shadow: none; }
button.request-card:hover, .metric-card:hover, .quick-action:hover { transform: none; box-shadow: none; }
.hero { background: transparent; color: var(--ink); padding: 20px 0; border-radius: 0; border-block: 1px solid var(--line-strong); }
.hero p, .hero small { color: var(--muted); }
.hero-row { gap: 12px; flex-wrap: wrap; }
.hero-action { border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.hero .amount, .request-amount, .metric-card strong, .total-box strong, .quote-price, .quote-total, .request-table-amount { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.card h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head > div { min-width: 0; }
.card-head .status-chip { flex-shrink: 0; }
.status-chip { border-radius: var(--radius-sm); }
.status-chip.pending { color: var(--status-pending-fg); background: var(--status-pending-bg); }
.status-chip.review { color: var(--status-review-fg); background: var(--status-review-bg); }
.status-chip.approved,.status-chip.paid { color: var(--status-approved-fg); background: var(--status-approved-bg); }
.status-chip.rejected { color: var(--status-rejected-fg); background: var(--status-rejected-bg); }
.status-chip.draft { color: var(--status-draft-fg); background: var(--status-draft-bg); }
.timeline i { width: 10px; height: 10px; left: 8px; background: var(--ink); border: 0; }
.timeline::before { background: var(--line); }
.account-dock, .account-menu { color: var(--ink); background: var(--bg); border-color: var(--line); box-shadow: none; }
.sidebar-avatar { border-radius: var(--radius); color: var(--ink); background: var(--surface-2); }
.ledger-split-list { display: none; }
@media (min-width: 760px) {
  .desktop-sidebar, .request-mode .desktop-sidebar { background: var(--bg); color: var(--ink); border-right: 1px solid var(--line); box-shadow: none; padding: 28px 16px 154px; }
  .sidebar-brand { padding: 0 8px 24px; border-color: var(--line); }
  .sidebar-brand img { padding: 0; background: transparent; width: 184px; border-radius: 0; }
  .sidebar-brand span { color: var(--muted); }
  .desktop-nav-item { min-height: 44px; border-radius: var(--radius); }
  .desktop-nav-item:hover,.desktop-nav-item.active,.request-mode .desktop-nav-item.active { color: var(--ink); background: var(--surface-2); }
  .desktop-nav-item b { font-weight: 500; }
  .desktop-nav-item.active b { font-weight: 700; }
  .topbar { padding-inline: 24px; background: var(--bg); }
  main, .request-mode main { padding: 28px 24px 48px; }
  .metric-grid { gap: 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
  .metric-card { background: transparent; padding: 20px; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
  .metric-card:last-child { border-right: 0; }
  .metric-card strong { font-size: 1.5rem; white-space: nowrap; }
  .metric-card small { color: var(--muted); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-grid .hero { min-height: auto; padding: 16px 0; border-top: 0; border-bottom: 1px solid var(--line); }
  .dashboard-actions { background: transparent; padding: 20px 0; border: 0; }
  .quick-action { border-radius: var(--radius); }
  .account-dock { left: 16px; width: 200px; }
}
@media (min-width: 1180px) {
  .ledger-detail-shell { display: grid; grid-template-columns: minmax(0,1fr) 400px; gap: 24px; align-items: start; }
  .ledger-split-list { display: block; min-width: 0; }
  .ledger-split-list .desktop-request-table { display: block; border-radius: 0; box-shadow: none; overflow-x: auto; }
  .ledger-split-list .request-data-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
  .ledger-split-list th,.ledger-split-list td { padding: 12px; border-bottom: 1px solid var(--line); font-size: 0.8125rem; }
  .ledger-split-list th:first-child { width: auto; }
  .ledger-split-list th:nth-child(3) { width: 108px; }
  .ledger-split-list th:nth-child(5) { width: 36px; }
  .ledger-split-list tr > :nth-child(2),.ledger-split-list tr > :nth-child(4) { display: none; }
  .ledger-split-list .request-row-open { width: 100%; min-width: 0; }
  .ledger-split-list .request-row-open b,.ledger-split-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ledger-split-list .icon { width: 16px; height: 16px; }
  .ledger-split-list .request-data-row:has(.request-row-open:focus) { box-shadow: inset 0 0 0 1px var(--ink); }
}
@media (min-width:760px) and (max-width:1179px) {
  .desktop-context { display: none; }
  .product-name { font-size: 0.875rem; }
  .metric-card { padding: 16px 10px; }
  .metric-card strong { font-size: 1.25rem; }
  .quick-grid { grid-template-columns: 1fr; }
}
@media (max-width:759px) {
  .topbar { padding-inline: 12px; gap: 8px; }
  .topbar .brand-logo { width: 120px; max-width: 35%; }
  .tour-button { padding-inline: 6px; }
  h1 { font-size: 1.625rem; }
  .bottom-nav { background: var(--surface); backdrop-filter: none; }
  .hero .amount { font-size: 1.75rem; }
  .hero-action { margin-top: 8px; }
}
main:focus { outline: none; }
.card-head .status-chip { align-self: flex-start; }
.sidebar-avatar { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; }

::placeholder { color: var(--muted); opacity: 1; }
.ledger-split-list .request-data-row.is-selected { box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--surface); }

/* 第二輪：聯絡資料使用緊湊欄位，編輯時才顯示輸入框。 */
.profile-card {max-width:720px;background:#fff;border:1px solid var(--line);border-radius:8px;padding:28px 32px;display:grid;gap:28px}
.profile-card h2 {font-size:0.9375rem;margin:0 0 8px;padding-bottom:8px;border-bottom:1px solid #272727;display:flex;justify-content:space-between;gap:12px}
.profile-card h2 small,.profile-note {font-size:0.75rem;font-weight:400;color:var(--muted)}
.profile-card dl {margin:0}.profile-row {display:grid;grid-template-columns:112px minmax(0,1fr) auto;gap:16px;align-items:center;min-height:44px;border-bottom:1px solid #F0EDE6}
.profile-row dt {font-size:0.8125rem;color:var(--muted)}.profile-row dd {margin:0;min-width:0;overflow-wrap:anywhere}.profile-row input {width:100%;min-width:0;min-height:36px;margin:4px 0}
.profile-row [hidden] {display:none!important}.profile-actions {display:flex;gap:4px;align-items:center}.text-action {border:0;background:transparent;color:#0E6E45;font-size:0.8125rem;font-weight:700;min-height:36px;padding:0 8px;cursor:pointer}
.profile-identity {display:flex;gap:16px;align-items:center}.profile-identity b {font-size:1.25rem}.profile-identity p {font-size:0.8125rem;color:var(--muted);margin:4px 0}.profile-avatar {width:52px;height:52px;flex-shrink:0;border-radius:50%;background:#272727;color:white;display:grid;place-items:center;font-size:1.25rem}.profile-secondary {margin-left:auto;min-height:36px;border:1px solid var(--line);border-radius:6px;background:white;padding:0 14px;font-size:0.8125rem}.danger {color:#B3342E}.role-tag {display:inline-block;background:#ECE8DF;border-radius:4px;padding:2px 8px;margin-right:6px;font-size:0.75rem;font-weight:700}
.profile-card .card {padding:0;border:0;box-shadow:none}.profile-card .field {font-size:0.8125rem}.profile-card .button {min-height:36px;font-size:0.8125rem;padding:8px 12px}
@media(max-width:767px){.profile-card{padding:20px 16px;gap:24px}.profile-row{grid-template-columns:64px minmax(0,1fr) auto;gap:8px}.profile-actions{flex-direction:column;gap:0}.profile-identity b{font-size:1.125rem}.text-action,.profile-secondary{min-height:44px}}
/* 第二輪：人員、通知與月報沿用 Ledger 的紙色與深綠配色。 */
.desktop-nav .nav-settings{margin-top:18px}.nav-group-label{font-size:0.6875rem;color:var(--muted);letter-spacing:.12em;padding:18px 14px 6px}.desktop-nav{overflow:auto}.brand-wordmark{font-weight:700;font-family:'Noto Serif TC',serif;font-size:1.125rem;overflow-wrap:anywhere}.sidebar-brand [data-brand-logo]{max-width:100%;object-fit:contain}.topbar .brand-wordmark{max-width:150px}.topbar [hidden],.bell-panel[hidden],.bell-backdrop[hidden]{display:none!important}
.people-layout{display:grid;grid-template-columns:300px minmax(0,1fr);gap:24px;align-items:start}.people-list{min-width:0}.people-list .field{margin-bottom:12px}.people-row{display:flex;align-items:center;gap:12px;padding:14px 12px;width:100%;border:0;background:transparent;text-align:left;border-radius:6px;color:var(--ink);min-height:64px}.people-row.selected{background:white;box-shadow:inset 0 0 0 1px #D9D3C6}.people-row>.profile-avatar{width:32px;height:32px;font-size:0.875rem}.people-row>span:last-child{min-width:0}.people-row b,.people-row small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.people-row small{font-size:0.75rem;color:var(--muted);margin-top:4px}.people-row.inactive{opacity:.65}.people-detail{max-width:none;min-width:0}.people-detail .profile-row{grid-template-columns:72px minmax(0,1fr);gap:12px}.people-detail .profile-row>span:empty{display:none}.people-detail form>.button{display:block;margin:12px 0 0 auto}.people-roles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.people-roles label{display:flex;gap:8px;align-items:center;min-height:40px;padding:6px;border:1px solid var(--line);border-radius:4px;font-size:0.8125rem}.people-roles label:has(:checked){background:#F7F5F0;border-color:#272727}.people-roles input{width:16px;height:16px}.people-actions{display:flex;gap:12px;flex-wrap:wrap}.people-actions .profile-secondary{margin:0}.people-create{max-width:720px;margin-bottom:24px}.people-create .field{margin-bottom:12px}
#notificationBell{position:relative;margin-left:auto;flex-shrink:0}.bell-toggle{position:relative;display:grid;place-items:center;width:40px;height:40px;border:1px solid var(--line);border-radius:6px;background:white;color:#272727}.bell-toggle[aria-expanded=true]{background:#ECE8DF}.bell-badge{position:absolute;right:-6px;top:-6px;border:2px solid var(--bg);background:#C0392B;color:white;min-width:18px;border-radius:12px;padding:0 4px;font-size:0.6875rem}.bell-panel{position:absolute;right:0;top:48px;width:380px;background:white;border:1px solid var(--line);border-radius:8px;box-shadow:0 12px 32px #27272729;overflow:hidden;z-index:22}.bell-panel header{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;border-bottom:1px solid var(--line)}.bell-panel footer{text-align:center;border-top:1px solid var(--line)}.bell-item{display:flex;width:100%;gap:12px;padding:14px 16px;text-align:left;background:white;border:0;border-bottom:1px solid #F0EDE6;color:var(--ink)}.bell-item.unread{background:#FBFAF6}.bell-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;margin-top:7px;background:transparent}.unread .bell-dot{background:#C0392B}.bell-item-copy{flex:1;min-width:0}.bell-item b{font-weight:400;display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.bell-item.unread b{font-weight:700}.bell-item small,.bell-item time{font-size:0.75rem;color:var(--muted)}.bell-item time{white-space:nowrap}.bell-empty{padding:16px}.bell-backdrop{display:none}
.report-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:24px 0 12px}.report-metrics article{min-width:0;background:white;border:1px solid var(--line);border-radius:6px;padding:20px}.report-metrics span,.report-metrics small{display:block;color:var(--muted);font-size:0.75rem}.report-metrics strong{display:block;font-family:'IBM Plex Mono',monospace;font-size:1.5rem;margin-top:12px;overflow-wrap:anywhere}.report-metrics strong small{display:inline}.monthly-controls{display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap}.monthly-controls input{font-family:'IBM Plex Mono',monospace;min-width:0;width:180px}.monthly-controls>button{min-height:36px}.monthly-controls [data-month-step]{background:white;border:1px solid var(--line);border-radius:4px;width:32px;color:var(--ink)}.report-trend{margin:24px 0}.report-trend h2,.report-tables h2{font-size:0.9375rem;margin-top:0}.report-chart{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}.report-month{text-align:center;min-width:0}.report-bars{height:148px;display:flex;align-items:flex-end;justify-content:center;gap:6px;border-bottom:1px solid var(--line)}.report-bar{width:24px;max-width:32%;background:#272727;border-radius:2px 2px 0 0}.report-bar.paid{background:#0E6E45}.paid-legend{color:#0E6E45!important}.report-month b{font-size:0.75rem;display:block;padding-top:8px}.report-month small{font-size:0.625rem;display:block;overflow-wrap:anywhere;font-family:'IBM Plex Mono',monospace}.report-tables{display:grid;grid-template-columns:1fr 1fr;gap:24px}.report-tables table{width:100%;border-collapse:collapse;font-size:0.8125rem}.report-tables th,.report-tables td{text-align:left;border-bottom:1px solid var(--line);padding:10px 4px;overflow-wrap:anywhere}.report-tables td:last-child{font-family:'IBM Plex Mono',monospace}.report-links{display:flex;gap:12px}
@media(min-width:1080px){.topbar>.brand-wordmark{display:none}.topbar{z-index:20}.people-layout{grid-template-columns:340px minmax(0,1fr)}}
@media(max-width:1079px){.people-layout{grid-template-columns:240px minmax(0,1fr)}.people-roles{grid-template-columns:repeat(2,minmax(0,1fr))}.report-metrics{gap:10px}.report-metrics article{padding:14px}.report-metrics strong{font-size:1.25rem}.topbar .desktop-context{display:none}}
@media(max-width:767px){.people-layout{grid-template-columns:minmax(0,1fr);gap:20px}.people-list [data-people-results]{max-height:220px;overflow:auto}.people-roles{grid-template-columns:repeat(2,minmax(0,1fr))}.report-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.report-tables{grid-template-columns:1fr;gap:16px}.report-chart{gap:6px}.report-month small{font-size:0.5625rem}.monthly-controls{gap:6px}.monthly-controls input{width:180px}.monthly-controls>button{min-height:44px}.bell-toggle{width:44px;height:44px}.bell-panel{position:fixed;top:76px;left:8px;right:8px;width:auto;max-height:calc(100dvh - 100px);overflow:auto}.bell-backdrop{display:block;position:fixed;inset:68px 0 0;background:#27272752;z-index:21}.topbar{z-index:25}.topbar .tour-button{display:none}.topbar .product-name{display:none}.topbar .brand-wordmark{font-size:1rem;max-width:100px}.topbar #tenantPicker{min-width:0;flex:1}.topbar #tenantSelect{max-width:120px}.bottom-nav{grid-template-columns:repeat(4,1fr)}.bottom-nav .nav-item{min-height:54px;font-size:0.8125rem}}
@media(max-width:1000px){.people-layout{grid-template-columns:minmax(0,1fr)}.people-list [data-people-results]{max-height:240px;overflow:auto}.report-tables{grid-template-columns:1fr}}
@media(max-width:767px){#monthlyWorkspace>.page-head{flex-wrap:wrap;gap:16px}.monthly-controls{width:100%}.monthly-controls .button{padding-inline:10px}.monthly-filters .button-row{grid-template-columns:repeat(2,minmax(0,1fr))}.monthly-filters .button-row>[type=submit]{grid-column:1/-1}.monthly-controls [data-month-step]{min-height:48px}}
[data-brand-logo][hidden], [data-brand-text][hidden]{display:none!important}.sidebar-brand>.brand-wordmark{font-size:1.25rem;color:#272727;line-height:1.5}.desktop-nav-item{display:flex;align-items:center;min-height:44px}.desktop-nav-item>b{flex:1;min-width:0;white-space:nowrap}.profile-card .account-form,.profile-card .account-permissions,.profile-card [data-account-preferences] .card{padding:0;margin:0;max-width:none}.profile-card [role=status]:empty{display:none}.people-roles input[type=checkbox]{padding:0;margin:0;min-height:16px;min-width:16px;width:16px;height:16px}.people-roles label{min-height:44px}.profile-card .account-permissions p{font-size:0.8125rem;line-height:1.7}.account-management{display:flex;flex-wrap:wrap;gap:12px}
.people-detail .profile-row{grid-template-columns:72px minmax(0,1fr) auto}.people-detail [hidden]{display:none!important}.people-detail .profile-row dd>select{width:100%;min-width:0}.people-detail .profile-row input,.people-detail .profile-row select{height:36px;padding:6px 10px}.people-detail .profile-row{min-height:44px}
.people-item{display:flex;align-items:center;gap:2px}.people-item>.people-row{flex:1;min-width:0;width:auto}.invite-pick{flex:none;width:40px;min-height:44px;display:flex;align-items:center;justify-content:center;cursor:pointer}.invite-pick.invite-blocked{cursor:help}.invite-pick input[type=checkbox]{width:18px;height:18px;min-width:18px;min-height:18px;margin:0;padding:0}
.invite-bar{display:grid;gap:8px;margin:0 0 12px;padding:12px;border:1px solid var(--line);border-radius:6px;background:white}.invite-bar-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:0.8125rem;color:var(--muted)}.invite-bar-actions .text-action{padding:0;min-height:44px}.invite-bar>.button{width:100%;min-height:44px}.invite-results h2{font-size:0.875rem;margin:4px 0}.invite-results ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}.invite-results li{font-size:0.8125rem;line-height:1.5;overflow-wrap:anywhere}.invite-results li.sent{color:#0E6E45}.invite-results li.failed{color:var(--danger)}.invite-results li b{color:var(--ink)}.invite-results .text-action{padding:0;min-height:44px}

@media(min-width:768px){.topbar>.brand-wordmark{display:none}}
@media(min-width:768px) and (max-width:1079px){#monthlyWorkspace>.page-head{flex-wrap:wrap;gap:16px}.report-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* 公司設定延用個人資料卡片，僅管理員可編輯。 */
.account-branding>.card{padding:0;margin:0;border:0;box-shadow:none}.account-branding .field{margin-block:12px}.account-branding input{width:100%;min-width:0}.account-branding p{font-size:0.8125rem}.account-branding .button{min-height:44px}
/* 第三輪：本人簽名設定；不改共用核准簽名板。 */
.personal-signature-preview{display:block;width:min(240px,100%);aspect-ratio:5/2;object-fit:contain}
.personal-signature-backdrop{position:fixed;inset:0;z-index:2000;background:rgb(39 39 39 / 36%);display:flex;align-items:center;justify-content:center;padding:24px}
.personal-signature-dialog{background:var(--surface,#fff);border-radius:8px;padding:26px 30px;width:640px;max-width:100%;max-height:calc(100dvh - 48px);overflow:auto;display:flex;flex-direction:column;gap:16px;box-shadow:0 20px 48px rgb(39 39 39 / 22%)}
.personal-signature-dialog header,.personal-signature-dialog footer{display:flex;align-items:center;justify-content:space-between;gap:12px}
.personal-signature-dialog h2{margin:0;font-family:var(--font-serif,serif);font-size:1.375rem}
.personal-signature-dialog button{min-height:44px}
.personal-signature-dialog [hidden]{display:none!important}
.personal-signature-dialog label{display:flex;flex-direction:column;gap:6px;font-size:0.8125rem}
.personal-signature-dialog input:not([type=checkbox]):not([type=radio]){min-height:44px;width:100%;min-width:0}
.signature-methods{display:flex;border-bottom:1px solid var(--line,#e6e2d9);gap:20px}
.signature-methods button{border:0;border-bottom:2px solid transparent;background:transparent;padding:0;font:inherit;color:var(--muted)}
.signature-methods [aria-pressed=true]{border-bottom-color:var(--ink,#272727);color:var(--ink,#272727);font-weight:700}
.signature-fonts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:12px}
.signature-fonts label{position:relative;border:1px solid var(--line-strong,#cfc9bc);padding:12px;border-radius:6px;min-width:0}
.signature-fonts label:has(:checked){outline:1px solid var(--ink,#272727)}
.signature-fonts input{position:absolute;right:10px;top:10px;width:18px;height:18px;accent-color:var(--brand-strong)}
.signature-fonts span{font-size:2rem;line-height:1.8;color:#1f2a55;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-right:18px;border-bottom:1px solid var(--line-strong)}
.personal-signature-dialog canvas{width:100%;aspect-ratio:5/2;border:1px solid var(--line-strong)}
.signature-result{background:var(--surface-2,#fbfaf6);padding:10px;border:1px solid var(--line,#e6e2d9);font-size:0.75rem}
.signature-result img{display:block;width:100%;height:110px;object-fit:contain}
.personal-signature-dialog .signature-consent{flex-direction:row;align-items:center;min-height:44px}
.signature-consent input{width:20px;height:20px;flex-shrink:0}
.personal-signature-dialog [role=alert]{color:var(--status-rejected-fg,#a12f27);margin:0}
@media(max-width:600px){.personal-signature-backdrop{padding:8px}.personal-signature-dialog{padding:18px 16px;max-height:calc(100dvh - 16px)}.signature-fonts span{font-size:1.625rem}.signature-methods{gap:16px}.personal-signature-dialog footer{position:sticky;bottom:-18px;background:var(--surface,#fff);padding:12px 0}.personal-signature-dialog footer button{flex:1}}

.bottom-nav .nav-item[hidden] { display: none; }
.live-guide-panel{margin:16px 24px;padding:16px;border:2px solid #0e6e45;border-radius:12px;background:#f5faf6;scroll-margin-top:90px}
.live-guide-panel[hidden]{display:none}.live-guide-panel h2{font-size:1.25rem;margin:4px 0}.live-guide-panel p{margin:8px 0}.live-guide-controls{display:flex;flex-wrap:wrap;gap:8px}.live-guide-target{outline:3px solid #c99619;outline-offset:3px}.live-guide-panel [data-live-status]{font-size:0.8125rem;color:#526258}
@media(max-width:767px){.live-guide-panel{margin:12px;padding:12px}.live-guide-controls .button{flex:1 1 40%;min-height:44px}}
.sidebar-avatar img,.profile-avatar img{width:100%;height:100%;object-fit:cover;border-radius:inherit}.account-avatar{margin-top:24px;border-top:1px solid var(--line);padding-top:20px}.avatar-preview{width:80px;height:80px;overflow:hidden}.avatar-icons,.avatar-controls{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}.avatar-icons button{font-size:1.5rem;min-width:44px}.account-avatar input[type=file]{max-width:100%}


/* Shared help stays outside the working form so reading never discards inputs. */
.page-help-bar{display:flex;justify-content:flex-end;padding:12px 24px 0}
.page-help-bar button{display:flex;align-items:center;gap:6px;min-height:44px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--muted);font:inherit;font-size:0.875rem;padding:6px 12px}
.page-help-bar[hidden]{display:none}
.page-help-bar span{font-weight:700}
.usage-help{max-width:1000px;margin:0 auto}
.usage-help header{margin:24px 0}
.usage-help h1{margin:0 0 12px}
.usage-help h2{font-size:1.25rem;margin:28px 0 12px}
.usage-help p,.usage-help li,.usage-help dd{line-height:1.7}
.usage-help li{margin:12px 0}
.usage-help-search{display:grid;gap:8px;font-weight:600}
.usage-help-search input{font:inherit;width:100%;min-height:44px;padding:10px 12px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--ink)}
.usage-help-links{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.usage-help-links button{display:grid;gap:6px;text-align:left;padding:16px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);font:inherit}
.usage-help-links button:hover{border-color:var(--brand)}
.usage-help-links span{font-size:0.875rem;line-height:1.6;color:var(--muted)}
.usage-help-actions{border-top:1px solid var(--line)}
.usage-help-actions>div{display:grid;grid-template-columns:minmax(140px,1fr) 3fr;gap:16px;padding:16px 0;border-bottom:1px solid var(--line)}
.usage-help-actions dt{font-weight:600;line-height:1.7}
.usage-help-actions dd{margin:0}
.usage-help-note{color:var(--muted);font-size:0.875rem}
.usage-help-related .text-action,.account-help .text-action{display:inline-block;min-height:44px;margin-right:16px;text-align:left}
.usage-index-link{margin-left:16px;min-height:44px}
.account-help{margin-top:24px;border-top:1px solid var(--line);padding-top:16px}
@media(max-width:600px){.page-help-bar{padding:8px 16px 0}.usage-help-links{grid-template-columns:1fr}.usage-help-actions>div{grid-template-columns:1fr;gap:6px}.usage-index-link{margin-left:10px}}

.problem-report-button { position: fixed; right: 16px; bottom: 20px; z-index: 35; border: 1px solid #cbd2cd; border-radius: 24px; background: #fff; color: #293c34; padding: 10px 16px; box-shadow: 0 2px 8px #0001; }
.problem-report-button[hidden] { display: none !important; }
.problem-report-dialog { width: min(560px, calc(100vw - 32px)); max-height: 85dvh; overflow: auto; border: 1px solid #cbd2cd; border-radius: 12px; padding: 20px; }
.problem-report-dialog::backdrop { background: #0005; }
.problem-report-dialog textarea { width: 100%; min-height: 240px; }
@media (max-width: 760px) { .problem-report-button { right: 12px; bottom: calc(194px + env(safe-area-inset-bottom, 0px)); padding: 8px 12px; } }

/* Keep the focusable file control at the visible picker, not the grid origin. */
.upload-box { position: relative; }
.upload-box > .file-input { inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; clip: auto; cursor: pointer; }
.upload-box:focus-within { outline: 2px solid var(--brand-strong); outline-offset: 3px; }

.help-menu{position:relative;margin-left:auto}
.help-menu summary{list-style:none;display:flex;align-items:center;justify-content:center;cursor:pointer}
.help-menu summary::-webkit-details-marker{display:none}
.help-menu nav{position:absolute;right:0;top:calc(100% + 8px);z-index:80;width:190px;padding:8px;border:1px solid var(--line,#ddd);border-radius:8px;background:var(--surface,#fff);box-shadow:0 8px 28px #0002}
.help-menu nav button{display:block;width:100%;text-align:left;padding:12px;border:0;border-radius:4px;background:transparent;color:inherit;font:inherit;cursor:pointer}
.help-menu nav button:hover,.help-menu nav button:focus-visible{background:#edeae3}
.request-history>summary{font-weight:600;cursor:pointer;padding:8px 0}

.account-push [hidden]{display:none!important}
.notification-settings form{display:grid;gap:12px;margin:18px 0}
.notification-settings form>label{display:flex;align-items:center;gap:10px;font-weight:600}
.notification-settings form input[type=checkbox]{display:inline-block;flex:0 0 20px;width:20px;height:20px;min-height:20px;margin:0;accent-color:var(--brand-strong)}
.notification-settings form .profile-note{margin:0 0 10px 30px}
.notification-settings form>.button{justify-self:start}

/* #322 手機版外框、首頁、明細與我的：只影響 <760px，桌機維持原樣。 */
.mobile-home { display: none; }
@media (min-width: 760px) { .header-tenant-slot { display: none; } }
@media (max-width: 759px) {
  .app-shell, .app-frame, .request-mode .app-frame, main { background: #F4F4F2; }
  /* 頁首：logo＋公司切換在左；說明與鈴鐺為相鄰透明圖示在右。 */
  .topbar { height: 56px; padding: 0 6px 0 16px; gap: 2px; background: #fff; border-bottom: 1px solid #ECECEA; }
  .topbar .brand-logo { width: 132px; max-width: 45%; height: 30px; }
  .help-menu { margin-left: auto; }
  #notificationBell { margin-left: 0; }
  .help-menu summary.help-button, .bell-toggle { width: 44px; height: 44px; border: 0; border-radius: 22px; background: transparent; color: #1F1F1F; box-shadow: none; }
  .help-menu summary.help-button { font-size: 0; }
  .help-menu summary.help-button::before { content: "?"; display: grid; place-items: center; width: 22px; height: 22px; border: 1.8px solid currentColor; border-radius: 50%; font-size: 0.8125rem; font-weight: 800; line-height: 1; }
  .bell-toggle[aria-expanded=true], .help-menu[open] summary.help-button { background: #EFEFED; }
  .bell-badge { right: 4px; top: 4px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 0.625rem; line-height: 12px; border-color: #fff; }
  /* 公司切換：收進 logo 旁的 ▾，點開為系統原生選單；只有多公司時出現。 */
  #mobileTenantSlot { display: none; }
  .header-tenant-slot { display: flex; align-items: center; }
  .header-tenant-slot #tenantPicker { position: relative; display: block; margin: 0; }
  .header-tenant-slot #tenantPicker[hidden] { display: none; }
  .header-tenant-slot #tenantPicker > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .header-tenant-slot .tenant-select-control { width: 36px; height: 44px; }
  .header-tenant-slot #tenantSelect { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
  .header-tenant-slot .tenant-chevron { position: absolute; inset: 0; display: grid; place-items: center; color: #6B6B6B; font-size: 1.125rem; pointer-events: none; }
  /* 移除帳號列；個人資料與登出改在「我的」。 */
  .account-dock { display: none !important; }
  .app-shell:not(.is-gated) main { padding-bottom: 104px; }
  /* 底部導覽：等寬圖示＋文字，中央新增請款，固定在畫面底部。 */
  .bottom-nav { position: fixed; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #ECECEA; }
  /* 新增鈕固定在正中間；案件依權限與待辦入口互補，不能新增時其餘項目平均分配。 */
  .app-shell .bottom-nav:has(.nav-new[hidden]) { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .app-shell .bottom-nav:has(.nav-new[hidden]) [data-route=account] { grid-column: auto; }
  .bottom-nav .nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 0; color: #666666; font-size: 0.6875rem; }
  .bottom-nav .nav-icon { box-sizing: content-box; width: 22px; height: 22px; padding: 4px 16px; border-radius: 15px; }
  .bottom-nav .nav-label { font-size: 0.6875rem; font-weight: 500; }
  .bottom-nav .nav-item.active { color: #0E6E45; }
  .bottom-nav .nav-item.active .nav-icon { background: #E8F2EC; }
  .bottom-nav .nav-item.active .nav-label { font-weight: 700; }
  .bottom-nav .nav-new { justify-self: center; width: 52px; height: 52px; min-height: 52px; margin-top: -14px; border-radius: 26px; background: #0E6E45; color: #fff; box-shadow: 0 6px 16px rgba(14,110,69,.28); }
  .bottom-nav .nav-new .nav-icon { padding: 0; width: 26px; height: 26px; stroke-width: 2.2; }
  /* 表單是全螢幕任務：不顯示底部導覽，送出列固定在底部。 */
  .form-mode .bottom-nav { display: none; }
  .form-mode main { padding-bottom: 132px; }
  .app-shell.form-mode .attribution-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr); gap: 8px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #ECECEA; }
  .app-shell.form-mode .attribution-actions > p { grid-column: 1 / -1; margin: 0; }
  .app-shell.form-mode .attribution-actions > p:empty { display: none; }
  .app-shell.form-mode .attribution-actions > button[type=button] { display: none; }
  .app-shell.form-mode .attribution-actions > button { min-height: 48px; }
  /* 新增請款手機分兩步：選完類型後只留選中的一項與「更改類型」。 */
  .attributed-request.has-scope:not(.choosing-scope) .attribution-choice:not(.selected) { display: none; }
  .attributed-request.has-scope:not(.choosing-scope) .attribution-choices { grid-template-columns: minmax(0, 1fr); }
  .attributed-request.has-scope:not(.choosing-scope) .attribution-group { display: none; }
  .attribution-change { grid-column: 1 / -1; }
  .attribution-change { justify-self: start; margin-top: 4px; min-height: 40px; padding: 0 4px; border: 0; background: transparent; color: #0E6E45; font: inherit; font-size: 0.8125rem; font-weight: 700; }
  .attribution-change[hidden], .choosing-scope .attribution-change { display: none; }
  /* 首頁：白色區塊＋淺灰分隔，一個新增請款主按鈕與待處理清單。 */
  .dashboard-heading .eyebrow, .dashboard-heading > div > p, .app-shell .review-home-links, .dashboard-grid .hero, .app-shell .request-workspace .request-action-jump { display: none; }
  .dashboard-heading h1 { font-size: 1.5rem; }
  .mobile-home { display: block; margin: 0 -16px 8px; padding: 16px; background: #fff; border-top: 1px solid #ECECEA; border-bottom: 1px solid #ECECEA; }
  .mobile-home-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .mobile-home-stats button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
  .mobile-home-stats span, .mobile-home-stats small { font-size: 0.75rem; color: #6B6B6B; }
  .mobile-home-stats strong { font-family: 'IBM Plex Mono', monospace; font-size: 1.375rem; font-weight: 500; }
  .app-shell .mobile-home .mobile-home-new { width: 100%; min-height: 48px; margin-top: 16px; border: 0; border-radius: 12px; background: #0E6E45; color: #fff; font-size: 0.9375rem; }
  .app-shell .mobile-home .mobile-home-next { width: 100%; min-height: 48px; margin-top: 8px; border-radius: 12px; font-size: 0.9375rem; }
  .mobile-section-title { margin: 20px 0 8px; font-size: 0.8125rem; font-weight: 700; color: #6B6B6B; letter-spacing: .04em; }
  .mobile-todo-list { margin: 0 -16px; border-top: 1px solid #ECECEA; }
  .mobile-todo-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 16px; border: 0; border-bottom: 1px solid #ECECEA; background: #fff; color: #1F1F1F; font: inherit; font-size: 0.9375rem; text-align: left; }
  .mobile-todo-row span { flex-grow: 1; }
  .mobile-todo-row i { min-width: 22px; height: 22px; padding: 0 7px; box-sizing: border-box; border-radius: 11px; background: #C0392B; color: #fff; font-size: 0.75rem; font-style: normal; font-weight: 700; display: grid; place-items: center; }
  .mobile-todo-row em { font-style: normal; color: #707070; font-size: 1.25rem; }
  .report-home .card, .dashboard-actions.card, .request-card { border: 0; border-radius: 12px; box-shadow: none; }
  /* 清單卡片不顯示內部單號與資料版本。 */
  .request-card .card-head p, .request-card .meta span:last-child { display: none; }
  .profile-card > section, .profile-card > form, .profile-card > nav { scroll-margin-top: 64px; }
}

/* #597 我的資料：桌機與手機都是分類總覽，點卡片進入單一設定的子頁。 */
.account-role-mobile, .account-subpage-head, .account-company, .mobile-company-toggle { display: none; }
.account-index { display: grid; gap: 24px; }
.profile-card .account-group h3 { margin: 0 0 10px; padding: 0; border: 0; font-size: 0.8125rem; font-weight: 700; color: #6B6B6B; letter-spacing: .04em; }
/* #607 設定頁：個人設定與公司設定兩段。 */
.settings-section { display: grid; gap: 20px; }
.profile-card .settings-section > h2 { margin: 0; padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--line); font-size: 1.0625rem; font-weight: 600; color: #1F1F1F; }
.account-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.account-card { display: flex; align-items: flex-start; gap: 12px; min-height: 76px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #1F1F1F; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.account-card:hover { border-color: var(--brand-2); }
.account-card:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.account-card > span { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.account-card b { font-size: 0.9375rem; font-weight: 600; }
.account-card small { font-size: 0.8125rem; line-height: 1.5; color: #6B6B6B; }
.account-card em { align-self: center; font-style: normal; color: #707070; font-size: 1.25rem; }
[data-account] .profile-card > :is(section,form,button[data-department-help]) { display: none; }
[data-account] .account-subpage > :is(.profile-identity,.account-company,.account-index) { display: none; }
[data-account] .profile-card.account-subpage > .account-panel-active { display: block; }
.account-subpage .account-subpage-head { display: block; }
.account-subpage-head a { display: inline-flex; align-items: center; min-height: 44px; color: #0E6E45; font-weight: 500; text-decoration: none; }
.account-subpage-head [data-account-title] { margin: 4px 0 0; font-size: 1.375rem; font-weight: 600; }
[data-account]:has(.account-subpage) > .page-head { display: none; }
@media (min-width: 760px) { .attribution-change { display: none; } }
@media (max-width: 759px) {
  .header-tenant-slot { display: none; }
  .mobile-company-toggle:not([hidden]) { display: block; width: 40px; min-height: 44px; border: 0; background: transparent; color: #555; font-size: 1.25rem; }
  .account-role-desktop { display: none; }
  .account-role-mobile { display: block; }
  [data-account] .profile-card { padding: 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  [data-account] .profile-identity { padding: 0 0 16px; border: 0; }
  [data-account] .profile-identity > div { min-width: 0; flex: 1; }
  [data-account] .profile-identity p { white-space: normal; }
  .account-company { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 14px; border: 1px solid #E2E2DE; border-radius: 12px; background: #fff; color: #333; text-align: left; }
  .account-company > span:first-child { display: grid; gap: 4px; min-width: 0; }
  .account-company small { color: #666; }
  .account-company b { overflow-wrap: anywhere; }
  .account-company > span:last-child { flex-shrink: 0; color: #0E6E45; }
  [data-account] .profile-card.account-subpage > .account-panel-active { padding: 16px; margin: 0 -16px; background: #fff; border-radius: 12px; }
  .account-cards { grid-template-columns: minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
  .account-card { align-items: center; min-height: 64px; padding: 10px 14px; border: 0; border-bottom: 1px solid #ECECEA; border-radius: 0; }
  .account-card:last-child { border-bottom: 0; }
  .company-sheet { box-sizing: border-box; position: fixed; inset: auto 0 0; width: 100%; max-width: 100%; max-height: 80dvh; margin: 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border: 0; border-radius: 20px 20px 0 0; background: #fff; color: #222; }
  .company-sheet::backdrop { background: #0006; }
  .company-sheet header { display: flex; align-items: center; justify-content: space-between; }
  .company-sheet h2 { margin: 0; font-size: 1.25rem; }
  .company-sheet header button { min-width: 44px; min-height: 44px; border: 0; background: transparent; font-size: 1.25rem; }
  .company-sheet > p { color: #666; font-size: 0.875rem; }
  .company-sheet [data-company-id] { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 64px; padding: 12px; border: 0; border-bottom: 1px solid #eee; background: #fff; text-align: left; font: inherit; }
  .company-sheet [data-company-id] span { overflow-wrap: anywhere; }
  .company-sheet [data-company-id] small { flex-shrink: 0; }
  .company-sheet [aria-current] { background: #E8F2EC; border-radius: 10px; color: #0E6E45; }
}

@media (max-width:759px) {
  /* Keep unique role tools, without repeating the mobile summary. */
  .report-home .report-todo { display:none; }
  .dashboard-grid > div:has(> .hero) { display:none; }
  .dashboard-actions.card { padding:16px; margin:0 0 16px; }
  .dashboard-actions > p { display:none; }
  .dashboard-actions .quick-grid { gap:0; }
  .dashboard-actions .quick-action { min-height:48px; padding:12px 0; border:0; border-bottom:1px solid #ECECEA; border-radius:0; background:transparent; }
  .dashboard-actions .quick-action span { display:none; }
}

@media (max-width:759px) {
  .dashboard-actions:has(.quick-grid:empty) { display:none; }
}

/* Keep an explicit exit available even when forms hide the mobile tab bar. */
.page-navigation { position: sticky; top: 72px; z-index: 10; display: flex; justify-content: space-between; gap: 12px; padding: 0 18px; background: var(--surface, #fff); border-bottom: 1px solid var(--line); }
.page-navigation[hidden] { display: none; }
.page-navigation button { min-height: 44px; padding: 8px 12px; border: 0; background: transparent; color: var(--brand-2); font: inherit; font-weight: 500; }
@media(max-width:759px) { .page-navigation { top: 56px; padding-inline: 8px; } }

/* The shared navigation owns page exits; help keeps its return-to-form action. */
.page-navigation:not([hidden]) ~ #app [data-page-back] { display: none; }
.app-frame:has(#helpPage:not([hidden])) .page-navigation { display: none; }

/* Login, recovery and onboarding have no business form to save. */
.app-shell.is-gated .desktop-context { display: none; }

.payment-account-settings {max-width:54rem;min-width:0}
.payment-account-settings fieldset {min-width:0;margin:0 0 1rem;padding:1rem;border:1px solid var(--line,#ddd);border-radius:12px}
.payment-account-fields {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,14rem),1fr));gap:1rem}
.payment-account-settings .button {width:auto;max-width:100%;white-space:normal;margin-bottom:.5rem}
.payment-account-actions {display:flex;flex-wrap:wrap;gap:.75rem}

/* Persistent actionable errors; success text replaces the child and loses the red style. */
.operation-error{display:block;color:#a21d24;background:#fff2f2;border:1px solid #d99a9e;border-left:4px solid #a21d24;border-radius:6px;padding:12px;margin-block:8px;line-height:1.6;white-space:pre-line;overflow-wrap:anywhere;font-size:.9375rem;text-align:left}
[data-page-error]:empty{display:none}
[data-field-error],.field-error,[data-form-errors]:not(:empty),[data-request-errors]:not(:empty),[data-case-error]:not(:empty),[data-ledger-error]:not(:empty),[data-review-error]:not(:empty){color:#a21d24;white-space:pre-line;overflow-wrap:anywhere}
/* In-app file viewer (#483): fixed back bar, safe areas, no page underneath scrolling. */
body.file-viewer-open{overflow:hidden}
.file-viewer{position:fixed;inset:0;z-index:3000;display:flex;flex-direction:column;background:var(--paper,#f7f6f2);color:var(--ink,#272727)}
.file-viewer-bar{position:sticky;top:0;display:flex;align-items:center;gap:8px;min-height:56px;padding:calc(6px + env(safe-area-inset-top,0px)) calc(8px + env(safe-area-inset-right,0px)) 6px calc(8px + env(safe-area-inset-left,0px));background:#fff;border-bottom:1px solid var(--line,#e5e2da)}
.file-viewer-back,.file-viewer-download{flex-shrink:0;min-height:48px;padding:0 14px;border-radius:8px;font:inherit;font-weight:600;font-size:1rem}
.file-viewer-back{min-width:96px;border:1px solid var(--line,#d6d2c8);background:#fff;color:inherit}
.file-viewer-download{border:1px solid #272727;background:#272727;color:#fff}
.file-viewer-download[hidden]{display:none}
.file-viewer-title{flex:1;min-width:0;margin:0;font-size:1rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.file-viewer-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:auto;-webkit-overflow-scrolling:touch;padding:12px calc(12px + env(safe-area-inset-right,0px)) calc(12px + env(safe-area-inset-bottom,0px)) calc(12px + env(safe-area-inset-left,0px))}
.file-viewer-frame{flex:1;width:100%;min-height:60dvh;border:1px solid var(--line,#e5e2da);border-radius:6px;background:#fff}
.file-viewer-image{display:block;max-width:100%;height:auto;margin:0 auto;background:#fff}
.file-viewer-message,.file-viewer-hint{margin:8px 0;line-height:1.6}
.file-viewer-hint{font-size:.875rem;color:var(--muted,#6b6b6b)}
.file-viewer-error-back{min-height:48px;width:100%}
/* #501 單純員工（無審核收件匣、無案件）：手機首頁直接列出自己的請款，取代「請款」分頁；桌機不變。 */
.home-request-list { display: none; }
@media (max-width: 759px) {
  .home-request-list { display: block; margin: 8px 0 0; }
  .home-request-list .mobile-section-title { margin-top: 12px; }
  .home-recent { display: none; }
}
.people-companies{margin:8px 0 16px}.people-companies-list{list-style:none;margin:0;padding:0}.people-companies-list li{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:52px;padding:6px 0;border-bottom:1px solid #F0EDE6}.people-companies-list li>span{min-width:0}.people-companies-list b,.people-companies-list li>span>small{display:block;overflow-wrap:anywhere}.people-companies-list li>span>small{font-size:0.75rem;color:var(--muted);margin-top:2px}.people-companies-list li>.request-note{max-width:55%;text-align:right;margin:0}.people-companies-list .profile-secondary{margin:0;flex:none}
.people-companies>.request-note{margin-top:8px}@media(max-width:767px){.people-companies-list li{flex-wrap:wrap}.people-companies-list li>.request-note{max-width:none;text-align:left}}

/* Resizable desktop list columns (#533): widths come from column-resize.mjs; phones keep cards without dividers. */
.col-resizer, .column-reset-bar { display: none; }
@media (min-width: 760px) {
  [data-resizable-table] table.resizable-cols { table-layout: fixed; width: 100%; min-width: var(--table-min, 0); }
  [data-resizable-table] table.resizable-cols > thead > tr > th { position: relative; overflow: visible; }
  [data-resizable-table] table.resizable-cols > thead > tr > th.col-sized { width: var(--col-w); }
  [data-resizable-table] table.resizable-cols > thead > tr > th.col-flex { width: auto; }
  [data-resizable-table] .request-data-table td:nth-child(4) { white-space: normal; }
  .desktop-request-table.has-resizable-columns { overflow-x: auto; }
  .desktop-request-table.has-resizable-columns .request-table-head, .desktop-request-table.has-resizable-columns .request-table-row { grid-template-columns: var(--resizable-grid); min-width: var(--resizable-min, 0); }
  .has-resizable-columns .request-table-head > span { position: relative; min-width: 0; }
  .request-status-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  [data-resizable-table] .request-status-tags > .status-chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
  .col-resizer { display: block; position: absolute; top: 0; bottom: 0; right: -6px; width: 12px; cursor: col-resize; z-index: 2; touch-action: none; }
  .has-resizable-columns .request-table-head > span > .col-resizer { right: -14px; }
  .col-resizer::after { content: ''; position: absolute; top: 20%; bottom: 20%; left: 5px; width: 2px; border-radius: 1px; background: var(--muted); opacity: .35; }
  .col-resizer:hover::after, .col-resizer:focus-visible::after { opacity: 1; }
  .col-resizer:hover::after, .col-resizer:focus-visible::after { background: var(--brand); }
  .col-resizer:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 2px; }
  .column-reset-bar { display: flex; justify-content: flex-end; padding: 4px 12px; }
  .column-reset { min-height: 32px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm, 6px); background: var(--surface, #fff); color: var(--ink); font: inherit; font-size: 0.75rem; cursor: pointer; }
  .column-reset:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  .col-resizing, .col-resizing * { cursor: col-resize !important; user-select: none; }
}
.column-reset-bar[hidden] { display: none !important; }
/* 問題回報（#545） */
.help-requests-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .help-requests-layout { grid-template-columns: minmax(300px, 2fr) 3fr; } }
.help-request-new summary { cursor: pointer; }
.help-request-new form { margin-top: 12px; }
.help-request-new select, .help-request-new input, .help-request-new textarea,
.help-request-detail select, .help-request-detail input, .help-request-detail textarea,
.help-request-dialog select, .help-request-dialog input, .help-request-dialog textarea { width: 100%; }
[data-help-list] h2 { margin: 18px 0 8px; font-size: 1rem; }
[data-help-list] .nav-segmented { display: flex; gap: 6px; margin-bottom: 8px; }
[data-help-list] .nav-link { flex: 1; min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm, 6px); background: var(--white); font: inherit; font-weight: 700; }
[data-help-list] .nav-link.active { border-color: var(--brand); color: var(--brand); }
.help-request-filter select { width: 100%; min-height: 40px; margin-bottom: 8px; }
.help-request-list { display: grid; gap: 8px; }
.help-request-row { display: grid; gap: 4px; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.card.help-request-row + .card.help-request-row { margin-top: 0; }
.help-request-row.active { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.help-request-row-head { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; min-width: 0; }
.help-request-row-head b, .help-request-row-head h2 { min-width: 0; overflow-wrap: anywhere; margin: 0; }
.help-request-row small, .help-request-meta { color: var(--muted); font-size: 0.8125rem; }
.help-request-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink) !important; }
.help-request-detail h3 { margin: 16px 0 6px; font-size: 0.9375rem; }
.help-request-replies { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.help-request-replies li { border-left: 3px solid var(--line); padding: 4px 0 4px 10px; }
.help-request-replies time { margin-left: 8px; color: var(--muted); font-size: 0.75rem; }
.help-request-replies p { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.help-request-resolution h3 { margin-top: 0; }
.help-request-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.help-request-files li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: var(--radius-sm, 6px); padding: 8px 10px; }
.help-request-files li > span:first-child { display: grid; gap: 2px; min-width: 0; flex: 1 1 180px; }
.help-request-files b { overflow-wrap: anywhere; }
.help-request-files small { color: var(--muted); font-size: 0.75rem; }
.help-request-files .button-row { display: flex; gap: 8px; margin: 0; }
.help-request-resolution { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm, 6px); background: var(--status-approved-bg, #dff2e9); }
[data-help-actions] form { margin-top: 14px; }
.help-request-dialog { width: min(560px, calc(100vw - 32px)); max-height: 85dvh; overflow: auto; border: 1px solid #cbd2cd; border-radius: 12px; padding: 20px; }
.help-request-dialog::backdrop { background: #0005; }
/* #611 部門設定／請款權限：垃圾桶在部門名稱右邊同一行；搜尋篩選；固定在底部的儲存列。 */
.department-row { margin-bottom: 10px; }
.department-row-line { display: flex; align-items: flex-end; gap: 8px; max-width: 640px; }
.department-row-line .field input { width: 100%; max-width: none; }
.department-row-line .field { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.department-remove { flex: 0 0 auto; display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: #9B2F24; cursor: pointer; }
.department-remove:hover { background: #F6E3DF; }
.department-remove:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.department-remove:disabled { opacity: .45; cursor: not-allowed; }
.department-remove .ui-icon { width: 20px; height: 20px; }
.department-row-status { margin: 6px 0 0; color: #9B2F24; font-size: 0.8125rem; }
.department-row-status:empty { display: none; }
.department-page-switch { margin: 0 0 12px; }
.member-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-top: 8px; }
.member-filter .field { flex: 1 1 220px; min-width: 0; margin-bottom: 0; }
.member-filter-count { flex: 1 0 100%; margin: 0; color: var(--muted); font-size: 0.8125rem; }
.unsaved-bar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
.unsaved-bar[hidden] { display: none; }
.unsaved-bar-count { flex: 1 1 auto; margin: 0; font-weight: 750; }
.unsaved-bar-actions { display: flex; gap: 8px; }
.unsaved-bar-actions .button { min-height: 44px; }
.unsaved-bar-status { flex: 1 0 100%; margin: 0; font-size: 0.8125rem; }
.unsaved-bar-status:empty { display: none; }
.has-save-bar { padding-bottom: 120px; }
/* #611 手機：成員表改成每人一張卡片；姓名／帳號與部門在上，權限欄位帶標籤排在下方，不需左右捲動。 */
@media (max-width: 759px) {
  .settings-table-scroll:has(.member-card-table) { overflow-x: visible; border: 0; background: transparent; }
  .member-card-table { min-width: 0; }
  .member-card-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .member-card-table, .member-card-table tbody { display: block; width: 100%; }
  .member-card-table tr[data-member] { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
  .member-card-table tr[data-member][hidden] { display: none; }
  .member-card-table tr[data-member-empty]:not([hidden]) { display: block; padding: 12px; }
  .member-card-table td { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 0; border: 0; }
  .member-card-table td.member-name { display: block; min-width: 0; }
  .member-card-table td[data-label]:not(.member-name)::before { content: attr(data-label); flex: 0 1 auto; color: var(--muted); font-size: 0.8125rem; font-weight: 700; }
  .member-card-table td select { flex: 0 1 70%; min-width: 0; width: auto; }
  .member-card-table td input[type="checkbox"] { width: 24px; height: 24px; }
}
