/* Team inbox mock-up. Shared tokens and the font come from /assets/site.css. */

:root {
  --emerald:    #39D08A;
  --capri-tint: #F0F9FF;
  --border:     #E5E7EB;
  --chat-bg:    #EEF2F6;
  --bot:        #E4EEF8;
  --mine:       #D9F4E6;
  --amber-bg:   #FEF3C7;
  --amber:      #92400E;
  --red-bg:     #FEE2E2;
  --red:        #B91C1C;
  --green-bg:   #DCFCE7;
  --green:      #166534;
}

body.app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Top bar */

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--oxford);
  color: var(--white);
}

.app-bar-left,
.app-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-name {
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 600;
  white-space: nowrap;
}

.app-user-text {
  font-size: 13px;
  white-space: nowrap;
}

.waiting-count {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 203, 120, 0.16);
  color: #FFCB78;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--capri-tint);
  color: var(--sky);
  font-size: 13px;
  font-weight: 700;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  background: rgba(19, 178, 247, 0.18);
  color: var(--blizzard);
  font-size: 12px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 20px;
}

/* Layout: list | thread. Member details slide in on request. */

.inbox {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
}

.pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
}

.pane-list { border-right: 1px solid var(--border); }

.pane-head { padding: 16px 16px 4px; }

.pane-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

/* Conversation list */

.conv-list {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 0 8px 16px;
  list-style: none;
}

.group-label {
  padding: 14px 8px 6px;
  color: var(--gray-mid);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.group-label span {
  margin-left: 4px;
  color: var(--oxford);
}

.conv {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.conv:hover { background: var(--off-white); }

.conv.is-active {
  background: var(--capri-tint);
  box-shadow: inset 3px 0 0 var(--sky);
}

.conv-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.conv-name {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-preview {
  min-width: 0;
  overflow: hidden;
  color: var(--gray-mid);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip,
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.chip { padding: 3px 9px; }
.pill { padding: 2px 8px; }

.chip-wait,
.pill-new    { background: var(--amber-bg); color: var(--amber); }
.chip-late   { background: var(--red-bg); color: var(--red); }
.chip-ok,
.pill-ok     { background: var(--green-bg); color: var(--green); }
.chip-muted  { background: #F3F4F6; color: var(--gray-mid); }
.pill-muted  { background: #F3F4F6; color: var(--gray-dark); }
.pill-member { background: var(--capri-tint); color: var(--sky); }

/* Thread */

.pane-thread { background: var(--chat-bg); }

.thread-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.who {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.who:hover { background: var(--off-white); }

.who-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.who-text b { font-size: 15px; }

.who-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.thread-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--oxford);
  border-radius: 999px;
  background: var(--oxford);
  color: var(--white);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.btn-quiet {
  border-color: var(--border);
  background: var(--white);
  color: var(--oxford);
}

.btn-quiet:hover { border-color: var(--oxford); }

.btn-send {
  padding: 11px 20px;
  border-color: var(--emerald);
  background: var(--emerald);
  color: var(--oxford);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--white);
  color: var(--oxford);
  font: inherit;
  font-size: 18px;
  cursor: pointer;
}

.back { display: none; }

.more { position: relative; }

.more summary {
  list-style: none;
  line-height: 1;
}

.more summary::-webkit-details-marker { display: none; }

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 12px 32px rgba(4, 23, 46, 0.16);
}

.menu-label {
  margin: 4px 8px 6px;
  color: var(--gray-mid);
  font-size: 12px;
}

.menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--oxford);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.menu button:hover { background: var(--off-white); }

.thread-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px clamp(12px, 3vw, 32px) 24px;
}

.channel-note {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(4, 23, 46, 0.06);
  color: var(--gray-dark);
  font-size: 12px;
  text-align: center;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The assistant's part, folded into one line */
.earlier {
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 10px;
  max-width: 100%;
  margin-bottom: 4px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(4, 23, 46, 0.06);
  color: var(--gray-dark);
  font-size: 12px;
}

.day {
  align-self: center;
  margin: 10px 0 4px;
  color: var(--gray-mid);
  font-size: 12px;
  font-weight: 700;
}

.day span {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--white);
}

.event {
  align-self: center;
  color: var(--gray-dark);
  font-size: 12px;
  text-align: center;
}

.event span {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(57, 208, 138, 0.16);
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: min(78%, 540px);
}

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

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

.bubble {
  padding: 8px 12px;
  border-radius: 14px;
  box-shadow: 0 1px 1px rgba(4, 23, 46, 0.08);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.in .bubble {
  border-top-left-radius: 4px;
  background: var(--white);
}

.from-bot .bubble {
  border-top-right-radius: 4px;
  background: var(--bot);
}

.from-manager .bubble {
  border-top-right-radius: 4px;
  background: var(--mine);
}

.msg-meta {
  display: flex;
  gap: 6px;
  margin-top: 2px;
  padding: 0 4px;
  color: var(--gray-mid);
  font-size: 11px;
}

.who-label {
  color: var(--gray-dark);
  font-weight: 700;
}

.ticks {
  color: var(--sky);
  font-weight: 700;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.options span {
  padding: 4px 10px;
  border: 1px solid rgba(0, 119, 182, 0.35);
  border-radius: 999px;
  background: var(--white);
  color: var(--sky);
  font-size: 12px;
  font-weight: 600;
}

.tapped { font-weight: 600; }
.locked { color: var(--gray-dark); }

.voice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.voice-bar {
  width: 72px;
  height: 14px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--sky) 0 2px, transparent 2px 5px);
  opacity: 0.5;
}

.transcript {
  display: block;
  margin-top: 6px;
  color: var(--gray-dark);
  font-style: italic;
}

.form-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
}

.form-fields {
  display: grid;
  gap: 2px;
  margin: 0;
  font-size: 13px;
}

.form-fields div {
  display: flex;
  gap: 8px;
}

.form-fields dt {
  min-width: 104px;
  color: var(--gray-mid);
}

.form-fields dd {
  margin: 0;
  font-weight: 600;
}

.tpl-tag {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* The handover: where the assistant stops and the manager starts */

.handover {
  position: relative;
  margin: 24px 0 8px;
  padding: 22px 16px 14px;
  border: 2px solid var(--emerald);
  border-radius: 14px;
  background: var(--white);
  text-align: center;
}

.handover-label {
  position: absolute;
  top: 0;
  left: 50%;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--oxford);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.handover blockquote {
  max-width: 46ch;
  margin: 0 auto 6px;
  color: var(--oxford);
  font-size: 15px;
  font-weight: 700;
}

.handover p {
  margin: 0;
  color: var(--gray-mid);
  font-size: 12px;
}

/* Composer */

.composer {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
  background: var(--white);
}

.window {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.window .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.window-open { color: var(--green); }
.window-open .dot { background: var(--emerald); }
.window-soon { color: var(--amber); }
.window-soon .dot { background: #F59E0B; }
.window-closed { color: var(--red); }
.window-closed .dot { background: var(--red); }

.compose {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.compose textarea {
  flex: 1;
  min-height: 46px;
  max-height: 160px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--oxford);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}

.compose textarea:focus {
  border-color: transparent;
  outline: 2px solid var(--capri);
  outline-offset: 0;
}

.composer-note {
  margin: 0 0 10px;
  color: var(--gray-dark);
  font-size: 13px;
}

.composer-done .composer-note { margin: 0; }

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

.template {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--off-white);
  color: var(--oxford);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.template:hover {
  border-color: var(--sky);
  background: var(--capri-tint);
}

.template b { font-size: 14px; }

.template span {
  overflow: hidden;
  color: var(--gray-mid);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 12px;
}

.demo-badge {
  padding: 2px 8px;
  border-radius: 6px;
  background: #EDE9FE;
  color: #5B21B6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--sky);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Member details: a drawer from the right */

.pane-info {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  width: min(360px, 100%);
  overflow-y: auto;
  padding: 24px 20px;
  box-shadow: -12px 0 32px rgba(4, 23, 46, 0.18);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s var(--ease-out), visibility 0s 0.3s;
}

.show-info .pane-info {
  transform: none;
  visibility: visible;
  transition: transform 0.3s var(--ease-out);
}

.info-backdrop { display: none; }

.show-info .info-backdrop {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: block;
  background: rgba(4, 23, 46, 0.35);
}

.info-head {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 16px;
  text-align: center;
}

.info-head h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.info-close {
  position: absolute;
  top: -8px;
  right: -4px;
}

.facts {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.facts dt { color: var(--gray-mid); }

.facts dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.info-block {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.info-block h3 {
  margin: 0 0 8px;
  color: var(--gray-mid);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.info-block p {
  margin: 0;
  color: var(--gray-dark);
  font-size: 13px;
}

.info-block .muted {
  color: var(--gray-mid);
  font-size: 12px;
}

.info-block .total {
  margin: 6px 0 8px;
  color: var(--oxford);
  font-size: 22px;
  font-weight: 800;
}

.pots,
.history {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.pots { gap: 6px; }

.pots li {
  display: flex;
  justify-content: space-between;
}

.history { gap: 8px; }

.history li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
}

.h-date { color: var(--gray-mid); }

.toast {
  position: fixed;
  top: 64px;
  left: 50%;
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--oxford);
  box-shadow: 0 12px 32px rgba(4, 23, 46, 0.25);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 0.25s, transform 0.25s var(--ease-out);
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  padding: 24px;
  text-align: center;
}

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

/* Phones: the list first, then the conversation on its own screen. */
@media (max-width: 820px) {
  .app-bar { padding: 10px 16px; }
  .app-user-text { display: none; }
  .app-bar-left,
  .app-user { gap: 8px; }
  .app-bar .wordmark { white-space: nowrap; }
  .app-name { padding-left: 8px; }

  .inbox { grid-template-columns: 1fr; }
  .pane-thread { display: none; }
  .show-thread .pane-list { display: none; }
  .show-thread .pane-thread { display: flex; }

  .back { display: grid; }
  .thread-head { padding: 8px 12px; }
  .thread-actions {
    justify-content: flex-end;
    width: 100%;
  }

  .msg { max-width: 88%; }
  .composer { padding: 10px 12px 12px; }
}

@media (max-width: 420px) {
  .app-bar .avatar-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pane-info,
  .show-info .pane-info,
  .toast { transition: none; }
}
