:root {
  --ink: #182235;
  --muted: #6b7890;
  --line: rgba(111, 137, 173, 0.2);
  --glass: rgba(255, 255, 255, 0.78);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --blue: #3478f6;
  --blue-dark: #245fc9;
  --cyan: #45cce8;
  --violet: #9a6df5;
  --green: #16a86d;
  --shadow: 0 10px 30px rgba(52, 78, 119, 0.08), 0 1px 4px rgba(52, 78, 119, 0.05);
  --radius: 15px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: #eef6ff; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-size: 13px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 30% 10%, rgba(112, 210, 255, 0.27), transparent 35%),
    radial-gradient(circle at 90% 30%, rgba(208, 133, 255, 0.24), transparent 34%),
    linear-gradient(135deg, #f6faff, #f7f3ff 54%, #eafcff);
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(60px); opacity: .5; pointer-events: none; }
.ambient-a { width: 420px; height: 420px; background: #8ae9ff; left: 30%; top: -220px; }
.ambient-b { width: 500px; height: 500px; background: #d6a6ff; right: -160px; bottom: -220px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.shell.sidebar-collapsed { grid-template-columns: 62px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 10px 8px;
  display: flex; flex-direction: column; z-index: 30;
  background: rgba(246, 250, 255, 0.72); border-right: 1px solid rgba(129, 151, 181, 0.18);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
}
.brand { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 3px 4px 10px; }
.brand-mark { position: relative; width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border: 0; color: white; font-weight: 900; border-radius: 10px; background: linear-gradient(145deg, var(--blue), var(--violet)); box-shadow: 0 7px 18px rgba(72, 102, 228, .24); transition: transform .18s ease, box-shadow .18s ease; }
.brand-copy { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; }
.brand strong, .brand span, .sidebar-foot strong, .sidebar-foot span { display: block; }
.brand strong { font-size: 14px; }
.brand span, .sidebar-foot span { color: var(--muted); font-size: 10px; margin-top: 1px; }
.sidebar-toggle, .sidebar-refresh { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: #5d6d85; background: rgba(255,255,255,.72); cursor: pointer; }
.sidebar-toggle { font-size: 20px; }
.nav { display: grid; gap: 3px; }
.nav-item { position: relative; width: 100%; display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 10px; color: #59677f; background: transparent; text-align: left; white-space: nowrap; overflow: hidden; cursor: pointer; transition: background .18s ease, color .18s ease; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: rgba(255,255,255,.62); color: var(--ink); transform: translateX(2px); }
.nav-item.active { color: var(--blue-dark); font-weight: 750; background: rgba(255,255,255,.88); box-shadow: 0 8px 30px rgba(69, 102, 160, .1); }
.sidebar-foot { margin-top: auto; padding: 8px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.55); }
.sidebar-foot-copy { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #23c581; box-shadow: 0 0 0 4px rgba(35,197,129,.13); }
.sidebar-foot strong { font-size: 11px; }
.sidebar-refresh { width: 27px; height: 27px; }
.sidebar-collapsed .brand-copy, .sidebar-collapsed .sidebar-foot-copy, .sidebar-collapsed .status-dot, .sidebar-collapsed .sidebar-refresh { display: none; }
.sidebar-collapsed .brand { display: flex; justify-content: center; padding-inline: 0; }
.sidebar-collapsed .brand-mark { width: 36px; height: 36px; cursor: pointer; }
.sidebar-collapsed .brand-mark::after { content: "›"; position: absolute; right: -5px; bottom: -4px; width: 16px; height: 16px; display: grid; place-items: center; border: 2px solid #eef6ff; border-radius: 50%; color: var(--blue-dark); background: white; box-shadow: 0 3px 9px rgba(39,76,139,.24); font-size: 14px; line-height: 1; }
.sidebar-collapsed .brand-mark:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(72,102,228,.3); }
.sidebar-collapsed .sidebar-toggle { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 8px; overflow: visible; }
.sidebar-collapsed .nav-label { display: none; }
.sidebar-collapsed .nav-item:hover::after { content: attr(data-label); position: absolute; z-index: 50; left: 48px; top: 50%; display: block; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: rgba(255,255,255,.97); box-shadow: 0 8px 22px rgba(42,67,106,.16); font-size: 11px; font-weight: 650; transform: translateY(-50%); pointer-events: none; }
.sidebar-collapsed .sidebar-foot { justify-content: center; padding: 9px; }
.sidebar-collapsed .sidebar-foot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #23c581; box-shadow: 0 0 0 4px rgba(35,197,129,.13); }

.main { position: relative; min-width: 0; }
.eyebrow { margin: 0; color: var(--blue-dark); font-weight: 760; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.icon-button, .mobile-menu-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.82); cursor: pointer; }
.mobile-menu-button { display: none; position: fixed; z-index: 24; top: 8px; left: 8px; box-shadow: var(--shadow); }

.page { display: none; padding: 10px 12px 20px; animation: appear .2s ease both; }
.page.active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 11px; align-items: start; }
.stack { display: grid; gap: 11px; }
.glass-card { background: var(--glass); border: 1px solid rgba(133,153,181,.25); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.hero-card { padding: 14px; display: flex; align-items: center; gap: 12px; overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; right: -80px; top: -90px; background: radial-gradient(circle, rgba(117,210,255,.35), transparent 68%); }
.agent-avatar { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; font-size: 19px; color: white; background: linear-gradient(145deg, #31c7d5, #6179f7 58%, #a66aec); box-shadow: 0 9px 22px rgba(77,117,226,.2); }
.hero-copy { min-width: 0; }
.hero-copy h2 { margin: 4px 0 2px; font-size: 17px; }
.hero-copy p { margin: 0; color: var(--muted); line-height: 1.4; font-size: 11px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 999px; font-size: 9px; font-weight: 750; white-space: nowrap; }
.pill.success { color: #087e51; background: #dcf9ec; border: 1px solid #b9efd8; }
.pill.muted { color: #657188; background: rgba(237,241,247,.92); border: 1px solid #dce3ed; }
.switch { margin-left: auto; z-index: 1; }
.switch input { position: absolute; opacity: 0; }
.switch span { display: block; width: 40px; height: 23px; padding: 3px; border-radius: 99px; background: #d6dce6; cursor: pointer; transition: background .18s ease; }
.switch span::after { content: ""; display: block; width: 17px; height: 17px; border-radius: 50%; background: white; box-shadow: 0 2px 8px rgba(24,35,55,.2); transition: transform .18s ease; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(17px); }

.form-card { padding: 14px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.card-heading.compact { align-items: center; margin-bottom: 8px; }
.card-heading h2, .section-head h2 { margin: 3px 0 0; font-size: 17px; letter-spacing: -.02em; }
.field-row { display: grid; grid-template-columns: 1fr 180px; gap: 9px; }
.message-delay-inputs { display: grid; grid-template-columns: 1fr; gap: 6px; }
.message-delay-inputs:has(#messageDelayCustom:not([hidden])) { grid-template-columns: minmax(0, 1fr) 72px; }
.skill-settings-card { margin-bottom: 9px; padding: 12px; display: grid; gap: 8px; }
.skill-settings-title h3 { margin: 2px 0 0; font-size: 14px; }
.skill-settings-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(240px, .7fr) auto; gap: 9px; align-items: end; }
.skill-settings-grid .field { margin-top: 0; transition: opacity .18s ease; }
.skill-settings-grid .primary-button { margin-bottom: 1px; }
.skill-limit-field.is-disabled { opacity: .42; }
.skill-limit-field.is-disabled input { cursor: not-allowed; background: rgba(232,237,245,.8); }
.field { display: grid; gap: 5px; margin-top: 9px; }
.field > span { font-size: 11px; font-weight: 730; }
.field small { color: var(--muted); font-size: 10px; line-height: 1.35; }
input, textarea, select { width: 100%; color: var(--ink); border: 1px solid #d6dfeb; border-radius: 9px; outline: 0; background: rgba(255,255,255,.84); transition: border .18s ease, box-shadow .18s ease, background .18s ease; }
input, select { height: 36px; padding: 0 10px; }
textarea { resize: vertical; min-height: 70px; padding: 9px 10px; line-height: 1.4; }
input:focus, textarea:focus, select:focus { border-color: #77a4ff; background: white; box-shadow: 0 0 0 4px rgba(57,120,246,.1); }
.primary-button, .secondary-button, .text-button { border: 0; cursor: pointer; font-weight: 760; border-radius: 9px; transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease; }
.primary-button { width: fit-content; padding: 8px 12px; color: white; background: linear-gradient(135deg, #347cf7, #6968eb); box-shadow: 0 6px 16px rgba(58,104,224,.18); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.secondary-button { width: fit-content; padding: 7px 11px; color: #344158; background: rgba(255,255,255,.9); border: 1px solid #d8e0eb; }
.text-button { width: fit-content; color: var(--blue-dark); background: transparent; padding: 6px; }
.full { width: fit-content; margin: 11px 0 0 auto; display: block; }

.overview-card { padding: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.stat { padding: 10px; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 10px; text-align: left; background: rgba(255,255,255,.56); cursor: pointer; }
.stat strong { color: var(--blue-dark); font-size: 19px; }
.stat span { color: var(--muted); font-size: 10px; }

.chat-card { position: sticky; top: 10px; height: calc(100vh - 20px); min-height: 500px; padding: 14px; display: flex; flex-direction: column; }
.chat-context { padding: 7px 9px; border-radius: 8px; color: #66738c; background: rgba(233,241,255,.72); font-size: 10px; line-height: 1.35; }
.messages { min-height: 0; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 2px; scrollbar-width: thin; }
.empty-chat { margin: auto; display: grid; justify-items: center; gap: 6px; color: var(--muted); text-align: center; }
.empty-chat div { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 15px; color: var(--blue); background: #eaf2ff; }
.empty-chat strong { color: #39465c; font-size: 13px; }
.empty-chat span { font-size: 11px; }
.message { max-width: 88%; padding: 8px 10px; border-radius: 11px; font-size: 11px; line-height: 1.45; white-space: pre-wrap; }
.message.user { align-self: flex-end; color: white; background: linear-gradient(135deg, #3978f6, #666fe7); border-bottom-right-radius: 5px; }
.message.assistant { align-self: flex-start; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.message.assistant.pending { color: var(--muted); border-style: dashed; }
.message-meta { display: block; opacity: .65; margin-top: 5px; font-size: 9px; }
.chat-form { padding-top: 8px; display: flex; gap: 7px; border-top: 1px solid var(--line); }
.chat-form textarea { resize: none; min-height: 40px; max-height: 100px; }
.send-button { align-self: flex-end; width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 10px; color: white; font-size: 18px; background: linear-gradient(145deg, var(--blue), #6969e9); cursor: pointer; }

.section-head { margin-bottom: 9px; display: flex; justify-content: space-between; align-items: end; gap: 10px; }
.section-head h2 { font-size: 20px; }
.section-head p:not(.eyebrow) { margin: 4px 0 0; color: var(--muted); }
.filter-tabs { width: fit-content; display: flex; gap: 3px; padding: 3px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.56); }
.filter-tabs button { padding: 6px 10px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.filter-tabs button.active { color: var(--blue-dark); font-weight: 750; background: white; box-shadow: 0 5px 15px rgba(68,94,130,.1); }
.item-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.item-card { position: relative; padding: 12px; display: flex; align-items: flex-start; gap: 10px; }
.item-card h3 { margin: 2px 0 4px; font-size: 14px; }
.item-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.item-card .item-content-preview { color: #344158; line-height: 1.55; white-space: pre-wrap; }
.item-card small { display: block; margin-top: 6px; color: #7b879b; font-size: 9px; }
.item-card .pill { margin-left: auto; }
.item-actions { display: flex; gap: 4px; margin-left: auto; }
.item-actions { align-items: center; }
.item-actions button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; color: var(--muted); background: rgba(240,244,250,.85); cursor: pointer; }
.item-actions .view-source-button { width: auto; padding: 0 9px; color: #245dbd; background: #e8f1ff; font-size: 10px; font-weight: 760; }
.item-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: white; font-weight: 850; }
.telegram { background: #2aabee; }.zalo { background: #1677ff; }.web { background: #0ca78f; }
.category-label { display: inline-block; margin-bottom: 8px; color: var(--blue-dark); font-weight: 760; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.item-switch { min-height: 28px; padding: 0 7px 0 4px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid #d9e2ef; border-radius: 8px; background: rgba(255,255,255,.72); cursor: pointer; }
.item-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.item-switch-track { width: 26px; height: 15px; padding: 2px; display: block; border-radius: 99px; background: #b8c1ce; transition: background .16s ease; }
.item-switch-track::after { content: ""; width: 11px; height: 11px; display: block; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(32,46,68,.25); transition: transform .16s ease; }
.item-switch input:checked + .item-switch-track { background: #2e73e8; }
.item-switch input:checked + .item-switch-track::after { transform: translateX(11px); }
.item-switch input:focus-visible + .item-switch-track { outline: 3px solid rgba(68,121,238,.2); }
.item-switch-text { color: #637087; font-size: 9px; font-weight: 760; }
.empty-state { min-height: 230px; display: grid; place-content: center; justify-items: center; text-align: center; border: 1px dashed #bccbe0; border-radius: var(--radius); background: rgba(255,255,255,.42); }
.empty-state > div { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--blue); background: #e8f1ff; font-size: 18px; }
.empty-state h3 { margin: 10px 0 4px; font-size: 14px; }.empty-state p { margin: 0; color: var(--muted); font-size: 11px; }
.customer-workspace { min-height: calc(100vh - 68px); display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 9px; }
.customer-list-panel, .customer-detail-panel { min-width: 0; padding: 10px; }
.customer-list-panel { display: flex; flex-direction: column; }
.customer-panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 2px 2px 9px; border-bottom: 1px solid var(--line); }
.customer-panel-title strong { font-size: 12px; }
.customer-panel-title span { color: var(--muted); font-size: 9px; }
.customer-list { min-height: 0; display: grid; align-content: start; gap: 5px; padding-top: 7px; overflow-y: auto; }
.customer-row { width: 100%; padding: 9px; display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 8px; align-items: center; border: 1px solid transparent; border-radius: 9px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.customer-row:hover, .customer-row.active { border-color: #d9e4f2; background: rgba(255,255,255,.82); }
.customer-row.active { box-shadow: 0 6px 18px rgba(55,88,140,.08); }
.customer-avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: white; font-size: 11px; font-weight: 800; background: linear-gradient(145deg, #35bfd0, #6677ed); }
.customer-row-copy { min-width: 0; display: grid; gap: 2px; }
.customer-row-copy strong, .customer-row-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-row-copy strong { font-size: 11px; }
.customer-row-copy span { color: var(--muted); font-size: 9px; }
.customer-empty { min-height: 330px; display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--muted); text-align: center; }
.customer-empty div { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--blue); background: #eaf2ff; font-size: 18px; }
.customer-empty strong { color: #39465c; font-size: 13px; }
.customer-empty span { max-width: 360px; font-size: 10px; }
.customer-detail-head { display: flex; justify-content: space-between; gap: 10px; padding: 2px 2px 10px; border-bottom: 1px solid var(--line); }
.customer-detail-head h3 { margin: 3px 0 2px; font-size: 16px; }
.customer-detail-head p { margin: 0; color: var(--muted); font-size: 10px; }
.customer-summary { display: flex; gap: 5px; align-items: flex-start; flex-wrap: wrap; }
.customer-section { margin-top: 10px; }
.customer-section-head { margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.customer-section-head strong { font-size: 11px; }
.customer-section-head span { color: var(--muted); font-size: 9px; }
.memory-placeholder { min-height: 66px; padding: 10px; display: grid; place-content: center; border: 1px dashed #c5d3e5; border-radius: 9px; color: var(--muted); background: rgba(245,249,255,.6); text-align: center; font-size: 10px; }
.memory-fact-list { max-height: 250px; display: grid; gap: 5px; overflow-y: auto; }
.memory-fact { padding: 7px 9px; border: 1px solid #dce5f0; border-radius: 9px; background: rgba(255,255,255,.74); }
.memory-fact > div { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 8px; }
.memory-fact-type { padding: 3px 6px; border-radius: 99px; color: #245ab6; background: #eaf2ff; font-weight: 760; }
.memory-fact p { margin: 5px 0 3px; color: #263248; font-size: 10px; line-height: 1.38; }
.memory-fact small { color: var(--muted); font-size: 8px; }
.conversation-state-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.conversation-state-grid > span { display: grid; gap: 2px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.66); }
.conversation-state-grid small { color: var(--muted); font-size: 8px; }
.conversation-state-grid strong { overflow: hidden; font-size: 10px; font-weight: 650; text-overflow: ellipsis; }
@media (max-width: 820px) { .conversation-state-grid { grid-template-columns: 1fr 1fr; } }
.conversation-list { display: grid; gap: 5px; }
.conversation-row { width: 100%; padding: 8px 9px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; border: 1px solid #dce5f0; border-radius: 9px; background: rgba(255,255,255,.7); text-align: left; cursor: pointer; }
.conversation-row:hover, .conversation-row.active { border-color: #9bb8ef; background: white; }
.conversation-row strong, .conversation-row span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-row strong { font-size: 10px; }
.conversation-row span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.conversation-row time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.customer-transcript { max-height: 340px; padding: 8px; display: flex; flex-direction: column; gap: 6px; border: 1px solid #dce5f0; border-radius: 9px; background: rgba(248,251,255,.64); overflow-y: auto; }
.transcript-message { max-width: 82%; padding: 7px 9px; border-radius: 9px; font-size: 10px; line-height: 1.42; white-space: pre-wrap; }
.transcript-message.user { align-self: flex-end; color: white; background: linear-gradient(135deg, #3978f6, #666fe7); }
.transcript-message.assistant { align-self: flex-start; border: 1px solid var(--line); background: white; }
.transcript-message time { display: block; margin-top: 3px; opacity: .62; font-size: 8px; }
.trace-filterbar { margin-bottom: 9px; padding: 8px; display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(105px, .55fr)) auto auto; gap: 6px; align-items: end; }
.trace-filterbar label { min-width: 0; display: grid; gap: 4px; }
.trace-filterbar label span { color: var(--muted); font-size: 8px; font-weight: 760; }
.trace-filterbar input, .trace-filterbar select { width: 100%; min-width: 0; min-height: 34px; padding: 6px 8px; border: 1px solid #d7e1ed; border-radius: 8px; color: var(--ink); background: rgba(255,255,255,.82); font: inherit; font-size: 10px; outline: none; }
.trace-filterbar input:focus, .trace-filterbar select:focus { border-color: #83a9f5; box-shadow: 0 0 0 3px rgba(68,121,238,.1); }
.trace-filterbar button { min-height: 34px; padding: 7px 11px; white-space: nowrap; }
.trace-workspace { min-height: calc(100vh - 122px); display: grid; grid-template-columns: minmax(270px, 340px) minmax(0, 1fr); gap: 9px; }
.trace-list-panel, .trace-detail-panel { min-width: 0; padding: 10px; }
.trace-list-panel { display: flex; flex-direction: column; }
.trace-list { min-height: 0; display: grid; align-content: start; gap: 5px; padding-top: 7px; overflow-y: auto; }
.trace-day { position: sticky; top: 0; z-index: 1; padding: 7px 5px 3px; color: #65758d; background: rgba(245,249,255,.94); font-size: 8px; font-weight: 780; }
.trace-row { width: 100%; padding: 8px; display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 1px solid transparent; border-radius: 9px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.trace-row:hover, .trace-row.active { border-color: #d7e3f2; background: rgba(255,255,255,.84); }
.trace-row.active { box-shadow: 0 6px 18px rgba(55,88,140,.08); }
.trace-status { width: 7px; height: 7px; border-radius: 50%; background: #d96070; }
.trace-status.success { background: #25bd84; }
.trace-row-copy { min-width: 0; display: grid; gap: 2px; }
.trace-row-copy strong, .trace-row-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-row-copy strong { font-size: 10px; }
.trace-row-copy span { color: var(--muted); font-size: 8px; }
.trace-model { max-width: 100px; display: grid; gap: 2px; overflow: hidden; color: #52627a; font-size: 8px; text-align: right; white-space: nowrap; }
.trace-model small { overflow: hidden; color: var(--muted); font-size: 7px; text-overflow: ellipsis; }
.trace-detail-panel { overflow: hidden; }
.trace-detail-head { display: flex; justify-content: space-between; gap: 10px; padding: 2px 2px 9px; border-bottom: 1px solid var(--line); }
.trace-detail-head h3 { max-width: 780px; margin: 3px 0 2px; font-size: 15px; overflow-wrap: anywhere; }
.trace-detail-head p { margin: 0; color: var(--muted); font-size: 9px; }
.trace-empty { padding: 8px; color: var(--muted); font-size: 9px; text-align: center; }
.trace-exchanges { max-height: calc(100vh - 180px); padding-top: 8px; display: grid; align-content: start; gap: 7px; overflow-y: auto; scrollbar-width: thin; }
.trace-exchange { border: 1px solid #dce5f0; border-radius: 9px; background: rgba(255,255,255,.56); overflow: hidden; }
.trace-exchange summary { padding: 8px 10px; display: flex; align-items: center; gap: 8px; color: #2f3e56; cursor: pointer; list-style: none; font-size: 9px; font-weight: 760; }
.trace-exchange summary::-webkit-details-marker { display: none; }
.trace-exchange summary::before { content: "›"; color: #6780a5; font-size: 16px; transition: transform .15s ease; }
.trace-exchange[open] summary::before { transform: rotate(90deg); }
.trace-pair { padding: 0 8px 8px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; }
.trace-pair section { min-width: 0; border: 1px solid #dfe7f1; border-radius: 8px; background: rgba(248,251,255,.86); overflow: hidden; }
.trace-block-title { min-height: 38px; padding: 7px 8px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; border-bottom: 1px solid #e2e9f2; }
.trace-block-title strong { flex: 0 0 auto; color: #275eb8; font-size: 9px; }
.trace-block-title span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 8px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.trace-pair pre { min-height: 240px; max-height: calc(100vh - 300px); margin: 0; padding: 8px; color: #2e3a4f; background: transparent; font: 9px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow: auto; overflow-wrap: anywhere; }
.trace-technical { padding: 6px 8px; display: flex; flex-wrap: wrap; gap: 5px; border-top: 1px solid #e2e9f2; }
.trace-technical span { padding: 3px 6px; border-radius: 99px; color: #61718a; background: #edf3fb; font-size: 7px; }
.trace-raw { border-top: 1px solid #e2e9f2; }
.trace-raw summary { padding: 7px 8px; color: #61718a; font-size: 8px; cursor: pointer; }
.trace-raw pre { min-height: 120px; max-height: 320px; border-top: 1px solid #e2e9f2; }
.notice { margin-top: 9px; padding: 10px 12px; display: flex; gap: 9px; border-radius: 10px; color: #50617d; background: rgba(232,242,255,.76); border: 1px solid #d5e6ff; font-size: 11px; }
.notice strong { color: #27539b; white-space: nowrap; }.notice span { line-height: 1.5; }
.settings-grid { width: 100%; min-width: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.provider-tabs { width: fit-content; max-width: 100%; display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.64); box-shadow: 0 7px 22px rgba(58,84,124,.08); overflow-x: auto; scrollbar-width: none; }
.provider-tabs::-webkit-scrollbar { display: none; }
.provider-tabs button { flex: 0 0 auto; padding: 7px 13px; border: 0; border-radius: 8px; color: #64728a; background: transparent; font-size: 11px; font-weight: 760; cursor: pointer; }
.provider-tabs button:hover { color: var(--blue-dark); background: rgba(255,255,255,.72); }
.provider-tabs button.active { color: white; background: linear-gradient(135deg, #347cf7, #6968eb); box-shadow: 0 6px 15px rgba(58,104,224,.2); }
.provider-tabs button.configured:not(.active)::after { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 6px; border-radius: 50%; background: #24bd82; vertical-align: 1px; }
.ai-config-grid { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(340px, .84fr); gap: 11px; align-items: start; }
.ai-config-grid > *, .model-add-row > * { min-width: 0; }
.compact-textarea { min-height: 78px; max-height: 160px; }
.model-add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.model-list { margin-top: 7px; display: grid; gap: 5px; max-height: 245px; overflow-y: auto; scrollbar-width: thin; }
.model-row { min-height: 38px; padding: 5px 6px 5px 10px; display: flex; align-items: center; gap: 7px; border: 1px solid #dbe3ee; border-radius: 9px; background: rgba(255,255,255,.72); }
.model-number { width: 24px; color: #78869b; font-size: 11px; }
.model-name { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: 11px; font-weight: 720; }
.model-actions { display: flex; gap: 4px; }
.model-actions button { width: 27px; height: 27px; padding: 0; border: 0; border-radius: 7px; color: #58677d; background: #eef3f9; cursor: pointer; }
.model-actions button:disabled { opacity: .35; cursor: default; }
.model-actions .remove-model { color: #a53f4d; background: #fff0f2; }
.model-list-empty { padding: 12px; border: 1px dashed #c5d2e3; border-radius: 9px; color: var(--muted); text-align: center; font-size: 10px; }
.ai-test-card { position: sticky; top: 10px; }
.ai-summary { display: grid; grid-template-columns: .7fr .7fr 1.6fr; gap: 6px; }
.ai-summary > div { min-width: 0; padding: 8px; display: grid; gap: 3px; border: 1px solid #dce5f0; border-radius: 9px; background: rgba(255,255,255,.6); }
.ai-summary span { color: var(--muted); font-size: 9px; }
.ai-summary strong { overflow-wrap: anywhere; font-size: 11px; }
.test-prompt { min-height: 82px; max-height: 170px; }
.test-result { min-height: 76px; margin-top: 10px; padding: 10px; border: 1px solid #dbe4f0; border-radius: 9px; color: #344158; background: rgba(255,255,255,.66); white-space: pre-wrap; line-height: 1.45; font-size: 11px; }
.test-result > span { color: var(--muted); }
.test-result.error { color: #9d3444; border-color: #efcbd1; background: #fff4f5; }
.attempt-section { margin-top: 10px; display: grid; gap: 6px; }
.attempt-section > strong { font-size: 10px; }
.attempt-list { display: grid; gap: 4px; max-height: 160px; overflow-y: auto; scrollbar-width: thin; }
.attempt-list > span { color: var(--muted); font-size: 10px; }
.attempt-row { padding: 6px 8px; display: grid; grid-template-columns: 30px 1fr auto; gap: 6px; align-items: center; border: 1px solid #dfe6ef; border-radius: 8px; background: rgba(255,255,255,.62); font-size: 10px; }
.attempt-row .attempt-number { color: #7a8799; }
.attempt-row .attempt-pair { overflow-wrap: anywhere; font-weight: 700; }
.attempt-status { color: #a63c4b; }
.attempt-status.success { color: #087e51; }

dialog { width: min(620px, calc(100vw - 20px)); max-height: calc(100vh - 20px); padding: 0; border: 0; border-radius: 15px; background: transparent; box-shadow: 0 30px 100px rgba(26,40,64,.28); overflow: hidden; }
dialog::backdrop { background: rgba(31,42,61,.35); backdrop-filter: blur(4px); }
.dialog-card { max-height: calc(100vh - 20px); padding: 14px; display: flex; flex-direction: column; background: rgba(250,252,255,.96); border: 1px solid rgba(255,255,255,.8); }
#dialogFields { min-height: 0; overflow-y: auto; padding: 0 5px 4px 0; }
.dialog-actions { margin-top: 10px; padding-top: 9px; display: flex; justify-content: flex-end; gap: 7px; border-top: 1px solid var(--line); }
.source-viewer-dialog { width: min(1180px, calc(100vw - 20px)); height: min(850px, calc(100vh - 20px)); }
.source-viewer-card { height: 100%; min-height: 0; padding: 10px; }
.source-viewer-heading { flex: 0 0 auto; margin-bottom: 7px; padding: 2px 2px 7px; border-bottom: 1px solid var(--line); }
.source-viewer-heading h2 { max-width: 850px; overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.source-viewer-toolbar { flex: 0 0 auto; display: grid; grid-template-columns: minmax(180px, 420px) auto 1fr; gap: 6px; align-items: center; }
.source-viewer-toolbar input { width: 100%; min-height: 34px; padding: 7px 9px; border: 1px solid #d7e1ed; border-radius: 8px; color: var(--ink); background: white; font: inherit; font-size: 10px; outline: none; }
.source-viewer-toolbar input:focus { border-color: #83a9f5; box-shadow: 0 0 0 3px rgba(68,121,238,.1); }
.source-viewer-toolbar button { min-height: 34px; padding: 7px 11px; }
.source-viewer-toolbar span { color: var(--muted); font-size: 9px; text-align: right; }
.source-viewer-content { min-height: 0; flex: 1 1 auto; margin-top: 7px; border: 1px solid #dce5f0; border-radius: 9px; background: rgba(255,255,255,.68); overflow: auto; scrollbar-width: thin; }
.source-viewer-empty { min-height: 220px; display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.source-table-wrap { min-width: 680px; }
.source-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 9px; }
.source-table th { position: sticky; top: 0; z-index: 2; padding: 8px; color: #52627a; background: #edf3fb; text-align: left; white-space: nowrap; }
.source-table td { max-width: 290px; padding: 7px 8px; border-top: 1px solid #e5ebf3; color: #344158; vertical-align: top; overflow-wrap: anywhere; }
.source-table tbody tr:first-child td { border-top: 0; }
.source-table tbody tr:hover td { background: rgba(238,245,255,.55); }
.source-table th:first-child, .source-table td:first-child { width: 44px; color: #7b879b; text-align: right; }
.source-table strong { color: #25334a; font-size: 10px; }
.source-price { color: #176548 !important; font-weight: 780; white-space: nowrap; }
.source-stock { display: inline-flex; padding: 3px 7px; border-radius: 999px; font-size: 8px; font-weight: 780; white-space: nowrap; }
.source-stock.available { color: #176548; background: #e6f6ee; border: 1px solid #bfe6d1; }
.source-stock.unavailable { color: #9b3f3f; background: #fff0f0; border: 1px solid #f0cccc; }
.source-specifications-toggle { margin-top: 5px; padding: 3px 7px; display: block; border: 1px solid #cbd9ec; border-radius: 6px; color: #2b65c6; background: #f6f9fe; font: inherit; font-size: 8px; font-weight: 760; cursor: pointer; }
.source-specifications-toggle:hover { border-color: #8eb1fa; background: #edf4ff; }
.source-specifications-row td { padding-top: 0; background: #f8fbff; }
.source-specifications-row:hover td { background: #f8fbff !important; }
.source-specifications-panel { padding: 8px 10px; display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; border-left: 3px solid #84aaf5; border-radius: 0 7px 7px 0; background: #f0f5fd; }
.source-specifications-panel > span { color: #2b65c6; font-size: 9px; font-weight: 800; }
.source-specifications { margin: 0; display: grid; grid-template-columns: max-content minmax(120px, 1fr); gap: 3px 8px; line-height: 1.4; }
.source-specifications dt { color: #52627a; font-weight: 760; }
.source-specifications dd { margin: 0; color: #25334a; }
.source-specifications-empty { color: #8a94a5; font-style: italic; }
.source-chunk-list { display: grid; gap: 6px; padding: 7px; }
.source-chunk { border: 1px solid #dfe7f1; border-radius: 8px; background: rgba(250,252,255,.9); overflow: hidden; }
.source-chunk > div { padding: 7px 9px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #e5ebf3; }
.source-chunk span { color: #2b65c6; font-size: 8px; font-weight: 760; white-space: nowrap; }
.source-chunk strong { font-size: 10px; }
.source-chunk pre { margin: 0; padding: 9px; color: #344158; background: transparent; font: inherit; font-size: 10px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.source-viewer-actions { flex: 0 0 auto; justify-content: space-between; }
.source-viewer-actions > div { display: flex; gap: 6px; }
.source-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.source-choices button { min-height: 105px; padding: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; border: 1px solid #d9e2ef; border-radius: 11px; text-align: left; background: rgba(255,255,255,.78); cursor: pointer; transition: transform .16s ease, border .16s ease, box-shadow .16s ease; }
.source-choices button:hover { transform: translateY(-2px); border-color: #8eb1fa; box-shadow: 0 10px 26px rgba(60,94,151,.12); }
.source-choices strong { font-size: 15px; }.source-choices span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.replace-note { margin-top: 16px; padding: 12px 14px; border-radius: 12px; color: #7c5a21; background: #fff5dc; border: 1px solid #f2ddb0; font-size: 12px; line-height: 1.5; }
.inventory-template-download { margin-top: 12px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #d8e4f5; border-radius: 10px; background: #f4f8fe; }
.inventory-template-download > div { display: grid; gap: 2px; }
.inventory-template-download strong { color: #25334a; font-size: 11px; }
.inventory-template-download span { color: var(--muted); font-size: 10px; }
.inventory-template-download a { padding: 7px 10px; border-radius: 8px; color: #fff; background: #2e73e8; font-size: 10px; font-weight: 780; text-decoration: none; white-space: nowrap; }
.toast { position: fixed; z-index: 100; right: 12px; bottom: 12px; max-width: 360px; padding: 9px 12px; border-radius: 9px; color: white; background: #26354d; box-shadow: 0 15px 40px rgba(28,41,62,.24); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #b43e4d; }
.backdrop { display: none; }

.tool-guide-card, .tool-field-explanation-card, .tool-result-card, .tool-rule-card, .tool-result-contract-card, .tool-source-card { padding: 24px; }
.tool-guide-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.tool-guide-title.compact { align-items: center; margin-bottom: 16px; }
.tool-guide-title h2, .tool-guide-title p { margin: 0; }
.tool-guide-title code, .tool-explanation-name code { color: var(--primary); }
.tool-guide-lead { max-width: 1000px; margin: 14px 0 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.tool-call-clarification { margin: 16px 0 0; padding: 13px 15px; border: 1px solid #bfd3ff; border-radius: 13px; color: #203554; background: #edf4ff; line-height: 1.58; }
.tool-call-clarification code { color: var(--primary); }
.tool-flow { display: grid; grid-template-columns: minmax(150px,1fr) auto minmax(150px,1fr) auto minmax(150px,1fr) auto minmax(150px,1fr); align-items: stretch; gap: 10px; margin-top: 22px; }
.tool-flow > div { display: grid; grid-template-columns: 30px 1fr; align-content: start; column-gap: 9px; min-height: 112px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.65); }
.tool-flow > div > span { display: grid; place-items: center; width: 30px; height: 30px; grid-row: 1 / span 2; border-radius: 10px; color: #fff; background: var(--primary); font-weight: 800; }
.tool-flow > div strong { align-self: center; }
.tool-flow > div small { grid-column: 2; margin-top: 7px; color: var(--muted); line-height: 1.45; }
.tool-flow > b { align-self: center; color: var(--primary); font-size: 22px; }
.tool-why-grid { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); gap: 16px; margin-top: 18px; }
.tool-why-grid > section { padding: 18px; border-radius: 16px; background: rgba(45,98,232,.055); }
.tool-why-grid h3 { margin: 3px 0 10px; }
.tool-why-grid p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.tool-call-example { margin: 12px 0 8px; padding: 15px; overflow: auto; border-radius: 13px; color: #eaf1ff; background: #1e2b41; font: 600 13px/1.65 Consolas, monospace; white-space: pre-wrap; }
.tool-field-explanation-card { margin-top: 16px; }
.tool-explanation-list { display: grid; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.tool-explanation-row { display: grid; grid-template-columns: minmax(190px,.38fr) minmax(0,1fr); gap: 18px; padding: 18px; background: rgba(255,255,255,.52); }
.tool-explanation-row + .tool-explanation-row { border-top: 1px solid var(--line); }
.tool-explanation-row small { display: block; margin-bottom: 5px; color: var(--muted); font-weight: 700; }
.tool-explanation-row p { margin: 0; line-height: 1.55; white-space: pre-wrap; }
.tool-explanation-name { display: grid; align-content: start; gap: 6px; }
.tool-explanation-name code { font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.tool-explanation-name span { color: var(--muted); font-size: 12px; }
.tool-explanation-name small { margin: 2px 0 0; color: #526782; font-size: 11px; font-weight: 650; line-height: 1.45; }
.tool-explanation-name small code { color: #315fbd; font-size: 11px; }
.tool-field-meaning { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.tool-field-meaning > div { padding: 11px 12px; border-radius: 11px; background: rgba(45,98,232,.05); }
.tool-field-meaning dt { margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.tool-field-meaning dd { margin: 0; line-height: 1.52; }
.tool-field-example { grid-column: 1 / -1; }
.tool-field-example code { color: var(--primary); font-weight: 750; white-space: pre-wrap; }
.tool-field-sent-text { grid-column: 2; border-top: 1px dashed var(--line); padding-top: 10px; }
.tool-field-sent-text summary { color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 750; }
.tool-field-sent-text p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.tool-option-explanations { display: grid; gap: 5px; margin-top: 9px; }
.tool-option-explanations span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.tool-result-contract-card { margin-top: 16px; }
.tool-contract-note { margin: 0 0 16px; padding: 13px 15px; border-radius: 13px; color: #31445f; background: rgba(45,98,232,.055); line-height: 1.6; }
.tool-contract-note code { color: var(--primary); font-weight: 800; }
.tool-result-contract-list { display: grid; gap: 14px; margin-top: 14px; }
.tool-result-section { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.55); }
.tool-result-section > p { color: var(--muted); line-height: 1.55; }
.tool-result-section h3, .tool-result-section .eyebrow { margin: 0; }
.tool-result-section h3 { margin-top: 3px; }
.tool-result-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.tool-result-section-head .eyebrow code { color: var(--primary); }
.tool-result-action { display: grid; justify-items: end; gap: 3px; min-width: 210px; }
.tool-result-action span { color: var(--muted); font-size: 11px; font-weight: 750; }
.tool-result-action code { color: var(--primary); font-weight: 800; }
.tool-result-field-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 14px; }
.tool-result-field { display: grid; grid-template-columns: minmax(150px,.7fr) auto; align-content: start; gap: 5px 10px; padding: 11px 12px; border-radius: 11px; background: rgba(45,98,232,.045); }
.tool-result-field > code { color: #285fc5; font-weight: 800; overflow-wrap: anywhere; }
.tool-result-field > span { align-self: start; padding: 2px 7px; border-radius: 999px; color: #526782; background: #e8eef8; font-size: 10px; font-weight: 750; white-space: nowrap; }
.tool-result-field > p { grid-column: 1 / -1; margin: 0; color: #42546e; font-size: 12px; line-height: 1.52; }
.tool-result-envelope, .tool-result-failures { margin-top: 14px; }
.tool-source-card h2 { margin: 3px 0 14px; }
.tool-source-card p:not(.eyebrow) { color: var(--muted); line-height: 1.62; }
.tool-source-card code { color: var(--primary); font-weight: 750; }
.tool-bottom-grid { display: grid; grid-template-columns: minmax(0,.75fr) minmax(0,1.25fr); gap: 16px; margin-top: 16px; }
.tool-bottom-grid.tool-rule-grid { grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); }
.tool-result-card h2, .tool-rule-card h2 { margin: 3px 0 15px; }
.tool-result-list { display: grid; gap: 9px; }
.tool-result-list > span { display: grid; gap: 3px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.55); }
.tool-result-list small { color: var(--muted); line-height: 1.45; }
.tool-rule-card > strong { display: block; margin-bottom: 8px; }
.tool-rule-card pre { max-height: 320px; margin: 0; padding: 14px; overflow: auto; border-radius: 13px; color: #26354d; background: rgba(45,98,232,.055); font: 500 13px/1.65 inherit; white-space: pre-wrap; }
.tool-editor-actions { display: flex; justify-content: flex-end; margin: 16px 0; }
.tool-config-card { padding: 24px; }
.tool-main-fields { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(360px, 1.25fr); gap: 18px; align-items: start; }
.tool-fields-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 14px; padding-top: 22px; border-top: 1px solid var(--line); }
.tool-fields-heading h3, .tool-fields-heading p { margin: 0; }
.tool-field-list { display: grid; gap: 14px; }
.tool-field-card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.58); }
.tool-field-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.tool-field-head > div { display: grid; gap: 2px; min-width: 0; margin-right: auto; }
.tool-field-head strong { overflow-wrap: anywhere; }
.tool-field-head small { color: var(--muted); }
.tool-field-number { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px; color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.tool-field-grid { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 16px; align-items: end; margin-bottom: 14px; }
.tool-required-control { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.72); font-weight: 700; cursor: pointer; }
.tool-required-control input { width: 18px; height: 18px; accent-color: var(--primary); }
.tool-options { display: grid; gap: 10px; margin-top: 16px; padding: 14px; border-radius: 14px; background: rgba(45,98,232,.055); }
.tool-option-row { display: grid; grid-template-columns: minmax(160px, .42fr) minmax(260px, 1fr); gap: 12px; }

@media (max-width: 1050px) {
  .page-grid { grid-template-columns: 1fr; }
  .chat-card { position: relative; top: auto; height: 560px; }
  .ai-config-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-test-card { position: relative; top: auto; }
  .customer-workspace { grid-template-columns: 240px minmax(0, 1fr); }
  .trace-workspace { grid-template-columns: 260px minmax(0, 1fr); }
  .trace-filterbar { grid-template-columns: minmax(200px, 1.5fr) repeat(2, minmax(105px, .7fr)) auto auto; }
  .trace-filterbar label:nth-of-type(4), .trace-filterbar label:nth-of-type(5) { display: none; }
  .tool-flow { grid-template-columns: 1fr 1fr; }
  .tool-flow > b { display: none; }
  .tool-explanation-row { grid-template-columns: minmax(170px,.5fr) minmax(0,1fr); }
  .tool-result-field-list { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar, .sidebar-collapsed .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 232px; transition: transform .22s ease; will-change: transform; }
  .sidebar.open { transform: none; }
  .sidebar-collapsed .brand-copy, .sidebar-collapsed .sidebar-foot-copy, .sidebar-collapsed .status-dot, .sidebar-collapsed .sidebar-refresh { display: block; }
  .sidebar-collapsed .brand { min-height: 44px; display: flex; justify-items: initial; gap: 9px; }
  .sidebar-collapsed .brand-mark { width: 34px; height: 34px; cursor: default; }
  .sidebar-collapsed .brand-mark::after { display: none; }
  .sidebar-collapsed .sidebar-toggle { width: 28px; display: grid; }
  .sidebar-collapsed .nav-item { justify-content: flex-start; padding: 8px 10px; }
  .sidebar-collapsed .nav-label { display: inline; }
  .sidebar-collapsed .nav-item:hover::after { display: none; }
  .sidebar-collapsed .sidebar-foot { justify-content: flex-start; padding: 8px; }
  .sidebar-collapsed .sidebar-foot::after { display: none; }
  .backdrop { position: fixed; inset: 0; z-index: 25; border: 0; background: rgba(34,45,63,.3); opacity: 0; pointer-events: none; display: block; transition: opacity .2s ease; }
  .backdrop.open { opacity: 1; pointer-events: auto; }
  .mobile-menu-button { display: grid; }
  .page { padding: 50px 8px 16px; }
  .item-grid { grid-template-columns: 1fr; }
  .fixed-grid { grid-template-columns: 1fr; }
  .skill-settings-grid { grid-template-columns: 1fr; }
  .customer-workspace { min-height: 0; grid-template-columns: 1fr; }
  .trace-workspace { min-height: 0; grid-template-columns: 1fr; }
  .trace-list-panel { max-height: 280px; }
  .trace-filterbar { grid-template-columns: minmax(0, 1fr) minmax(105px, .55fr) auto; }
  .trace-filterbar label:nth-of-type(3) { display: none; }
  .trace-pair { grid-template-columns: 1fr; }
  .trace-pair pre { min-height: 170px; max-height: 320px; }
  .customer-list-panel { max-height: 280px; }
  .skill-settings-grid .primary-button { justify-self: start; }
  .tool-main-fields, .tool-field-grid, .tool-option-row { grid-template-columns: 1fr; }
  .tool-required-control { min-height: 46px; }
  .tool-why-grid, .tool-bottom-grid, .tool-flow, .tool-explanation-row, .tool-field-meaning { grid-template-columns: 1fr; }
  .tool-bottom-grid.tool-rule-grid { grid-template-columns: 1fr; }
  .tool-field-example, .tool-field-sent-text { grid-column: auto; }
  .tool-result-section-head { display: grid; }
  .tool-result-action { justify-items: start; min-width: 0; }
}

@media (max-width: 560px) {
  .section-head { align-items: stretch; flex-direction: column; }
  .section-head .primary-button { width: fit-content; }
  .hero-card { align-items: flex-start; }.hero-card .switch { position: absolute; right: 18px; top: 18px; }
  .hero-copy { padding-right: 42px; }
  .field-row, .stat-grid { grid-template-columns: 1fr; }
  .card-heading { align-items: flex-start; }
  .card-heading > button { width: fit-content; }
  .card-heading.compact { flex-direction: row; }
  .card-heading.compact > button { width: auto; }
  .filter-tabs { width: 100%; overflow-x: auto; }
  .provider-tabs { width: 100%; }
  .filter-tabs button { white-space: nowrap; }
  .chat-card { min-height: 480px; height: calc(100vh - 60px); }
  .notice { flex-direction: column; }
  .source-choices { grid-template-columns: 1fr; }
  .source-choices button { min-height: 105px; }
  .model-add-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ai-summary { grid-template-columns: 1fr 1fr; }
  .ai-summary > div:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
