:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  color: #202a30;
  background: #fff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid #3e7381; outline-offset: 3px; }
.shell { width: min(100% - 48px, 1020px); margin: 0 auto; padding-bottom: 55px; }

.topbar { height: 78px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid #eef1f1; }
.brand { grid-column: 2; font-size: 20px; font-weight: 700; letter-spacing: -.045em; }
.refresh-button { grid-column: 3; justify-self: end; display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid #e7eded; border-radius: 50%; background: #fff; color: #52616a; font-size: 24px; line-height: 1; }
.refresh-button:hover:not(:disabled) { background: #f4f8f9; }
.refresh-button:disabled { opacity: .45; cursor: wait; }

.sort-tabs { width: min(100%, 610px); margin: 25px auto 20px; padding: 4px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; border-radius: 999px; background: #f1f5f7; }
.sort-tabs button { min-width: 0; min-height: 39px; padding: 0 9px; border: 0; border-radius: 999px; background: transparent; color: #718087; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sort-tabs button:hover { color: #253138; }
.sort-tabs button[aria-pressed="true"] { background: #fff; color: #202a30; box-shadow: 0 1px 3px rgba(31, 61, 74, .08); }

.list-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 40px; margin-bottom: 5px; color: #89969c; font-size: 12px; }
.count { color: #536169; font-weight: 600; }
.list-options { display: flex; align-items: center; gap: 20px; }
.updated { white-space: nowrap; }
.toggle { display: flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.toggle input { width: 14px; height: 14px; margin: 0; accent-color: #3e7381; }
.status { padding: 13px 15px; margin: 9px 0 15px; border-radius: 9px; background: #f3f7f8; color: #4c6872; font-size: 13px; line-height: 1.5; }
.status[hidden] { display: none; }
.status.error { color: #9f3a35; background: #fff1ef; }
.status.notice { color: #83602e; background: #fbf5e9; }

.server-list { border-top: 1px solid #edf0f1; }
.server-row { display: grid; grid-template-columns: 46px minmax(170px, 1.1fr) minmax(360px, 1.5fr) 64px; grid-template-areas: "rank name metrics action"; align-items: center; column-gap: 18px; min-height: 93px; padding: 15px 10px; border-bottom: 1px solid #edf0f1; }
.server-row:hover { background: #fafcfc; }
.rank { grid-area: rank; display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; background: #f0f5f7; color: #527583; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hostname { grid-area: name; min-width: 0; margin: 0; color: #243138; font-size: 16px; font-weight: 600; letter-spacing: -.025em; line-height: 1.35; overflow-wrap: anywhere; }
.row-metrics { grid-area: metrics; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.metric { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.metric-label { color: #929da2; font-size: 11px; white-space: nowrap; }
.metric-value { color: #35444c; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.download-button { grid-area: action; justify-self: end; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; width: 52px; height: 52px; padding: 0; border: 1px solid #dce9ed; border-radius: 13px; background: #f7fbfc; color: #397387; }
.download-button:hover { background: #eaf5f8; border-color: #c4dfe6; }
.download-arrow { font-size: 23px; line-height: 1; font-weight: 500; }
.download-caption { margin-top: 1px; font-size: 9px; font-weight: 700; letter-spacing: .04em; }
.empty { padding: 55px 12px; text-align: center; color: #7d8a90; font-size: 13px; }
.footnote { margin: 25px 2px 0; color: #a0a9ad; font-size: 11px; line-height: 1.6; }

@media (max-width: 740px) {
  .server-row { grid-template-columns: 43px minmax(0, 1fr) 56px; grid-template-areas: "rank name action" ". metrics metrics"; gap: 9px 12px; min-height: 105px; padding: 17px 4px; }
  .rank { width: 41px; height: 41px; }
  .hostname { font-size: 15px; }
  .row-metrics { gap: 8px; margin-top: 2px; }
  .metric-value { font-size: 13px; }
  .download-button { width: 47px; height: 47px; }
}

@media (max-width: 480px) {
  .shell { width: calc(100% - 34px); }
  .topbar { height: 70px; }
  .brand { font-size: 18px; }
  .sort-tabs { margin-top: 22px; margin-bottom: 17px; }
  .sort-tabs button { font-size: 11px; min-height: 37px; padding: 0 3px; }
  .list-meta { align-items: flex-start; }
  .list-options { align-items: flex-end; flex-direction: column; gap: 3px; }
  .metric-label { font-size: 10px; }
  .footnote { margin-top: 23px; }
}

@media (max-width: 350px) {
  .sort-tabs button { font-size: 10px; }
  .server-row { grid-template-columns: 35px minmax(0, 1fr) 48px; gap: 8px; }
  .rank { width: 35px; height: 35px; font-size: 11px; }
  .download-button { width: 43px; height: 43px; }
  .metric-value { font-size: 12px; }
}

/* A single moving selection surface keeps tab changes continuous. */
.sort-tabs { position: relative; isolation: isolate; gap: 0; }
.sort-tabs::before { content: ''; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 4); border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(31,61,74,.08); transform: translateX(calc(var(--active-tab, 0) * 100%)); transition: transform 280ms cubic-bezier(.22,1,.36,1); }
.sort-tabs button { transition: color 180ms ease; }
.sort-tabs button[aria-pressed="true"] { background: transparent; box-shadow: none; }
.server-row { grid-template-columns: 32px minmax(150px,1fr) minmax(320px,1.5fr) 44px; column-gap: 20px; padding: 22px 4px; }
.rank { width: 28px; height: auto; background: transparent; color: #9aa3a7; font-size: 12px; font-weight: 500; }
.download-button { width: 40px; height: 40px; border-radius: 10px; border-color: #e7ebed; background: #fff; color: #53636b; transition: background-color 160ms ease, border-color 160ms ease; }
.download-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.download-button:hover { background: #f2f6f7; border-color: #d8e1e4; }
@media (max-width: 820px) {
  .server-row { grid-template-columns: 26px minmax(0,1fr) 40px; grid-template-areas: "rank name action" "rank metrics action"; gap: 12px 14px; padding: 21px 0; }
  .rank, .download-button { align-self: center; }
  .hostname { font-size: 14px; }
  .row-metrics { margin: 0; gap: 12px; }
  .metric { gap: 4px; }
  .metric-value { font-size: 13px; }
  .metric-label { font-size: 10px; }
}
@media (max-width: 380px) {
  .server-row { grid-template-columns: 22px minmax(0,1fr) 36px; column-gap: 9px; }
  .rank { width: 22px; }
  .download-button { width: 36px; height: 40px; }
  .row-metrics { gap: 7px; }
  .metric-label { font-size: 9px; }
  .metric-value { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sort-tabs::before, .sort-tabs button, .download-button { transition: none; }
}
