/* SolidifAi console - Console Assistant chat.
   Header launcher, right-hand drawer (full width at <=768px) and the full-page
   chat on assistant.html. Loaded on every console page through _shared_head.html;
   behaviour in console-assistant.js (loaded through _shared_nav.html). */

.cdp-asst-launch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  margin-left: auto;
  border: 1px solid var(--cdp-primary);
  border-radius: 999px;
  background: var(--cdp-surface);
  color: var(--cdp-primary);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.cdp-asst-launch[hidden] { display: none; }
.cdp-asst-launch::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.cdp-asst-launch:hover,
.cdp-asst-launch:focus-visible,
.cdp-asst-launch[aria-expanded="true"] { background: var(--cdp-primary); color: #fff; }

/* Drawer */
.cdp-asst-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  width: 420px;
  max-width: 100%;
  display: none;
  flex-direction: column;
  background: var(--cdp-surface);
  border-left: 1px solid var(--cdp-border);
  box-shadow: -12px 0 40px rgba(15, 23, 42, .18);
}
.cdp-asst-drawer.is-open { display: flex; }
.cdp-asst-drawer__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--cdp-border);
  flex-wrap: wrap;
}
.cdp-asst-drawer__title { margin: 0; font-size: 17px; font-weight: 700; margin-right: auto; }
.cdp-asst-drawer__tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cdp-asst-iconbtn,
.cdp-asst-linkbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--cdp-border);
  border-radius: var(--cdp-radius);
  background: var(--cdp-surface);
  color: var(--cdp-text);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.cdp-asst-iconbtn { min-width: 40px; font-size: 20px; line-height: 1; }
.cdp-asst-iconbtn:hover,
.cdp-asst-linkbtn:hover,
.cdp-asst-iconbtn:focus-visible,
.cdp-asst-linkbtn:focus-visible { background: var(--cdp-bg); }

/* Chat (shared by drawer and full page) */
.cdp-asst-chat { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.cdp-asst-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--cdp-bg);
}
.cdp-asst-empty { color: var(--cdp-muted); font-size: 15px; margin: auto 0; text-align: center; padding: 16px; }
.cdp-asst-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.45;
}
.cdp-asst-msg--user { align-self: flex-end; background: var(--cdp-primary); color: #fff; border-bottom-right-radius: 4px; }
.cdp-asst-msg--assistant { align-self: flex-start; background: var(--cdp-surface); border: 1px solid var(--cdp-border); border-bottom-left-radius: 4px; }
.cdp-asst-msg--pending { color: var(--cdp-muted); font-style: italic; }

.cdp-asst-card {
  align-self: stretch;
  border: 1px solid var(--cdp-border);
  border-left: 4px solid #f0a33a;
  border-radius: var(--cdp-radius);
  background: var(--cdp-surface);
  padding: 10px 12px;
  font-size: 15px;
}
.cdp-asst-card--applied { border-left-color: #16a34a; }
.cdp-asst-card--rejected,
.cdp-asst-card--canceled { border-left-color: var(--cdp-disabled); }
.cdp-asst-card--failed,
.cdp-asst-card--error { border-left-color: #b91c1c; }
.cdp-asst-card__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.cdp-asst-card__kind { font-weight: 700; }
.cdp-asst-card__status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--cdp-bg);
  border: 1px solid var(--cdp-border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cdp-asst-card__summary { margin: 0 0 6px; overflow-wrap: anywhere; }
.cdp-asst-card__fields {
  display: grid;
  grid-template-columns: minmax(90px, max-content) 1fr;
  gap: 2px 10px;
  margin: 0 0 8px;
  font-size: 14px;
}
.cdp-asst-card__fields dt { color: var(--cdp-muted); }
.cdp-asst-card__fields dd { margin: 0; overflow-wrap: anywhere; }
.cdp-asst-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cdp-asst-card__actions .cdp-btn { min-height: 40px; }
.cdp-asst-card__outcome { margin: 4px 0 0; font-size: 14px; color: var(--cdp-muted); overflow-wrap: anywhere; }
.cdp-asst-card__key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.cdp-asst-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--cdp-border);
  background: var(--cdp-surface);
}
.cdp-asst-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 12px;
  border: 1px solid var(--cdp-border);
  border-radius: var(--cdp-radius);
  font: inherit;
  font-size: 16px;
  resize: vertical;
}
.cdp-asst-input:focus { outline: 2px solid var(--cdp-primary); outline-offset: 0; border-color: var(--cdp-primary); }
.cdp-asst-form .cdp-btn[disabled] { background: var(--cdp-disabled); cursor: not-allowed; }
.cdp-asst-status { margin: 0; padding: 0 12px 8px; min-height: 0; font-size: 14px; color: var(--cdp-muted); background: var(--cdp-surface); }
.cdp-asst-status:empty { display: none; }
.cdp-asst-hint { padding: 0 12px 8px; margin: 0; font-size: 12px; color: var(--cdp-muted); background: var(--cdp-surface); }

/* Full page (assistant.html) */
.cdp-asst-page {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  margin: 16px 0 24px;
}
.cdp-asst-convs {
  border: 1px solid var(--cdp-border);
  border-radius: var(--cdp-radius);
  background: var(--cdp-surface);
  padding: 8px;
  max-height: 640px;
  overflow-y: auto;
}
.cdp-asst-convs__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 8px; }
.cdp-asst-convs__head h2 { margin: 0; font-size: 16px; }
.cdp-asst-convs__list { list-style: none; margin: 0; padding: 0; }
.cdp-asst-conv {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin: 0 0 4px;
  border: 1px solid transparent;
  border-radius: var(--cdp-radius);
  background: none;
  color: var(--cdp-text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.cdp-asst-conv:hover,
.cdp-asst-conv:focus-visible { background: var(--cdp-bg); }
.cdp-asst-conv[aria-current="true"] { border-color: var(--cdp-primary); background: #eff6ff; }
.cdp-asst-conv__title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdp-asst-conv__meta { display: block; font-size: 12px; color: var(--cdp-muted); }
.cdp-asst-pagechat {
  display: flex;
  flex-direction: column;
  height: 640px;
  border: 1px solid var(--cdp-border);
  border-radius: var(--cdp-radius);
  overflow: hidden;
  background: var(--cdp-surface);
}
.cdp-asst-pagechat .cdp-asst-drawer__head { border-bottom: 1px solid var(--cdp-border); }
.cdp-asst-runlog-h { margin: 8px 0 12px; font-size: 18px; }

@media (max-width: 768px) {
  .cdp-asst-launch { min-height: 44px; }
  .cdp-asst-launch + .cdp-nav__toggle { margin-left: 0; }
  .cdp-asst-drawer { width: 100%; border-left: 0; box-shadow: none; }
  .cdp-asst-page { grid-template-columns: minmax(0, 1fr); }
  .cdp-asst-convs { max-height: 220px; }
  .cdp-asst-pagechat { height: 560px; }
}
@media (max-width: 480px) {
  .cdp-asst-launch { padding: 0 10px; }
  .cdp-asst-msg { max-width: 94%; }
  .cdp-asst-card__fields { grid-template-columns: minmax(0, 1fr); }
  .cdp-asst-card__fields dd { margin-bottom: 4px; }
}
