/* PocoPon Message 管理画面モック */
:root {
  --bg: #f4f5fa;
  --panel: #fff;
  --line: #e3e6ef;
  --text: #1c2333;
  --muted: #6b7385;
  --primary: #4f46e5;
  --primary-d: #4038c7;
  --primary-w: #eef0ff;
  --ok: #0f9f6e;
  --ok-w: #e3f7ee;
  --warn: #b7670a;
  --warn-w: #fdf1dc;
  --danger: #d43c3c;
  --danger-w: #fde8e8;
  --info: #2563c9;
  --info-w: #e6effd;
  --side: #151a30;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 26, 48, .05), 0 1px 6px rgba(20, 26, 48, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-size: 14px; line-height: 1.6; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
p + p { margin-top: 8px; }
small { font-size: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 12.5px; background: #f1f3f9; padding: 2px 6px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0 14px; }
[hidden] { display: none !important; }
.ic { flex: none; vertical-align: -3px; }

/* ---------- 枠組み ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: 224px; background: var(--side); color: #c9cee0; display: flex; flex-direction: column; z-index: 30; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; color: #fff; }
.side-brand:hover { text-decoration: none; }
.side-brand b { display: block; font-size: 14.5px; letter-spacing: .01em; }
.side-brand small { display: block; color: #8d95b3; font-size: 11px; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #6d63ff, #f59e0b); color: #fff; font-weight: 800; font-size: 18px; display: grid; place-items: center; }
.side-nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: #c9cee0; margin-bottom: 2px; }
.nav-item:hover { background: rgba(255, 255, 255, .07); text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item.locked { opacity: .45; }
.nav-t { flex: 1; min-width: 0; line-height: 1.3; }
.nav-t b { display: block; font-size: 13.5px; font-weight: 600; }
.nav-t small { display: block; font-size: 11px; opacity: .7; }
.side-foot { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; color: #a9b0cb; font-size: 12.5px; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.side-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }

.main { margin-left: 224px; min-height: 100vh; display: flex; flex-direction: column; min-width: 900px; }
.top { height: 60px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.top-title { display: flex; align-items: center; gap: 10px; }
.top-title h1 { font-size: 19px; }
.top-sub { color: var(--muted); font-size: 13px; }
.top-right { display: flex; align-items: center; gap: 14px; }
.acct { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfe; cursor: pointer; }
.acct-t { display: grid; line-height: 1.25; }
.acct-t small { font-size: 10.5px; color: var(--muted); }
.acct select { border: 0; background: transparent; font-weight: 600; font-size: 13px; padding: 0 18px 0 0; height: auto; cursor: pointer; outline: none; }
.tabs { background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 24px; display: flex; gap: 4px; }
.tab { padding: 11px 14px 9px; color: var(--muted); font-weight: 600; font-size: 13.5px; border-bottom: 3px solid transparent; display: flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-badge { font-size: 10.5px; background: var(--warn-w); color: var(--warn); padding: 0 6px; border-radius: 999px; }
.content { padding: 22px 24px 48px; max-width: 1440px; width: 100%; display: grid; gap: 18px; align-content: start; }

/* ---------- 共通部品 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 50px; flex-wrap: wrap; }
.card-h.bt { border-top: 1px solid var(--line); }
.card-h > b { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.card-b { padding: 16px; }
.card-f { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fafbfe; }
.grid { display: grid; gap: 18px; }
.grid.astart { align-items: start; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-1-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); }
.col { display: grid; gap: 18px; align-content: start; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.sp { flex: 1; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.center { text-align: center; }
.pad { padding: 10px 16px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.sec { font-size: 15px; margin-top: 6px; }
.link { font-size: 13px; font-weight: 600; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; justify-self: start; }
.back .ic { transform: rotate(180deg); }

.kpi { padding: 14px 16px; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-val { font-size: 26px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 4px; }
.kpi-val small { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-sub.up, .up { color: var(--ok); }
.kpi-sub.down, .down { color: var(--danger); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid #cfd4e2; background: #fff; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f5f6fb; text-decoration: none; }
.tbl td .btn { vertical-align: middle; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-w); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn.block { display: flex; width: 100%; justify-content: flex-start; }
.btn.disabled, .btn:disabled { opacity: .5; cursor: default; }
.is-locked { opacity: .55; cursor: not-allowed !important; }
.btn.is-locked::after, .chip.is-locked::after {
  content: ""; width: 12px; height: 12px; background: currentColor; flex: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: #eceef5; color: #545c70; }
.badge.ok { background: var(--ok-w); color: var(--ok); }
.badge.warn { background: var(--warn-w); color: var(--warn); }
.badge.danger { background: var(--danger-w); color: var(--danger); }
.badge.info { background: var(--info-w); color: var(--info); }
.badge.muted { background: #eceef5; color: #6b7385; }
.badge.demo { background: #fff6e0; color: #96600a; border: 1px solid #f3dca6; padding: 3px 10px; }
.badge.lv1, .lv1 { background: #eceef5; color: #545c70; }
.badge.lv2, .lv2 { background: var(--info-w); color: var(--info); }
.badge.lv3, .lv3 { background: var(--primary-w); color: var(--primary); }
.lv0 { background: #f6f7fb; color: #b3b9c9; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { --c: var(--primary); display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 999px; border: 1px solid #cfd4e2; background: #fff; font-size: 12.5px; font-weight: 600; color: #4a5266; cursor: pointer; }
button.chip:hover { background: #f5f6fb; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.sm { padding: 1px 9px; font-size: 11.5px; }
span.chip { cursor: default; border-color: color-mix(in srgb, var(--c) 35%, #fff); background: color-mix(in srgb, var(--c) 10%, #fff); color: color-mix(in srgb, var(--c) 78%, #000); margin: 1px 2px 1px 0; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
input[type="text"], input[type="search"], input[type="email"], input[type="number"], select, textarea {
  height: 36px; border: 1px solid #cfd4e2; border-radius: 8px; padding: 0 10px; background: #fff; outline: none; max-width: 100%;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
input:disabled, select:disabled, textarea:disabled { background: #f4f5fa; color: var(--muted); }
.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 10px; color: var(--muted); }
.search input { padding-left: 32px; width: 300px; }
.field { display: grid; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 700; color: #4a5266; }
.field input, .field select, .field textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg-btn { display: inline-flex; border: 1px solid #cfd4e2; border-radius: 8px; overflow: hidden; background: #fff; }
.seg-btn button { border: 0; background: transparent; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 5px; color: #4a5266; }
.seg-btn button + button { border-left: 1px solid #cfd4e2; }
.seg-btn button.active { background: var(--primary); color: #fff; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfe; white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid #eef0f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.hover tbody tr[data-href] { cursor: pointer; }
.tbl.hover tbody tr[data-href]:hover { background: #f7f8fd; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .right { text-align: right; }
.tbl .center { text-align: center; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; }
.ucell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ucell b { font-size: 13.5px; }
.ucell small { display: block; color: var(--muted); font-size: 11.5px; }
.dot-on { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10b981; margin-left: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; margin: 0; padding: 6px 16px 12px; font-size: 13px; }
.kv dt { color: var(--muted); padding: 7px 16px 7px 0; border-bottom: 1px solid #eef0f6; white-space: nowrap; }
.kv dd { margin: 0; padding: 7px 0; border-bottom: 1px solid #eef0f6; min-width: 0; overflow-wrap: anywhere; }
.kv.tight { padding: 8px 0 0; font-size: 12.5px; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.note { position: relative; padding: 11px 14px 11px 38px; border-radius: var(--radius); background: var(--primary-w); color: #3a3690; font-size: 13px; border: 1px solid #d9dcff; }
.note > .ic { position: absolute; left: 14px; top: 14px; }
.note.warn { background: var(--warn-w); border-color: #f3dca6; color: #7a4a06; }
.linklist { display: grid; gap: 8px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #cfd4e2; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 8px; }
.spinner.sm { width: 10px; height: 10px; margin-right: 2px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: #10b981; margin-right: 6px; align-self: center; animation: pulse 1.6s infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); } 100% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); } }
pre.code { margin: 12px 0 0; background: #151a30; color: #d7dcf2; padding: 14px; border-radius: 8px; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; font-family: Consolas, Menlo, monospace; }

#pm-toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; justify-items: end; }
.toast { display: flex; align-items: center; gap: 8px; background: #1c2333; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(20, 26, 48, .3); animation: toastIn .25s ease; max-width: 460px; transition: opacity .35s; }
.toast.warn { background: #8a4b05; }
.toast.out { opacity: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 20, 40, .5); display: grid; place-items: center; z-index: 90; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: min(520px, 100%); box-shadow: 0 30px 80px rgba(15, 20, 40, .35); overflow: hidden; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
.modal-b { padding: 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; background: #fafbfe; border-top: 1px solid var(--line); }
.modal { max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { width: min(640px, 100%); }
.modal-b { overflow-y: auto; }
.modal-b > p + .field, .modal-b > .note { margin-top: 12px; }
.toast.alert { background: #a12a2a; }
.btn.danger { color: var(--danger); }
.btn.ghost.danger:hover { background: var(--danger-w); }
.good { color: var(--ok); font-weight: 600; }
.bad { color: var(--danger); font-weight: 600; }
.cond { display: grid; grid-template-columns: 1.6fr 1fr 1fr 30px; gap: 6px; margin-bottom: 6px; align-items: center; }
.cond select, .cond input { width: 100%; min-width: 0; }
.cond-eq { text-align: center; color: var(--muted); font-weight: 700; }
.tbl tr.is-site { background: #f3f8ff; }
.tbl tr.is-off td:not(:last-child) { opacity: .55; }
mark { background: #fff1c2; color: inherit; border-radius: 3px; padding: 0 2px; }

.denied { padding: 54px 24px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.denied-ic { width: 64px; height: 64px; border-radius: 50%; background: #eceef5; color: var(--muted); display: grid; place-items: center; }
.denied h2 { font-size: 18px; }

/* ---------- グラフ ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart .ax { font-size: 10.5px; fill: #8a91a3; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.lg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.hbars { display: grid; gap: 9px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 10px; font-size: 12.5px; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-t { height: 10px; background: #eef0f6; border-radius: 999px; overflow: hidden; }
.hbar-t i { display: block; height: 100%; border-radius: 999px; transition: width .4s; }
.hbar-v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.dn-legend { display: grid; gap: 6px; font-size: 12.5px; flex: 1; min-width: 160px; }
.dn-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; }
.dn-row i { width: 10px; height: 10px; border-radius: 3px; }
.funnel { display: grid; gap: 10px; }
.fn-row { display: grid; grid-template-columns: 130px 1fr 120px; gap: 10px; align-items: center; font-size: 12.5px; }
.fn-t { position: relative; height: 30px; background: #f1f3f9; border-radius: 6px; overflow: hidden; }
.fn-t i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #6d63ff, #4f46e5); border-radius: 6px; }
.fn-t b { position: absolute; left: 10px; top: 5px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .45); font-variant-numeric: tabular-nums; }
.fn-t b.out { color: var(--text); text-shadow: none; }
.fn-r { color: var(--muted); text-align: right; }

/* ---------- ホーム ---------- */
.pcard { padding: 14px 16px; color: var(--text); display: grid; gap: 8px; transition: border-color .15s, transform .15s; }
.pcard:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-1px); }
.pcard.locked { opacity: .6; }
.pcard-h { display: flex; align-items: center; gap: 10px; }
.pcard-h > div { flex: 1; line-height: 1.3; }
.pcard-h b { display: block; font-size: 15px; }
.pcard-h small { color: var(--muted); }
.pcard-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-w); color: var(--primary); display: grid; place-items: center; }
.pcard p { color: #4a5266; font-size: 13px; }
.pcard-f { font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
.todo { padding: 6px; }
.todo-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); }
.todo-row:hover { background: #f5f6fb; text-decoration: none; }
.todo-row span:nth-child(2) { flex: 1; }
.todo-row b { background: var(--danger-w); color: var(--danger); border-radius: 999px; padding: 0 9px; font-size: 12.5px; }
.todo-ic { width: 30px; height: 30px; border-radius: 8px; background: #eef0f6; display: grid; place-items: center; color: #4a5266; }
.log-mini { display: grid; grid-template-columns: 62px 1fr; gap: 8px; font-size: 12.5px; padding: 5px 0; }

/* ---------- Insight ---------- */
.score { width: 70px; height: 6px; background: #eef0f6; border-radius: 999px; overflow: hidden; display: inline-block; margin-right: 6px; vertical-align: middle; }
.score i { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #ef4444); }
.profile { display: grid; justify-items: center; gap: 8px; text-align: center; }
.profile h2 { font-size: 18px; }
.pstats { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; }
.pstats div { padding: 8px 4px; }
.pstats div + div { border-left: 1px solid var(--line); }
.pstats b { display: block; font-size: 18px; }
.pstats small { color: var(--muted); font-size: 11px; }
.tl-session + .tl-session { margin-top: 22px; }
.tl-sh { display: flex; align-items: baseline; gap: 10px; padding: 6px 10px; background: #f4f5fa; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }
.tl { position: relative; padding-left: 4px; }
.tl::before { content: ""; position: absolute; left: 16px; top: 6px; bottom: 6px; width: 2px; background: #e3e6ef; }
.tl-ev { --e: #8a91a3; position: relative; display: grid; grid-template-columns: 26px 62px 1fr; gap: 10px; align-items: start; padding: 6px 0; }
.tl-ic { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid var(--e); color: var(--e); display: grid; place-items: center; z-index: 1; }
.tl-time { color: var(--muted); font-size: 12px; padding-top: 3px; font-variant-numeric: tabular-nums; }
.tl-body { min-width: 0; padding-top: 1px; }
.tl-body b { font-weight: 600; }
.tl-body small { display: block; color: var(--muted); }
.tl-type { display: inline-block; font-size: 11px; font-weight: 700; color: var(--e); background: color-mix(in srgb, var(--e) 12%, #fff); border-radius: 4px; padding: 0 6px; margin-right: 8px; }
.ev-visit { --e: #64748b; }
.ev-view { --e: #3b82f6; }
.ev-action { --e: #d97706; }
.ev-chat { --e: #0ea5a4; }
.ev-form { --e: #8b5cf6; }
.ev-cv { --e: #0f9f6e; }
.ev-cv .tl-body b { color: #0b7d56; }
.ev-leave { --e: #d43c3c; }

/* ---------- Live ---------- */
.playbtn { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-w); color: var(--primary); display: grid; place-items: center; }
.browser { margin: 16px; border: 1px solid #cfd4e2; border-radius: 10px; overflow: hidden; background: #fff; }
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #eef0f6; border-bottom: 1px solid #dfe3ee; }
.browser-bar i { width: 10px; height: 10px; border-radius: 50%; background: #cfd4e2; }
.browser-bar span { flex: 1; margin-left: 8px; background: #fff; border-radius: 6px; padding: 2px 10px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-view { position: relative; height: 420px; overflow: hidden; background: #f7f8fc; user-select: none; }
.mp { position: absolute; left: 0; right: 0; top: 0; display: none; will-change: transform; }
.mp.on { display: block; }
.mp > *, .mp-card > * { position: absolute; }
.mp-header { left: 0; right: 0; top: 0; height: 48px; background: #fff; border-bottom: 1px solid #e3e6ef; display: flex; align-items: center; gap: 18px; padding: 0 4%; font-size: 12px; color: #6b7385; }
.mp-header b { color: #0e7c7b; font-size: 15px; margin-right: auto; }
.mp-h { left: 6%; font-weight: 700; font-size: 15px; }
.mp-h small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.mp-card { left: 4%; width: 92%; height: 110px; background: #fff; border: 1px solid #e3e6ef; border-radius: 10px; }
.mp-card b { top: 12px; left: 3%; font-size: 14px; }
.mp-wage { top: 36px; left: 3%; font-size: 12px; color: #c2410c; font-weight: 700; }
.mp-card em { right: 3%; bottom: 12px; font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: #0e7c7b; border-radius: 999px; padding: 3px 12px; }
.sk { background: #e7eaf2; border-radius: 4px; }
.mp-title { left: 6%; right: 6%; height: 90px; background: #fff; border: 1px solid #e3e6ef; border-radius: 10px; padding: 14px 16px; }
.mp-title b { position: static; display: block; font-size: 17px; }
.mp-tags { position: static; display: flex; gap: 6px; margin-top: 8px; }
.mp-tags i { font-style: normal; font-size: 11px; background: #e5f5f4; color: #0e7c7b; padding: 1px 8px; border-radius: 4px; font-weight: 700; }
.mp-table { left: 6%; width: 88%; background: #fff; border: 1px solid #e3e6ef; border-radius: 10px; font-size: 12.5px; }
.mp-table div { position: static; height: 40px; display: flex; align-items: center; padding: 0 14px; border-bottom: 1px solid #eef0f6; }
.mp-table div:last-child { border-bottom: 0; }
.mp-table span { width: 84px; color: var(--muted); font-weight: 700; }
.mp-btn { display: grid; place-items: center; background: #e8590c; color: #fff; font-weight: 700; border-radius: 999px; font-size: 14px; }
.mp-btn.sub { background: #fff; color: #0e7c7b; border: 1.5px solid #0e7c7b; border-radius: 8px; font-size: 12.5px; }
.mp-btn.rage { background: #fde8e8; border-color: var(--danger); color: var(--danger); animation: shake .25s linear infinite; }
@keyframes shake { 0%, 100% { margin-left: 0; } 25% { margin-left: -2px; } 75% { margin-left: 2px; } }
.mp label { left: 8%; font-size: 12px; font-weight: 700; color: #4a5266; }
.mp-input { height: 38px; background: #fff; border: 1.5px solid #cfd4e2; border-radius: 8px; padding: 0 12px; display: flex; align-items: center; font-size: 13px; letter-spacing: .08em; color: #4a5266; }
.mp-input.focus { border-color: #0e7c7b; box-shadow: 0 0 0 3px rgba(14, 124, 123, .15); }
.lv-cursor { position: absolute; z-index: 5; margin: -3px 0 0 -5px; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3)); }
.lv-ripple { position: absolute; z-index: 4; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 3px solid #ef4444; animation: ripple .6s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.lv-end { position: absolute; inset: 0; z-index: 6; background: rgba(21, 26, 48, .72); color: #fff; display: grid; place-content: center; justify-items: center; gap: 4px; }
.lv-end b { font-size: 16px; }
.lv-end span { font-size: 12.5px; opacity: .85; }
.controls { display: flex; align-items: center; gap: 12px; padding: 0 16px 6px; }
.lv-time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.lv-bar { position: relative; flex: 1; height: 10px; background: #e3e6ef; border-radius: 999px; cursor: pointer; }
.lv-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--primary); border-radius: 999px; pointer-events: none; }
.mk, .lv-ev { --m: #3b82f6; }
.mk-click { --m: #8b5cf6; }
.mk-form { --m: #0ea5a4; }
.mk-scroll { --m: #94a3b8; }
.mk-warn { --m: #ef4444; }
.mk-leave { --m: #1c2333; }
.lv-bar .mk { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; border-radius: 2px; background: var(--m); pointer-events: none; }
.lv-events { display: grid; max-height: 330px; overflow-y: auto; }
.lv-ev { display: grid; grid-template-columns: 40px 1fr; gap: 8px; text-align: left; border: 0; border-left: 4px solid var(--m); background: #fff; padding: 8px 12px; font-size: 12.5px; cursor: pointer; border-bottom: 1px solid #eef0f6; }
.lv-ev span { color: var(--muted); font-variant-numeric: tabular-nums; }
.lv-ev:hover { background: #f7f8fd; }
.lv-ev.active { background: var(--primary-w); font-weight: 700; }
.lv-ev.mk-warn { color: var(--danger); }
.note-card { border-color: #f3c8c8; }
.note-card .card-h { background: var(--danger-w); color: #9b2323; border-bottom-color: #f3c8c8; }
.note-card p { font-size: 13px; margin-bottom: 12px; }
.note-card.calm { border-color: #bfe6d3; }
.note-card.calm .card-h { background: var(--ok-w); color: #0b6b4b; border-bottom-color: #bfe6d3; }
.mk-cv { --m: #0f9f6e; }
.lv-ev.mk-cv { color: #0b7d56; font-weight: 700; }
.mp-table div.rage { background: #fde8e8; color: var(--danger); animation: shake .25s linear infinite; }
.mp-done { background: #fff; border: 1px solid #e3e6ef; border-radius: 12px; padding: 26px 18px; display: grid; gap: 6px; justify-items: center; text-align: center; }
.mp-done > * { position: static; }
.mp-done i { width: 46px; height: 46px; border-radius: 50%; background: #e3f7ee; color: #0f9f6e; display: grid; place-items: center; font-style: normal; font-size: 24px; font-weight: 700; }
.mp-done b { font-size: 16px; }
.mp-done span { font-size: 12.5px; color: var(--muted); }

/* ---------- Action ---------- */
.pv-wrap { background: #eceef5; display: grid; place-items: center; padding: 18px; }
.pv-frame { position: relative; width: 100%; height: 380px; background: #fff; border-radius: 10px; overflow: hidden; border: 1px solid #cfd4e2; box-shadow: 0 6px 20px rgba(20, 26, 48, .1); }
.pv-frame.sp { width: 300px; height: 500px; border-radius: 26px; border: 8px solid #1c2333; }
.pv-head { height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid #e3e6ef; }
.pv-head b { color: #0e7c7b; margin-right: auto; font-size: 13px; }
.pv-head i { width: 34px; height: 8px; border-radius: 4px; background: #e7eaf2; }
.pv-frame.sp .pv-head i { width: 16px; }
.pv-hero { height: 90px; background: linear-gradient(120deg, #e5f5f4, #eef0ff); display: grid; place-content: center; justify-items: center; }
.pv-hero b { font-size: 15px; }
.pv-hero span { font-size: 11px; color: var(--muted); }
.pv-lines { padding: 16px; display: grid; gap: 10px; }
.pv-lines i { height: 10px; border-radius: 4px; background: #e7eaf2; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfd4e2; cursor: pointer; padding: 0; }
.swatch.active { box-shadow: 0 0 0 2px var(--text); }
.swatch.is-locked::after { display: none; }
.pv-frame .pw-cta, .pv-frame .pw-x { cursor: pointer; }
.ab-box { border: 1px solid #d9dcff; background: #f8f8ff; border-radius: 10px; padding: 12px 14px 2px; }
.ab-box.off { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-style: dashed; border-color: #cfd4e2; background: #fafbfe; }
.ab-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tpl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tpl-item { display: grid; gap: 6px; text-align: center; font-size: 12.5px; cursor: pointer; }
.tpl-item input { position: absolute; opacity: 0; }
.tpl-box { position: relative; height: 86px; border: 2px solid #cfd4e2; border-radius: 10px; background: #f4f5fa; }
.tpl-item input:checked + .tpl-box { border-color: var(--primary); background: var(--primary-w); }
.tpl-box i { position: absolute; background: var(--primary); border-radius: 4px; }
.tpl-popup i { inset: 22px 28%; }
.tpl-bar i { left: 0; right: 0; bottom: 0; height: 18px; border-radius: 0 0 7px 7px; }
.tpl-slide i { right: 8px; bottom: 8px; width: 42%; height: 34px; }

/* ---------- Message ---------- */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr) 270px; gap: 14px; height: calc(100vh - 170px); min-height: 480px; }
.inbox > .card { display: flex; flex-direction: column; overflow: hidden; }
#cv-list { overflow-y: auto; flex: 1; }
.cv-item { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; border-top: 1px solid #eef0f6; background: #fff; padding: 11px 12px; cursor: pointer; border-left: 3px solid transparent; }
.cv-item:hover { background: #f7f8fd; }
.cv-item.active { background: var(--primary-w); border-left-color: var(--primary); }
.cv-main { flex: 1; min-width: 0; display: grid; gap: 3px; justify-items: start; }
.cv-top { display: flex; justify-content: space-between; width: 100%; gap: 8px; }
.cv-top small { color: var(--muted); white-space: nowrap; }
.cv-last { font-size: 12.5px; color: #4a5266; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cv-last i { font-style: normal; color: var(--muted); }
.th-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.th-msgs { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 12px; align-content: start; background: #f7f8fc; }
.msg { display: grid; gap: 2px; max-width: 76%; justify-self: start; }
.msg.op, .msg.bot { justify-self: end; justify-items: end; }
.msg-meta { font-size: 11px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.bubble { padding: 9px 13px; border-radius: 14px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; border-top-left-radius: 4px; overflow-wrap: anywhere; }
.msg.op .bubble { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 14px 4px 14px 14px; }
.msg.bot .bubble { background: #e9ebf5; border-color: #dfe3ee; border-radius: 14px 4px 14px 14px; }
.th-reply { border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; }
.reply { display: flex; gap: 8px; }
.reply input { flex: 1; }
.inbox-info { overflow-y: auto !important; }
.info-h { display: grid; justify-items: center; gap: 4px; padding: 18px 12px 8px; text-align: center; }
.info-h small { color: var(--muted); }
.bt-wrap { overflow-x: auto; padding: 22px; }
.bt-row { position: relative; display: flex; align-items: flex-start; gap: 36px; }
.bt-node { width: 250px; flex: none; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 10px 12px; display: grid; gap: 6px; justify-items: start; box-shadow: var(--shadow); }
.bt-opt { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; font-weight: 700; font-size: 13px; }
.bt-opt span { background: var(--primary-w); color: var(--primary); border-radius: 999px; padding: 0 8px; font-size: 11.5px; }
.bt-opt.start { color: var(--primary); justify-content: flex-start; }
.bt-text { font-size: 12.5px; color: #4a5266; background: #f4f5fa; border-radius: 8px; padding: 6px 8px; width: 100%; }
.bt-text .ic { margin-right: 4px; color: var(--muted); }
.bt-children { position: relative; display: flex; flex-direction: column; gap: 14px; }
.bt-children::before { content: ""; position: absolute; left: -36px; top: 20px; width: 18px; border-top: 2px solid #cfd4e2; }
.bt-children > .bt-row::before { content: ""; position: absolute; left: -18px; top: 20px; width: 18px; border-top: 2px solid #cfd4e2; }
.bt-children > .bt-row:not(:last-child)::after { content: ""; position: absolute; left: -18px; top: 20px; bottom: -36px; border-left: 2px solid #cfd4e2; }
.bt-node.editing { border-color: #c9cdfb; }
.bt-tools { display: flex; gap: 4px; width: 100%; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 2px; }
.bt-tools .btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.bt-tools .btn.ghost { margin-left: auto; color: var(--danger); }
.pv-mail { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pv-mail dl { display: grid; grid-template-columns: auto 1fr; margin: 0; padding: 10px 14px; background: #fafbfe; border-bottom: 1px solid var(--line); font-size: 12.5px; gap: 2px 12px; }
.pv-mail dt { color: var(--muted); }
.pv-mail dd { margin: 0; overflow-wrap: anywhere; }
.pv-mail-b { padding: 16px 14px; font-size: 13.5px; line-height: 1.8; overflow-wrap: anywhere; }
.pv-line { border-radius: 10px; overflow: hidden; background: #8cabd9; max-width: 340px; margin: 0 auto; }
.pv-line-h { background: #26314a; color: #fff; font-size: 12.5px; font-weight: 700; padding: 8px 12px; }
.pv-line-b { padding: 16px 12px 22px; display: flex; align-items: flex-end; gap: 6px; }
.pv-line-b .bubble { border: 0; border-radius: 4px 16px 16px 16px; max-width: 84%; line-height: 1.7; }
.pv-line-b span { font-size: 10.5px; color: #fff; }
.pv-mail + p, .pv-line + p { margin-top: 12px; }

/* ---------- Datahub ---------- */
.conn-test { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.conn-test .ic { margin-right: 3px; }
#q-result .empty p { margin: 8px 0 10px; }
.conn { display: flex; flex-direction: column; }
.conn .card-b { flex: 1; }
.qlist { display: grid; }
.qlist button { display: flex; gap: 8px; align-items: flex-start; text-align: left; border: 0; border-bottom: 1px solid #eef0f6; background: #fff; padding: 11px 14px; cursor: pointer; font-size: 13px; border-left: 3px solid transparent; }
.qlist button .ic { margin-top: 3px; }
.qlist button:hover { background: #f7f8fd; }
.qlist button.active { background: var(--primary-w); border-left-color: var(--primary); font-weight: 700; }
textarea.sql { display: block; width: 100%; height: 250px; border: 0; border-radius: 0; background: #151a30; color: #d7dcf2; font-family: Consolas, Menlo, monospace; font-size: 12.5px; line-height: 1.7; padding: 14px 16px; resize: vertical; }
textarea.sql:focus { box-shadow: none; }
textarea.sql:disabled { background: #2a2f47; color: #aab1cc; }
.q-meta { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.q-table { max-height: 320px; overflow: auto; }

/* ---------- Report ---------- */
.mini-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.mini-kpis div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: grid; }
.mini-kpis small { color: var(--muted); }
.mini-kpis b { font-size: 20px; }
.mini-kpis span { font-size: 11.5px; }

/* ---------- 設定 ---------- */
.perm-dots { display: flex; gap: 4px; }
.pd { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12.5px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row .pd { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(28, 35, 51, .22); }
.matrix th.center span { display: block; font-size: 11.5px; }
.lvsel { height: 30px; font-size: 12.5px; font-weight: 700; border-color: transparent; border-radius: 999px; padding: 0 8px; cursor: pointer; }

@media (max-width: 1280px) {
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbox { grid-template-columns: 260px minmax(0, 1fr); }
  .inbox-info { display: none !important; }
}
