:root {
  --bg: #f4f6f9; --card: #fff; --text: #1d2733; --muted: #667585; --line: #e1e6ec;
  --primary: #1f5fbf; --primary-d: #164a96; --danger: #c0392b; --ok: #1e8e5a; --warn: #b9770e;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif; font-size: 15px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.35; }
h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; }
.hidden { display: none !important; }

/* header */
.hd { background: #14316b; color: #fff; position: sticky; top: 0; z-index: 10; }
.hd-in { max-width: 1040px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 14px; min-height: 52px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 700; letter-spacing: .02em; padding: 8px 0; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a { color: #d6e2ff; padding: 14px 10px; font-size: .92rem; border-bottom: 3px solid transparent; }
.nav a:hover { color: #fff; text-decoration: none; }
.nav a.on { color: #fff; border-bottom-color: #7fb0ff; }
.who { font-size: .85rem; color: #d6e2ff; display: flex; gap: 10px; align-items: center; }
/* ポータルと同じ並び: 名前(大きめの太字)→丸い白枠のアイコン→ログアウトボタン を縦に並べる */
.who { flex-direction: column; gap: 5px; padding: 6px 0; }
.who > span { order: -1; font-size: 1.05rem; font-weight: 700; color: #fff; }
.who .who-ph { order: 0; }
.who button { order: 1; }
.who-ph { display: inline-flex; flex: none; border-radius: 50%; }
.who-av { width: 36px; height: 36px; aspect-ratio: 1 / 1; border-radius: 50%; border: 2px solid #fff; background: #e9edf2; color: #14316b; box-sizing: border-box; box-shadow: 0 0 0 1px rgba(0,0,0,.15); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; line-height: 1; }
.who button { background: transparent; border: 1px solid #5c78b5; color: #fff; padding: 4px 10px; border-radius: 6px; cursor: pointer; }

main { max-width: 1040px; margin: 0 auto; padding: 18px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card > h2:first-child { margin-top: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 160px; }

/* forms */
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 3px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c9d1da; border-radius: 7px; font: inherit; background: #fff; color: inherit; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0ff; border-color: var(--primary); }
input[readonly] { background: #f1f4f7; }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: .9rem; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

button, .btn { font: inherit; border-radius: 7px; border: 1px solid #c9d1da; background: #fff; color: var(--text);
  padding: 7px 14px; cursor: pointer; display: inline-block; }
button:hover, .btn:hover { background: #f1f4f8; text-decoration: none; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-d); }
button.danger { color: var(--danger); border-color: #e6b8b2; }
button.sm { padding: 3px 9px; font-size: .85rem; }
button:disabled { opacity: .55; cursor: default; }

.msg { padding: 9px 12px; border-radius: 7px; margin: 10px 0; font-size: .9rem; }
.msg.err { background: #fdecea; color: #8e2a20; } .msg.ok { background: #e8f6ee; color: #14633f; }

/* badges */
.badge { display: inline-block; font-size: .72rem; padding: 1px 8px; border-radius: 99px; background: #e7edf6; color: #36506f; vertical-align: middle; white-space: nowrap; }
.badge.contract { background: #fff1d6; color: #7a5200; }
.badge.gray { background: #e8eaed; color: #555; }
.badge.pin { background: #fde3e1; color: #9a2c22; }
.badge.type-法人 { background: #dfe9ff; color: #1b4a9c; }
.badge.type-部署 { background: #e5f4ea; color: #1d6b41; }
.badge.type-店舗 { background: #fdeede; color: #8a4b0b; }
.badge.type-担当 { background: #efe8fb; color: #5a3a96; }
.badge.type-グループ { background: #fdf1da; color: #8a5a00; }
.badge.type-チーム { background: #dcf3f1; color: #0b6b66; }

/* notices */
.notice { border-top: 1px solid var(--line); padding: 8px 0; }
.notice:first-of-type { border-top: 0; }
.notice summary { cursor: pointer; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.notice .date { color: var(--muted); font-size: .82rem; min-width: 5.5em; }
.notice .body { white-space: pre-wrap; padding: 8px 0 4px 0; color: #2b3945; overflow-wrap: anywhere; }

/* org tree */
.tree, .tree ul { list-style: none; margin: 0; padding-left: 22px; }
.tree { padding-left: 0; }
.tree li { position: relative; }
.node { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 7px; }
.node:hover { background: #f0f4fa; }
.tg { width: 24px; height: 24px; padding: 0; line-height: 1; border-radius: 6px; font-size: .8rem; flex: none; }
.tg.ph { visibility: hidden; }
.node a.nm { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.node .cnt { margin-left: auto; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.tree ul { border-left: 2px solid var(--line); margin-left: 11px; }
.node .nmw { flex: 1; min-width: 0; }
.node .nmw .alias { display: inline-block; }
.node .badge { flex: none; white-space: nowrap; }
/* スマホ幅では法人格(株式会社など)を隠す */
@media screen and (max-width: 600px) { .corp { display: none; } }
/* スマホ: 階層の字下げを減らし、名称が縦に折れないようにする(別称は名称の下に表示) */
@media (max-width: 600px) {
  .tree ul { padding-left: 10px; margin-left: 9px; }
  .node { gap: 6px; padding: 7px 2px; align-items: flex-start; }
  .node .tg { width: 28px; height: 28px; }
  .node .badge { font-size: .68rem; padding: 2px 6px; margin-top: 4px; }
  .node a.nm { overflow-wrap: break-word; word-break: normal; line-height: 1.4; }
  .node .nmw { padding-top: 2px; }
  .node .nmw .alias { display: block; font-size: .78rem; line-height: 1.35; }
  .node .cnt { font-size: .78rem; margin-top: 4px; }
}

/* people */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.person { display: block; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; color: var(--text); }
a.person:hover { border-color: #9cb8e6; text-decoration: none; background: #f8faff; }
.person .pn { font-weight: 700; } .person .ps { font-size: .85rem; color: var(--muted); } .person .pd { font-size: .85rem; margin-top: 3px; }
.person.retired { background: #f4f4f5; color: #777; }
.crumb { font-size: .88rem; color: var(--muted); margin-bottom: 6px; }
dl.kv { display: grid; grid-template-columns: 8.5em 1fr; gap: 8px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { dl.kv { grid-template-columns: 1fr; gap: 0; } dl.kv dd { margin-bottom: 8px; } }

/* tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; white-space: nowrap; }
tr.retired td { color: #888; background: #fafafa; }

/* dialog / toast */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(680px, 94vw); max-height: 92vh; box-shadow: 0 12px 40px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(20, 30, 50, .45); }
.dlg-in { padding: 20px; max-height: 92vh; overflow: auto; }
.dlg-ft { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.aff-row { display: grid; grid-template-columns: 1fr 140px auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
@media (max-width: 560px) { .aff-row { grid-template-columns: 1fr 1fr; } }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #1d2733; color: #fff; padding: 9px 16px;
  border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: .96; }

/* login */
.login { max-width: 400px; margin: 9vh auto 0; }
.login h1 { font-size: 1.25rem; text-align: center; }
.login .card { padding: 24px; }

.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin: 2px 0 0; padding: 4px 0; list-style: none;
  background: var(--card, #fff); border: 1px solid var(--line, #ccd); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.15); max-height: 320px; overflow-y: auto; }
.suggest li { padding: 8px 12px; cursor: pointer; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.suggest li:hover, .suggest li.on { background: rgba(31,78,121,.1); }
.suggest.hidden { display: none; }
.row.grow-wrap { position: relative; }

/* ---- 組織図(ツリー図) ---- */
.chart-head { display: flex; align-items: baseline; gap: 12px; }
.chart-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.oc { display: block; width: max-content; --ln: #7a8794; }
.oc ul { list-style: none; margin: 0; padding: 0; }
.oc .top, .oc .cols { display: flex; justify-content: center; }
.oc .top > li { text-align: center; }
.oc .cols { padding-top: 22px; position: relative; align-items: flex-start; }
.oc .cols::before { content: ''; position: absolute; top: 0; left: 50%; height: 22px; border-left: 1px solid var(--ln); }
.oc .cols > li { position: relative; padding: 22px 6px 0; text-align: center; flex: 0 0 auto; display: flex; flex-direction: column; align-items: stretch; }
.oc .cols > li::before, .oc .cols > li::after { content: ''; position: absolute; top: 0; width: 50%; height: 22px; border-top: 1px solid var(--ln); }
.oc .cols > li::before { right: 50%; }
.oc .cols > li::after { left: 50%; border-left: 1px solid var(--ln); }
.oc .cols > li:first-child::before, .oc .cols > li:last-child::after { border-top: 0; }
.oc .cols > li:last-child::before { border-right: 1px solid var(--ln); }
.oc .cols > li:only-child::before, .oc .cols > li:only-child::after { display: none; }
.oc .cols > li:only-child::after { display: block; border-top: 0; }
.oc .stack { margin: 0 0 0 22px; text-align: left; }
.oc .cols > li > .stack { margin-top: 0; }
.oc .stack > li { position: relative; padding: 8px 0 0 16px; }
.oc .stack > li::before { content: ''; position: absolute; left: 0; top: 24px; width: 16px; border-top: 1px solid var(--ln); }
.oc .stack > li::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid var(--ln); }
.oc .stack > li:last-child::after { bottom: auto; height: 24px; }
.oc .ob { display: inline-flex; flex-direction: column; gap: 1px; min-width: 128px; max-width: 168px; padding: 6px 10px; border: 1.5px solid #5b6b7a; border-radius: 6px;
  background: #eef3f9; color: #1d2733; text-align: center; font-size: 13px; line-height: 1.35; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.oc .ob:hover { text-decoration: none; border-color: var(--primary); }
.oc .ob-t { font-size: 10px; color: #566676; }
.oc .ob-n { font-weight: 700; overflow-wrap: anywhere; word-break: normal; text-wrap: balance; line-height: 1.35; }
.oc .ob-c { font-size: 11px; color: #3a4a5a; }
.oc .ob-m { font-size: 10px; color: #3a4a5a; border-top: 1px dotted #9aa8b5; margin-top: 3px; padding-top: 2px; }
/* 枠の色は種類(法人・部署など)ではなく階層(深さ)で決める: 同じ階層なら同じ色 */
.oc .ob.lv-0 { background: #fff3d6; border-color: #c9a24a; }
.oc .ob.lv-1 { background: #e3e6f8; border-color: #7f8bc9; }
.oc .ob.lv-2 { background: #d3e5f8; border-color: #5b8fc7; }
.oc .ob.lv-3 { background: #e2f3e8; border-color: #6aa97f; }
.oc .ob.lv-4 { background: #f1e9f8; border-color: #a184c2; }
.oc .ob.lv-5 { background: #f4f4f4; border-color: #8a8a8a; }
.oc .stack .ob { text-align: left; align-items: flex-start; }
@media print {
  .chart-page { break-after: page; page-break-after: always; margin-bottom: 0; }
  .chart-page:last-of-type { break-after: auto; page-break-after: auto; }
  .hd, .no-print, #toast { display: none !important; }
  body { background: #fff; }
  main { padding: 0 !important; max-width: none !important; }
  .chart-wrap { border: 0; padding: 0; overflow: visible; }
  .chart-head { margin-bottom: 6px; }
  .oc .ob:hover { border-color: inherit; }
}

.chart-page { margin-bottom: 18px; }

/* ---- 顔写真・履歴・デバイス ---- */
.ph { display: inline-block; flex: none; aspect-ratio: 3 / 4; background: #e9edf2; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.ph svg, .ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph-sm { width: 45px; } .ph-lg { width: 120px; }
.person.pc { display: flex; gap: 11px; align-items: flex-start; }
.person .pbody { min-width: 0; flex: 1; }
.dhead { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.dhead > div:last-child { flex: 1; min-width: 240px; }
.pcrop { border: 1px solid var(--line); border-radius: 6px; touch-action: none; cursor: grab; max-width: 100%; }
.er { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; align-items: end; padding: 8px 0; border-bottom: 1px dashed var(--line); }
h3 { margin: 18px 0 6px; font-size: 1rem; }
@media print { .ph-sm { width: 30px; } }

.hprompt { border: 1px solid #f0b429; background: #fffbea; border-radius: 6px; margin: 12px 0; padding: 8px 12px; }
.hprompt legend { font-weight: 600; padding: 0 6px; }

/* 組織図: 管理者のドラッグ並べ替え */
.oc .ob[draggable=true] { cursor: grab; }
.oc .ob.dragging { opacity: .35; }
.oc .ob.drop-before { box-shadow: -5px 0 0 0 var(--primary); }
.oc .ob.drop-after { box-shadow: 5px 0 0 0 var(--primary); }
.oc .stack .ob.drop-before { box-shadow: 0 -5px 0 0 var(--primary); }
.oc .stack .ob.drop-after { box-shadow: 0 5px 0 0 var(--primary); }

.alias{color:#666;font-size:.85em}
.oc .ob .ob-a{display:none;font-size:.75em;color:#555}
/* 別称は画面ではマウスを乗せたときだけ(title)。印刷時はボックス内に表示 */
.chart-printing .oc .ob .ob-a{display:block}
@media print{.oc .ob .ob-a{display:block}}

.steps{padding-left:1.3em;margin:0 0 10px}.steps li{margin-bottom:8px}
.badges{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-top:6px}
.badge-link{display:inline-block;line-height:0}.badge-link img{height:40px;width:auto}
.badge-text{display:inline-block;line-height:1.4;padding:10px 14px;border:1px solid #888;border-radius:8px;background:#000;color:#fff;font-size:.9em}
.qr{width:200px;height:200px;margin:10px auto;background:#fff;padding:8px;border-radius:8px;border:1px solid #ccc}.qr svg{width:100%;height:100%;display:block}

/* スマホ: ハンバーガーメニュー */
.menu-btn { display: none; }
@media (max-width: 720px) {
  .hd-in { gap: 0; }
  .brand { flex: 1; font-size: .95rem; padding: 14px 0; }
  .menu-btn { display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; padding: 0 10px; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
  .menu-btn span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }
  .menu-open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-open .menu-btn span:nth-child(2) { opacity: 0; }
  .menu-open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav, .who { display: none; width: 100%; flex: none; }
  .menu-open .nav { display: flex; flex-direction: column; gap: 0; border-top: 1px solid rgba(255,255,255,.2); }
  .nav a { padding: 13px 4px; border-bottom: 1px solid rgba(255,255,255,.12); font-size: 1rem; }
  .nav a.on { border-bottom-color: rgba(255,255,255,.12); background: rgba(255,255,255,.12); padding-left: 10px; }
  /* スマホのメニューは、アイコン・名前・ログアウトを一番上に(横並び) */
  .menu-open .who { display: flex; flex-direction: row; justify-content: space-between; align-items: center; padding: 10px 4px 10px; order: 1; }
  .who > span { order: 0; font-size: 1.15rem; }
  .menu-open .nav { order: 2; }
}
@media print { .menu-btn { display: none !important; } }

.ft{text-align:center;padding:16px 0 24px}
@media print{.ft{display:none}}

.orginfo{background:#fff;border:1px solid var(--line,#dde3ee);border-radius:8px;padding:10px 14px;margin:8px 0 12px}

/* 法人の枠: 法人名を大きく、代表取締役はそれより小さく */
.oc .ob.t-法人 .ob-n { font-size: 14px; }
.oc .ob.t-法人 { max-width: 200px; }
/* 法人の下に法人を横並びにするとき: 親の枠は子の列の中央に置き、親子をつなぐ線は子の列の幅に合わせる */
.oc .stack + .cols.sub, .oc .ob + .cols.sub { margin-top: 0; }
.oc .cols > li > .cols.sub { align-self: stretch; }
.oc .cols > li:has(> .cols.sub) > .ob { align-self: center; }
.oc .stack > li:has(> .cols.sub) > .ob { align-self: flex-start; }
.oc .ob-a { overflow-wrap: anywhere; text-wrap: balance; }
.oc .ob .ob-r { font-size: 11px; font-weight: 400; color: #3a4a5a; margin-top: 1px; }

/* 組織管理: ドラッグで並べ替え・入れ子 */
.node[draggable=true] { cursor: grab; }
.node.dragging { opacity: .4; }
.node.drop-before { box-shadow: 0 -3px 0 0 var(--primary); }
.node.drop-after { box-shadow: 0 3px 0 0 var(--primary); }
.node.drop-in { outline: 2px dashed var(--primary); outline-offset: -2px; background: #eef4ff; }

/* 組織図の拡大縮小・横スライド */
.chart-wrap { overflow-x: auto; overflow-y: hidden; cursor: grab; max-width: 100%; }
.chart-wrap.panning { cursor: grabbing; user-select: none; }
.chart-wrap .ob { cursor: pointer; }
.zoombar .sm { min-width: 2.2em; }
@media print { .chart-wrap { overflow: visible !important; cursor: auto; max-width: none; } }

/* ---- チャット ---- */
.nbadge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 99px; background: #e5484d; color: #fff; font-size: .72rem; line-height: 18px; text-align: center; font-weight: 700; vertical-align: middle; }
.nbadge[hidden] { display: none; }
.lnk { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font-size: inherit; }
.lnk:hover { background: none; text-decoration: underline; }
.chat { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: stretch; height: calc(100vh - 150px); min-height: 420px; }
.chat .card { margin: 0; display: flex; flex-direction: column; min-height: 0; padding: 14px; }
.ch-side .ch-list { list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; flex: 1; }
.ch-item { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 9px 8px; border-radius: 8px; color: var(--text); border-bottom: 1px solid var(--line); }
.ch-item:hover { background: #f1f4f8; text-decoration: none; }
.ch-item.on { background: #e7efff; }
.ch-kind { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-prev { grid-column: 1; color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-side-r { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ch-side-r .nbadge { margin: 0; }
/* LINE風: 上部に相手の名前を固定(会話だけがスクロールする) */
.ch-hd { display: flex; align-items: center; gap: 10px; flex: none; margin: -14px -14px 0; padding: 10px 14px; background: #14316b; color: #fff; border-radius: 10px 10px 0 0; }
.ch-hd .ch-who { min-width: 0; }
.ch-hd .ch-who strong { display: block; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-hd .ch-who .small { color: rgba(255,255,255,.75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-hd a:not(.ch-back) { color: #fff; }
.ch-back { display: none; align-items: center; gap: 4px; flex: none; padding: 6px 12px 6px 8px; border: 1.5px solid rgba(255,255,255,.85); border-radius: 99px; color: #fff; font-weight: 700; white-space: nowrap; }
.ch-back:hover { background: rgba(255,255,255,.18); text-decoration: none; }
.ch-back span { font-size: 1.5rem; line-height: .8; }
.ch-main { background-color: #fff; }
.ch-msgs { flex: 1; overflow-y: auto; padding: 10px 2px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.ch-day { text-align: center; margin: 8px 0 2px; font-size: .75rem; color: var(--muted); }
.ch-day span { background: #e9eef4; padding: 2px 10px; border-radius: 99px; }
.ch-m { max-width: 78%; align-self: flex-start; }
.ch-m.mine { align-self: flex-end; text-align: right; }
.ch-nm { font-size: .75rem; color: var(--muted); margin: 0 0 1px 6px; }
.ch-b { display: inline-block; text-align: left; background: #eef1f5; padding: 7px 11px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.ch-m.mine .ch-b { background: var(--primary); color: #fff; }
.ch-m.mine .ch-b a { color: #fff; text-decoration: underline; }
.ch-b.del { background: transparent; border: 1px dashed #c9d1da; color: var(--muted); }
.ch-meta { font-size: .7rem; color: var(--muted); margin: 1px 6px 0; }
.ch-img { display: block; max-width: min(260px, 100%); max-height: 260px; border-radius: 8px; margin-top: 4px; }
.ch-file { display: inline-block; margin-top: 2px; }
.ch-form { border-top: 1px solid var(--line); padding-top: 10px; }
.ch-in { display: flex; gap: 8px; align-items: flex-end; }
.ch-in textarea { min-height: 38px; max-height: 140px; resize: none; flex: 1; }
.ch-chip { display: inline-block; background: #eef1f5; border-radius: 99px; padding: 2px 10px; font-size: .85rem; margin-bottom: 6px; }
.ch-tabs { display: flex; gap: 6px; margin-bottom: 4px; }
.ch-tabs button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pk-list, .gp-mem { list-style: none; margin: 8px 0 0; padding: 0; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.gp-mem { max-height: 140px; padding: 6px 10px; }
.pk-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 0; color: var(--text); cursor: pointer; border-bottom: 1px solid var(--line); }
.pk-row:hover { background: #f1f4f8; }
@media (max-width: 760px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 120px); height: calc(100dvh - 120px); }
  .chat.has-room .ch-side { display: none; }
  .chat:not(.has-room) .ch-main { display: none; }
  .ch-back { display: inline-flex; }
  .ch-m { max-width: 88%; }
}
/* スマホ: ヘッダーのチャットアイコン(常時表示・未読は赤ポチ) */
.hd-chat { display: none; position: relative; width: 44px; height: 44px; align-items: center; justify-content: center; color: #fff; }
.hd-chat svg { width: 28px; height: 28px; display: block; }
.hd-dot { font-size: 0; position: absolute; top: 7px; right: 7px; width: 11px; height: 11px; border-radius: 50%; background: #e5484d; border: 2px solid #14316b; }
.hd-dot[hidden] { display: none; }
@media (max-width: 720px) { .hd-chat { display: flex; } }
/* PC: 右下のチャットボックス・ボタン */
.chat-dock { position: fixed; right: 16px; bottom: 16px; width: 380px; height: min(560px, calc(100vh - 90px)); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.28); display: flex; flex-direction: column; z-index: 30; overflow: hidden; }
.cd-hd { display: flex; align-items: center; gap: 4px; padding: 8px 10px; background: #14316b; color: #fff; }
.cd-btn { background: transparent; border: 0; color: #fff; cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.cd-btn:hover { background: rgba(255,255,255,.18); }
.cd-body { flex: 1; min-height: 0; position: relative; }
.chat.embedded { position: absolute; inset: 0; height: auto; min-height: 0; grid-template-columns: 1fr; gap: 0; }
.chat.embedded .card { border: 0; border-radius: 0; box-shadow: none; padding: 10px; }
.chat.embedded.has-room .ch-side { display: none; }
.chat.embedded:not(.has-room) .ch-main { display: none; }
.chat.embedded .ch-back { display: inline-flex; }
.chat.embedded .ch-hd { margin: -10px -10px 0; border-radius: 0; }
.chat.embedded .ch-m { max-width: 88%; }
.chat.embedded .ch-side h2 { font-size: 1rem; }
#chat-fab { position: fixed; right: 20px; bottom: 20px; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%; background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.3); cursor: pointer; z-index: 30; display: flex; align-items: center; justify-content: center; }
#chat-fab:hover { background: var(--primary-d); }
#chat-fab svg { width: 38px; height: 38px; display: block; }
#chat-fab .nbadge { position: absolute; top: -4px; right: -4px; margin: 0; }
@media (max-width: 720px) { .chat-dock, #chat-fab { display: none !important; } }
@media print { .chat-dock, #chat-fab { display: none !important; } }
/* 別ウィンドウのチャット */
.popout-wrap { position: fixed; inset: 0; display: flex; flex-direction: column; background: #fff; }
.ch-dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa7b5; display: inline-block; margin-top: 4px; }
.ch-mention { position: absolute; left: 0; right: 0; bottom: 100%; background: #fff; z-index: 5; box-shadow: 0 -4px 14px rgba(0,0,0,.12); margin: 0 0 4px; }
.ch-form { position: relative; }
.ch-mention .pk-row { width: 100%; border: 0; border-radius: 0; text-align: left; background: #fff; }
.ch-mention .pk-row.on, .ch-mention .pk-row:hover { background: #e7efff; }
.ch-mention-tag { background: rgba(31,95,191,.14); color: var(--primary-d); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.ch-mention-tag.me { background: #fff3c4; color: #7a5200; }
.ch-m.mine .ch-mention-tag { background: rgba(255,255,255,.25); color: #fff; }

/* 組織図の枠: 法人格(株式会社など)は小さく1行目、名称は2行目 */
.oc .ob-n .ob-corp { display: block; font-size: 10px; font-weight: 400; line-height: 1.2; opacity: .9; }

/* チャット強化: 返信・リアクション・ピン留め・検索・添付 */
.ch-act { margin-left: 8px; display: inline-flex; gap: 8px; opacity: 0; transition: opacity .12s; }
.ch-m:hover .ch-act, .ch-m:focus-within .ch-act { opacity: 1; }
@media (hover: none) { .ch-act { opacity: 1; } }
.ch-act .lnk { font-size: .72rem; }
.ch-quote { display: block; width: 100%; text-align: left; font-size: .8rem; background: rgba(0,0,0,.07); border: 0; border-left: 3px solid #9aa7b5; border-radius: 6px; padding: 3px 8px; margin: 0 0 4px; color: inherit; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-quote.missing { cursor: default; font-style: italic; color: var(--muted); }
.ch-m.mine .ch-quote { background: rgba(255,255,255,.2); border-left-color: rgba(255,255,255,.7); }
.ch-rxs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.ch-m.mine .ch-rxs { justify-content: flex-end; }
.ch-rx { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 0 8px; font-size: .8rem; line-height: 22px; cursor: pointer; }
.ch-rx.on { background: #e7efff; border-color: var(--primary); }
.ch-rxpick { display: inline-flex; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 2px 6px; margin-top: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.ch-rxpick button { border: 0; background: transparent; cursor: pointer; font-size: 1.05rem; padding: 0 3px; }
.ch-m.hl .ch-b { outline: 3px solid #ffd54f; }
.ch-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.ch-atts .ch-file { display: block; }
.ch-edit { width: 100%; min-width: 220px; min-height: 60px; }
.ch-editbtn { margin-top: 4px; }
.ch-pinbox { background: #fff8e1; border: 1px solid #f0dc9a; border-radius: 8px; padding: 4px 10px; margin: 6px 0 0; font-size: .85rem; }
.ch-pinbox summary { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-pinbox ul { list-style: none; margin: 4px 0; padding: 0; }
.ch-pinbox li { padding: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-jump { text-align: center; padding: 4px 0; }
.ch-typing { min-height: 1.2em; padding: 0 4px; }
.ch-replying { background: #eef1f5; border-left: 3px solid var(--primary); border-radius: 6px; padding: 3px 8px; margin-bottom: 6px; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-chip { margin-right: 4px; }
.ch-thumb { height: 28px; width: 28px; object-fit: cover; border-radius: 4px; vertical-align: middle; }
.ch-main.dropping { outline: 3px dashed var(--primary); outline-offset: -6px; background: #f3f8ff; }
.sr-res { max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.sr-item { display: block; width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 8px 6px; cursor: pointer; }
.sr-item:hover { background: #f1f4f8; }
.sr-item mark { background: #ffe58a; }
@media print { .ch-act { display: none; } }

/* タスク起票 */
.tk-tbl .tk-row { cursor: pointer; }
.tk-tbl .tk-row:hover { background: #f1f4f8; }
.tk-tbl .tk-row.fin { opacity: .65; }
.tk-due { font-size: .85rem; white-space: nowrap; }
.tk-due.soon { color: #b36200; font-weight: 600; }
.tk-due.today { color: #c0392b; font-weight: 700; }
.tk-due.over { color: #fff; background: #c0392b; border-radius: 99px; padding: 1px 8px; font-weight: 600; }
.tk-5w { width: 100%; border-collapse: collapse; margin: 10px 0; }
.tk-5w th { width: 11em; text-align: left; vertical-align: top; background: #f4f6fa; font-weight: 600; font-size: .85rem; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tk-5w td { padding: 8px 10px; border-bottom: 1px solid var(--line); word-break: break-word; }
.tk-who { list-style: none; margin: 0; padding: 0; } .tk-who li { padding: 2px 0; }
.ch-tasklink { margin-top: 6px; }
@media (max-width: 640px) { .tk-5w th { width: 7em; } }

/* カレンダー */
.cv-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cv-title { margin: 0 0 0 6px; font-size: 1.15rem; }
.cv-month { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cv-dows, .cv-cells { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cv-dows div { text-align: center; padding: 4px 0; font-size: .8rem; background: #f4f6fa; border-bottom: 1px solid var(--line); }
.cv-dows .sun, .cv-num.sun { color: #c0392b; } .cv-dows .sat { color: #1b4a9c; }
.cv-cell { min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 2px; cursor: pointer; min-width: 0; }
.cv-cell:nth-child(7n) { border-right: 0; }
.cv-cell.out { background: #fafbfc; color: var(--muted); }
.cv-cell.today { position: relative; }
.cv-cell.today::after, .cv-col.today::after, .cv-gh.today::after, .cv-ad.today::after { content: ""; position: absolute; pointer-events: none; z-index: 4; border: 0 solid var(--primary); }
.cv-cell.today::after { inset: 0; border-width: 3px; }
.cv-gh.today, .cv-ad.today { position: relative; }
.cv-gh.today::after { inset: 0; border-width: 3px 3px 0 3px; }
.cv-ad.today::after { inset: 0; border-width: 0 3px; }
.cv-col.today::after { inset: 0; border-width: 0 3px 3px 3px; }
.cv-cell.today .cv-num { background: var(--primary); color: #fff; border-radius: 99px; }
.cv-num { background: none; border: 0; padding: 1px 7px; font-size: .85rem; cursor: pointer; color: inherit; }
.cv-chip { display: block; width: 100%; text-align: left; font-size: .75rem; padding: 1px 5px; margin: 1px 0; border: 0; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cv-more { display: block; border: 0; background: none; font-size: .72rem; color: var(--muted); cursor: pointer; padding: 0 5px; }
.cv-ev.mine { background: #dbe7ff; color: #14316b; }
.cv-ev.other { background: #d9f2e3; color: #14502f; }
.cv-ev.declined { text-decoration: line-through; opacity: .55; }
.cv-grid { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cv-gead, .cv-body { display: grid; grid-template-columns: 3.4em minmax(0, 1fr); }
.cv-gut { font-size: .7rem; color: var(--muted); text-align: right; padding-right: 4px; }
.cv-row { display: grid; min-width: 0; }
.cv-gh { text-align: center; border-left: 1px solid var(--line); background: #f4f6fa; }
.cv-gh.today { background: #e7efff; }
.cv-ad { border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 24px; padding: 1px; cursor: pointer; min-width: 0; }
.cv-scroll { max-height: 62vh; overflow-y: auto; }
.cv-hr { box-sizing: border-box; border-top: 1px solid var(--line); font-size: .7rem; color: var(--muted); text-align: right; padding-right: 4px; }
.cv-col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 48px; min-width: 0; cursor: pointer; }
.cv-blk { position: absolute; overflow: hidden; border: 0; border-left: 3px solid rgba(0,0,0,.25); border-radius: 4px; font-size: .75rem; text-align: left; padding: 1px 4px; cursor: pointer; line-height: 1.25; }
.cv-loc { opacity: .75; }
.cv-now { position: absolute; left: 0; right: 0; height: 2px; background: #d93025; pointer-events: none; }
.cv-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
@media (max-width: 640px) {
  .cv-cell { min-height: 74px; } .cv-chip { font-size: .68rem; padding: 0 3px; } .cv-chip b { display: none; }
  .cv-gead, .cv-body { grid-template-columns: 2.6em minmax(0, 1fr); }
  .cv-grid[style*="--cols:7"] { overflow-x: auto; } .cv-grid[style*="--cols:7"] > * { min-width: 560px; }
}
.cv-embed .cv-scroll { max-height: 340px; }
.cv-embed .cv-title { font-size: 1rem; }
/* 日曜・祝日=薄いピンク、土曜=薄い水色(今日の強調は数字の丸で表す) */
.cv-cell.hol-day, .cv-gh.hol-day, .cv-ad.hol-day, .cv-col.hol-day { background-color: #fbdde2; }
.cv-cell.sat-day, .cv-gh.sat-day, .cv-ad.sat-day, .cv-col.sat-day { background-color: #e8f3fd; }
.cv-gh.today.hol-day { background-color: #f4c3cd; } .cv-gh.today.sat-day { background-color: #d3e8fa; }
.cv-cell.out.hol-day, .cv-cell.out.sat-day { opacity: .75; }
.cv-hol { font-size: .68rem; color: #b3394a; margin-left: 2px; white-space: nowrap; }
.cv-gh .cv-hol { display: block; margin: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .cv-cell .cv-hol { display: block; font-size: .6rem; margin: 0; overflow: hidden; text-overflow: ellipsis; } }
.cv-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; margin: 0 0 8px; color: var(--muted); }
.cv-legend i, .cv-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: baseline; }
.cat-row { margin-bottom: 6px; } .cat-color { width: 44px; height: 34px; padding: 2px; flex: none; }

/* ---- シフト ---- */
.linklike { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-align: left; }
.linklike:hover { text-decoration: underline; }
.sh-card { max-width: none; }
.sh-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 8px; }
.sh-nav { display: flex; align-items: center; gap: 8px; }
.sh-org-sel { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .9rem; }
.sh-org-sel select { max-width: 260px; }
.sh-tools { margin-left: auto; display: flex; gap: 6px; }
.sh-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: var(--muted); margin: 6px 0 8px; }
.sh-lg i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; border: 1px solid #0002; }
.sh-pal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.sh-pen { min-width: 40px; padding: 4px 8px; border: 2px solid transparent; border-radius: 6px; color: #222; cursor: pointer; font-size: .85rem; }
.sh-pen.on { border-color: var(--primary); box-shadow: 0 0 0 2px #1f5fbf55; font-weight: 700; }
.sh-wrap { overflow: auto; max-height: 76vh; border: 1px solid var(--line); border-radius: 6px; }
table.sh { border-collapse: separate; border-spacing: 0; font-size: .8rem; background: #fff; }
table.sh th, table.sh td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 2px 3px; text-align: center; white-space: nowrap; }
table.sh thead th { position: sticky; background: #f6f8fb; z-index: 3; }
table.sh thead tr:nth-child(1) th { top: 0; } table.sh thead tr:nth-child(2) th { top: 24px; } table.sh thead tr:nth-child(3) th { top: 48px; }
.sh-org, .sh-title, .sh-name { position: sticky; background: #fff; z-index: 2; text-align: left !important; }
table.sh thead .sh-org, table.sh thead .sh-title, table.sh thead .sh-name { z-index: 5; background: #f6f8fb; }
.sh-org { left: 0; min-width: 84px; } .sh-title { left: 84px; min-width: 78px; } .sh-name { left: 162px; min-width: 112px; border-right: 2px solid #c9d1db !important; }
.sh-sub { font-size: .68rem; color: var(--muted); }
.sh-rq-badge { display: inline-block; background: #e8505b; color: #fff; border-radius: 3px; font-size: .65rem; padding: 0 3px; }
.sh-d, .sh-c { min-width: 34px; width: 34px; }
.sh-h { height: 70px; vertical-align: top; padding: 2px 0 !important; } .sh-h span { writing-mode: vertical-rl; color: #d33; font-weight: 700; font-size: .72rem; }
table.sh .hol-day { background-color: #fbdde2; } table.sh .sat-day { background-color: #e8f3fd; }
table.sh th.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.sh-cnt .sh-org, .sh-cnt .sh-title, .sh-cnt .sh-name { background: #fafafa; } .sh-cnt-l { white-space: normal !important; }
.sh-cnt td { background: #fafafa; color: #555; font-size: .75rem; } .sh-cnt td.hol-day { background: #fbdde2; } .sh-cnt td.sat-day { background: #e8f3fd; }
.sh-c { position: relative; height: 34px; line-height: 1.1; } .sh-c b { display: block; font-size: .82rem; } .sh-c small { display: block; font-size: .62rem; color: #333; }
.sh-c.edit { cursor: pointer; } .sh-c.edit:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.sh-c.has-note::after { content: ''; position: absolute; top: 0; right: 0; border-top: 7px solid #222; border-left: 7px solid transparent; }
.sh-c.rq { box-shadow: inset 0 0 0 2px #e8505b; }
.sh-sum { min-width: 44px; font-weight: 700; } .sh-sum small { font-weight: 400; color: var(--muted); } .sh-sum.warn { color: #c0392b; background: #fff0ee; }
@media (max-width: 720px) {
  .sh-org, .sh-title { display: none; } .sh-name { left: 0; min-width: 92px; max-width: 112px; white-space: normal !important; }
  .sh-name .sh-sub { white-space: normal; }
  .sh-tools { margin-left: 0; }
}
@media print {
  .hd, .ft, .sh-bar, .sh-pal, .sh-card > p { display: none !important; }
  .sh-wrap { max-height: none; overflow: visible; border: 0; } table.sh { font-size: 7pt; } .sh-card { box-shadow: none; padding: 0; }
  .sh-org, .sh-title, .sh-name, table.sh thead th { position: static; }
}
.rq-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 520px; }
.rq-dw { text-align: center; font-size: .8rem; padding: 2px 0; border-radius: 4px; }
.rq-dw.hol-day, .rq-day.hol-day { background: #fbdde2; } .rq-dw.sat-day, .rq-day.sat-day { background: #e8f3fd; }
.rq-day { min-height: 54px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text); }
.rq-day small { font-size: .62rem; line-height: 1.1; color: var(--muted); }
.rq-day.on { background: #e8505b; border-color: #e8505b; color: #fff; } .rq-day.on small { color: #fff; }
.rq-day:disabled { opacity: .35; cursor: not-allowed; }
main:has(.sh-card) { max-width: 1700px; }
.sh-warnchip { font-size: .72rem; font-weight: 400; padding: 0 6px; border-radius: 10px; background: #eef1f5; color: var(--muted); }
.sh-warnchip.bad { background: #ffd0d0; color: #a11; font-weight: 700; } .sh-warnchip.mid { background: #ffe3b3; color: #8a5200; font-weight: 700; }
.sh-cnt td.short { background: #ffc9c9 !important; color: #a11; font-weight: 700; } .sh-cnt td.over { background: #ffe3b3 !important; color: #8a5200; font-weight: 700; }
.sh-dl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 6px 0; font-size: .88rem; } .sh-dl label { margin: 0; }
.sh-unsub { font-size: .8rem; color: var(--muted); } .sh-unsub.bad { color: #a11; font-weight: 700; }
.sh-miss { color: #c07000; margin-left: 2px; } .sh-sum small.warn { color: #c0392b; font-weight: 700; } .sh-sum small { display: block; }

/* システム管理のドロップダウン(システム管理者だけ) */
.nav-dd { position: relative; margin-left: auto; }
.nav-dd-btn { background: transparent; border: 0; border-bottom: 3px solid transparent; color: #d6e2ff; padding: 14px 10px; font: inherit; font-size: .92rem; cursor: pointer; border-radius: 0; }
.nav-dd-btn:hover, .nav-dd-btn.on, .nav-dd.open .nav-dd-btn { color: #fff; } .nav-dd-btn.on { border-bottom-color: #7fb0ff; }
.nav-dd-menu { display: none; position: absolute; right: 0; top: 100%; min-width: 190px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px #0003; padding: 6px 0; z-index: 30; }
.nav-dd.open .nav-dd-menu { display: block; }
.nav .nav-dd-menu a { display: block; color: var(--text); padding: 9px 16px; border-bottom: 0; font-size: .92rem; white-space: nowrap; }
.nav .nav-dd-menu a:hover, .nav .nav-dd-menu a:focus-visible { background: var(--primary) !important; color: #fff !important; text-decoration: none; }
.nav .nav-dd-menu a:not(:hover):not(:focus-visible) { color: var(--text); } .nav .nav-dd-menu a.on:not(:hover):not(:focus-visible) { color: var(--primary); } .nav .nav-dd-menu a.on { background: #e1ebfb; color: var(--primary); font-weight: 700; }
@media (max-width: 720px) {
  .nav-dd { margin-left: 0; } .nav-dd-btn { width: 100%; text-align: left; padding: 13px 4px; border-bottom: 1px solid rgba(255,255,255,.12); font-size: 1rem; }
  .nav-dd-menu { position: static; box-shadow: none; border: 0; border-radius: 0; background: rgba(255,255,255,.08); padding: 0; }
  .nav .nav-dd-menu a, .nav .nav-dd-menu a:not(:hover):not(:focus-visible) { color: #d6e2ff; padding: 12px 4px 12px 22px; border-bottom: 1px solid rgba(255,255,255,.1); } .nav .nav-dd-menu a.on, .nav .nav-dd-menu a.on:not(:hover):not(:focus-visible) { background: rgba(255,255,255,.14); color: #fff; }
  .nav .nav-dd-menu a:hover { background: rgba(255,255,255,.22) !important; }
}

/* スレッド: 会話の右側に重ねて出すパネル(スマホは全面) */
.ch-main { position: relative; }
.ch-thread { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: #fff; border-left: 1px solid var(--line); box-shadow: -6px 0 18px rgba(0,0,0,.14); display: flex; flex-direction: column; z-index: 6; border-radius: 0 12px 12px 0; overflow: hidden; }
.th-hd { display: flex; align-items: center; gap: 10px; flex: none; padding: 10px 14px; background: #14316b; color: #fff; }
.th-back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px 6px 8px; border: 1.5px solid rgba(255,255,255,.85); border-radius: 99px; background: transparent; color: #fff; font-weight: 700; cursor: pointer; white-space: nowrap; }
.th-back:hover { background: rgba(255,255,255,.18); }
.th-back span { font-size: 1.5rem; line-height: .8; }
.th-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.th-root { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.th-count { text-align: center; margin: 2px 0; }
.th-form { flex: none; display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px; border-top: 1px solid var(--line); }
.th-form textarea { flex: 1; min-height: 38px; max-height: 120px; resize: none; margin: 0; }
.ch-thr { align-self: flex-start; background: #eef3ff; border: 0; border-radius: 99px; color: var(--primary); font-size: .8rem; font-weight: 700; padding: 3px 10px; cursor: pointer; margin-top: 2px; }
.ch-m.mine .ch-thr { align-self: flex-end; }
.ch-thr:hover { background: #dce7ff; }
@media (max-width: 760px) { .ch-thread { width: 100%; border-radius: 12px; } }
/* 幅の狭いチャット(右下のボックス・スマホ)で、長い見出しが枠を押し広げて右端が切れないようにする */
.chat > * { min-width: 0; }
.ch-main, .ch-side { overflow: hidden; }
.ch-hd { min-width: 0; }
.ch-hd .ch-who { flex: 1 1 0; }
.ch-hd > * { flex-shrink: 0; } .ch-hd > .ch-who { flex-shrink: 1; }
.ch-form, .ch-in { min-width: 0; } .ch-in textarea { min-width: 0; }

/* 出勤場所の行(期間をまとめて表示) */
.sh-loc td { height: 20px; padding: 0 3px; font-size: .72rem; }
.sh-loc .sh-name, .sh-loc .sh-org, .sh-loc .sh-title { background: #f4faf5; }
.sh-loc-c { max-width: 0; overflow: hidden; text-overflow: ellipsis; background: #dff1e3; color: #1b5e20; font-weight: 700; border-left: 2px solid #5fae72 !important; }
.sh-loc-e { background: #fafafa; }
.sh-locbtn { background: #eef6ef; border: 1px solid #b9dcc0; border-radius: 99px; color: #1b5e20; font-size: .68rem; padding: 0 6px; cursor: pointer; }
@media print { .sh-locbtn { display: none; } }
/* スマホ: タスク一覧は表をやめ、1件ずつカードで見せる(件名が1文字ずつ縦に折れないように) */
@media (max-width: 640px) {
  .tk-tbl, .tk-tbl tbody { display: block; width: 100%; }
  .tk-tbl thead { display: none; }
  .tk-tbl .tk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .tk-tbl .tk-row td { display: block; padding: 0; border: 0; width: auto; }
  .tk-tbl .tk-row td:first-child { flex: 1 0 100%; font-size: 1rem; word-break: break-word; overflow-wrap: anywhere; }
  .tk-tbl .tk-row td:nth-child(3) { color: var(--muted); }
  .tk-tbl .tk-row td:nth-child(4) { margin-left: auto; text-align: right; }
}

/* パンくずリスト */
.crumb { max-width: 1040px; margin: 12px auto -8px; padding: 0 16px; font-size: .82rem; color: var(--muted); }
.crumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; }
.crumb li { display: flex; align-items: center; min-width: 0; }
.crumb li + li::before { content: "›"; margin: 0 8px; color: #9aa6b8; }
.crumb a { color: var(--primary); } .crumb a:hover { text-decoration: underline; }
.crumb [aria-current="page"] { color: var(--text); font-weight: 600; }
@media print { .crumb { display: none; } }

/* マニュアル */
.mn-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mn-chip { border-radius: 99px; padding: 3px 12px; font-size: .85rem; background: #fff; border: 1px solid var(--line); color: var(--text); cursor: pointer; }
.mn-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
a.mn-item { display: block; color: inherit; text-decoration: none; }
a.mn-item:hover { border-color: var(--primary); }
.mn-tb { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; background: #f3f6fa; position: sticky; top: 0; z-index: 2; }
.mn-tb button { padding: 4px 9px; font-size: .85rem; }
.mn-ed { min-height: 320px; padding: 14px; border: 1px solid var(--line); border-radius: 0 0 8px 8px; background: #fff; outline: none; }
.mn-ed:focus { border-color: var(--primary); }
.mn-body { line-height: 1.8; overflow-wrap: anywhere; }
.mn-body h2 { font-size: 1.25rem; border-left: 5px solid var(--primary); padding-left: 10px; margin: 1.4em 0 .6em; }
.mn-body h3 { font-size: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: 3px; margin: 1.2em 0 .5em; }
.mn-body h4 { margin: 1em 0 .4em; }
.mn-body p { margin: .6em 0; }
.mn-body ul, .mn-body ol { padding-left: 1.6em; margin: .6em 0; }
.mn-body blockquote { margin: .8em 0; padding: 6px 14px; border-left: 4px solid var(--line); color: var(--muted); background: #f8fafc; }
.mn-body pre, .mn-body code { background: #f1f3f6; border-radius: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
.mn-body code { padding: 1px 5px; } .mn-body pre { padding: 10px; overflow: auto; }
.mn-body img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; }
.mn-body table { border-collapse: collapse; max-width: 100%; display: block; overflow-x: auto; margin: .8em 0; }
.mn-body th, .mn-body td { border: 1px solid #cfd6df; padding: 6px 10px; min-width: 70px; vertical-align: top; }
.mn-body th { background: #eef2f7; }
.mn-body hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
@media print { .hd, .crumb, .ft, .mn-act, .dock, #chat-dock { display: none !important; } .card { border: 0; padding: 0; } body { background: #fff; } }

/* タスク詳細(5W2H)をスマホで右にはみ出さない: 項目名を上、内容を下に積む */
.tk-5w { width: 100%; table-layout: fixed; }
.tk-5w td { overflow-wrap: anywhere; word-break: break-word; }
@media (max-width: 720px) {
  .tk-5w, .tk-5w tbody, .tk-5w tr, .tk-5w th, .tk-5w td { display: block; width: 100%; }
  .tk-5w tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .tk-5w th { padding: 0 0 2px; border: 0; background: none; font-size: .8rem; color: var(--muted); font-weight: 600; white-space: normal; }
  .tk-5w td { padding: 0; border: 0; }
}
.notice .body.mn-body { white-space: normal; }

/* トップページ: 未読チャット・タスク */
.top-ch, .top-tk { list-style: none; margin: 8px 0 0; padding: 0; }
.top-ch li + li, .top-tk li + li { border-top: 1px solid var(--line); }
.top-ch a, .top-tk a { display: flex; align-items: center; gap: 8px 10px; padding: 8px 2px; color: inherit; text-decoration: none; flex-wrap: wrap; }
.top-ch a:hover, .top-tk a:hover { background: #f3f6fa; }
.top-ch .ch-prev { flex: 1 1 140px; min-width: 0; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-tk .tk-t { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }

/* ---- フォーム(アンケート・申込) ---- */
.nav-badge { display: inline-block; margin-left: 5px; min-width: 18px; padding: 0 5px; border-radius: 99px; background: #e5484d; color: #fff; font-size: .72rem; line-height: 18px; text-align: center; vertical-align: 1px; }
.nav-badge[hidden] { display: none; }
.fm-tabs { display: flex; gap: 4px; margin: 12px 0 8px; border-bottom: 1px solid #dfe4ea; flex-wrap: wrap; }
.fm-tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 8px 14px; }
.fm-tabs button.on { border-bottom-color: var(--primary, #1a56c7); font-weight: 700; }
.fm-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.fm-row { display: block; border: 1px solid #dfe4ea; border-radius: 9px; padding: 10px 12px; color: var(--text); background: #fff; }
a.fm-row:hover { background: #f5f8fc; text-decoration: none; }
.fm-row.un { border-left: 5px solid #e5484d; background: #fff9f8; }
.fm-rt { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fm-meta { margin: 6px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.fm-dl { display: grid; grid-template-columns: minmax(8em, 14em) 1fr; gap: 6px 14px; margin: 12px 0; }
.fm-dl dt { font-weight: 600; color: var(--muted); }
.fm-dl dd { margin: 0; overflow-wrap: anywhere; }
.fm-shot { max-width: 220px; max-height: 220px; border-radius: 6px; border: 1px solid #dfe4ea; margin: 0 8px 8px 0; }
/* 回答画面 */
.fm-wrap { min-height: 100vh; padding: 20px 14px 60px; background: #eef2f7; }
.fm-pubcard { max-width: 680px; margin: 0 auto; }
.fm-pub h2 { margin-top: 0; }
.fm-desc { white-space: normal; }
.fm-prog { position: sticky; top: 0; z-index: 3; background: #fff; padding: 8px 0 6px; margin-bottom: 8px; border-bottom: 1px solid #edf0f4; }
.fm-bar { height: 8px; background: #e5e9ef; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.fm-bar > div { height: 100%; width: 0; background: #2f9e6a; transition: width .25s; }
.fm-f { margin: 16px 0; }
.fm-q { font-weight: 700; display: block; margin-bottom: 4px; }
.fm-req { display: inline-block; font-size: .7rem; font-weight: 600; color: #fff; background: #d9480f; border-radius: 4px; padding: 0 5px; vertical-align: 1px; }
.fm-help { margin: -2px 0 6px; }
.fm-opts { display: flex; flex-direction: column; gap: 6px; }
.fm-f input[type=text], .fm-f input[type=number], .fm-f input[type=date], .fm-f input[type=tel], .fm-f input[type=email], .fm-f select, .fm-f textarea { width: 100%; max-width: 100%; }
.fm-err { color: #b42318; font-size: .85rem; min-height: 0; margin-top: 3px; }
.fm-sec { border-top: 2px solid #dfe4ea; padding-top: 14px; margin-top: 26px; }
.fm-sec h3 { margin: 0 0 4px; }
.fm-note { background: #f3f6fa; border-radius: 8px; padding: 10px 12px; }
.fm-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fm-ths { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.fm-th { width: 140px; border: 1px solid #dfe4ea; border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 4px; background: #fff; }
.fm-th img { width: 100%; height: 100px; object-fit: cover; border-radius: 5px; }
.fm-th-ph { height: 100px; border-radius: 5px; background: #eef1f5; }
.fm-bad { color: #b42318; }
.fm-pvbar { margin-top: 0; }
.fm-dlg { min-width: 0; }
dialog:has(.fm-dlg) { width: min(760px, 96vw); }
/* ビルダー */
.fm-build { display: grid; grid-template-columns: 210px 1fr; gap: 14px; align-items: start; }
.fm-pal { position: sticky; top: 8px; margin: 0; }
.fm-pal h3 { margin: 0 0 4px; font-size: 1rem; }
.fm-pg { margin: 10px 0 4px; }
.fm-pgs { display: flex; flex-direction: column; gap: 5px; }
.fm-pi { display: flex; align-items: center; gap: 8px; text-align: left; cursor: grab; padding: 6px 10px; }
.fm-pi span { width: 2.2em; text-align: center; color: var(--primary, #1a56c7); font-weight: 700; }
.fm-canvas { margin: 0; min-width: 0; }
.fm-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; min-height: 90px; padding: 6px; border-radius: 10px; }
.fm-list.over { background: #f0f6ff; outline: 2px dashed #7fb0ff; }
.fm-empty { border: 2px dashed #c3ccd8; border-radius: 10px; padding: 28px 10px; text-align: center; color: var(--muted); }
.fm-drop { border: 2px dashed #2f6fe0; background: #e8f0ff; color: #2f6fe0; border-radius: 8px; text-align: center; padding: 8px; font-size: .85rem; }
.fm-card { border: 1px solid #d3dae3; border-radius: 10px; background: #fff; }
.fm-card.sel { border-color: #2f6fe0; box-shadow: 0 0 0 2px #cfe0ff; }
.fm-card.in { margin-left: 18px; }
.fm-card.t-section { background: #f3f6fa; border-left: 5px solid #2f6fe0; }
.fm-card.dragging { opacity: .4; }
.fm-hd { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; flex-wrap: wrap; }
.fm-grip { cursor: grab; color: #8a97a8; padding: 2px 4px; user-select: none; letter-spacing: -2px; }
.fm-ty { width: 2em; text-align: center; color: var(--primary, #1a56c7); font-weight: 700; }
.fm-lb { font-weight: 600; flex: 1; min-width: 6em; overflow-wrap: anywhere; }
.fm-ops { display: flex; gap: 4px; margin-left: auto; }
.fm-edit { padding: 4px 12px 12px; border-top: 1px solid #edf0f4; }
.fm-in { display: inline-flex; flex-direction: column; gap: 2px; font-size: .85rem; color: var(--muted); }
.fm-condbox { margin-top: 12px; padding: 10px; background: #fafbfd; border: 1px dashed #c9d1da; border-radius: 8px; }
.fm-cond { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.fm-rule select, .fm-rule input { max-width: 100%; }
.fm-ind { margin: 6px 0 6px 22px; display: flex; flex-direction: column; gap: 6px; }
.fm-prm { border: 1px solid #dfe4ea; border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.fm-mk { margin-top: 8px; padding: 8px; background: #f6f8fb; border-radius: 8px; }
.fm-chips { margin-bottom: 4px; }
@media (max-width: 720px) {
  .fm-build { grid-template-columns: 1fr; }
  .fm-pal { position: static; }
  .fm-pgs { flex-direction: row; flex-wrap: wrap; }
  .fm-card.in { margin-left: 8px; }
  .fm-tn { display: none; }
  .fm-dl { grid-template-columns: 1fr; }
  .fm-dl dt { margin-top: 6px; }
  .fm-wrap { padding: 8px 8px 60px; }
}

/* CRM/SFA: ポータルと見分けがつくよう、ヘッダーの色を変える */
.hd { background: #0b4f5c; }
.hd .nav a.on, .nav-dd-btn.on { border-bottom-color: #6fd3e0; }
.login h1 { color: #0b4f5c; }
