#riftex-agent {
  --agent-ink: #060b0e;
  --agent-cyan: #81d6e3;
  --agent-border: #28515a;
  --agent-text: #edf6f8;
  position: fixed;
  z-index: 210;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  font: 14px/1.45 system-ui, sans-serif;
  color: var(--agent-text);
}
#riftex-agent [hidden] { display: none !important; }
#riftex-agent button {
  cursor: pointer;
  border: 1px solid var(--agent-border);
  border-radius: 7px;
  background: #0b171b;
  color: var(--agent-text);
  font: inherit;
}
#riftex-agent button:focus-visible, #riftex-agent textarea:focus-visible { outline: 2px solid var(--agent-cyan); outline-offset: 2px; }
#riftex-agent .riftex-agent-launch {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 8px;
  min-height: 44px;
  padding: 0 13px;
  box-shadow: 0 8px 28px #0008;
  font-weight: 650;
}
#riftex-agent img { flex: none; width: 19px; height: 24px; }
#riftex-agent-panel {
  box-sizing: border-box;
  position: absolute;
  right: 0;
  bottom: 54px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(400px, calc(100vw - 32px));
  height: min(520px, calc(100dvh - 84px));
  overflow: hidden;
  border: 1px solid var(--agent-border);
  border-radius: 10px;
  background: var(--agent-ink);
  box-shadow: 0 14px 55px #000b;
}
.riftex-agent-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #193842;
  background: #0b151a;
}
.riftex-agent-heading h2 { padding: 0; margin: 0; color: inherit; font: 650 15px/1.3 system-ui, sans-serif; }
.riftex-agent-heading span { color: #a9c1c7; font-size: 11px; }
#riftex-agent .riftex-agent-close { margin-left: auto; width: 34px; height: 34px; font-size: 20px; }
.riftex-agent-log { display: flex; flex-direction: column; gap: 10px; overflow: auto; padding: 14px; }
.riftex-agent-log p { margin: 0; align-self: flex-start; padding: 9px 11px; border-radius: 7px; background: #102027; overflow-wrap: anywhere; white-space: pre-wrap; }
.riftex-agent-log p[data-role="user"] { align-self: flex-end; max-width: 88%; background: #15363d; }
#riftex-agent form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 0; padding: 12px; border-top: 1px solid #193842; }
#riftex-agent textarea { min-width: 0; padding: 8px; resize: vertical; max-height: 120px; border: 1px solid var(--agent-border); border-radius: 6px; background: #0c1619; color: inherit; font: inherit; }
#riftex-agent [type="submit"] { align-self: end; padding: 8px 12px; background: var(--agent-cyan); color: #071217; font-weight: 650; }
#riftex-agent [type="submit"]:disabled { opacity: .55; cursor: wait; }
#riftex-agent [role="status"] { grid-column: 1 / -1; margin: 0; font-size: 12px; color: #a9c1c7; }
#riftex-agent [role="status"]:empty { display: none; }
.riftex-agent-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 767px) {
  #riftex-agent[data-terminal] { bottom: calc(68px + env(safe-area-inset-bottom)); }
  #riftex-agent[data-terminal] #riftex-agent-panel { height: min(520px, calc(100dvh - 142px)); }
}
