/* Network resource block: hide the always-empty progress bar under rx/tx. */
.information-widget-resource .min-w-\[120px\] .resource-usage {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Top metrics: a uniform grid of cards                               */
/* ------------------------------------------------------------------ */
#information-widgets {
  margin: 1rem 2rem 0;
  padding: 0;
  background: none;
  border: 0;
}

#widgets-wrap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

/* Let the clock participate in the same grid as the metrics. */
#information-widgets-right {
  display: contents;
}

#information-widgets .widget-container {
  width: auto;
  min-width: 0;
  min-height: 76px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#information-widgets .widget-container > div:first-child {
  justify-content: center;
}

#information-widgets .information-widget-resource {
  margin-right: 0 !important;
}

#information-widgets .information-widget-datetime {
  grid-column: span 2;
  min-width: 0;
  margin: 0;
}

#information-widgets .information-widget-datetime > div > div {
  justify-content: center;
  text-align: center;
}

#information-widgets .information-widget-datetime span {
  width: 100%;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* CPU card: icon left, model/cores/temp on one line, usage below     */
/* ------------------------------------------------------------------ */
#widgets-wrap > .widget-container:first-child {
  display: grid;
  grid-template-columns: 32px auto auto;
  grid-template-rows: auto auto;
  column-gap: 0;
  row-gap: 8px;
  align-content: center;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

#widgets-wrap > .widget-container:first-child > div:first-child {
  display: contents;
}

#widgets-wrap > .widget-container:first-child .information-widget-resource:nth-child(1) {
  display: contents;
}

#widgets-wrap > .widget-container:first-child .information-widget-resource:nth-child(1) > svg {
  grid-column: 1;
  grid-row: 1 / span 2;
  justify-self: start;
  align-self: center;
  display: block;
  width: 24px;
  height: 24px;
}

#widgets-wrap > .widget-container:first-child .information-widget-resource:nth-child(1) > div:last-child {
  grid-column: 2 / span 2;
  grid-row: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: 0 !important;
}

#widgets-wrap > .widget-container:first-child .information-widget-resource:nth-child(1) > div:last-child > div:first-child {
  order: 2;
  flex: none;
}

#widgets-wrap > .widget-container:first-child .information-widget-resource:nth-child(1) .resource-usage {
  order: 1;
  flex: 1 1 auto;
  width: auto;
  min-width: 40px;
  margin-top: 0;
}

#widgets-wrap > .widget-container:first-child .information-widget-resource:nth-child(2) {
  display: contents;
}

#widgets-wrap > .widget-container:first-child .information-widget-resource:nth-child(2) > svg {
  display: none;
}

#widgets-wrap > .widget-container:first-child .information-widget-resource:nth-child(2) > div:last-child {
  grid-column: 3;
  grid-row: 1;
  justify-self: start;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  min-width: 0 !important;
  width: auto;
  margin-left: 0 !important;
}

#widgets-wrap > .widget-container:first-child .information-widget-resource:nth-child(2) .resource-usage {
  display: none;
}

#widgets-wrap > .widget-container:first-child > div:last-child {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  margin: 0;
  padding: 0;
  text-align: left;
  white-space: nowrap;
}

#widgets-wrap > .widget-container:first-child > div:last-child::after {
  content: " ·";
}

#widgets-wrap > .widget-container:first-child .information-widget-resource > div > div:first-child > div:last-child {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Floating refresh / sign-out pill                                    */
/* ------------------------------------------------------------------ */
#footer {
  position: fixed;
  top: auto;
  right: 16px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  flex-direction: row;
  align-items: center;
  width: auto;
  height: 40px;
  padding: 4px 10px;
  margin: 0;
  background: rgba(15, 23, 42, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 50;
}

#style {
  width: auto;
}

#revalidate {
  margin-right: 0.5rem;
}

#signout {
  margin-right: 0;
}

/* Room at the bottom so the floating pill never covers the last card. */
#services {
  padding-bottom: 56px;
}

li.service[data-name="Scrutiny"] {
  margin-bottom: 3.5rem;
}

/* ------------------------------------------------------------------ */
/* Phones                                                              */
/* ------------------------------------------------------------------ */
@media (max-width: 600px) {
  #information-widgets {
    margin: 0.75rem 1rem 0;
  }

  #widgets-wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  #information-widgets .widget-container {
    min-height: 68px;
    padding: 6px 8px;
  }

  /* CPU spans both columns; the other six metrics pair up. */
  #widgets-wrap > .widget-container:first-child {
    grid-column: span 2;
  }

  #information-widgets .information-widget-datetime {
    grid-column: span 1;
    min-height: 40px;
  }

  .information-widget-datetime span {
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
  }

  /* Keep rx/tx on one line inside its half-width card. */
  #information-widgets .min-w-\[120px\] > div {
    font-size: 10.5px;
    white-space: nowrap;
    gap: 0.25rem;
  }

  #services {
    margin-top: 0.5rem;
    padding-bottom: 56px;
  }

  li.service[data-name="Scrutiny"] {
    margin-bottom: 3.5rem;
  }
}

@media (max-width: 340px) {
  #widgets-wrap {
    grid-template-columns: 1fr;
  }

  #widgets-wrap > .widget-container:first-child,
  #information-widgets .information-widget-datetime {
    grid-column: span 1;
  }
}

/* ------------------------------------------------------------------ */
/* Scrutiny detail card                                                */
/* ------------------------------------------------------------------ */
li.service[data-name="Scrutiny"] {
  justify-self: center;
  width: 100%;
  max-width: 900px;
}

li.service[data-name="Scrutiny"] .service-container .flex-col > .flex-row {
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* Tablet: two metric columns, the CPU card spans a full row. */
/* Room to scroll the last service card out from under the floating pill. */
@media (max-width: 1023px) {
  #layout-groups {
    padding-bottom: 72px;
  }
}

@media (min-width: 601px) and (max-width: 1023px) {
  #widgets-wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #widgets-wrap > .widget-container:first-child {
    grid-column: span 2;
  }

  #information-widgets .information-widget-datetime {
    grid-column: span 1;
  }
}

/* ------------------------------------------------------------------ */
/* Tabs: left sidebar on desktop, horizontal bar on mobile             */
/* ------------------------------------------------------------------ */
#tabs ul#myTab {
  display: flex;
  flex-direction: row;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

#tabs ul#myTab::-webkit-scrollbar {
  display: none;
}

#tabs ul#myTab > li {
  width: auto;
  height: auto;
  flex: 0 0 auto;
}

#tabs ul#myTab > li > button {
  width: auto;
  margin: 0;
  padding: 8px 16px;
  font-size: 14px;
  white-space: nowrap;
  border-radius: 6px;
}

@media (min-width: 1280px) {
  #tabs {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: 208px;
    margin: 0;
    padding: 22px 12px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(148, 163, 184, 0.14);
  }

  #tabs::before {
    content: "HomeLab 控制台";
    display: block;
    padding: 0 12px 18px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #e2e8f0;
  }

  #tabs ul#myTab {
    flex-direction: column;
    gap: 4px;
    overflow: visible;
    background: transparent;
  }

  #tabs ul#myTab > li {
    width: 100%;
  }

  #tabs ul#myTab > li > button {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin: 0;
    text-align: left;
    font-size: 14px;
    color: #cbd5e1;
    border-radius: 8px;
  }

  #tabs ul#myTab > li > button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
  }

  #tabs ul#myTab > li > button[aria-selected="true"] {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    box-shadow: inset 2px 0 0 #60a5fa;
  }

  /* keep the whole content area to the right of the sidebar */
  #inner_wrapper:has(#tabs) {
    padding-left: 208px;
  }
}
