/* Hikari Works — 仕事用のデザイン(紺・白)。PC(Windows/Mac/Linux)・iPad・スマホのブラウザーで同じ画面。 */
:root {
  --navy: #0f2a5c; --navy-2: #163a7a; --blue: #1d4ed8; --blue-soft: #e8eefc;
  --ink: #0f1f3d; --sub: #5b6b86; --line: #e3e8f1; --bg: #f4f6fa; --card: #ffffff;
  --side-ink: #dbe4f7; --side-sub: #9fb1d6; --danger: #c62828; --ok: #1b7f4b;
  --radius: 10px; --side-w: 280px;
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
.boot { display: flex; height: 100vh; align-items: center; justify-content: center; font-weight: 700; color: var(--navy); font-size: 22px; }

/* ── サインイン・招待など(1枚のカード) ── */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: 100%; max-width: 420px;
  box-shadow: 0 6px 30px rgba(15,42,92,.08); }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.brand img { width: 40px; height: 40px; }
.brand b { font-size: 20px; color: var(--navy); letter-spacing: .02em; }
.card h1 { font-size: 20px; margin: 0 0 6px; }
.card p.sub { color: var(--sub); margin: 0 0 20px; font-size: 14px; line-height: 1.6; }
label.f { display: block; font-size: 13px; color: var(--sub); margin: 12px 0 6px; }
input.t, textarea.t, select.t { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
input.t:focus, textarea.t:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.pw { position: relative; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--sub); padding: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: var(--radius);
  padding: 11px 16px; font-weight: 600; background: var(--blue); color: #fff; }
.btn.full { width: 100%; margin-top: 18px; }
.btn.ghost { background: var(--blue-soft); color: var(--blue); }
.btn.plain { background: none; color: var(--sub); padding: 8px; }
.btn.danger { background: #fdecec; color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.note { color: var(--sub); font-size: 12px; line-height: 1.6; margin-top: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--sub); margin-top: 14px; line-height: 1.5; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .08em; background: var(--blue-soft);
  color: var(--navy); padding: 14px; border-radius: var(--radius); text-align: center; margin: 12px 0; user-select: all; }

/* ── 本体: 左に会社とチャンネル、右に会話 ── */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; height: 100vh; height: 100dvh; }
.side { background: var(--navy); color: var(--side-ink); display: flex; flex-direction: column; min-height: 0; }
.ws { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.ws .logo { width: 34px; height: 34px; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; }
.ws .logo img { width: 26px; height: 26px; }
.ws .name { font-weight: 700; color: #fff; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws select { background: var(--navy-2); color: #fff; border: 0; border-radius: 8px; padding: 6px; max-width: 100%; }
.side .scroll { overflow-y: auto; flex: 1; padding: 8px 0 16px; }
.sec { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; font-size: 12px; color: var(--side-sub);
  text-transform: uppercase; letter-spacing: .06em; }
.sec button { background: none; border: 0; color: var(--side-sub); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.sec button:hover { background: rgba(255,255,255,.08); color: #fff; }
.item { display: flex; align-items: center; gap: 8px; padding: 7px 16px; margin: 1px 8px; border-radius: 8px; color: var(--side-ink);
  cursor: pointer; font-size: 14px; }
.item:hover { background: rgba(255,255,255,.07); }
.item.on { background: var(--blue); color: #fff; }
.item .hash { color: var(--side-sub); width: 16px; text-align: center; }
.item.on .hash { color: #cfe0ff; }
.item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .n { background: #ef4444; color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.item.unread .t { font-weight: 700; color: #fff; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.me .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.av { width: 30px; height: 30px; border-radius: 8px; background: #3b5ba9; color: #fff; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 13px; flex: none; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

.main { display: flex; flex-direction: row; min-width: 0; min-height: 0; background: var(--card); }
.chatcol { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }

/* ── 打ち合わせ(ビデオ会議): PC では左に映像、右にチャット・ファイル ── */
.stage { flex: 1 1 auto; min-width: 0; background: #0b1220; display: flex; flex-direction: column; position: relative; }
.main.inmeeting .chatcol { flex: none; width: 380px; border-left: 1px solid var(--line); }
.stage .banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: #b91c1c; color: #fff; padding: 6px 14px;
  border-radius: 20px; font-size: 13px; font-weight: 700; z-index: 2; }
.tiles { flex: 1; display: grid; gap: 8px; padding: 12px; min-height: 0; grid-template-columns: 1fr; grid-auto-rows: 1fr; }
.tiles.n2 { grid-template-columns: 1fr 1fr; }
.tiles.n3, .tiles.n4 { grid-template-columns: 1fr 1fr; }
.tiles.n5, .tiles.n6 { grid-template-columns: 1fr 1fr 1fr; }
.tiles.n7, .tiles.n8, .tiles.n9 { grid-template-columns: 1fr 1fr 1fr; }
.tiles.n10, .tiles.n11, .tiles.n12, .tiles.n13, .tiles.n14, .tiles.n15, .tiles.n16 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tile.on { border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.35); }
.tile.scr video { object-fit: contain; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; color: #cbd5e1; font-size: 13px; padding-top: 2px; }
.pager[hidden] { display: none; }
.pager .cb { padding: 6px 14px; }
.pager .cb:disabled { opacity: .35; }
.ctrl .cnt { align-self: center; color: #cbd5e1; font-size: 13px; margin-right: 4px; }
.stage .audiogo { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 3; }
.stage .audiogo[hidden], .stage .banner[hidden] { display: none; }
.tile { position: relative; background: #172133; border-radius: 12px; overflow: hidden; min-height: 0; border: 2px solid transparent; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #0b1220; }
.tile .who { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.55); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 13px; }
.tile .novid { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 700;
  color: #fff; background: #1f2a3e; }
.ctrl { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 10px 12px 14px; }
.cb { border: 0; border-radius: 22px; padding: 10px 16px; background: #283449; color: #fff; font-weight: 600; font-size: 14px; }
.cb:hover { background: #33415b; }
.cb.off { background: #4b5563; }
.cb.act { background: var(--blue); }
.cb.rec { background: #b91c1c; }
.cb.leave { background: #dc2626; }
.ring { position: fixed; right: 20px; top: 20px; z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(15,31,61,.18); max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.ring div { display: flex; gap: 8px; justify-content: flex-end; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); min-height: 58px; }
.top .menu { display: none; border: 0; background: none; font-size: 22px; padding: 4px 8px; }
.top h2 { margin: 0; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .meta { color: var(--sub); font-size: 13px; font-weight: 400; margin-left: 8px; }
.top .acts { display: flex; gap: 6px; }
.icon { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; color: var(--ink); font-size: 14px; }
.icon:hover { background: var(--bg); }

.msgs { flex: 1; overflow-y: auto; padding: 16px 18px 8px; min-height: 0; }
.more { display: block; margin: 0 auto 12px; }
.day { text-align: center; color: var(--sub); font-size: 12px; margin: 14px 0 8px; }
.m { display: flex; gap: 10px; padding: 4px 6px; border-radius: 8px; }
.m:hover { background: #f8fafd; }
.m .av { width: 36px; height: 36px; margin-top: 2px; }
.m .b { min-width: 0; flex: 1; }
.m .h { display: flex; gap: 8px; align-items: baseline; }
.m .h b { font-size: 14px; }
.m .h span { color: var(--sub); font-size: 12px; }
.m .x { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.6; }
.m .x.gone { color: var(--sub); font-style: italic; }
.m.cont { padding-top: 0; }
.m.cont .av { visibility: hidden; height: 0; }
.m.cont .h { display: none; }
.m .pend { color: var(--sub); font-size: 12px; }
.m .fail { color: var(--danger); font-size: 12px; }
.att img { max-width: min(360px, 100%); max-height: 320px; border-radius: 8px; border: 1px solid var(--line); margin-top: 4px; display: block; cursor: zoom-in; }
.att video { max-width: min(420px, 100%); border-radius: 8px; margin-top: 4px; }
.file { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 4px;
  background: #fff; cursor: pointer; max-width: 100%; }
.file b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file span { color: var(--sub); font-size: 12px; }
.typing { color: var(--sub); font-size: 12px; padding: 0 18px; min-height: 18px; }

.composer { border-top: 1px solid var(--line); padding: 10px 14px 14px; }
.box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 10px; background: #fff; }
.box:focus-within { border-color: var(--blue); }
.box textarea { flex: 1; border: 0; resize: none; outline: none; max-height: 180px; min-height: 24px; padding: 6px 0; line-height: 1.5; }
.box .att-b { border: 0; background: none; font-size: 20px; color: var(--sub); padding: 4px 6px; }
.box .send { padding: 8px 14px; }
.hint { color: var(--sub); font-size: 11px; margin-top: 6px; }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--sub); gap: 10px; padding: 24px;
  text-align: center; }
.empty img { width: 64px; opacity: .9; }

/* ── 右から出る欄(メンバー・チャンネル一覧) / 小窓 ── */
.panel { position: fixed; inset: 0 0 0 auto; width: min(420px, 100%); background: #fff; box-shadow: -8px 0 30px rgba(15,42,92,.12);
  display: flex; flex-direction: column; z-index: 20; }
.panel .ph { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.panel .ph h3 { margin: 0; flex: 1; font-size: 16px; }
.panel .pb { overflow-y: auto; padding: 8px 10px 20px; flex: 1; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; }
.row:hover { background: var(--bg); }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t span { color: var(--sub); font-size: 12px; }
.tag { font-size: 11px; color: var(--blue); background: var(--blue-soft); border-radius: 6px; padding: 2px 6px; }
.scrim { position: fixed; inset: 0; background: rgba(15,31,61,.35); z-index: 15; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #fff; border-radius: 16px; padding: 24px;
  width: min(440px, calc(100% - 32px)); z-index: 30; box-shadow: 0 20px 60px rgba(15,31,61,.25); }
.modal h3 { margin: 0 0 8px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 10px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 60; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.viewer img { max-width: 94vw; max-height: 94vh; }

/* ── iPad 縦・スマホ: 左の欄は重ねて開く ── */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(var(--side-w), 86vw); z-index: 25; transform: translateX(-105%); transition: transform .18s; }
  .shell.open .side { transform: none; box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  .top .menu { display: block; }
  .msgs { padding: 12px 10px 8px; }
  /* 打ち合わせ中: 上に映像、下にチャット */
  .main.inmeeting { flex-direction: column; }
  .main.inmeeting .stage { flex: none; height: 58vh; height: 58dvh; }
  .main.inmeeting .chatcol { width: auto; flex: 1; border-left: 0; border-top: 1px solid var(--line); }
  .cb { padding: 9px 12px; font-size: 13px; }
}
@media (max-width: 700px) {
  .tiles.n7, .tiles.n8, .tiles.n9, .tiles.n10, .tiles.n11, .tiles.n12 { grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; }
  .tile .who { font-size: 11px; left: 4px; bottom: 4px; padding: 2px 6px; }
}
