/* 會議詳情頁（播放器、逐字稿對齊、編輯）。只用 styles.css 定義的 CSS 變數，不在這裡定義顏色。 */

/* ── 標題、基本資料的就地編輯 ───────────── */
.mt-title-row { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.mt-title-row h1 { min-width: 0; flex: 0 1 auto; }
.mt-title-row .btn { margin-top: 2px; }
.inline-edit { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.inline-edit .input, .inline-edit .select { width: 100%; max-width: 100%; }
.mt-title-input { font-size: 18px; font-weight: 600; height: 42px; }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fact-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.fact-edit .fact-value { min-width: 0; overflow-wrap: anywhere; }
.fact-edit > .btn.ghost { height: 26px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.fact-edit .inline-edit { width: 100%; }

/* 儲存狀態 */
.save-state { font-size: 13px; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.save-state:empty { display: none; }
.save-state.saving { color: var(--info); }
.save-state.ok { color: var(--ok); }
.save-state.fail { color: var(--danger); }

.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.icon-btn.sm { width: 30px; height: 30px; font-size: 14px; display: inline-grid; place-items: center; }
.icon-btn.sm:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.danger { color: var(--danger); }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }

/* ── 摘要／決議：清單編輯 ───────────────── */
.list-edit { margin: 0; padding: 0 0 0 22px; display: flex; flex-direction: column; gap: 8px; }
.list-edit li { display: flex; gap: 6px; align-items: flex-start; }
.list-edit li::marker { color: var(--faint); font-size: 13px; }
.list-edit textarea { flex: 1; min-width: 0; resize: vertical; min-height: 38px; height: auto; padding-top: 7px; padding-bottom: 7px; line-height: 1.5; }
.list-edit .row-tools { display: flex; gap: 2px; flex: none; }

/* ── 待辦 ───────────────────────────────── */
.todo .todo-actions { display: flex; gap: 2px; flex: none; margin-left: auto; opacity: .55; }
.todo:hover .todo-actions, .todo:focus-within .todo-actions { opacity: 1; }
.todo-edit { display: block; }
.todo-form { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.todo-form .input { width: 100%; }
.todo-form-row { display: flex; flex-wrap: wrap; gap: 8px; }
.todo-form-row .field { flex: 1 1 140px; }
.todo-form-row .field:first-child { flex: 0 1 110px; }
.todo-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.todo-add .input:first-child { flex: 1 1 220px; min-width: 0; }
.todo-add .select { flex: 0 0 auto; width: auto; }
.todo-add .input + .select + .input { flex: 0 1 170px; min-width: 0; }
.todo-add .save-state { flex-basis: 100%; }

/* ── 播放器 ─────────────────────────────── */
.mp {
  position: sticky; top: var(--mp-top, 64px); z-index: 25;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  margin: 0 0 16px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.mp audio { display: none; }
.mp-play {
  width: 40px; height: 40px; flex: none; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); border: 0;
}
.mp-play:hover { background: var(--accent-hover); }
.mp-play svg { width: 18px; height: 18px; fill: currentColor; }
.mp-time { font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 92px; text-align: center; }
.mp-seek { flex: 1 1 160px; min-width: 80px; accent-color: var(--accent); height: 24px; }
.mp-rate { width: auto; height: 32px; font-size: 13px; padding: 0 26px 0 10px; flex: none; }
.mp-msg { flex-basis: 100%; font-size: 13px; color: var(--danger); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mp-msg:empty { display: none; }
.mp-spacer { height: 0; }

/* 手機：固定在底部導覽列上面 */
.mp.mp-docked {
  position: fixed; top: auto; left: 0; right: 0; bottom: var(--mp-bottom, 0px);
  margin: 0; border-radius: 0; border-width: 1px 0 0; z-index: 45;
  padding: 6px 12px; gap: 4px 6px;
}
.mp.mp-docked.no-tabbar { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
.mp.mp-docked .mp-seek { order: -1; flex-basis: 100%; height: 20px; }
.mp.mp-docked .mp-play { width: 36px; height: 36px; }
.mp.mp-docked .btn.sm { padding: 0 8px; }
.mp.mp-docked .mp-time { min-width: 0; margin-left: auto; }
body.has-docked-player .toasts { bottom: calc(var(--mp-bottom, 0px) + var(--mp-h, 0px) + 14px); }

/* ── 逐字稿 ─────────────────────────────── */
.tx-card .card-body { display: flex; flex-direction: column; gap: 10px; }
.tx-hint { font-size: 13px; }
.speakers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.speakers:empty { display: none; }
button.spk-chip { cursor: pointer; font: inherit; font-size: 12px; }
button.spk-chip:hover { border-color: var(--border-strong); }
.tx-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tx-count { font-size: 13px; }
.tx-lines {
  max-height: min(62vh, 640px); overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  padding: 4px 0; outline: none;
}
.tx-line {
  display: flex; gap: 10px; align-items: baseline;
  padding: 5px 12px 5px 9px; border-left: 3px solid transparent;
  line-height: 1.7; font-size: 15px;
}
.tx-line.is-current { background: var(--accent-soft); border-left-color: var(--accent); }
.tx-line.edited { border-left-color: var(--warn); }
.tx-line.edited.is-current { border-left-color: var(--accent); }
.tx-time {
  flex: none; width: 58px; text-align: right;
  font-family: var(--font-mono); font-size: 12px; color: var(--faint);
  background: none; border: 0; padding: 0; white-space: nowrap;
}
.tx-time.none { visibility: hidden; }
button.tx-time { cursor: pointer; color: var(--accent); border-radius: 4px; }
button.tx-time:hover { text-decoration: underline; }
.tx-line.is-current .tx-time { color: var(--accent); font-weight: 600; }
.tx-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tx-speaker { font-weight: 600; margin-right: 6px; font-size: 13px; }
.tx-speaker::after { content: "："; }
.spk-0 { color: var(--accent); }
.spk-1 { color: var(--info); }
.spk-2 { color: var(--ok); }
.spk-3 { color: var(--warn); }
.tx-text { color: var(--text); white-space: pre-wrap; }
.tx-text[contenteditable] { border-radius: 4px; padding: 0 2px; margin: 0 -2px; cursor: text; }
.tx-text[contenteditable]:hover { background: var(--surface-2); }
.tx-text[contenteditable]:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--surface); }

/* 選字 → 加入常聽錯的字 */
.sel-pill {
  position: fixed; z-index: 70; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; border: 0;
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); white-space: nowrap;
}

/* 409 時沒存進去的內容 */
.lost-draft { width: 100%; margin: 8px 0; font-size: 13px; resize: vertical; height: auto; }

/* 帳房：詞彙表 */
.gl-wrong { text-decoration: line-through; color: var(--muted); }
.gl-right { color: var(--ok); }

@media (max-width: 860px) {
  .tx-lines { max-height: 56vh; }
  .tx-line { gap: 8px; padding: 6px 10px 6px 7px; font-size: 15px; }
  .tx-time { width: 44px; }
}
@media (max-width: 420px) {
  .mp.mp-docked .btn.sm { font-size: 12px; }
  .todo-add .input + .select + .input { flex: 1 1 140px; }
}
