.hidden { display: none !important; }

.wc-host-page .web-content {
  max-width: none;
  padding: 20px 20px 28px;
}

.wc-page-shell,
.wc-page-shell * { box-sizing: border-box; }

.wc-page-shell {
  height: calc(100vh - 48px);
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--ink, #1c1917);
}

.wc-chat-header,
.wc-chat-card,
.wc-composer-card,
.wc-utility-card,
.wc-modal {
  border: 1px solid rgba(28, 25, 23, 0.1);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 48px rgba(28, 25, 23, 0.07);
}

.wc-chat-header {
  position: relative;
  z-index: 20;
  min-height: 58px;
  padding: 7px 10px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wc-chat-heading {
  min-width: 160px;
  max-width: 240px;
}

.wc-chat-heading .wc-eyebrow { display: none; }

.wc-eyebrow {
  margin: 0;
  color: var(--accent, #0d9488);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.wc-chat-heading h1 {
  margin: 0 0 1px;
  font-size: 0.98rem;
  line-height: 1.25;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wc-chat-heading > p:last-child {
  margin: 0;
  color: var(--muted, #78716c);
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wc-chatbot-picker { position: relative; min-width: 220px; }

.wc-chatbot-trigger {
  width: 100%;
  min-height: 42px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(28, 25, 23, 0.1);
  border-radius: 11px;
  background: rgba(250, 248, 245, 0.8);
  color: var(--ink, #1c1917);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.wc-chatbot-trigger:hover,
.wc-chatbot-trigger[aria-expanded="true"] { border-color: rgba(13, 148, 136, 0.38); }

.wc-chatbot-trigger-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent, #0d9488), var(--accent-2, #d97706));
  font-size: 0.72rem;
  font-weight: 800;
}

.wc-chatbot-trigger-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 1px; }
.wc-chatbot-trigger-copy small { color: var(--muted, #78716c); font-size: 0.61rem; }
.wc-chatbot-trigger-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.79rem; }
.wc-chatbot-trigger-caret { color: var(--muted, #78716c); }

.wc-chatbot-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(390px, calc(100vw - 48px));
  padding: 10px;
  border: 1px solid rgba(28, 25, 23, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 55px rgba(28, 25, 23, 0.16);
}

.wc-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid rgba(28, 25, 23, 0.1);
  border-radius: 12px;
  background: #faf8f5;
  color: var(--muted, #78716c);
}

.wc-search-box:focus-within { border-color: rgba(13, 148, 136, 0.4); }
.wc-search-box input { width: 100%; height: 40px; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 0.84rem; }

.wc-chatbot-results {
  max-height: 310px;
  margin-top: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wc-chatbot-option {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.wc-chatbot-option:hover { background: #f5f2ed; }
.wc-chatbot-option.is-current { border-color: rgba(13, 148, 136, 0.25); background: rgba(13, 148, 136, 0.08); }
.wc-chatbot-option strong { display: block; font-size: 0.84rem; }
.wc-chatbot-option span { display: -webkit-box; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 0.73rem; line-height: 1.4; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wc-picker-empty { margin: 12px 4px 4px; text-align: center; color: var(--muted); font-size: 0.8rem; }

.wc-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.wc-header-btn,
.wc-send-btn,
.wc-inline-action,
.wc-modal-btn {
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
}

.wc-header-btn {
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 9px;
  border-color: rgba(28, 25, 23, 0.09);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted, #78716c);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.wc-header-btn:hover { border-color: rgba(28, 25, 23, 0.2); color: var(--ink); }
.wc-header-btn-primary { background: var(--ink, #1c1917); border-color: var(--ink, #1c1917); color: #fff; }
.wc-header-btn:disabled { opacity: 0.45; cursor: default; }

.wc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid rgba(217, 119, 6, 0.18);
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.09);
  color: #9a5b05;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.wc-chat-layout {
  position: relative;
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 10px;
}

.wc-main-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.wc-chat-card, .wc-composer-card, .wc-utility-card { border-radius: 20px; }
.wc-chat-card { min-height: 390px; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.wc-thread { min-height: 330px; flex: 1; overflow-y: auto; padding: 22px 0 10px; scroll-behavior: smooth; }
.wc-thread-inner { width: min(820px, calc(100% - 30px)); margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }

.wc-welcome,
.wc-hub-state { min-height: 300px; padding: 38px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 9px; color: var(--muted); }
.wc-welcome-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(135deg, rgba(13,148,136,.14), rgba(217,119,6,.15)); color: #115e59; font-size: 1.45rem; }
.wc-welcome h2, .wc-hub-state h2 { margin: 0; color: var(--ink); font-size: clamp(1.5rem, 3vw, 2.25rem); letter-spacing: -0.04em; }
.wc-welcome > p, .wc-hub-state > p { max-width: 570px; margin: 0; line-height: 1.6; }
.wc-inline-action { margin-top: 5px; padding: 9px 13px; border-radius: 11px; background: rgba(13, 148, 136, 0.1); color: #115e59; font-size: 0.8rem; font-weight: 700; }

.wc-hub-grid { width: 100%; margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; text-align: left; }
.wc-hub-card { min-width: 0; padding: 13px; border: 1px solid rgba(28,25,23,.09); border-radius: 14px; background: rgba(255,255,255,.82); color: var(--muted); font: inherit; text-align: left; cursor: pointer; }
.wc-hub-card:hover, .wc-hub-card.is-selected { border-color: rgba(13,148,136,.34); background: rgba(13,148,136,.07); }
.wc-hub-card strong { display: block; color: var(--ink); font-size: .86rem; }
.wc-hub-card span { display: -webkit-box; margin-top: 4px; overflow: hidden; font-size: .74rem; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wc-hub-empty { color: var(--muted); font-size: .84rem; }

.wc-msg { display: flex; gap: 10px; padding: 3px 0; align-items: flex-start; }
.wc-msg.is-user { flex-direction: row-reverse; }
.wc-avatar { width: 34px; height: 34px; margin-top: 3px; display: grid; place-items: center; flex: 0 0 34px; border-radius: 11px; color: #fff; font-size: .75rem; font-weight: 800; }
.wc-avatar.user { background: linear-gradient(135deg, #0d9488, #115e59); }
.wc-avatar.assistant { background: linear-gradient(135deg, #d97706, #b45309); }
.wc-bubble-wrap { min-width: 0; max-width: min(720px, calc(100% - 48px)); display: flex; flex-direction: column; gap: 4px; }
.wc-msg.is-user .wc-bubble-wrap { align-items: flex-end; }
.wc-meta { display: flex; gap: 7px; color: var(--muted); font-size: .68rem; }
.wc-msg.is-user .wc-meta { flex-direction: row-reverse; }
.wc-meta-name { color: var(--ink); font-weight: 700; }
.wc-bubble { max-width: 100%; padding: 12px 15px; border: 1px solid rgba(28,25,23,.08); border-radius: 17px; background: #fff; color: var(--ink); font-size: .9rem; line-height: 1.62; word-break: break-word; white-space: pre-wrap; }
.wc-msg.is-user .wc-bubble { border-radius: 17px 17px 6px 17px; border-color: rgba(13,148,136,.16); background: rgba(13,148,136,.1); color: #115e59; }
.wc-msg.is-assistant .wc-bubble { border-radius: 17px 17px 17px 6px; }
.wc-msg.is-pending { opacity: .72; }
.wc-typing { display: inline-flex; gap: 5px; padding: 12px 15px; }
.wc-typing span { width: 7px; height: 7px; border-radius: 99px; background: var(--accent); animation: wc-dot 1.2s infinite; }
.wc-typing span:nth-child(2) { animation-delay: .18s; }
.wc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes wc-dot { 0%,80%,100% { opacity:.35; transform:scale(.75); } 40% { opacity:1; transform:scale(1); } }

.wc-status-bar { min-height: 22px; padding: 5px 16px 11px; text-align: center; color: var(--muted); font-size: .75rem; font-weight: 600; }
.wc-status-bar.error { color: #b91c1c; }
.wc-status-bar.success { color: #115e59; }

.wc-composer-card { padding: 11px; }
.wc-composer-box { border: 1px solid rgba(28,25,23,.11); border-radius: 16px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.wc-composer-box:focus-within { border-color: rgba(13,148,136,.35); box-shadow: 0 0 0 3px rgba(13,148,136,.09); }
.wc-composer-textarea { width: 100%; min-height: 52px; max-height: 180px; padding: 13px 14px 6px; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; line-height: 1.55; }
.wc-file-list { padding: 10px 12px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.wc-file-chip, .wc-message-file { max-width: 100%; display: inline-flex; align-items: center; gap: 5px; border: 1px solid rgba(13,148,136,.18); border-radius: 8px; background: rgba(13,148,136,.07); color: #115e59; font-size: .7rem; font-weight: 700; }
.wc-file-chip { padding: 5px 6px 5px 8px; }
.wc-file-chip > span { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-file-chip button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #115e59; font-size: 1rem; cursor: pointer; }
.wc-file-chip button:hover { background: rgba(13,148,136,.12); }
.wc-message-files { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.wc-message-file { padding: 4px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-composer-actions { padding: 6px 8px 8px 13px; display: flex; align-items: center; gap: 8px; }
.wc-attach-btn { width: 34px; height: 34px; flex: 0 0 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 1rem; cursor: pointer; }
.wc-attach-btn:hover { background: #f5f2ed; color: var(--ink); }
.wc-attach-btn:disabled { opacity: .4; cursor: default; }
.wc-composer-hint { color: #9a938a; font-size: .68rem; }
.wc-spacer-flex { flex: 1; }
.wc-send-btn { padding: 9px 16px; border-radius: 11px; background: var(--ink); color: #fff; font-size: .8rem; font-weight: 800; }
.wc-send-btn:disabled { opacity: .42; cursor: default; }
.wc-page-shell.is-hub .wc-composer-card { display: none; }

.wc-utility-backdrop { display: none; }
.wc-utility-card { min-height: 0; padding: 14px; display: flex; flex-direction: column; overflow: hidden; }
.wc-utility-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.wc-utility-head h2 { margin: 3px 0 0; font-size: 1rem; }
.wc-utility-close { display: none; width: 30px; height: 30px; border: 0; border-radius: 9px; background: #f5f2ed; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.wc-segmented { margin-top: 13px; padding: 3px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 11px; background: #f5f2ed; }
.wc-segmented button { padding: 8px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: .73rem; font-weight: 700; cursor: pointer; }
.wc-segmented button.is-active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(28,25,23,.07); }
.wc-utility-panel { min-height: 0; margin-top: 10px; overflow-y: auto; }
.wc-panel-help, .wc-empty-sidebar { margin: 2px 1px 9px; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.wc-compact-list, .wc-session-list { display: flex; flex-direction: column; gap: 6px; }
.wc-starter-btn, .wc-session-switch { width: 100%; padding: 9px 10px; border: 1px solid rgba(28,25,23,.08); border-radius: 11px; background: rgba(255,255,255,.8); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.wc-starter-btn { display: flex; align-items: flex-start; gap: 8px; font-size: .76rem; line-height: 1.4; }
.wc-starter-btn::after { content: '→'; margin-left: auto; flex-shrink: 0; color: var(--accent); }
.wc-starter-btn:hover, .wc-session-switch:hover { border-color: rgba(13,148,136,.28); background: rgba(13,148,136,.06); }
.wc-starter-btn:disabled { opacity: .5; cursor: default; }
.wc-session-switch.is-current { border-color: rgba(13,148,136,.34); background: rgba(13,148,136,.09); }
.wc-session-switch-title { display: -webkit-box; overflow: hidden; color: var(--ink); font-size: .76rem; font-weight: 700; line-height: 1.4; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wc-session-switch-meta { display: block; margin-top: 4px; color: var(--muted); font-size: .65rem; }
.wc-history-head { display: flex; align-items: flex-start; gap: 6px; }
.wc-history-head .wc-panel-help { flex: 1; }
.wc-history-head button { padding: 5px 8px; border: 1px solid rgba(13,148,136,.2); border-radius: 8px; background: rgba(13,148,136,.08); color: #115e59; font-size: .68rem; font-weight: 700; cursor: pointer; }

.wc-modal-overlay { position: fixed; inset: 0; z-index: 120; padding: 20px; display: flex; align-items: center; justify-content: center; background: rgba(28,25,23,.34); }
.wc-modal { width: min(520px,100%); max-height: calc(100vh - 40px); padding: 22px; overflow-y: auto; border-radius: 22px; display: flex; flex-direction: column; gap: 15px; }
.wc-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wc-modal-title { margin: 0; font-size: 1.2rem; }
.wc-modal-close { border: 0; background: transparent; color: var(--muted); font-size: 1.35rem; cursor: pointer; }
.wc-pkg-grid { display: flex; flex-direction: column; gap: 8px; }
.wc-pkg-card { width: 100%; padding: 13px 15px; display: flex; justify-content: space-between; gap: 10px; border: 1px solid rgba(28,25,23,.09); border-radius: 14px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.wc-pkg-card.selected { border-color: rgba(13,148,136,.35); background: rgba(13,148,136,.07); }
.wc-pkg-name { font-size: .86rem; font-weight: 800; }
.wc-pkg-desc, .wc-modal-empty { color: var(--muted); font-size: .75rem; }
.wc-pkg-price { color: #9a5b05; font-weight: 800; white-space: nowrap; }
.wc-modal-status { min-height: 18px; margin: 0; color: var(--muted); font-size: .76rem; }
.wc-modal-status.error { color: #b91c1c; }
.wc-modal-status.success { color: #115e59; }
.wc-modal-footer { display: flex; justify-content: flex-end; gap: 8px; }
.wc-modal-btn { padding: 9px 15px; border-radius: 11px; border-color: rgba(28,25,23,.1); background: #fff; color: var(--ink); font-size: .78rem; font-weight: 700; }
.wc-modal-btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.wc-modal-btn:disabled { opacity: .45; cursor: default; }

@media (max-width: 1080px) {
  .wc-chat-header { flex-wrap: wrap; }
  .wc-chat-heading { max-width: none; flex: 1; }
  .wc-chatbot-picker { order: 3; width: min(420px, 100%); }
}

@media (max-width: 980px) {
  .wc-chat-layout { grid-template-columns: 1fr; }
  .wc-utility-card { position: fixed; top: 14px; right: 14px; bottom: 14px; z-index: 100; width: min(88vw, 330px); transform: translateX(115%); transition: transform .2s ease; box-shadow: 0 24px 60px rgba(28,25,23,.18); }
  body.wc-utility-open { overflow: hidden; }
  body.wc-utility-open .wc-utility-card { transform: translateX(0); }
  .wc-utility-close { display: block; }
  .wc-utility-backdrop { position: fixed; inset: 0; z-index: 90; border: 0; background: rgba(28,25,23,.28); }
  body.wc-utility-open .wc-utility-backdrop { display: block; }
}

@media (max-width: 768px) {
  .wc-host-page .web-content { padding: 12px 12px 20px; }
  .wc-page-shell { height: auto; min-height: calc(100vh - 94px); }
  .wc-header-actions { width: 100%; margin-left: 0; justify-content: flex-start; overflow-x: auto; }
  .wc-chatbot-picker { width: 100%; }
  .wc-chatbot-popover { width: 100%; }
  .wc-chat-card { min-height: 54vh; }
}

@media (max-width: 560px) {
  .wc-chat-header, .wc-chat-card, .wc-composer-card, .wc-utility-card { border-radius: 16px; }
  .wc-chat-heading { min-width: 0; width: 100%; flex-basis: 100%; }
  .wc-header-actions { flex-wrap: wrap; }
  .wc-pill { max-width: 100%; }
  .wc-hub-grid { grid-template-columns: 1fr; }
  .wc-thread-inner { width: calc(100% - 20px); }
  .wc-welcome, .wc-hub-state { padding: 28px 8px; }
  .wc-avatar { display: none; }
  .wc-bubble-wrap { max-width: 92%; }
  .wc-composer-hint { display: none; }
}
