/* Jolu Chat Redesign — handoff de claude.ai/design 2026-04-18.
 * Escopo: classes `.app`, `.rail`, `.inbox`, `.thread`, `.sidecar`,
 * `.conv*`, `.bubble`, `.msg-row`, `.composer*`, `.copilot*`, etc.
 * Essas classes NÃO existem em outras telas — aplicação só se manifesta
 * dentro do componente JoluChatDesktopRedesign (que as emite).
 *
 * Globals (html/body/#root) do design original foram removidos pra não
 * quebrar outras páginas. Layout usa .app como flex container próprio.
 */

/* ── Shell ─────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
}

/* Left global rail (modules) */
.rail {
  background: var(--md-sys-color-surface-container-low);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 4px;
}
.rail__logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  display: grid; place-items: center;
  font-family: var(--md-ref-typeface-brand);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.rail__btn {
  width: 48px; height: 40px;
  border-radius: 20px;
  border: 0; background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  display: grid; place-items: center;
  cursor: pointer;
  position: relative;
  transition: background 150ms, color 150ms;
}
.rail__btn:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); color: var(--md-sys-color-on-surface); }
.rail__btn--active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.rail__btn--active::before {
  content: '';
  position: absolute;
  left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: var(--md-sys-color-primary);
}
.rail__spacer { flex: 1; }
.rail__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  display: grid; place-items: center;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  border: 2px solid var(--md-sys-color-surface-container-low);
}

/* Workspace (everything after rail) */
.workspace {
  display: grid;
  grid-template-columns: var(--inbox-w, 360px) 1fr var(--sidecar-w, 0px);
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 320ms cubic-bezier(0.2, 0, 0, 1);
}

/* ── Inbox column ──────────────────────────────────────── */
.inbox {
  border-right: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.inbox--focus {
  width: 72px;
}
.inbox--focus .inbox__header,
.inbox--focus .inbox__tabs,
.inbox--focus .inbox__filters { display: none; }

.inbox__header {
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inbox__title-row {
  display: flex; align-items: center; justify-content: space-between;
}
.inbox__title {
  font-family: var(--md-ref-typeface-brand);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--md-sys-color-on-surface);
  display: flex; align-items: center; gap: 10px;
}
.inbox__title-count {
  font-family: var(--md-ref-typeface-plain);
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container-high);
  padding: 2px 8px;
  border-radius: 999px;
}
.inbox__actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 999px; border: 0;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 150ms;
}
.icon-btn:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); color: var(--md-sys-color-on-surface); }
.icon-btn--primary {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.icon-btn--primary:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 24%, var(--md-sys-color-primary-container)); }

.inbox__search {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 14px;
  background: var(--md-sys-color-surface-container);
  border-radius: 999px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 14px;
  cursor: pointer;
  transition: background 150ms;
  border: 1px solid transparent;
}
.inbox__search:hover { background: var(--md-sys-color-surface-container-high); }
.inbox__search-kbd {
  margin-left: auto;
  font-family: var(--md-ref-typeface-plain);
  font-size: 11px; font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface);
}

.inbox__tabs {
  display: flex;
  padding: 0 8px;
  gap: 0;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  overflow: hidden;
}
.inbox__tab {
  position: relative;
  padding: 10px 8px 12px;
  background: transparent;
  border: 0;
  font-family: var(--md-ref-typeface-plain);
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 150ms;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
}
.inbox__tab:hover { color: var(--md-sys-color-on-surface); }
.inbox__tab--active { color: var(--md-sys-color-primary); }
.inbox__tab--active::after {
  content: '';
  position: absolute;
  left: 8px; right: 8px; bottom: -1px;
  height: 3px; border-radius: 3px 3px 0 0;
  background: var(--md-sys-color-primary);
}
.inbox__tab-count {
  font-size: 10px;
  padding: 0 6px;
  height: 16px;
  min-width: 16px;
  border-radius: 999px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}
.inbox__tab--active .inbox__tab-count {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.inbox__filters {
  display: flex; gap: 6px; padding: 10px 12px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms;
}
.chip:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 6%, transparent); color: var(--md-sys-color-on-surface); }
.chip--active {
  background: var(--md-sys-color-secondary-container);
  border-color: transparent;
  color: var(--md-sys-color-on-secondary-container);
}

/* ── Conversation list items (bold redesign) ───────────── */
.inbox__list { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.inbox__section {
  padding: 14px 10px 6px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--md-ref-typeface-plain);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}
.inbox__section::after {
  content: ''; flex: 1;
  height: 1px;
  background: var(--md-sys-color-outline-variant);
}

.conv {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 150ms;
  margin-bottom: 2px;
}
.conv:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 5%, transparent); }
.conv--active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.conv--active::before {
  content: '';
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--md-sys-color-primary);
}
.conv--unread .conv__name { font-weight: 700; color: var(--md-sys-color-on-surface); }
.conv--unread .conv__preview { color: var(--md-sys-color-on-surface); font-weight: 500; }

.conv__avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  display: grid; place-items: center;
  font-family: var(--md-ref-typeface-brand);
  font-weight: 500;
  font-size: 16px;
  position: relative;
  flex-shrink: 0;
  align-self: start;
  margin-top: 2px;
}
.conv__channel-dot {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  border: 2px solid var(--md-sys-color-surface);
}
.conv--active .conv__channel-dot { border-color: var(--md-sys-color-secondary-container); }

.conv__body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.conv__head {
  display: flex; align-items: baseline; gap: 8px;
  justify-content: space-between;
}
.conv__name {
  font-family: var(--md-ref-typeface-plain);
  font-size: 14px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv__time {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  font-weight: 500;
}
.conv__time--urgent { color: var(--md-sys-color-error); }

.conv__preview {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  word-break: break-word;
}
.conv__meta {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.conv__inbox {
  font-size: 11px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  letter-spacing: 0.02em;
}
.conv__label {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.conv__label-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: 2px;
  flex-shrink: 0;
}
.conv__name { display: inline-flex; align-items: center; gap: 0; flex-wrap: nowrap; overflow: hidden; min-width: 0; }
.conv__name .conv__label-dot + .conv__label-dot { margin-left: 3px; }
.conv__meta-sep { color: var(--md-sys-color-outline); }
.conv__sla-inline { color: var(--md-sys-color-on-surface-variant); }
.conv__sla-inline--warn { color: var(--md-sys-color-error); font-weight: 500; }
.conv__end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-top: 2px; }
.conv__head-end {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.conv__unread {
  min-width: 22px; height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--md-sys-color-primary) 45%, transparent);
  font-variant-numeric: tabular-nums;
  animation: unreadPop 320ms cubic-bezier(0.2, 0, 0, 1.2);
}
.conv--active .conv__unread {
  background: var(--md-sys-color-on-primary);
  color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--md-sys-color-primary);
}
@keyframes unreadPop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.conv__sla {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}
.conv__sla--warn { color: var(--md-sys-color-error); }

/* ── Thread / main column ───────────────────────────────── */
.thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--md-sys-color-surface-container-lowest);
  position: relative;
}

.thread__header {
  display: flex; align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  min-height: 72px;
}
.thread__identity { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.thread__avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  display: grid; place-items: center;
  font-weight: 500; font-size: 16px;
  font-family: var(--md-ref-typeface-brand);
  flex-shrink: 0;
  position: relative;
}
.thread__avatar .dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--jc-success);
  border: 2px solid var(--md-sys-color-surface);
}
.thread__name-row { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.thread__name {
  font-family: var(--md-ref-typeface-brand);
  font-size: 18px; font-weight: 500;
  color: var(--md-sys-color-on-surface);
  display: flex; align-items: center; gap: 8px;
}
.thread__sub {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  display: flex; align-items: center; gap: 8px;
}
.thread__sub-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.thread__actions { display: flex; gap: 4px; align-items: center; }

.thread__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 120px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.date-pill {
  align-self: center;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 16px 0 8px;
}

.msg-row {
  display: flex;
  gap: 10px;
  padding: 0 24px;
  margin-top: 2px;
  animation: fadeInUp 300ms cubic-bezier(0.2, 0, 0, 1);
}
.msg-row--first { margin-top: 12px; }
.msg-row--me { flex-direction: row-reverse; }
.msg-row--system { justify-content: center; padding: 8px 24px; margin-top: 8px; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  display: grid; place-items: center;
  font-family: var(--md-ref-typeface-brand);
  font-weight: 500;
  font-size: 12px;
  flex-shrink: 0;
  align-self: flex-end;
  visibility: hidden;
}
.msg-row--first .msg-avatar { visibility: visible; }
.msg-row--me .msg-avatar {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.msg-stack { display: flex; flex-direction: column; gap: 2px; max-width: 68%; align-items: flex-start; min-width: 0; }
.msg-row--me .msg-stack { align-items: flex-end; }

.msg-author {
  font-size: 11px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  padding: 0 14px 2px;
}

/* Bubble — clean, high-contrast, no tail ─────────── */
.bubble {
  --bubble-bg: var(--md-sys-color-surface-container-high);
  --bubble-fg: var(--md-sys-color-on-surface);
  background: var(--bubble-bg);
  color: var(--bubble-fg);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  max-width: 100%;
  border-radius: 18px;
}

/* THEM (left) — grouping squares the LEFT edges between consecutive */
.bubble--first  { border-bottom-left-radius: 6px; }
.bubble--middle { border-top-left-radius: 6px;  border-bottom-left-radius: 6px; }
.bubble--last   { border-top-left-radius: 6px; }

/* ME (right) — primary fill; grouping squares the RIGHT edges */
.msg-row--me .bubble {
  --bubble-bg: var(--md-sys-color-primary);
  --bubble-fg: var(--md-sys-color-on-primary);
}
.msg-row--me .bubble--first  { border-bottom-right-radius: 6px; border-bottom-left-radius: 18px; }
.msg-row--me .bubble--middle { border-top-right-radius: 6px;   border-bottom-right-radius: 6px; }
.msg-row--me .bubble--last   { border-top-right-radius: 6px; }

/* Internal note — clearly different */
.bubble--internal {
  --bubble-bg: color-mix(in srgb, var(--md-sys-color-tertiary-container) 70%, var(--md-sys-color-surface));
  --bubble-fg: var(--md-sys-color-on-tertiary-container);
  border: 1px dashed color-mix(in srgb, var(--md-sys-color-tertiary) 60%, transparent);
}

.msg-foot {
  font-size: 10px;
  color: var(--md-sys-color-on-surface-variant);
  padding: 2px 14px 0;
  display: flex; align-items: center; gap: 4px;
}
.msg-foot .material-symbols-outlined { font-size: 14px; }

.bubble--image { padding: 4px; overflow: hidden; }
.bubble--image img, .bubble--image .img-ph {
  border-radius: 14px;
  display: block;
  max-width: 260px;
}
.img-ph {
  width: 240px; height: 160px;
  background:
    linear-gradient(135deg, var(--md-sys-color-surface-container-high) 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(225deg, var(--md-sys-color-surface-container-high) 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(315deg, var(--md-sys-color-surface-container-high) 25%, transparent 25%) 0 0/20px 20px,
    linear-gradient(45deg, var(--md-sys-color-surface-container-high) 25%, transparent 25%) 0 0/20px 20px,
    var(--md-sys-color-surface-container);
  display: grid; place-items: center;
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  letter-spacing: 0.05em;
}

.system-pill {
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.system-pill .material-symbols-outlined { font-size: 14px; }

/* Typing */
.typing {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 12px 16px;
  background: var(--md-sys-color-surface);
  border-radius: 18px;
  box-shadow: var(--md-sys-elevation-level1);
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--md-sys-color-on-surface-variant);
  animation: typingDot 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ── Composer ──────────────────────────────────────────── */
.composer-wrap {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0 20px 16px;
  background: linear-gradient(to top, var(--md-sys-color-surface-container-lowest) 70%, transparent);
  pointer-events: none;
}
.composer-wrap > * { pointer-events: auto; }

.copilot {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--md-sys-color-surface-container);
  border-radius: 20px 20px 0 0;
  margin: 0 8px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.copilot::-webkit-scrollbar { display: none; }
.copilot__icon {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.copilot__icon .material-symbols-outlined { font-size: 16px; }
.copilot__chip {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms;
}
.copilot__chip:hover { background: var(--md-sys-color-surface-container-high); }
.copilot__chip--ai {
  background: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
  border-color: color-mix(in srgb, var(--md-sys-color-primary) 24%, transparent);
  color: var(--md-sys-color-primary);
}
.copilot__chip .material-symbols-outlined { font-size: 16px; }

.composer {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 28px;
  padding: 8px 8px 8px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  box-shadow: var(--md-sys-elevation-level2);
  transition: border-color 150ms;
}
.composer:focus-within { border-color: var(--md-sys-color-primary); }
.composer--with-copilot { border-top-left-radius: 0; border-top-right-radius: 0; margin: 0 8px; }

.composer__textarea {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  outline: 0;
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  min-height: 28px;
  max-height: 180px;
  padding: 8px 0;
}
.composer__textarea::placeholder { color: var(--md-sys-color-on-surface-variant); }
.composer__actions { display: flex; gap: 2px; align-items: center; align-self: flex-end; }
.composer__send {
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 0;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform 150ms, opacity 150ms;
}
.composer__send:disabled { opacity: 0.38; cursor: not-allowed; }
.composer__send:not(:disabled):hover { transform: scale(1.04); }

.mode-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--md-sys-color-surface-container-high);
  border-radius: 999px;
  margin-bottom: 8px;
  margin-left: 8px;
  width: fit-content;
}
.mode-toggle__btn {
  padding: 4px 12px;
  border-radius: 999px;
  border: 0; background: transparent;
  font-size: 12px; font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.mode-toggle__btn--active {
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-level1);
}
.mode-toggle__btn--note.mode-toggle__btn--active {
  background: color-mix(in srgb, var(--jc-status-pending) 24%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface);
}

/* ── Sidecar ───────────────────────────────────────────── */
.sidecar {
  background: var(--md-sys-color-surface);
  border-left: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.sidecar__header {
  padding: 16px 16px 0;
  display: flex; flex-direction: column; gap: 14px;
}
.sidecar__close-row { display: flex; justify-content: flex-end; margin-bottom: -8px; }
.sidecar__profile { text-align: center; padding: 4px 0 8px; }
.sidecar__avatar-big {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  margin: 0 auto 12px;
  display: grid; place-items: center;
  font-family: var(--md-ref-typeface-brand);
  font-weight: 500;
  font-size: 30px;
  position: relative;
}
.sidecar__avatar-big .dot {
  position: absolute;
  bottom: 4px; right: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--jc-success);
  border: 3px solid var(--md-sys-color-surface);
}
.sidecar__name {
  font-family: var(--md-ref-typeface-brand);
  font-size: 20px; font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 4px;
}
.sidecar__sub {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 12px;
}
.sidecar__quick {
  display: flex; justify-content: center; gap: 8px;
  margin-bottom: 8px;
}
.quick-btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 64px;
  padding: 10px 6px;
  border-radius: 12px; border: 0;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: background 150ms;
}
.quick-btn:hover { background: var(--md-sys-color-surface-container-high); }

.sidecar__tabs {
  display: flex;
  padding: 0 16px;
  gap: 4px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.sidecar__content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.kv {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  padding: 10px 0;
  align-items: center;
  font-size: 13px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.kv:last-child { border: 0; }
.kv .material-symbols-outlined { font-size: 18px; color: var(--md-sys-color-on-surface-variant); }
.kv__label { color: var(--md-sys-color-on-surface-variant); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.kv__value { color: var(--md-sys-color-on-surface); margin-top: 1px; }

.section-title {
  font-family: var(--md-ref-typeface-brand);
  font-size: 13px; font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin: 18px 0 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-title button {
  font-size: 12px; font-weight: 500;
  background: transparent; border: 0;
  color: var(--md-sys-color-primary);
  cursor: pointer;
}

.label-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.note {
  background: color-mix(in srgb, var(--jc-status-pending) 10%, transparent);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--md-sys-color-on-surface);
  border-left: 3px solid var(--jc-status-pending);
  margin-bottom: 8px;
}
.note__meta { font-size: 11px; color: var(--md-sys-color-on-surface-variant); margin-top: 6px; }

.ai-card {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--md-sys-color-primary) 8%, var(--md-sys-color-surface-container-low)),
    color-mix(in srgb, var(--md-sys-color-tertiary) 6%, var(--md-sys-color-surface-container-low)));
  border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}
.ai-card__head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-sys-color-primary);
  margin-bottom: 8px;
}
.ai-card__head .material-symbols-outlined { font-size: 16px; }
.ai-card__body { font-size: 13px; line-height: 1.5; color: var(--md-sys-color-on-surface); }

.conv-mini {
  display: flex; gap: 10px; padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 150ms;
}
.conv-mini:hover { background: var(--md-sys-color-surface-container); }
.conv-mini__i {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--md-sys-color-surface-container-high);
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}
.conv-mini__b { flex: 1; min-width: 0; font-size: 12px; color: var(--md-sys-color-on-surface-variant); line-height: 1.4; }
.conv-mini__t { color: var(--md-sys-color-on-surface); font-weight: 500; margin-bottom: 2px; }

/* ── Command palette ───────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: color-mix(in srgb, var(--md-sys-color-scrim) 40%, transparent);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  animation: fadeIn 200ms;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.cmdk {
  width: 640px; max-width: 92vw;
  background: var(--md-sys-color-surface-container);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-level5);
  animation: scaleIn 220ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96) translateY(-8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.cmdk__input {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.cmdk__input input {
  flex: 1;
  border: 0; background: transparent; outline: 0;
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 17px;
}
.cmdk__input input::placeholder { color: var(--md-sys-color-on-surface-variant); }

.cmdk__list { max-height: 420px; overflow-y: auto; padding: 8px; }
.cmdk__section {
  padding: 8px 12px 4px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}
.cmdk__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--md-sys-color-on-surface);
}
.cmdk__item:hover, .cmdk__item--selected { background: var(--md-sys-color-surface-container-high); }
.cmdk__item-name { flex: 1; font-size: 14px; }
.cmdk__item-hint {
  font-family: var(--md-ref-typeface-plain);
  font-size: 11px;
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
}
.cmdk__item-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 500;
}

/* ── New conversation modal ───────────────────────────── */
.modal {
  width: 520px; max-width: 92vw;
  background: var(--md-sys-color-surface-container);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-level5);
  animation: scaleIn 220ms cubic-bezier(0.2, 0, 0, 1);
}
.modal__head {
  padding: 20px 24px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal__title { font-family: var(--md-ref-typeface-brand); font-size: 22px; font-weight: 500; }
.modal__body { padding: 0 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field__label { font-size: 12px; font-weight: 500; color: var(--md-sys-color-on-surface-variant); }
.field__input {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.field__input:focus { border-color: var(--md-sys-color-primary); }
.field__textarea {
  min-height: 80px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  outline: none;
}
.channel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.channel-option {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  background: transparent;
  transition: all 150ms;
}
.channel-option:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 5%, transparent); }
.channel-option--active {
  border-color: transparent;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.modal__foot {
  padding: 16px 24px;
  background: var(--md-sys-color-surface-container-low);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px;
  border-radius: 999px;
  border: 0;
  font-family: inherit;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background 150ms, box-shadow 150ms;
}
.btn--filled { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.btn--filled:hover { box-shadow: var(--md-sys-elevation-level1); }
.btn--tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.btn--text { background: transparent; color: var(--md-sys-color-primary); }
.btn--text:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); }

/* ── Tweaks panel ─────────────────────────────────────── */
.tweaks {
  position: fixed;
  right: 20px; bottom: 20px;
  width: 280px;
  background: var(--md-sys-color-surface-container-high);
  border-radius: 20px;
  box-shadow: var(--md-sys-elevation-level4);
  padding: 16px;
  z-index: 90;
  display: none;
  border: 1px solid var(--md-sys-color-outline-variant);
}
.tweaks--open { display: block; animation: scaleIn 200ms; }
.tweaks__title {
  font-family: var(--md-ref-typeface-brand);
  font-size: 16px; font-weight: 500;
  margin-bottom: 12px;
  color: var(--md-sys-color-on-surface);
  display: flex; align-items: center; justify-content: space-between;
}
.tweaks__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.tweaks__row:last-child { border: 0; }
.tweaks__row label { color: var(--md-sys-color-on-surface); }
.seg {
  display: inline-flex;
  background: var(--md-sys-color-surface-container-low);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  padding: 4px 10px;
  border-radius: 999px;
  border: 0; background: transparent;
  font-size: 12px; font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
}
.seg button.seg--active {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1200px) {
  .workspace { grid-template-columns: 320px 1fr 0px; }
  .sidecar { display: none; }
  .sidecar--mobile-open {
    display: flex;
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 360px;
    z-index: 20;
    animation: slideIn 260ms cubic-bezier(0.2, 0, 0, 1);
    box-shadow: var(--md-sys-elevation-level4);
  }
}
@media (max-width: 840px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .inbox { display: var(--inbox-display, flex); }
  .thread { display: var(--thread-display, none); }
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* density compact */
.density-compact .conv { padding: 8px 12px 8px 16px; }
.density-compact .conv__avatar { width: 36px; height: 36px; font-size: 13px; }
.density-compact .conv__preview { -webkit-line-clamp: 1; }
.density-compact .conv__meta { display: none; }

/* Focus-mode micro avatars */
.focus-list {
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.focus-item {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  display: grid; place-items: center;
  cursor: pointer;
  font-weight: 500; font-size: 14px;
  transition: transform 150ms;
}
.focus-item:hover { transform: scale(1.05); }
.focus-item--active {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}
.focus-item__badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--md-sys-color-surface);
}

/* scrollbars */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--md-sys-color-on-surface) 15%, transparent); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 24%, transparent); }

/* PARITY-09 — sidecar tabs (mirror .inbox__tabs) */
.sidecar__tabs {
    display: flex;
    gap: 2px;
    padding: 4px;
    margin: 8px 16px;
    background: var(--jc-surface-container);
    border-radius: 8px;
}
.sidecar__tab {
    flex: 1;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: var(--jc-text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: background 150ms, color 150ms;
    white-space: nowrap;
}
.sidecar__tab:hover {
    background: var(--jc-hover-bg);
    color: var(--jc-text-primary);
}
.sidecar__tab:focus-visible {
    outline: 2px solid var(--jc-primary);
    outline-offset: 2px;
}
.sidecar__tab--active {
    background: var(--jc-surface);
    color: var(--jc-primary);
    font-weight: 600;
}

/* PARITY-01..04 (02-08) D-07 — fade+translate 150ms ao abrir dropdowns. motion-safe. */
@keyframes jc-dropdown-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jc-dropdown {
    animation: jc-dropdown-fade-in 150ms ease-out;
}

/* Respeita o prefers-reduced-motion do sistema */
@media (prefers-reduced-motion: reduce) {
    .jc-dropdown {
        animation: none;
    }
}
