/* 業務後台（Operate）：同一套字與色，資訊密度優先。
   訊號：急迫＝圓點燈（紅黃綠），價金＝金屬牌（金牌／銀牌／鐵牌）；形狀不同又都附文字，色弱也分得出來。 */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
body.admin { min-height: 100vh; background: var(--ground); font-size: 15px; }
.a-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; height: 56px; padding: 0 24px; background: var(--white); border-bottom: 1px solid var(--hairline); }
.a-mark { display: inline-flex; align-items: center; gap: 12px; color: var(--navy); text-decoration: none; font-weight: 600; font-size: 20px; flex: none; }
.a-mark .brand-logo { height: 32px; }
.a-mark span { font-family: var(--serif); font-weight: 700; font-size: 14px; letter-spacing: .14em; color: var(--gold); white-space: nowrap; }
.a-tabs { display: flex; gap: 2px; align-self: stretch; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.a-tabs button { flex: none; white-space: nowrap; border: 0; background: none; padding: 0 14px; font: inherit; font-weight: 600; color: var(--navy-soft); border-bottom: 2px solid transparent; cursor: pointer; }
.a-tabs button[aria-selected="true"] { color: var(--indigo); border-bottom-color: var(--indigo); }
.a-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-weight: 600; white-space: nowrap; }
.a-main { padding: 24px 24px 56px; max-width: 1520px; margin: 0 auto; }
.a-muted { color: var(--navy-soft); }
.a-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 18px; border-radius: 999px; font: inherit; font-weight: 600; letter-spacing: .04em; text-decoration: none; cursor: pointer; border: 1.5px solid var(--navy); transition: background-color .2s var(--ease-out), color .2s var(--ease-out); white-space: nowrap; }
.a-btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.a-btn.primary { background: var(--indigo); border-color: var(--indigo); color: var(--white); }
.a-btn.primary:hover { background: var(--indigo-hover); }
.a-btn.ghost { background: var(--white); color: var(--navy); }
.a-btn.ghost:hover { background: var(--navy); color: var(--white); }
.a-btn:disabled { opacity: .6; cursor: progress; }
.link { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--navy); cursor: pointer; text-align: left; }
.link:hover { color: var(--indigo); text-decoration: underline; text-underline-offset: 3px; }

.a-login { max-width: 400px; margin: 8vh auto 0; padding: 32px; background: var(--white); border: 1px solid var(--hairline); border-radius: 16px; box-shadow: 0 16px 40px rgb(20 42 110 / .08); }
.a-login h1 { margin: 0; font-family: var(--serif); font-size: 26px; letter-spacing: .08em; }
.a-login p { margin: 8px 0 20px; line-height: 1.7; font-size: 14px; }
.a-login form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.a-login input { width: 100%; min-width: 0; }
.a-login label { font-weight: 600; font-size: 14px; margin-top: 6px; }
.a-login input, .toolbar input, .toolbar select, .a-detail select, .a-detail input, .a-detail textarea {
  min-height: 40px; padding: 6px 12px; font: inherit; color: var(--navy); background: #FBFBFD; border: 1.5px solid #CBD2E3; border-radius: 10px;
}
.a-login input { min-height: 44px; }
.a-login input:focus, .toolbar input:focus, .toolbar select:focus, .a-detail select:focus, .a-detail input:focus, .a-detail textarea:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-wash); background: var(--white); }
.a-login .a-btn { margin-top: 14px; min-height: 46px; }
/* 兩步驟驗證（2026-10-27） */
.mfa-enroll p { margin: 0 0 10px; font-size: 14px; line-height: 1.7; }
.mfa-qr { display: block; width: 200px; height: 200px; margin: 4px auto 12px; background: var(--white); border: 1px solid var(--hairline); border-radius: 10px; }
.mfa-secret { display: inline-block; max-width: 100%; padding: 4px 8px; border-radius: 6px; background: #F2F4F9; font-size: 14px; letter-spacing: .08em; overflow-wrap: anywhere; user-select: all; }
.a-login .mfa-hint { margin: 2px 0 0; font-size: 13px; }
.a-login #mfa-code { font-size: 20px; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.a-login .mfa-back { justify-self: center; margin-top: 10px; font-weight: 600; font-size: 14px; }
.a-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: #FFF6E0; border: 1px solid #EBD38F; color: #5C4410; font-size: 14px; line-height: 1.6; }
.a-banner p { margin: 0; }
.a-banner.d-assist { display: block; margin: 12px 0 0; }
.a-detail :disabled, .d-controls :disabled { opacity: .5; cursor: not-allowed; }
.a-banner.alert { background: #FCEEEE; border-color: #E7B4B0; color: #8C1D18; }
.a-banner .link { flex: none; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.a-error { margin: 6px 0 0; padding: 10px 12px; border-radius: 10px; background: #FCEEEE; color: #8C1D18; font-size: 14px; }

.a-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.a-head h1 { margin: 0; font-family: var(--serif); font-size: 26px; letter-spacing: .06em; }
.a-head p { margin: 4px 0 0; font-size: 14px; }
.a-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.a-note-line { margin: 8px 0 0; font-size: 13px; }
.a-card { background: var(--white); border: 1px solid var(--hairline); border-radius: 14px; padding: 18px 20px; }
.a-card h2 { margin: 0 0 4px; font-family: var(--serif); font-size: 18px; letter-spacing: .06em; }
.a-card > p { margin: 0 0 12px; font-size: 13.5px; }

/* signals */
.light { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.light i { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.light.r { color: #B42318; } .light.r i { background: #D92D20; }
.light.y { color: #8A5A00; } .light.y i { background: #E0A100; }
.light.g { color: #1E7A46; } .light.g i { background: #2E9E5E; }
.tier { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 52px; height: 24px; padding: 0 13px; border-radius: 4px; font-family: var(--serif); font-weight: 700; font-size: 12.5px; letter-spacing: .12em; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .65), inset 0 -1px 0 rgb(0 0 0 / .22), 0 1px 2px rgb(0 0 0 / .25); }
.tier::before, .tier::after { content: ""; position: absolute; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 50%; background: rgb(0 0 0 / .28); box-shadow: inset 0 1px 0 rgb(255 255 255 / .5); }
.tier::before { left: 4px; } .tier::after { right: 4px; }
.tier.gold { background: linear-gradient(180deg, #F6E3A8 0%, #D9B45E 45%, #B88E3A 55%, #E1C27A 100%); color: #4A3510; text-shadow: 0 1px 0 rgb(255 245 210 / .7); }
.tier.silver { background: linear-gradient(180deg, #FAFBFD 0%, #D5DAE2 45%, #AEB6C2 55%, #DDE1E8 100%); color: #2E3440; text-shadow: 0 1px 0 rgb(255 255 255 / .8); }
.tier.iron { background: linear-gradient(180deg, #9AA0A8 0%, #6C727B 45%, #4E545C 55%, #7A8089 100%); color: #F3F4F6; text-shadow: 0 -1px 0 rgb(0 0 0 / .45); }
.tier.none { background: #F4F5F8; color: #6F7891; box-shadow: inset 0 0 0 1px #C8CDD8; letter-spacing: .06em; }
.tier.none::before, .tier.none::after { display: none; }
.ovr { margin-left: 6px; font-size: 11px; color: var(--navy-soft); border: 1px dashed #B7C1D8; border-radius: 6px; padding: 0 5px; }

/* overview */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.kpi { text-align: left; cursor: pointer; font: inherit; color: var(--navy); }
.kpi:hover { border-color: var(--indigo); }
.kpi b { display: block; font-family: var(--serif); font-size: 30px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--navy-soft); }
.ov-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; align-items: start; }
.matrix { display: grid; grid-template-columns: 70px repeat(4, minmax(0, 1fr)); gap: 6px; }
.mh { display: flex; justify-content: center; padding: 4px 0 8px; }
.mr { display: flex; align-items: center; }
.mc { min-height: 60px; border-radius: 10px; border: 1px solid var(--hairline); background: #FAFBFD; font-family: var(--serif); font-size: 24px; font-weight: 700; color: var(--navy); cursor: pointer; font-variant-numeric: tabular-nums; }
.mc:hover { border-color: var(--indigo); }
.mc.hot { background: #FCEBEA; border-color: #F0C4C1; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.todo-list li.a-muted { display: block; }
.todo-list li.done b { text-decoration: line-through; color: var(--navy-soft); font-weight: 600; }
.todo-list input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--indigo); }
.due { font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--navy-soft); }
.due.late, .late { color: #B42318; font-weight: 700; }
.due.today { color: #8A5A00; font-weight: 700; }

/* list */
.saved { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 18px 0 8px; font-size: 13.5px; }
.saved button { border: 1px solid transparent; background: none; color: var(--indigo); padding: 3px 8px; border-radius: 999px; cursor: pointer; font: inherit; }
.saved button:hover { text-decoration: underline; text-underline-offset: 3px; }
.saved button.on { border-color: var(--indigo); background: #F4F3FF; font-weight: 700; text-decoration: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.toolbar input[type=search] { flex: 1 1 260px; }
.chips { display: inline-flex; gap: 6px; }
.chipf { display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; border: 1.5px solid var(--hairline); border-radius: 999px; background: var(--white); cursor: pointer; }
.chipf[aria-pressed="true"] { border-color: var(--indigo); background: #F4F3FF; box-shadow: 0 0 0 2px var(--indigo-wash); }
.a-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(380px, 1fr); gap: 16px; align-items: start; }
.a-table-wrap { background: var(--white); border: 1px solid var(--hairline); border-radius: 14px; overflow: auto; }
.a-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.a-table th, .a-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hairline); }
.a-table thead th { position: sticky; top: 0; background: #F7F8FB; font-family: var(--serif); font-size: 13px; letter-spacing: .06em; white-space: nowrap; }
.a-table tbody tr { cursor: pointer; transition: background-color .15s var(--ease-out); }
.a-table tbody tr:hover { background: #F7F8FB; }
.a-table tbody tr.is-on { background: #F1F0FE; }
.a-table tbody tr:focus-visible { outline: 2px solid var(--indigo); outline-offset: -2px; }
.a-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--navy-soft); }
.num { font-variant-numeric: tabular-nums; }
.a-sub { display: block; font-size: 12.5px; color: var(--navy-soft); }
.a-tag { margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #F3EEE1; color: #6E5520; white-space: nowrap; }
.stage { font-size: 12.5px; padding: 1px 8px; border-radius: 999px; background: #EEF0F6; white-space: nowrap; }
.a-empty { margin: 0; padding: 28px; text-align: center; color: var(--navy-soft); }

/* detail */
.a-detail { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; padding: 20px 22px; background: var(--white); border: 1px solid var(--hairline); border-radius: 14px; }
.a-detail h2 { margin: 0; font-family: var(--serif); font-size: 21px; letter-spacing: .04em; }
.a-detail h3 { margin: 18px 0 6px; font-family: var(--serif); font-size: 15px; letter-spacing: .08em; color: var(--navy-soft); }
.d-signals { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 4px; }
.why { margin: 4px 0 0; font-size: 12.5px; color: var(--navy-soft); line-height: 1.6; }
.override { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #F7F8FB; }
.override input { flex: 1 1 200px; }
.d-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0 0; }
.d-controls label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; font-size: 12.5px; color: var(--navy-soft); font-weight: 600; }
.d-controls select, .d-controls input { width: 100%; min-width: 0; }
.d-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--hairline); margin: 16px 0 12px; }
.d-tabs button { border: 0; background: none; padding: 8px 10px; font: inherit; font-weight: 600; font-size: 14px; color: var(--navy-soft); border-bottom: 2px solid transparent; cursor: pointer; }
.d-tabs button[aria-selected="true"] { color: var(--indigo); border-bottom-color: var(--indigo); }
.compose { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 14px; }
.compose textarea { min-height: 70px; resize: vertical; line-height: 1.6; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.small-note { font-size: 12px; }
.tl { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--hairline); }
.tl li { position: relative; padding: 0 0 14px 10px; }
.tl li::before { content: ""; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--white); border: 2px solid #B7C1D8; }
.tl li.k-call::before, .tl li.k-meeting::before, .tl li.k-email::before { border-color: var(--indigo); }
.tl li.k-note::before { border-color: #B8913A; }
.tl time { font-size: 12px; color: var(--navy-soft); font-variant-numeric: tabular-nums; }
.tl p { margin: 2px 0 0; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-add { display: grid; grid-template-columns: minmax(0, 1fr) 150px 110px auto; gap: 6px; margin-bottom: 8px; }
.a-kv { margin: 0; display: grid; }
.a-kv div { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--hairline); }
.a-kv dt { color: var(--navy-soft); font-size: 14px; }
.a-kv dd { margin: 0; overflow-wrap: anywhere; }
.a-kv a { color: var(--indigo); }
.a-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); margin: 0; padding: 12px 18px; border-radius: 12px; background: var(--navy); color: var(--white); box-shadow: 0 12px 30px rgb(20 42 110 / .3); z-index: 20; }

@media (max-width: 1180px) {
  .a-layout, .ov-grid { grid-template-columns: minmax(0, 1fr); }
  .a-detail { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .a-bar { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 4px 12px; }
  .a-tabs { order: 3; width: 100%; }
  .a-tabs button { padding: 10px 12px; }
  .a-main { padding: 16px 16px 48px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .matrix { grid-template-columns: 52px repeat(4, minmax(0, 1fr)); }
  .d-controls, .task-add { grid-template-columns: minmax(0, 1fr); }
  .a-login input, .toolbar input, .toolbar select, .a-select, .a-detail input, .a-detail select, .a-detail textarea { font-size: 16px; }
}

/* ---------------- 第二期：看板、週行事曆、報表、側邊詳情 ---------------- */
.a-select { min-height: 40px; padding: 6px 12px; font: inherit; color: var(--navy); background: #FBFBFD; border: 1.5px solid #CBD2E3; border-radius: 10px; }
.a-select:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-wash); background: var(--white); }
.scope-line { margin: 14px 0 0; padding: 9px 14px; border-radius: 10px; background: #F4F3FF; font-size: 13.5px; }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 14px; flex-wrap: wrap; }
.d-export { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }

/* 看板：七個階段一欄一欄；暫停放最後、底色較淡 */
.board { display: grid; grid-template-columns: repeat(7, minmax(170px, 1fr)); gap: 8px; margin-top: 16px; padding-bottom: 10px; overflow-x: auto; scroll-snap-type: x proximity; }
.col { display: flex; flex-direction: column; min-height: 440px; padding: 8px; border-radius: 14px; background: #E9EBF1; scroll-snap-align: start; transition: background-color .15s var(--ease-out), box-shadow .15s var(--ease-out); }
.col header { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 10px; }
.col h2 { margin: 0; font-family: var(--serif); font-size: 15px; letter-spacing: .08em; }
.col header .num { font-weight: 700; color: var(--navy-soft); }
.col-paused { background: #F0F0F2; }
.col.over { background: #E4E2FB; box-shadow: inset 0 0 0 2px var(--indigo); }
.col-body { display: grid; gap: 8px; align-content: start; flex: 1; }
.col-empty { margin: 0; padding: 18px 8px; border: 1.5px dashed #C3C8D6; border-radius: 10px; text-align: center; font-size: 12.5px; color: var(--navy-soft); }
.is-dragging .col-empty { border-color: var(--indigo); color: var(--indigo); }
.kc { padding: 10px 12px; background: var(--white); border: 1px solid var(--hairline); border-radius: 12px; box-shadow: 0 1px 2px rgb(20 42 110 / .06); cursor: grab; transition: box-shadow .15s var(--ease-out), opacity .15s var(--ease-out); }
.kc:hover { box-shadow: 0 6px 16px rgb(20 42 110 / .12); }
.kc:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.kc.is-on { border-color: var(--indigo); }
.kc.dragging { opacity: .45; cursor: grabbing; }
.kc-sig { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.kc-sig .num { margin-left: auto; font-size: 12px; }
.kc-co { display: block; font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; }
.kc-meta { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--navy-soft); }
.board-note { grid-column: 1 / -1; margin: 0; }

/* 週行事曆：四種事件＝四種底色＋左邊條；客戶希望時段用虛線（還沒確定） */
.k-diagnosis { --k: #3A36C9; --kb: #3A36C9; }
.k-slot { --k: #F6F5FF; --kb: #8D89E6; }
.k-follow_up { --k: #E7F4F2; --kb: #2E8C82; }
.k-task { --k: #FFF6E3; --kb: #E0A100; }
.cal-nav { align-items: center; }
.cal-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin: 18px 0 10px; }
.cal-range { margin: 0; font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--navy-soft); }
.cal-legend li::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 6px; vertical-align: -1px; border-radius: 3px; background: var(--k); border: 1.5px solid var(--kb); }
.cal-legend .k-slot::before { border-style: dashed; }
.cal-overdue { margin: 0 0 12px; padding: 12px 14px; border: 1px solid #F0C4C1; border-radius: 14px; background: #FCEEEE; }
.cal-overdue h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 15px; letter-spacing: .06em; color: #8C1D18; }
.cal-overdue p { margin: 8px 0 0; font-size: 12.5px; }
.ev-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-row .ev { width: auto; max-width: 280px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { display: flex; flex-direction: column; gap: 6px; min-height: 280px; padding: 10px; background: var(--white); border: 1px solid var(--hairline); border-radius: 14px; }
.day h2 { display: flex; align-items: baseline; gap: 6px; margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--navy-soft); }
.day h2 b { font-family: var(--serif); font-size: 18px; color: var(--navy); }
.day h2 em { margin-left: auto; padding: 1px 8px; border-radius: 999px; background: var(--indigo); color: var(--white); font-style: normal; font-size: 11.5px; font-weight: 700; }
.day.today { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-wash); }
.day.past { background: #FAFAFB; }
.day-empty { margin: 0; color: #B4BACA; }
.ev { display: block; width: 100%; padding: 6px 8px 6px 10px; text-align: left; font: inherit; font-size: 12.5px; line-height: 1.45; color: var(--navy); background: var(--k); border: 1px solid var(--kb); border-left-width: 3px; border-radius: 8px; cursor: pointer; transition: box-shadow .15s var(--ease-out); }
.ev:hover { box-shadow: 0 4px 12px rgb(20 42 110 / .14); }
.ev:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.ev b { display: block; overflow-wrap: anywhere; }
.ev-k { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--navy-soft); }
.ev-t { display: block; color: var(--navy-soft); overflow-wrap: anywhere; }
.ev.k-diagnosis { color: var(--white); }
.ev.k-diagnosis .ev-k, .ev.k-diagnosis .ev-t { color: rgb(255 255 255 / .85); }
.ev.k-slot { border-style: dashed; border-left-style: solid; }
.ev.late { --kb: #D92D20; background: #FCEEEE; }
.ev.late .ev-k { color: #B42318; }
.ev.done { opacity: .62; }
.ev.done b { text-decoration: line-through; }

/* 報表與匯出 */
.exports { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.exp { display: flex; flex-direction: column; }
.exp h2 { font-size: 19px; }
.exp ul { flex: 1; margin: 10px 0 18px; padding-left: 1.2em; font-size: 13.5px; line-height: 1.8; }
.exp .a-btn { align-self: flex-start; }
.rules { margin-top: 16px; }
.rules-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rules-table th, .rules-table td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hairline); line-height: 1.7; }
.rules-table th { background: #F7F8FB; font-family: var(--serif); font-size: 13px; letter-spacing: .06em; }
.rules-table td:first-child { width: 96px; }
.rules-notes { margin: 12px 0 0; padding-left: 1.2em; font-size: 13px; line-height: 1.8; color: var(--navy-soft); }
.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }

/* 側邊詳情（總覽、看板、行事曆點客戶時；名單頁仍用右欄） */
.a-drawer { position: fixed; inset: 0; z-index: 30; }
.a-scrim { position: absolute; inset: 0; background: rgb(20 42 110 / .28); animation: a-fade .18s var(--ease-out); }
.a-drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); overflow: auto; background: var(--white); box-shadow: -18px 0 40px rgb(20 42 110 / .18); animation: a-slide .22s var(--ease-out); }
.a-drawer-panel .a-detail { position: static; max-height: none; padding: 22px 24px 40px; border: 0; border-radius: 0; }
.a-drawer-x { position: sticky; top: 10px; float: right; z-index: 1; width: 40px; height: 40px; margin: 10px 10px 0 0; border: 1px solid var(--hairline); border-radius: 50%; background: var(--white); color: var(--navy); font-size: 22px; line-height: 1; cursor: pointer; }
.a-drawer-x:hover { border-color: var(--navy); }
body.drawer-open { overflow: hidden; }
@keyframes a-slide { from { transform: translateX(28px); opacity: 0; } }
@keyframes a-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .a-scrim, .a-drawer-panel { animation: none; } }

@media (max-width: 1100px) {
  .week { grid-template-columns: minmax(0, 1fr); }
  .day { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 6px 12px; min-height: 0; }
  .day h2 { grid-row: 1 / span 30; flex-direction: column; align-items: flex-start; gap: 0; margin: 0; }
  .day h2 em { margin: 4px 0 0; }
  .day > :not(h2) { grid-column: 2; }
  .exports { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .board { grid-template-columns: repeat(7, 80vw); }
  .cal-nav { width: 100%; }
  .cal-nav .a-select { flex: 1 1 140px; }
  .a-drawer-panel .a-detail { padding: 16px 16px 40px; }
  .d-controls { grid-template-columns: minmax(0, 1fr); }
}
.d-diag { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; font-size: 12.5px; color: var(--navy-soft); font-weight: 600; }
.d-diag .row { flex-wrap: nowrap; }
.d-diag input { flex: 1 1 auto; min-width: 0; }

/* 參觀碼 */
.codes-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; margin-top: 18px; align-items: start; }
.code-new { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.code-new h2, .code-list h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 18px; letter-spacing: .06em; }
.code-new label { font-weight: 600; font-size: 14px; margin-top: 4px; }
.code-new input, .code-new select { width: 100%; min-width: 0; min-height: 42px; padding: 8px 12px; font: inherit; color: var(--navy); background: #FBFBFD; border: 1.5px solid #CBD2E3; border-radius: 10px; }
.code-new input:focus, .code-new select:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-wash); background: var(--white); }
.code-new .a-btn.primary { margin-top: 8px; }
.code-issued { margin-top: 10px; padding: 14px; border-radius: 12px; background: #F8F4EA; }
.code-issued p { margin: 0; }
.code-big { margin: 8px 0 10px !important; font-family: var(--serif); font-weight: 700; font-size: 30px; letter-spacing: .24em; color: var(--navy); user-select: all; }
.code-list .mono { font-variant-numeric: tabular-nums; font-family: var(--serif); font-weight: 700; letter-spacing: .12em; }
.code-st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.code-st.active { background: var(--indigo-wash); color: var(--indigo); }
.code-st.expired, .code-st.revoked { background: #EEF0F4; color: #5B6478; }
/* 帳號管理（2026-10-27）：沿用參觀碼分頁的版面 */
.code-st.pending { background: #FFF6E0; color: #6E5520; }
.code-st.locked { background: #FCEEEE; color: #8C1D18; }
.acc-url { margin: 8px 0 6px; font-size: 13px !important; }
.acc-note { margin: 0 0 10px !important; font-size: 13px; }
.acc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.code-list .acc-table { min-width: 720px; }
.acc-table td:nth-child(-n+3), .acc-table td:nth-child(5) { white-space: nowrap; }
.a-login .invite-for { margin: 0 0 6px; font-weight: 600; color: var(--navy); }
@media (max-width: 960px) { .codes-grid { grid-template-columns: minmax(0, 1fr); } }
.code-list .table-wrap { overflow-x: auto; }
.code-list .a-table { min-width: 640px; }
.code-list .a-table tbody tr { cursor: default; }
.code-list .a-table tbody tr:hover { background: none; }

/* 系統紀錄（只給管理員） */
.audit-table { min-width: 980px; font-size: 14px; }
.audit-table tbody tr { cursor: default; }
.audit-table td.nowrap { white-space: nowrap; }
.audit-table .mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
.au-kind { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 999px; background: #EEF0F6; color: var(--navy-soft); font-size: 12px; white-space: nowrap; }
.audit-filters { margin-top: 16px; }
.audit-filters input[type=date] { width: auto; }
.audit-filters select { min-width: 0; max-width: 100%; }
#au-who { flex: 1 1 240px; }
@media (max-width: 640px) {
  .audit-filters > input[type=date] { flex: 1 1 40%; }
  .audit-filters select, .audit-filters input[type=search] { flex: 1 1 100%; }
}
.audit-more { margin: 14px 0 0; text-align: center; }

.code-new .code-note { margin: 4px 0 6px; font-size: 13px; }

/* ---------- 兩棟切換（2026-10-27）：AgentDesk｜Ensemo｜全部 ---------- */
.a-bldg { display: inline-flex; flex: none; padding: 3px; gap: 2px; border: 1px solid var(--hairline); border-radius: 999px; background: #F6F6F9; }
.a-bldg button { min-height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--navy-soft); }
.a-bldg button:hover { color: var(--navy); }
.a-bldg button[aria-checked="true"] { background: var(--navy); color: var(--white); }
body[data-b="em"] .a-bldg button[aria-checked="true"] { background: #1A2340; color: #E9D7A6; }
body[data-b="em"] .a-bar { border-bottom: 2px solid #C9A962; }
.a-bt { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: 1px; letter-spacing: .02em; }
.a-bt.ad { background: #ECEBFB; color: #2E2AB3; }
.a-bt.em { background: #F3EBD8; color: #6E5520; }
td > .a-bt:first-child { margin: 0 6px 0 0; }
@media (max-width: 899px) { .a-bldg { order: 3; } }
