:root {
	--bg: #eef2fa;
	--surface: #ffffff;
	--surface-alt: #e6eefb;
	--primary: #1e40af;
	--primary-hover: #1b3aa0;
	--primary-dark: #16307f;
	--primary-soft: #dbe6fb;
	--primary-bg: #f2f6ff;
	--border: #d4deef;
	--border-strong: #aec3e6;
	--text: #10203f;
	--text-muted: #5a6b88;
	--danger: #e11d48;
	--danger-soft: #ffe1e8;
	--warn: #b45309;
	--warn-soft: #fbeccf;
	/* 濃い青のグラデーション（ブランド基調） */
	--grad: linear-gradient(135deg, #0b1f4d 0%, #1e40af 55%, #2f6bed 100%);
	--grad-soft: linear-gradient(135deg, #eef3ff 0%, #dce8fc 100%);
	--shadow: 0 1px 2px rgba(11, 31, 77, 0.06), 0 10px 30px rgba(11, 31, 77, 0.07);
	--radius: 9px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
	font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Segoe UI", sans-serif;
	background: var(--bg);
	color: var(--text);
	font-size: 14px;
	line-height: 1.55;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--primary-soft); padding: 1px 5px; border-radius: 3px; font-size: 12px; color: var(--primary); }

/* Login */
.login-screen {
	min-height: 100vh;
	display: grid;
	place-items: center;
	background: var(--grad);
	background-attachment: fixed;
}
.login-card {
	background: var(--surface);
	width: 380px;
	max-width: calc(100vw - 32px);
	padding: 36px 32px 28px;
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba(4, 14, 40, 0.45), 0 2px 8px rgba(4, 14, 40, 0.25);
	border-top: 4px solid transparent;
	border-image: var(--grad) 1;
}
.brand-large { font-size: 22px; margin-bottom: 4px; }
.brand-large .brand-logo { width: 36px; height: 36px; font-size: 14px; }
.login-card .sub { color: var(--text-muted); font-size: 12px; margin: 0 0 24px; }
.login-card .hint { font-size: 11px; color: var(--text-muted); text-align: center; margin: 14px 0 0; }
.btn-block { width: 100%; padding: 10px; font-size: 14px; }

/* Forms */
label { display: block; font-size: 12px; font-weight: 600; color: #4a5568; margin-bottom: 6px; }
input, select, textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: #fff;
	font-size: 14px;
	font-family: inherit;
	color: var(--text);
	outline: none;
	transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

button {
	background-color: var(--primary);
	background-image: var(--grad);
	color: #fff;
	border: none;
	padding: 8px 16px;
	border-radius: var(--radius);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	box-shadow: 0 1px 2px rgba(11, 31, 77, 0.18);
	transition: filter .15s, background .15s, color .15s, border-color .15s, box-shadow .15s, transform .05s;
}
button:hover { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(11, 31, 77, 0.28); }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; background-image: none; color: var(--primary); border: 1px solid var(--border-strong); box-shadow: none; }
button.ghost:hover { background: var(--primary-soft); filter: none; box-shadow: none; }
button.danger { background: #fff; background-image: none; color: var(--danger); border: 1px solid var(--danger-soft); box-shadow: none; }
button.danger:hover { background: var(--danger-soft); filter: none; box-shadow: none; }
button.sm { padding: 4px 10px; font-size: 12px; }

.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: var(--radius); font-size: 12px; margin-bottom: 12px; }

/* Layout */
.app { display: grid; grid-template-rows: 56px 1fr; height: 100vh; }
header.topbar {
	background: var(--grad);
	border-bottom: none;
	box-shadow: 0 2px 14px rgba(11, 31, 77, 0.28);
	padding: 0 20px;
	display: flex;
	align-items: center;
	gap: 18px;
	position: relative;
	z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--primary); font-size: 16px; letter-spacing: -.2px; }
.topbar .brand { color: #fff; }
.brand-logo { width: 28px; height: 28px; background: var(--grad); border-radius: 7px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 11px; letter-spacing: 0; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
/* トップバーはグラデーション背景のためロゴは半透明ガラス調に */
.topbar .brand-logo { background: rgba(255, 255, 255, 0.18); backdrop-filter: blur(2px); }
nav.tabs { display: flex; gap: 4px; margin-left: 8px; }
nav.tabs button {
	background: transparent;
	background-image: none;
	color: rgba(255, 255, 255, 0.78);
	font-weight: 500;
	border-radius: 7px;
	padding: 6px 14px;
	box-shadow: none;
}
nav.tabs button.active { background: rgba(255, 255, 255, 0.18); color: #fff; }
nav.tabs button:hover:not(.active) { background: rgba(255, 255, 255, 0.1); color: #fff; filter: none; }
.user-pill { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: rgba(255, 255, 255, 0.82); }
.user-pill .ghost { padding: 4px 12px; font-size: 12px; color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.user-pill .ghost:hover { background: rgba(255, 255, 255, 0.14); }

main.content { overflow: auto; padding: 20px; }

/* Cards */
.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 18px 20px;
	box-shadow: var(--shadow);
	margin-bottom: 16px;
}
.card-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.card-toolbar h2 { margin: 0; font-size: 15px; color: var(--primary); }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 10px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
thead th {
	background: var(--primary-bg);
	color: var(--primary);
	font-weight: 600;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .04em;
	position: sticky;
	top: 0;
}
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--primary-bg); }
tbody tr.selected { background: var(--primary-soft); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Split layout */
.split { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(420px, 1.3fr); gap: 18px; align-items: start; }
.split > .col { min-width: 0; }
.detail-empty { padding: 60px 20px; text-align: center; color: var(--text-muted); font-size: 13px; background: var(--surface); border: 1px dashed var(--border); border-radius: 8px; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.6; }
.badge.diamond  { background: #fef0d4; color: #8a5a06; }
.badge.premier  { background: #e9d8fd; color: #553c9a; }
.badge.sapphire { background: #ccecff; color: #1f5d8d; }
.badge.crystal  { background: #d6f0e1; color: #1f6e3f; }
.badge.regular  { background: #edf0f3; color: #4a5568; }
.badge.confirmed { background: #d6f0e1; color: #1f6e3f; }
.badge.cancelled { background: var(--danger-soft); color: var(--danger); }
.badge.pending   { background: #fef0d4; color: #8a5a06; }
.badge.greeting  { background: var(--primary-soft); color: var(--primary); }
.badge.message   { background: #d6e4f5; color: #2b4f7c; }
.badge.campaign  { background: #fef0d4; color: #8a5a06; }

/* Sub-tabs */
.subtabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.subtabs button {
	background: transparent;
	color: var(--text-muted);
	padding: 8px 14px;
	border-radius: 0;
	border-bottom: 2px solid transparent;
	font-weight: 500;
	font-size: 13px;
}
.subtabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.subtabs button:hover:not(.active) { color: var(--text); }

/* 生成ルール — ツール呼び出しルール行 */
.tool-rule-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.tool-rule-row .tr-tool { flex: 0 0 240px; max-width: 45%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tool-rule-row .tr-when { flex: 1 1 auto; }
.tool-rule-row .ghost.sm { flex: 0 0 auto; }
@media (max-width: 720px) { .tool-rule-row { flex-wrap: wrap; } .tool-rule-row .tr-tool { flex-basis: 100%; max-width: 100%; } }

/* 生成モニター — 3入力グリッド */
.gen-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.gen-input { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--primary-bg); }
.gen-input .gi-head { font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.gen-input .gi-body { font-size: 12px; color: var(--text); line-height: 1.5; word-break: break-word; }
@media (max-width: 820px) { .gen-inputs { grid-template-columns: 1fr; } }

/* 次のアクション — ゴール（完了条件）表示 */
.nba-goal-label { display: inline-block; font-weight: 700; color: var(--primary); margin-right: 6px; }
.nba-goal { font-size: 12px; color: var(--text); margin-top: 4px; padding-left: 2px; }
.nba-banner-goal { font-size: 12.5px; color: var(--text); margin-top: 6px; padding: 6px 10px; background: var(--primary-bg); border: 1px solid var(--border); border-radius: 6px; }
.trace-goal { font-size: 13px; color: var(--text); margin: 6px 0 4px; }
.trace-flow { font-size: 13px; color: var(--text); margin: 4px 0 8px; }
.trace-flow .flow-steps { margin: 4px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 3px; }
.trace-flow .flow-steps li { font-size: 12.5px; line-height: 1.6; }

/* 生成モニター — トレース表示 */
.trace-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.trace-detail { font-size: 13px; color: var(--text); line-height: 1.7; margin-bottom: 4px; }
.trace-lines { margin: 8px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.trace-lines li { font-size: 13px; line-height: 1.75; }

/* Detail rows */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 13px; margin: 0; }
.kv dt { color: var(--text-muted); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); }
.kv dd.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.points-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.points-card { background: var(--grad-soft); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.points-card .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.points-card .value { font-size: 22px; font-weight: 700; color: var(--primary); margin-top: 2px; font-variant-numeric: tabular-nums; }
.points-card .unit { font-size: 12px; color: var(--text-muted); margin-left: 4px; }

/* Modal */
.memo-cell { max-width: 220px; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 次のアクション（優先度） */
.badge.prio-high { background: var(--danger-soft); color: var(--danger); }
.badge.prio-medium { background: #fff2d6; color: #9a6a00; }
.badge.prio-low { background: #e8eaed; color: #55606e; }
.nba-cell { max-width: 240px; }
.nba-cell .nba-label { font-size: 12px; font-weight: 600; display: inline-block; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }

.nba-banner { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; border-left: 4px solid var(--text-muted); background: var(--surface); display: flex; align-items: center; gap: 16px; }
.nba-banner-main { flex: 1; min-width: 0; }
.nba-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.nba-act-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; width: 58px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 11px; font-weight: 600; line-height: 1; transition: background .12s, border-color .12s, transform .05s; }
.nba-act-btn:hover { background: var(--primary-bg, #f4f5f7); }
.nba-act-btn:active { transform: translateY(1px); }
.nba-act-btn svg { display: block; }
.nba-act-btn.act-phone { color: #1f9d55; }
.nba-act-btn.act-sms { color: #2b7de9; }
.nba-act-btn.act-line { color: #06c755; }
.nba-act-btn.act-mail { color: #55606e; }
.nba-act-btn span { color: var(--text); }
@media (max-width: 640px) { .nba-banner { flex-direction: column; align-items: stretch; } .nba-actions { justify-content: flex-start; } }
.prio-summary { display: flex; gap: 6px; }

/* 注文カードのお届け時間帯行 */
.segment-seat { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--border); }
.segment-seat .seat-label { font-size: 11px; color: var(--text-muted); }
.segment-seat .seat-value { font-size: 14px; font-weight: 700; }
.segment-seat .seat-value.unset { font-weight: 500; color: var(--text-muted); }
.segment-seat button { margin-left: auto; }

/* お届け日時スロット モーダル */
.seatmap-modal.modal-lg { width: 640px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; width: 100%; }
.slot-col { display: flex; flex-direction: column; gap: 8px; }
.slot-col-head { font-size: 11px; font-weight: 700; color: var(--primary); text-align: center; }
button.slot { width: 100%; padding: 8px 6px; border-radius: 8px; border: 1px solid var(--border); background: #eaf5ee; color: #1f7a44; font-size: 12px; font-weight: 600; cursor: pointer; }
button.slot:hover { background: #cdeeda; }
button.slot.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
button.slot.occupied { background: #e6e8eb; border-color: #cfd3d8; color: #9aa2ab; cursor: not-allowed; }
.seatmap-body { display: flex; flex-direction: column; align-items: center; }
.seat-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-bottom: 12px; align-self: center; }
.seat-legend i.seat { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: 2px; }
.seat-plane { background: var(--primary-bg, #f7f7f9); border: 1px solid var(--border); border-radius: 20px 20px 12px 12px; padding: 14px 18px 18px; width: fit-content; max-width: 100%; }
.seat-nose { text-align: center; font-size: 12px; color: var(--text-muted); padding-bottom: 10px; border-bottom: 1px dashed var(--border); margin-bottom: 12px; }
.seat-tail { text-align: center; font-size: 12px; color: var(--text-muted); padding-top: 10px; border-top: 1px dashed var(--border); margin-top: 8px; }
.seat-grid { display: flex; flex-direction: column; gap: 18px; }
.seat-section-label { font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.seat-row { display: flex; align-items: center; gap: 5px; }
.seat-row + .seat-row { margin-top: 5px; }
.seat-rownum { width: 22px; font-size: 10px; color: var(--text-muted); text-align: right; flex-shrink: 0; }
.seat-colletter { width: 30px; text-align: center; font-size: 10px; color: var(--text-muted); }
.seat-aisle { width: 14px; }
.seat-colhead { margin-bottom: 2px; }
button.seat { width: 30px; height: 30px; border-radius: 6px; border: 1px solid; font-size: 11px; font-weight: 600; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
.seat.available, i.seat.available { background: #eaf5ee; border-color: #b7dcc4; color: #1f7a44; }
button.seat.available:hover { background: #cdeeda; }
.seat.occupied, i.seat.occupied { background: #e6e8eb; border-color: #cfd3d8; color: #9aa2ab; cursor: not-allowed; }
.seat.selected, i.seat.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.seat-current { font-size: 13px; }

/* 商品管理／欠品 */
tr.product-soldout { background: var(--warn-soft); }
tr.product-soldout .line-no { text-decoration: line-through; color: var(--text-muted); }
tr.booking-disrupted { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); }
tr.booking-disrupted:hover { background: #f6e6c8; }
.badge.cancelled { background: var(--danger-soft); color: var(--danger); }
.disruption-banner { background: var(--warn-soft); border: 1px solid #efd6a6; border-left: 4px solid var(--warn); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.disruption-banner.resolved { background: #eef7f0; border-color: #bfe2c9; border-left-color: #1f9d55; }
.disruption-head { font-size: 12px; font-weight: 700; color: var(--warn); margin-bottom: 3px; }
.disruption-banner.resolved .disruption-head { color: #1f7a44; }
.disruption-body { font-size: 12px; line-height: 1.55; margin-bottom: 8px; }
.disruption-banner button { background-image: var(--grad); color: #fff; border: none; border-radius: 7px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.disruption-banner button:hover { filter: brightness(1.08); }
.booking-card.has-disruption { border-color: #efd6a6; }

/* 代替商品リスト */
.alt-list { display: flex; flex-direction: column; gap: 8px; }
.alt-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.alt-row input[type="radio"] { flex: 0 0 16px; width: 16px; height: 16px; margin: 0; }

/* パーソナライズ テンプレート選択 */
.tmpl-picker { margin-bottom: 16px; }
.tmpl-picker-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.tmpl-list { display: flex; flex-direction: column; gap: 6px; max-height: 210px; overflow-y: auto; padding: 2px; }
.tmpl-item { display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; width: 100%; }
.tmpl-item:hover { background: var(--primary-bg, #f7f7f9); }
.tmpl-item.selected { border-color: var(--primary); background: var(--primary-bg); }
.tmpl-item.recommended { border-color: var(--border-strong); }
.tmpl-item .badge { flex: 0 0 auto; margin-top: 1px; }
.tmpl-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tmpl-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.tmpl-reco { font-size: 10px; font-weight: 700; color: #fff; background: var(--primary); border-radius: 4px; padding: 1px 5px; }
.tmpl-preview { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* MCP 仕様・テストページ */
.mcp-conn dt { color: var(--text-muted); }
.mcp-conn code { font-size: 12px; }
.mcp-pre { background: #1e1e24; color: #e6e6e6; border-radius: 8px; padding: 12px; font-size: 12px; line-height: 1.5; overflow: auto; max-height: 320px; white-space: pre; }
.mcp-pre.result { background: #0f2a18; color: #d7f5df; }
.mcp-io { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.mcp-io label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
@media (max-width: 720px) { .mcp-io { grid-template-columns: 1fr; } }
.mcp-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.mcp-tool { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.mcp-tool-name code { font-size: 13px; font-weight: 700; color: var(--primary); }
.mcp-tool-desc { font-size: 11px; color: var(--text-muted); margin: 4px 0 6px; line-height: 1.5; }
.mcp-params { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.mcp-params li { font-size: 11px; }
.mcp-params code { font-size: 11px; background: var(--primary-bg, #f4f5f7); padding: 1px 4px; border-radius: 4px; }
.mcp-params .req { color: var(--danger); font-weight: 700; margin: 0 4px 0 2px; }
.mcp-params .pdesc { color: var(--text-muted); margin-left: 6px; }

/* FAQ ナレッジ管理 */
.kb-results { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.kb-hint { font-size: 12px; color: var(--text-muted); background: var(--primary-bg, #f7f7f9); border: 1px dashed var(--border); border-radius: 8px; padding: 12px 14px; line-height: 1.6; }
.kb-hit { border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px; padding: 10px 12px; }
.kb-hit-head { display: flex; align-items: center; gap: 8px; }
.kb-hit-head .kb-q { font-weight: 700; font-size: 14px; }
.kb-hit-head .kb-score { margin-left: auto; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.kb-a { font-size: 13px; line-height: 1.65; margin-top: 6px; }
.kb-meta { margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.kb-tag { color: var(--primary); }
.kb-src { margin-left: 6px; }
.kb-cell-a { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-cell-tags { margin-top: 4px; font-size: 11px; }
.kb-rag-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.kb-rag-answer { background: var(--primary-bg); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.7; white-space: normal; }
.kb-src-title { font-size: 11px; font-weight: 700; color: var(--text-muted); margin: 14px 0 6px; }
.kb-idx { font-weight: 700; color: var(--primary); font-size: 12px; }
.alt-row:hover { background: var(--primary-bg, #f7f7f9); }
.alt-row:has(input:checked) { border-color: var(--primary); background: var(--primary-bg); }
.alt-row .alt-no { font-weight: 700; font-variant-numeric: tabular-nums; }
.alt-row .alt-route { font-weight: 600; }
.alt-row .alt-time { color: var(--text-muted); font-size: 12px; margin-left: auto; }
.alt-row .alt-ac { font-size: 11px; color: var(--text-muted); }
.nba-table tbody tr { cursor: pointer; }
.nba-table td .nba-actions { flex-wrap: nowrap; justify-content: flex-start; }
.nba-banner.prio-high { border-left-color: var(--danger); background: var(--danger-soft); }
.nba-banner.prio-medium { border-left-color: #d99a00; background: #fff8ea; }
.nba-banner.prio-low { border-left-color: #8b95a3; background: #f4f5f7; }
.nba-banner-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.nba-banner-title { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--text-muted); }
.nba-banner-action { font-size: 15px; font-weight: 700; }
.nba-banner-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.55; }

.contact-cell { max-width: 320px; }
.contact-cell .c-subject { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.contact-cell .c-detail { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.contact-cell .c-meta { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.contact-link { cursor: pointer; border-radius: 6px; padding: 4px 6px; margin: -4px -6px; transition: background .12s; }
.contact-link:hover { background: var(--primary-bg); }
.contact-link:hover .c-subject { text-decoration: underline; }
.contact-link .c-transcript-hint { color: var(--primary); text-decoration: none; }
.link-btn { background: none; border: none; padding: 2px 0; margin-top: 4px; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* 会話トランスクリプション モーダル */
.modal.modal-lg { width: 760px; }

/* 連携モーダル（MCP / API連携） */
.modal.integration-modal { width: min(1080px, 100%); }
.integration-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 10px 20px 0; flex-shrink: 0; }
.integration-head .subtabs.integration-tabs { margin: 0; flex: 1; }
.integration-head [data-int-close] { margin-bottom: 8px; }
.integration-modal .body { padding-top: 16px; }
.integration-modal .body .card:first-child { margin-top: 0; }
/* MCP タブ内のネストしたポップアップ（サーバ仕様 / テストコンソール） */
#mcp-pop-overlay { z-index: 60; background: rgba(26, 32, 44, 0.35); }
.modal.mcp-pop .mcp-pop-bar { display: flex; justify-content: flex-end; padding: 10px 16px 0; flex-shrink: 0; }
.modal.mcp-pop .body { padding-top: 10px; }
.modal.mcp-pop .body .card:first-child { margin-top: 0; }
/* 検索テスト（キーワード / RAG）ポップアップ */
.modal.kb-search-modal .kb-search-bar { display: flex; justify-content: flex-end; padding: 10px 16px 0; flex-shrink: 0; }
.modal.kb-search-modal .body { padding-top: 10px; }
.modal.kb-search-modal .body .card:first-child { margin-top: 0; }

/* 紹介（ツール説明）ポップアップ — about.html を iframe で全面表示 */
.modal.modal-xl { width: 1000px; max-height: 92vh; }
.modal .intro-head-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal .intro-head-bar h3 { margin: 0; padding: 0; border: 0; }
.modal.modal-xl .intro-body { padding: 0; background: var(--bg); }
.modal.modal-xl .intro-frame { width: 100%; height: 74vh; border: 0; display: block; }
.transcript-summary { background: var(--primary-bg); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.transcript-summary .ts-label { font-size: 11px; font-weight: 700; color: var(--primary); letter-spacing: .04em; margin-bottom: 4px; }
.transcript-summary .ts-text { font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.transcript-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; overflow-wrap: anywhere; }
.transcript-chat { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chat-row { display: flex; flex-direction: column; max-width: 78%; min-width: 0; }
.chat-row.customer { align-self: flex-start; align-items: flex-start; }
.chat-row.agent { align-self: flex-end; align-items: flex-end; }
.chat-meta { font-size: 10px; color: var(--text-muted); margin: 0 4px 2px; }
.chat-bubble { max-width: 100%; padding: 8px 12px; border-radius: 14px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.chat-row.customer .chat-bubble { background: var(--surface-alt, #eef0f3); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-row.agent .chat-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }

.detail-overlay { position: fixed; inset: 0; background: rgba(26, 32, 44, 0.5); display: grid; justify-items: center; align-items: start; z-index: 45; padding: 40px 24px 24px; overflow: auto; }
.detail-popup { width: min(1000px, 100%); height: calc(100vh - 64px); overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); border-radius: 8px; }
.detail-popup .card { margin: 0; flex: 1; min-height: 0; overflow: auto; max-height: none; }

.modal-overlay { position: fixed; inset: 0; background: rgba(26, 32, 44, 0.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal {
	background: var(--surface);
	border-radius: 8px;
	width: 600px;
	max-width: 100%;
	max-height: 88vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 16px 48px rgba(0,0,0,.22);
	border-top: 4px solid var(--primary);
	overflow: hidden;
}
.modal form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.modal h3 { margin: 0; padding: 16px 22px; border-bottom: 1px solid var(--border); font-size: 15px; color: var(--primary); flex-shrink: 0; }
.modal .body { padding: 18px 22px; overflow: auto; flex: 1; min-height: 0; }
.modal .footer { padding: 12px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--primary-bg); flex-shrink: 0; }

/* Personalization */
.perso-list { display: flex; flex-direction: column; gap: 10px; }
.perso-item { border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; background: var(--surface); }
.perso-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.perso-title { font-weight: 600; font-size: 14px; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.perso-content { font-size: 13px; color: var(--text); white-space: pre-wrap; margin-top: 4px; }
.perso-meta { font-size: 11px; color: var(--text-muted); margin-top: 8px; display: flex; gap: 12px; }
.perso-actions { display: flex; gap: 6px; }

/* Booking */
.booking-list { display: flex; flex-direction: column; gap: 12px; }
.booking-card { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; background: var(--surface); }
.booking-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.booking-pnr { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; color: var(--primary); font-size: 14px; letter-spacing: .04em; }
.booking-meta { font-size: 11px; color: var(--text-muted); }
.itinerary { padding: 10px 0; }
.itinerary + .itinerary { border-top: 1px dashed var(--border); }
.itinerary-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.segment { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; padding: 6px 0; }
.segment .iata { font-size: 18px; font-weight: 700; color: var(--text); }
.segment .city-time { font-size: 11px; color: var(--text-muted); }
.segment .arrow { color: var(--primary); font-size: 18px; }
.segment-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 12px; }
.line-no { font-weight: 600; color: var(--primary); }
.booking-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.price { font-weight: 700; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.price .currency { font-size: 11px; color: var(--text-muted); margin-right: 4px; font-weight: 500; }

/* Empty */
.empty { text-align: center; padding: 32px 20px; color: var(--text-muted); font-size: 13px; }

/* Search */
.search-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-row input { flex: 1; }

/* Customer summary header */
.customer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.customer-head .name { font-size: 18px; font-weight: 700; color: var(--text); }
.customer-head .name-kana { font-size: 12px; color: var(--text-muted); }
.customer-head .jmb { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.customer-head .head-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* AI agent view */
.agent-card .form-row { margin-bottom: 18px; }
.agent-card label { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 8px; display: block; }
.agent-ta { font-family: ui-monospace, SFMono-Regular, Menlo, "Hiragino Sans", monospace; font-size: 12.5px; line-height: 1.65; resize: vertical; }

/* Reasoning Summary（顧客別 Instructions の生成根拠） */
.reasoning-summary { font-size: 13px; line-height: 1.7; color: var(--text); background: var(--primary-bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 16px 12px; }
.reasoning-summary p { margin: 4px 0 8px; }
.reasoning-summary ul { margin: 4px 0 8px; padding-left: 20px; }
.reasoning-summary li { margin: 3px 0; }
.reasoning-flow { margin: 4px 0 8px; padding-left: 22px; }
.reasoning-flow li { margin: 3px 0; }

/* Test view */
.test-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.3fr); gap: 22px; }
.test-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--primary-bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0 0 14px; line-height: 1.5; color: var(--text); }
.test-response { max-height: 480px; overflow: auto; word-break: normal; white-space: pre; }
.test-summary { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 6px; background: var(--primary-bg); border: 1px solid var(--border); margin-bottom: 10px; font-size: 13px; }
.test-summary.ok { background: #e8f5ee; border-color: #b9e0c8; }
.test-summary.fail { background: #fef0d4; border-color: #f3d590; }
@media (max-width: 980px) { .test-grid { grid-template-columns: 1fr; } }

@media (max-width: 980px) {
	.split { grid-template-columns: 1fr; }
	.points-grid { grid-template-columns: 1fr; }
	.form-grid { grid-template-columns: 1fr; }
}

/* ---------------- リーガルチェック（基本設定・文言評価）の結果表示 ---------------- */
.legal-ok { padding: 12px 14px; border-radius: 8px; background: #d6f0e1; color: #1f6e3f; font-size: 13px; }
.legal-summary { padding: 10px 14px; border-radius: 8px; background: #fef0d4; color: #8a5a06; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.legal-note { margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.legal-finding { border: 1px solid var(--border); border-left: 4px solid #c1272d; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.legal-finding.medium { border-left-color: #d9a406; }
.legal-finding .lf-head { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 6px; }
.legal-finding .lf-basis { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.legal-finding .lf-reason { font-size: 13px; margin-bottom: 8px; }
.legal-finding .lf-matched { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.legal-finding .lf-tag { display: inline-block; background: #fde0e2; color: #c1272d; border-radius: 4px; padding: 1px 6px; margin: 0 2px; font-size: 12px; }
.legal-finding .lf-sug { background: #eef6ef; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; }
.legal-finding .lf-sug-label { font-size: 11px; color: #1f6e3f; font-weight: 700; margin-bottom: 3px; }
.legal-finding .lf-sug-text { font-size: 13px; white-space: pre-wrap; }
.lf-sug { background: #eef6ef; border-radius: 6px; padding: 10px 12px; margin-top: 8px; }
.lf-sug .lf-sug-label { font-size: 11px; color: #1f6e3f; font-weight: 700; margin-bottom: 3px; }
.lf-sug .lf-sug-text { font-size: 13px; white-space: pre-wrap; }
textarea.legal-fixed, input.legal-fixed { border-color: #1f6e3f; background: #f3fbf5; }
.badge.prio-urgent { background: var(--danger-soft); color: var(--danger); }

/* ---------------- 応対ガイド ---------------- */
.guide-view .card-toolbar h2 { font-size: 17px; }
.guide-view table { font-size: 14.5px; }
.guide-view th, .guide-view td { padding: 11px 14px; }
.guide-view thead th { font-size: 12px; }
.guide-alert { background: #fdeff0; border: 1px solid #f3c2c5; border-left: 4px solid #c1272d; border-radius: 8px; padding: 16px 18px; }
.guide-alert-head { font-size: 16px; font-weight: 700; color: #c1272d; margin-bottom: 8px; }
.guide-alert ol { margin: 0; padding-left: 22px; font-size: 15px; line-height: 1.9; }
.guide-alert li + li { margin-top: 4px; }
.guide-card-head { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.guide-note { margin-top: 14px; font-size: 14px; line-height: 1.85; color: var(--text-muted); background: var(--primary-bg); border: 1px dashed var(--border); border-radius: 8px; padding: 14px 16px; }
.guide-note + .guide-note { margin-top: 10px; }
.guide-phrases { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.guide-phrases ul { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.9; }
.guide-phrases li + li { margin-top: 5px; }
.guide-phrases ul.ng li { color: #a02020; }
.guide-phrases ul.ok li { color: #1f6e3f; }
tbody tr.row-urgent { background: #fdf3f4; box-shadow: inset 3px 0 0 #c1272d; }
tbody tr.row-urgent:hover { background: #fbe9eb; }
@media (max-width: 860px) { .guide-phrases { grid-template-columns: 1fr; } }

/* ---------------- リアルタイムモニター ---------------- */
.live-split { display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.live-list { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow: auto; min-width: 0; }
.live-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; background: var(--surface); }
.live-item:hover { background: var(--primary-bg); }
.live-item.active { border-color: var(--primary); background: var(--primary-soft); }
.live-item-head { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.live-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.live-conv { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; background: var(--surface); min-width: 0; }
.live-conv-head { font-weight: 700; font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.live-chat { max-height: 58vh; overflow: auto; }
@media (max-width: 860px) { .live-split { grid-template-columns: 1fr; } }

/* ---------------- 画面内ボットパネル（ボイスボット/チャットボット） ---------------- */
:root { --bot-w: min(420px, 40vw); }
/* パネルが開いている間は本体を左に縮め、右側にパネル分の余白を作る（閉じると戻る） */
.app { transition: width .18s ease; }
body.bot-open .app { width: calc(100% - var(--bot-w)); }
.bot-panel {
	position: fixed; top: 0; right: 0; bottom: 0; width: var(--bot-w); z-index: 60;
	background: var(--surface); border-left: 1px solid var(--border);
	box-shadow: -8px 0 28px rgba(11, 31, 77, 0.18);
	display: flex; flex-direction: column;
}
.bot-panel[hidden] { display: none; }
.bot-panel-head {
	flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
	padding: 12px 14px; color: #fff; font-weight: 700; font-size: 14px;
	background: var(--grad);
}
.bot-panel.voice .bot-panel-head { background: linear-gradient(135deg, #0a7d33, #12a04a); }
.bot-panel-x {
	margin-left: auto; width: 30px; height: 30px; border: 0; border-radius: 50%;
	background: rgba(255,255,255,.2); background-image: none; color: #fff; font-size: 18px; line-height: 1;
	cursor: pointer; box-shadow: none; padding: 0;
}
.bot-panel-x:hover { background: rgba(255,255,255,.35); filter: none; box-shadow: none; }
.bot-panel-body { flex: 1 1 auto; min-height: 0; position: relative; }
.bot-panel-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #fff; }
@media (max-width: 720px) { :root { --bot-w: 100vw; } body.bot-open .app { width: 0; overflow: hidden; } }

/* ボットパネル表示中は、顧客ポップアップ等のオーバーレイを左（パネルと重ならない領域）へ寄せる。閉じると元の位置・サイズへ戻る。 */
.detail-overlay, .modal-overlay { transition: right .18s ease; }
body.bot-open .detail-overlay, body.bot-open .modal-overlay { right: var(--bot-w); }

/* リアルタイムモニター: ゴール達成度パネル */
.live-goal-col { min-width: 0; }
.live-goal { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; background: var(--surface); }
.live-goal .lg-label { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; }
.live-goal .lg-action { font-size: 14px; font-weight: 700; margin-top: 4px; }
.live-goal .lg-goal { font-size: 12.5px; line-height: 1.6; margin-top: 4px; background: var(--primary-bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
.lg-prog { margin-top: 6px; }
.lg-bar { height: 10px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.lg-bar span { display: block; height: 100%; background: var(--grad); border-radius: 999px; transition: width .3s ease; }
.lg-prog-num { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.lg-flow { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lg-flow li { position: relative; font-size: 12.5px; line-height: 1.5; padding: 6px 8px 6px 26px; border-radius: 6px; border: 1px solid var(--border); }
.lg-flow li .lg-mark { position: absolute; left: 8px; top: 6px; font-weight: 800; }
.lg-flow li.done { color: var(--text-muted); background: #eef7f0; border-color: #cfe8d6; }
.lg-flow li.done .lg-mark { color: #1f7a44; }
.lg-flow li.current { background: var(--primary-bg); border-color: var(--primary); font-weight: 600; }
.lg-flow li.current .lg-mark { color: var(--primary); }
.lg-flow li.pending { color: var(--text-muted); }
.lg-flow li.pending .lg-mark { color: var(--border-strong); }
.lg-rules { margin-top: 12px; }
.lg-rules summary { font-size: 11px; font-weight: 700; color: var(--text-muted); cursor: pointer; letter-spacing: .04em; }
.lg-rules ol { margin: 8px 0 0; padding-left: 20px; }
.lg-rules li { font-size: 12px; line-height: 1.6; margin-bottom: 4px; }
@media (max-width: 1100px) { .live-split { grid-template-columns: 200px 1fr; } .live-goal-col { grid-column: 1 / -1; } }
@media (max-width: 860px) { .live-split { grid-template-columns: 1fr; } }
