*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: #f5f5f5;
  color: #111;
}

/* ── Toolbar ─────────────────────────────────────────── */

.toolbar {
  flex-shrink: 0;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toolbar h1 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111;
  flex: 1 1 auto;
  letter-spacing: -0.01em;
}

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

.hint {
  flex-basis: 100%;
  font-size: 0.72rem;
  color: #999;
}

/* ── Buttons ──────────────────────────────────────────── */

.btn {
  cursor: pointer;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 500;
  transition: opacity 0.12s;
  background: none;
}

.btn:hover { opacity: 0.75; }

.btn--danger  { border-color: #d00; color: #d00; }
.btn--success { border-color: #1a7a3a; color: #1a7a3a; }
.btn--neutral { border-color: #ccc; color: #555; }

/* ── Scroll container (mirrors the host with cdkScrollable) ── */

.scroll-container {
  flex: 1 1 auto;
  overflow-y: scroll;
  padding: 16px 24px;
  position: relative;
}

/* Alternating state to invalidate styles in bulk */
.scroll-container.state-a .item-list { background: #f0f0f0; }
.scroll-container.state-b .item-list { background: #f5f5f5; }

/* ── Item list ────────────────────────────────────────── */

.item-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Individual items ────────────────────────────────── */

.item {
  padding: 8px 12px;
  border-radius: 3px;
  background: #fff;
  font-size: 0.75rem;
  color: #444;
  border-left: 2px solid transparent;
  contain: layout style;
}

/* Expensive selectors to make UpdateLayoutTree costly */

.scroll-container .item-list .item:nth-child(even) {
  background: #fafafa;
  border-left-color: #aaa;
  color: #333;
}

.scroll-container .item-list .item:nth-child(3n) {
  font-weight: 600;
}

.scroll-container .item-list .item:nth-child(5n) {
  letter-spacing: 0.01em;
}

.scroll-container.state-a .item-list .item:nth-child(even) {
  background: #f2f2f2;
  border-left-color: #bbb;
}

.scroll-container.state-b .item-list .item:nth-child(even) {
  background: #efefef;
  border-left-color: #999;
}

.scroll-container.state-a .item-list .item:nth-child(odd) {
  background: #fff;
  color: #333;
}

.scroll-container.state-b .item-list .item:nth-child(odd) {
  background: #fafafa;
  color: #444;
}

/* Additional nesting levels to inflate the DOM tree */

.item > .item-inner {
  margin-top: 3px;
  font-size: 0.65rem;
  color: #aaa;
}

.item > .item-inner > .item-detail {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  background: #f0f0f0;
  font-size: 0.6rem;
  color: #888;
}

.scroll-container .item-list .item:nth-child(even) > .item-inner > .item-detail {
  background: #e8e8e8;
  color: #666;
}

.scroll-container .item-list .item:nth-child(7n) > .item-inner {
  display: none;
}
