:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --sidebar: #121826;
  --sidebar-text: #aab3c5;
  --border: #e4e7ec;
  --text: #182032;
  --muted: #5d6679;
  --accent: #3563e9;
  --accent-soft: #eaf0fe;
  --good: #16794c;
  --good-soft: #e3f4ea;
  --warn: #a35f00;
  --warn-soft: #fdf2dd;
  --bad: #b42318;
  --bad-soft: #fde9e7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}
a { color: var(--accent); text-decoration: none; }

/* ---------- 版面 ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar .brand { color: #fff; font-weight: 700; font-size: 17px; padding: 4px 10px 20px; display: flex; align-items: center; gap: 10px; }
.sidebar .brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-size: 14px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--sidebar-text); margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.sidebar nav a .count { margin-left: auto; background: var(--warn); color: #fff; font-size: 12px; border-radius: 99px; padding: 0 7px; }
.sidebar nav .section { font-size: 12px; letter-spacing: .08em; padding: 16px 12px 6px; color: #6b7590; }
.sidebar svg { width: 18px; height: 18px; flex: none; }
.sidebar .foot { margin-top: auto; padding: 12px; font-size: 13px; border-top: 1px solid rgba(255,255,255,.08); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #6b7590; margin-right: 6px; }
.dot.on { background: #32d583; }

.main { padding: 28px 32px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.panel h2 { font-size: 15px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.panel h2 .more { margin-left: auto; font-size: 14px; font-weight: 400; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stack > * + * { margin-top: 16px; }

/* ---------- 指標 ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 14px; }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.kpi .value small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.kpi.warn .value { color: var(--warn); }
.kpi.bad .value { color: var(--bad); }

/* ---------- 元件 ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

label.field { display: block; font-weight: 600; margin: 14px 0 6px; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
input[type=text], input[type=password], input[type=url], input[type=email], textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 76px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; cursor: pointer; }
.check input { margin-top: 4px; }
.check .hint { display: block; color: var(--muted); font-size: 13px; }

button, .btn {
  font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
button:hover, .btn:hover { background: #f9fafb; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: #2c55d0; }
button.good { background: var(--good); border-color: var(--good); color: #fff; font-weight: 600; }
button.danger { color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; }
button.small { padding: 4px 10px; font-size: 14px; }
button:disabled { opacity: .5; cursor: default; }

.badge { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 99px; font-size: 13px; background: #eef0f3; color: var(--muted); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.pulse::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; font-size: 15px; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.avatar.sm { width: 26px; height: 26px; font-size: 13px; }

.progress { height: 6px; background: #eceef2; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.progress.done > div { background: var(--good); }

.list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row.link { cursor: pointer; }
.list-row.link:hover { background: #fafbfc; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty .big { font-size: 15px; color: var(--text); font-weight: 600; margin-bottom: 4px; }

/* ---------- 卡片 ---------- */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.card.link { cursor: pointer; transition: border-color .15s, transform .15s; }
.card.link:hover { border-color: #c7d2fe; transform: translateY(-1px); }
.card .name { font-weight: 700; font-size: 15px; }
.card .desc { color: var(--muted); font-size: 14px; flex: 1; }
.card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.card .stats div { text-align: center; }
.card .stats b { display: block; font-size: 16px; }
.card .stats span { font-size: 12px; color: var(--muted); }
.card.inactive { opacity: .55; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { border: none; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; background: #fff; cursor: pointer; font-size: 14px; }
.chip:hover, .chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- 看板 ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(148px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.column { background: #eef0f4; border-radius: 10px; padding: 10px; min-height: 160px; }
.column h4 { margin: 0 0 10px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.column.approval { background: var(--warn-soft); }
.column.failed { background: var(--bad-soft); }
.column.done { background: var(--good-soft); }
.task { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: pointer; box-shadow: var(--shadow); }
.task:hover { border-color: #c7d2fe; }
.task + .task { margin-top: 8px; }
.task .t { font-size: 14px; font-weight: 600; }
.task .who { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 8px; }

.summary { background: var(--accent-soft); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; display: flex; gap: 12px; }
.summary .text { white-space: pre-wrap; }

.timeline { max-height: 520px; overflow-y: auto; }
.timeline .item { display: flex; gap: 10px; padding: 8px 0; }
.timeline .item + .item { border-top: 1px solid #f0f2f5; }
.timeline .item .msg { flex: 1; min-width: 0; }
.timeline .item .time { font-size: 12px; color: var(--muted); }

/* ---------- 抽屜與對話框 ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .4); z-index: 20; display: none; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 96vw); background: #fff; z-index: 21; display: none; flex-direction: column; box-shadow: -8px 0 24px rgba(16,24,40,.12); }
.drawer.open, .drawer-backdrop.open { display: flex; }
.drawer .head { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer .body { padding: 18px 22px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.drawer .foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.drawer h3 { font-size: 14px; color: var(--muted); margin: 18px 0 6px; font-weight: 600; }
.drawer h3:first-child { margin-top: 0; }

dialog { border: none; border-radius: 14px; padding: 0; width: min(640px, 94vw); box-shadow: 0 20px 48px rgba(16,24,40,.2); }
dialog::backdrop { background: rgba(16, 24, 40, .45); }
dialog .head { padding: 18px 22px 0; }
dialog .head h2 { margin: 0; font-size: 17px; }
dialog .body { padding: 6px 22px 18px; max-height: min(70vh, calc(100vh - 170px)); overflow-y: auto; overscroll-behavior: contain; }
/* 開著對話框時鎖住背後的頁面，捲到底也不會帶著頁面一起捲 */
html:has(dialog[open]), html:has(.drawer.open) { overflow: hidden; }
dialog .foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Markdown ---------- */
.md { word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; line-height: 1.35; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; } .md h4 { font-size: 14px; }
.md p { margin: 8px 0; }
.md ul, .md ol { padding-left: 22px; margin: 8px 0; }
.md li.task-item { list-style: none; margin-left: -20px; }
.md table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: #f6f7f9; }
.md code { background: #f2f4f7; padding: 1px 5px; border-radius: 4px; font-size: 14px; }
.md pre { background: #101828; color: #e4e7ec; padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; color: inherit; }
.md blockquote { margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 0 8px 8px 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- 圖表 ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .bar > div { width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar span { font-size: 10px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data td { padding: 10px; border-bottom: 1px solid #f0f2f5; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.kb-row { display: grid; grid-template-columns: 140px 92px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 10px 0; }
.kb-row + .kb-row { border-top: 1px solid #f0f2f5; }
.kb-row input[name=label] { font-weight: 600; }
.kb-row select[name=type] { padding-left: 8px; padding-right: 4px; color: var(--muted); }
.kb-row textarea { min-height: 40px; overflow: hidden; resize: none; }
.kb-list { display: flex; flex-direction: column; gap: 6px; }
.kb-item { display: flex; align-items: center; gap: 6px; }
.kb-item button { padding: 4px 8px; }
.kb-add-item { align-self: flex-start; color: var(--accent); }
.kb-inline { display: flex; gap: 6px; }
.kb-tools { display: flex; gap: 0; padding-top: 4px; }
.kb-tools button { padding: 4px 8px; }
@media (max-width: 760px) {
  .kb-row { grid-template-columns: minmax(0, 1fr) 92px auto; }
  .kb-row .kb-value { grid-column: 1 / -1; grid-row: 2; }
}

.notice { background: var(--warn-soft); color: #7a4700; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.notice b { white-space: nowrap; }
code.inline { background: #f2f4f7; padding: 1px 6px; border-radius: 4px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #101828; color: #fff; padding: 10px 18px; border-radius: 10px; display: none; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid.side, .grid.two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 4px; }
  .sidebar .brand { padding: 0 8px 0 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .sidebar nav .section, .sidebar .foot { display: none; }
  .main { padding: 18px 16px 40px; }
  .page-head { flex-direction: column; }
  .page-head .actions { margin-left: 0; justify-content: flex-start; }
  .board { grid-template-columns: repeat(6, 220px); }
}

/* ---------- 工作動畫：頭像 ---------- */
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.avatar-wrap::before {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(var(--accent) 0 30%, transparent 30% 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  animation: spin 1.1s linear infinite;
}
.avatar-wrap.reworking::before { background: conic-gradient(var(--warn) 0 30%, transparent 30% 100%); }
.avatar-wrap.reworking .avatar { animation: shake 2.4s ease-in-out infinite; }
.avatar-wrap.reviewing::before { background: conic-gradient(#101828 0 30%, transparent 30% 100%); animation-duration: 1.8s; }
.avatar-wrap .typing {
  position: absolute; right: -10px; bottom: -4px; background: #fff; border: 1px solid var(--border);
  border-radius: 99px; padding: 2px 4px; display: flex; gap: 2px; box-shadow: var(--shadow);
}
.avatar-wrap .typing i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: bounce 1s infinite; }
.avatar-wrap .typing i:nth-child(2) { animation-delay: .15s; }
.avatar-wrap .typing i:nth-child(3) { animation-delay: .3s; }
.avatar-wrap.reviewing .typing { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
@keyframes shake { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }

/* ---------- 工作動畫：看板 ---------- */
.task { position: relative; overflow: hidden; }
.task.moved { animation: arrive .6s ease-out; }
.task.doing { border-color: #c7d2fe; }
.task .shimmer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: shimmer 1.4s linear infinite; }
.task.review .shimmer { background-image: linear-gradient(90deg, transparent, #101828, transparent); }
.planning { display: flex; align-items: center; gap: 10px; padding: 6px 2px; }
@keyframes arrive { 0% { transform: translateY(-10px) scale(.97); opacity: 0; box-shadow: 0 0 0 3px var(--accent-soft); } 60% { opacity: 1; box-shadow: 0 0 0 3px var(--accent-soft); } 100% { transform: none; box-shadow: var(--shadow); } }
@keyframes shimmer { from { background-position: -50% 0; } to { background-position: 150% 0; } }

.live-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: #32d583; animation: pulse 1.2s infinite; }

/* ---------- 辦公室 ---------- */
.office-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.office-stats div { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: baseline; gap: 6px; }
.office-stats b { font-size: 24px; }
.office-stats span { color: var(--muted); font-size: 14px; }
.office-stats .warn b { color: var(--warn); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; }
}

/* ---------- 登入 ---------- */
#login { position: fixed; inset: 0; background: var(--sidebar); display: grid; place-items: center; z-index: 100; padding: 16px; }
.login-card { background: #fff; border-radius: 16px; padding: 32px 28px; width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; gap: 12px; }
.login-card .logo { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; margin: 0 auto; }
.login-card h1 { font-size: 20px; margin: 4px 0 0; }
.login-card p { margin: 0; }
.login-card button { justify-content: center; }
.login-card .error { color: var(--bad); font-size: 14px; min-height: 18px; }

@media (max-width: 760px) {
  .office-stats { grid-template-columns: repeat(2, 1fr); }
}
.task .who { flex-wrap: wrap; row-gap: 2px; }
.task .who > .muted { margin-left: auto; white-space: nowrap; font-size: 12px; }

/* ---------- 團隊對話 ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 520px; overflow-y: auto; }
.chat-msg { display: flex; gap: 10px; align-items: flex-start; }
.chat-body { flex: 1; min-width: 0; }
.chat-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.chat-bubble { margin-top: 4px; background: #f5f6f8; border-radius: 4px 12px 12px 12px; padding: 8px 12px; white-space: pre-wrap; word-break: break-word; }
.chat-msg.ask .chat-bubble { background: var(--accent-soft); }
.chat-msg.answer .chat-bubble { background: var(--good-soft); }
.chat-msg.review .chat-bubble { background: var(--warn-soft); }
.chat-msg.boss .chat-bubble { background: var(--bad-soft); }

/* ---------- 辦公室場景 ---------- */
.office-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.office-wrap { min-width: 0; }
.office-chat .chat { max-height: 600px; }


@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flicker { 0%, 92%, 96%, 100% { opacity: 1; } 94% { opacity: .55; } }
@keyframes glow { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes blink-led { 50% { opacity: .25; } }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes sway-head { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes nod-head { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(2px); } }
@keyframes tap { from { transform: translateY(0); } to { transform: translateY(-4px); } }
@keyframes twinkle { 0%, 100% { transform: scale(.4); opacity: 0; } 50% { transform: scale(1); opacity: 1; } }
@keyframes drip-svg { 0% { transform: translateY(0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(12px); opacity: 0; } }
@keyframes steam-svg { 0% { transform: translateY(0); opacity: 0; } 30% { opacity: .9; } 100% { transform: translateY(-14px); opacity: 0; } }
@keyframes scan-svg { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(40px, 4px); } }
@keyframes talk { from { transform: scaleY(.35); } to { transform: scaleY(1.1); } }
@keyframes gesture { from { transform: translateY(0); } to { transform: translate(4px, -10px); } }
@keyframes walk-in { from { transform: translateX(var(--from)); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes hop { 50% { transform: translateY(-4px); } }

@media (max-width: 1100px) {
  .office-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
}

/* ---------- 辦公室風格 ---------- */
@keyframes float-up { 0%, 100% { transform: translateY(0); opacity: .9; } 50% { transform: translateY(-8px); opacity: .6; } }

/* 風格選擇：寬度依視窗高度決定，3 欄 × 2 列剛好放進一個畫面，不需要捲動 */
dialog.wide { width: min(1080px, 96vw, calc((100vh - 190px) * 1.9)); max-height: 96vh; }
dialog.wide .head { padding: 16px 20px 0; align-items: flex-start; }
dialog.wide .head h2 { font-size: 17px; }
@keyframes flame { from { transform: scale(1, 1); } to { transform: scale(.94, 1.08); } }
dialog.wide .head .grow { flex: 1; min-width: 0; }

/* ---------- 專案：檢視切換 ---------- */
.view-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.segmented { display: inline-flex; background: #eceef2; border-radius: 10px; padding: 3px; }
.segmented button { border: none; background: none; padding: 6px 14px; border-radius: 8px; color: var(--muted); }
.segmented button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.project-head h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 14px; color: var(--muted); align-items: center; }
.project-tabs { position: sticky; top: 0; z-index: 5; background: var(--bg); overflow-x: auto; }
.project-tabs button { white-space: nowrap; }
.kpi .progress { margin-top: 10px; }
.late-text { color: var(--bad); font-weight: 600; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data tr.link { cursor: pointer; }
table.data tr.link:hover td { background: #fafbfc; }
.ptable td, .tasks-table td { vertical-align: middle; }
.ptable .progress { flex: 1; min-width: 80px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
.task-due { font-size: 13px; color: var(--muted); margin-top: 6px; }
.task-due.late { color: var(--bad); font-weight: 600; }

/* 里程碑 */
.milestones { display: flex; flex-direction: column; }
.milestone { display: flex; align-items: center; gap: 12px; padding: 10px 0; position: relative; }
.milestone + .milestone { border-top: 1px dashed var(--border); }
.ms-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: #eceef2; color: var(--muted); flex: none; }
.milestone.done .ms-dot { background: var(--good); color: #fff; }
.milestone.late .ms-dot { background: var(--bad); color: #fff; }
.ms-date { display: flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }

/* 任務抽屜：時程 */
.schedule-box { display: grid; grid-template-columns: 1fr 1fr 90px auto; gap: 8px; align-items: end; background: #f6f7f9; border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.schedule-box label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.schedule-box input, .schedule-box select { padding: 6px 8px; }

/* 圖例 */
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-legend i.lg-line { width: 14px; height: 0; border-radius: 0; border-top: 2px solid; }
.chart-legend i.lg-line.today { border-color: var(--accent); }
.chart-legend i.lg-line.deadline { border-color: #d92d20; border-top-style: dashed; }
.chart-legend i.lg-diamond { width: 9px; height: 9px; background: #344054; transform: rotate(45deg); border-radius: 1px; }
.chart-legend i.lg-late { width: 14px; height: 9px; border: 2px dashed #d92d20; border-radius: 3px; }
.chart-legend i.lg-today-box { border: 2px solid var(--accent); background: var(--accent-soft); }

/* 環圈圖 */
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { width: 170px; height: 170px; flex: none; }
.donut path { stroke: #fff; stroke-width: 2; }
.donut path:hover { opacity: .85; }
.donut-num { font-size: 26px; font-weight: 700; fill: var(--text); }
.donut-label { font-size: 12px; fill: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 140px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend span { flex: 1; color: var(--muted); }

/* 橫向長條 */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 28px; align-items: center; gap: 10px; }
.hbar-label { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: flex; gap: 2px; height: 16px; }
.hbar-seg { height: 100%; min-width: 4px; }
.hbar-seg:first-child { border-radius: 4px 0 0 4px; }
.hbar-seg:last-child { border-radius: 0 4px 4px 0; }
.hbar-seg:only-child { border-radius: 4px; }
.hbar-val { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* 甘特時程 */
.gantt { display: grid; grid-template-columns: 210px minmax(0, 1fr); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.g-labels { border-right: 1px solid var(--border); background: #fff; }
.g-label { display: flex; flex-direction: column; justify-content: center; padding: 0 12px; border-top: 1px solid #f0f2f5; overflow: hidden; }
.g-label[data-act] { cursor: pointer; }
.g-label[data-act]:hover { background: #fafbfc; }
.g-label.g-group { background: #f6f7f9; font-weight: 700; font-size: 13px; }
.g-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-scroll { overflow-x: auto; }
.g-scroll svg { display: block; font-family: inherit; }
.g-weekend { fill: #f6f7f9; }
.g-grid { stroke: #f0f2f5; }
.g-axis { stroke: var(--border); }
.g-group-band { fill: #f6f7f9; }
.g-month { font-size: 11px; font-weight: 700; fill: var(--text); }
.g-day { font-size: 11px; fill: var(--muted); }
.g-day.we { fill: #b0b7c3; }
.g-wd { font-size: 10px; }
.g-bar.clickable { cursor: pointer; }
.g-bar.clickable:hover rect:first-child { filter: brightness(1.08); }
.g-bar-text { font-size: 11px; font-weight: 600; fill: #fff; pointer-events: none; }
.g-today { stroke: var(--accent); stroke-width: 2; }
.g-today-pill { fill: var(--accent); }
.g-today-text { font-size: 10px; font-weight: 700; fill: #fff; }
.g-deadline { stroke: #d92d20; stroke-width: 2; stroke-dasharray: 5 4; }
.g-deadline-text { font-size: 11px; font-weight: 700; fill: #d92d20; }

/* 月曆 */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-head b { font-size: 16px; min-width: 120px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cal-wd { background: #f6f7f9; text-align: center; font-size: 13px; color: var(--muted); padding: 6px 0; font-weight: 600; }
.cal-cell { min-height: 96px; border-top: 1px solid var(--border); border-left: 1px solid #f0f2f5; padding: 4px; background: #fff; min-width: 0; }
.cal-cell:nth-child(7n + 1) { border-left: none; }
.cal-cell.out { background: #fafbfc; }
.cal-cell.out .cal-date { color: #c0c6cf; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.cal-cell.deadline { box-shadow: inset 0 0 0 2px #d92d20; }
.cal-date { font-size: 13px; font-weight: 600; margin-bottom: 3px; display: flex; justify-content: space-between; align-items: center; }
.cal-flag { background: #d92d20; color: #fff; font-size: 11px; border-radius: 4px; padding: 0 5px; }
.cal-chip { font-size: 12px; border-left: 3px solid var(--c); background: #f6f7f9; border-radius: 3px; padding: 1px 5px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-chip:hover { background: #eceef2; }
.cal-chip.due { font-weight: 700; }
.cal-more { font-size: 12px; color: var(--muted); }

/* 近期交付 */
.due-date { width: 46px; text-align: center; flex: none; line-height: 1.2; }
.due-date b { display: block; font-size: 15px; }
.due-date span { font-size: 12px; color: var(--muted); }
.due-date.late b { color: var(--bad); }

@media (max-width: 760px) {
  .gantt { grid-template-columns: 130px minmax(0, 1fr); }
  .schedule-box { grid-template-columns: 1fr 1fr; }
  .cal-cell { min-height: 70px; }
  .cal-chip { font-size: 11px; }
  .hbar-row { grid-template-columns: 70px minmax(0, 1fr) 24px; }
}

/* ---------- 帳號 ---------- */
.account-btn { width: 100%; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06); border: none; color: #fff; padding: 8px 10px; border-radius: 10px; text-align: left; }
.account-btn:hover { background: rgba(255,255,255,.12); }
.account-btn .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.account-btn b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn .grow span { font-size: 12px; color: var(--sidebar-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn .caret { color: var(--sidebar-text); }
.trial-pill { display: block; margin-top: 8px; text-align: center; font-size: 13px; padding: 4px 8px; border-radius: 99px; background: rgba(53, 99, 233, .25); color: #c7d4ff; }
.trial-pill.bad { background: rgba(217, 45, 32, .3); color: #ffd0cc; }
#provider-foot { margin-top: 10px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card input[readonly] { background: #f6f7f9; color: var(--muted); }
.login-card .small a { font-weight: 600; }
.role-help { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.invite-link { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--good-soft); padding: 10px; border-radius: 8px; }
.invite-link input { font-size: 13px; }

/* ---------- 方案 ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 12px; }
.plan-card { background: #fff; border: 2px solid var(--border); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.plan-card.current { border-color: var(--good); }
.plan-name { font-weight: 700; font-size: 16px; }
.plan-price { font-size: 28px; font-weight: 800; }
.plan-price small { font-size: 14px; font-weight: 400; color: var(--muted); }
.plan-limit { font-size: 14px; font-weight: 600; }
.plan-card button { margin-top: auto; }
@media (max-width: 760px) {
  .sidebar .foot { display: block; width: 100%; border-top: none; padding: 6px 0 0; margin-top: 0; }
  .sidebar #provider-foot { display: none; }
  .trial-pill { display: inline-block; margin: 6px 0 0; }
}

/* ---------- 本地檔案 ---------- */
.safety-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; background: var(--good-soft); color: #0e5a37; border-radius: 10px; padding: 10px 16px; margin-bottom: 16px; font-size: 14px; }
.selected-row { background: var(--accent-soft) !important; }
.folder-icon { font-size: 20px; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row select { width: auto; flex: none; padding: 6px 8px; }
.list-row .path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-change { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.file-change.pending { border-color: #f5c56b; background: #fffaf0; }
.file-change details { margin-top: 6px; }
.file-change summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.fc-path { word-break: break-all; }
.fc-project { margin: 12px 0 4px; }
.add-n { color: var(--good); font-weight: 600; }
.del-n { color: var(--bad); font-weight: 600; }
pre.diff { background: #0f1729; color: #cbd5e1; border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.55; max-height: 320px; overflow: auto; margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; }
pre.diff .add { color: #86efac; background: rgba(34, 197, 94, .14); display: inline-block; width: 100%; }
pre.diff .del { color: #fca5a5; background: rgba(239, 68, 68, .14); display: inline-block; width: 100%; }
pre.diff .hunk { color: #93c5fd; }
pre.file-preview { white-space: pre-wrap; word-break: break-word; background: #f6f7f9; padding: 14px; border-radius: 8px; max-height: 60vh; overflow: auto; font-size: 14px; }

/* ---------- 平台後台 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar input[type=text] { max-width: 320px; }
.console .back { display: inline-block; font-size: 14px; margin-bottom: 8px; }
.console table.data tr.link { cursor: pointer; }
.console table.data tr.link:hover td { background: #fafbfc; }
button.block { display: block; width: 100%; margin-top: 10px; }
.row-form { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.row-form input { width: 80px; }
.notice.bad-notice { background: var(--bad-soft, #fdecea); color: #8a1c13; }
.bad-text { color: var(--bad); }
.actions-cell { white-space: nowrap; text-align: right; }
.actions-cell button + button { margin-left: 4px; }
.edit-table input { padding: 6px 8px; }
.edit-table input[type=number] { width: 110px; text-align: right; }
.list-row.inactive { opacity: .55; }
.day-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.day-bars .bar { flex: 1; height: 100%; display: flex; align-items: flex-end; background: #f4f6fa; border-radius: 3px; }
.day-bars .bar span { display: block; width: 100%; background: var(--accent); border-radius: 3px; }
.day-axis { display: flex; justify-content: space-between; margin-top: 6px; }
.console-me { display: flex; flex-direction: column; margin-bottom: 8px; color: #fff; }
.console-me span { color: var(--sidebar-text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.console .sidebar .foot a { display: block; color: var(--sidebar-text); margin: 6px 0; }
.link-btn { background: none; border: none; padding: 0; color: var(--sidebar-text); font: inherit; cursor: pointer; }
.link-btn:hover, .console .sidebar .foot a:hover { color: #fff; }
.console-link { display: block; margin-top: 8px; color: var(--sidebar-text); font-size: 13px; }
.console-link:hover { color: #fff; }
.talent-role + .talent-role { margin-top: 14px; }
.talent-role-head { font-weight: 600; margin-bottom: 6px; }
.talent-role .list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.tag { font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 1px 8px; }
.nowrap { white-space: nowrap; }
.dialog-section { font-size: 14px; margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }
.talent-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ai-intro { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-top: 16px; padding: 10px 12px; background: #f6f8fb; border-radius: 8px; }
.vendor { padding: 0; }
.vendor-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.vendor-head:hover { background: #fafbfc; }
.vendor-body { padding: 0 18px 18px; border-top: 1px solid var(--border); }
.vendor-fetched { margin-top: 14px; padding: 12px; background: #f6f8fb; border-radius: 8px; }
.fetched-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 12px; max-height: 220px; overflow-y: auto; margin: 8px 0; }
.vendor-models { margin-top: 14px; }
.vendor-models .edit-table input[type=text] { min-width: 160px; }
button.link { background: none; border: none; color: var(--accent); padding: 4px 0; cursor: pointer; }

/* ---------- 記憶與對話 ---------- */
.memory-dialog .body { max-height: 62vh; }
.memory-group { margin-top: 14px; }
.memory-cat { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.memory-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.memory-item .memory-text { font-size: 14px; }
.memory-item input[type=text] { flex: 1; }
.memory-item select { width: auto; }
.memory-empty { padding: 2px 2px 6px; }
.memory-add { display: flex; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.memory-add select { width: auto; }
.memory-dialog .foot .spacer { flex: 1; }
.chat-panel h2 .spacer { flex: 1; }
.chat-log { max-height: 420px; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 8px; }
.chat-msg { display: flex; flex-direction: column; max-width: 92%; }
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg .bubble { padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.55; background: #f2f4f7; word-break: break-word; }
.chat-msg.user .bubble { background: var(--accent); color: #fff; }
.chat-msg .bubble > :first-child { margin-top: 0; }
.chat-msg .bubble > :last-child { margin-bottom: 0; }
.chat-msg .bubble .typing { position: static; display: inline-flex; }
.chat-empty { padding: 20px 4px; text-align: center; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.chat-form textarea { flex: 1; resize: none; }
.chat-msg .bubble .typing { gap: 4px; padding: 4px 0; }
.chat-msg .bubble .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1s infinite; }
.chat-msg .bubble .typing i:nth-child(2) { animation-delay: .15s; }
.chat-msg .bubble .typing i:nth-child(3) { animation-delay: .3s; }

/* ---------- 配置助手 ---------- */
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.check-list label { display: flex; gap: 6px; align-items: center; }
.run-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.run-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.run-card.best { border-color: var(--good); box-shadow: 0 0 0 1px var(--good) inset; }
.run-card .row { gap: 8px; }
.run-comment { color: var(--text); }
.run-output { max-height: 360px; overflow-y: auto; font-size: 14px; padding: 8px; background: #f8f9fb; border-radius: 6px; margin: 6px 0; }
.small-h { font-size: 14px !important; }
.version-list { display: flex; flex-direction: column; gap: 4px; }
.version-item { display: flex; gap: 8px; align-items: center; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }
.version-item.active { border-color: var(--accent); background: var(--accent-soft); }
.version-item .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
pre.diff { white-space: pre-wrap; font-size: 13px; background: #f8f9fb; padding: 10px; border-radius: 8px; }
pre.diff .add { color: #0e6b3c; background: #e7f6ec; display: inline-block; width: 100%; }
pre.diff .del { color: #a3271a; background: #fdecea; display: inline-block; width: 100%; }
pre.diff .hunk { color: var(--muted); }
.portfolio-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.portfolio-item .row { gap: 8px; }
.portfolio-item input[type=text] { flex: 1; }

/* 確認點：老闆選方向 */
.decision-box { border: 1px solid var(--warn, #d08a1e); background: color-mix(in srgb, var(--warn, #d08a1e) 8%, transparent); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.decision-box p { margin: 4px 0 10px; }
.decision-options { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.decision-options .check { margin: 0; }
.notice.good { border-color: var(--good, #2e8b57); }

/* 每月 AI 額度 */
.budget-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin: 8px 0 4px; }
.budget-bar span { display: block; height: 100%; background: var(--good, #16794c); }
.budget-bar.warn span { background: var(--warn, #a35f00); }
.budget-bar.bad span { background: var(--bad, #b42318); }

/* ---------- 交代新工作：一次性／週期性 ---------- */
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 4px; }
.type-card { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.type-card:hover { border-color: var(--accent); }
.type-card.active { border-color: var(--accent); background: var(--accent-soft); }
.type-card input { margin-top: 3px; accent-color: var(--accent); }
.type-card b { display: block; font-size: 14px; }
.type-card small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.4; }
.np-chips { margin: 12px 0 2px; align-items: center; }
.np-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.np-form [hidden] { display: none !important; }
.np-preview { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; line-height: 1.5; }
.np-note { margin: 8px 0 0; line-height: 1.5; }
.np-more { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.np-more summary { cursor: pointer; font-size: 14px; color: var(--muted); font-weight: 600; list-style: none; }
.np-more summary::-webkit-details-marker { display: none; }
.np-more summary::before { content: "▸ "; }
.np-more[open] summary::before { content: "▾ "; }
@media (max-width: 560px) {
  .type-switch, .np-grid { grid-template-columns: 1fr; }
}

/* ---------- 例行工作 ---------- */
.routine-panel { margin-bottom: 16px; }
.routine-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.routine-row:first-of-type { border-top: none; }
.routine-row .grow { min-width: 200px; }
.routine-row .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.routine-row.paused .title { color: var(--muted); }
.np-form input[type=date], .np-form input[type=number] {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
.forget-list { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* ---------- 後台：人才市場（卡片） ---------- */
.talent-toolbar { display: flex; align-items: flex-end; gap: 16px; margin: 8px 0 18px; border-bottom: 1px solid var(--border); }
.talent-toolbar .tabs { border-bottom: none; margin-bottom: -1px; flex-wrap: wrap; }
.talent-toolbar input[type=search] { width: 240px; margin: 0 0 8px auto; }
.talent-section { margin-bottom: 28px; }
.talent-section-head { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0 0 12px; }
.talent-section-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.talent-section-head .muted { font-weight: 400; }
.talent-section .talent-role + .talent-role { margin-top: 18px; }
.talent-section .talent-role-head { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.talent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.talent-card { position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 12px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.talent-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--cat, var(--accent)); }
.talent-card:hover { box-shadow: 0 6px 18px rgba(16, 24, 40, .08); transform: translateY(-1px); }
.talent-card.inactive { background: #fafbfc; }
.talent-card.inactive > :not(.talent-actions) { opacity: .6; }
.talent-card-top { display: flex; align-items: center; gap: 12px; }
.talent-card-top .name { font-weight: 700; font-size: 16px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.talent-model { align-self: flex-start; font-size: 13px; background: #f2f4f7; border-radius: 6px; padding: 3px 8px; }
.talent-model.warn { background: var(--warn-soft); color: var(--warn); }
.talent-desc { color: var(--muted); font-size: 14px; line-height: 1.5; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.talent-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
.talent-stats div { text-align: center; }
.talent-stats div + div { border-left: 1px solid var(--border); }
.talent-stats b { display: block; font-size: 16px; }
.talent-stats span { font-size: 12px; color: var(--muted); }
.talent-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-top: 1px solid var(--border); padding-top: 10px; }
.talent-actions .spacer { flex: 1; }

/* ---------- 後台：配置助手 ---------- */
.studio-start { align-items: stretch; margin-bottom: 28px; }
.studio-card { display: flex; flex-direction: column; }
.studio-card .spacer { flex: 1; }
.studio-card > button.block { margin-top: 14px; }
.studio-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.studio-card-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.studio-card-head h2 { margin: 0 0 2px; font-size: 16px; }
.studio-card-head p { margin: 0; }
.studio-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; flex: none; }
.studio-icon.new { background: var(--accent-soft); }
.studio-icon.opt { background: var(--warn-soft); }
.studio-icon.sm { width: 34px; height: 34px; font-size: 16px; border-radius: 9px; }
.flow-mini { list-style: none; padding: 0; margin: 14px 0 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.flow-mini li { display: flex; align-items: center; gap: 6px; font-size: 13px; background: #f6f8fb; border-radius: 99px; padding: 3px 10px 3px 3px; }
.flow-mini li span { width: 18px; height: 18px; border-radius: 50%; background: var(--warn); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.section-title { font-size: 16px; margin: 0 0 12px; display: flex; gap: 8px; align-items: baseline; }
.section-title .muted { font-weight: 400; }
.studio-history { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.studio-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; color: inherit; transition: border-color .15s; }
.studio-row:hover { border-color: #c7d2fe; }
.studio-row .title { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.studio-row .grow { min-width: 0; }

.progress-panel { max-width: 720px; }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.step:last-child { padding-bottom: 0; }
.step:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 4px; width: 2px; background: var(--border); }
.step.done:not(:last-child)::after { background: var(--good); }
.step-dot { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: #f2f4f7; color: var(--muted); border: 2px solid var(--border); }
.step.done .step-dot { background: var(--good); border-color: var(--good); color: #fff; }
.step.running .step-dot { background: var(--accent-soft); border-color: var(--accent); }
.step.failed .step-dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.step-title { font-weight: 600; padding-top: 5px; }
.step.pending .step-title { color: var(--muted); font-weight: 500; }
.step-detail { font-size: 14px; color: #344054; margin-top: 4px; white-space: pre-wrap; background: #f6f8fb; border-radius: 8px; padding: 8px 10px; }
.step.failed .step-detail { background: #fdecea; color: #8a1c13; }
.spin { width: 14px; height: 14px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: block; }

.process { margin-bottom: 16px; }
.process-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pstep { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fcfcfd; position: relative; }
.pstep:not(:last-child)::after { content: "›"; position: absolute; right: -11px; top: 12px; color: var(--muted); font-size: 18px; line-height: 1; }
.pstep.next { border-color: var(--accent); background: var(--accent-soft); }
.pstep-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.pstep-head .num { width: 22px; height: 22px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; font-size: 13px; }
.pstep.next .pstep-head .num { background: var(--accent); }
.pstep .pre { white-space: pre-wrap; line-height: 1.55; }
.pstep .tags { margin: 0 0 6px; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mini-stats div { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.mini-stats b { display: block; font-size: 16px; }
.mini-stats span { font-size: 12px; color: var(--muted); }

@media (max-width: 1100px) { .process-steps { grid-template-columns: 1fr 1fr; } .pstep:nth-child(2)::after { display: none; } }
@media (max-width: 760px) {
  .process-steps { grid-template-columns: 1fr; }
  .pstep::after { display: none; }
  .talent-toolbar { flex-direction: column; align-items: stretch; }
  .talent-toolbar input[type=search] { width: 100%; margin: 0 0 8px; }
  .talent-grid, .studio-history { grid-template-columns: 1fr; }
}
.talent-toolbar input[type=search] { padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 14px; background: #fff; }
.talent-actions button { padding: 4px 9px; font-size: 13px; }
button.switch { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; padding: 2px 0; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; align-self: flex-start; }
button.switch i { width: 28px; height: 16px; border-radius: 99px; background: #d0d5dd; position: relative; transition: background .15s; flex: none; }
button.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s; }
button.switch.on { color: var(--good); font-weight: 600; }
button.switch.on i { background: var(--good); }
button.switch.on i::after { left: 14px; }
.talent-card.inactive > .talent-card-top { opacity: 1; }
.talent-card.inactive > .talent-card-top > :not(.switch) { opacity: .6; }

/* ---------- 頭像（插畫或照片）與角色檔案 ---------- */
.avatar.pic { background: none; padding: 0; overflow: hidden; box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(16, 24, 40, .12); }
.avatar.pic svg, .avatar.pic img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.avatar.xl { width: 72px; height: 72px; font-size: 28px; }
.avatar-picker { display: flex; align-items: center; gap: 16px; padding: 12px; background: #f6f8fb; border-radius: 12px; margin-top: 6px; }
.avatar-picker .avatar.xl { width: 84px; height: 84px; }
.avatar-picker-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.avatar-picker-actions .muted { width: 100%; }
.avatar-picker-actions .btn.small, .avatar-picker-actions button.small { padding: 5px 11px; font-size: 14px; cursor: pointer; }
.persona { background: #f8f9fc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.persona-motto { font-style: italic; color: #475467; font-size: 14px; line-height: 1.5; }
.persona-row { display: grid; grid-template-columns: 86px 1fr; gap: 8px; font-size: 14px; line-height: 1.5; }
.persona-row > span { color: var(--muted); white-space: nowrap; }
.ability-bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px 14px; }
.ability { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ability > span { color: var(--muted); width: 28px; flex: none; }
.ability-track { display: flex; gap: 3px; }
.ability-track i { width: 14px; height: 6px; border-radius: 3px; background: #e4e7ec; }
.ability-track i.on { background: var(--accent); }
.ability-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 16px; }
.ability-inputs label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ability-inputs label span { width: 30px; color: var(--muted); }
.ability-inputs input[type=range] { flex: 1; padding: 0; border: none; accent-color: var(--accent); }
.ability-inputs b { width: 14px; text-align: right; }
.hire-card { gap: 10px; }
.hire-top { display: flex; align-items: center; gap: 12px; }
.hire-top .name { font-weight: 700; font-size: 16px; }
.hire-card .persona-motto { border-left: 3px solid var(--accent-soft); padding-left: 8px; }
.talent-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head h2 { margin: 0; }
.style-row { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.style-pick { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 12px; color: var(--muted); cursor: pointer; }
.style-pick .avatar.sm { width: 34px; height: 34px; box-shadow: none; }
.style-pick:hover { border-color: #c7d2fe; }
.style-pick.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.style-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.style-option { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px; border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; }
.style-option:hover:not(:disabled) { border-color: #c7d2fe; }
.style-option.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.style-option .faces { display: flex; }
.style-option .faces .avatar { width: 34px; height: 34px; margin-left: -8px; }
.style-option .faces .avatar:first-child { margin-left: 0; }
.style-option .label { font-size: 14px; font-weight: 600; }
.style-option.active .label { color: var(--accent); }

/* ---------- 任務圖片 ---------- */
.task-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 8px; }
.task-images figure { margin: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #f8f9fc; }
.task-images img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #f2f4f7; }
.task-images figcaption { display: flex; align-items: center; gap: 6px; justify-content: space-between; padding: 6px 8px; font-size: 13px; color: var(--muted); }
#image-ai input[type=number] { width: 100%; }

/* ---------- 專案成果 ---------- */
.results { display: grid; gap: 16px; }
.result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.result-head .title { font-weight: 600; }
.result-body { font-size: 14px; line-height: 1.65; }
.result-body.collapsed { max-height: 260px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.result-thumbs { display: flex; gap: 4px; }
.result-thumbs img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.panel h2 .more.link { margin-left: auto; font-size: 14px; font-weight: 400; }
.result-head .grow { flex: 1; min-width: 0; }

/* ---------- 總覽：快速交代、入門引導、待你處理 ---------- */
.quick-task { margin-bottom: 16px; padding: 14px 16px; border-color: #c7d2fe; box-shadow: 0 0 0 3px var(--accent-soft); }
.quick-task textarea { border: none; padding: 4px 2px; font-size: 16px; resize: vertical; min-height: 52px; box-shadow: none; outline: none; }
.quick-task textarea:focus { outline: none; }
.quick-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.quick-foot .chips { gap: 6px; }
.quick-foot .chip { font-size: 13px; padding: 4px 10px; }
.quick-foot .spacer { flex: 1; }
.setup-guide { margin-bottom: 16px; }
.setup-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.setup-step { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fcfcfd; }
.setup-step .grow { min-width: 0; }
.setup-step.done { background: var(--good-soft); border-color: transparent; }
.setup-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.setup-step.done .setup-num { background: var(--good); }
.todo-panel { margin-bottom: 16px; border-color: #fcd9a8; }
.todo-row .title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
@media (max-width: 760px) { .setup-steps { grid-template-columns: 1fr; } }

/* ---------- 專案頁：下一步 ---------- */
.next-step { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 12px; margin: 4px 0 16px; background: #f6f8fb; border: 1px solid var(--border); }
.next-step .grow { min-width: 0; }
.next-step b { font-size: 15px; }
.next-step .small { color: #475467; margin-top: 2px; }
.next-step .ns-icon { font-size: 22px; width: 32px; display: grid; place-items: center; flex: none; }
.next-step.accent { background: var(--accent-soft); border-color: #c7d2fe; }
.next-step.warn { background: var(--warn-soft); border-color: #fcd9a8; }
.next-step.bad { background: #fdecea; border-color: #f5c2bd; }
.next-step.good { background: var(--good-soft); border-color: #b7e4c7; }
.decision-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.decision-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; min-width: 140px; }
.decision-option span { display: flex; flex-direction: column; }
.decision-option small { color: var(--muted); font-size: 13px; }
.decision-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.task-schedule { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.task-schedule summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.task-schedule .schedule-box { margin-top: 10px; }

/* ---------- 平台後台 ---------- */
.admin-todo { margin-bottom: 16px; }
.admin-todo.has { border-color: #fcd9a8; }
.admin-todo .todo-tag { flex: none; min-width: 92px; }
.vendor-status { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.vendor-status > div { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vendor-status b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .vendor-status { grid-template-columns: 1fr 1fr; } }

/* ---------- 開會討論 ---------- */
.attendee-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.attendee { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff; }
.attendee:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.attendee span { display: flex; flex-direction: column; min-width: 0; }
.attendee small { color: var(--muted); font-size: 13px; }
.faces-row { display: inline-flex; vertical-align: middle; }
.faces-row .avatar { margin-left: -6px; }
.faces-row .avatar:first-child { margin-left: 0; }
.meeting-layout { align-items: start; }
.meet-log { display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow-y: auto; padding: 4px 2px 8px; }
.meet-msg { display: flex; gap: 10px; align-items: flex-start; }
.meet-msg .bubble { background: #f6f8fb; border-radius: 12px; padding: 10px 14px; font-size: 14px; line-height: 1.6; min-width: 0; flex: 1; }
.meet-msg .bubble > b { margin-right: 6px; }
.meet-msg .bubble ul { margin: 6px 0 0; padding-left: 18px; }
.meet-msg .bubble p { margin: 6px 0 0; }
.meet-msg.boss { justify-content: flex-end; }
.meet-msg.boss .bubble { background: var(--accent); color: #fff; flex: 0 1 80%; }
.meet-round { text-align: center; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.meet-round::before, .meet-round::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.meet-typing { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.meet-conclusion { background: var(--good-soft); border-radius: 10px; padding: 10px 14px; font-size: 14px; line-height: 1.65; }
.meeting-summary h3 { font-size: 14px; margin: 14px 0 6px; }
.meet-actions { display: grid; gap: 8px; }
.meet-action { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.meet-action .grow { min-width: 0; }
.meet-action .muted.small { margin-top: 2px; line-height: 1.5; }
.quick-foot .chips { flex: 1 1 100%; }

/* ---------- 辦公室：依工作狀態的動作（全部用現有資料演出，不呼叫 AI） ---------- */
@keyframes wave-paper { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) translateY(-3px); } }
@keyframes hand-up { 0%, 100% { transform: translate(0, -50px); } 50% { transform: translate(2px, -54px); } }
@keyframes paint { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } }
@keyframes confetti { 0% { transform: translateY(0) rotate(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(26px) rotate(160deg); opacity: 0; } }

/* ---------- 和員工聊聊（抽屜） ---------- */
.drawer.chat-drawer { width: min(520px, 96vw); }
.chat-status { margin-top: 10px; background: #f6f8fb; border-radius: 8px; padding: 8px 12px; }
.chat-drawer-body { display: flex; flex-direction: column; }
.chat-drawer-body .chat-log { max-height: none; flex: 1; }
.chat-drawer-foot { padding: 12px 22px 16px; border-top: 1px solid var(--border); display: block; }
.chat-drawer-foot .chat-form { margin-top: 0; }
.drawer .foot.chat-drawer-foot { display: block; }
.chat-drawer-foot .chat-form textarea { flex: 1; min-width: 0; }

.office-note { margin: 10px 2px 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.good-text { color: var(--good); }

.china-tag { display: inline-flex; align-self: flex-start; align-items: center; gap: 4px; font-size: 13px; font-weight: 600;
  color: #b42318; background: #fef3f2; border: 1px solid #fecdca; border-radius: 99px; padding: 1px 9px; white-space: nowrap; cursor: help; }

.price-sync { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; background: #f6f8fb; border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 14px; margin-bottom: 16px; }
.price-sync .spacer { flex: 1; }

/* ---------- 精力與道具 ---------- */
.energy { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; }
.energy-face { font-size: 18px; line-height: 1; }
.energy-track { flex: 1; height: 8px; border-radius: 99px; background: var(--line, #e4e7ec); overflow: hidden; min-width: 60px; }
.energy-track span { display: block; height: 100%; border-radius: 99px; background: #22c55e; transition: width .4s; }
.energy.warn .energy-track span { background: #f59e0b; }
.energy.low .energy-track span { background: #ef4444; }
.energy.out .energy-track span { background: #98a2b3; }
.energy-pct { font-size: 14px; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.energy.out .energy-pct { color: #b42318; }
.energy-buy { white-space: nowrap; }
.energy-panel .energy { margin-top: 0; }
.chat-energy .energy { margin: 8px 0 0; }
.chat-nudge { margin-top: 8px; padding: 8px 12px; border-radius: 12px; background: #fff7e6; color: #8a5300; font-size: 14px; }
.salary-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft, #eef2ff);
  color: var(--accent, #4f46e5); font-size: 13px; font-weight: 700; white-space: nowrap; }
.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 14px; height: auto; text-align: center; }
.shop-item:not([disabled]):hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.shop-emoji { font-size: 32px; line-height: 1.1; }
.shop-price { margin-top: 4px; font-weight: 800; font-size: 15px; }
.shop-team { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border: 1px dashed var(--line, #d0d5dd); border-radius: 14px; }
@media (max-width: 520px) { .shop-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- 部門 ---------- */
.dept-section { margin-bottom: 26px; }
.dept-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; font-size: 17px; }
.dept-title .muted { font-weight: 400; }
.quick-dept { width: auto; max-width: 230px; }

/* ---------- 方案、精力點數、補給包 ---------- */
.energy-pct small { font-weight: 400; color: var(--muted, #667085); }
.energy-pct { min-width: 120px; }
.kpi.wide { grid-column: span 2; }
.sub-panel .sub-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 4px; }
.sub-h { font-size: 14px; margin: 14px 0 6px; color: var(--muted, #667085); font-weight: 600; }
.usage-list { display: grid; gap: 6px; }
.usage-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.usage-row .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-bar { width: 38%; height: 6px; border-radius: 99px; background: var(--line, #e4e7ec); overflow: hidden; flex: none; }
.usage-bar span { display: block; height: 100%; background: var(--accent, #4f46e5); border-radius: 99px; }
.plan-features { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; gap: 5px; font-size: 14px; text-align: left; }
.plan-features .muted { font-size: 13px; }
.shop-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shop-item.static { border: 1px solid var(--line, #e4e7ec); border-radius: 14px; }
.good-notice { background: #ecfdf3; border-color: #abefc6; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line, #e4e7ec); border-top-color: var(--accent, #4f46e5);
  animation: spin 0.9s linear infinite; margin: 6px auto 12px; }
/* ---------- 品牌健檢 ---------- */
.brand-wait { text-align: center; padding: 34px 20px; }
.brand-notice { background: #f5f3ff; border-color: #ddd6fe; }
.chip-check { display: inline-flex; }
.chip-check input { display: none; }
.chip-check span { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line, #e4e7ec); font-size: 14px; cursor: pointer; }
.chip-check input:checked + span { background: var(--accent-soft, #eef2ff); border-color: var(--accent, #4f46e5); color: var(--accent, #4f46e5); font-weight: 700; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line, #e4e7ec); }
.direction-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.direction-card { border: 1px solid var(--line, #e4e7ec); border-radius: 16px; overflow: hidden; background: var(--panel, #fff); display: flex; flex-direction: column; }
.direction-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.direction-body { padding: 14px; display: grid; gap: 8px; }
.direction-body h3 { margin: 0; font-size: 18px; }
.swatches { display: flex; gap: 6px; }
.swatches span { width: 26px; height: 26px; border-radius: 8px; border: 1px solid rgba(0,0,0,.08); }
.swatches.big { height: 140px; gap: 0; }
.swatches.big span { flex: 1; height: 100%; width: auto; border-radius: 0; border: 0; }
.sample-post { font-size: 14px; background: #f8fafc; border-radius: 10px; padding: 10px; max-height: 140px; overflow: auto; }
.brand-section.confirmed { border-color: #abefc6; }
.brand-content { margin: 10px 0; font-size: 14px; }
.brand-editor { width: 100%; font-family: inherit; }
.brand-actions { gap: 8px; }
.source-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.source-tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #f2f4f7; color: #475467; white-space: nowrap; }
.issue-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
@media (max-width: 720px) { .shop-grid.three { grid-template-columns: 1fr; } .kpi.wide { grid-column: auto; } }
.edit-table input[name=name] { min-width: 90px; }
.edit-table input[name=extras] { min-width: 150px; }
.edit-table input[type=number] { min-width: 70px; }
/* 左上角：客戶的公司名稱＋AI 員工系統，點一下回到總覽 */
.sidebar a.brand { text-decoration: none; line-height: 1.35; word-break: break-word; cursor: pointer; }
.sidebar a.brand:hover { opacity: .85; }
.sidebar .brand-logo { width: 30px; height: 30px; flex: none; }
.login-logo { width: 56px; height: 56px; display: block; margin: 0 auto 8px; }

/* ---------- AI 優化師、月報、新手導覽 ---------- */
.optimizer-card h2 .more { margin-left: auto; }
.optimizer-summary p { margin: 0; line-height: 1.8; }
.launch-panel { align-items: center; gap: 14px; }
.tour-ring { position: fixed; z-index: 999; border: 3px solid var(--accent, #4f46e5); border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, .45); transition: all .2s; }
.tour-box { position: fixed; z-index: 1000; width: 320px; background: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.tour-box p { margin: 6px 0 12px; font-size: 14px; line-height: 1.6; color: #344054; }
/* 左上角品牌：固定兩行，不會因為公司名稱太長而跑版 */
.sidebar a.brand { min-width: 0; }
.sidebar #brand-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidebar .brand-company { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.sidebar .brand-sub { font-size: 13px; font-weight: 500; opacity: .65; white-space: nowrap; }

/* ---------- 新手引導 ---------- */
.welcome { max-width: 760px; margin: 0 auto; }
.welcome-head { display: flex; gap: 14px; align-items: center; margin: 8px 0 16px; }
.welcome-head img { width: 56px; height: 56px; }
.welcome-head h1 { margin: 0; font-size: 24px; }
.chip.pick { cursor: pointer; }
.chip.pick.active { background: var(--accent-soft, #eef2ff); border-color: var(--accent, #4f46e5); color: var(--accent, #4f46e5); font-weight: 700; }
.welcome-task textarea { width: 100%; }
.onboarding h2 { font-size: 16px; }
.onb-bar { height: 6px; border-radius: 99px; background: var(--line, #e4e7ec); margin: 12px 0; overflow: hidden; }
.onb-bar span { display: block; height: 100%; background: var(--accent, #4f46e5); border-radius: 99px; transition: width .4s; }
.onb-steps { display: grid; gap: 6px; }
.onb-step { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.onb-step.next { background: var(--accent-soft, #eef2ff); }
.onb-step.done b { color: var(--muted, #667085); text-decoration: line-through; font-weight: 500; }
.onb-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none;
  background: #f2f4f7; color: #475467; }
.onb-step.done .onb-num { background: #dcfae6; color: #067647; }
.onb-step.next .onb-num { background: var(--accent, #4f46e5); color: #fff; }
.tip-bubble { position: fixed; z-index: 998; max-width: 320px; background: #1d2939; color: #fff; border-radius: 12px; padding: 10px 12px;
  font-size: 14px; line-height: 1.6; display: flex; gap: 10px; align-items: flex-start; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.tip-bubble button { flex: none; background: #fff; color: #1d2939; border: 0; }

/* ---------- 版面優化（2026-11） ---------- */
/* 首頁兩欄：左邊是要處理的事，右邊是引導、建議與團隊 */
.grid.side.dash-grid { grid-template-columns: minmax(0, 1fr) 360px; }
.dash-grid .onboarding .onb-step { padding: 6px 8px; }
.optimizer-card .list-row { flex-wrap: wrap; gap: 6px 10px; }
.optimizer-card .list-row .grow { min-width: 160px; }
.timeline .item:last-child { border-bottom: 0; }
/* 員工頁的對話：右欄比較窄，輸入框和按鈕上下排 */
.chat-panel .chat-form { flex-direction: column; align-items: stretch; }
.chat-panel .chat-form button { align-self: flex-end; }
/* 數字卡片不會把版面撐開 */
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { min-width: 0; }
.nav-toggle { display: none; }
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .office-layout { grid-template-columns: minmax(0, 1fr); }
  .grid.side.dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  /* 手機：頂部只留品牌和選單按鈕，選單展開才顯示 */
  .sidebar { position: sticky; top: 0; z-index: 40; flex-direction: column; align-items: stretch; flex-wrap: nowrap; padding: 10px 14px; gap: 0; }
  .sidebar .brand { padding: 2px 0; padding-right: 48px; }
  .nav-toggle { display: flex; flex-direction: column; justify-content: center; gap: 4px; position: absolute; right: 12px; top: 10px;
    width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.08); border: 0; padding: 0 10px; }
  .nav-toggle span { display: block; height: 2px; background: #fff; border-radius: 2px; }
  .sidebar nav, .sidebar .foot { display: none !important; }
  .sidebar.open nav { display: block !important; margin-top: 10px; max-height: calc(100vh - 160px); overflow-y: auto; }
  .sidebar.open nav .section { display: block !important; }
  .sidebar.open .foot { display: block !important; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.1); }
  .sidebar nav { flex-wrap: nowrap; }
  /* 快速交代的範例：橫向滑動，不要一個一行 */
  .quick-foot .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; }
  .quick-foot .chips .chip { flex: none; }
  .quick-foot { flex-wrap: wrap; }
  .grid.side.dash-grid { grid-template-columns: minmax(0, 1fr); }
  .todo-row { flex-wrap: wrap; }
  .todo-row .grow { min-width: 0; flex-basis: calc(100% - 60px); }
  .energy { flex-wrap: wrap; }
  .energy-track { min-width: 120px; }
  .kpi.wide { grid-column: 1 / -1; }
  .welcome-head h1 { font-size: 20px; }
  .tour-box { width: calc(100vw - 24px); }
}
.dash-grid .onb-step { flex-wrap: wrap; }
.dash-grid .onb-step .grow { min-width: 170px; }
.dash-grid .onb-step .btn, .dash-grid .onb-step button { margin-left: 34px; }
@media (max-width: 760px) {
  .sidebar .nav-toggle span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; margin: 0 auto; }
  .sidebar .nav-toggle { align-items: center; }
}
.sidebar .nav-toggle:hover, .sidebar .nav-toggle:focus, .sidebar .nav-toggle:active { background: rgba(255,255,255,.16); border: 0; }

/* ---------- 平台後台：公司與用戶管理 ---------- */
.toolbar-select { width: auto; min-width: 140px; }
.mini-bar { display: inline-block; width: 46px; height: 6px; border-radius: 99px; background: var(--line, #e4e7ec); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.mini-bar span { display: block; height: 100%; background: #22c55e; }
.mini-bar.low span { background: #ef4444; }
.good-text { color: var(--good, #067647); }
.user-menu { display: grid; gap: 8px; }
.user-menu hr { border: 0; border-top: 1px solid var(--line, #e4e7ec); margin: 4px 0; }

/* ---------- 辦公室：AI 優化師 ---------- */
@keyframes op-patrol { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-70px); } 50% { transform: translateX(-70px); } 75% { transform: translateX(0); } }

/* ---------- 字級與間距整理（2026-11） ---------- */
/* 間距統一用 8 的倍數：區塊之間 20、卡片內 20～22、標題到內容 16 */
.main { padding: 32px 36px 56px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 24px; line-height: 1.35; }
.page-head p { font-size: 15px; margin-top: 6px; }
.grid { gap: 20px; }
.stack > * + * { margin-top: 20px; }
.kpis { gap: 20px; margin-bottom: 20px; }
.panel { padding: 22px; }
.panel h2 { font-size: 17px; margin-bottom: 16px; }
.panel h2 .more, .panel h2 .more.link { font-size: 14px; }
.card { padding: 18px; gap: 12px; }
.list-row { padding: 14px 16px; gap: 14px; }
.list-row .title { font-size: 15px; }
.kpi .label { font-size: 14px; }
.kpi .value { font-size: 28px; }
.kpi .value small { font-size: 14px; }
.kpi .muted.small { font-size: 13px; margin-top: 4px; }
label.field { font-size: 14px; margin-top: 16px; margin-bottom: 6px; }
input, select, textarea { font-size: 15px; }
input:disabled, select:disabled, textarea:disabled { background: #f2f4f7; color: #475467; cursor: not-allowed; }
button, .btn { font-size: 14px; }
.sidebar nav a { font-size: 15px; padding-top: 9px; padding-bottom: 9px; }
table.data td { font-size: 14px; padding: 10px 12px; }
table.data th { padding: 10px 12px; }
dialog .body { line-height: 1.7; }
.tabs { margin-bottom: 20px; }
.notice { font-size: 14px; }
@media (max-width: 760px) {
  .main { padding: 20px 16px 40px; }
  .page-head h1 { font-size: 21px; }
  .grid, .kpis { gap: 14px; }
  .stack > * + * { margin-top: 14px; }
  .panel { padding: 18px; }
}
.talent-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.hire-actions { margin-top: auto; gap: 8px; }
.hired-tag { font-size: 13px; color: var(--good, #067647); font-weight: 600; white-space: nowrap; }

/* 辦公室名牌在桌子正面 */

/* ---------- 和員工對話：Messenger 風格 ---------- */
.chat-log { gap: 2px; padding: 8px 4px 12px; }
.msgr-time { align-self: center; font-size: 12px; color: #8a8d91; margin: 14px 0 8px; }
.msgr-who { font-size: 12px; color: #8a8d91; align-self: flex-end; margin: 6px 12px 2px 0; }
.msgr-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.msgr-row.first:not(:first-child) { margin-top: 6px; }
.msgr-row.me { justify-content: flex-end; }
.msgr-avatar { width: 28px; flex: none; display: flex; }
.msgr-avatar .avatar.sm { width: 28px; height: 28px; }
.msgr-bubble { max-width: min(78%, 460px); padding: 8px 13px; border-radius: 18px; background: #f0f2f5; color: #050505;
  font-size: 15px; line-height: 1.45; word-break: break-word; }
.msgr-bubble > :first-child { margin-top: 0; }
.msgr-bubble > :last-child { margin-bottom: 0; }
.msgr-bubble p { margin: 0 0 6px; }
.msgr-bubble ul, .msgr-bubble ol { margin: 4px 0; padding-left: 20px; }
.msgr-row.me .msgr-bubble { background: #0866ff; color: #fff; }
.msgr-row.me .msgr-bubble a { color: #fff; text-decoration: underline; }
/* 連續訊息：靠內側的角變小，看起來是一串 */
.msgr-row.them:not(.first) .msgr-bubble { border-top-left-radius: 5px; }
.msgr-row.them:not(.last) .msgr-bubble { border-bottom-left-radius: 5px; }
.msgr-row.me:not(.first) .msgr-bubble { border-top-right-radius: 5px; }
.msgr-row.me:not(.last) .msgr-bubble { border-bottom-right-radius: 5px; }
.msgr-bubble .typing { display: inline-flex; gap: 4px; padding: 5px 2px; }
.msgr-bubble .typing i { width: 7px; height: 7px; border-radius: 50%; background: #90949c; animation: bounce 1s infinite; }
.msgr-bubble .typing i:nth-child(2) { animation-delay: .15s; }
.msgr-bubble .typing i:nth-child(3) { animation-delay: .3s; }
.msgr-empty { margin: auto; text-align: center; padding: 28px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.msgr-empty .name { font-weight: 700; font-size: 17px; margin-top: 8px; }
.msgr-online { position: relative; display: inline-flex; }
.msgr-online.on::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: #31a24c; border: 2px solid #fff; }
.chat-form.msgr-form, .chat-panel .chat-form.msgr-form { flex-direction: row; align-items: flex-end; gap: 8px; }
.msgr-form textarea { flex: 1; min-width: 0; resize: none; border: 0; background: #f0f2f5; border-radius: 20px; padding: 9px 16px;
  font-size: 15px; line-height: 1.4; min-height: 38px; max-height: 120px; overflow-y: auto; }
.msgr-form textarea:focus { outline: none; box-shadow: 0 0 0 2px rgba(8, 102, 255, .25); }
.msgr-send { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: none; color: #0866ff; display: grid; place-items: center; padding: 0; cursor: pointer; }
.msgr-send:hover { background: #f0f2f5; }
.msgr-send:disabled { color: #bcc0c4; }
.msgr-head .row .btn.small { padding: 4px 9px; }
/* 抽屜要蓋過手機版固定在上方的選單列 */
.drawer-backdrop { z-index: 50; }
.drawer { z-index: 51; }
#toast { z-index: 60; }

.email-preview { max-height: 70vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: #f4f5f7; }
.good-notice { background: var(--good-soft, #ecfdf3); color: #05603a; }
.data td.nowrap { white-space: nowrap; }

/* ---------- 交給真人的工作 ---------- */
.badge.human { background: #fff1e6; color: #b54708; }
.board.seven { grid-template-columns: repeat(7, minmax(180px, 1fr)); }
.column.human h4 span:first-child { color: #b54708; }
.task.human { border-left: 4px solid #f79009; background: #fffbf5; }
.human-box { border: 1px solid #fcd9b6; background: #fffaf3; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.human-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 10px; }
.human-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.human-grid > div { display: flex; flex-direction: column; }
.human-grid .wide { grid-column: 1 / -1; }
.human-step { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #fcd9b6; }
.human-step textarea { margin-top: 8px; }
.human-upload { display: block; margin-top: 8px; padding: 10px 12px; border: 1px dashed #d0d5dd; border-radius: 10px; cursor: pointer; background: #fff; }
.human-upload input { display: block; margin-bottom: 4px; }
.human-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.human-photo img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.assign-cell { min-width: 170px; }
.assign-cell .duties { margin-top: 6px; font-size: 13px; padding: 5px 8px; }
.switch-line { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.next-step.human { background: #fffaf3; border-color: #fcd9b6; }
.member-cell { flex-wrap: nowrap; min-width: 180px; }
.member-cell b { white-space: nowrap; }
[data-role-user] { min-width: 96px; }

.login-card .login-en { margin: -6px 0 14px; color: var(--muted); font-size: 13px; letter-spacing: .04em; }

/* ---------- 左側選單：視窗較矮時可以捲動（原本超出的部分被切掉、捲不到） ---------- */
@media (min-width: 761px) {
  .sidebar { overflow: hidden; }
  .sidebar .brand, .sidebar .foot { flex: none; }
  .sidebar nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
  .sidebar nav::-webkit-scrollbar { width: 6px; }
  .sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }
  .sidebar nav::-webkit-scrollbar-track { background: transparent; }
  /* 捲動時上下緣淡出，看得出還有內容 */
  .sidebar nav { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 14px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 14px), transparent 100%); }
  .sidebar .foot { margin-top: 8px; }
}
/* 手機版展開的選單捲到底也不帶動後面的頁面 */
.sidebar.open nav { overscroll-behavior: contain; }
/* 選單捲動不要平滑動畫（滾輪一格就移一格，比較跟手） */
.sidebar nav { scroll-behavior: auto; }

/* ---------- 公司名稱很長時不跑版 ---------- */
/* 很長又沒有空格的英文名稱也能換行 */
.page-head h1, .page-head p, .list-row .title, .notice span, .account-btn .grow, .invite-link { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  /* 手機頂部列：公司名稱過長顯示「…」，不把整個畫面撐寬（選單按鈕也不會被擠出去） */
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; max-width: 100vw; }
  .sidebar a.brand { min-width: 0; max-width: 100%; overflow: hidden; }
  .sidebar #brand-name { min-width: 0; overflow: hidden; }
  .sidebar .brand-company, .sidebar .brand-sub { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { min-width: 0; }
}

/* ---------- Telegram 通知 ---------- */
.tg-group { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.tg-kinds { display: grid; gap: 2px; margin-top: 6px; }
.tg-kinds .check { margin: 0; }
.tg-personal { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.tg-code { margin-top: 12px; padding: 12px; border-radius: 10px; background: #f0f7ff; display: grid; gap: 8px; }
.tg-code code { background: #fff; padding: 1px 6px; border-radius: 5px; }

.tg-qr-row { display: flex; gap: 12px; align-items: center; }
.tg-qr { flex: none; background: #fff; border-radius: 10px; padding: 4px; line-height: 0; }
.tg-qr svg { width: 132px; height: 132px; }
.tg-claim { max-width: 520px; margin: 40px auto; text-align: center; padding: 32px 28px; }
.tg-claim h1 { font-size: 22px; margin: 6px 0 12px; }
.tg-claim-icon { font-size: 44px; }
.tg-claim .primary { min-width: 180px; margin-top: 8px; }

/* ---------- 頁面區塊之間固定留白（原本區塊直接相鄰會黏在一起） ---------- */
#view > * + * { margin-top: 20px; }
#view > .page-head + *, #view > .small:first-child + * { margin-top: 0; }
@media (max-width: 760px) { #view > * + * { margin-top: 14px; } }

/* AI 員工頁：工作範圍、驗收清單、解僱與交接 */
.bullet-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.55; }
.bullet-list.small { font-size: 14px; margin: 6px 0 4px; }
.item-editor { display: grid; gap: 6px; }
.item-row { display: flex; align-items: center; gap: 8px; }
.item-row input { flex: 1; min-width: 0; }
.item-row.add input { border-style: dashed; }
.item-dot { width: 16px; text-align: center; color: var(--muted); flex: none; }
.icon-btn { border: 0; background: none; color: var(--muted); padding: 6px 8px; cursor: pointer; border-radius: 8px; }
.icon-btn:hover { background: var(--bad-soft, #fdecea); color: #b42318; }
.profile-rows { display: grid; gap: 8px; }
.profile-rows .persona-row { grid-template-columns: 120px 1fr; }
.scope-dialog, .fire-dialog { width: min(560px, calc(100vw - 32px)); }
.fire-dialog select, .scope-dialog textarea { width: 100%; }
.handover { border-top: 1px solid var(--border); padding: 10px 0; }
.handover:first-of-type { border-top: 0; }
.handover summary { cursor: pointer; font-weight: 600; }
.handover .md { margin-top: 8px; font-size: 14px; }
@media (max-width: 760px) { .profile-rows .persona-row { grid-template-columns: 1fr; gap: 2px; } }
.notice select { width: auto; min-width: 200px; max-width: 100%; }

/* 配置助手：人才趨勢 */
.trend-panel h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trend-summary { background: #f6f7fb; border-radius: 10px; padding: 12px 14px; line-height: 1.6; margin-bottom: 14px; }
.trend-table td { vertical-align: top; }
.trend-table .stars { color: #f59e0b; letter-spacing: 1px; white-space: nowrap; }
.trend-sources { margin-top: 12px; }
.trend-sources summary { cursor: pointer; font-weight: 600; }
.trend-sources ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.table-wrap { overflow-x: auto; }

/* 後台：生成人選照片 */
.portrait-gen { margin-top: 10px; padding: 10px 12px; background: #f6f7fb; border-radius: 10px; }
.portrait-candidates { margin-top: 10px; }
.portrait-option { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pixel-gen { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.pixel-gen img { height: 72px; image-rendering: pixelated; background: #e7d3b3; padding: 4px 8px; border-radius: 8px; }
.pixel-gen img.fig { image-rendering: auto; height: 88px; background: #efe4d4; }
.portrait-option img { width: 112px; height: 112px; border-radius: 50%; background: #e7e9ef; object-fit: cover; }

/* ---------- 辦公室（像素版）：尺寸都用辦公室寬度（cqw），任何螢幕大小都不跑版 ---------- */
.po-tabs { display: flex; gap: 6px; margin-bottom: -1px; position: relative; z-index: 2; overflow-x: auto; }
.po-tabs[hidden] { display: none; }
.po-tabs button { white-space: nowrap; border: 1px solid var(--border); border-bottom: 0; background: #eceef3; color: var(--muted); font-size: 14px; padding: 8px 14px; border-radius: 12px 12px 0 0; }
.po-tabs button.on { background: #fff; color: var(--text); font-weight: 600; }
.po-tabs em { font-style: normal; color: #98a2b3; font-size: 12px; margin-left: 4px; }
.po-tabs .warn { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; margin-left: 6px; }
.po-stage { position: relative; isolation: isolate; width: 100%; aspect-ratio: 16 / 9; container-type: inline-size; overflow: hidden; user-select: none;
  border: .5cqw solid #3b2a20; border-radius: 4px; image-rendering: pixelated; font-family: -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
  background: conic-gradient(#d9b48a 25%, #cfa77a 0 50%, #d9b48a 0 75%, #cfa77a 0) 0 0 / 4cqw 4cqw; }
.po-stage.day { --sky: #9fd8ff; --tint: transparent; }
.po-stage.dusk { --sky: #ffbb7a; --tint: rgba(255,140,40,.14); }
.po-stage.night { --sky: #1d2748; --tint: rgba(12,20,60,.38); }
.po-wall { position: absolute; inset: 0 0 auto 0; height: 13%; background: linear-gradient(#7d8bb0 0 82%, #4d5878 82%); z-index: 1; }
.po-win { position: absolute; top: 1.3cqw; width: 8cqw; height: 4.4cqw; background: var(--sky); border: .5cqw solid #3b2a20; box-shadow: inset 0 0 0 .3cqw rgba(255,255,255,.55); z-index: 2; overflow: hidden; transition: background 1.5s; }
.po-stage.night .po-win::before { content: ""; position: absolute; left: 20%; top: 25%; width: .35cqw; height: .35cqw; background: #fff; box-shadow: 3cqw .6cqw #fff, 1.6cqw 2cqw #ffe9a8, 5.6cqw 1.4cqw #fff; }
.po-sign { position: absolute; left: 31%; top: 1cqw; transform: translateX(-50%); z-index: 2; background: #23263a; border: .4cqw solid #11131d; color: #ffd36a; padding: .5cqw 1.6cqw; max-width: 26cqw;
  font-weight: 800; font-size: 1.6cqw; letter-spacing: .1cqw; white-space: nowrap; text-align: center; overflow: hidden; }
.po-sign small { display: block; font-family: "Courier New", monospace; font-size: .9cqw; color: #8fd3ff; letter-spacing: .1cqw; }
.po-clock { position: absolute; left: 46%; top: 1.6cqw; z-index: 2; background: #11131d; color: #7dffb0; border: .35cqw solid #3b2a20; font-family: "Courier New", monospace; font-weight: 700; font-size: 1.4cqw; padding: .25cqw .6cqw; }
.po-pantry { position: absolute; left: 53%; top: 13%; width: 10%; height: 7%; background: #b7bfd0; border: .35cqw solid #3b2a20; box-shadow: inset 0 -.5cqw 0 #8e97ab; z-index: 200; }
.po-pantry .cm { position: absolute; left: 10%; bottom: 60%; width: 3cqw; height: 3.4cqw; background: #2d3142; border: .3cqw solid #11131d; }
.po-pantry .cm::after { content: ""; position: absolute; left: 30%; bottom: .3cqw; width: .9cqw; height: .7cqw; background: #f1f1f1; }
.po-pantry .wd { position: absolute; right: 12%; bottom: 60%; width: 2.2cqw; height: 4cqw; background: #e9f3ff; border: .3cqw solid #11131d; }
.po-pantry .wd::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 45%; background: #7cc4ff; }
.po-steam { position: absolute; left: 56%; top: 4%; width: 2cqw; height: 3cqw; z-index: 210; pointer-events: none; display: none; }
.po-steam.on { display: block; }
.po-steam i { position: absolute; bottom: 0; width: .4cqw; height: .8cqw; background: rgba(255,255,255,.85); animation: po-steam 1.2s steps(4) infinite; }
.po-steam i:nth-child(2) { left: .9cqw; animation-delay: .4s; }
@keyframes po-steam { 100% { transform: translateY(-2.2cqw); opacity: 0; } }
.po-door { position: absolute; left: 56%; top: 98.6%; width: 6%; height: 1.4%; background: #6e4528; z-index: 3; }
.po-room { position: absolute; border: .45cqw solid #3b2a20; }
.po-label { position: absolute; left: .8cqw; top: .6cqw; font-weight: 700; font-size: 1.05cqw; color: #fff; background: #3b2a20; padding: .1cqw .6cqw; z-index: 990; white-space: nowrap; }
.po-gap { position: absolute; left: -.45cqw; width: .45cqw; background: inherit; }
.po-boss { left: 64%; top: 15%; width: 34%; height: 35%; background: conic-gradient(#c8d5ea 25%, #bccbe3 0 50%, #c8d5ea 0 75%, #bccbe3 0) 0 0 / 4cqw 4cqw; }
.po-meet { left: 64%; top: 55%; width: 34%; height: 42%; background: conic-gradient(#cfe3c9 25%, #c3dbbd 0 50%, #cfe3c9 0 75%, #c3dbbd 0) 0 0 / 4cqw 4cqw; }
.po-mtable { position: absolute; left: 67.5%; top: 76%; width: 27%; height: 10%; background: #8a5a36; border: .4cqw solid #3b2a20; box-shadow: inset 0 -.6cqw 0 #6e4528; z-index: 805; }
.po-mchair { position: absolute; width: 4.2cqw; height: 3.4cqw; transform: translate(-50%, -100%); background: #6b7280; border: .3cqw solid #374151; border-radius: .6cqw .6cqw 0 0; z-index: 700; }
.po-plaque { position: absolute; left: 81%; top: 81.5%; transform: translate(-50%, -50%); z-index: 806; background: #f6f1e4; color: #23263a; border: .25cqw solid #23263a; box-shadow: 0 .35cqw 0 #23263a; border-radius: 0;
  font-weight: 800; font-size: max(9px, 1.1cqw); padding: .15cqw .7cqw; white-space: nowrap; cursor: pointer; min-height: 0; line-height: 1.4; }
.po-light { position: absolute; inset: 0; pointer-events: none; z-index: 1000; background: var(--tint); transition: background 1.5s; }
.po-desk { position: absolute; width: 11cqw; height: 3.6cqw; transform: translate(-50%, 0); background: #8a5a36; border: .35cqw solid #3b2a20; box-shadow: inset 0 -.6cqw 0 #6e4528; }
.po-desk::before { content: ""; position: absolute; left: 4%; top: -1.9cqw; width: 2.9cqw; height: 1.9cqw; background: var(--scr, #2a2f3c); border: .3cqw solid #11131d; }
.po-desk.on { --scr: #3b82f6; }
.po-desk.on:not(.away)::before { animation: po-scr 1.2s steps(2) infinite; }
@keyframes po-scr { 50% { background: #60a5fa; } }
.po-plate { position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%); white-space: nowrap; font-size: .95cqw; font-weight: 700; color: #fff; background: #23263a; padding: .1cqw .6cqw; border: .2cqw solid #11131d; }
.po-plate i { display: inline-block; width: .7cqw; height: .7cqw; background: #c3cad6; margin-right: .35cqw; }
.po-plate .s-working, .po-plate .s-reviewing, .po-plate .s-drawing { background: #3b82f6; }
.po-plate .s-reworking, .po-plate .s-waiting, .po-plate .s-tired, .po-plate .s-noted { background: #f59e0b; }
.po-plate .s-talking, .po-plate .s-answering, .po-plate .s-meeting, .po-plate .s-celebrate, .po-plate .s-treat { background: #22c55e; }
.po-plate .s-presenting { background: #8b5cf6; } .po-plate .s-asleep { background: #ef4444; }
.po-lamp { position: absolute; right: 6%; top: -2.2cqw; width: 1.2cqw; height: 2.2cqw; border-left: .3cqw solid #11131d; display: none; }
.po-lamp::before { content: ""; position: absolute; left: -.3cqw; top: 0; width: 1.6cqw; height: .8cqw; background: #ffd36a; border: .2cqw solid #11131d; }
.po-stage.night .po-desk.on .po-lamp, .po-stage.dusk .po-desk.on .po-lamp { display: block; }
.po-glow { position: absolute; width: 16cqw; height: 9cqw; transform: translate(-50%, -30%); background: radial-gradient(rgba(255,220,140,.42), transparent 65%); z-index: 1001; pointer-events: none; }
.po-chair { position: absolute; width: 4.4cqw; height: 3.6cqw; transform: translate(-50%, -100%); background: #6b7280; border: .3cqw solid #374151; border-radius: .6cqw .6cqw 0 0; }
.po-plant { position: absolute; width: 2.6cqw; height: 3.6cqw; transform: translate(-50%, -100%); }
.po-plant::before { content: ""; position: absolute; bottom: 0; left: .4cqw; width: 1.8cqw; height: 1.4cqw; background: #c2643c; border: .25cqw solid #3b2a20; }
.po-plant::after { content: ""; position: absolute; bottom: 1.2cqw; left: 0; width: 2.6cqw; height: 2.4cqw; background: #4f9d5d; border: .25cqw solid #24502d; }

.po-who { position: absolute; height: 10cqw; transform: translate(-50%, -100%); cursor: pointer; transition: left var(--t, 0s) linear, top var(--t, 0s) linear; }
.po-who img { height: 100%; display: block; image-rendering: pixelated; }
.po-who.walk img { animation: po-step .36s steps(2) infinite; }
.po-who.flip img { transform: scaleX(-1); }
.po-who.walk.flip img { animation: po-stepf .36s steps(2) infinite; }
@keyframes po-step { 50% { transform: translateY(-.35cqw); } }
@keyframes po-stepf { 0% { transform: scaleX(-1); } 50% { transform: scaleX(-1) translateY(-.35cqw); } }
.po-who.type img { animation: po-type 1.1s steps(2) infinite; }
@keyframes po-type { 50% { transform: translateY(.2cqw); } }
.po-who.stretch img { animation: po-stretch 1.4s steps(3) 2; }
@keyframes po-stretch { 0%, 100% { transform: none; } 40% { transform: translateY(-1.1cqw) scaleY(1.06); } 70% { transform: translateY(-.6cqw); } }
.po-icon { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: .2cqw; font-weight: 700; font-size: max(9px, 1.05cqw); z-index: 2;
  background: #fff; color: #23263a; border: .25cqw solid #23263a; padding: .05cqw .45cqw; white-space: nowrap; line-height: 1.35; }
.po-icon:empty { display: none; }
.po-icon.warn { background: #f59e0b; color: #fff; animation: po-bob 1.4s steps(2) infinite; }
.po-icon.warnish { background: #fff4e0; }
.po-icon.dots { font-family: "Courier New", monospace; letter-spacing: .15cqw; animation: po-dots 1.6s steps(1) infinite; }
.po-icon.speak { background: #e6f7ec; }
.po-icon.dark { background: #23263a; color: #fff; }
.po-icon.zz { background: #e0e7ff; color: #4338ca; }
@keyframes po-dots { 0% { clip-path: inset(0 66% 0 0); } 33% { clip-path: inset(0 33% 0 0); } 66% { clip-path: none; } }
@keyframes po-bob { 50% { transform: translate(-50%, -.4cqw); } }
.po-mug { position: absolute; right: -.4cqw; top: 52%; width: 1.3cqw; height: 1.4cqw; background: #fff; border: .25cqw solid #23263a; display: none; }
.po-mug::after { content: ""; position: absolute; right: -.75cqw; top: .2cqw; width: .5cqw; height: .55cqw; border: .25cqw solid #23263a; border-left: 0; }
.po-who.cup .po-mug { display: block; }

/* 交接的文件：淡黃色紙、藍色文字線、折角 */
.po-paper { position: absolute; z-index: 980; width: 2.6cqw; height: 3.2cqw; background: #fdf3c8; border: .25cqw solid #23263a; transform: translate(-50%, -50%); box-shadow: .3cqw .3cqw 0 rgba(0,0,0,.25);
  transition: left 1.3s steps(14), top 1.3s steps(14), opacity .2s; opacity: 0; pointer-events: none;
  background-image: linear-gradient(#5b8def, #5b8def), linear-gradient(#5b8def, #5b8def), linear-gradient(#5b8def, #5b8def), linear-gradient(#e2574c, #e2574c);
  background-size: 60% .35cqw, 60% .35cqw, 40% .35cqw, 35% .4cqw; background-repeat: no-repeat; background-position: 30% 35%, 30% 55%, 25% 75%, 25% 15%; }
.po-paper::after { content: ""; position: absolute; right: -.25cqw; top: -.25cqw; width: .8cqw; height: .8cqw; background: #e0cf8a; border-left: .25cqw solid #23263a; border-bottom: .25cqw solid #23263a; }

.po-card { position: absolute; z-index: 1100; width: 26cqw; min-width: 230px; max-width: 92%; background: #fff; border: 3px solid #23263a; padding: 12px; font-size: 14px; display: none; box-shadow: 5px 5px 0 rgba(0,0,0,.25); }
.po-card.show { display: block; }
.po-card .po-x { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; min-height: 0; padding: 0; border: 2px solid #23263a; border-radius: 0; background: #fff; font-weight: 800; font-size: 13px; justify-content: center; }
.po-card .po-x:hover { background: #fde68a; }
.po-top { display: flex; gap: 10px; align-items: center; padding-right: 26px; }
.po-top img { height: 52px; image-rendering: pixelated; }
.po-top b { font-size: 15px; }
.po-card .muted { color: var(--muted); font-size: 13px; }
.po-card ul { margin: 8px 0 0; padding-left: 18px; }
.po-line { margin-top: 8px; color: var(--text); }
.po-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.po-btns a.btn { text-decoration: none; }

/* ---------- 辦公室（3D 版）：背景是一張 3D 渲染圖，桌子、椅背是蓋在人前面的圖層 ---------- */
.po-who.gone { opacity: 0; transition: opacity .35s; }
.po3d .po-stage { aspect-ratio: 3 / 2; border: 0; border-radius: 14px; background: #efe4d4; image-rendering: auto; box-shadow: var(--shadow); }
.po3-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.po3-occ { position: absolute; pointer-events: none; display: block; }
.po3d .po-light { z-index: 20000; background: none; }
.po3d .po-stage.dusk .po-light { background: linear-gradient(rgba(255,150,60,.16), rgba(255,120,40,.10)); mix-blend-mode: multiply; }
.po3d .po-stage.night .po-light { background: rgba(30,40,90,.38); mix-blend-mode: multiply; }
.po3-lamp { position: absolute; width: 12cqw; height: 7cqw; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(rgba(255,214,140,.55), transparent 65%);
  z-index: 20001; pointer-events: none; mix-blend-mode: screen; }
.po3d .po-clock { left: 1.5cqw; top: 1.5cqw; z-index: 20002; background: rgba(255,255,255,.85); color: #3b2a1a; border: 0; border-radius: 99px; font-family: inherit; font-size: max(11px, 1.1cqw); padding: .3cqw 1cqw; }
.po3d .po-who { transition: left var(--t, 0s) linear, top var(--t, 0s) linear, height var(--t, 0s) linear, opacity .35s; }
.po3d .po-who img { image-rendering: auto; filter: drop-shadow(0 .25cqw .25cqw rgba(0,0,0,.18)); transition: translate .08s; }
.po3d .po-who.walk img, .po3d .po-who.walk.flip img { animation: none; }
.po3d .po-who.pass img { translate: 0 -1.5%; }
.po3d .po-who.type img { animation: po3-type 1.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes po3-type { 50% { transform: translateY(.12cqw) rotate(-.6deg); } }
.po3d .po-who.stretch img { animation: po3-stretch 1.6s ease-in-out 2; transform-origin: 50% 100%; }
@keyframes po3-stretch { 40% { transform: translateY(-.6cqw) scaleY(1.04); } }
.po3d .po-who::after { content: ""; position: absolute; left: 50%; bottom: -.2cqw; width: 70%; height: .9cqw; transform: translateX(-50%); border-radius: 50%; background: rgba(0,0,0,.16); filter: blur(.25cqw); z-index: -1; }
.po3d .po-who.sit::after { display: none; }
.po3d .po-icon { border: 0; border-radius: 1cqw; padding: .3cqw .8cqw; font-size: max(10px, 1.05cqw); font-weight: 600; box-shadow: 0 .2cqw .7cqw rgba(0,0,0,.2); margin-bottom: .4cqw; line-height: 1.4; }
.po3d .po-icon.warn { border-radius: 99px; }
.po3d .po-icon.dots { font-family: inherit; }
.po3d .po-mug { border-width: .15cqw; border-radius: .2cqw; width: .9cqw; height: 1cqw; right: 10%; top: 45%; }
.po3d .po-plaque { z-index: 8000; background: #fffaf0; color: #3b2a1a; border: .12cqw solid #c8b48f; border-bottom: .35cqw solid #6b4f2e; border-radius: .3cqw; box-shadow: 0 .3cqw .5cqw rgba(0,0,0,.25); font-size: max(9px, 1cqw); }
.po3d .po-paper { z-index: 9000; border-radius: .2cqw; border-width: .12cqw; }
.po3d .po-card { z-index: 30000; border: 0; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.po3d .po-card .po-x { border: 0; border-radius: 50%; background: #f2f4f7; }
.po3d .po-top img { image-rendering: auto; height: 64px; }
.po3d .po-steam { z-index: 3300; }
.po3d .po-steam i { width: .35cqw; height: 1.2cqw; border-radius: 1cqw; }
.office-style { display: inline-flex; background: var(--panel, #fff); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.office-style button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-size: 13px; color: var(--muted); min-height: 0; }
.office-style button.on { background: #24273a; color: #fff; }
/* 頭像跟著人物風格：像素版的頭像要保持格子清楚 */
.avatar.pic img.px { image-rendering: pixelated; object-fit: cover; background: #e9dcc6; }
.avatar.pic img.fig3d { object-fit: cover; background: #efe4d4; }
.notice.warn-notice { box-shadow: inset 4px 0 0 var(--warn, #f59e0b); }
