:root{
  --tp-agent-user: rgba(124,92,255,.3);
  --tp-agent-bot: rgba(255,255,255,.08);
  --tp-agent-border: rgba(255,255,255,.12);
}

#tpAgentLoading .tp-loading-card{
  animation: tp-agent-loading-pop .22s ease-out;
}

#tpAgentLoading .tp-progress{
  display: none;
}

@keyframes tp-agent-loading-pop{
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#tpAgentLoading.tp-agent-loading--hero .tp-loading-grid{
  display: grid;
}

.tp-agent-loading-hero{
  position: relative;
  height: 220px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
}

#tpAgentLoading.tp-agent-loading--hero .tp-agent-loading-hero{
  height: min(60vh, 520px);
}

.tp-agent-loading-hero-slide{
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity .9s ease;
  filter: saturate(1.05) contrast(1.02);
}

.tp-agent-loading-hero-slide.is-active{
  opacity: 1;
  animation: tp-agent-ken-burns 7s ease-in-out forwards;
}

@keyframes tp-agent-ken-burns{
  from { transform: scale(1.02); }
  to { transform: scale(1.08); }
}

.tp-agent-loading-hero-ui{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,.10) 0%,
    rgba(0,0,0,.45) 55%,
    rgba(0,0,0,.68) 100%
  );
}

#tpAgentLoading .tp-loading-text{
  margin: 0;
}

#tpAgentLoading .tp-loading-tagline{
  margin: 0;
}

@media (max-width: 560px){
  .tp-agent-loading-hero{
    height: 200px;
  }
  #tpAgentLoading.tp-agent-loading--hero .tp-agent-loading-hero{
    height: min(52vh, 420px);
  }
}

@media (prefers-reduced-motion: reduce){
  #tpAgentLoading .tp-loading-card{
    animation: none;
  }
  .tp-agent-loading-hero-slide{
    transition: none;
  }
  .tp-agent-loading-hero-slide.is-active{
    animation: none;
  }
}

.tp-agent{
  margin-top: 26px;
}

.tp-agent-toggle{
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.tp-agent-toggle-button{
  min-width: 160px;
}

.tp-agent-toggle-button.is-active{
  background: linear-gradient(135deg, var(--tp-accent), var(--tp-accent2));
  color: #0b1024;
  border: 0;
  box-shadow: 0 12px 30px rgba(124,92,255,.20);
}

.tp-agent-shell{
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
}

.tp-agent-banner{
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(46,233,166,.14);
  border: 1px solid rgba(46,233,166,.5);
  color: var(--tp-text);
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
}

.tp-agent-banner.is-visible{
  opacity: 1;
  transform: translateY(0);
}

.tp-agent-banner-error{
  background: rgba(255,107,107,.12);
  border-color: rgba(255,107,107,.6);
}

.tp-agent-messages{
  min-height: 280px;
  max-height: 58vh;
  overflow-y: auto;
  padding: 18px;
  background: rgba(7,10,20,.55);
  border: 1px solid var(--tp-agent-border);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tp-agent-highlights{
  border: 1px solid var(--tp-agent-border);
  border-radius: 16px;
  padding: 16px;
  background: rgba(7,10,20,.55);
}

.tp-agent-dates{
  border: 1px solid var(--tp-agent-border);
  border-radius: 16px;
  padding: 16px;
  background: rgba(7,10,20,.55);
}

.tp-agent-dates-head h3{
  margin: 0;
  font-size: 18px;
}

.tp-agent-dates-head p{
  margin: 6px 0 0;
  color: var(--tp-muted);
}

.tp-agent-date-fields{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.tp-agent-date-field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--tp-muted);
  font-size: 13px;
  font-weight: 600;
}

.tp-agent-date-input{
  background: rgba(10,14,30,.85);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--tp-text);
  font-size: 14px;
}

.tp-agent-date-input:focus{
  outline: none;
  border-color: rgba(46,233,166,.6);
  box-shadow: 0 0 0 2px rgba(46,233,166,.18);
}

.tp-agent-dates-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.tp-agent-map{
  margin-top: 12px;
  margin-bottom: 12px;
}

.tp-agent-map-controls{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tp-agent-map-meta{
  color: var(--tp-muted);
  font-size: 13px;
}

.tp-agent-map-wrap{
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(7,10,20,.6);
}

.tp-agent-map-canvas{
  width: 100%;
  height: 260px;
}

.tp-agent-map-status{
  padding: 10px 12px;
  color: var(--tp-muted);
  font-size: 13px;
}

.tp-agent-map-status.tp-error{
  color: var(--tp-danger);
}

.tp-agent-highlights-head h3{
  margin: 0;
  font-size: 18px;
}

.tp-agent-highlights-head p{
  margin: 6px 0 0;
  color: var(--tp-muted);
}

.tp-agent-highlights-grid{
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.tp-agent-highlight-card{
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.04);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}

.tp-agent-highlight-tags{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tp-agent-highlight-tag{
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.2);
  color: var(--tp-text);
  background: rgba(255,255,255,.08);
}

.tp-agent-highlight-tag--bucket{
  border-color: rgba(255,170,80,.7);
  color: #ffba7a;
  background: rgba(255,170,80,.15);
}

.tp-agent-highlight-thumb{
  width: 100%;
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  margin-bottom: 10px;
}

.tp-agent-highlight-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tp-agent-highlight-card:hover{
  border-color: rgba(46,233,166,.5);
  transform: translateY(-2px);
}

.tp-agent-highlight-card.is-selected{
  border-color: rgba(46,233,166,.9);
  box-shadow: 0 0 0 2px rgba(46,233,166,.2);
}

.tp-agent-highlight-title{
  font-weight: 700;
  margin-bottom: 6px;
}

.tp-agent-highlight-meta{
  font-size: 13px;
  color: var(--tp-muted);
  margin-bottom: 8px;
}

.tp-agent-highlight-summary{
  font-size: 14px;
  color: var(--tp-text);
}

.tp-agent-highlights-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.tp-agent-bubble{
  max-width: min(76%, 640px);
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 15px;
  white-space: pre-wrap;
  border: 1px solid transparent;
}

.tp-agent-link{
  color: var(--tp-accent2);
  font-weight: 650;
}

.tp-agent-bubble.assistant{
  background: var(--tp-agent-bot);
  border-color: rgba(255,255,255,.12);
  align-self: flex-start;
}

.tp-agent-bubble.user{
  background: var(--tp-agent-user);
  border-color: rgba(124,92,255,.45);
  align-self: flex-end;
  text-align: left;
}

.tp-agent-form{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tp-agent-label{
  font-weight: 650;
  color: var(--tp-muted);
}

.tp-agent-input{
  background: rgba(10,14,30,.8);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--tp-text);
  font-size: 15px;
  resize: vertical;
  min-height: 90px;
}

.tp-agent-input:focus{
  outline: none;
  border-color: rgba(46,233,166,.6);
  box-shadow: 0 0 0 2px rgba(46,233,166,.18);
}

.tp-agent-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.tp-agent-actions-left{
  display: flex;
  align-items: center;
  gap: 12px;
}

.tp-button-ghost{
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.04);
  color: var(--tp-text);
}

.tp-button-ghost.is-active{
  border-color: rgba(46,233,166,.6);
  box-shadow: 0 0 0 2px rgba(46,233,166,.18);
}

.tp-button-ghost.is-listening{
  border-color: rgba(46,233,166,.6);
  box-shadow: 0 0 0 2px rgba(46,233,166,.18);
}

.tp-agent-actions-right{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--tp-muted);
}

.tp-agent-model-label{
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tp-agent-model-option{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
  cursor: pointer;
  color: var(--tp-text);
  font-size: 14px;
}

.tp-agent-model-option input{
  accent-color: var(--tp-accent2);
}

.tp-agent-model-select{
  display: inline-flex;
  align-items: center;
}

.tp-agent-select{
  background: rgba(10,14,30,.8);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  color: var(--tp-text);
  padding: 6px 12px;
  font-size: 13px;
}

.tp-agent-select:disabled{
  opacity: 0.6;
  cursor: not-allowed;
}

.tp-agent-status{
  min-height: 18px;
  color: var(--tp-muted);
}

.tp-agent-status.tp-error{
  color: var(--tp-danger);
}

.tp-agent-profile-picker{
  margin-top: 14px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  display: grid;
  gap: 10px;
}

.tp-agent-profile-toggle{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.tp-agent-profile-toggle input{
  width: 18px;
  height: 18px;
}

.tp-label--inline{
  margin: 0;
}

.tp-agent-profile-controls{
  display: grid;
  gap: 8px;
  align-items: start;
}

@media (max-width: 768px){
  .tp-agent-messages{
    max-height: none;
  }
  .tp-agent-bubble{
    max-width: 100%;
  }
  .tp-agent-toggle{
    flex-direction: column;
  }
  .tp-agent-toggle-button{
    width: 100%;
  }
  .tp-agent-actions{
    flex-direction: column;
    align-items: stretch;
  }
  .tp-agent-actions-left,
  .tp-agent-actions-right{
    justify-content: center;
  }
  .tp-agent-highlights-actions{
    flex-direction: column;
    align-items: stretch;
  }
}
