/* ── Bookinguz AI panel — built on ds.css tokens ── */
body { background: var(--ink-50); font-size: var(--fs-sm); line-height: 1.5; }
[hidden] { display: none !important; }

/* Login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at top, var(--brand-50), var(--ink-50) 60%); }
.login { width: min(400px, 100%); background: var(--white); border: 1px solid var(--border); border-radius: var(--r-2xl); padding: 32px; box-shadow: var(--shadow-lg); }
.login .brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login .brand-row img { width: 40px; height: 40px; border-radius: 10px; }
.login h1 { font-size: var(--fs-xl); margin-bottom: 4px; }
.login p { color: var(--text-2); margin-bottom: 20px; }
.login form { display: grid; gap: 14px; }
.form-err { color: var(--danger-600); font-weight: 500; font-size: var(--fs-sm); }

/* Shell: sidebar + content */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 10px; padding: 14px 10px; background: var(--white); border-right: 1px solid var(--border); }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 6px; font-family: var(--font-display); font-weight: 800; font-size: 15px; }
.side .brand img { width: 32px; height: 32px; border-radius: 8px; }
.side .brand small { display: block; font: 600 11px var(--font-body); color: var(--text-3); }
.ai-pill { margin: 0 4px; }
.ai-pill a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-md); font-weight: 600; font-size: 12.5px; }
.ai-pill .ok { background: var(--success-50); color: var(--success-600); }
.ai-pill .off { background: var(--ink-100); color: var(--ink-600); }
.ai-pill .bad { background: var(--danger-50); color: var(--danger-600); }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; min-height: 0; }
.nav .grp { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400); padding: 12px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); color: var(--ink-700); font-weight: 600; white-space: nowrap; transition: background-color var(--t-fast), color var(--t-fast); }
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.nav a:hover { background: var(--ink-100); color: var(--ink-900); }
.nav a.on { background: var(--brand-50); color: var(--brand-700); }
.nav a.on svg { opacity: 1; }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; display: inline-grid; place-items: center; font-size: 11px; background: var(--danger-600); color: #fff; }
.me { position: relative; border-top: 1px solid var(--ink-100); padding-top: 10px; }
.me-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-md); text-align: left; }
.me-btn:hover { background: var(--ink-100); }
.me-txt { min-width: 0; } .me-txt b, .me-txt small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-txt small { color: var(--text-3); font-size: 11.5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 800 13px var(--font-display); color: #fff; background: linear-gradient(135deg, var(--accent-400), var(--brand-500)); flex-shrink: 0; }
.menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; z-index: 30; }
.menu button { width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--r-sm); font-weight: 500; }
.menu button:hover { background: var(--ink-100); }

/* Phone drawer pieces — inert on wide screens */
.nav-toggle { display: none; position: relative; width: 40px; height: 40px; border-radius: var(--r-md); place-items: center; color: var(--ink-800); flex-shrink: 0; }
.nav-toggle:hover { background: var(--ink-100); }
.nav-toggle svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.nav-toggle.has-badge::after { content: ''; position: absolute; top: 8px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger-600); box-shadow: 0 0 0 2px var(--white); }
.side-panel { display: contents; }
.nav-scrim { display: none; }

main.view { min-width: 0; padding: 22px 26px 80px; max-width: 1400px; }
main.view.full { max-width: none; padding: 0; height: 100dvh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: var(--fs-xl); }
.page-head p { color: var(--text-2); margin-top: 2px; max-width: 760px; }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--warning-50); border: 1px solid #f2dc9b; color: #6b4a00; border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 12px; }
.banner.info { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-900); }
.banner.bad { background: var(--danger-50); border-color: #f5c2c3; color: #8a1f23; }
.banner a { font-weight: 700; text-decoration: underline; }
.banner code, code { overflow-wrap: anywhere; background: var(--ink-100); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

/* Cards & tiles */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-xl); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.card-head h2 { font-size: var(--fs-md); }
.card-head small { color: var(--text-3); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; }
a.tile:hover { border-color: var(--brand-300); }
.tile .label { color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tile .value { font: 800 28px/1.15 var(--font-display); letter-spacing: -.02em; margin-top: 6px; color: var(--ink-900); }
.tile .sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.tile.alert .value { color: var(--danger-600); }
.tile.hot .value { color: var(--danger-600); } .tile.warm .value { color: var(--warning-600); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.seg { display: inline-flex; padding: 3px; background: var(--ink-100); border-radius: var(--r-pill); flex-wrap: wrap; }
.seg button { padding: 6px 14px; border-radius: var(--r-pill); font-weight: 600; color: var(--ink-600); }
.seg button.on, .seg button[aria-pressed="true"] { background: var(--white); color: var(--ink-900); box-shadow: var(--shadow-sm); }

/* Level split bar (hot / warm / cold) */
.split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--ink-100); margin: 14px 20px 6px; gap: 2px; }
.split i { display: block; height: 100%; }
.split .hot { background: var(--danger-600); } .split .warm { background: #e8a317; } .split .cold { background: var(--ink-300); }
.split-legend { display: flex; gap: 18px; padding: 4px 20px 16px; color: var(--text-2); font-weight: 500; flex-wrap: wrap; }
.split-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Chart */
.chart { position: relative; padding: 10px 20px 16px; }
.chart svg { width: 100%; height: 240px; overflow: visible; }
.chart .grid line { stroke: var(--ink-100); }
.chart .hit { fill: transparent; }
.chart .col:hover path { opacity: .85; }
.legend { display: flex; gap: 16px; color: var(--text-2); font-weight: 500; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--ink-900); color: #fff; border-radius: var(--r-md); padding: 8px 10px; font-size: 12px; line-height: 1.5; box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, -100%); }
.tip b { display: block; margin-bottom: 2px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
details.table-view { padding: 0 20px 16px; }
details.table-view summary { cursor: pointer; color: var(--brand-700); font-weight: 600; width: max-content; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--ink-50); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--ink-100); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.row { cursor: pointer; }
.table tr.row:hover td { background: var(--brand-50); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-2); }
.muted { color: var(--text-3); font-size: 12.5px; }
.who b { display: block; font-weight: 600; }
.who a { color: var(--brand-700); font-weight: 500; }
.sum { color: var(--ink-700); max-width: 380px; }

/* Badges */
.b { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.b.hot { background: var(--danger-50); color: var(--danger-600); }
.b.warm { background: var(--warning-50); color: var(--warning-600); }
.b.cold, .b.gray { background: var(--ink-100); color: var(--ink-600); }
.b.new { background: var(--brand-50); color: var(--brand-700); }
.b.contacted { background: var(--accent-50); color: var(--accent-700); }
.b.won { background: var(--success-50); color: var(--success-600); }
.b.lost { background: var(--ink-100); color: var(--ink-500); }
.b.owner { background: var(--ink-900); color: #fff; }
.b.operator { background: var(--brand-50); color: var(--brand-700); }
.b.wait { background: var(--danger-50); color: var(--danger-600); }
.b.live { background: var(--success-50); color: var(--success-600); }
.b.ai { background: var(--brand-50); color: var(--brand-700); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-300); display: inline-block; flex-shrink: 0; }
.dot.on { background: var(--success-600); box-shadow: 0 0 0 3px rgb(18 146 74 / .15); }
.dot.bad { background: var(--danger-600); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.meter { display: inline-flex; align-items: center; gap: 8px; }
.meter span { width: 54px; height: 6px; border-radius: 3px; background: var(--ink-100); overflow: hidden; }
.meter span i { display: block; height: 100%; border-radius: 3px; }

/* Filters bar */
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bar .chip { height: 34px; }
.chip[aria-pressed="true"] { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }
.bar .search { flex: 1; min-width: 200px; height: 38px; border-radius: var(--r-pill); }

/* ── Inbox ── */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; height: 100dvh; background: var(--white); }
.inbox.no-info { grid-template-columns: 340px minmax(0, 1fr); }
.ilist { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.ilist-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--ink-100); display: grid; gap: 10px; }
.ilist-head h1 { font-size: var(--fs-lg); display: flex; align-items: center; gap: 8px; }
.ilist-head .search { height: 36px; border-radius: var(--r-pill); }
.ilist-head .chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.ilist-head .chips .chip { height: 30px; font-size: 12.5px; padding: 0 10px; flex-shrink: 0; }
.items { overflow-y: auto; flex: 1; }
.item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--ink-100); cursor: pointer; align-items: start; }
.item:hover { background: var(--ink-50); }
.item.on { background: var(--brand-50); }
.item .avatar { width: 40px; height: 40px; font-size: 14px; }
.item .avatar.hot { background: linear-gradient(135deg, #ff7a59, var(--danger-600)); }
.item .avatar.warm { background: linear-gradient(135deg, #ffc65a, #e8a317); }
.item .avatar.cold { background: linear-gradient(135deg, var(--ink-300), var(--ink-500)); }
.item .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.item .pv { color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.item .pv b { color: var(--ink-700); font-weight: 600; }
.item .tm { font-size: 11px; color: var(--text-3); text-align: right; display: grid; gap: 4px; justify-items: end; }
.item .unread { min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--brand-600); color: #fff; }
.item .flags { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.item .flags .b { height: 19px; font-size: 10.5px; padding: 0 6px; }

.ichat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--ink-50); }
.ichat-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--white); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ichat-head .t { flex: 1; min-width: 160px; }
.ichat-head .t b { font: 800 16px var(--font-display); display: block; }
.ichat-head .t a { color: var(--brand-700); font-weight: 600; font-size: 12.5px; }
.back { display: none; }
@media (min-width: 1281px) { #info-btn { display: none; } }
.modebar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--white); border-bottom: 1px solid var(--ink-100); flex-wrap: wrap; font-size: 12.5px; }
.modebar .sp { flex: 1; }
.mode { font-weight: 700; font-size: 12.5px; border-radius: var(--r-pill); padding: 4px 10px; display: inline-flex; align-items: center; gap: 6px; }
.mode.ai { background: var(--brand-50); color: var(--brand-700); } .mode.operator { background: var(--success-50); color: var(--success-600); } .mode.off { background: var(--ink-100); color: var(--ink-600); }
.tx { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; }
.tx .day { align-self: center; font-size: 11.5px; font-weight: 600; color: var(--ink-500); background: var(--white); border: 1px solid var(--ink-100); padding: 2px 10px; border-radius: var(--r-pill); margin: 6px 0; }
.tx .m { max-width: min(560px, 80%); display: flex; flex-direction: column; gap: 3px; }
.tx .m small { font-size: 11px; color: var(--ink-500); font-weight: 600; padding: 0 4px; display: flex; gap: 8px; align-items: center; }
.tx .m .bubble { padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.tx .customer { align-self: flex-start; } .tx .customer .bubble { background: var(--white); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.tx .ai, .tx .operator, .tx .owner { align-self: flex-end; align-items: flex-end; }
.tx .ai .bubble { background: var(--brand-100); color: var(--brand-950); border-bottom-right-radius: 4px; }
.tx .operator .bubble { background: var(--brand-600); color: #fff; border-bottom-right-radius: 4px; }
.tx .owner .bubble { background: #1f8a5b; color: #fff; border-bottom-right-radius: 4px; }
.tx .m.media .bubble { font-style: italic; }
.tx .sys { align-self: center; background: var(--warning-50); color: #6b4a00; font-size: 12px; padding: 4px 12px; border-radius: var(--r-pill); max-width: 90%; text-align: center; }
.fix { color: var(--brand-700); font-weight: 700; font-size: 11px; opacity: 0; transition: opacity var(--t-fast); }
.tx .m:hover .fix, .fix:focus-visible { opacity: 1; }
.thinking { align-self: flex-end; color: var(--brand-700); font-size: 12px; font-weight: 600; padding: 4px 10px; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px; background: var(--white); border-top: 1px solid var(--border); }
.composer textarea { flex: 1; resize: none; min-height: 42px; max-height: 160px; }
.hint { font-size: 11.5px; color: var(--text-3); padding: 0 14px 10px; background: var(--white); }
.ichat-empty { display: grid; place-items: center; height: 100%; color: var(--text-2); text-align: center; padding: 20px; }
.ichat-empty div { max-width: 360px; }
.ichat-empty h2 { font-size: var(--fs-md); margin-bottom: 6px; }

.iinfo { border-left: 1px solid var(--border); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.iinfo h3 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 14px 0 6px; }
.iinfo h3:first-child { margin-top: 0; }
.info-top { display: none; align-items: center; justify-content: space-between; margin: -4px 0 8px; }
.info-top b { font: 800 16px var(--font-display); }
.iinfo .lv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.iinfo .lv button { padding: 7px 4px; border-radius: var(--r-md); border: 1px solid var(--border); font-weight: 700; font-size: 12px; color: var(--ink-600); }
.iinfo .lv button.on.hot { background: var(--danger-50); color: var(--danger-600); border-color: #f5c2c3; }
.iinfo .lv button.on.warm { background: var(--warning-50); color: var(--warning-600); border-color: #f2dc9b; }
.iinfo .lv button.on.cold { background: var(--ink-100); color: var(--ink-800); border-color: var(--ink-300); }
.iinfo .st { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.iinfo .st button { padding: 7px 4px; border-radius: var(--r-md); border: 1px solid var(--border); font-weight: 600; font-size: 12px; }
.iinfo .st button.on { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; margin: 0; }
.kv dt { color: var(--text-3); font-size: 12.5px; } .kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.ai-sum { background: var(--brand-50); color: var(--brand-900); border-radius: var(--r-md); padding: 10px 12px; }
.score { font: 800 22px var(--font-display); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.help { font-size: 12px; color: var(--text-3); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section { margin-bottom: 16px; }
.play .card-head { flex-wrap: nowrap; }
.section > .card-pad > h2 { font-size: var(--fs-md); margin-bottom: 2px; }
.section > .card-pad > p.help { margin-bottom: 14px; }
.branch-row { display: grid; grid-template-columns: 1fr 1.4fr 1.2fr auto; gap: 8px; margin-bottom: 8px; }
.status-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.status-list div { padding: 10px 12px; border-radius: var(--r-md); background: var(--ink-50); border: 1px solid var(--ink-100); }
.status-list b { display: block; }
.opts { display: flex; gap: 6px; flex-wrap: wrap; }
.opts label { position: relative; }
.opts input { position: absolute; opacity: 0; pointer-events: none; }
.opts span { display: inline-flex; flex-direction: column; padding: 8px 12px; border-radius: var(--r-md); border: 1px solid var(--border); cursor: pointer; font-weight: 600; min-width: 96px; }
.opts span small { font-weight: 500; color: var(--text-3); font-size: 11.5px; }
.opts input:checked + span { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-800); box-shadow: 0 0 0 1px var(--brand-500) inset; }
.opts input:focus-visible + span { box-shadow: var(--focus); }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--ink-50) 30%); padding: 16px 0 4px; display: flex; gap: 8px; align-items: center; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .tr { width: 44px; height: 26px; border-radius: 13px; background: var(--ink-300); position: relative; transition: background-color var(--t-fast); flex-shrink: 0; }
.switch .tr::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t-base) var(--ease-out); }
.switch input:checked + .tr { background: var(--success-600); }
.switch input:checked + .tr::after { transform: translateX(18px); }
.switch input:focus-visible + .tr { box-shadow: var(--focus); }
.power { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--white); margin-bottom: 16px; flex-wrap: wrap; }
.power.on { border-color: #b7e3c8; background: var(--success-50); }
.power .t { flex: 1; min-width: 200px; } .power .t b { font: 800 16px var(--font-display); display: block; }

/* AI page: settings + playground */
.ai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.play { position: sticky; top: 16px; display: flex; flex-direction: column; height: calc(100dvh - 40px); max-height: 760px; overflow: hidden; }
.play .card-head { padding-bottom: 10px; border-bottom: 1px solid var(--ink-100); }
.play .tx { background: var(--ink-50); padding: 14px; }
.play .tx .m { max-width: 88%; }
.play-lead { padding: 8px 14px; border-top: 1px solid var(--ink-100); font-size: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 38px; }
.tourcard { display: flex; gap: 8px; align-items: center; background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 6px; max-width: 280px; }
.tourcard img { width: 56px; height: 42px; border-radius: 8px; object-fit: cover; }
pre.prompt { white-space: pre-wrap; font: 12px/1.55 ui-monospace, Consolas, monospace; background: var(--ink-50); border: 1px solid var(--ink-100); border-radius: var(--r-md); padding: 14px; max-height: 60dvh; overflow: auto; }

/* Knowledge lists */
.klist { display: grid; }
.krow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--ink-100); align-items: start; }
.krow.off { opacity: .55; }
.krow b { display: block; }
.krow p { color: var(--ink-700); white-space: pre-wrap; }
.krow .bad { color: var(--danger-600); text-decoration: line-through; text-decoration-color: rgb(217 58 63 / .4); }
.krow .good { color: var(--success-600); }
.krow small { color: var(--text-3); }

/* Telegram page */
.steps { counter-reset: s; display: grid; gap: 12px; margin-top: 6px; }
.steps li { list-style: none; counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.steps li.done::before { content: '✓'; background: var(--success-50); color: var(--success-600); }
.conn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); margin-top: 8px; flex-wrap: wrap; }
.conn .t { flex: 1; min-width: 180px; }
.conn .t b, .conn .t span { display: block; }

/* Tours */
.tour-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--ink-100); align-items: center; }
.tour-row img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: var(--ink-100); }
.tour-row .i { flex: 1; min-width: 0; } .tour-row .i b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-row.off { opacity: .5; }

/* Audit */
.log-row { display: grid; grid-template-columns: 150px 200px 1fr; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--ink-100); align-items: baseline; }
.log-row:last-child { border-bottom: 0; }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgb(7 13 28 / .45); display: grid; place-items: center; padding: 16px; animation: fadeIn var(--t-base); }
.modal-box { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--white); border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow-xl); display: grid; gap: 14px; }
.modal-box.wide { width: min(860px, 100%); }
.modal-box h3 { font-size: var(--fs-md); }
.quote { background: var(--ink-50); border-left: 3px solid var(--ink-300); border-radius: 0 var(--r-md) var(--r-md) 0; padding: 8px 12px; white-space: pre-wrap; color: var(--ink-700); }
.quote.ai { border-left-color: var(--brand-500); background: var(--brand-50); }
.secret { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--r-md); background: var(--ink-50); border: 1px dashed var(--border-strong); font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70; background: var(--ink-900); color: #fff; padding: 10px 16px; border-radius: var(--r-md); font-weight: 500; box-shadow: var(--shadow-lg); animation: fadeIn var(--t-base); max-width: calc(100vw - 32px); }
@keyframes fadeIn { from { opacity: 0; } }

@media (max-width: 1280px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox .iinfo { display: none; }
  .inbox.show-info .info-top { display: flex; }
  .inbox.show-info .iinfo { display: flex; position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 100%); background: var(--white); z-index: 40; box-shadow: var(--shadow-xl); }
  .ai-layout { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1100px) {
  .ai-layout { grid-template-columns: 1fr; }
  .play { position: static; height: 620px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: 56px; flex-direction: row; align-items: center; padding: 8px 12px 8px 8px; gap: 6px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: inline-grid; }
  .side .brand { flex: 1; min-width: 0; padding: 0; }
  .side .brand small { display: none; }
  .side-panel { display: flex; flex-direction: column; gap: 10px; position: fixed; top: 0; bottom: 0; left: 0; z-index: 2; width: min(288px, 86vw);
    padding: 16px 10px calc(16px + env(safe-area-inset-bottom)); background: var(--white); box-shadow: var(--shadow-xl);
    transform: translateX(-100%); visibility: hidden; transition: transform var(--t-base) var(--ease-out), visibility 0s linear var(--t-base); }
  .app.nav-open .side { z-index: 50; }
  .app.nav-open .side-panel { transform: none; visibility: visible; transition: transform var(--t-base) var(--ease-out); }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 1; background: rgb(7 13 28 / .45); animation: fadeIn var(--t-base); }
  .nav a { padding: 11px 12px; font-size: 15px; }
  .me-txt { display: none; }
  .me { border-top: 0; padding-top: 0; }
  .me-btn { width: auto; padding: 2px; }
  .menu { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); min-width: 200px; }
  main.view.full { height: calc(100dvh - 56px); }
  .inbox { grid-template-columns: 1fr; height: 100%; }
  .inbox .ichat { display: none; }
  .inbox.open .ilist { display: none; }
  .inbox.open .ichat { display: flex; }
  .back { display: inline-flex; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .hide-md { display: none; }
  .log-row { grid-template-columns: 1fr; gap: 2px; }
  .branch-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main.view { padding: 14px 16px 60px; }
  .page-head { margin-bottom: 14px; }
  .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .seg button { flex-shrink: 0; padding: 6px 12px; }
  .table th, .table td { padding: 10px 8px; }
  .table th:first-child, .table td:first-child { padding-left: 12px; }
  .table th:last-child, .table td:last-child { padding-right: 12px; }
  .meter span { width: 36px; }
  .table .muted, .table .who b { overflow-wrap: anywhere; }
  /* table.stack: each row becomes a small card */
  .table.stack thead { display: none; }
  .table.stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px; border-bottom: 1px solid var(--ink-100); }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { padding: 0 !important; border: 0; }
  .table.stack td:first-child { flex-basis: 100%; }
  .table.stack td:last-child { flex-basis: 100%; margin-top: 4px; }
  .table.stack td.hide-sm { display: none; }
  .tour-row { flex-wrap: wrap; align-items: flex-start; }
  .tour-row .i { flex-basis: calc(100% - 76px); }
  .tour-row .row-actions { width: 100%; padding-left: 76px; }
  .log-row { padding: 10px 14px; }
  .input, .select, .textarea { font-size: 16px; }
  .card-pad { padding: 16px; }
  .card-head { padding: 14px 16px 0; }
  .tile .value { font-size: 24px; }
  .hide-sm { display: none; }
  .tx { padding: 12px; }
  .tx .m { max-width: 88%; }
}

/* Photos: uploader, thumbnails */
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photo, .photo-add { width: 112px; height: 84px; border-radius: var(--r-md); position: relative; overflow: hidden; flex-shrink: 0; }
.photo { background: var(--ink-100); border: 1px solid var(--border); }
.photo:first-child { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo.loading { display: grid; place-items: center; font-size: 11.5px; color: var(--text-3); }
.photo-acts { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity var(--t-fast); }
.photo:hover .photo-acts, .photo:focus-within .photo-acts { opacity: 1; }
.photo-acts button { width: 24px; height: 24px; border-radius: 50%; background: rgb(7 13 28 / .7); color: #fff; font-size: 12px; display: grid; place-items: center; }
.photo-add { border: 1.5px dashed var(--border-strong); display: grid; place-items: center; cursor: pointer; color: var(--brand-700); font-weight: 700; }
.photo-add:hover { background: var(--brand-50); border-color: var(--brand-400); }
.photo-add:focus-within { box-shadow: var(--focus); }
.thumbs { display: flex; gap: 4px; margin: 2px 0 4px; flex-wrap: wrap; justify-content: flex-end; }
.tx .customer .thumbs { justify-content: flex-start; }
.thumbs img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.tx .card-msg .bubble { background: var(--white); color: var(--ink-800); border: 1px solid var(--brand-200); }
.noimg { display: grid; place-items: center; background: var(--ink-100); color: var(--text-3); font-size: 11px; text-align: center; padding: 6px; }
.tour-row .noimg { width: 64px; height: 48px; border-radius: 8px; flex-shrink: 0; }

/* Hotel options inside a tour package */
.opt-row { display: grid; grid-template-columns: minmax(0, 2fr) 120px minmax(0, 1.4fr) auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.radio { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; white-space: nowrap; cursor: pointer; }

/* Hotels catalog */
.hotel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 14px 20px 20px; }
.hotel-card { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--white); display: flex; flex-direction: column; }
.hotel-card.off { opacity: .55; }
.hotel-card > img, .hotel-card > .noimg { width: 100%; height: 140px; object-fit: cover; }
.hc-body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.stars { color: #e8a317; letter-spacing: 1px; font-size: 12px; }
.textarea.mono { font: 12.5px/1.55 ui-monospace, Consolas, monospace; }

@media (max-width: 900px) {
  .opt-row { grid-template-columns: 1fr 1fr; }
  .opt-row [name="o_hotel"], .opt-row [name="o_note"] { grid-column: 1 / -1; }
}

/* Sales result card (overview) */
.growth-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; font-size: 14px; }
.growth-row b { font-family: var(--font-display); font-size: 18px; }
.growth-row b.good { color: #1f9d55; }
.growth-row b.bad { color: var(--danger-600); }
