/* ============================================================================
 *  QuickChat — スタイル
 * ==========================================================================*/
:root {
  --bg: #eef1f6; --surface: #ffffff; --side: #f7f9fc;
  --text: #1f2733; --muted: #6b7785; --hint: #9aa6b2;
  --line: #e4e9f0; --line2: #d6deea;
  --brand: #2f6df6; --brand-bg: #eaf1ff; --brand-line: #cfe0ff;
  --mine: #2f6df6; --mine-text: #fff; --theirs: #ffffff;
  --on: #28c76f; --danger: #e0455e;
  --r: 12px; --r-lg: 16px;
  --shadow: 0 6px 22px rgba(20,35,70,.08);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); } /* ページ自体はスクロールさせない（スクロールは各内部領域のみ） */
body { display: flex; flex-direction: column; }   /* 上部固定ヘッダー＋その下に本体 */
/* ===== 上部固定ヘッダー（左=タイトル / 右=言語・Googleログイン） ===== */
.app-header { flex: none; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 40; }
.hdr-brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; white-space: nowrap; }
.hdr-brand .by { font-size: 11px; font-weight: 400; color: var(--muted); }
.hdr-right { display: flex; align-items: center; gap: 12px; }
.app-header .lang-row { margin-top: 0; }
.hdr-user { display: flex; align-items: center; gap: 8px; }
.hdr-user .hdr-name { font-weight: 600; font-size: 14px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.view { flex: 1 1 auto; min-height: 0; }   /* ヘッダーの下の残り全部 */
.lt-q { color: var(--brand); }
.icon-btn { border: 1px solid var(--line2); background: #fff; border-radius: 9px; width: 34px; height: 34px; cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.icon-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.link-btn { border: none; background: none; color: var(--brand); cursor: pointer; font-size: 14px; }

/* ---------- ログイン ---------- */
.login-view { display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 40px 34px; max-width: 420px; width: 100%; text-align: center; }
.login-ico { display: block; margin: 0 auto 14px; border-radius: 18px; }
.brand-big { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.brand-big .by { font-size: 13px; font-weight: 500; color: var(--muted); }
.login-lead { color: var(--muted); line-height: 1.7; margin: 16px 0 24px; font-size: 14px; }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.login-note { color: var(--hint); font-size: 12px; margin-top: 20px; line-height: 1.6; }

/* ---------- アプリ枠 ---------- */
.app-view { display: grid; grid-template-columns: 300px 1fr 340px; grid-template-rows: minmax(0, 1fr); overflow: hidden; }

/* ---------- 右パネル（概要固定＋🔖/📅切替） ---------- */
.cal-panel { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-tabs { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.panel-tab { position: relative; border: 1px solid transparent; background: transparent; border-radius: 8px; font-size: 18px; line-height: 1; padding: 5px 9px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.panel-tab:hover { background: #eef2f8; }
.panel-tab.active { background: var(--brand-bg); border-color: var(--brand); }
.panel-tab .tab-svg { width: 20px; height: 20px; display: block; color: var(--muted); }
.panel-tab.active .tab-svg { color: var(--brand); }
.task-badge { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; border-radius: 999px; text-align: center; }
.panel-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.panel-content.hidden { display: none; }
.panel-view.hidden { display: none; }
.panel-toggle { display: none; }   /* デスクトップは常時パネル表示なので不要 */
#bm-list { padding: 8px 10px; }
/* メモ（自分だけ） */
.memo-text { width: 100%; box-sizing: border-box; height: 260px; border: none; border-bottom: 1px solid var(--line); padding: 12px 13px; font-size: 14px; font-family: inherit; line-height: 1.6; resize: vertical; }
.memo-text:focus { outline: none; background: rgba(47,109,246,.03); }
/* 電卓 */
.calc { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.calc-modes { display: flex; align-items: center; gap: 6px; }
.calc-mode { flex: 1; border: 1px solid var(--line2); background: #fff; border-radius: 9px; padding: 7px 0; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.calc-mode.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.calc-deg { flex: none; border: 1px solid var(--line2); background: #fff; border-radius: 9px; padding: 7px 12px; font-size: 12px; font-weight: 700; color: var(--brand); cursor: pointer; }
.calc-sci-keys { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.calc-sci-keys .calc-key.fn { background: #f1f5fb; color: var(--text); font-size: 15px; padding: 11px 0; font-weight: 600; }
.calc-sci-keys .calc-key.fn:hover { border-color: var(--brand); }
#panel-calc:not(.sci-on) .calc-sci-keys, #panel-calc:not(.sci-on) .calc-deg { display: none; }
.calc-display { background: #0f1722; color: #fff; border-radius: 10px; padding: 14px 16px; font-size: 26px; font-weight: 600; text-align: right; min-height: 30px; word-break: break-all; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.calc-key { border: 1px solid var(--line2); background: #fff; border-radius: 10px; font-size: 18px; padding: 12px 0; cursor: pointer; color: var(--text); }
.calc-key:hover { border-color: var(--brand); }
.calc-key.op { background: var(--brand-bg); color: var(--brand); font-weight: 700; }
.calc-key.eq { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.calc-send { border: none; background: var(--brand); color: #fff; border-radius: 10px; padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer; }
.calc-send:hover { filter: brightness(1.06); }
/* トーク概要欄 */
.note-sec { flex: none; border-bottom: 1px solid var(--line); padding: 11px 13px; display: flex; flex-direction: column; gap: 6px; }   /* 概要は固定表示 */
.note-head { display: flex; align-items: center; justify-content: space-between; }
.note-ttl { font-weight: 700; font-size: 13px; }
.note-view { font-size: 13px; line-height: 1.6; color: var(--text); max-height: 160px; overflow-y: auto; word-break: break-word; }
.note-view a { color: var(--brand); text-decoration: underline; word-break: break-all; }
.note-empty { color: var(--hint); font-size: 12px; }
.note-editor { display: flex; flex-direction: column; gap: 7px; }
.note-editor textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line2); border-radius: 9px; padding: 8px 10px; font-size: 13px; font-family: inherit; resize: vertical; min-height: 84px; max-height: 220px; }
.note-editor textarea:focus { outline: none; border-color: var(--brand); }
.note-acts { display: flex; align-items: center; gap: 8px; }
.note-meta { font-size: 11px; color: var(--hint); }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.cal-open { text-decoration: none; color: var(--brand); font-size: 16px; }
.cal-sec { display: flex; flex-direction: column; min-height: 0; padding: 8px 10px; }
.cal-month-sec { flex: 0 0 auto; }
.cal-day-sec { flex: 1 1 auto; }
.cal-sec-t { font-size: 11px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; margin: 2px 4px 6px; }
.cal-frame { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.cal-month-sec .cal-frame { height: 300px; }
.cal-day-sec .cal-frame { height: 230px; }
.cal-note { font-size: 11px; color: var(--hint); line-height: 1.6; padding: 8px 14px 12px; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.side-tools { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.login-hint { font-size: 13px; color: var(--brand); font-weight: 600; margin-top: 14px; }
.side-head .brand { display: flex; align-items: center; gap: 7px; font-size: 18px; font-weight: 800; }
.side-head .brand .by { font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.brand-ico { width: 24px; height: 24px; border-radius: 7px; flex: none; }
.me { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.me-avatar, .c-avatar, .ch-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-bg); color: var(--brand); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex: none; overflow: hidden; }
.av-img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
.me-avatar, .me-name { cursor: pointer; }
.me-avatar:hover { box-shadow: 0 0 0 2px var(--brand); }
/* プロフィール編集 */
.pf-av-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.pf-av { width: 76px; height: 76px; border-radius: 50%; background: var(--brand-bg); color: var(--brand); font-weight: 700; font-size: 30px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; flex: none; }
.pf-av-btns { display: flex; flex-direction: column; gap: 7px; }
.pf-label { display: block; font-size: 12px; color: var(--muted); margin: 2px 0 5px; }
.pf-input { width: 100%; box-sizing: border-box; border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; }
.pf-input:focus { outline: none; border-color: var(--brand); }
.pf-note { font-size: 12px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }
.me-name { flex: 1; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-row { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.lang-row .lang-ico { font-size: 15px; flex: none; }
.lang-select { margin-top: 8px; width: 100%; border: 1px solid var(--line2); border-radius: 8px; padding: 5px 8px; font-size: 12px; font-family: inherit; background: #fff; color: var(--text); cursor: pointer; }
.lang-row .lang-select { margin-top: 0; flex: 1; }
.login-lang { margin-top: 16px; }
.login-lang .lang-select { width: auto; min-width: 140px; margin: 0 auto; display: inline-block; }

.add-box { padding: 12px 16px 6px; }
.add-form { display: flex; gap: 6px; }
.add-form input { flex: 1; height: 36px; border: 1px solid var(--line2); border-radius: 9px; padding: 0 10px; font-size: 13px; background: #fff; }
.add-form input:focus { outline: none; border-color: var(--brand); }
.add-form button { width: 36px; height: 36px; border: none; border-radius: 9px; background: var(--brand); color: #fff; font-size: 20px; cursor: pointer; flex: none; }
.add-msg { font-size: 12px; color: var(--muted); min-height: 16px; margin-top: 5px; }
.qr-actions { display: flex; gap: 6px; margin-top: 6px; }
.qr-act { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line2); background: #fff; border-radius: 9px; padding: 7px 6px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.qr-act:hover { border-color: var(--brand); color: var(--brand); }
.qr-act .qr-ico { font-size: 14px; line-height: 1; }
/* QR表示 / スキャン モーダル */
.qr-sub { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 0 0 4px; text-align: center; }
.qr-box .modal-body, .scan-box .modal-body { display: flex; flex-direction: column; align-items: center; }
.qr-canvas { width: 220px; max-width: 70vw; margin: 12px auto 8px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr-canvas svg { width: 100%; height: auto; display: block; }
.qr-id-text { display: block; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); word-break: break-all; text-align: center; }
.qr-fail { color: var(--danger); font-size: 13px; padding: 24px 8px; }
.scan-video-wrap { position: relative; width: 280px; max-width: 78vw; aspect-ratio: 1; margin: 12px auto; border-radius: 14px; overflow: hidden; background: #0d0f14; }
#scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 14%; border: 3px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25); }
.scan-msg { font-size: 13px; color: var(--text); text-align: center; min-height: 18px; margin: 4px 0 0; }

.pending { padding: 6px 16px; }
.pending-h, .contacts-head { font-size: 11px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; }
.pending-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; padding: 5px 0; color: var(--text); }
.pr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-state { color: var(--hint); font-size: 11px; flex: none; }
.req-acts { display: flex; gap: 6px; flex: none; }
.req-ok, .req-no { border: none; border-radius: 7px; font-size: 12px; padding: 4px 10px; cursor: pointer; }
.req-ok { background: var(--brand); color: #fff; }
.req-no { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.contacts-head { display: flex; align-items: center; gap: 5px; padding: 10px 16px 6px; cursor: pointer; user-select: none; }
.contacts-head .fold-label { flex: 1; }
.contacts-head .link-btn { flex: none; }
.fold-caret { font-size: 10px; color: var(--hint); transition: transform .15s; flex: none; }
.contacts-head.collapsed .fold-caret { transform: rotate(-90deg); }
.contacts-head.collapsed + .contacts { display: none; }

.contacts { flex: 1; overflow-y: auto; min-height: 0; padding: 0 8px 12px; }
.contacts-empty { color: var(--hint); font-size: 13px; text-align: center; padding: 26px 12px; line-height: 1.7; }
.contact-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; position: relative; }
.contact-row:hover { background: #eef2f8; }
.contact-row.sel { background: var(--brand-bg); }
.c-avatar { position: relative; }
.c-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--hint); flex: none; margin-left: -16px; margin-top: 16px; border: 2px solid var(--side); }
.c-dot.on { background: var(--on); }
.c-name { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-unread { background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center; }
.self-chat { padding: 4px 8px 0; }
.self-avatar { background: var(--brand-bg); }
.news-row-wrap { padding: 0 8px 4px; }
.news-ic { background: #fff4e6; }
/* ニュース表示ビュー */
.news-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.news-avatar { background: #fff4e6; }
.news-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 10px 16px; }
.news-item { display: block; text-decoration: none; color: inherit; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); margin-bottom: 8px; background: #fff; }
.news-item:hover { border-color: var(--brand); background: #fbfdff; }
.news-t { font-size: 14px; line-height: 1.5; color: var(--text); }
.news-m { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 11.5px; color: var(--hint); }
.news-cat { flex: none; background: var(--brand-bg); color: var(--brand); font-weight: 700; font-size: 10.5px; padding: 1px 7px; border-radius: 999px; }
.news-src { font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.news-time { flex: none; margin-left: auto; }
/* ニュースのフィード選択 */
.news-feed-list { max-height: 52vh; overflow-y: auto; }
.nf-cat { font-size: 11px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; margin: 12px 2px 5px; }
.nf-cat:first-child { margin-top: 0; }
.nf-item { display: flex; align-items: center; gap: 9px; padding: 7px 4px; font-size: 14px; cursor: pointer; }
.nf-item input { width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.news-empty { color: var(--hint); font-size: 13px; text-align: center; padding: 30px 12px; }
/* 新聞レイアウト（画像つき・レスポンシブなカードグリッド） */
.news-list.paper { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-items: start; align-content: start; padding: 12px 12px 20px; }
.np-item { display: block; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; text-decoration: none; color: inherit; }
.np-item:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(47,109,246,.08); }
.np-img { background: #eef2f8; line-height: 0; }
.np-img img { width: 100%; height: auto; display: block; max-height: 240px; object-fit: cover; }
.np-body { padding: 10px 12px 11px; }
.np-item.no-img .np-body { padding-top: 12px; }
.np-t { font-size: 14px; font-weight: 600; line-height: 1.45; color: var(--text); }
.np-item .news-m { margin-top: 7px; }
/* タスク */
.task-list { padding: 8px 10px 14px; }
.task-sec-h { font-size: 11px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; margin: 8px 2px 6px; }
.task-item { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; margin-bottom: 7px; background: #fff; }
.task-item.done { opacity: .55; }
.task-item.done .task-ttl { text-decoration: line-through; }
.task-chk { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line2); background: #fff; color: #fff; font-size: 13px; font-weight: 800; cursor: pointer; line-height: 1; }
.task-chk.on { background: var(--on, #22a06b); border-color: var(--on, #22a06b); }
.task-body { flex: 1; min-width: 0; }
.task-ttl { font-size: 13.5px; color: var(--text); line-height: 1.5; word-break: break-word; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 11.5px; color: var(--hint); }
.task-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62%; }
.task-due.over { color: var(--danger); font-weight: 700; }
.task-acts { flex: none; display: flex; flex-direction: column; gap: 2px; align-items: center; }
.task-cal { border: none; background: transparent; cursor: pointer; font-size: 14px; padding: 2px; line-height: 1; opacity: .8; }
.task-cal:hover { opacity: 1; }
.task-del { flex: none; border: none; background: transparent; cursor: pointer; font-size: 14px; color: var(--hint); padding: 2px; }
.task-del:hover { color: var(--danger); }
.task-empty { color: var(--hint); font-size: 13px; text-align: center; padding: 16px 12px; }
.task-title-in { resize: vertical; min-height: 60px; font-family: inherit; line-height: 1.5; }
.c-fav { border: none; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; color: var(--hint); padding: 2px 3px; flex: none; opacity: 0; transition: opacity .12s; }
.contact-row:hover .c-fav { opacity: 1; }                 /* 非お気に入りはホバーで☆表示 */
.c-fav.on { opacity: 1; color: #f5b301; }                 /* お気に入りは常に★（金） */

/* ---------- グループ ---------- */
.groups-list { flex: 0 0 auto; max-height: 28vh; }
.g-avatar { background: #ece6ff; color: #6b46e0; border-radius: 9px; }
.ch-avatar.g-avatar { border-radius: 9px; }
.g-count { font-size: 11px; color: var(--hint); flex: none; }

/* ---------- 会話 ---------- */
.main { background: var(--bg); min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.conv-empty { flex: 1; display: flex; align-items: center; justify-content: center; }
.conv-empty-inner { text-align: center; color: var(--hint); }
.ce-logo { font-size: 26px; font-weight: 800; opacity: .5; margin-bottom: 8px; }
.conv { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.conv-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ch-info { flex: 1; min-width: 0; }
.ch-name { font-weight: 700; font-size: 15px; }
.ch-status { font-size: 12px; color: var(--hint); }
.ch-status.on { color: var(--on); }
.ch-actions { display: flex; gap: 8px; }

.msgs { flex: 1; overflow-y: auto; min-height: 0; padding: 18px 18px 10px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 72%; display: flex; flex-direction: column; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.m-bubble { padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.55; word-break: break-word; white-space: normal; }
.msg.mine .m-bubble { background: var(--mine); color: var(--mine-text); border-bottom-right-radius: 5px; }
.msg.theirs .m-bubble { background: var(--theirs); color: var(--text); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.m-bubble a { color: inherit; text-decoration: underline; }
.msg.theirs .m-bubble a { color: var(--brand); }
.m-sender { font-size: 11px; font-weight: 700; color: #6b46e0; margin: 0 4px 2px; }
.m-actions { display: none; gap: 6px; margin-top: 5px; }
.msg:hover .m-actions { display: flex; }                 /* 全メッセージで操作を表示 */
.m-actions button { border: 1px solid var(--line2); background: #fff; border-radius: 8px; font-size: 17px; line-height: 1; padding: 6px 10px; cursor: pointer; color: var(--muted); }
.m-actions button:hover { border-color: var(--brand); color: var(--brand); }
/* 引用（返信先） */
.m-quote { border-left: 3px solid var(--brand); background: rgba(127,127,127,.08); border-radius: 6px; padding: 4px 9px; margin-bottom: 4px; max-width: 100%; cursor: pointer; font-size: 12px; }
.m-quote .mq-name { display: block; font-weight: 700; color: var(--brand); }
.m-quote .mq-text { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* リアクションチップ */
.m-reacts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.m-react { border: 1px solid var(--line2); background: #fff; border-radius: 999px; font-size: 15px; line-height: 1; padding: 5px 11px; cursor: pointer; color: var(--text); }
.m-react.on { border-color: var(--brand); background: var(--brand-bg); color: var(--brand); font-weight: 700; }
/* メッセージ翻訳の表示 */
.m-trans { margin-top: 4px; max-width: 100%; font-size: 13.5px; line-height: 1.55; color: var(--text); background: rgba(47,109,246,.06); border-left: 3px solid var(--brand); border-radius: 6px; padding: 6px 10px; word-break: break-word; }
.m-trans a { color: var(--brand); text-decoration: underline; }
.m-trans-orig { border: none; background: transparent; color: var(--brand); cursor: pointer; font-size: 11px; text-decoration: underline; padding: 0 0 0 4px; }
/* メッセージのその場編集欄 */
.msg.editing { max-width: 100%; width: 100%; align-self: stretch; align-items: flex-end; } /* 編集中は入力欄と同じ幅・チャット欄の右寄せ */
.m-editbox { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.msg.editing .m-editbox { width: 100%; }
.m-edit-ta { width: 100%; box-sizing: border-box; border: 1px solid var(--brand); border-radius: 12px; padding: 9px 12px; font-size: 14px; font-family: inherit; line-height: 1.5; resize: none; overflow-y: hidden; }
.m-edit-ta:focus { outline: none; }
.m-edit-acts { display: flex; align-items: center; gap: 8px; }
.m-edit-hint { font-size: 11px; color: var(--hint); }
.m-edit-acts .m-edit-cancel { border: 1px solid var(--line2); background: #fff; color: var(--muted); border-radius: 8px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.m-edit-acts .m-edit-save { border: none; background: var(--brand); color: #fff; border-radius: 8px; padding: 5px 14px; font-size: 13px; cursor: pointer; }
/* 絵文字ピッカー */
.react-pop { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); padding: 6px 9px; display: flex; gap: 4px; }
.react-pop .rp-emoji { border: none; background: transparent; font-size: 30px; line-height: 1; padding: 6px 8px; border-radius: 12px; cursor: pointer; }
.react-pop .rp-emoji:hover { background: var(--brand-bg); transform: scale(1.15); }
/* 返信バー */
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 7px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.reply-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.reply-to { font-size: 11px; color: var(--brand); font-weight: 600; }
.reply-snip { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ハイライト（引用/ブックマークからジャンプ時） */
.msg-flash > * { animation: msgflash 1.5s ease; }
@keyframes msgflash { 0%, 40% { background: rgba(47,109,246,.16); } 100% { background: transparent; } }
/* ブックマーク一覧 */
.bm-empty { color: var(--hint); font-size: 13px; padding: 14px 4px; text-align: center; }
.bm-item { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; cursor: pointer; }
.bm-item:hover { border-color: var(--brand); }
.bm-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.bm-where { flex: 1; font-size: 11px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-del { border: none; background: transparent; color: var(--hint); cursor: pointer; font-size: 13px; }
.bm-time { font-size: 10.5px; color: var(--hint); margin: 1px 0 3px; }
.bm-text { font-size: 13px; line-height: 1.5; word-break: break-word; }
.m-del { font-style: italic; opacity: .85; background: transparent !important; color: var(--muted) !important; border: 1px dashed var(--line2) !important; }
.msg.mine .m-del { color: rgba(255,255,255,.9) !important; border-color: rgba(255,255,255,.5) !important; }
.m-edited { font-style: italic; opacity: .8; }
.m-meta { font-size: 10.5px; color: var(--hint); margin: 3px 4px 0; }
.m-status { color: var(--brand); }
.msg.mine .m-status { color: var(--on); }

.send-form { display: flex; gap: 10px; align-items: flex-end; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); }
.send-form textarea { flex: 1; border: 1px solid var(--line2); border-radius: 12px; padding: 10px 13px; font-size: 14px; font-family: inherit; resize: none; min-height: 42px; max-height: 60vh; line-height: 1.5; }
.send-form.drag-over { outline: 2px dashed var(--brand); outline-offset: -4px; border-radius: 14px; background: var(--brand-bg); } /* ドロップで送信 */
.send-form.drag-over textarea { background: transparent; }
/* チャット表示と入力カードの境目（ドラッグで入力欄の高さを調整） */
.compose-divider { flex: none; height: 10px; cursor: ns-resize; display: flex; align-items: center; justify-content: center; touch-action: none; }
.compose-divider::before { content: ''; width: 48px; height: 4px; border-radius: 2px; background: var(--line2); transition: background .12s, width .12s; }
.compose-divider:hover::before { background: var(--brand); width: 64px; }
.send-form textarea:focus { outline: none; border-color: var(--brand); }
.send-form button { width: 42px; height: 42px; border: none; border-radius: 50%; background: var(--brand); color: #fff; font-size: 18px; cursor: pointer; flex: none; }
.send-form button:hover { filter: brightness(1.06); }
.send-form .attach-btn { background: #fff; color: var(--muted); border: 1px solid var(--line2); font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }
.send-form .attach-btn:hover:not(:disabled) { filter: none; border-color: var(--brand); color: var(--brand); }
.send-form .attach-btn:disabled { opacity: .4; cursor: not-allowed; }
.send-form .mic-btn { background: #fff; color: var(--muted); border: 1px solid var(--line2); font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }
.send-form .mic-btn:hover { filter: none; border-color: var(--brand); color: var(--brand); }
.send-form .mic-btn.is-recording { background: var(--danger); color: #fff; border-color: var(--danger); animation: micpulse 1.1s infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,69,94,.45); } 50% { box-shadow: 0 0 0 7px rgba(224,69,94,0); } }

/* ---------- ファイルカード ---------- */
.file-card { display: flex; align-items: center; gap: 10px; min-width: 210px; max-width: 320px; }
.msg.mine .file-card { background: var(--mine); color: #fff; }
.fc-thumb { width: 40px; height: 40px; border-radius: 9px; background: rgba(127,127,127,.16); display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; overflow: hidden; }
.msg.mine .fc-thumb { background: rgba(255,255,255,.22); }
.fc-img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.fc-info { flex: 1; min-width: 0; }
.fc-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-sub { font-size: 11px; opacity: .8; margin-top: 2px; }
.fc-prog { font-variant-numeric: tabular-nums; }
.fc-act { display: flex; gap: 5px; flex: none; }
.fc-act button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line2); background: #fff; color: var(--text); cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.msg.mine .fc-act button { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.16); color: #fff; }
.fc-act button:hover { border-color: var(--brand); }
.fc-cancel { color: var(--danger) !important; border-color: var(--danger) !important; }
.file-card.canceled { opacity: .6; }

/* ---------- ドロップヒント ---------- */
.drop-hint { position: absolute; inset: 12px; border: 2px dashed var(--brand); border-radius: 14px; background: rgba(47,109,246,.06); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; pointer-events: none; z-index: 5; }
.msgs { position: relative; }

/* ---------- プレビューモーダル ---------- */
.fp-modal { position: fixed; inset: 0; background: rgba(15,22,35,.66); display: flex; align-items: center; justify-content: center; z-index: 10000; padding: 24px; }
.fp-box { background: var(--surface); border-radius: var(--r-lg); width: min(900px, 96vw); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.fp-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.fp-title { flex: 1; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-body { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 14px; background: var(--bg); }
.fp-img { max-width: 100%; max-height: 78vh; }
.fp-frame { width: 100%; height: 78vh; border: none; background: #fff; }
.fp-media { max-width: 100%; max-height: 78vh; }
.fp-audio { width: 100%; }
.fp-text { white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: 13px; width: 100%; max-height: 78vh; overflow: auto; margin: 0; text-align: left; color: var(--text); }
.fp-na { color: var(--muted); padding: 40px; }

/* ---------- グループモーダル ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,22,35,.6); display: flex; align-items: center; justify-content: center; z-index: 10000; padding: 22px; }
.modal-box { background: var(--surface); border-radius: var(--r-lg); width: min(440px, 96vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-title { flex: 1; font-weight: 700; font-size: 15px; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.gm-row input { width: 100%; height: 40px; border: 1px solid var(--line2); border-radius: 10px; padding: 0 12px; font-size: 14px; margin-bottom: 12px; }
.gm-row input:focus { outline: none; border-color: var(--brand); }
.gm-sub { font-size: 11px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 6px; }
.gm-mem { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px; font-size: 14px; }
.gm-rm { border: 1px solid var(--danger); color: var(--danger); background: #fff; border-radius: 7px; font-size: 12px; padding: 3px 9px; cursor: pointer; }
.gm-chk { display: flex; align-items: center; gap: 9px; padding: 8px 4px; font-size: 14px; cursor: pointer; border-radius: 8px; }
.gm-chk:hover { background: #eef2f8; }
.gm-empty { color: var(--hint); font-size: 13px; padding: 12px 4px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.btn-primary { background: var(--brand); color: #fff; border: none; border-radius: 9px; padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
.btn-ghost.danger { color: var(--danger); border-color: var(--danger); }

/* ---------- 通話 ---------- */
.call-bar { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 9998; display: flex; align-items: center; gap: 12px; background: #14233f; color: #fff; padding: 9px 12px 9px 16px; border-radius: 999px; box-shadow: var(--shadow); }
.call-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--on); animation: callpulse 1.4s infinite; }
@keyframes callpulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.call-meta { line-height: 1.2; }
.call-title { font-weight: 700; font-size: 13px; }
.call-sub { font-size: 11px; opacity: .75; }
.call-btn { width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer; font-size: 16px; background: rgba(255,255,255,.16); color: #fff; }
.call-btn.muted { background: #c2410c; }
.call-btn.hang { background: var(--danger); }

.inc-box { background: var(--surface); border-radius: var(--r-lg); padding: 30px 34px; text-align: center; box-shadow: var(--shadow); width: min(340px, 92vw); }
.inc-icon { font-size: 40px; animation: callpulse 1.2s infinite; }
.inc-name { font-size: 20px; font-weight: 800; margin-top: 10px; }
.inc-from { color: var(--muted); font-size: 13px; margin-top: 2px; }
.inc-actions { display: flex; gap: 14px; justify-content: center; margin-top: 24px; }
.inc-accept, .inc-decline { border: none; border-radius: 999px; padding: 11px 26px; font-size: 15px; font-weight: 700; cursor: pointer; color: #fff; }
.inc-accept { background: var(--on); }
.inc-decline { background: var(--danger); }

/* ---------- トースト ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1f2733; color: #fff; padding: 9px 18px; border-radius: 999px; font-size: 13px; z-index: 9999; box-shadow: var(--shadow); }

.back-btn { display: none; }

/* ---------- タブレット（iPad縦など）: 右パネルはスライドオーバーにして本文を潰さない ---------- */
@media (max-width: 1024px) {
  .app-view { grid-template-columns: 300px 1fr; }
  .cal-panel { position: fixed; top: 52px; right: 0; height: calc(100dvh - 52px); width: min(340px, 86vw); z-index: 60;
    transform: translateX(100%); transition: transform .22s ease; box-shadow: -10px 0 30px rgba(0,0,0,.18); display: flex; }
  .app-view.panel-open .cal-panel { transform: translateX(0); }   /* 会話ヘッダーの▤で開閉 */
  .cal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 55; }
  .panel-toggle { display: inline-flex; }
}

/* ---------- スマホ ---------- */
@media (max-width: 720px) {
  .app-view { grid-template-columns: 1fr; }
  .app-view.show-conv .side { display: none; }
  .app-view:not(.show-conv) .main { display: none; }
  .app-view.show-conv .back-btn { display: inline-flex; }   /* 会話中の戻るボタン（スマホのみ） */
  .msg { max-width: 86%; }
}
