/* 校稿牆：紙面灰底 + 墨藍主色；狀態用黃（修正中）與綠（校稿完成） */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --fg: #1b2230;
  --muted: #5d6677;
  --line: #dde1e8;
  --accent: #1f4e8c;
  --accent-fg: #ffffff;
  --accent-soft: #e6edf8;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-bg: #fff1c7;
  --ok: #1d6b3a;
  --ok-bg: #dbf2e3;
  --viewer-bg: #1d2129;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .06);
  --radius: 10px;
  --font: "Noto Sans TC", system-ui, -apple-system, "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --surface: #1a1e26; --surface-2: #222733; --fg: #e5e8ee; --muted: #9aa2b1; --line: #2d3340;
    --accent: #7ea6e4; --accent-fg: #0e1828; --accent-soft: #1f2b40;
    --danger: #ff8a7a; --danger-soft: #3a1d1a; --warn: #f3c55c; --warn-bg: #3a2f12; --ok: #7fd69c; --ok-bg: #16321f;
    --viewer-bg: #0b0d11; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right)); }

/* ---------- 按鈕 / 表單 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1.4; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, .textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 12px; }
.textarea { resize: vertical; min-height: 84px; }
.input:focus, .textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }
.error-text { color: var(--danger); font-size: 13.5px; }

/* ---------- 狀態標籤 ---------- */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-revising { background: var(--warn-bg); color: var(--warn); }
.status-approved { background: var(--ok-bg); color: var(--ok); }
.badge-admin { font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* ---------- 頂部列 ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .container { display: flex; align-items: center; gap: 12px; min-height: 56px; flex-wrap: wrap; padding-block: 8px; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-size: 14px; flex: none; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adminbar { background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.adminbar .container { display: flex; gap: 12px; align-items: center; min-height: 34px; flex-wrap: wrap; }

/* ---------- 置中卡片（密碼、登入、錯誤） ---------- */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 28px; width: 100%; max-width: 400px; display: grid; gap: 16px; }
.card h1 { font-size: 20px; margin: 0; text-wrap: balance; }
.card p { margin: 0; color: var(--muted); }

/* ---------- 牆：工具列、搜尋 ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-block: 18px 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--line); }

.section-label { font-size: 12px; letter-spacing: .08em; color: var(--muted); margin: 18px 0 10px; font-weight: 500; }
.find-row { flex: 1 1 320px; min-width: 0; }
.search-input { flex: 1 1 200px; min-width: 0; max-width: 360px; }
.sort-select { width: auto; flex: none; }
.list-summary:empty { display: none; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; padding-bottom: 48px; align-items: start; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: left; padding: 0; min-width: 0;
  display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.tile:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tile-thumb { aspect-ratio: 4 / 5; background: var(--surface-2); position: relative; overflow: hidden; display: grid; place-items: center; }
.tile-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile-thumb .type { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; background: var(--danger); color: #fff; padding: 1px 6px; border-radius: 4px; }
.tile-thumb .tile-ver { position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 500; background: var(--accent); color: var(--accent-fg); padding: 1px 7px; border-radius: 4px; }
.tile-thumb .noimg { color: var(--muted); font-size: 13px; padding: 12px; text-align: center; }
.tile-body { padding: 10px 12px 12px; display: grid; gap: 6px; }
.tile-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.tile-count { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }

.empty { text-align: center; color: var(--muted); padding: 56px 16px; border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 16px; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- 檢視器 ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr) 400px; background: var(--viewer-bg); }
.viewer-media { position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.viewer-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); color: #e8ebf0; }
.viewer-head .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-head .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: #e8ebf0; }
.viewer-head .btn:hover { background: rgba(255,255,255,.16); }
.stage { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.stage.dragging { cursor: grabbing; }
.stage img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; user-select: none; -webkit-user-drag: none; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.stage .msg { position: absolute; inset: 0; display: grid; place-items: center; color: #aab2c0; font-size: 14px; text-align: center; padding: 16px; }
.zoombar { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px;
  background: rgba(20,24,32,.85); border-radius: 10px; color: #e8ebf0; align-items: center; }
.zoombar button { background: transparent; border: 0; color: inherit; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.zoombar button:hover { background: rgba(255,255,255,.12); }
.zoombar .pct { min-width: 52px; text-align: center; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.navbtn { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; border: 0; border-radius: 8px; background: rgba(20,24,32,.6); color: #fff;
  font-size: 22px; cursor: pointer; z-index: 2; }
.navbtn:hover { background: rgba(20,24,32,.85); }
.navbtn.prev { left: 10px; }
.navbtn.next { right: 10px; }

.panel { background: var(--surface); display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); }
.panel-head { padding: 16px 18px 12px; padding-top: max(16px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.panel-title { font-weight: 700; font-size: 15px; word-break: break-all; }
.panel-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.versions { display: flex; flex-wrap: wrap; gap: 6px; }
.ver { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px;
  font-size: 12.5px; cursor: pointer; color: var(--muted); }
.ver:hover { border-color: var(--accent); }
.ver[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 500; }
.ver-dot { width: 7px; height: 7px; border-radius: 50%; }
.ver-dot.ver-revising { background: var(--warn); }
.ver-dot.ver-approved { background: var(--ok); }
.ver-latest { font-size: 11px; color: var(--accent); }
.ver-count { font-size: 11px; background: var(--surface-2); border-radius: 999px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.old-note { background: var(--warn-bg); color: var(--warn); font-size: 13px; border-radius: 8px; padding: 8px 10px; }
.stage .msg { white-space: pre-line; }
.comments { flex: 1; overflow-y: auto; padding: 8px 18px 16px; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.c-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.c-name { font-weight: 700; }
.c-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.c-body { margin-top: 4px; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.c-deleted { color: var(--muted); font-style: italic; font-size: 13.5px; margin-top: 4px; }
.c-actions { display: flex; gap: 4px; margin-top: 4px; }
.c-actions button { border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 2px 6px; cursor: pointer; border-radius: 4px; }
.c-actions button:hover { color: var(--accent); background: var(--accent-soft); }
.c-actions .del:hover { color: var(--danger); background: var(--danger-soft); }
.replies { margin: 8px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--line); }
.replies .comment { padding: 8px 0; border-bottom: 0; }
.reply-form { margin-top: 8px; display: grid; gap: 6px; }
.compose { border-top: 1px solid var(--line); padding: 12px 18px; padding-bottom: max(12px, env(safe-area-inset-bottom)); display: grid; gap: 8px; background: var(--surface); }
.compose .name-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.compose .name-row .input { padding: 5px 10px; font-size: 13.5px; max-width: 180px; }
.no-comments { color: var(--muted); font-size: 13.5px; padding: 24px 0; text-align: center; }

@media (max-width: 860px) {
  .viewer { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .viewer-media { height: 58vh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); min-height: 42vh; }
  .comments { flex: none; overflow: visible; }
  .compose { position: sticky; bottom: 0; }
  .panel-head { padding-top: 14px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

/* ---------- 對話框 ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 22, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; display: grid; gap: 16px; padding: 24px; }
.modal h2 { margin: 0; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------- 通知 ---------- */
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px;
  border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- 後台 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-size: 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 20px 4px; }
.page-head h2 { margin: 0; font-size: 18px; }
.wall-list { display: grid; gap: 10px; padding-block: 12px 48px; }
.wall-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; }
.wall-item.inactive { opacity: .65; }
.wall-title { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wall-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.wall-note { font-size: 13px; color: var(--muted); }
.pill-off { font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); color: var(--muted); font-weight: 500; }
.pill-open { font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); color: var(--accent, #2563eb); font-weight: 500; margin-left: 6px; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; }
.cf-off { font-size: 13px; color: var(--muted); padding: 8px 0; }
@media (max-width: 640px) { .wall-item { grid-template-columns: minmax(0, 1fr); } }
.copy-box { display: flex; gap: 6px; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-family: var(--mono); font-size: 13px; }
.copy-box span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.list-table th, .list-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list-table th { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.table-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; margin-block: 12px 48px; }
.recent-item { display: grid; gap: 2px; }
.recent-item .where { font-size: 12.5px; color: var(--muted); }
/* ---------- 上傳、選取、容量 ---------- */
.storage-warn { background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.storage-warn .container { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; min-height: 36px; padding-block: 6px; }
.storage-warn a { color: inherit; font-weight: 700; }
.badge-client { font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--warn-bg); color: var(--warn); font-weight: 500; white-space: nowrap; }
.tile-by { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.tile-by span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tile-check { position: absolute; bottom: 8px; right: 8px; width: 24px; height: 24px; border-radius: 6px; border: 2px solid #fff; background: rgba(20,24,32,.45);
  color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.tile.is-selected .tile-check { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.pdf-icon { display: inline-grid; place-items: center; width: 64px; height: 80px; border-radius: 6px; background: var(--danger); color: #fff; font-weight: 700; font-size: 15px; }
.batchbar { position: sticky; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(20,30,50,.08);
  padding-bottom: env(safe-area-inset-bottom); }
.batch-inner { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-block: 10px; }
.dropzone { display: grid; gap: 6px; }
.drop-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(31, 78, 140, .18); border: 3px dashed var(--accent); display: grid; place-items: center; pointer-events: none; }
.drop-overlay div { background: var(--surface); color: var(--accent); font-weight: 700; padding: 14px 22px; border-radius: 12px; box-shadow: var(--shadow); }
.up-panel { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 65; width: min(380px, calc(100vw - 32px));
  max-height: 50vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.up-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.up-list { overflow-y: auto; padding: 6px 14px 10px; }
.up-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 6px 0; font-size: 13px; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-state { color: var(--muted); font-size: 12px; text-align: right; }
.up-row.ok .up-state { color: var(--ok); }
.up-row.err .up-state { color: var(--danger); grid-column: 1 / -1; text-align: left; }
.up-bar { grid-column: 1 / -1; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.up-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up-row.ok .up-fill { background: var(--ok); }
.up-row.err .up-fill { background: var(--danger); }
.linkbtn { border: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; font: inherit; font-weight: 700; }
.pdf-open { position: absolute; right: 14px; bottom: 14px; z-index: 2; }
.usage-bar { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; position: relative; }
.usage-fill { height: 100%; background: var(--accent); }
.usage-fill.over { background: var(--danger); }
.usage-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--fg); opacity: .5; }
.stat-row { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat-row strong { color: var(--fg); }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; margin-top: 12px; }
.badge-over { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; }
.list-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.check-ok { background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }
.devnote { background: var(--warn-bg); color: var(--warn); font-size: 13px; padding: 8px 12px; border-radius: 8px; }

/* ---------- 留言附件 ---------- */
.att-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att { display: grid; grid-template-rows: 72px auto auto; width: 112px; padding: 0; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); overflow: hidden; cursor: zoom-in; text-align: left; color: var(--fg); font: inherit; }
.att:hover { border-color: var(--accent); }
.att:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.att-thumb { display: grid; place-items: center; overflow: hidden; background: var(--surface); }
.att-thumb img { width: 100%; height: 72px; object-fit: cover; }
.att-thumb .pdf-icon, .att-chip .pdf-icon { width: 40px; height: 50px; font-size: 12px; }
.att-name { padding: 4px 6px 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { padding: 0 6px 5px; font-size: 11px; color: var(--muted); }

.att-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 3px 4px 3px 3px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface-2); font-size: 12px; }
.att-chip img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; flex: none; }
.att-chip .pdf-icon { width: 26px; height: 32px; font-size: 9px; flex: none; }
.att-chip .att-name { padding: 0; min-width: 0; }
.att-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; flex: none; }
.att-chip button:hover { color: var(--danger); background: var(--danger-soft); }

.att-preview { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: rgba(8, 10, 14, .96); }
.att-preview .viewer-head .c-time { color: #aab2c0; }
.att-preview .navbtn[hidden] { display: none; }

/* ---------- 卡片：點開大圖 + 直接留言 ---------- */
.tile-main { display: flex; flex-direction: column; width: 100%; border: 0; background: none; padding: 0; margin: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.tile-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile-cbtn { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; border-top: 1px solid var(--line); background: none; padding: 8px 12px;
  font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; text-align: left; }
.tile-cbtn:hover, .tile-cbtn[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
.tile-cnum { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-2); color: var(--fg); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.tile-cbtn .caret { font-size: 11px; }
.tile.is-open { border-color: var(--accent); }

.inline { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: grid; gap: 10px; background: var(--surface); }
.inline-list { display: grid; gap: 10px; max-height: 340px; overflow-y: auto; }
.inline-c { font-size: 13px; min-width: 0; }
.inline-c.is-reply { margin-left: 10px; padding-left: 8px; border-left: 2px solid var(--line); }
.inline-c .c-head { font-size: 12.5px; gap: 6px; }
.inline-c .c-body { font-size: 13px; margin-top: 2px; }
.inline-c .att-list { gap: 6px; margin-top: 6px; }
.inline-c .att { width: 76px; grid-template-rows: 52px auto auto; }
.inline-c .att-thumb img { height: 52px; }
.inline-c .att-size { display: none; }
.inline-rbtn { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--muted); text-decoration: none; }
.inline-rbtn:hover { color: var(--accent); }
.inline-more { justify-self: start; font-size: 12.5px; font-weight: 500; color: var(--accent); }
.inline-empty { text-align: center; padding: 4px 0; }
.inline-compose { display: grid; gap: 6px; }
.inline-compose .inline-name { padding: 4px 8px; font-size: 12.5px; }
.inline-compose .textarea { font-size: 13px; min-height: 0; }
.inline-compose .att-chip { max-width: 100%; }
.inline-reply { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 3px 4px 3px 8px; }
.inline-reply button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; }

/* ---------- 左側：客戶檔案上傳區 ---------- */
.wall-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.wall-main { min-width: 0; }
.cf-area { position: sticky; top: 12px; margin-top: 18px; display: grid; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); max-height: calc(100vh - 24px); min-height: 0; grid-template-rows: auto auto auto minmax(0, 1fr); transition: border-color .15s, box-shadow .15s; }
.cf-area.is-drag { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cf-head h2 { margin: 0; font-size: 15px; }
.cf-count { font-size: 12px; color: var(--muted); }
.cf-note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.cf-drop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; border: 1.5px dashed var(--line); border-radius: 8px; background: var(--surface-2); }
.cf-list { display: grid; gap: 2px; overflow-y: auto; min-height: 0; align-content: start; }
.cf-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 16px 0; }
.cf-item { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 4px 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); align-items: center; }
.cf-item:last-child { border-bottom: 0; }
.cf-ext { grid-row: span 2; display: grid; place-items: center; width: 38px; height: 44px; border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; overflow: hidden; }
.cf-info { min-width: 0; }
.cf-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-meta { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.cf-meta .badge-client { flex: none; }
.cf-tools { display: flex; gap: 6px; }
.cf-tools .btn { padding: 3px 10px; font-size: 12.5px; }
.cf-del:hover { color: var(--danger); background: var(--danger-soft); }
@media (max-width: 860px) {
  .wall-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cf-area { position: static; max-height: none; }
  .cf-list { max-height: 260px; }
}
.nick-edit { font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; margin-left: 2px; }
.nick-edit:hover { color: var(--accent); }
