/* Page-specific layout. Everything visual comes from vendor/tolstoy/tolstoy.css.
   The target is the dashboard's density: a slim bar, then a 3-column board of
   compact rows, so the services are visible without scrolling. */

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 600;
}
.skip-link:focus {
  top: 0.75rem;
}

/* --- Top bar ------------------------------------------------------------ */

.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: blur(12px);
}

.bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  padding-block: 0.55rem;
}

.bar .brand__name {
  font-size: 1.05rem;
}

.bar .brand__mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

/* Segmented tabs. */
.tabs {
  display: flex;
  gap: 0.125rem;
  padding: 0.125rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--card);
}

.tab {
  padding: 0.3rem 0.7rem;
  border-radius: 0.45rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.tab:hover {
  color: var(--foreground);
}

.tab[aria-current="page"] {
  background: var(--muted);
  color: var(--foreground);
  font-weight: 500;
}

.search {
  position: relative;
  display: flex;
  flex: 0 1 200px;
  align-items: center;
}

.search > svg {
  position: absolute;
  left: 0.6rem;
  width: 0.9rem;
  height: 0.9rem;
  color: var(--dim);
  pointer-events: none;
}

.search .input {
  height: 2rem;
  padding-left: 1.9rem;
  padding-right: 1.6rem;
  font-size: 0.8125rem;
}

.search .kbd {
  position: absolute;
  right: 0.35rem;
  padding: 0 0.25rem;
  font-size: 0.625rem;
  line-height: 1.3;
  pointer-events: none;
}

.count {
  min-width: 1.5rem;
  font-size: 0.6875rem;
  color: var(--dim);
  text-align: right;
}

.badge--view {
  letter-spacing: 0.08em;
}

.btn--sm {
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
}

.btn--sm svg {
  width: 0.9rem;
  height: 0.9rem;
}

/* --- Board -------------------------------------------------------------- */

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem 2.25rem;
  align-content: start;
  align-items: start;
  padding-block: 1.1rem 1.5rem;
}

/* Each tab's groups flow into the same grid. */
.tabpanel {
  display: contents;
}
.tabpanel[hidden] {
  display: none;
}

/* While filtering, the tabs step aside and every panel is searched. */
body[data-filtering="true"] .tabs {
  display: none;
}

.group {
  min-width: 0;
}

/* A tab with a single group (Media Managers) uses the whole board width and
   spreads its entries over three columns, like the dashboard's "row" style. */
.tabpanel > .group:only-child {
  grid-column: 1 / -1;
}

.tabpanel > .group:only-child .group__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px 1.75rem;
}

.group[hidden],
.entry[hidden],
.empty[hidden] {
  display: none;
}

.group__head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.group__icon {
  display: inline-flex;
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted-foreground);
}

.group__icon svg,
.group__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.group__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.group__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--dim);
}

.group__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* One service: icon, name, host, public dot. 32px tall. */
.entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 32px;
  padding: 0 0.5rem;
  border-radius: 0.4rem;
  color: var(--muted-foreground);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.entry:hover,
.entry:focus-visible {
  background: var(--muted);
  color: var(--foreground);
}

.entry__icon {
  display: inline-flex;
  flex: none;
  width: 18px;
  height: 18px;
}

.entry__icon svg,
.entry__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.entry__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--foreground);
  font-size: 0.875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry__host {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--dim);
}

.entry__dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-soft);
}

.entry__dot--lan {
  background: var(--line-strong);
  box-shadow: none;
}

/* In the public view every entry is public, so the dot carries no meaning. */
body[data-view="public"] .entry__dot {
  display: none;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.empty {
  grid-column: 1 / -1;
}

/* Narrower screens: two columns, then one. The host label is the first thing
   to go. */
@media (max-width: 1100px) {
  .entry__host {
    display: none;
  }
}

@media (max-width: 900px) {
  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tabpanel > .group:only-child .group__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .board {
    grid-template-columns: 1fr;
  }
  .tabpanel > .group:only-child .group__list {
    grid-template-columns: 1fr;
  }
  .bar__inner {
    gap: 0.5rem;
  }
  .search {
    flex: 1 1 100%;
    order: 5;
    max-width: none;
  }
  .tabs {
    order: 6;
    width: 100%;
  }
  .tab {
    flex: 1;
    text-align: center;
  }
}
