: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: 12px; 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: 13px; font-weight: 800; letter-spacing: .06em; }
h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
h2 { margin: 0; font-size: 20px; }
h3 { margin: 0; font-size: 16px; }
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: 14px; }
.status-chip { white-space: nowrap; padding: 7px 10px; border-radius: 999px; font-size: 12px; 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: 32px; 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: 14px; }
.card .request-amount { font-weight: 800; font-size: 19px; 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: 12px; }
.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: 12px; }
.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: 13px; 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: 21px; }
.check-field { display: flex; align-items: flex-start; gap: 10px; margin: 13px 0; line-height: 1.5; font-size: 14px; }
.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: 14px; 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: 13px; }
.receipt-list li { padding: 7px 10px; overflow-wrap: anywhere; border-radius: 8px; background: var(--bg); }
.receipt-list li + li { margin-top: 5px; }
.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: 13px; }
.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: 12px; }
.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: 14px; }
.timeline span { color: var(--muted); font-size: 12px; }
.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: 12px; }
.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: 13px; }
.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: 34px; }
.success-screen .amount { font-size: 30px; 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: 11px; }
.nav-item > span { font-size: 20px; 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: 10px; 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: 13px; }
.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: 12px; }
.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: 17px; }
.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: 24px; }
.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: 12px; }
.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: 12px; 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: 12px; 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: 12px; } }
.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: 12px; }
.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: 17px; }
  .sidebar-brand span { margin-top: 3px; color: var(--muted); font-size: 12px; }
  .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: 18px; text-align: center; }
  .desktop-nav-item > b { font-size: 14px; }
  .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: 10px;
    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: 13px; }
  .sidebar-user div > span { margin-top: 3px; color: var(--muted); font-size: 11px; }
  .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: 16px; font-weight: 850; }
  .desktop-context { display: inline; margin-left: 10px; padding-left: 18px; border-left: 1px solid var(--line); color: var(--muted); font-size: 12px; }
  .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: 30px; }
  .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: 12px; font-weight: 750; }
  .metric-card strong { display: block; margin: 11px 0 6px; font-size: 25px; letter-spacing: -.02em; }
  .metric-card strong em { color: var(--muted); font-size: 13px; font-style: normal; }
  .metric-card .metric-status { color: var(--brand-2); font-size: 20px; }
  .metric-card small { color: var(--muted); }
  .metric-card i { display: block; margin-top: 11px; color: var(--brand-2); font-size: 12px; 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: 11px; 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: 11px; }
  .request-table-row strong { font-size: 16px; }
  .request-table-row .table-action { color: var(--brand-2); font-size: 12px; 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; }
#tenantPicker { display: grid; gap: 6px; min-width: 0; margin: 16px 0; font-size: 12px; }
#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: 14px; 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: 22px; 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: 24px; }

.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: 26px; }
.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: 13px; }
.settings-table td:first-child { min-width: 180px; overflow-wrap: anywhere; }
.settings-table input[type="number"] { width: 90px; padding: 8px; }
.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:14px;}.account-identity>span {font-size:12px;}
.account-logout {width:100%;min-height:44px;background:transparent;border:0;border-top:1px solid var(--line);color:inherit;text-align:left;padding:8px;}
.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,.account-logout: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:154px;}}
@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-logout{width:auto;flex:none;border-top:0;border-left:1px solid var(--line);padding:8px 14px;}
  .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; }
/* 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: 30px; }
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: 24px; 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: 13px; }
  .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: 14px; }
  .metric-card { padding: 16px 10px; }
  .metric-card strong { font-size: 20px; }
  .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: 26px; }
  .bottom-nav { background: var(--surface); backdrop-filter: none; }
  .hero .amount { font-size: 28px; }
  .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:15px;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:12px;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:13px;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:13px;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:20px}.profile-identity p {font-size:13px;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:20px}.profile-secondary {margin-left:auto;min-height:36px;border:1px solid var(--line);border-radius:6px;background:white;padding:0 14px;font-size:13px}.danger {color:#B3342E}.role-tag {display:inline-block;background:#ECE8DF;border-radius:4px;padding:2px 8px;margin-right:6px;font-size:12px;font-weight:700}
.profile-card .card {padding:0;border:0;box-shadow:none}.profile-card .field {font-size:13px}.profile-card .button {min-height:36px;font-size:13px;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:18px}.text-action,.profile-secondary{min-height:44px}}
/* 第二輪：人員、通知與月報沿用 Ledger 的紙色與深綠配色。 */
.nav-group-label{font-size:11px;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:18px;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:14px}.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:12px;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:13px}.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:11px}.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:12px;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:12px}.report-metrics strong{display:block;font-family:'IBM Plex Mono',monospace;font-size:24px;margin-top:12px;overflow-wrap:anywhere}.report-metrics strong small{display:inline}.monthly-controls{display:flex;gap:8px;align-items:center;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}.report-trend{margin:24px 0}.report-trend h2,.report-tables h2{font-size:15px;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:12px;display:block;padding-top:8px}.report-month small{font-size:10px;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:13px}.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:20px}.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:9px}.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:16px;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:13px}}
@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}}
[data-brand-logo][hidden], [data-brand-text][hidden]{display:none!important}.sidebar-brand>.brand-wordmark{font-size:20px;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:13px;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}

@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:13px}.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:22px}
.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:13px}
.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:32px;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:12px}
.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:26px}.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:20px;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:13px;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:24px;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:14px;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:20px;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:14px;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:14px}
.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(--paper,#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}
