/* Shared app layout (topbar + left palette + collapsible groups). */

.topbar {
  height: var(--app-topbar-height, 56px);
  display: flex;
  align-items: center;
  gap: var(--app-topbar-gap, 10px);
  padding: var(--app-topbar-padding, 10px 12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #000;
  color: #fff;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
}

.layout {
  display: grid;
  grid-template-columns: var(--app-layout-left-col, 340px) 1fr;
  height: var(--app-layout-height, calc(100vh - 56px));
  min-height: 0;
  transition: grid-template-columns 160ms ease;
}

.layout.palette-collapsed {
  grid-template-columns: 44px 1fr;
}

.palette.collapsed .palette-body {
  display: none;
}

.palette.collapsed .count {
  display: none;
}

.palette.collapsed .palette-title {
  display: none;
}

.palette.collapsed .palette-header {
  padding: 10px 8px;
  justify-content: center;
  align-items: center;
}

.palette.collapsed .palette-header-right {
  width: 100%;
  justify-content: center;
}

.palette {
  border-right: 1px solid var(--border);
  background: var(--cat);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.palette-header {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.palette-title {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #fff;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
}

.palette-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.palette-toggle {
  width: 24px;
  height: 24px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  line-height: 1;
  user-select: none;
  flex: 0 0 auto;
}

.palette-toggle:hover {
  filter: brightness(1.08);
}

.palette-toggle:active {
  transform: translateY(1px);
}

.palette-header .count {
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
  font-weight: 800;
}

.palette-body {
  padding: 10px;
  overflow: auto;
  min-height: 0;
  background: var(--panel);
}

.group {
  border: 1px solid #dedede;
  border-radius: 12px;
  overflow: hidden;
  margin: 8px 0 6px;
  background: #fff;
}

.group:first-child {
  margin-top: 0;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  background: var(--cat);
  cursor: pointer;
  user-select: none;
  color: #fff;
}

.group-header:hover {
  filter: brightness(0.95);
}

.gh-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chev {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.1);
  flex: 0 0 auto;
  padding-bottom: 4px;
}

.gh-title {
  font-family: var(--heading-font);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
  text-transform: uppercase;
}

.gh-count {
  font-size: 12px;
  color: #fff;
  opacity: 0.92;
  white-space: nowrap;
  flex: 0 0 auto;
  font-weight: 700;
}

.group-body {
  display: none;
  padding: 6px 10px 2px;
  background: #fff;
}

.group.open .group-body {
  display: block;
}

.group.open .chev {
  background: rgba(0, 0, 0, 0.16);
}

.group.open .chev::after {
  content: "–";
}

.group:not(.open) .chev::after {
  content: "+";
}

.group-empty {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 6px 2px;
}
