:root {
    --green: #0a8ad8;
    --green-dark: #0870b3;
    --bubble-me: #a6dbff;
    --bubble-other: #ffffff;
    --chat-bg: #8ca8d2;
    --rail: #1f2a37;
    --rail-icon: #8b98a9;
    --text: #1e2329;
    --muted: #8a9099;
    --line: #e9ecef;
    --hover: #f3f5f7;
    --danger: #f04c4c;
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);
    background: #fff;
    font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; font-size: 14px; }
svg { width: 22px; height: 22px; fill: currentColor; }
[hidden] { display: none !important; }

/* ---------- Auth ---------- */
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #0a8ad8 0%, #0870b3 100%);
    padding: 16px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px;
    box-shadow: 0 20px 50px rgba(0,0,0,.18);
}
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo h1 { margin: 12px 0 4px; font-size: 22px; }
.auth-logo p { margin: 0; color: var(--muted); }
.auth-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.auth-card input {
    width: 100%; padding: 11px 12px; border: 1px solid var(--line);
    border-radius: 8px; outline: none; background: #f7f8fa;
}
.auth-card input:focus { border-color: var(--green); background: #fff; }
.auth-errors ul { margin: 0; padding: 10px 14px 10px 28px; background: #fff1f1; color: #c33; border-radius: 8px; }
.auth-errors.validation-summary-valid { display: none; }
.block-install { display: block; width: 100%; margin-top: 12px; padding: 10px; }
.auth-card label.auth-check { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 14px; color: #444; cursor: pointer; }
.auth-card .auth-check input { width: 18px; height: 18px; padding: 0; accent-color: var(--green); margin: 0; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid #dadce0; border-radius: 8px;
    background: #fff; color: #3c4043; font-weight: 600; font-size: 14.5px; text-decoration: none; box-sizing: border-box; }
.btn-google:hover { background: #f8faff; border-color: #c6d4ee; }
.auth-switch { text-align: center; margin-top: 16px; color: var(--muted); }
.auth-switch a { color: var(--green-dark); font-weight: 600; text-decoration: none; }

.logo-bubble {
    display: inline-grid; place-items: center;
    width: 64px; height: 56px; border-radius: 18px;
    background: var(--green); color: #fff; font-weight: 700; font-size: 22px;
    position: relative;
}
.logo-bubble::after {
    content: ""; position: absolute; bottom: -8px; left: 14px;
    border: 8px solid transparent; border-top-color: var(--green); border-left-color: var(--green);
}
.logo-bubble.big { width: 96px; height: 84px; font-size: 32px; border-radius: 26px; }

.btn-primary {
    display: inline-block; border: 0; background: var(--green); color: #fff;
    padding: 11px 18px; border-radius: 8px; font-weight: 600; font-size: 15px; text-decoration: none; text-align: center;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-primary.block { display: block; width: 100%; margin-top: 20px; }
.btn-light {
    border: 1px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 8px; font-size: 13px;
}
.btn-light:hover { background: var(--hover); }
.btn-danger { border: 0; background: var(--danger); color: #fff; padding: 9px 16px; border-radius: 8px; }

/* ---------- App layout ---------- */
.app-body { overflow: hidden; }
.app { display: flex; height: 100vh; height: 100dvh; }

.rail {
    width: 64px; background: var(--rail); display: flex; flex-direction: column; align-items: center;
    padding: 14px 0; gap: 6px; flex-shrink: 0;
}
.rail form { margin: 0; }
.rail-spacer { flex: 1; }
.rail-btn, .rail-avatar {
    position: relative; width: 44px; height: 44px; border: 0; border-radius: 12px;
    background: transparent; color: var(--rail-icon); display: grid; place-items: center;
}
.rail-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail-btn.active { color: var(--green); }
.rail-avatar { margin-bottom: 10px; padding: 0; }
.badge {
    position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; font-weight: 600;
}

.list-pane {
    width: 320px; border-right: 1px solid var(--line); display: flex; flex-direction: column; flex-shrink: 0; background: #fff;
}
.list-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.list-header h2 { margin: 0; font-size: 20px; }
.search-box {
    margin: 4px 16px 10px; display: flex; align-items: center; gap: 6px; background: #f1f3f5; border-radius: 8px; padding: 0 10px;
}
.search-box svg { width: 18px; height: 18px; fill: var(--muted); flex-shrink: 0; }
.search-box input { flex: 1; border: 0; background: transparent; padding: 9px 0; outline: none; }
.list-body { flex: 1; overflow-y: auto; }
.section-label { padding: 12px 16px 6px; font-size: 12px; color: var(--muted); }

.item-list { list-style: none; margin: 0; padding: 0; }
.item {
    display: flex; align-items: center; gap: 12px; padding: 9px 16px; cursor: pointer;
}
.item:hover { background: var(--hover); }
.item.active { background: #eaf5fd; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11px; color: var(--muted); }
.unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--green); color: #fff; font-size: 11px; line-height: 20px; text-align: center; font-weight: 600; }
.me-card { display: flex; align-items: center; gap: 12px; padding: 10px 16px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.me-card .item-name { font-size: 16px; }

.avatar {
    position: relative; flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 17px; background: #9aa5b1;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.avatar.lg { width: 96px; height: 96px; font-size: 36px; }
.avatar.group svg { width: 24px; height: 24px; }
.avatar .dot {
    position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%;
    background: var(--green); border: 2px solid #fff;
}

.icon-btn {
    border: 0; background: transparent; color: #5b6470; width: 38px; height: 38px; border-radius: 10px;
    display: inline-grid; place-items: center; flex-shrink: 0; cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* ---------- Chat pane ---------- */
.chat-pane { flex: 1; min-width: 0; position: relative; background: #f7f8fa; }
.empty-state { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 14px; }
.chat { height: 100%; display: flex; flex-direction: column; background: var(--chat-bg); position: relative; }
.chat-header {
    display: flex; align-items: center; gap: 4px; padding: 10px 12px 10px 18px; background: #fff; border-bottom: 1px solid var(--line);
}
.chat-title { flex: 1; min-width: 0; }
.chat-title .name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title .sub { font-size: 12px; color: var(--muted); }
.back-btn { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 16px 18px 8px; display: flex; flex-direction: column; gap: 6px; }
.date-sep { align-self: center; margin: 10px 0 4px; padding: 3px 12px; border-radius: 12px; background: rgba(0,0,0,.18); color: #fff; font-size: 12px; }
.sys-msg { align-self: center; padding: 4px 14px; border-radius: 12px; background: rgba(0,0,0,.18); color: #fff; font-size: 12px; text-align: center; max-width: 80%; }

.msg { display: flex; align-items: flex-end; gap: 6px; max-width: 78%; }
.msg.other { align-self: flex-start; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .avatar { align-self: flex-start; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg-col { display: flex; flex-direction: column; min-width: 0; }
.msg.me .msg-col { align-items: flex-end; }
.sender { font-size: 12px; color: #fff; margin: 0 0 3px 4px; text-shadow: 0 1px 1px rgba(0,0,0,.15); }
.msg.cont .sender { display: none; }
.bubble-row { display: flex; align-items: flex-end; gap: 6px; }
.msg.me .bubble-row { flex-direction: row-reverse; }
.bubble {
    padding: 8px 13px; border-radius: var(--radius); background: var(--bubble-other); word-wrap: break-word;
    overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.45; position: relative; max-width: 100%;
}
.msg.me .bubble { background: var(--bubble-me); }
.msg.other:not(.cont) .bubble { border-top-left-radius: 4px; }
.msg.me:not(.cont) .bubble { border-top-right-radius: 4px; }
.bubble a { color: #0b63ce; }
.meta { display: flex; flex-direction: column; font-size: 10.5px; color: rgba(255,255,255,.95); white-space: nowrap; line-height: 1.3; }
.msg.me .meta { align-items: flex-end; }
.read-label { color: #fff; }

.bubble.sticker { background: transparent !important; padding: 0; font-size: 84px; line-height: 1.1; }
.bubble.image { padding: 0; background: transparent !important; }
.bubble.image img { display: block; max-width: 260px; max-height: 320px; border-radius: 14px; cursor: zoom-in; background: #ddd; }
.bubble.file { display: flex; align-items: center; gap: 10px; min-width: 200px; text-decoration: none; color: var(--text); }
.bubble.file .file-icon { width: 40px; height: 40px; border-radius: 10px; background: #eef1f5; display: grid; place-items: center; color: #5b6470; flex-shrink: 0; }
.msg.me .bubble.file .file-icon { background: rgba(255,255,255,.5); }
.bubble.file .file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.bubble.file .file-size { font-size: 12px; color: var(--muted); }
.bubble.call { display: flex; align-items: center; gap: 10px; }
.bubble.call .call-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #eef1f5; }
.bubble.call.missed .call-ico { color: var(--danger); }
.bubble.call small { display: block; color: var(--muted); font-size: 12px; }

.typing { padding: 0 20px 6px; color: #fff; font-size: 12px; }
.load-more { align-self: center; color: #fff; font-size: 12px; opacity: .8; padding: 4px; }

.composer { display: flex; align-items: flex-end; gap: 4px; padding: 8px 10px; background: #fff; border-top: 1px solid var(--line); }
.composer textarea {
    flex: 1; resize: none; border: 0; outline: none; padding: 9px 10px; max-height: 140px; line-height: 1.4;
    background: #f1f3f5; border-radius: 18px;
}
.send-btn { border: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; }
.send-btn svg { width: 18px; height: 18px; }
.send-btn:disabled { background: #c9ced4; }

.sticker-panel {
    background: #fff; border-top: 1px solid var(--line); height: 220px; overflow-y: auto;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; padding: 10px;
}
.sticker-panel button { border: 0; background: transparent; font-size: 42px; border-radius: 12px; padding: 4px; }
.sticker-panel button:hover { background: var(--hover); transform: scale(1.08); }

.drop-hint {
    position: absolute; inset: 0; background: rgba(10,138,216,.85); color: #fff; font-size: 22px; font-weight: 700;
    display: grid; place-items: center; z-index: 5; pointer-events: none;
}

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: 100%; max-width: 420px; max-height: 86vh; background: #fff; border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; font-size: 17px; }
.modal header .icon-btn { font-size: 24px; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-body .field { margin-bottom: 12px; }
.modal-body .field > label:not(.radio-inline) { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.modal-body input[type=text], .modal-body textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; outline: none;
}
.modal-body input[type=text]:focus { border-color: var(--green); }
.modal-body .item { padding: 8px 4px; }
.modal-body .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.profile-view { text-align: center; }
.profile-view .avatar { margin: 6px auto 12px; }
.profile-view h2 { margin: 0; font-size: 20px; }
.profile-view p { color: var(--muted); margin: 6px 0 18px; }
.profile-actions { display: flex; justify-content: center; gap: 22px; }
.profile-actions button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text); font-size: 12px; }
.profile-actions button span { width: 48px; height: 48px; border-radius: 50%; background: #eef1f5; display: grid; place-items: center; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 7px 4px; cursor: pointer; }
.check-item input { width: 18px; height: 18px; accent-color: var(--green); }
.muted { color: var(--muted); }

/* ---------- Calls ---------- */
.incoming { position: fixed; inset: 0; z-index: 70; background: rgba(15,23,32,.75); display: grid; place-items: center; }
.incoming-card { text-align: center; color: #fff; }
.incoming-name { font-size: 24px; font-weight: 700; margin-top: 16px; }
.incoming-type { opacity: .8; margin-top: 4px; }
.pulse-avatar { display: inline-block; border-radius: 50%; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(10,138,216,.6); } 70% { box-shadow: 0 0 0 28px rgba(10,138,216,0); } 100% { box-shadow: 0 0 0 0 rgba(10,138,216,0); } }
.call-actions { display: flex; gap: 60px; justify-content: center; margin-top: 40px; }
.call-btn { width: 62px; height: 62px; border-radius: 50%; border: 0; color: #fff; display: grid; place-items: center; }
.call-btn svg { width: 28px; height: 28px; }
.call-btn.accept { background: var(--green); }
.call-btn.reject { background: var(--danger); }
.call-btn.ghost { background: rgba(255,255,255,.18); }
.call-btn.ghost.off { background: #fff; color: #222; }

.call-screen { position: fixed; inset: 0; z-index: 60; background: #111820; color: #fff; display: flex; flex-direction: column; }
.call-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#remoteVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#localVideo {
    position: absolute; right: 18px; top: 18px; width: 200px; max-width: 32vw; aspect-ratio: 4/3; object-fit: cover;
    border-radius: 12px; background: #222; box-shadow: 0 6px 20px rgba(0,0,0,.4); transform: scaleX(-1);
}
#localVideo.screen { transform: none; }
.call-info { position: absolute; top: 18%; left: 0; right: 0; text-align: center; }
.call-peer { font-size: 26px; font-weight: 700; margin-top: 16px; }
.call-status { opacity: .8; margin-top: 6px; }
.call-screen.has-video .call-info { top: 24px; left: 24px; right: auto; text-align: left; }
.call-screen.has-video .call-info .pulse-avatar { display: none; }
.call-screen.has-video .call-peer { font-size: 18px; margin: 0; text-shadow: 0 1px 4px #000; }
.call-controls {
    flex-shrink: 0; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 16px;
    padding: 12px 12px calc(14px + env(safe-area-inset-bottom)); background: #0b1118; border-top: 1px solid rgba(255,255,255,.06);
}
.call-controls .call-btn { width: 52px; height: 52px; }
.call-controls .call-btn svg { width: 24px; height: 24px; }
#localVideo { cursor: pointer; transition: opacity .2s, width .2s; }
#localVideo.mini { width: 72px; opacity: .55; }
/* อีกฝ่ายแชร์หน้าจอ: ภาพเราย่อเล็กไว้มุมล่างขวา ไม่บังเนื้อหา, ชื่อ/เวลาย่อ */
.call-screen.peer-sharing #localVideo { top: auto; bottom: 12px; right: 12px; width: 150px; }
.call-screen.peer-sharing #localVideo.mini { width: 60px; }
.call-screen.peer-sharing .call-info { top: 8px; left: 10px; opacity: .8; }
.call-screen.peer-sharing .call-peer { font-size: 13px; }
.call-screen.peer-sharing .call-status { font-size: 12px; }
/* เรากำลังแชร์หน้าจอ: แสดงคำแนะนำ */
.share-hint {
    position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2; max-width: calc(100% - 32px);
    background: rgba(10,138,216,.92); color: #fff; padding: 8px 16px; border-radius: 16px; font-size: 13px; text-align: center;
}

.toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: rgba(20,26,33,.92); color: #fff;
    padding: 10px 18px; border-radius: 20px; z-index: 90; font-size: 13.5px; max-width: 90vw;
}

/* ---------- Call recording ---------- */
.rec-badges { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 2; }
.rec-badge { background: rgba(240,76,76,.92); color: #fff; padding: 5px 14px; border-radius: 16px; font-size: 13px; font-weight: 600; animation: blink 1.4s infinite; }
.rec-badge.peer { background: rgba(0,0,0,.6); color: #ff8a8a; animation: none; }
@keyframes blink { 50% { opacity: .55; } }
#btnRecord svg { fill: #ff5b5b; }
#btnRecord.off { background: #ff5b5b; }
#btnRecord.off svg { fill: #fff; }
.rec-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.rec-item:last-child { border-bottom: 0; }
.rec-ico { width: 42px; height: 42px; border-radius: 10px; background: #eaf5fd; color: var(--green-dark); display: grid; place-items: center; flex-shrink: 0; font-size: 20px; }
.rec-actions { display: flex; gap: 4px; }
.rec-actions .icon-btn.del:hover { color: var(--danger); background: #fff1f1; }
.rec-player video, .rec-player audio { width: 100%; border-radius: 10px; background: #000; max-height: 60vh; }
.modal.wide { max-width: 760px; }

/* ---------- Remote control ---------- */
.rec-badge.remote { background: rgba(255,153,0,.95); animation: none; display: flex; align-items: center; gap: 8px; }
.rec-badge.remote button { border: 0; background: #fff; color: #c25e00; border-radius: 10px; padding: 2px 10px; font-weight: 700; }
#btnControl.off { background: var(--green); }

.remote-bar {
    position: absolute; top: 8px; right: 8px; z-index: 3;
    display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-radius: 22px;
    background: rgba(20,26,33,.88); box-shadow: 0 4px 16px rgba(0,0,0,.4); max-width: calc(100vw - 300px);
}
.remote-title { white-space: nowrap; font-size: 13px; }
.remote-bar { opacity: .55; transition: opacity .2s; }
.remote-bar:hover, .remote-bar:focus-within { opacity: 1; }
.remote-bar input { width: 320px; max-width: 40vw; border: 0; border-radius: 14px; padding: 6px 12px; outline: none; }
.remote-bar button { border: 0; background: var(--danger); color: #fff; border-radius: 14px; padding: 6px 14px; font-weight: 600; white-space: nowrap; }

.call-screen.controlling #remoteVideo { cursor: crosshair; }
.call-screen.controlling #localVideo, .call-screen.controlling .call-info { display: none; }
.call-screen.controlling .call-controls { padding-top: 6px; padding-bottom: 8px; gap: 10px; }
.call-screen.controlling .call-controls .call-btn { width: 40px; height: 40px; }
.call-screen.controlling .call-controls .call-btn svg { width: 19px; height: 19px; }

.remote-prompt {
    position: absolute; inset: 0; z-index: 5; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px;
}
.remote-card { background: #fff; color: var(--text); border-radius: 16px; padding: 22px; width: 100%; max-width: 420px; }
.remote-card h3 { margin: 0 0 6px; font-size: 18px; }
.remote-card p { margin: 6px 0; color: #444; line-height: 1.5; }
.remote-card .warn { background: #fff6e5; color: #8a5300; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.remote-card .ok { background: #eaf5fd; color: #075e96; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.remote-card .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.remote-card a { color: #0b63ce; }
.remote-card .warn code { background: #fff; border: 1px solid #f0d9a8; border-radius: 6px; padding: 1px 6px; font-size: 12.5px; user-select: all; }
.agent-fields { margin: 8px 0; border-collapse: collapse; }
.agent-fields td { padding: 2px 10px 2px 0; vertical-align: top; }
.agent-cmd { margin: 8px 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.agent-cmd code { word-break: break-all; }
.agent-cmd .btn-light { padding: 3px 10px; font-size: 12px; }

/* ---------- API keys ---------- */
.key-item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.key-item:last-child { border-bottom: 0; }
.key-new { background: #eaf5fd; border-radius: 10px; padding: 12px; margin: 10px 0; }
.key-new .key-value { display: flex; gap: 6px; margin: 8px 0; }
.key-new input { flex: 1; font-family: Consolas, monospace; font-size: 13px; }
pre.code { background: #1e2329; color: #d8f5e3; border-radius: 10px; padding: 10px 12px; font-size: 12px; overflow-x: auto; white-space: pre; margin: 6px 0 12px; }
.code-tabs { display: flex; gap: 4px; margin-top: 10px; }
.code-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 8px 8px 0 0; padding: 5px 12px; font-size: 12px; }
.code-tabs button.active { background: #1e2329; color: #fff; border-color: #1e2329; }
.targets { font-size: 12.5px; color: #444; }
.targets code { background: #f1f3f5; border-radius: 5px; padding: 1px 5px; user-select: all; }
.section-title { font-weight: 700; margin: 14px 0 6px; }

.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 14px; overflow-x: auto; }
.tabbar button { border: 0; background: transparent; padding: 9px 12px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabbar button.active { color: var(--text); font-weight: 700; border-bottom-color: var(--green); }
.modal-body input[type=password], .modal-body select.select, .modal-body input[type=file] {
    width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; outline: none; background: #fff; font-family: inherit; font-size: 14px;
}
.key-new input[type=password], .key-new input[type=text] { font-family: Consolas, monospace; font-size: 13px; }
.test-ok { background: #eaf5fd; color: #075e96; border-radius: 8px; padding: 8px 12px; font-weight: 600; margin-top: 12px; }
.test-err { background: #fff1f1; color: #c33; border-radius: 8px; padding: 8px 12px; font-weight: 600; margin-top: 12px; }
.pill { display: inline-block; background: #fff3e0; color: #c25e00; border-radius: 10px; padding: 0 8px; font-size: 11.5px; font-weight: 600; }
.check-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.check-inline input { accent-color: var(--green); width: 16px; height: 16px; }
.admin-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.admin-card { background: #f7f8fa; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.admin-card b { font-size: 22px; }
.admin-card span { font-size: 12px; color: var(--muted); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.admin-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* ---------- Remote Agent panel ---------- */
.agent-dot { position: absolute; right: 6px; bottom: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid var(--rail); }
.agent-status { display: flex; align-items: center; gap: 12px; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.agent-status.on { background: #eaf5fd; color: #075e96; }
.agent-status.off { background: #f4f5f7; color: #555; }
.agent-status .big { font-size: 28px; }
.agent-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.agent-actions a { text-decoration: none; }
.agent-actions a.btn-light { color: var(--text); padding: 11px 16px; font-size: 14px; }
.steps { margin: 6px 0 0; padding-left: 20px; line-height: 1.7; }
.steps li { margin-bottom: 2px; }

/* ---------- Unsend ---------- */
.unsend-btn {
    display: none; border: 0; background: rgba(0,0,0,.35); color: #fff; font-size: 11px; border-radius: 10px;
    padding: 1px 8px; margin-bottom: 3px; cursor: pointer; font-family: inherit;
}
.msg.me:hover .unsend-btn { display: inline-block; }
.unsend-btn:hover { background: var(--danger); }
@media (hover: none) { .unsend-btn { display: inline-block; opacity: .75; } }
.sys-msg.unsent { background: rgba(0,0,0,.12); font-style: italic; }

.sent-item { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.sent-item:last-child { border-bottom: 0; }
.sent-thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #eef1f5; display: grid; place-items: center; font-size: 22px; overflow: hidden; }
.sent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sent-actions { display: flex; gap: 4px; flex-shrink: 0; }
.sent-actions .btn-danger { padding: 6px 12px; font-size: 13px; }
.sent-actions .icon-btn { width: 34px; height: 34px; }

/* ---------- Group call ---------- */
.gc-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: #e6f4fd; color: #075e96; font-size: 13.5px; border-bottom: 1px solid #c3e4f9; }
.gc-banner .btn-primary { padding: 6px 14px; font-size: 13px; }
.gc-screen { position: fixed; inset: 0; z-index: 60; background: #111820; color: #fff; display: flex; flex-direction: column; }
.gc-top { padding: 10px 16px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.muted-light { color: rgba(255,255,255,.65); font-size: 13px; }
.gc-grid { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 0 8px 8px; grid-auto-rows: 1fr; }
.gc-tile { position: relative; background: #1c2633; border-radius: 12px; overflow: hidden; min-height: 0; display: grid; place-items: center; }
.gc-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.gc-tile.screen video, .gc-tile.contain video { object-fit: contain; }
.gc-tile.me video { transform: scaleX(-1); }
.gc-tile.me.screen video { transform: none; }
.gc-tile .gc-ava { display: none; }
.gc-tile.cam-off video { visibility: hidden; }
.gc-tile.cam-off .gc-ava { display: block; }
.gc-name { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55); padding: 3px 10px; border-radius: 10px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.gc-tile.mic-off .gc-name::after { content: "🔇"; }
.gc-tile.connecting::before { content: "กำลังเชื่อมต่อ..."; position: absolute; top: 8px; right: 10px; font-size: 12px; color: rgba(255,255,255,.7); z-index: 1; }
.gc-tile.speaking { box-shadow: 0 0 0 3px var(--green) inset; }

/* ---------- มุมมองการโทร: เต็มจอ / ภาพตัวเอง / ผู้พูดหลัก ---------- */
.call-screen:fullscreen, .gc-screen:fullscreen { width: 100vw; height: 100vh; }
/* 1:1 — ภาพของฉันไว้ด้านข้าง (ไม่ทับภาพอีกฝ่าย) */
.call-screen.self-side #remoteVideo { width: calc(100% - 248px); right: auto; }
.call-screen.self-side #localVideo { top: 8px; bottom: auto; right: 8px; width: 232px; max-width: none; border-radius: 10px; }
.call-screen.self-side #localVideo.mini { width: 232px; opacity: 1; }
/* 1:1 — ซ่อนภาพของฉัน */
.call-screen.self-hidden #localVideo { display: none; }
#btnSelfView.side, #btnSelfView.hidden-self { background: #fff; color: #222; }

/* กลุ่ม — โหมดผู้พูดหลัก: ภาพหลักใหญ่ + แถบผู้เข้าร่วมด้านขวา */
.gc-screen.spotlight .gc-grid { display: block; position: relative; margin: 0 8px 8px; padding: 0; }
.gc-screen.spotlight .gc-tile { position: absolute; transition: top .2s, height .2s; }
.gc-screen.spotlight .gc-tile.main video { object-fit: contain; }
.gc-screen.spotlight.strip-hidden .gc-tile:not(.main) { display: none; }
.gc-tile { cursor: pointer; }
.gc-tile.main { box-shadow: none; }
.gc-tile .pin-hint { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.5); border-radius: 8px; padding: 2px 8px; font-size: 11px; opacity: 0; transition: opacity .2s; z-index: 1; }
.gc-tile:hover .pin-hint { opacity: 1; }
#gcLayout.on, #gcStrip.on { background: #fff; color: #222; }
.call-btn.fs-on { background: #fff; color: #222; }

/* ---------- คอลกลุ่ม: บันทึก + รีโมท ---------- */
.remote-bar.floating { position: fixed; top: 8px; right: 8px; z-index: 66; }
.rec-badge.floating { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 66; }
.gc-screen .remote-prompt { z-index: 5; }
.gc-screen.controlling .gc-tile.main video { cursor: crosshair; object-fit: contain; }
.gc-ctl {
    display: none; position: absolute; right: 8px; bottom: 8px; z-index: 2; border: 0; border-radius: 12px;
    background: var(--green); color: #fff; padding: 5px 12px; font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.gc-tile.screen:not(.me) .gc-ctl { display: block; }
.gc-rec { color: #ff8a8a; font-size: 13px; font-weight: 600; }
.gc-rec.me { color: #fff; background: rgba(240,76,76,.9); border-radius: 10px; padding: 1px 10px; animation: blink 1.4s infinite; }
#gcRecord svg { fill: #ff5b5b; }
#gcRecord.off { background: #ff5b5b; }
#gcRecord.off svg { fill: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .call-controls { gap: 10px; }
    .call-controls .call-btn { width: 44px; height: 44px; }
    .call-controls .call-btn svg { width: 20px; height: 20px; }
    .remote-bar input { display: none; }
    .rail { width: 56px; }
    .list-pane { flex: 1; width: auto; border-right: 0; }
    .chat-pane { display: none; }
    .app.chat-open .list-pane { display: none; }
    .app.chat-open .rail { display: none; }
    .app.chat-open .chat-pane { display: block; }
    .back-btn { display: inline-grid; }
    .chat-header { padding-left: 4px; }
    .msg { max-width: 88%; }
    .bubble.image img { max-width: 200px; }
}

/* ระหว่างโทร: ย้าย toast ขึ้นด้านบน ไม่ให้บังแถบปุ่ม */
body:has(#callScreen:not([hidden])) .toast { bottom: auto; top: 64px; }
.gc-screen.controlling .gc-ctl, .gc-screen.controlling .pin-hint { display: none !important; }
body:has(#gcScreen:not([hidden])) .toast { bottom: auto; top: 64px; }

/* แถบสถานะการเชื่อมต่อ */
.conn-banner {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 95; display: flex; align-items: center; gap: 10px;
    background: #f04c4c; color: #fff; padding: 6px 8px 6px 16px; border-radius: 0 0 12px 12px; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.conn-banner button { border: 0; background: #fff; color: #c33; border-radius: 8px; padding: 3px 10px; font-weight: 600; font-family: inherit; }

/* ---------- ปฏิทินนัดหมาย ---------- */
.cal-screen { position: fixed; inset: 0; z-index: 45; background: #fff; display: flex; flex-direction: column; }
.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 24px; flex-wrap: wrap; }
.cal-head h2 { margin: 0 8px; font-size: 19px; flex: 1; min-width: 160px; }
.cal-head .icon-btn { font-size: 22px; }
.cal-views { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cal-views button { border: 0; background: #fff; padding: 7px 14px; font-size: 13px; }
.cal-views button + button { border-left: 1px solid var(--line); }
.cal-views button.active { background: var(--green); color: #fff; font-weight: 600; }
.cal-screen { background: #f5f7f9; }
.cal-head { background: #f5f7f9; }
.cal-body { flex: 1; min-height: 0; overflow: auto; position: relative; padding: 0 24px 20px; }
/* กรอบปฏิทิน: เว้นจากขอบจอ มุมมน มีเงาบาง ๆ */
.cal-month, .cal-grid { background: #fff; border: 1px solid #e3e7eb; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(16,24,40,.05); }

/* เดือน */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); height: 100%; min-height: 420px; box-sizing: border-box; }
.cal-month > .cal-cell:nth-child(7n) { border-right: 0; }
.cal-month > .cal-cell:nth-last-child(-n+7) { border-bottom: 0; }
.cal-cell { padding: 6px 8px !important; }
.cal-daynum { margin-left: -2px; }
.cal-dow { position: sticky; top: 0; z-index: 2; background: #fafbfc; text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--line); }
.cal-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; overflow: hidden; cursor: pointer; min-width: 0; min-height: 0; }
.cal-cell:hover { background: #f8fbfe; }
.cal-cell.other { background: #fafafa; color: #aaa; }
.cal-cell.drop { background: #e6f4fd; }
.cal-daynum { font-size: 12.5px; font-weight: 600; margin-bottom: 3px; display: inline-block; min-width: 24px; height: 24px; line-height: 24px; text-align: center; border-radius: 12px; }
.cal-cell.today .cal-daynum { background: var(--green); color: #fff; }
.cal-ev {
    display: block; font-size: 12px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; margin-bottom: 2px; color: #fff;
    background: var(--green); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.cal-ev.class { background: #6c5ce7; }
.cal-ev.started { background: #f04c4c; animation: blink 1.6s infinite; }
.cal-ev.canceled { background: #c9ced4; text-decoration: line-through; }
.cal-ev.ended { opacity: .55; }
.cal-ev[draggable="true"] { cursor: grab; }
.cal-more { font-size: 11.5px; color: var(--muted); padding-left: 4px; }

/* สัปดาห์ / วัน */
.cal-grid { display: grid; position: relative; padding-bottom: 8px; overflow: clip; }   /* clip (ไม่ใช่ hidden) หัวคอลัมน์ยัง sticky ได้ */
.cal-colhead { position: sticky; top: 0; z-index: 4; background: #fff; border-bottom: 1px solid var(--line); text-align: center;
    padding: 6px 2px 7px; font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.cal-colhead.corner { cursor: default; }
.cal-colhead .dow { color: var(--muted); font-weight: 500; font-size: 13px; }
.cal-hour.near { visibility: hidden; }
.cal-colhead b { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 15px; font-size: 16px; font-weight: 600; color: var(--text); }
.cal-colhead:not(.corner):hover b { background: #eef3f8; }
.cal-colhead.wkend .dow { color: #e06666; }
.cal-colhead.today .dow { color: var(--green); font-weight: 700; }
.cal-colhead.today b, .cal-colhead.today:hover b { background: var(--green); color: #fff; }
.cal-hours { position: relative; }
.cal-hour { height: var(--hpx, 48px); font-size: 11px; line-height: 1; color: #8a929b; text-align: right; padding-right: 8px; transform: translateY(-6px); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid #e6e9ec; }
.cal-col.wkend { background: #fcfcfd; }
.cal-col.today { background: #f5faff; }
.cal-slot { height: var(--hpx, 48px); border-bottom: 1px solid #eceef1; box-sizing: border-box;
    background-image: linear-gradient(to right, #f1f3f5 50%, transparent 50%); background-size: 6px 1px; background-repeat: repeat-x; background-position: 0 calc(var(--hpx, 48px) / 2); }
.cal-slot.off { background-color: rgba(0,0,0,.018); }
.cal-slot:hover { background-color: #eef6fd; }
.cal-slot.drop { background-color: #e6f4fd; }
.cal-col .cal-ev { position: absolute; left: 2px; right: 2px; white-space: normal; padding: 2px 6px; line-height: 1.25; overflow: hidden; border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,.12); border-left: 3px solid rgba(0,0,0,.18); font-size: 12px; z-index: 1; }
.cal-col .cal-ev:hover { z-index: 3; box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; margin-top: -1px; background: #f04c4c; z-index: 2; pointer-events: none; }
.cal-now.faint { height: 1px; background: rgba(240,76,76,.35); }
.cal-now.faint::before { display: none; }
.cal-nowtag { position: absolute; right: 2px; transform: translateY(-50%); background: #f04c4c; color: #fff; font-size: 10.5px; font-weight: 600; padding: 1px 4px; border-radius: 4px; z-index: 5; font-variant-numeric: tabular-nums; pointer-events: none; }
.cal-grid.m .cal-nowtag { font-size: 9px; padding: 1px 2px; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #f04c4c; }

/* รายละเอียด / ฟอร์ม */
.mt-kind { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 10px; border-radius: 10px; background: #e6f4fd; color: #075e96; }
.mt-kind.class { background: #efeafe; color: #5a46d6; }
.mt-status { display: inline-block; font-size: 12px; padding: 1px 10px; border-radius: 10px; background: #f1f3f5; color: #555; margin-left: 4px; }
.mt-status.started { background: #ffe8e8; color: #c33; }
.mt-row { display: flex; gap: 10px; margin: 8px 0; align-items: flex-start; }
.mt-row > span:first-child { width: 22px; text-align: center; }
.mt-people { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-person { display: flex; align-items: center; gap: 6px; background: #f4f5f7; border-radius: 16px; padding: 2px 10px 2px 2px; font-size: 13px; }
.mt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mt-actions .btn-light, .mt-actions .btn-primary, .mt-actions .btn-danger { font-size: 13px; padding: 8px 14px; }
.mt-form .row2 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.mt-form input[type=date], .mt-form input[type=time], .mt-form select, .mt-form textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font-family: inherit; font-size: 14px; background: #fff;
}
.mt-pick { max-height: 200px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.mt-note { font-size: 12px; color: var(--muted); background: #f7f8fa; border-radius: 8px; padding: 8px 10px; }
.radio-inline { display: inline-flex; align-items: center; gap: 4px; margin-right: 14px; font-size: 14px; }

/* การ์ดเตือนมุมขวาล่าง */
.mt-cards { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.mt-card { width: 340px; max-width: 100%; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 14px 16px; border-left: 5px solid var(--green); }
.mt-card.start { border-left-color: #f04c4c; }
.mt-card h4 { margin: 0 0 4px; font-size: 15px; }
.mt-card p { margin: 0 0 10px; color: #555; font-size: 13px; }
.mt-card .acts { display: flex; gap: 8px; justify-content: flex-end; }
.mt-card .acts button { font-size: 13px; padding: 7px 12px; }
.mt-count { font-weight: 700; color: #f04c4c; }

@media (max-width: 760px) {
    .cal-head h2 { order: -2; flex: 1 1 calc(100% - 50px); margin: 0; font-size: 17px; min-width: 0; }
    .cal-head #calClose { order: -1; }
    .cal-head .btn-light, .cal-head .btn-primary { padding: 6px 10px; font-size: 13px; }
    .cal-head #calNew { margin-left: auto; }
    .cal-head .icon-btn { width: 30px; }
    .cal-month { min-height: 360px; }
    .cal-ev { font-size: 10.5px; padding: 1px 3px; }
    .cal-colhead { font-size: 11px; padding: 4px 0; flex-direction: column; gap: 1px; }
    .cal-colhead b { font-size: 14px; min-width: 26px; height: 26px; }
    .cal-hour { font-size: 10px; padding-right: 4px; }
    .cal-head { gap: 6px; padding: 8px 10px; }
    .cal-body { padding: 0 8px 10px; }
    .cal-month, .cal-grid { border-radius: 10px; }
    .cal-cell { padding: 3px 4px !important; }
    .cal-views button { padding: 6px 10px; }
    .mt-form .row2 { grid-template-columns: 1fr 1fr; }
}

/* ---------- สายเรียกเข้าของนัดหมาย ---------- */
.mt-ring { position: fixed; inset: 0; z-index: 140; background: rgba(10, 20, 30, .72); display: flex; align-items: center; justify-content: center; padding: 16px; animation: mtFade .2s ease; }
@keyframes mtFade { from { opacity: 0; } to { opacity: 1; } }
.mt-ring-box { width: 360px; max-width: 100%; background: linear-gradient(160deg, #1f2d3a, #0f1a24); color: #fff; border-radius: 22px; padding: 26px 22px 20px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.mt-ring-icon { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 50%; background: var(--green); display: flex; align-items: center; justify-content: center; font-size: 38px; animation: mtPulse 1.2s infinite; }
@keyframes mtPulse { 0% { box-shadow: 0 0 0 0 rgba(10,138,216,.6); } 70% { box-shadow: 0 0 0 22px rgba(10,138,216,0); } 100% { box-shadow: 0 0 0 0 rgba(10,138,216,0); } }
.mt-ring-kind { font-size: 12px; opacity: .75; letter-spacing: .3px; }
.mt-ring h3 { margin: 6px 0 6px; font-size: 20px; word-break: break-word; }
.mt-ring p { margin: 4px 0; font-size: 14px; }
.mt-ring p.muted { color: #b8c4cf; font-size: 12px; }
.mt-ring-auto { color: #ffd76a; }
.mt-ring .mt-count { color: #ffd76a; }
.mt-ring-acts { display: flex; justify-content: space-around; margin-top: 18px; }
.mt-ring-acts button { width: 64px; height: 64px; border-radius: 50%; border: none; font-size: 26px; cursor: pointer; color: #fff; }
.mt-ring-no { background: #f04c4c; }
.mt-ring-yes { background: var(--green); animation: mtPulse 1.2s infinite; }
.mt-ring-labels { display: flex; justify-content: space-around; font-size: 12px; opacity: .8; margin-top: 6px; }
.mt-call1 { border: none; background: #e6f4fd; border-radius: 50%; width: 24px; height: 24px; margin-left: 4px; cursor: pointer; font-size: 12px; padding: 0; }
.mt-call1:hover { background: #cfe9fb; }

/* ฟอร์มนัด: ทำซ้ำ */
.mt-repeat { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mt-repeat select, .mt-repeat input { width: auto !important; }
.mt-rep-end { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mt-rep-end[hidden], .mt-rep-end [hidden] { display: none !important; }
.mt-repeat input[type=number] { width: 80px !important; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-family: inherit; font-size: 14px; }
.mt-rep-preview { font-size: 12.5px; margin-top: 6px; color: #075e96; }
.mt-scope { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-scope button { flex: 1 1 180px; }
.radio-inline input { width: auto !important; margin: 0; }

/* คำขอเป็นเพื่อน */
.rail-btn .badge#reqBadge { background: #ff9f1a; }
.req-label { color: #e07b00 !important; font-weight: 600; }
.req-item { cursor: default; }
.req-acts, .af-acts { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.req-acts button, .af-acts button { font-size: 12.5px; padding: 6px 10px; }
.af-wait { font-size: 12px; }
.link-btn { background: none; border: 0; cursor: pointer; font-size: 13px; color: var(--muted); margin-top: 14px; text-decoration: underline; }
.link-btn.danger { color: #e04848; }

/* ---------- บันทึก / แจ้งเตือน ---------- */
.nt-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--green); color: #fff; font-weight: 600; }
.nt-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.nt-chip { border: 1px solid var(--line); background: #fafbfc; border-radius: 16px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.nt-chip:hover { background: #e6f4fd; border-color: #b8def7; }
.nt-list { margin-top: 6px; }
.nt-empty { text-align: center; padding: 30px 10px; line-height: 1.8; }
.nt-group { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.nt-group span { background: #eef0f2; border-radius: 10px; padding: 0 7px; margin-left: 4px; font-weight: 500; }
.nt-group.late { color: #d63c3c; }
.nt-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.nt-item:hover { background: #f8fbfe; }
.nt-item.late { border-color: #f5b5b5; background: #fff7f7; }
.nt-item.done { opacity: .75; }
.nt-ico { font-size: 24px; width: 36px; text-align: center; }
.nt-main { flex: 1; min-width: 0; }
.nt-title { font-weight: 600; font-size: 14.5px; word-break: break-word; }
.nt-amt { color: #075e96; font-weight: 700; margin-left: 4px; }
.nt-sub { font-size: 12.5px; color: #555; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.nt-late { color: #d63c3c; font-weight: 600; }
.nt-tag { background: #f1f3f5; border-radius: 10px; padding: 0 8px; font-size: 11.5px; }
.nt-tag.ok { background: #e6f4fd; color: #075e96; }
.nt-note { font-size: 12.5px; color: #666; margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.nt-acts { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.nt-acts .btn-primary, .nt-acts .btn-light { font-size: 12.5px; padding: 6px 10px; white-space: nowrap; }
.nt-acts .icon-btn { font-size: 15px; }
.nt-form .row2 { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.nt-form .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.nt-form input[type=date], .nt-form input[type=time], .nt-form input[type=number], .nt-form select, .nt-form textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font-family: inherit; font-size: 14px; background: #fff; box-sizing: border-box;
}
.nt-cats, .nt-offs { display: flex; flex-wrap: wrap; gap: 6px; }
.nt-cat input, .nt-off input { display: none; }
.nt-cat span, .nt-off span { display: inline-block; border: 1px solid var(--line); border-radius: 16px; padding: 5px 12px; font-size: 13px; cursor: pointer; background: #fff; }
.nt-cat input:checked + span, .nt-off input:checked + span { background: #e6f4fd; border-color: var(--green); color: #075e96; font-weight: 600; }
.nt-view p { margin: 6px 0; }
.mt-card.nt-card { border-left-color: #ff9f1a; }
.mt-card.nt-card.start { border-left-color: #f04c4c; }
.rail-btn .badge#notesBadge { background: #ff9f1a; }
.cal-ev.rem { background: #ff9f1a; }
.cal-ev.rem.late { background: #f04c4c; }
.cal-ev.rem.done { background: #c9ced4; text-decoration: line-through; }
@media (max-width: 760px) {
    .nt-form .row2, .nt-form .row3 { grid-template-columns: 1fr 1fr; }
    .nt-item { flex-wrap: wrap; }
    .nt-acts { width: 100%; justify-content: flex-end; }
}

/* ---------- ตั้งค่าแอป ---------- */
.st-sec { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.st-sec h4 { margin: 0 0 8px; font-size: 15px; }
.st-sec p { margin: 6px 0; font-size: 13.5px; }
.st-sec ol { margin: 6px 0 4px; padding-left: 20px; font-size: 13.5px; line-height: 1.9; }
.st-sec code { background: #f1f3f5; border-radius: 6px; padding: 1px 6px; }
.st-way { background: #fafbfc; border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.st-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.st-btns a { text-decoration: none; font-size: 13px; padding: 8px 12px; display: inline-block; }
.st-btns a.btn-light { color: #333; }
.st-copy { font-size: 12px; padding: 2px 8px; margin-left: 4px; }
.st-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.st-switch input { display: none; }
.st-switch span { width: 42px; height: 24px; border-radius: 12px; background: #c9ced4; position: relative; flex-shrink: 0; transition: background .2s; }
.st-switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }
.st-switch input:checked + span { background: var(--green); }
.st-switch input:checked + span::after { left: 21px; }

/* ---------- ไลฟ์สด ---------- */
.live-btn span { font-size: 10.5px; font-weight: 800; letter-spacing: .5px; border: 2px solid currentColor; border-radius: 6px; padding: 1px 4px; line-height: 1; }
.live-btn.on { color: #f0383b; }
.live-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: #fff0f0; color: #b3261e; font-size: 13.5px; border-bottom: 1px solid #f6caca; }
.live-banner .btn-danger { padding: 6px 14px; font-size: 13px; }
.live-dot { color: #f0383b; animation: blink 1.4s infinite; }
.live-screen { position: fixed; inset: 0; z-index: 120; background: #000; color: #fff; overflow: hidden; }
.live-screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.live-screen video.mirror { transform: scaleX(-1); }
.live-wait { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #ddd; font-size: 15px; text-align: center; max-width: 80%; }
.live-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.live-host { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.live-host div { display: flex; flex-direction: column; min-width: 0; }
.live-host b { font-size: 14px; }
.live-host small { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.live-badge { background: #f0383b; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.live-pill { background: rgba(0,0,0,.45); border-radius: 12px; padding: 2px 10px; font-size: 12.5px; }
.live-close { background: rgba(0,0,0,.45); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.live-comments { position: absolute; left: 12px; bottom: 76px; width: min(380px, 70vw); max-height: 40vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
    -webkit-mask-image: linear-gradient(transparent, #000 25%); mask-image: linear-gradient(transparent, #000 25%); scrollbar-width: none; }
.live-cmt { background: rgba(0,0,0,.45); border-radius: 12px; padding: 5px 10px; font-size: 13.5px; align-self: flex-start; max-width: 100%; word-break: break-word; }
.live-cmt b { color: #ffd76a; margin-right: 4px; }
.live-cmt.sys { color: #bfe1f7; font-size: 12.5px; }
.live-hearts { position: absolute; right: 16px; bottom: 70px; width: 80px; height: 60vh; pointer-events: none; }
.live-hearts span { position: absolute; bottom: 0; font-size: 22px; animation: liveHeart 2.5s ease-out forwards; }
@keyframes liveHeart { 0% { transform: translateY(0) scale(.6); opacity: 1; } 100% { transform: translateY(-55vh) translateX(-20px) scale(1.2); opacity: 0; } }
.live-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 12px; background: linear-gradient(transparent, rgba(0,0,0,.65)); flex-wrap: wrap; }
.live-form { display: flex; flex: 1; min-width: 200px; background: rgba(255,255,255,.15); border-radius: 22px; overflow: hidden; }
.live-form input { flex: 1; background: transparent; border: 0; color: #fff; padding: 10px 14px; font-size: 14px; outline: none; font-family: inherit; }
.live-form input::placeholder { color: rgba(255,255,255,.7); }
.live-form button { background: transparent; border: 0; color: #fff; padding: 0 14px; font-weight: 600; cursor: pointer; }
.live-act { background: rgba(255,255,255,.15); border: 0; color: #fff; height: 42px; min-width: 42px; border-radius: 21px; font-size: 18px; cursor: pointer; padding: 0 10px; }
.live-act.off { background: #f0383b; }
.live-act.end { background: #f0383b; font-size: 14px; font-weight: 700; padding: 0 16px; }
.live-act.heart:active { transform: scale(1.2); }
.live-host-ctl { display: inline-flex; gap: 8px; }
.live-host-ctl[hidden] { display: none; }
.live-ended { position: absolute; inset: 0; background: rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center; text-align: center; }
.live-ended h3 { font-size: 22px; margin: 0 0 8px; }
.mt-card.live-card { border-left-color: #f0383b; }
@media (max-width: 760px) {
    .live-host-ctl { width: 100%; justify-content: flex-end; order: 3; }
    .live-meta .live-pill#liveHearts { display: none; }
}

/* Google ในตั้งค่า / ปฏิทิน */
.st-g { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-g .btn-google { width: auto; padding: 8px 14px; font-size: 13.5px; }
.st-g-mail { font-weight: 600; }
.st-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-top: 8px; cursor: pointer; }
.st-check input { width: 16px; height: 16px; accent-color: var(--green); }
.st-pre { background: #f1f3f5; border-radius: 8px; padding: 8px 10px; font-family: Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.cal-ev.gcal { background: #fff; color: #3c4043; border: 1px solid #c6d4ee; border-left: 4px solid #4285f4; }
.cal-ev.gcal.allday { background: #e8f0fe; }
.cal-gbtn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 7px 12px; }
@media (max-width: 760px) { .cal-gbtn { font-size: 12px; padding: 6px 8px; } }
.st-way > summary { cursor: pointer; list-style: revert; }
.st-way .field input { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: inherit; }

/* ---------- มือถือ / แท็บเล็ต: แถบเมนูล่าง + เมนูเพิ่มเติม ---------- */
.rail-moreBtn, .mobile-only, .list-me { display: none; }
.rail { overflow-y: auto; scrollbar-width: none; }
.more-sheet { position: fixed; inset: 0; z-index: 110; background: rgba(0,0,0,0); transition: background .2s; display: flex; align-items: flex-end; }
.more-sheet.show { background: rgba(0,0,0,.4); }
.more-panel { width: 100%; background: #fff; border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(100%); transition: transform .2s ease; max-height: 80vh; overflow-y: auto; }
.more-sheet.show .more-panel { transform: none; }
.more-grab { width: 40px; height: 4px; border-radius: 2px; background: #d6d9dd; margin: 4px auto 12px; }
.more-me { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.more-me > div:last-child { display: flex; flex-direction: column; }
.more-me small { color: var(--muted); }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.more-item { border: 0; background: #f4f6f8; border-radius: 14px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: 12.5px; color: var(--text); font-family: inherit; cursor: pointer; }
.more-item span { font-size: 22px; }
.more-item.danger { color: #d63c3c; }

/* PC/แท็บเล็ต: แถบซ้ายแสดงเฉพาะเมนูโปรด + ปุ่ม ⋯ เปิดเมนูลอย (ปักหมุด ☆/★) */
@media (min-width: 761px) {
    .rail .rail-hide { display: none !important; }
    .rail .rail-moreBtn { display: grid; }
    .rail-btn.active-more { background: rgba(255,255,255,.12); color: #fff; }
    .rail-btn.dot::before { content: ""; position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
    .more-sheet.pc { align-items: flex-start; justify-content: flex-start; }
    .more-sheet.pc.show { background: rgba(0,0,0,.08); }
    .more-sheet.pc .more-panel { position: absolute; left: 72px; width: 280px; max-height: calc(100vh - 16px); border-radius: 14px; padding: 8px;
        box-shadow: 0 10px 34px rgba(0,0,0,.22); transform: translateX(-8px); opacity: 0; transition: transform .15s ease, opacity .15s ease; }
    .more-sheet.pc.show .more-panel { transform: none; opacity: 1; }
    .more-sheet.pc .more-grab { display: none; }
    .more-sheet.pc .more-me { padding: 6px 8px 10px; margin-bottom: 4px; }
    .more-sheet.pc .more-grid { display: flex; flex-direction: column; gap: 1px; }
    .more-row { display: flex; align-items: center; border-radius: 10px; }
    .more-row:hover { background: #f2f4f6; }
    .more-sheet.pc .more-item { flex: 1; flex-direction: row; justify-content: flex-start; gap: 10px; background: transparent; padding: 9px 8px; font-size: 14px; border-radius: 10px; text-align: left; }
    .more-sheet.pc .more-item span { font-size: 18px; width: 24px; text-align: center; }
    .more-sheet.pc .more-item b { font-weight: 500; flex: 1; }
    .more-star { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px; font-size: 18px; color: #b8bec6; cursor: pointer; flex-shrink: 0; }
    .more-star:hover { background: #e6e9ed; color: #f5a623; }
    .more-row.fav .more-star { color: #f5a623; }
    .more-foot { font-size: 12px; color: var(--muted); padding: 8px 8px 4px; border-top: 1px solid var(--line); margin-top: 6px; }
    .more-foot .link-btn { border: 0; background: none; color: var(--green); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
}
.more-badge { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; font-weight: 600; text-align: center; }
.more-badge.dot { min-width: 8px; width: 8px; height: 8px; padding: 0; background: var(--green); }
.more-item { position: relative; }
@media (max-width: 760px) { .more-item .more-badge { position: absolute; top: 6px; right: 10px; } }

/* แท็บเล็ต */
@media (min-width: 761px) and (max-width: 1100px) {
    .list-pane { width: 280px; }
    .rail { width: 58px; gap: 2px; }
    .rail-btn, .rail-avatar { width: 42px; height: 42px; }
}

/* มือถือ: แถบเมนูล่างแบบ LINE */
@media (max-width: 760px) {
    .app { flex-direction: column; }
    .app .rail {
        order: 2; width: 100%; height: auto; flex-direction: row; justify-content: space-around; align-items: stretch;
        padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 0; background: #fff; border-top: 1px solid var(--line); overflow: visible;
    }
    .app .rail .rail-more, .app .rail form, .app .rail .rail-spacer { display: none !important; }
    .app .rail .rail-moreBtn { display: grid; }
    .app .rail .rail-btn { flex: 1; width: auto; height: 54px; border-radius: 10px; color: #8a9099; grid-template-rows: 26px auto; gap: 2px; padding-top: 4px; }
    .app .rail .rail-btn svg { width: 24px; height: 24px; justify-self: center; }
    .app .rail .rail-btn::after { content: attr(data-label); font-size: 11px; line-height: 1; }
    .app .rail .rail-btn:hover { background: transparent; color: var(--text); }
    .app .rail .rail-btn.active { color: var(--green); }
    .app .rail .rail-btn .badge { top: 0; right: calc(50% - 26px); }
    .app .rail .rail-btn.dot::before { content: ""; position: absolute; top: 6px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
    .app .list-pane { order: 1; flex: 1; min-height: 0; }
    .app .chat-pane { order: 1; flex: 1; min-height: 0; }
    .list-header { padding: 12px 14px 6px; gap: 6px; }
    .list-header h2 { flex: 1; font-size: 22px; }
    .list-me { display: block; border: 0; background: none; padding: 0; margin-right: 4px; }
    .mobile-only { display: inline-grid; }
    .search-box { margin: 4px 14px 8px; border-radius: 12px; }
    .list-body .item { padding: 10px 14px; }
    /* แถบขาดการเชื่อมต่อ: เต็มความกว้าง เส้นบาง ๆ ด้านบน ไม่บังหัวข้อ */
    .conn-banner { left: 0; right: 0; transform: none; border-radius: 0; justify-content: center; padding: 4px 10px calc(4px); font-size: 12px; box-shadow: none; }
    .conn-banner button { padding: 2px 8px; font-size: 12px; }
    body.conn-off .app { padding-top: 30px; }
    .mt-cards { bottom: calc(76px + env(safe-area-inset-bottom)); right: 10px; left: 10px; }
    .mt-card { width: auto; }
    .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
    .composer { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
    .app.chat-open ~ .toast, body:has(.app.chat-open) .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
.live-unmute { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3; border: 0; border-radius: 24px; padding: 12px 22px;
    background: rgba(0,0,0,.65); color: #fff; font-size: 16px; font-family: inherit; cursor: pointer; }
.live-unmute[hidden] { display: none; }
#liveMic { transition: box-shadow .1s; }

/* อุปกรณ์รับแจ้งเตือน */
.st-devs { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.st-dev { display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid var(--line, #e3e6ea); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.st-dev .muted { font-size: 12px; }
.st-dev-acts { display: flex; gap: 6px; flex-shrink: 0; }
.st-dev-acts .btn-light { padding: 5px 10px; font-size: 12px; }

.incoming-sound { margin: 6px auto 0; border: 0; border-radius: 18px; padding: 7px 14px; background: rgba(255,255,255,.18); color: #fff; font-size: 13px; cursor: pointer; }
.incoming-sound[hidden] { display: none; }

.nt-next { font-size: 12px; color: var(--muted, #7a8591); margin-top: 4px; }
.cal-ev.rem.future { opacity: .72; border-style: dashed; }

/* บัญชีทางการ (OA) */
.oa-badge { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #06c755; color: #fff; font-size: 10px; font-weight: 700; vertical-align: 1px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--green, #0a8ad8); cursor: pointer; font: inherit; text-decoration: underline; }
.oa-wrap { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.oa-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line, #e3e6ea); padding-bottom: 8px; }
.oa-tabs button { border: 1px solid var(--line, #e3e6ea); background: #fff; border-radius: 16px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.oa-tabs button.on { background: var(--green, #0a8ad8); border-color: var(--green, #0a8ad8); color: #fff; }
.oa-kv, .oa-table { width: 100%; border-collapse: collapse; }
.oa-kv th, .oa-kv td, .oa-table th, .oa-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line, #eef0f2); vertical-align: top; }
.oa-kv th { width: 150px; font-weight: 600; white-space: nowrap; }
.oa-kv td:last-child, .oa-table td:last-child { white-space: nowrap; text-align: right; }
.oa-kv td .btn-light, .oa-table td .btn-light { padding: 4px 10px; font-size: 12px; margin-left: 4px; }
.oa-kv code, .oa-table code { word-break: break-all; font-size: 12px; }
.oa-table th { font-size: 12px; color: var(--muted, #7a8591); font-weight: 600; }
.oa-blocked { opacity: .55; }
.oa-pre { white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, Consolas, monospace; font-size: 12px; margin: 8px 0; }
.oa-api { margin: 6px 0 6px 18px; padding: 0; line-height: 1.7; font-size: 13px; }
.oa-add { text-align: center; padding: 10px; }
.oa-add h3 { margin: 10px 0 4px; }
/* หน้าจัดการบัญชีทางการ: หน้าต่างกว้างขึ้น + แต่ละค่าเป็นแถว (ชื่อ / ค่า / ปุ่ม) */
.modal:has(.oa-wrap) { max-width: 760px; }
.oa-kv tr { display: grid; grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid var(--line, #eef0f2); padding: 6px 0; }
.oa-kv th { grid-column: 1 / -1; width: auto; padding: 2px 6px 0; border: 0; font-size: 12px; color: var(--muted, #7a8591); }
.oa-kv td { border: 0; padding: 4px 6px; }
.oa-kv code { font-size: 13px; }
@media (max-width: 640px) {
    .oa-kv tr { grid-template-columns: 1fr; }
    .oa-kv td:last-child { text-align: left; }
    .oa-table tr { display: grid; grid-template-columns: 1fr; }
    .oa-table td:last-child { text-align: left; }
    .oa-table tr:first-child { display: none; }
}

/* เชื่อมต่อ LINE OA จริง */
.modal:has(.lc-wrap) { max-width: 680px; }
.lc-wrap { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.lc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.lc-grid .field:last-child { grid-column: 1 / -1; }
.lc-grid textarea { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.lc-agents { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 160px; overflow: auto; border: 1px solid var(--line, #e3e6ea); border-radius: 10px; padding: 8px 10px; }
.lc-pic { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.lc-pic-ph { display: grid; place-items: center; background: #e9f9ef; }
.lc-bot { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: #effaf3; border-radius: 12px; }
.lc-notice { padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.lc-notice.ok { background: #e8f8ee; color: #136c34; }
.lc-notice.err { background: #fdeceb; color: #a12a20; }
@media (max-width: 640px) { .lc-grid { grid-template-columns: 1fr; } }

.lc-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 12px; }
.lc-card { border: 1px solid var(--line, #e3e6ea); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.lc-card-h { font-weight: 700; }
.lc-card ul { margin: 0 0 4px 18px; padding: 0; font-size: 13px; line-height: 1.6; flex: 1; }
.lc-card .btn-primary { align-self: flex-start; }
.lc-pic-sm { font-size: 18px; }
@media (max-width: 640px) { .lc-choose { grid-template-columns: 1fr; } }

/* ตั้งค่าเสียง */
.snd-rows { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.snd-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(140px, 1.2fr) auto auto; gap: 8px; align-items: center; }
.snd-label { font-size: 14px; }
.snd-row .select { width: 100%; padding: 7px 8px; border: 1px solid var(--line, #e3e6ea); border-radius: 8px; font: inherit; background: #fff; }
.snd-row .btn-light { padding: 6px 10px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.snd-vol { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; margin: 4px 0 6px; }
.snd-vol input[type=range] { vertical-align: middle; width: 140px; accent-color: var(--green, #0a8ad8); }
@media (max-width: 640px) {
    .snd-row { grid-template-columns: 1fr auto auto; }
    .snd-label { grid-column: 1 / -1; font-weight: 600; }
}

/* ---------- แชทระหว่างโทร ---------- */
.cc-btn { position: relative; }
.cc-badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px #0b1118; }
.cc-badge[hidden] { display: none; }
.cc-panel { position: absolute; top: 0; right: 0; width: 340px; max-width: 100%; z-index: 20; display: flex; flex-direction: column;
    background: rgba(17, 24, 32, .96); backdrop-filter: blur(6px); border-left: 1px solid rgba(255,255,255,.08); color: #e8edf2; }
.cc-panel[hidden] { display: none; }
.cc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.cc-head b { font-size: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cc-close { border: 0; background: rgba(255,255,255,.08); color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.cc-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cc-sys { align-self: center; font-size: 12px; color: #9aa7b3; background: rgba(255,255,255,.06); padding: 4px 10px; border-radius: 10px; text-align: center; max-width: 90%; }
.cc-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; }
.cc-msg.me { align-self: flex-end; align-items: flex-end; }
.cc-from { font-size: 11px; color: #9aa7b3; margin: 0 0 2px 4px; }
.cc-bubble { background: #26323f; padding: 7px 11px; border-radius: 14px; font-size: 14px; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.cc-msg.me .cc-bubble { background: var(--green, #0a8ad8); color: #fff; }
.cc-bubble a { color: inherit; text-decoration: underline; }
.cc-bubble.image { padding: 3px; background: transparent; }
.cc-bubble.image img { display: block; max-width: 220px; max-height: 200px; border-radius: 10px; }
.cc-bubble.sticker { background: transparent; padding: 0; }
.cc-sticker { font-size: 40px; line-height: 1; }
.cc-unsent { opacity: .7; }
.cc-time { font-size: 10px; color: #7f8b97; margin: 2px 4px 0; }
.cc-form { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.08); }
.cc-attach { cursor: pointer; font-size: 18px; opacity: .8; flex-shrink: 0; }
.cc-input { flex: 1; min-width: 0; height: 40px; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; background: rgba(255,255,255,.06); color: #fff; padding: 0 14px; font: inherit; font-size: 14px; outline: none; }
.cc-input:focus { border-color: var(--green, #0a8ad8); }
.cc-send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--green, #0a8ad8); color: #fff; font-size: 16px; cursor: pointer; flex-shrink: 0; }
.cc-preview { position: absolute; left: 50%; transform: translateX(-50%); z-index: 21; max-width: min(520px, 92vw); background: rgba(17,24,32,.95); color: #fff;
    border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 9px 14px; font-size: 14px; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.4);
    animation: ccIn .2s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-preview b { color: #7cc4ff; margin-right: 4px; }
.cc-preview[hidden] { display: none; }
@keyframes ccIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* เปิดแชทบนจอกว้าง → ย่อพื้นที่ภาพไม่ให้ถูกแผงบัง */
@media (min-width: 900px) {
    .call-screen.cc-open .call-stage { margin-right: 340px; }
    .gc-screen.cc-open .gc-grid, .gc-screen.cc-open .gc-top { margin-right: 340px; }
}
/* มือถือ/แท็บเล็ตแนวตั้ง: แผงแชทเป็นแผ่นด้านล่างสูงครึ่งจอ */
@media (max-width: 899px) {
    .cc-panel { top: auto; left: 0; right: 0; width: auto; height: 55%; border-left: 0; border-top: 1px solid rgba(255,255,255,.1); border-radius: 16px 16px 0 0; }
}

/* ---------- สั่งงานด้วยเสียง ---------- */
.voice-btn.on { color: #fff; background: #ef4444 !important; animation: vcPulse 1.2s infinite; }
.call-btn.voice-btn .vb-ico { font-size: 20px; line-height: 1; }
@keyframes vcPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } }
.vc-box { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 300;
    width: min(560px, calc(100vw - 24px)); display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px;
    background: #fff; color: #1d2733; border-radius: 16px; box-shadow: 0 14px 40px rgba(10,20,30,.28); animation: vcIn .18s ease; }
.vc-box[hidden] { display: none; }
@keyframes vcIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.vc-mic { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; background: #e8f3fb; display: grid; place-items: center; }
.vc-mic span { width: 14px; height: 14px; border-radius: 50%; background: var(--green, #0a8ad8); }
.vc-box.listening .vc-mic { background: #fde8e8; }
.vc-box.listening .vc-mic span { background: #ef4444; animation: vcDot 1s infinite; }
@keyframes vcDot { 0%,100% { transform: scale(1); } 50% { transform: scale(1.5); } }
.vc-main { flex: 1; min-width: 0; }
.vc-state { font-weight: 700; font-size: 15px; }
.vc-text { font-size: 14px; margin-top: 4px; color: #3b4652; word-break: break-word; }
.vc-hint { color: #8a95a1; font-size: 12.5px; }
.vc-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.vc-acts:empty { display: none; }
.vc-close { border: 0; background: #f1f3f5; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.vc-help { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.vc-help td { padding: 4px 6px; border-bottom: 1px solid #eef0f2; vertical-align: top; }
.vc-help td:first-child { font-weight: 600; color: #0b5e93; }
.vc-help td:last-child { color: #6b7682; }

/* ---------- QR Code เข้าเว็บไซต์ / เพิ่มเพื่อน (qr.js) ---------- */
.qr-tabs { display: flex; gap: 4px; background: #f1f3f5; padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.qr-tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.qr-tabs button[aria-selected="true"] { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.qr-img svg { display: block; width: min(240px, 62vw); height: auto; }
.qr-err { padding: 60px 20px; color: var(--danger); }
.qr-cap { display: flex; align-items: center; gap: 10px; text-align: center; }
.qr-cap small { display: block; color: var(--muted); font-size: 12.5px; word-break: break-all; }
.qr-url { margin-top: 12px; }
.qr-url input { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.qr-url input[readonly] { background: #f6f7f8; color: var(--muted); }
.qr-warn { font-size: 12.5px; background: #fff7e6; border: 1px solid #ffd591; color: #8a5a00; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.qr-warn code { background: rgba(0,0,0,.06); padding: 0 4px; border-radius: 4px; }
.qr-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.qr-actions button { flex: 1; min-width: 120px; }
.qr-actions2 { margin-top: 8px; align-items: center; }
.qr-layout { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; color: var(--muted); flex: 1.4; min-width: 200px; }
.qr-layout select { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font: inherit; font-size: 13px; color: var(--text); background: #fff; }
.qr-hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }

/* ---------- ผู้ดูแลระบบ: จัดการผู้ใช้ (admin.js) ---------- */
.au-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.au-search { flex: 1; min-width: 220px; margin: 0; }
.au-search input { width: 100%; }
.au-reg { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.au-reg input { position: absolute; opacity: 0; pointer-events: none; }
.au-switch { width: 38px; height: 22px; border-radius: 11px; background: #cfd4da; position: relative; transition: background .15s; flex-shrink: 0; }
.au-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.au-reg input:checked + .au-switch { background: var(--green); }
.au-reg input:checked + .au-switch::after { transform: translateX(16px); }
.au-reg input:focus-visible + .au-switch { outline: 2px solid var(--green); outline-offset: 2px; }
.au-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.au-filters button { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.au-filters button em { font-style: normal; color: var(--muted); margin-left: 2px; }
.au-filters button.on { background: var(--green); border-color: var(--green); color: #fff; }
.au-filters button.on em { color: rgba(255,255,255,.85); }
.au-list { list-style: none; margin: 0; padding: 0; max-height: min(58vh, 560px); overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.au-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.au-row:last-child { border-bottom: 0; }
.au-row.is-blocked { background: #fff6f6; }
.au-row.is-blocked .avatar { filter: grayscale(1); opacity: .6; }
.au-main { flex: 1; min-width: 0; }
.au-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.au-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.au-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: #6b737c; margin-top: 2px; }
.au-why { font-size: 12px; color: #c33; margin-top: 3px; }
.au-pill { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: #eef1f4; color: #555; font-weight: 600; }
.au-pill.admin { background: #e6f4fd; color: #075e96; }
.au-pill.blocked { background: #ffe3e3; color: #c33; }
.au-pill.new { background: #fff3d6; color: #9a6400; }
.au-pill.online { background: #e3f8ea; color: #18864b; }
.au-acts { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.au-acts .btn-light { padding: 6px 10px; font-size: 13px; }
.au-acts .au-warn { color: #b25e00; }
.au-acts .au-danger { color: #d63c3c; }
.au-acts .au-danger:hover { background: #ffecec; }
.au-self { font-size: 12px; }
.au-empty { padding: 30px; text-align: center; color: var(--muted); }
.au-note { font-size: 12px; color: var(--muted); margin: 10px 2px 0; line-height: 1.5; }
.au-panel h3 { margin: 0 0 10px; font-size: 17px; }
.au-panel h3.danger { color: #d63c3c; }
.au-who { display: flex; align-items: center; gap: 10px; padding: 10px; background: #f6f7f9; border-radius: 10px; }
.au-who small { display: block; color: var(--muted); font-size: 12px; }
.au-bullets { margin: 10px 0; padding-left: 20px; font-size: 13.5px; line-height: 1.6; color: #444; }
.au-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.au-chips button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.au-chips button:hover { background: #f3f5f7; }
.au-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; margin: 6px 0 12px; cursor: pointer; }
.au-check input { margin-top: 3px; }
.au-panel .field input { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; }
.au-panel .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.btn-danger:disabled { opacity: .45; cursor: default; }
.au-kicked { position: fixed; inset: 0; z-index: 500; background: rgba(15,20,25,.72); display: grid; place-items: center; padding: 16px; }
.au-kicked-card { background: #fff; border-radius: 16px; padding: 26px 24px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.au-kicked-card .big { font-size: 46px; }
.au-kicked-card h2 { margin: 8px 0; font-size: 19px; }
.au-kicked-card button { margin-top: 12px; min-width: 120px; }
@media (max-width: 760px) {
    .au-row { flex-wrap: wrap; }
    .au-acts { width: 100%; justify-content: flex-end; }
    .au-list { max-height: 55vh; }
}

/* ---------- 💾 พื้นที่จัดเก็บ (storage.js) ---------- */
.bubble.file.removed { opacity: .7; cursor: default; border: 1px dashed #c9ced4; background: #f7f8fa !important; color: #6b737c !important; }
.bubble.file.removed .file-icon { font-size: 20px; background: #eceff2 !important; }
.st-loading, .st-err { padding: 30px; text-align: center; }
.st-err { color: var(--danger); }
.st-cards { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.st-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; background: #fff; }
.st-card small { color: var(--muted); font-size: 12px; }
.st-card > b { font-size: 22px; line-height: 1.2; }
.st-card > span { font-size: 12.5px; color: #6b737c; }
.st-card .btn-light { margin-top: auto; align-self: flex-start; padding: 6px 12px; font-size: 13px; }
.st-card .btn-light:disabled { opacity: .5; }
.st-bar { height: 10px; border-radius: 5px; background: #eef1f4; overflow: hidden; display: flex; margin-top: 8px; }
.st-bar i { display: block; height: 100%; background: var(--green); }
.st-bar:not(.multi) { background: #a78bfa; }
.st-bar .c1, .st-legend .c1 { background: var(--green); }
.st-bar .c2, .st-legend .c2 { background: #a78bfa; }
.st-bar .c3, .st-legend .c3 { background: #f59e0b; }
.st-bar .c4, .st-legend .c4 { background: #10b981; }
.st-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #555; margin-top: 6px; }
.st-legend em { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.st-warn { margin-top: 8px; font-size: 12.5px; background: #fff4e5; color: #9a5b00; border-radius: 8px; padding: 6px 8px; }
.st-h { margin: 16px 0 8px; font-size: 14px; }
.st-rooms { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; max-height: 200px; overflow-y: auto; }
.st-rooms li { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.st-rooms li:last-child { border-bottom: 0; }
.st-rname { width: 34%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-rbar { flex: 1; height: 6px; border-radius: 3px; background: #eef1f4; overflow: hidden; }
.st-rbar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.st-rsize { width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
.st-rsize small { color: var(--muted); }
.st-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.st-tools select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13px; background: #fff; max-width: 200px; }
.st-tools .btn-danger { padding: 7px 12px; font-size: 13px; }
.st-spacer { flex: 1; }
.st-all { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.st-chip { background: #e6f4fd; color: #075e96; border-radius: 14px; padding: 3px 4px 3px 10px; font-size: 12.5px; }
.st-chip button { border: 0; background: transparent; cursor: pointer; color: inherit; }
.st-files { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; max-height: 340px; overflow-y: auto; }
.st-files li { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.st-files li:last-child { border-bottom: 0; }
.st-files li:hover { background: #f7f9fb; }
.st-files li.on { background: #fff3f3; }
.st-thumb { width: 40px; height: 40px; border-radius: 8px; background: #eef1f4; display: grid; place-items: center; overflow: hidden; flex-shrink: 0; font-size: 20px; }
.st-thumb img { width: 100%; height: 100%; object-fit: cover; }
.st-fmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.st-fmain b { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-fmain small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-fsize { font-variant-numeric: tabular-nums; font-size: 13px; color: #444; width: 76px; text-align: right; }
.st-empty { justify-content: center; color: var(--muted); padding: 24px !important; cursor: default !important; }
.st-more { display: block; margin: 8px auto 0; }
.st-note { font-size: 12px; color: var(--muted); margin: 12px 2px 0; line-height: 1.5; }
.st-global { background: #f7f8fa; border-radius: 10px; padding: 10px; }
.st-uacts { white-space: nowrap; text-align: right; }
.st-uacts .link-btn + .link-btn { margin-left: 8px; }
@media (max-width: 760px) {
    .st-cards { grid-template-columns: 1fr 1fr; }
    .st-card.big { grid-column: 1 / -1; }
    .st-rname { width: 40%; }
    .st-rbar { display: none; }
    .st-tools .st-spacer { display: none; }
}
.st-rooms .link-btn, .st-files .link-btn, .st-uacts .link-btn { margin-top: 0; }
.st-bar .c5, .st-legend .c5 { background: #ec4899; } .st-bar .c6, .st-legend .c6 { background: #64748b; }

/* ---------- ฟังก์ชันเสริมห้องแชท: ปักหมุด / ปิดเสียง / โน้ต / อัลบั้ม / Keep (roomextras.js) ---------- */
.avatar.xs { width: 18px; height: 18px; font-size: 10px; display: inline-grid; vertical-align: -4px; }
.room-flag { font-size: 12px; opacity: .75; }
.room-pin { font-size: 11px; margin-right: 4px; }
.unread.muted-unread { background: #aab2bb; }
#roomList .item.pinned { background: #f6f9fc; }
#roomList .item.pinned.active, #roomList .item.active { background: var(--hover, #eef3f8); }
.msg-more { display: none; border: 0; background: rgba(0,0,0,.25); color: #fff; font-size: 12px; line-height: 1; border-radius: 10px; padding: 2px 7px 4px; margin-bottom: 3px; cursor: pointer; }
.msg:hover .msg-more { display: inline-block; }
.msg-more:hover { background: rgba(0,0,0,.45); }
@media (hover: none) { .msg-more { display: inline-block; opacity: .7; } }
.rx-flash .bubble { animation: rxflash 1.6s ease; }
@keyframes rxflash { 0%, 60% { box-shadow: 0 0 0 4px rgba(10,138,216,.45); } 100% { box-shadow: none; } }

.pin-banner { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 14px; background: #fffbea; border-bottom: 1px solid #f3e3a2; font-size: 13.5px; }
.pin-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; font: inherit; cursor: pointer; color: var(--text); padding: 2px 0; }
.pin-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-x { border: 0; background: none; cursor: pointer; color: #9a8a4a; font-size: 14px; padding: 4px 8px; border-radius: 6px; }
.pin-x:hover { background: rgba(0,0,0,.06); }

.rx-pop { position: fixed; z-index: 300; background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.22); padding: 6px; min-width: 210px; display: flex; flex-direction: column; }
.rx-pop button { border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; color: var(--text); }
.rx-pop button:hover { background: #f1f4f7; }

.rx-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rx-grid button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--text); }
.rx-grid button:hover { background: #f6f8fa; }
.rx-grid button span { font-size: 24px; margin-bottom: 2px; }
.rx-grid button small { color: var(--muted); font-size: 11px; min-height: 14px; text-align: center; }
.rx-grid button.on { border-color: #ffd28a; background: #fff8ec; }
.rx-pinned { margin-top: 12px; background: #fffbea; border: 1px solid #f3e3a2; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; }
.rx-pinned small { color: var(--muted); }
.rx-mute { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.rx-mute h4 { margin: 0 0 4px; font-size: 15px; }
.rx-mute p { margin: 0 0 10px; font-size: 12.5px; }
.rx-mute-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.rx-mute-opts .btn-light { padding: 7px 12px; font-size: 13px; }
.rx-unmute { margin-top: 10px; width: 100%; }

.rx-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rx-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 34px 20px; font-size: 13.5px; line-height: 1.6; }
.rx-empty span { display: block; font-size: 38px; margin-bottom: 6px; }
.rx-danger { color: #d63c3c !important; }
.rx-upload { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.btn-light.rx-upload { padding: 8px 14px; }

.rx-notes { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.rx-note { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; font: inherit; cursor: pointer; color: var(--text); }
.rx-note:hover { background: #f8fafc; border-color: #d5dce3; }
.rx-note b { display: block; font-size: 15px; }
.rx-note p { margin: 4px 0 6px; font-size: 13px; color: #555; white-space: pre-wrap; max-height: 3.2em; overflow: hidden; }
.rx-note small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.rx-note-view .rx-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.rx-note-body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.65; background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; max-height: 55vh; overflow-y: auto; }
.rx-big { max-width: 100%; max-height: 60vh; border-radius: 10px; display: block; margin: 0 auto; }
.actions { gap: 8px; }
#modalBody textarea#rxContent, #modalBody #rxTitle { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 14px; }
#modalBody textarea#rxContent { resize: vertical; line-height: 1.6; }

.rx-albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: 62vh; overflow-y: auto; }
.rx-album { border: 0; background: none; text-align: left; padding: 0; cursor: pointer; font: inherit; color: var(--text); }
.rx-album b { display: block; margin-top: 6px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-album small { color: var(--muted); font-size: 12px; }
.rx-cover { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #eef1f4; display: grid; gap: 2px; place-items: center; }
.rx-cover span { font-size: 34px; opacity: .6; }
.rx-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rx-cover.c1 { grid-template-columns: 1fr; }
.rx-cover.c2, .rx-cover.c3, .rx-cover.c4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; place-items: stretch; }
.rx-cover.c2 img { grid-row: span 2; }
.rx-cover.c3 img:first-child { grid-row: span 2; }
.rx-album:hover .rx-cover { box-shadow: 0 0 0 3px rgba(10,138,216,.35); }
.rx-album.new .rx-cover { border: 2px dashed #c9d1d9; background: #fafbfc; }
.rx-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; max-height: 64vh; overflow-y: auto; }
.rx-photos button { border: 0; padding: 0; aspect-ratio: 1; overflow: hidden; border-radius: 6px; cursor: zoom-in; background: #eef1f4; }
.rx-photos img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s; }
.rx-photos button:hover img { transform: scale(1.04); }
.rx-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 4px; max-height: 260px; overflow-y: auto; }
.rx-pick button { position: relative; border: 0; padding: 0; aspect-ratio: 1; border-radius: 6px; overflow: hidden; cursor: pointer; background: #eef1f4; }
.rx-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rx-pick i { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.3); color: transparent; font-style: normal; font-size: 12px; display: grid; place-items: center; }
.rx-pick button.on { box-shadow: inset 0 0 0 3px var(--green); }
.rx-pick button.on i { background: var(--green); color: #fff; }

.rx-viewer { position: fixed; inset: 0; z-index: 400; background: rgba(10,12,15,.94); display: grid; place-items: center; }
.rx-viewer img { max-width: 92vw; max-height: 84vh; object-fit: contain; border-radius: 4px; }
.rx-vtop { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 10px 14px; color: #ddd; font-size: 13px; background: linear-gradient(rgba(0,0,0,.5), transparent); }
.rx-vtop a, .rx-vtop button { border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 16px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.rx-vtop a:hover, .rx-vtop button:hover { background: rgba(255,255,255,.22); }
.rx-nav { position: absolute; top: 50%; transform: translateY(-50%); border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 34px; width: 52px; height: 52px; border-radius: 50%; cursor: pointer; }
.rx-nav:hover { background: rgba(255,255,255,.25); }
.rx-nav.prev { left: 16px; }
.rx-nav.next { right: 16px; }

.rx-ktabs { margin: 0; flex: 1.2; min-width: 260px; }
.rx-ksearch { flex: 1; min-width: 180px; margin: 0; }
.rx-ksearch input { width: 100%; }
.rx-knew { border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-bottom: 10px; background: #fafbfc; }
.rx-knew textarea { width: 100%; box-sizing: border-box; border: 0; background: transparent; resize: vertical; font: inherit; font-size: 14px; outline: none; }
.rx-knew-acts { display: flex; justify-content: space-between; gap: 8px; }
.rx-knew-acts .btn-light, .rx-knew-acts .btn-primary { padding: 7px 14px; font-size: 13px; }
.rx-klist { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.rx-kitem { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: #fff; }
.rx-kthumb { width: 48px; height: 48px; border-radius: 8px; background: #eef1f4; display: grid; place-items: center; overflow: hidden; flex-shrink: 0; font-size: 22px; }
.rx-kthumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.rx-kmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.rx-kmain b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-ktext { white-space: pre-wrap; word-break: break-word; max-height: 6.5em; overflow: hidden; }
.rx-kmemo { font-size: 12.5px; color: #8a5a00; }
.rx-kmain small { font-size: 11.5px; }
.rx-kacts { display: flex; gap: 2px; flex-shrink: 0; }
.rx-kacts button, .rx-kacts a { border: 0; background: none; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; text-decoration: none; font-size: 15px; }
.rx-kacts button:hover, .rx-kacts a:hover { background: #f1f4f7; }

@media (max-width: 760px) {
    .rx-grid { grid-template-columns: repeat(3, 1fr); }
    .rx-albums { grid-template-columns: repeat(2, 1fr); }
    .rx-photos { grid-template-columns: repeat(3, 1fr); }
    .rx-kacts { flex-direction: column; }
    .rx-nav { width: 42px; height: 42px; font-size: 26px; }
}
.rs-folder { background: #f6f8fa; border-radius: 10px; padding: 10px 12px; margin: 6px 0; font-size: 13.5px; }

/* ---------- 📥 ไฟล์พักชั่วคราว (recvsave.js) ---------- */
.relay-wrap { display: flex; flex-direction: column; gap: 3px; max-width: 100%; }
.msg.me .relay-wrap { align-items: flex-end; }
.relay-info { font-size: 11.5px; color: rgba(0,0,0,.6); background: rgba(255,255,255,.75); border-radius: 8px; padding: 2px 8px; align-self: flex-start; }
.msg.me .relay-info { align-self: flex-end; }
.relay-info a { color: var(--green); font-weight: 600; text-decoration: none; }
.relay-info.ok { color: #18864b; }
.relay-info.done { color: #6b737c; }
.rv-banner { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 260; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
    padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 10px; font-size: 14px; max-width: calc(100vw - 24px); flex-wrap: wrap; }
.rv-banner .btn-primary { padding: 7px 12px; font-size: 13px; }
.rv-x { border: 0; background: none; cursor: pointer; font-size: 15px; color: #888; padding: 4px 6px; }
.st-relay select { max-width: 260px; }
.kp-migrate { background: #eef6fd; border: 1px solid #cfe5f7; border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; font-size: 13.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .kp-migrate .btn-primary { padding: 6px 12px; font-size: 13px; } .kp-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; } .kp-foot .link-btn { margin-top: 0; }

/* ---------- ตัวเลือกสมาชิก (สร้างกลุ่ม / เพิ่มสมาชิก) ---------- */
.mp { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.mp-top { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.mp-search { flex: 1; margin: 0 !important; }
.mp-search input { width: 100%; }
.mp-count { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.mp-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px; }
.mp-chips:not(:empty) { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.mp-chip { border: 0; background: #e6f4fd; color: #075e96; border-radius: 14px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.mp-chip:hover { background: #d3ebfb; }
.mp-list { max-height: 300px; overflow-y: auto; }
.modal-body .mp-item, .mp-item { display: flex !important; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; margin: 0 !important; font-size: 14px; color: var(--text) !important; }
.mp-item:hover { background: #f5f8fb; }
.mp-item[hidden] { display: none !important; }
.mp-item .avatar { flex-shrink: 0; }
.mp-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mp-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-name small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-item input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.mp-tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c9d1d9; flex-shrink: 0; display: grid; place-items: center; transition: all .12s; }
.mp-item input:checked + .mp-tick { background: var(--green); border-color: var(--green); }
.mp-item input:checked + .mp-tick::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translate(0, -1px) rotate(45deg); }
.mp-item input:focus-visible + .mp-tick { outline: 2px solid var(--green); outline-offset: 2px; }
.mp-item:has(input:checked) { background: #f0f8fe; }
.mp-none { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 🎥 บันทึกหน้าจอ (screenrec.js) ---------- */
.sr-intro { margin: 0 0 12px; color: #555; font-size: 14px; }
.sr-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sr-opt { position: relative; display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 10px; cursor: pointer; }
.sr-opt input { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; accent-color: var(--green); }
.sr-opt span { grid-row: span 2; font-size: 22px; text-align: center; }
.sr-opt b { font-size: 14px; font-weight: 600; padding-right: 22px; }
.sr-opt small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.sr-opt:has(input:checked) { border-color: var(--green); background: #f0f8fe; }
.sr-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0 4px; font-size: 13.5px; color: #555; }
.sr-row label { display: flex; align-items: center; gap: 6px; }
.sr-row select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13px; background: #fff; }
.sr-tips { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: #6b737c; line-height: 1.7; }
.sr-go { font-weight: 600; }
.sr-count { position: fixed; inset: 0; z-index: 600; background: rgba(0,0,0,.55); display: grid; place-items: center; align-content: center; gap: 10px; color: #fff; pointer-events: none; }
.sr-count b { font-size: 120px; line-height: 1; text-shadow: 0 4px 20px rgba(0,0,0,.5); animation: srpop 1s ease; }
.sr-count span { font-size: 15px; opacity: .9; }
@keyframes srpop { from { transform: scale(1.6); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }
.sr-bar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 590; display: flex; align-items: center; gap: 6px; background: #1f2329; color: #fff; border-radius: 30px; padding: 6px 8px 6px 6px; box-shadow: 0 8px 28px rgba(0,0,0,.35); user-select: none; }
.sr-grip { cursor: grab; color: #8a929b; padding: 4px 4px 4px 8px; letter-spacing: -2px; touch-action: none; }
.sr-dot { width: 11px; height: 11px; border-radius: 50%; background: #f04c4c; animation: blink 1.2s infinite; }
.sr-bar.paused .sr-dot { animation: none; background: #f0b44c; }
.sr-time { font-variant-numeric: tabular-nums; min-width: 48px; font-size: 14px; }
.sr-bar button { border: 0; background: rgba(255,255,255,.1); color: #fff; height: 34px; min-width: 34px; border-radius: 17px; cursor: pointer; font-size: 15px; padding: 0 10px; }
.sr-bar button:hover { background: rgba(255,255,255,.22); }
.sr-bar button.off { background: #f04c4c; }
.sr-bar .sr-stop { background: #f04c4c; font-weight: 600; font-size: 13.5px; }
.sr-bar .sr-stop:hover { background: #e03535; }
.sr-video { width: 100%; max-height: 52vh; background: #000; border-radius: 10px; display: block; }
.sr-meta { font-size: 12.5px; color: var(--muted); margin: 6px 0 10px; }
.sr-save { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sr-act { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; cursor: pointer; color: var(--text); }
.sr-act:hover { background: #f6f8fa; }
.sr-act span { font-size: 22px; }
.sr-act b { font-size: 13px; font-weight: 600; }
.sr-act small { font-size: 11px; color: var(--muted); text-align: center; }
.sr-act.done { border-color: #18864b; background: #effaf3; }
.sr-act.done b::after { content: " ✓"; color: #18864b; }
.sr-chat { margin-top: 10px; background: #f6f8fa; border-radius: 10px; padding: 10px; font-size: 13px; }
.sr-chat-row { display: flex; gap: 8px; margin-top: 4px; }
.sr-chat-row select { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font: inherit; background: #fff; }
.sr-discard { color: #d63c3c !important; }
.rec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rec-head .btn-light { padding: 6px 12px; font-size: 13px; }
.bubble.video { padding: 4px; max-width: min(420px, 80vw); }
.bubble.video video { width: 100%; max-height: 320px; border-radius: 10px; background: #000; display: block; }
.video-dl { display: block; font-size: 12px; padding: 4px 6px 2px; color: inherit; opacity: .8; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-dl:hover { opacity: 1; text-decoration: underline; }
@media (max-width: 760px) {
    .sr-opts { grid-template-columns: 1fr; }
    .sr-save { grid-template-columns: 1fr 1fr; }
}

/* ---------- 🎥 บันทึกวิดีโอ: อัดตัวเอง ---------- */
.sr-src { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.sr-src button { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; cursor: pointer; color: var(--text); }
.sr-src button span { font-size: 24px; }
.sr-src button b { font-size: 14px; }
.sr-src button small { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.3; }
.sr-src button.on { border-color: var(--green); background: #f0f8fe; box-shadow: 0 0 0 3px rgba(10,138,216,.12); }
.sr-src button:disabled { opacity: .45; cursor: not-allowed; }
.sr-cam { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; margin-bottom: 12px; align-items: start; }
.sr-cam[hidden] { display: none; }
.sr-live { position: relative; aspect-ratio: 16 / 9; background: #111; border-radius: 12px; overflow: hidden; }
.sr-live[hidden] { display: none; }
.sr-live video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sr-live video.mirror, .sr-studio video.mirror { transform: scaleX(-1); }
.sr-live-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #ccc; font-size: 13px; padding: 12px; text-align: center; }
.sr-meter { position: absolute; left: 10px; right: 10px; bottom: 8px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.2); overflow: hidden; }
.sr-meter i { display: block; height: 100%; width: 0; background: #2ecc71; transition: width .08s; }
.sr-devs { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #555; }
.sr-devs label:not(.st-check) { display: flex; flex-direction: column; gap: 3px; }
.sr-devs select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font: inherit; font-size: 13px; background: #fff; max-width: 100%; }
.sr-opt[hidden] { display: none; }
p.sr-tips { padding: 0; margin-top: 8px; }
.sr-studio { position: fixed; inset: 0; z-index: 580; background: #000; display: grid; place-items: center; }
.sr-studio video { width: 100%; height: 100%; object-fit: contain; }
.sr-studio-hint { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.75); font-size: 13px; background: rgba(0,0,0,.4); padding: 6px 14px; border-radius: 16px; pointer-events: none; text-align: center; max-width: 90vw; }
.sr-studio.mini { inset: auto 20px 84px auto; width: 320px; height: 180px; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.4); cursor: pointer; }
.sr-studio.mini video { object-fit: cover; }
.sr-studio.mini .sr-studio-hint { display: none; }
.sr-act-opt { border-style: dashed !important; }
@media (max-width: 760px) {
    .sr-src { grid-template-columns: 1fr; }
    .sr-src button { flex-direction: row; justify-content: flex-start; gap: 10px; text-align: left; }
    .sr-src button small { text-align: left; }
    .sr-cam { grid-template-columns: 1fr; }
    .sr-studio.mini { width: 160px; height: 220px; right: 10px; }
    .sr-bar { bottom: calc(12px + env(safe-area-inset-bottom)); }
}
.rec-tabs { margin-bottom: 12px; }
.rl-dir { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rl-btns { display: flex; gap: 6px; flex-shrink: 0; }
.rl-btns .btn-light { padding: 6px 10px; font-size: 13px; }
.rl-perm { text-align: center; padding: 20px 0; }
.sr-dest { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 12px; background: #fafbfc; }
.sr-dest-h { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.sr-dest .st-check { margin-top: 6px; }
.sr-dest-btns { margin: 4px 0 2px 24px; }
.sr-dest-btns .btn-light { padding: 6px 12px; font-size: 13px; }
.sr-saved { background: #effaf3; border: 1px solid #bfe8cf; color: #18864b; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; }
.sr-saved b { color: #155f37; word-break: break-all; }
.sr-saved small { display: block; color: #4f7a62; font-size: 11.5px; margin-top: 2px; }
.agent-remember { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #effaf3; border: 1px solid #bfe8cf; border-radius: 12px; padding: 12px 14px; margin: 12px 0 4px; }
.agent-remember b { color: #155f37; }
.agent-remember small { display: block; color: #4f7a62; font-size: 12.5px; margin-top: 2px; }
.agent-reinstall { margin-top: 10px; font-size: 13.5px; }
.agent-reinstall summary { cursor: pointer; color: var(--muted); }
.sr-live-msg small { display: block; color: #aab; margin-top: 4px; line-height: 1.5; } .sr-live-msg .sr-retry { margin-top: 10px; padding: 6px 14px; font-size: 13px; } .sr-live-msg b { color: #fff; }
.sr-diag { font-size: 11px; color: #9aa1a9; font-family: ui-monospace, Consolas, monospace; margin-top: 4px; word-break: break-word; }
.sr-gate { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 22px; } .sr-gate b { font-size: 15px; color: #fff; } .sr-gate small { font-size: 12.5px; } .sr-gate .btn-primary, .sr-live-msg .sr-allow { margin-top: 8px; font-size: 14px; padding: 9px 18px; }

/* กล้องฝั่งเราเปิดไม่ได้ระหว่างโทร */
.cam-off { position: absolute; right: 18px; top: 18px; width: 200px; max-width: 32vw; aspect-ratio: 4/3; border-radius: 12px; background: #222; box-shadow: 0 6px 20px rgba(0,0,0,.4);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; text-align: center; font-size: 13px; z-index: 2; }
.cam-off small { opacity: .75; font-size: 11px; line-height: 1.35; }
.cam-off button { margin-top: 4px; border: 0; border-radius: 999px; padding: 5px 12px; background: var(--green); color: #fff; font: inherit; font-size: 12px; cursor: pointer; }
.cam-off button:disabled { opacity: .6; cursor: wait; }
.call-screen.self-side .cam-off { top: 8px; right: 8px; width: 232px; max-width: none; border-radius: 10px; }
.call-screen.peer-sharing .cam-off { top: auto; bottom: 12px; right: 12px; width: 150px; }
.call-screen.self-hidden .cam-off, .call-screen.controlling .cam-off { display: none; }

/* 📦 ส่งไฟล์ตรงถึงเครื่อง (P2P) */
.p2p-panel { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: flex; flex-direction: column; gap: 10px; width: 340px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow-y: auto; pointer-events: none; }
.p2p-panel:empty { display: none; }
.p2p-card { pointer-events: auto; background: var(--panel, #fff); color: var(--text, #222); border: 1px solid var(--line, #e3e6ea); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 12px 14px; font-size: 13px; animation: p2pIn .2s ease-out; }
@keyframes p2pIn { from { transform: translateY(10px); opacity: 0; } }
.p2p-card.offer { border-color: var(--green); box-shadow: 0 0 0 3px rgba(10,138,216,.2), 0 10px 30px rgba(0,0,0,.18); }
.p2p-card.error { border-color: #f0b4b4; }
.p2p-head { display: flex; gap: 10px; align-items: center; }
.p2p-ico { font-size: 24px; flex-shrink: 0; }
.p2p-meta { min-width: 0; flex: 1; }
.p2p-meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p2p-meta small { opacity: .7; }
.p2p-bar { height: 6px; border-radius: 99px; background: rgba(127,127,127,.2); margin-top: 10px; overflow: hidden; }
.p2p-bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .25s; }
.p2p-line { margin-top: 6px; opacity: .85; font-size: 12px; }
.p2p-card.error .p2p-line { color: #d33; opacity: 1; }
.p2p-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.p2p-btns > * { padding: 6px 14px; font-size: 13px; text-decoration: none; }
@media (max-width: 760px) { .p2p-panel { right: 8px; left: 8px; width: auto; bottom: calc(70px + env(safe-area-inset-bottom)); } }

/* ---------- ไอคอนกลุ่ม + ข้อมูลกลุ่ม ---------- */
.avatar.xl { width: 72px; height: 72px; font-size: 28px; }
.avatar.gi span { font-size: 24px; line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.avatar.sm.gi span { font-size: 18px; }
.avatar.lg.gi span { font-size: 50px; }
.avatar.xl.gi span { font-size: 38px; }
.avatar.lg.group svg { width: 56px; height: 56px; }
.avatar.xl.group svg { width: 40px; height: 40px; }
.avatar.group svg { fill: #fff; }
.chat-gi { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 15px; margin-right: 8px; vertical-align: -5px; }
#chatName .muted { font-weight: 400; font-size: .85em; }

.gi-picker { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--hover); }
.gi-preview { grid-row: span 2; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.gi-preview small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.gi-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.gi-color { width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); transition: transform .12s; }
.gi-color:hover { transform: scale(1.12); }
.gi-color.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text); }
.gi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; max-height: 172px; overflow-y: auto; padding: 2px; }
.gi-ico { height: 38px; border: 0; border-radius: 10px; background: #fff; font-size: 21px; cursor: pointer; display: grid; place-items: center; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; transition: background .12s, transform .12s; }
.gi-ico:hover { transform: scale(1.08); }
.gi-ico.on { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.gi-ico .avatar.sm { width: 26px; height: 26px; }
.gi-ico .avatar.sm svg { width: 16px; height: 16px; }
@media (max-width: 520px) { .gi-picker { grid-template-columns: 1fr; } .gi-preview { grid-row: auto; flex-direction: row; } .gi-preview .avatar.lg { width: 64px; height: 64px; } .gi-preview .avatar.lg.gi span { font-size: 34px; } }

.gr-head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.gr-title { flex: 1; min-width: 140px; }
.gr-title b { display: block; font-size: 18px; word-break: break-word; }
.gr-title small { color: var(--muted); }
.gr-sec { margin: 14px 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.gr-members { max-height: 300px; overflow-y: auto; }
.gr-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: #fff4d6; color: #a46b00; font-size: 11px; font-weight: 600; vertical-align: 1px; }
.gr-add { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.gr-add summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.gr-add[open] summary { margin-bottom: 8px; }
.gr-foot { justify-content: space-between; margin-top: 16px; }
.danger-text { color: var(--danger) !important; }
.gr-note { font-size: 12px; text-align: right; margin: 6px 0 0; }

/* แอปที่ติดตั้ง: บังคับเปิดการแจ้งเตือน */
.push-gate { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 16px; background: rgba(15,23,32,.72); backdrop-filter: blur(6px); }
.pg-card { width: 100%; max-width: 440px; background: #fff; color: var(--text); border-radius: 20px; padding: 28px 24px 18px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); max-height: calc(100vh - 32px); overflow-y: auto; }
.pg-ico { width: 76px; height: 76px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font-size: 40px; background: #e6f3fc; animation: pgRing 2.4s ease-in-out infinite; }
@keyframes pgRing { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-14deg); } 85% { transform: rotate(12deg); } 92% { transform: rotate(-6deg); } }
.pg-card h2 { margin: 0 0 8px; font-size: 20px; }
.pg-card p { margin: 0 0 16px; color: #4a5562; font-size: 14px; line-height: 1.6; }
.pg-quiet { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 99px; background: var(--hover); font-size: 12px; }
.pg-btn { width: 100%; padding: 12px; font-size: 16px; }
.pg-hint { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.pg-denied { text-align: left; background: #fff4f4; border: 1px solid #f5c8c8; border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.pg-denied ol { margin: 6px 0 0 18px; padding: 0; line-height: 1.6; }
.pg-out { margin-top: 14px; font-size: 12px; color: var(--muted); }
.st-check.st-strong { font-weight: 600; padding: 8px 10px; border-radius: 10px; background: var(--hover); }

/* 🖼 เปลี่ยนพื้นหลังวิดีโอ */
.sr-bg { grid-column: 1 / -1; font-size: 13px; }
.sr-bg[hidden] { display: none; }
.sr-bg > small { color: var(--muted); }
.bgp { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.bgp-row { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; }
.bgp-it { flex: 0 0 auto; width: 78px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px; border: 2px solid transparent; border-radius: 10px; background: var(--hover); cursor: pointer; font: inherit; color: var(--text); }
.bgp-it:hover { border-color: #b9d9ef; }
.bgp-it.on { border-color: var(--green); background: #e6f3fc; }
.bgp-it img, .bgp-it .bgp-sw, .bgp-it .bgp-ico { width: 66px; height: 38px; border-radius: 6px; object-fit: cover; display: grid; place-items: center; }
.bgp-it .bgp-sw { box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.bgp-it .bgp-ico { background: #fff; font-size: 18px; }
.bgp-it .bgp-blur { background: linear-gradient(135deg, #9fb3c8, #d9c6a5); filter: blur(.4px); }
.bgp-it small { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.chat-title.clickable { cursor: pointer; border-radius: 10px; padding: 2px 6px; margin-left: -6px; }
.chat-title.clickable:hover { background: var(--hover); }
.chat-members-link { color: var(--green); font-weight: 600; }
.gr-search { margin: 4px 0 6px; }
.gr-members .item { cursor: pointer; }

/* ---------- 🎨 ธีมเทศกาล ---------- */
.festive-banner { display: flex; align-items: center; gap: 10px; margin: 0 16px 8px; padding: 8px 10px; border-radius: 12px;
    background: linear-gradient(120deg, color-mix(in srgb, var(--green) 16%, #fff), color-mix(in srgb, var(--green) 6%, #fff)); border: 1px solid color-mix(in srgb, var(--green) 30%, #fff); animation: fbIn .4s ease-out; }
@keyframes fbIn { from { opacity: 0; transform: translateY(-6px); } }
.fb-ico { font-size: 26px; line-height: 1; }
.fb-txt { flex: 1; min-width: 0; }
.fb-txt b { display: block; font-size: 13px; color: var(--green-dark); }
.fb-txt small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-btn { border: 0; background: transparent; color: var(--muted); font-size: 13px; padding: 4px 6px; border-radius: 8px; }
.fb-btn:hover { background: rgba(0,0,0,.06); }
html[data-festive] .rail { background-image: linear-gradient(180deg, transparent 60%, color-mix(in srgb, var(--green) 25%, transparent)); }
html[data-festive] .list-header h2 { color: var(--green-dark); }
html.festive-mono .avatar img, html.festive-mono .msg img { filter: grayscale(.4); }

.festive-fx { position: fixed; inset: 0; pointer-events: none; z-index: 8000; overflow: hidden; }
.festive-fx span { position: absolute; top: -50px; opacity: 0; animation: fxFall linear forwards; will-change: transform, opacity; }
.festive-fx.rise span { top: auto; bottom: -50px; animation-name: fxRise; }
@keyframes fxFall { 0% { opacity: 0; transform: translate(0, 0) rotate(0); } 10% { opacity: .95; } 90% { opacity: .9; } 100% { opacity: 0; transform: translate(var(--drift), 105vh) rotate(200deg); } }
@keyframes fxRise { 0% { opacity: 0; transform: translate(0, 0); } 10% { opacity: .95; } 85% { opacity: .85; } 100% { opacity: 0; transform: translate(var(--drift), -105vh); } }

.fs-row { display: flex; gap: 8px; flex-wrap: wrap; }
.fs-row .select { flex: 1; min-width: 220px; }
.fs-next { margin-top: 10px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fs-chip { padding: 3px 10px; border-radius: 99px; background: var(--hover); cursor: pointer; }
.fs-chip:hover { background: color-mix(in srgb, var(--green) 15%, #fff); }

/* ---------- ธีมโปรไฟล์ + เปลี่ยนรหัสผ่าน ---------- */
.profile-view.has-cover { position: relative; margin: -16px -16px 0; padding: 0 16px; }
.pv-cover { height: 130px; margin: 0 -16px; }
.profile-view.has-cover > .avatar, .pv-avatar-edit { margin: -52px auto 10px; position: relative; display: block; width: max-content; }
.profile-view.has-cover .avatar.lg { border: 4px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.pv-avatar-edit { cursor: pointer; }
.pv-avatar-edit .avatar { margin: 0 !important; }
.pv-cam { position: absolute; right: 2px; bottom: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 15px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.pt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.pt-it { border: 2px solid transparent; border-radius: 10px; background: var(--hover); padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; color: var(--text); }
.pt-it i { display: block; width: 100%; height: 34px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.pt-it small { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pt-it.on { border-color: var(--green); background: #e6f3fc; }
.pw-box { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 4px 0 6px; }
.pw-box summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.pw-box[open] summary { margin-bottom: 8px; }
.pw-box input:disabled { background: var(--hover); cursor: not-allowed; }
.pw-msg { font-size: 12px; min-height: 16px; }
.pw-msg.err { color: var(--danger); }
.pw-msg.ok { color: #1f8a4c; }

.fs-status { font-size: 13px; background: var(--hover); padding: 6px 10px; border-radius: 8px; }
.fs-until { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.fs-until input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; }
.fs-auto { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.fs-auto summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.fs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; margin-top: 8px; }
.fs-th { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.fs-th .link-btn { margin: 0 0 0 auto; padding: 0 4px; font-size: 12px; line-height: 1.4; align-self: center; }
.fs-th input { margin: 0; }

/* ควบคุมด้วยรหัส (unattended) */
.ra-tabs { display: grid; gap: 12px; }
.ra-opt { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.ra-opt > b { font-size: 14px; }
.ra-msg { font-size: 12.5px; min-height: 16px; margin: 2px 0 6px; }
.ra-msg.err { color: var(--danger); }
.ra-msg.ok { color: #1f8a4c; }
@media (min-width: 560px) { .ra-tabs { grid-template-columns: 1fr 1fr; align-items: start; } }

/* 🖲 Remote Desktop (ควบคุมเครื่องอื่น) */
.rd-msg { font-size: 12.5px; min-height: 16px; margin: 2px 0 6px; }
.rd-msg.err { color: var(--danger); }
.rd-view { position: fixed; inset: 0; z-index: 2000; background: #0b0f14; display: flex; flex-direction: column; }
.rd-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #121922; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); flex-wrap: wrap; }
.rd-bar .rd-dot { width: 10px; height: 10px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 8px #2ecc71; flex-shrink: 0; }
.rd-bar .rd-name { font-size: 14px; }
.rd-bar .rd-stat { font-size: 12px; color: #9fb0c0; }
.rd-bar .rd-spacer { flex: 1; }
.rd-bar .rd-text { flex: 0 1 300px; min-width: 120px; background: #0b1017; border: 1px solid rgba(255,255,255,.14); color: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; }
.rd-bar button { border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.rd-bar button:hover { background: rgba(255,255,255,.22); }
.rd-bar .rd-stop { background: #e04848; }
.rd-stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: hidden; }
.rd-img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; cursor: crosshair; outline: none; background: #000; display: block; }
.rd-wait { position: absolute; color: #9fb0c0; text-align: center; font-size: 15px; line-height: 1.7; pointer-events: none; }
.rd-wait small { color: #6b7a88; font-size: 12px; }

/* 🖥 Remote Desktop — หน้าหลักแบบ AnyDesk */
.rdh { position: fixed; inset: 0; z-index: 1900; background: #0e1420; color: #e8eef6; display: flex; flex-direction: column; overflow: auto; }
.rdh-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: #121a2a; border-bottom: 1px solid rgba(255,255,255,.08); position: sticky; top: 0; z-index: 2; }
.rdh-head .rdh-logo { font-size: 22px; }
.rdh-head h2 { margin: 0; font-size: 18px; }
.rdh-head .rdh-sub { font-size: 12.5px; color: #8ea0b6; }
.rdh-head .rdh-grow { flex: 1; }
.rdh-x { border: 0; background: rgba(255,255,255,.1); color: #fff; width: 34px; height: 34px; border-radius: 9px; font-size: 16px; cursor: pointer; }
.rdh-x:hover { background: rgba(255,255,255,.2); }
.rdh-body { flex: 1; display: grid; gap: 18px; padding: 20px; max-width: 980px; width: 100%; margin: 0 auto; align-content: start; }
@media (min-width: 760px) { .rdh-body { grid-template-columns: 1fr 1fr; } }
.rdh-card { background: #16203200; background: #161f30; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 18px; }
.rdh-card-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 14px; }
.rdh-card-h span { font-size: 18px; }
.rdh-id-box { background: #0e1726; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.rdh-id-label { font-size: 12px; color: #8ea0b6; margin-bottom: 4px; }
.rdh-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rdh-id b { font-size: 26px; letter-spacing: .5px; color: #fff; word-break: break-all; }
.rdh-copy { border: 0; background: rgba(90,160,255,.18); color: #9fc6ff; border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.rdh-copy:hover { background: rgba(90,160,255,.32); }
.rdh-agent { margin-top: 12px; font-size: 13px; color: #b9c6d6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rdh-agent a { color: #9fc6ff; }
.rdh-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.rdh-dot.on { background: #2ecc71; box-shadow: 0 0 8px #2ecc71; }
.rdh-dot.off { background: #6b7a88; }
.rdh-unatt { background: #0e1726; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 14px; }
.rdh-unatt-h { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.rdh-unatt .ok { color: #46d07f; font-size: 13px; margin: 4px 0; }
.rdh-unatt .muted { color: #8ea0b6; font-size: 13px; margin: 4px 0; }
.rdh-warn { background: #3a2e12; color: #e7c66b; border-radius: 9px; padding: 8px 10px; font-size: 12.5px; margin: 6px 0 0; }
.rdh-note { font-size: 12px; color: #8ea0b6; line-height: 1.6; margin: 14px 0 0; }
.rdh .field { margin-bottom: 12px; }
.rdh .field label { display: block; font-size: 12.5px; color: #8ea0b6; margin-bottom: 5px; }
.rdh .field input, .rdh .select { width: 100%; background: #0e1726; border: 1px solid rgba(255,255,255,.14); color: #fff; border-radius: 9px; padding: 10px 12px; font: inherit; font-size: 14px; }
.rdh .field input:focus, .rdh .select:focus { outline: none; border-color: #4b8ef0; }
.rdh-two { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.rdh-msg { font-size: 12.5px; min-height: 16px; margin: 2px 0 8px; color: #b9c6d6; }
.rdh-msg.err { color: #ff8f8f; }
.rdh-msg.ok { color: #46d07f; }
.rdh-connect { width: 100%; padding: 12px; font-size: 15px; }
.rdh-ra-act { display: flex; gap: 8px; }
.rdh-recent { margin-top: 16px; }
.rdh-recent-h { font-size: 12px; color: #8ea0b6; margin-bottom: 8px; }
.rdh-rec { display: flex; align-items: center; gap: 10px; background: #0e1726; border: 1px solid rgba(255,255,255,.06); border-radius: 10px; padding: 9px 11px; margin-bottom: 7px; cursor: pointer; }
.rdh-rec:hover { border-color: rgba(90,160,255,.4); }
.rdh-rec-ico { font-size: 20px; }
.rdh-rec-main { flex: 1; min-width: 0; }
.rdh-rec-main b { display: block; font-size: 14px; color: #fff; }
.rdh-rec-main small { color: #8ea0b6; font-size: 12px; }
.rdh-rec-x { border: 0; background: transparent; color: #6b7a88; font-size: 14px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.rdh-rec-x:hover { background: rgba(255,255,255,.08); color: #ff8f8f; }

/* Remote Desktop Pro — ตัวเลือก + ปุ่มในแถบ */
.rdh-pro { background: #0e1726; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: grid; gap: 8px; }
.rdh-chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c7d2de; cursor: pointer; }
.rdh-chk input { width: 16px; height: 16px; accent-color: #4b8ef0; }
.rd-bar button.on { background: #e0a800; color: #1a1300; }
.rd-bar #rdRec.on { background: #e04848; color: #fff; }

/* Remote Desktop — แสดง SMChat ID คู่กับเลข ADDRESS */
.rdh-id2 { margin-top: 10px; font-size: 13px; color: #b9c6d6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rdh-id2 #rdhChatId { color: #fff; font-weight: 700; background: #0b1017; border: 1px solid rgba(255,255,255,.1); border-radius: 7px; padding: 2px 9px; }
.rdh-copy.sm { padding: 4px 10px; font-size: 12px; }

/* Remote Desktop — ตัวเลือกขั้นสูง (รวมเมนูเดียว) */
.rdh-adv { margin-bottom: 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: #0e1726; }
.rdh-adv > summary { cursor: pointer; padding: 10px 12px; font-size: 13px; color: #b9c6d6; list-style: none; user-select: none; }
.rdh-adv > summary::-webkit-details-marker { display: none; }
.rdh-adv[open] > summary { border-bottom: 1px solid rgba(255,255,255,.08); color: #fff; }
.rdh-adv .rdh-chk { padding: 8px 12px 0; }
.rdh-adv-note { font-size: 11.5px; color: #7d8ca0; margin: 8px 12px 10px; }

/* Remote Desktop — โหมดแสดงผล "ขนาดจริง" (เลื่อนดูได้) */
.rd-stage.rd-actual { place-items: start; overflow: auto; }
.rd-img.rd-actual { max-width: none; max-height: none; width: auto; height: auto; }

/* Remote Desktop — เมนูสลับจอ */
.rd-bar .rd-mon { background: #0b1017; border: 1px solid rgba(255,255,255,.14); color: #fff; border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13px; max-width: 220px; }
.rd-bar .rd-mon option { background: #121922; color: #fff; }

/* Remote Desktop — ข้อความช่วยในช่องรหัส */
.rdh-inline { font-weight: 400; font-size: 11px; color: #7d8ca0; }
