/* ห้องประชุมภายนอก V114 — โทนมืด + โต๊ะไม้ (สีเดิมจาก app.css V95) */
:root {
  --bg: #0F1216; --bg-2: #141920; --panel: #171C23; --panel-2: #1D232C; --line: #2A313B;
  --text: #ECE6DC; --muted: #9AA2AC; --gold: #E8A33D; --gold-soft: rgba(232,163,61,.14);
  --warn: #F2B35B; --danger: #F07167; --ok: #6FCF97; --radius: 14px;
  --font: "IBM Plex Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55; }
button, input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.wide { width: 100%; }

.btn { min-height: 38px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover:not(:disabled) { border-color: #46505d; background: #232a34; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { min-height: 32px; padding: 3px 10px; font-size: .85rem; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1A1306; font-weight: 600; }
.btn-gold:hover:not(:disabled) { background: #F0B254; border-color: #F0B254; }
.btn-gold-soft { background: var(--gold-soft); border-color: var(--gold); color: #F3C276; font-weight: 600; }
.btn-outline-gold { border-color: rgba(232,163,61,.7); color: #F3C276; background: transparent; }
.icon-btn { background: transparent; border: 1px solid transparent; border-radius: 8px; min-width: 34px; min-height: 34px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { border-color: var(--line); color: var(--text); }
.icon-btn.small { min-width: 26px; min-height: 26px; }
.chip { min-height: 30px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.chip.on { background: var(--gold-soft); border-color: var(--gold); color: #F3C276; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

/* ล็อกอิน */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 30%, #1F2228, var(--bg) 70%); }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px 22px; display: grid; gap: 12px; text-align: center; }
.login-card h1 { margin: 0; font-size: 1.25rem; }
.login-card p { margin: 0; }
.login-icon { font-size: 2rem; }
.login-card input { min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: #0F1318; padding: 8px 12px; font-size: 16px; }
.login-card input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.login-msg { min-height: 1.4em; color: #F7A39C; font-size: .9rem; }

/* โครงหน้าคอม */
.mtop, .mtabs, .side-head, .scrim, .mseats { display: none; }
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; max-width: 1180px; margin: 0 auto; padding: 20px 20px 60px; }
.side { display: grid; gap: 12px; align-content: start; position: sticky; top: 20px; }
.main { display: grid; gap: 14px; min-width: 0; }
.fold summary { list-style: none; cursor: pointer; padding: 10px 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "⌄"; color: var(--muted); }
.fold[open] summary::after { content: "⌃"; }
.fold-body { padding: 0 14px 14px; display: grid; gap: 8px; }
.fold-body h3 { margin: 10px 0 2px; font-size: .86rem; color: #CFC8BC; }
.seat-list { display: grid; gap: 6px; }
.seat-row { display: flex; align-items: center; gap: 8px; font-size: .86rem; }
.seat-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.seat-row .nm { flex: 1; min-width: 0; }
.seat-row .nm small { display: block; color: var(--muted); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .88rem; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 40px; height: 22px; border-radius: 999px; background: #2B323C; position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #CFC8BC; transition: transform .15s; }
.switch-row input:checked + .switch { background: var(--gold); }
.switch-row input:checked + .switch::after { transform: translateX(18px); background: #1A1306; }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--gold); outline-offset: 2px; }
.speed { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.past-list { display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
.past { text-align: left; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: .85rem; }
.past:hover { border-color: var(--line); background: var(--panel-2); }
.past.on { border-color: var(--gold); background: var(--gold-soft); }
.past small { display: block; color: var(--muted); font-size: .74rem; }

/* ข.1 การ์ดประธานพูด */
.composer { padding: 12px 14px; border-color: rgba(232,163,61,.55); box-shadow: 0 0 0 1px rgba(232,163,61,.08) inset; }
.composer-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; color: #F3C276; margin-bottom: 8px; }
.composer-head .topic { color: var(--muted); font-weight: 500; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--gold-soft); border: 1px solid var(--gold); color: #F3C276; font-size: .84rem; }
.input-wrap { position: relative; display: flex; gap: 8px; align-items: flex-end; }
.input-wrap textarea { flex: 1; min-height: 46px; max-height: 180px; resize: none; background: #0F1318; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; line-height: 1.45; }
.input-wrap textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.send-btn { width: 46px; height: 46px; border-radius: 10px; border: 1px solid var(--gold); background: var(--gold); color: #1A1306; font-size: 1.1rem; cursor: pointer; flex: none; }
.send-btn:disabled { opacity: .45; cursor: not-allowed; }
.mention { position: absolute; left: 0; top: calc(100% + 6px); min-width: 220px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.mention button { display: flex; width: 100%; gap: 8px; align-items: center; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.mention button.on, .mention button:hover { background: var(--gold-soft); }
.mention .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.cmds { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.secret-warn { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(240,113,103,.12); border: 1px solid rgba(240,113,103,.6); color: #F7A39C; font-weight: 600; font-size: .88rem; }

/* ข.3 โต๊ะ */
.stage { padding: 14px 12px 12px; background: radial-gradient(ellipse 60% 70% at 50% 45%, #1F2228 0%, #13161B 60%, #0F1216 100%); overflow: hidden; }
.table-wrap { position: relative; width: min(100%, 860px); height: 420px; margin: 0 auto; }
.table { position: absolute; left: 15%; right: 15%; top: 27%; bottom: 13%; border-radius: 50%;
  background: radial-gradient(ellipse at 45% 35%, #8A5E38 0%, #6B4527 45%, #4A2E18 100%);
  box-shadow: 0 20px 50px rgba(0,0,0,.55), inset 0 0 0 6px #3A2414, inset 0 2px 0 8px rgba(255,214,160,.06); }
.table-inner { position: absolute; inset: 9%; border-radius: 50%; border: 1px solid rgba(255,214,160,.12); }
.seat { position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 3px; width: 110px; z-index: 3; }
.avatar { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1rem; background: #1B2027; border: 3px solid var(--c, #888); color: var(--c, #ddd); cursor: pointer; transition: box-shadow .2s, transform .2s; padding: 0; }
.avatar:hover { transform: scale(1.05); }
.avatar:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.seat.reading .avatar { box-shadow: 0 0 0 4px #0F1216, 0 0 0 7px var(--gold), 0 0 26px rgba(232,163,61,.5); }
.seat.off .avatar { opacity: .35; }
.seat .sname { font-size: .78rem; color: #CFC8BC; text-align: center; line-height: 1.2; }
.seat .light { font-size: .74rem; min-height: 1.2em; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.light .g { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.light.new { color: #9FE0B9; font-weight: 600; }
.light.skip { color: var(--warn); }
.seat.boss .avatar { width: 64px; height: 64px; border-color: var(--gold); color: var(--gold); background: radial-gradient(circle at 50% 35%, #2A2214, #16130D); box-shadow: 0 0 0 5px rgba(232,163,61,.14), 0 0 22px rgba(232,163,61,.3); cursor: default; font-size: .86rem; }
.seat.boss .avatar:hover { transform: none; }
/* ข.6 ฟองคำพูด */
.speech { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 170px; padding: 4px 10px; border-radius: 12px; background: #F4EFE6; color: #1d1a16; font-size: .74rem; line-height: 1.35; box-shadow: 0 4px 12px rgba(0,0,0,.35); cursor: pointer; }
.speech::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #F4EFE6; }
.speech.think { background: #2A313B; color: #CFC8BC; }
.speech.think::after { border-top-color: #2A313B; }
.speech.skip { background: rgba(242,179,91,.9); }
.speech.skip::after { border-top-color: rgba(242,179,91,.9); }
.dots::after { content: "…"; animation: dots 1.2s steps(3) infinite; display: inline-block; overflow: hidden; vertical-align: bottom; width: 0; }
@keyframes dots { to { width: 1.1em; } }
/* ข.3 กล่องข้อความกลางโต๊ะ */
.center { position: absolute; left: 50%; top: 59%; transform: translate(-50%, -50%); width: min(62%, 480px); max-height: 230px; display: flex; flex-direction: column; background: #FBF7F0; color: #1d1a16; border-radius: 12px; border: 2px solid var(--c, var(--gold)); box-shadow: 0 14px 36px rgba(0,0,0,.5); z-index: 5; }
.center-hint { position: absolute; left: 50%; top: 59%; transform: translate(-50%, -50%); color: rgba(255,232,200,.55); font-size: .85rem; pointer-events: none; text-align: center; }
.msgbox-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px 12px; }
.msgbox-head b { flex: 1; min-width: 0; font-size: .92rem; }
.msgbox-head .tag { font-size: .7rem; padding: 0 6px; border-radius: 999px; border: 1px solid #c9bfae; color: #6a5f4f; white-space: nowrap; }
.msgbox-head .nav { background: transparent; border: 1px solid transparent; border-radius: 6px; width: 30px; height: 30px; cursor: pointer; color: #5b5145; font-size: 1rem; }
.msgbox-head .nav:hover { border-color: #d8cdbb; background: #f1e9dc; }
.msgbox-body { padding: 2px 12px 8px; overflow-y: auto; flex: 1; min-height: 40px; font-size: .9rem; line-height: 1.55; overscroll-behavior: contain; }
.msgbox-acts { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 10px 10px; border-top: 1px solid #ece3d4; }
.msgbox-acts button { min-height: 30px; padding: 2px 10px; border-radius: 8px; border: 1px solid #d8cdbb; background: #fff; color: #2b251e; cursor: pointer; font-size: .8rem; }
.msgbox-acts button:hover { background: #f6efe3; }
.msgbox-acts button.on { background: #FDE7BD; border-color: var(--gold); }
.status { text-align: center; font-size: .84rem; color: var(--muted); padding-top: 6px; }
.status b { color: #F3C276; }
.md b { font-weight: 700; }
.md .h { display: block; font-weight: 700; margin-top: 6px; }

/* สรุป + บทสนทนา */
.fold-card { padding: 12px 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.summary h4 { margin: 12px 0 4px; font-size: .9rem; color: #F3C276; }
.summary ol, .summary ul { margin: 0; padding-left: 22px; }
.summary li { margin: 3px 0; }
.decide { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.decide li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.decide .acts { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.decide .acts input { flex: 1; min-width: 160px; min-height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #0F1318; padding: 4px 8px; font-size: 16px; }
.decide .done { margin-top: 4px; font-size: .84rem; color: #9FE0B9; }
.talk { display: grid; gap: 8px; max-height: 70vh; overflow: auto; }
.msg { padding: 8px 12px; border-radius: 10px; background: var(--panel-2); border-left: 3px solid var(--c, var(--line)); }
.msg .who { font-size: .82rem; font-weight: 600; color: var(--c, #CFC8BC); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.msg .who small { color: var(--muted); font-weight: 400; }
.msg .text { margin-top: 3px; white-space: normal; overflow-wrap: anywhere; }
.msg.boss { background: rgba(232,163,61,.09); --c: var(--gold); }
.msg.boss .text { color: #F6D9A8; }
.msg.skip { background: rgba(242,179,91,.06); --c: var(--warn); }
.msg.round-h { background: transparent; border: 0; padding: 4px 0 0; color: #F3C276; font-weight: 600; font-size: .86rem; }
.tag { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: .72rem; font-weight: 600; border: 1px solid var(--line); color: #CFC8BC; }
.tag.r1 { border-color: rgba(110,168,254,.55); color: #A9C9FF; }
.tag.r2 { border-color: rgba(240,147,91,.6); color: #F6B48B; }
.tag.one { border-color: rgba(232,163,61,.6); color: #F3C276; }
.tag.pin { border-color: var(--gold); color: var(--gold); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #262D37; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; max-width: min(92vw, 560px); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s; font-size: .9rem; }
.toast.show { opacity: 1; }
.toast.err { border-color: rgba(240,113,103,.7); color: #F7A39C; }

/* ===== มือถือ (ข.13) ===== */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .mtop { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: linear-gradient(180deg, #131820, #0F1216); border-bottom: 1px solid var(--line); }
  .mtitle { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mprog { font-size: .8rem; color: #F3C276; white-space: nowrap; }
  .mtabs { display: flex; position: sticky; top: 51px; z-index: 19; background: var(--bg); border-bottom: 1px solid var(--line); }
  .mtabs button { flex: 1; min-height: 42px; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; }
  .mtabs button.on { color: #F3C276; border-bottom-color: var(--gold); font-weight: 600; }
  .layout { display: block; padding: 12px 16px 190px; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 330px); z-index: 60; background: var(--bg-2); border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; transform: translateX(-102%); transition: transform .2s; display: flex; flex-direction: column; gap: 12px; }
  .side.open { transform: none; }
  .side-head { display: flex; justify-content: space-between; align-items: center; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 55; }
  .main { display: block; }
  .main > [data-pane] { display: none; }
  body.tab-table .main > [data-pane="table"], body.tab-sum .main > [data-pane="sum"], body.tab-talk .main > [data-pane="talk"] { display: block; }
  /* ช่องพิมพ์ติดล่างจอ ; ปุ่มคำสั่งเลื่อนซ้ายขวา */
  .composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; border-radius: 14px 14px 0 0; border-left: 0; border-right: 0; border-bottom: 0; padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: var(--panel); }
  .composer-head { display: none; }
  .cmds { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 8px; padding: 0 12px 2px; order: -1; scrollbar-width: none; }
  .cmds::-webkit-scrollbar { display: none; }
  .composer { display: flex; flex-direction: column; }
  .cmds .btn { min-height: 34px; padding: 4px 12px; font-size: .86rem; }
  .input-wrap textarea { min-height: 44px; max-height: 120px; }
  .mention { top: auto; bottom: calc(100% + 6px); }
  .send-btn { width: 44px; height: 44px; }
  /* แท็บโต๊ะ = แถวรูปที่นั่ง */
  .stage { padding: 12px 8px; background: var(--panel); }
  .table-wrap { display: none; }
  .mseats { display: flex; gap: 6px; overflow-x: auto; padding: 46px 4px 6px; justify-content: space-around; }
  .mseats .seat { position: relative; transform: none; width: 96px; flex: none; }
  .mseats .speech { max-width: 120px; font-size: .72rem; }
  .status { padding-top: 10px; }
  .talk { max-height: none; }
  .toast { bottom: 150px; }
}
/* ข้อความเต็มจอ (มือถือ) */
.sheet { position: fixed; inset: 0; z-index: 80; background: #FBF7F0; color: #1d1a16; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); border-top: 4px solid var(--c, var(--gold)); }
.sheet .msgbox-head { padding: 10px 10px 6px 14px; border-bottom: 1px solid #ece3d4; }
.sheet .msgbox-head .nav { width: 40px; height: 40px; font-size: 1.15rem; }
.sheet .msgbox-body { padding: 12px 16px; font-size: 1rem; }
.sheet .msgbox-acts { padding: 10px 12px 14px; }
.sheet .msgbox-acts button { min-height: 40px; padding: 4px 12px; font-size: .9rem; }
.sheet .swipe-hint { text-align: center; font-size: .74rem; color: #8b8172; padding: 0 0 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
