/* Agent dashboard: three-pane shell on real API data. */

body.dash {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

@media (max-width: 900px) {
  body.dash {
    grid-template-columns: minmax(0, 1fr);
  }
}

.side {
  border-right: 1px solid var(--hairline);
  background: rgba(10, 14, 22, 0.6);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  max-height: 100vh;
}

@media (max-width: 900px) {
  .side {
    position: static;
    max-height: none;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
  }
}

.side-head {
  padding: 0.85rem 0.85rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.side-section {
  padding: 0.5rem 0.65rem;
}

.side-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ghost);
  padding: 0.4rem 0.4rem 0.3rem;
}

.workspace-switch {
  width: 100%;
  font-size: 13px;
  padding: 0.45rem 0.55rem;
  background: rgba(17, 24, 39, 0.9);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.nav-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.42rem 0.5rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13.5px;
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
}

.nav-list a.active {
  background: var(--indigo-soft);
  color: #e0e7ff;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.28);
}

.nav-list .count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ghost);
}

.side-foot {
  margin-top: auto;
  padding: 0.75rem;
  border-top: 1px solid var(--hairline);
  display: grid;
  gap: 0.5rem;
}

.who {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.who div {
  min-width: 0;
}

.who strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who span {
  display: block;
  font-size: 11.5px;
  color: var(--ghost);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* main column */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 15;
  background: rgba(11, 15, 23, 0.86);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  font-size: 17px;
  letter-spacing: -0.015em;
  font-weight: 500;
}

.topbar .crumbs {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.view {
  padding: 1.4rem;
  display: grid;
  gap: 1rem;
  align-content: start;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.stat {
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: rgba(17, 24, 39, 0.55);
}

.stat .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghost);
}

.stat .v {
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-top: 0.15rem;
}

.stat .v small {
  font-size: 12px;
  color: var(--ghost);
  margin-left: 0.35rem;
  letter-spacing: 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

.empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius);
  background: rgba(17, 24, 39, 0.35);
}

.empty .glyph {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.85rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--indigo-soft);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
}

.empty h3 {
  margin-bottom: 0.35rem;
}

.empty p {
  color: var(--muted);
  font-size: 13.5px;
  max-width: 34rem;
  margin: 0 auto;
}

.empty p + p {
  margin-top: 0.6rem;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.between {
  justify-content: space-between;
}

.grid-2 {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.code-block {
  position: relative;
  background: #0a0e16;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  color: #a5b4fc;
  overflow-x: auto;
  white-space: pre;
}

.copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--hairline-strong);
  border-radius: 5px;
  padding: 2px 6px;
  cursor: pointer;
}

.copy:hover {
  color: var(--text);
}

.kv-list {
  display: grid;
  gap: 0.4rem;
  font-size: 13px;
}

.kv-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.kv-list > div:last-child {
  border-bottom: 0;
}

.kv-list dt {
  color: var(--ghost);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kv-list dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13.5px;
  color: var(--muted);
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--indigo);
}

.skeleton {
  color: var(--ghost);
  font-family: var(--mono);
  font-size: 12px;
  padding: 1rem 0;
}

.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ------------------------------------------------------------- inbox list */

.filter {
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
}

.filter:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.filter.on {
  color: #e0e7ff;
  background: var(--indigo-soft);
  border-color: rgba(99, 102, 241, 0.4);
}

.conv-list {
  display: grid;
  gap: 2px;
}

.conv {
  display: flex;
  gap: 0.7rem;
  padding: 0.65rem 0.5rem;
  border-radius: 6px;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.conv:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.035);
}

.conv-main {
  display: grid;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.conv-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.conv-top strong {
  font-weight: 500;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-preview {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-tags {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

/* ----------------------------------------------------------------- thread */

.thread-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .thread-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.thread {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  min-height: min(70vh, 640px);
}

.thread-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--hairline);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 52vh;
}

.msg {
  max-width: 76%;
  display: grid;
  gap: 0.2rem;
}

.msg.in {
  align-self: flex-start;
}

.msg.out {
  align-self: flex-end;
  justify-items: end;
}

.msg-body {
  padding: 0.5rem 0.7rem;
  border-radius: 8px 8px 8px 2px;
  background: var(--surface-raised);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.out .msg-body {
  border-radius: 8px 8px 2px 8px;
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.35);
}

.msg-meta {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ghost);
}

.composer {
  border-top: 1px solid var(--hairline);
  padding: 0.75rem;
  display: grid;
  gap: 0.5rem;
  background: rgba(10, 14, 22, 0.5);
}

.composer textarea {
  min-height: 58px;
  border-color: var(--hairline);
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.composer-bar select {
  width: auto;
  max-width: 210px;
  font-size: 12px;
  padding: 0.3rem 0.5rem;
}

.attach-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--hairline);
  color: var(--muted, #9aa4b2);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.attach-button:hover,
.attach-button:focus-within {
  border-color: rgba(99, 102, 241, 0.5);
  color: #c7d2fe;
}

.attach-button input:disabled + svg {
  opacity: 0.4;
}

.attachments {
  display: grid;
  gap: 0.35rem;
  max-width: 320px;
}

.attach-image {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 0;
}

.attach-image img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.attach-file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--surface-raised);
  font-size: 12.5px;
  text-decoration: none;
  color: inherit;
}

.attach-file:hover {
  border-color: rgba(99, 102, 241, 0.45);
}

.attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-size {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ghost);
}

.visitor-card {
  position: sticky;
  top: 76px;
}
