.collapsed-bar {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.collapsed-bar--micro {
  width: 100%;
  cursor: default;
}

.collapsed-bar__micro-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 32px;
  padding: 4px 12px;
}

.collapsed-bar__micro-count {
  color: var(--island-text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Status row: rate limits + icons (only shown when expanded) */
.collapsed-bar__status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 0;
  min-height: 30px;
}

.collapsed-bar__rate-limits {
  flex: 1;
  overflow: hidden;
}

.collapsed-bar__icons {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.collapsed-bar__header-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  pointer-events: none;
}

.collapsed-bar__header-tip > div {
  min-width: 0;
  max-width: 100%;
}

.collapsed-bar__header-tip span {
  white-space: nowrap;
}

.collapsed-bar__header-tip span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tip-display {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.tip-display__label {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.tip-display__text {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapsed-bar__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  color: var(--island-text-secondary);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.collapsed-bar__icon-btn:hover {
  color: var(--island-text);
  background: rgba(255, 255, 255, 0.1);
}

.collapsed-bar__icon-btn--quit {
  color: #ff5f57;
  background: rgba(255, 95, 87, 0.1);
}

.collapsed-bar__icon-btn--quit:hover {
  color: #ff5f57;
  background: rgba(255, 95, 87, 0.2);
}

.collapsed-bar__update-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--island-danger-bg);
  border: 1.5px solid var(--island-bg);
  pointer-events: none;
}

/* Separator below status row — AgentBro dashed style */
.collapsed-bar--expanded .collapsed-bar__status-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  margin-bottom: 0;
}

/* Main row: pixel + info + count */
.collapsed-bar__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 32px;
  min-height: 32px;
}

.collapsed-bar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.collapsed-bar__status-row > .collapsed-bar__left {
  flex: 0 0 auto;
  overflow: visible;
}

.collapsed-bar__theme-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
}

.collapsed-bar__theme-avatar .sprite-canvas {
  display: block;
}

.collapsed-bar__idle-logo-wrap {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: visible;
}

.collapsed-bar__idle-logo {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  filter: drop-shadow(0 1px 6px rgba(248, 164, 0, 0.28));
}

.collapsed-bar__right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Carousel container — clips the slide-up animation */
.collapsed-bar__carousel {
  overflow: hidden;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.collapsed-bar__info {
  font-size: 11px;
  font-weight: 500;
  color: var(--island-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  width: 100%;
}

.collapsed-bar__info--empty {
  color: var(--island-text-secondary);
  font-weight: 600;
}

.collapsed-bar__brand-empty {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.collapsed-bar__brand-logo {
  width: 31px;
  height: 23px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 5px rgba(248, 164, 0, 0.26));
}

.collapsed-bar__brand-name {
  flex: 0 0 auto;
  color: var(--island-text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.collapsed-bar__brand-slogan {
  min-width: 0;
  overflow: hidden;
  color: var(--island-text-secondary);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapsed-bar__tool-inline {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.collapsed-bar__tool-label {
  flex-shrink: 0;
  color: #fa216e;
}

.collapsed-bar__tool-project {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--island-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapsed-bar__tool-target,
.collapsed-bar__tool-target-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #2f8cff;
}

.collapsed-bar__tool-target {
  color: var(--island-text-secondary);
}

.collapsed-bar__tool-count {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.collapsed-bar__tool-count--add {
  color: var(--island-success-text);
}

.collapsed-bar__tool-count--del {
  color: var(--island-danger-text);
}

.collapsed-bar__waiting-inline {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.collapsed-bar__waiting-project {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--island-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapsed-bar__waiting-dot {
  --collapsed-waiting-pulse: color-mix(in srgb, var(--island-warning) 38%, transparent);
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--island-warning);
  box-shadow: 0 0 0 0 var(--collapsed-waiting-pulse);
  animation: waiting-dot-pulse 1.25s ease-out infinite;
}

.collapsed-bar__waiting-label {
  flex: 0 0 auto;
  color: var(--island-warning-text);
  font-weight: 800;
}

.collapsed-bar__waiting-target {
  min-width: 0;
  overflow: hidden;
  color: var(--island-text-secondary);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapsed-bar__compacting-inline {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.collapsed-bar__compacting-label {
  flex: 0 0 auto;
  color: var(--island-info-text);
}

.collapsed-bar__compacting-dot {
  --collapsed-compacting-pulse: color-mix(in srgb, var(--island-info) 36%, transparent);
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--island-info);
  box-shadow: 0 0 0 0 var(--collapsed-compacting-pulse);
  animation: compacting-dot-pulse 1.2s ease-out infinite;
}

.collapsed-bar--compacting .collapsed-bar__main {
  position: relative;
  overflow: hidden;
}

.collapsed-bar--compacting .collapsed-bar__main::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(168, 85, 247, 0.14) 50%,
    transparent 100%
  );
  animation: shimmer-slide 1.8s ease-in-out infinite;
}

@keyframes compacting-dot-pulse {
  70% {
    box-shadow: 0 0 0 6px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes waiting-dot-pulse {
  70% {
    box-shadow: 0 0 0 6px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* Alert badge — AgentBro-style: gray bg + amber dot + count */
.collapsed-bar__alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--island-warning) 30%, var(--island-border) 70%);
  border-radius: 4px;
  background: var(--island-warning-bg);
  color: var(--island-warning-text);
  font-size: 11px;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.collapsed-bar__alert-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--island-warning);
}

/* Session count — mono, semibold */
.collapsed-bar__count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--island-text);
  font-variant-numeric: tabular-nums;
}

/* Unattended timer badge */
.collapsed-bar__unattended {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 5px;
  border-radius: 6px;
  line-height: 1.4;
}

.collapsed-bar__unattended--amber {
  color: var(--island-warning-text);
  background: var(--island-warning-bg);
  animation: unattended-pulse-amber 2s ease-in-out infinite;
}

.collapsed-bar__unattended--red {
  color: var(--island-danger-text);
  background: var(--island-danger-bg);
  animation: unattended-pulse-red 1s ease-in-out infinite;
}

@keyframes unattended-pulse-amber {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 159, 10, 0.3); }
  50% { opacity: 0.75; box-shadow: 0 0 0 3px rgba(255, 159, 10, 0); }
}

@keyframes unattended-pulse-red {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
  50% { opacity: 0.75; box-shadow: 0 0 0 3px rgba(255, 59, 48, 0); }
}

/* Shimmer animation — AI is thinking */
.collapsed-bar--shimmer .collapsed-bar__main {
  position: relative;
  overflow: hidden;
}

.collapsed-bar--shimmer .collapsed-bar__main::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  animation: shimmer-slide 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shimmer-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Tool status in collapsed bar — AgentBro accent for tool names */
.collapsed-bar__tool-status {
  font-size: 11px;
  font-weight: 500;
  color: #fa216e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ALL/ACT/WAIT counter pills — AgentBro expanded header */
.collapsed-bar__counter-pills {
  display: flex;
  height: 26px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.collapsed-bar__counter-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--island-text-muted);
}

.collapsed-bar__counter-pill:last-child {
  border-right: none;
}

.collapsed-bar__counter-pill--active {
  background: rgba(255, 255, 255, 0.085);
  color: var(--island-text);
}

.collapsed-bar__counter-pill--act {
  color: var(--island-success-text);
}

.collapsed-bar__counter-pill--wait {
  color: var(--island-warning-text);
}

.collapsed-bar__counter-pill-val {
  font-size: 9px;
  opacity: 0.76;
}

.collapsed-bar__session-count-text {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--island-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.collapsed-bar__esc-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--island-text-muted);
  flex-shrink: 0;
  letter-spacing: 0;
}

/* Rate limit percentage — color set inline */
.collapsed-bar__rate-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Error warning badge */
.collapsed-bar__error-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--island-danger-bg);
  color: var(--island-danger-text);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  animation: error-pulse 1.5s ease-in-out infinite;
}

@keyframes error-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0); }
}

/* YOLO mode badge */
.collapsed-bar__yolo-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--island-warning-text);
  background: var(--island-warning-bg);
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
