:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --ink: #1b2230;
  --ink-2: #3a4252;
  --muted: #747b88;
  --line: #e7e6e1;
  --line-2: #f0efea;
  --accent: #0f766e;
  --accent-ink: #0b5c56;
  --accent-soft: #e5f1ee;
  --sun: #f2b84b;
  --sun-soft: #fdf3df;
  --rose: #c2412d;
  --rose-soft: #fbe9e5;
  --sky: #3b6fd8;
  --sky-soft: #e8effc;
  --radius: 12px;
  --radius-sm: 8px;
  font-family: "Inter", "Noto Sans JP", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- レイアウト ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; color: var(--muted); padding: 0 10px 4px; letter-spacing: .06em; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--line-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav a .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.nav a.active .dot { background: var(--accent); }
.side-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 8px; display: flex; flex-direction: column; gap: 6px; }

.main { padding: 28px 36px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: .01em; }
.page-desc { color: var(--muted); margin: 4px 0 0; font-size: 13px; }

/* ---------- 部品 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card-title { font-weight: 700; font-size: 14px; margin: 0 0 12px; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.stat { padding: 18px 20px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-family: "Inter", sans-serif; font-size: 28px; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--muted); }
.bar { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--line-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--rose); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=url], input[type=number], input[type=email], input[type=datetime-local], select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm); padding: 9px 11px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 96px; resize: vertical; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px;
  background: var(--line-2); color: var(--ink-2); border: 1px solid transparent; cursor: default; white-space: nowrap;
}
.chip.tag { background: var(--accent-soft); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.pick .chip { cursor: pointer; background: #fff; border-color: var(--line); color: var(--ink-2); }
.chips.pick .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips.pick.ex .chip.on { background: var(--rose); border-color: var(--rose); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge.draft { background: var(--line-2); color: var(--muted); }
.badge.scheduled { background: var(--sky-soft); color: var(--sky); }
.badge.sending { background: var(--sun-soft); color: #9a6a10; }
.badge.sent, .badge.on { background: var(--accent-soft); color: var(--accent-ink); }
.badge.failed, .badge.off { background: var(--rose-soft); color: var(--rose); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fbfbf9; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--line-2); object-fit: cover; flex: none; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }

/* ---------- モーダル ---------- */
.overlay { position: fixed; inset: 0; background: rgba(27, 34, 48, .32); display: grid; place-items: center; z-index: 50; padding: 24px; }
.modal { background: var(--surface); border-radius: 16px; width: min(760px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.modal.wide { width: min(1040px, 100%); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.split { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }

/* ---------- メッセージ編集・プレビュー ---------- */
.msg-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: #fcfcfa; }
.phone { background: #8cabd9; border-radius: 22px; padding: 16px 12px; min-height: 420px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; }
.phone-head { color: #fff; font-size: 12px; font-weight: 600; text-align: center; margin-bottom: 4px; opacity: .9; }
.bubble { background: #fff; border-radius: 16px; border-top-left-radius: 4px; padding: 9px 12px; max-width: 88%; white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.bubble.img { padding: 0; overflow: hidden; }
.bubble.img img { display: block; max-width: 100%; }
.bubble .qr { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bubble .qr span { border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: 12px; }
.flex-card { background: #fff; border-radius: 14px; overflow: hidden; max-width: 88%; font-size: 13px; }
.flex-card .fc-body { padding: 12px; }
.flex-card .fc-btn { margin: 0 12px 12px; background: var(--accent); color: #fff; text-align: center; border-radius: 8px; padding: 8px; font-weight: 600; }
.btns-card { background: #fff; border-radius: 14px; max-width: 88%; font-size: 13px; overflow: hidden; }
.btns-card .t { padding: 12px; white-space: pre-wrap; }
.btns-card .a { border-top: 1px solid var(--line-2); padding: 9px; text-align: center; color: var(--sky); }

/* ---------- リッチメニュー ---------- */
.rm-canvas { position: relative; width: 100%; aspect-ratio: 2500 / 1686; background: var(--line-2) center / cover no-repeat; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.rm-canvas.half { aspect-ratio: 2500 / 843; }
.rm-cell { position: absolute; border: 1.5px dashed rgba(255, 255, 255, .95); outline: 1px solid rgba(27, 34, 48, .25); display: grid; place-items: center; color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.5); cursor: pointer; }
.rm-cell.sel { background: rgba(15, 118, 110, .35); }
.rm-thumb { width: 120px; aspect-ratio: 2500 / 1686; border-radius: 8px; background: var(--line-2) center / cover; border: 1px solid var(--line); flex: none; }
.layouts { display: flex; gap: 8px; flex-wrap: wrap; }
.layout-opt { width: 74px; border: 1px solid var(--line); border-radius: 8px; padding: 5px; cursor: pointer; background: #fff; }
.layout-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.layout-opt .mini { position: relative; width: 100%; aspect-ratio: 2500/1686; background: var(--line-2); border-radius: 4px; }
.layout-opt .mini.half { aspect-ratio: 2500/843; }
.layout-opt .mini i { position: absolute; border: 1px solid #fff; background: #d8dcd6; }

/* ---------- ログイン ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); padding: 36px 32px; text-align: center; }
.login-card h1 { font-size: 20px; margin: 18px 0 6px; }
.login-card .brand-mark { margin: 0 auto; width: 44px; height: 44px; font-size: 16px; border-radius: 12px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#toast div { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; animation: up .2s ease; }
#toast div.err { background: var(--rose); }
@keyframes up { from { opacity: 0; transform: translateY(6px); } }

.confirm-inline { display: inline-flex; gap: 6px; align-items: center; }
.section-gap { margin-top: 22px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- スマホ：ヘッダーのハンバーガーでサイドメニューを開閉 ---------- */
.topbar { display: none; }
.side-backdrop { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 14px;
  }
  .burger { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
  .burger span, .burger span::before, .burger span::after { display: block; width: 16px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; content: ''; }
  .burger span::before { position: absolute; top: -5px; }
  .burger span::after { position: absolute; top: 5px; }
  .topbar .brand { padding: 0; }
  .side {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; height: 100vh; z-index: 60;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: none;
  }
  .side.open { transform: translateX(0); }
  .side-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(27, 34, 48, .32); z-index: 55; }
  .main { padding: 18px 16px 48px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .split { grid-template-columns: 1fr; }
  .card { overflow-x: auto; }
  .modal-body .split { grid-template-columns: 1fr; }
}

/* ---------- 追加部品 ---------- */
a.brand { text-decoration: none; color: inherit; }
a.brand:hover .brand-name { color: var(--accent); }
.content { min-width: 0; }
.notice { background: var(--sun-soft); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; }
.errbox { background: var(--rose-soft); color: var(--rose); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tpl-card { cursor: pointer; }
.tpl-card:hover { border-color: var(--accent); }

.text-with-tools { display: flex; flex-direction: column; gap: 6px; }
.text-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.text-tools .btn.ghost { color: var(--accent-ink); padding: 4px 8px; }
.emoji-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; max-height: 180px; overflow-y: auto; }
.emoji-panel[hidden] { display: none; }
.emoji { border: 0; background: transparent; font-size: 20px; padding: 4px; border-radius: 6px; cursor: pointer; line-height: 1; }
.emoji:hover { background: var(--line-2); }

.uploader { display: flex; gap: 12px; align-items: center; }
.upl-thumb { width: 96px; height: 72px; border-radius: var(--radius-sm); border: 1px dashed var(--line); background: var(--line-2) center / cover no-repeat; display: grid; place-items: center; font-size: 11px; color: var(--muted); flex: none; }

.step { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: #fff; }
.step-head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.step-no { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-family: "Inter", sans-serif; }
.count-pill { margin-left: auto; background: var(--accent-soft); color: var(--accent-ink); border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; align-self: flex-start; }
.seg button { border: 0; background: #fff; padding: 7px 14px; cursor: pointer; font-weight: 500; }
.seg button.on { background: var(--accent); color: #fff; }

.add-types { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.action-row { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.action-row select { width: auto; }
.card-edit, .slot-edit { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.slot-edit input[type=number] { width: 80px; }

.cards-prev { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.cards-prev .flex-card { flex: 0 0 72%; max-width: 72%; }
.flex-card .fc-btn.sub { background: #fff; color: var(--sky); border: 1px solid var(--line); }
.video-prev { position: relative; }
.video-prev img { display: block; max-width: 100%; }
.video-prev span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 28px; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.event-hero { aspect-ratio: 20 / 13; background: var(--line-2) center / cover no-repeat; border-radius: 12px 12px 0 0; }
.rm-canvas { aspect-ratio: auto; }
.layout-opt .mini { aspect-ratio: auto; }

@media (max-width: 900px) {
  /* 表はカード型に縦並び */
  table.tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { border: 0; padding: 3px 0; display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
  .tbl td::before { content: attr(data-label); flex: 0 0 84px; font-size: 11px; color: var(--muted); padding-top: 2px; }
  .tbl td[data-label=""]::before, .tbl td:not([data-label])::before { display: none; }
  .tbl td > * { min-width: 0; }
  .card { overflow-x: visible; }
  .list-item { flex-wrap: wrap; }
  .rm-item .rm-actions, .rule-item > .small { width: 100%; justify-content: flex-start; }
  .rm-item .rm-thumb { width: 100px; }
  .rules-head { flex-direction: column; align-items: stretch; }
  .rm-split, .composer { grid-template-columns: 1fr !important; }
  .composer .phone { position: static; min-height: 0; }
  .modal { max-height: calc(100vh - 16px); }
  .overlay { padding: 8px; }
  .modal-foot { flex-wrap: wrap; }
  .slot-edit .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .uploader { flex-wrap: wrap; }
  .page-head .row { flex-wrap: wrap; }
}

/* 絵文字ピッカー（emoji-picker-element） */
.emoji-wrap[hidden] { display: none; }
.emoji-picker {
  width: 100%; height: 320px;
  --border-color: var(--line); --background: #fff; --input-border-color: var(--line);
  --indicator-color: var(--accent); --outline-color: var(--accent); --button-active-background: var(--accent-soft);
  --button-hover-background: var(--line-2); --emoji-size: 1.4rem; --num-columns: 9;
  border-radius: var(--radius-sm); overflow: hidden;
}
@media (max-width: 900px) { .emoji-picker { --num-columns: 7; height: 280px; } }

/* 位置情報の地図 */
.map-box { height: 260px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--line-2); z-index: 0; position: relative; }
.geo-results { display: flex; flex-direction: column; gap: 4px; }
.geo-results:empty { display: none; }
.geo-item { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; }
.geo-item:hover { border-color: var(--accent); background: var(--accent-soft); }
details summary { cursor: pointer; }

/* iPhoneで入力欄をタップしたときの自動拡大を防ぐ（16px未満だと拡大される） */
@media (max-width: 900px) {
  input, select, textarea { font-size: 16px; }
  .emoji-picker { --input-font-size: 16px; }
}

/* ---------- 追加：タグ入力・フォルダ・トーク など ---------- */
.seg a { display: inline-block; padding: 7px 14px; color: var(--ink); text-decoration: none; font-weight: 500; background: #fff; }
.seg a.on { background: var(--accent); color: #fff; }
.tag-input { display: flex; flex-direction: column; gap: 6px; }
.tag-input .chips:empty { display: none; }
.tag-input.ex .chip.tag { background: var(--rose-soft); color: var(--rose); }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 0 0 6px; font-size: 13px; line-height: 1; }
.ti-box { position: relative; }
.ti-drop { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(27, 34, 48, .12); max-height: 240px; overflow: auto; }
.ti-item { padding: 8px 10px; cursor: pointer; font-size: 14px; }
.ti-item.hi, .ti-item:hover { background: var(--accent-soft); }
.organizer { display: grid; grid-template-columns: 230px 1fr; min-height: 320px; }
.org-folders { border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 4px; background: #fcfcfa; border-radius: var(--radius) 0 0 var(--radius); }
.org-folder { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; }
.org-folder:hover { background: var(--line-2); }
.org-folder.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.org-items { padding: 12px; min-width: 0; }
.org-tools { margin-bottom: 8px; flex-wrap: wrap; }
.org-tools input[type=search] { min-width: 160px; }
.org-row { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--line-2); background: #fff; }
.org-row.dragging { opacity: .4; }
.org-row .drag { cursor: grab; color: var(--muted); user-select: none; padding: 0 4px; }
.org-row-body { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.org-row-body select { width: auto; max-width: 150px; }
.star { border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 0 2px; }
.star.on { color: var(--sun); }
.switch { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); }
.switch .knob { width: 18px; height: 18px; border-radius: 50%; background: var(--line); transition: background .15s; }
.switch.on { border-color: var(--accent); color: var(--accent); }
.switch.on .knob { background: var(--accent); }
.step-block { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.step-block .row select, .step-block .row input { width: auto; flex: 1; min-width: 120px; }
.trend { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 6px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.trend-bar { width: 100%; max-width: 34px; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85; }
.trend-x { font-size: 10px; color: var(--muted); }
td.plus { color: var(--accent); font-weight: 600; }
td.minus { color: var(--rose); font-weight: 600; }
.talk { display: grid; grid-template-columns: 280px 1fr; grid-template-rows: minmax(0, 1fr); height: calc(100vh - 170px); min-height: 540px; overflow: hidden; }
.talk-list { border-right: 1px solid var(--line); overflow: auto; }
.talk-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none; }
.talk-item:hover { background: var(--line-2); }
.talk-item.on { background: var(--accent-soft); }
.talk-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.talk-head { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.talk-log { flex: 1 1 auto; min-height: 140px; overflow: auto; padding: 14px; background: #eef2f1; display: flex; flex-direction: column; gap: 10px; }
.talk-msg { display: flex; flex-direction: column; max-width: 75%; }
.talk-msg.out { align-self: flex-end; align-items: flex-end; }
.talk-bubble { background: #fff; border-radius: 14px; padding: 8px 12px; white-space: pre-wrap; word-break: break-word; }
.talk-msg.out .talk-bubble { background: #9be4a6; }
.talk-compose { flex: none; padding: 10px 14px; border-top: 1px solid var(--line); }
.talk-compose textarea { min-height: 56px; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); margin-left: 6px; flex: none; }
.clamp1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.bulk-bar { margin-top: 14px; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bulk-bar[hidden] { display: none; }
tr.picked td { background: var(--accent-soft); }
.table-wrap { overflow-x: auto; }
.rm-canvas.draw { cursor: crosshair; touch-action: none; user-select: none; }
.rm-canvas.draw .rm-cell { cursor: move; }
.rm-handle { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; background: #fff; border: 2px solid var(--accent); border-radius: 3px; cursor: nwse-resize; }
.fx-box { display: flex; flex-direction: column; gap: 4px; }
.fx-box.horizontal, .fx-box.baseline { flex-direction: row; }
button.badge { border: 0; cursor: pointer; }
details > summary { cursor: pointer; }
@media (max-width: 900px) {
  .organizer { grid-template-columns: 1fr; }
  .org-folders { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; border-radius: var(--radius) var(--radius) 0 0; }
  .org-folder { padding: 6px 10px; }
  .talk { grid-template-columns: 1fr; height: auto; }
  .talk-list { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); }
  .talk-log { min-height: 320px; }
}
.form-item { flex-wrap: wrap; }
@media (max-width: 900px) {
  /* 友だち数の推移：棒を細く、日付は1つおきに */
  .trend { gap: 3px; height: 110px; }
  .trend-x { font-size: 9px; white-space: nowrap; }
  .trend-col:nth-child(even) .trend-x { visibility: hidden; }
  /* 回答フォームの一覧：縦に並べる */
  .form-item { flex-direction: column; align-items: stretch; gap: 8px; }
  .form-item > .row, .form-item > span.row { width: 100%; }
  .form-item select { flex: 1; min-width: 0; }
  .form-item .mono { display: block; word-break: break-all; }
  .form-item > .btn { width: 100%; justify-content: center; }
  .form-item > .grow { width: 100%; }
  /* 推移の表はスマホでも表のまま（カード型にすると縦に長くなるため） */
  table.tbl.compact { display: table; font-size: 12px; }
  .tbl.compact thead { display: table-header-group; }
  .tbl.compact tbody { display: table-row-group; }
  .tbl.compact tr { display: table-row; padding: 0; }
  .tbl.compact td, .tbl.compact th { display: table-cell; width: auto; padding: 7px 6px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
  .tbl.compact td::before { display: none; }
}

/* ダイアログが中身の幅で画面からはみ出さないように（スマホでリッチメニュー編集の右が切れていた） */
.modal { min-width: 0; }
.split > *, .rm-split > * { min-width: 0; }
.modal-body { overflow-x: hidden; }
.modal-body input, .modal-body select, .modal-body textarea { max-width: 100%; }

/* プランで使えないメニュー（非活性＋ホバーで理由） */
.nav a.locked { position: relative; color: #a3a9b5; cursor: not-allowed; }
.nav a.locked:hover { background: transparent; }
.nav a.locked .lock-mark { margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted, #6b7280); }
.nav a.locked[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 10px; top: calc(100% + 4px); z-index: 70;
  width: max-content; max-width: 220px; white-space: normal; padding: 6px 10px; border-radius: 8px;
  background: #1f2937; color: #fff; font-size: 12px; line-height: 1.5; opacity: 1; pointer-events: none;
}
