/* Workspaces: the switcher at the top (its checkboxes choose which
   workspaces the pages show), the manage sheet, and workspace dots. */

/* ------------------------------------------------------------------- dots */

.ws-dot {
  flex: 0 0 auto;
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ws-color, var(--faint));
}

.ws-dot--lg {
  width: 16px;
  height: 16px;
}

/* A workspace logo: a little bigger than a dot, on a light tile, whole. */
span.ws-dot.has-logo {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: #fff var(--ws-logo) center / contain no-repeat;
  box-shadow: 0 0 0 1px var(--line);
}

span.ws-dot--lg.has-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.ws-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ws-meta .ws-dot {
  width: 10px;
  height: 10px;
}

/* ------------------------------------------------------------------ switcher */

.ws {
  position: relative;
  display: inline-flex;
}

.ws__trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px 0 16px;
  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.ws__trigger:active {
  transform: scale(0.97);
}

.ws__dots {
  display: inline-flex;
  align-items: center;
}

.ws__dots .ws-dot {
  box-shadow: 0 0 0 2px var(--bg);
}

.ws__dots .ws-dot + .ws-dot {
  margin-left: -4px;
}

.ws__label {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws__caret {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.2s var(--ease);
}

.ws.is-open .ws__caret {
  transform: rotate(180deg);
}

.ws__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 310px;
  max-height: min(72vh, 600px);
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 26px;
  background: var(--glass-menu);
  -webkit-backdrop-filter: blur(36px) saturate(150%);
  backdrop-filter: blur(36px) saturate(150%);
  box-shadow: var(--shadow-pill);
  transform-origin: top right;
  animation: menu-in 0.2s var(--ease);
}

.ws__head {
  padding: 10px 14px 4px;
  color: var(--muted);
  font-size: 13px;
}

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

.ws__item {
  position: relative;
  display: flex;
  align-items: center;
}

.ws__row {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  transition: background 0.16s;
}

.ws__row:hover {
  background: var(--soft-1);
}

.ws__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws__count {
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* "Only" takes the count's place while the row is hovered or it has focus. */
.ws__only {
  position: absolute;
  right: 8px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--soft-2);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, background 0.15s;
}

.ws__only:hover {
  background: var(--soft-3);
}

.ws__item:hover .ws__only,
.ws__only:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.ws__item:hover .ws__count,
.ws__item:has(.ws__only:focus-visible) .ws__count {
  visibility: hidden;
}

@media (hover: none) {
  .ws__only {
    position: static;
    margin-right: 6px;
    opacity: 1;
    pointer-events: auto;
  }

  .ws__item .ws__count {
    display: none;
  }
}

/* A checkbox drawn to match the app: a rounded square that fills with ink. */
.ws__check {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ws__check:checked,
.ws__check:indeterminate {
  border-color: var(--ink);
  background: var(--ink);
}

.ws__check:checked::after {
  content: '';
  width: 10px;
  height: 5px;
  border: 2px solid var(--bg);
  border-top: 0;
  border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}

.ws__check:indeterminate::after {
  content: '';
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--bg);
}

.ws__check:focus-visible {
  outline: 2px solid var(--line-strong);
  outline-offset: 2px;
}

.ws__sep {
  margin: 4px 12px;
  border: 0;
  border-top: 1px solid var(--line);
}

.ws__hint {
  padding: 4px 14px 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.ws__action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s;
}

.ws__action:hover,
.ws__action:focus-visible {
  background: var(--soft-1);
  outline: none;
}

.ws__action svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.ws__new {
  display: flex;
  gap: 6px;
  padding: 4px;
}

.ws__new .input {
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
}

.ws__new .btn {
  height: 40px;
}

/* ------------------------------------------------------------ manage sheet */

.wsm {
  gap: 16px;
}

.wsm__add {
  display: flex;
  gap: 8px;
}

.wsm__row.row {
  align-items: flex-start;
}

.wsm__color {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--soft-2);
  cursor: pointer;
  transition: background 0.15s;
}

.wsm__color:hover {
  background: var(--soft-3);
}

.wsm__name.input {
  height: 40px;
  padding: 0 14px;
}

.wsm__row .row__meta {
  padding: 0 14px;
}

.wsm__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 4px 2px;
}

.wsm__swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ws-color);
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}

.wsm__swatch:hover {
  transform: scale(1.1);
}

.wsm__swatch.is-active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ws-color);
}

.wsm__remove {
  width: 40px;
  height: 40px;
  padding: 0;
}

/* ------------------------------------------------------------ odds and ends */

.ws-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-workspace__icon {
  background: var(--soft-1);
}

/* A button that reads as a link, inside a sentence. */
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--whisper);
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration-color: var(--muted);
}

/* ---------------------------------------------------------------- narrower */

@media (max-width: 1200px) {
  .ws__label {
    display: none;
  }

  .ws__trigger {
    gap: 6px;
    padding: 0 12px 0 16px;
  }
}

@media (max-width: 900px) {
  .ws__panel {
    position: fixed;
    left: 8px;
    right: 8px;
    top: 72px;
    width: auto;
  }
}

/* Phones: a round button with just the dots, so the search keeps its room. */
@media (max-width: 560px) {
  .ws__trigger {
    justify-content: center;
    width: 52px;
    padding: 0;
  }

  .ws__caret {
    display: none;
  }
}

.wsm__picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.wsm__picker .wsm__swatches {
  margin-top: 0;
}

.wsm__logo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.wsm__logo .btn svg {
  width: 15px;
  height: 15px;
}

.wsm__logo-note {
  color: var(--faint);
  font-size: 12px;
}
