/* lab_monitor.css — Lab GPU Monitor 전용 스타일.
   design token 은 style.css :root 에서 상속 (--bg-*, --btn-*, --r-*, --text-*, --border-*).
*/

/* 서버 카드 그리드 */
.lm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: 12px;
  padding: 0 12px 20px;
}

.lm-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Active users */
.lm-users-block {
  margin: 0 12px 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-ui);
  border-radius: var(--r-lg);
}
.lm-users-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.lm-users-head::-webkit-details-marker { display: none; }
.lm-users-head::before {
  content: "▼";
  color: var(--text-dim);
  font-size: 10px;
  margin-top: 2px;
}
.lm-users-block:not([open]) .lm-users-head { margin-bottom: 0; }
.lm-users-block:not([open]) .lm-users-head::before { content: "▶"; }
.lm-users-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lm-users-subtitle {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-dim);
}
.lm-users-total {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.lm-users-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.lm-user-tag {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-template-areas:
    "dot name meta"
    "dot servers servers";
  align-items: center;
  column-gap: 6px;
  row-gap: 1px;
  min-height: 38px;
  max-width: 320px;
  padding: 6px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
}
.lm-user-tag:hover {
  border-color: var(--accent-blue);
  background: #0f1f36;
}
.lm-user-dot {
  grid-area: dot;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.lm-user-name {
  grid-area: name;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.lm-user-meta {
  grid-area: meta;
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}
.lm-user-servers {
  grid-area: servers;
  min-width: 0;
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dispatch availability */
.lm-dispatch-block {
  margin: 0 12px 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-ui);
  border-radius: var(--r-lg);
}
.lm-dispatch-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.lm-dispatch-head::-webkit-details-marker { display: none; }
.lm-dispatch-head::before {
  content: "▼";
  color: var(--text-dim);
  font-size: 10px;
  margin-top: 2px;
}
.lm-dispatch-block:not([open]) .lm-dispatch-head { margin-bottom: 0; }
.lm-dispatch-block:not([open]) .lm-dispatch-head::before { content: "▶"; }
.lm-dispatch-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lm-dispatch-subtitle,
.lm-dispatch-total {
  font-size: 11px;
  color: var(--text-dim);
}
.lm-dispatch-body {
  display: grid;
  gap: 8px;
}
.lm-dispatch-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lm-dispatch-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border: 1px solid rgba(34,197,94,0.45);
  border-radius: 8px;
  background: rgba(34,197,94,0.08);
  color: #86efac;
  font-size: 11px;
  font-weight: 700;
}
.lm-dispatch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-dim);
  font-size: 10px;
}
.lm-dispatch-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lm-dispatch-legend i,
.lm-dispatch-cell {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
}
.lm-dispatch-map {
  display: grid;
  gap: 4px;
}
.lm-dispatch-row {
  display: grid;
  grid-template-columns: minmax(92px, 150px) 1fr;
  gap: 8px;
  align-items: center;
  min-height: 24px;
}
.lm-dispatch-server {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 11px;
}
.lm-dispatch-server span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lm-dispatch-gpus {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.lm-dispatch-cell {
  width: 22px;
  height: 20px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
}
.lm-dispatch-cell.ok,
.lm-dispatch-legend i.ok {
  background: rgba(34,197,94,0.24);
  border-color: rgba(34,197,94,0.65);
  color: #86efac;
}
.lm-dispatch-cell.warm,
.lm-dispatch-legend i.warm {
  background: rgba(251,191,36,0.18);
  border-color: rgba(251,191,36,0.55);
  color: #fbbf24;
}
.lm-dispatch-cell.busy,
.lm-dispatch-legend i.busy {
  background: rgba(148,163,184,0.12);
  border-color: rgba(148,163,184,0.32);
  color: #94a3b8;
}
.lm-dispatch-cell.blocked,
.lm-dispatch-legend i.blocked {
  background: rgba(248,113,113,0.16);
  border-color: rgba(248,113,113,0.5);
  color: #fca5a5;
}

.lm-server-users {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 3px 0 5px 26px;
}
.lm-server-users-label {
  min-width: 28px;
  padding: 1px 5px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}
.lm-server-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 150px;
  padding: 2px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-raised);
  font-size: 10px;
  font-weight: 700;
}
.lm-server-user-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lm-server-user-more {
  color: var(--text-dim);
  font-size: 10px;
  padding: 1px 5px;
}

/* 서버 카드 */
.lm-server-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-ui);
  border-radius: var(--r-lg);
  padding: 12px 14px;
}
.lm-card-dead {
  border-color: #5c2626;
  opacity: 0.7;
}

.lm-server-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

/* 서버별 요약바 */
.lm-summary-bar {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 3px 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
}

/* <details> collapse 섹션 */
details.lm-details {
  margin: 0;
}
details.lm-details > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;  /* 기본 triangle 제거 */
}
details.lm-details > summary::-webkit-details-marker { display: none; }
details.lm-details > summary::before {
  content: "▶ ";
  font-size: 9px;
  opacity: 0.7;
}
details.lm-details[open] > summary::before {
  content: "▼ ";
}
details.lm-details > summary:hover {
  color: var(--text-primary);
}

/* GPU idle alert 테두리 */
.lm-gpu-alert-warn {
  border: 1px solid #fbbf24 !important;
  animation: lm-pulse-warn 2s infinite;
}
.lm-gpu-alert-critical {
  border: 1px solid #f87171 !important;
  animation: lm-pulse-crit 1s infinite;
}
@keyframes lm-pulse-warn {
  0%,100% { box-shadow: 0 0 0 0 rgba(251,191,36,0); }
  50%      { box-shadow: 0 0 0 3px rgba(251,191,36,0.35); }
}
@keyframes lm-pulse-crit {
  0%,100% { box-shadow: 0 0 0 0 rgba(248,113,113,0); }
  50%      { box-shadow: 0 0 0 4px rgba(248,113,113,0.45); }
}

/* idle alert chip */
.lm-idle-alert-chip {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.lm-idle-warn {
  background: #451a03;
  color: #fbbf24;
}
.lm-idle-critical {
  background: #450a0a;
  color: #f87171;
  animation: lm-pulse-crit 1s infinite;
}
.lm-server-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.lm-server-meta {
  font-size: 11px;
}
.lm-status-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}
.lm-status-alive {
  background: #14532d;
  color: #86efac;
}
.lm-status-dead {
  background: #450a0a;
  color: #fca5a5;
}

.lm-error {
  font-size: 11px;
  color: #fca5a5;
  background: #450a0a;
  border-radius: var(--r-sm);
  padding: 4px 8px;
  margin-bottom: 6px;
}

/* section labels */
.lm-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 10px 0 5px;
}

/* GPU mini-cards row — 균일 크기 (Task 1) */
.lm-gpu-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, 160px);
  gap: 8px;
}
.lm-gpu-mini {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 8px 10px;
  width: 160px;
  box-sizing: border-box;
  position: relative;
}
.lm-gpu-idle {
  border-color: #166534;
  background: #052e16;
}
.lm-gpu-idx {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}
.lm-gpu-name {
  font-size: 10px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.lm-avail-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  background: #166534;
  color: #86efac;
  padding: 1px 6px;
  border-radius: 8px;
  margin-bottom: 5px;
  letter-spacing: 0.04em;
}

/* Gauge bars */
.lm-gauge-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}
.lm-gauge-label {
  font-size: 10px;
  color: var(--text-dim);
  width: 28px;
  flex-shrink: 0;
}
.lm-gauge-bar-wrap {
  height: 5px;
  background: #1e293b;
  border-radius: 3px;
  flex: 1;
  overflow: hidden;
}
.lm-gauge-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s;
}
.lm-gauge-val {
  font-size: 10px;
  min-width: 68px;
  text-align: right;
}
.lm-temp {
  font-size: 10px;
  text-align: right;
  margin-top: 3px;
}

/* Processes */
.lm-proc-list {
  background: var(--bg-raised);
  border-radius: var(--r-sm);
  padding: 5px 8px;
}
.lm-proc-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 2px 0;
  border-bottom: 1px solid #1e293b;
  font-size: 11px;
}
.lm-proc-row:last-child { border-bottom: none; }
.lm-proc-user {
  color: #7dd3fc;
  width: 60px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lm-proc-owner {
  font-weight: 700;
  width: 64px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lm-proc-pid {
  width: 64px;
  flex-shrink: 0;
  font-size: 10px;
}
.lm-proc-cmd {
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lm-proc-mem {
  font-size: 10px;
  color: #7dd3fc;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Disk rows */
.lm-disk-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lm-disk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.lm-disk-mount {
  color: var(--text-secondary);
  min-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lm-disk-stat {
  min-width: 110px;
  text-align: right;
}
.lm-disk-avail {
  min-width: 60px;
  text-align: right;
}

/* Summary badges */
.lm-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 10px;
}
.lm-badge-green { background: #14532d; color: #86efac; }
.lm-badge-red   { background: #450a0a; color: #fca5a5; }
.lm-badge-blue  { background: #1e3a5f; color: #7dd3fc; }

/* Env label (conda) in process row */
.lm-proc-env {
  font-size: 9px;
  color: #a78bfa;
  background: #2e1065;
  border-radius: 6px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
/* Docker container chip in process row */
.lm-docker-chip {
  font-size: 9px;
  color: #7dd3fc;
  background: #1e3a5f;
  border-radius: 6px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: default;
}

/* 즐겨찾기 별 버튼 (Task 3) */
.lm-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  color: #94a3b8;
  transition: color 0.15s;
}
.lm-star-btn.lm-star-on {
  color: #fbbf24;
}
.lm-star-btn:hover {
  color: #fbbf24;
}

/* 즐겨찾기 섹션 구분선 */
.lm-fav-divider {
  grid-column: 1 / -1;
  border: none;
  border-top: 1px solid #334155;
  margin: 4px 0;
}

/* GPU-수 버켓 경계 행바꿈 (같은 버켓끼리 행을 이루도록 full-width break) */
.lm-bucket-break {
  grid-column: 1 / -1;
  height: 0;
  margin: 0;
}

/* 통계 블록 (Task 5) */
.lm-stats-block {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-ui);
}
.lm-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}
.lm-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.lm-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.lm-stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border-ui);
  align-self: center;
}
.lm-model-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── 서버별 GPU 분류 표 ────────────────────────────────────────────────────── */
.lm-breakdown-panel {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-ui);
  padding: 0 14px 8px;
}
.lm-breakdown-summary {
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  padding: 6px 0 4px;
  list-style: none;
}
.lm-breakdown-summary::-webkit-details-marker { display: none; }
.lm-breakdown-summary::before { content: "▼ "; font-size: 9px; opacity: 0.7; }
details.lm-breakdown-panel:not([open]) .lm-breakdown-summary::before { content: "▶ "; }
.lm-bd-table {
  border-collapse: collapse;
  font-size: 11px;
  width: auto;
  min-width: 320px;
}
.lm-bd-table thead th {
  color: var(--text-secondary);
  font-weight: 600;
  text-align: center;
  padding: 3px 14px 3px 4px;
  border-bottom: 1px solid var(--border-ui);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.lm-bd-th-name { text-align: left !important; padding-left: 0 !important; }
.lm-bd-table thead th:hover { color: var(--text-primary); }
.lm-bd-table tbody tr:hover { background: var(--bg-raised); }
.lm-bd-table td {
  padding: 2px 14px 2px 4px;
  text-align: center;
  border-bottom: 1px solid #1e293b;
}
.lm-bd-name  { text-align: left; color: var(--text-primary); font-weight: 600; padding-left: 0; }
.lm-bd-avail  { color: #22c55e; font-weight: 700; }
.lm-bd-semi   { color: #f59e0b; font-weight: 700; }
.lm-bd-active { color: #f87171; font-weight: 700; }
.lm-bd-total  { color: var(--text-secondary); }
.lm-bd-offline { color: #4b5563; font-style: italic; text-align: center; }
.lm-bd-dead td { opacity: 0.45; }
.lm-bd-total-row td {
  font-weight: 700;
  border-top: 1px solid var(--border-ui);
  border-bottom: none;
  padding-top: 4px;
}
.lm-bd-arrow { font-size: 9px; margin-left: 2px; }
.lm-model-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  background: #1e3a5f;
  color: #7dd3fc;
}

/* 즐겨찾기 필터 토글 */
.lm-fav-filter {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.lm-fav-filter input[type=checkbox] {
  cursor: pointer;
  accent-color: #fbbf24;
}

/* Add form grid */
.lm-add-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.lm-add-grid label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: var(--text-secondary);
  gap: 3px;
}
.lm-input {
  background: var(--bg-raised);
  border: 1px solid var(--border-ui);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-primary);
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.lm-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* ── Layout polish / overflow guard ─────────────────────────────────────── */
.lm-stats-block,
.lm-users-block,
.lm-dispatch-block,
.lm-breakdown-panel {
  margin: 0 12px 10px;
  border: 1px solid var(--border-ui);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  box-shadow: 0 1px 0 rgba(148,163,184,0.04);
}

.lm-stats-block {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-ui);
  justify-content: flex-start;
}

.lm-stat-item {
  min-width: 74px;
  align-items: flex-start;
}

.lm-stat-value {
  font-size: 17px;
  white-space: nowrap;
}

.lm-stat-label {
  white-space: nowrap;
}

.lm-users-block,
.lm-dispatch-block {
  padding: 0;
  overflow: hidden;
}

.lm-users-head,
.lm-dispatch-head,
.lm-breakdown-summary {
  min-height: 42px;
  margin: 0;
  padding: 9px 12px;
  align-items: center;
}

.lm-users-head > div:first-child,
.lm-dispatch-head > div:first-child {
  min-width: 0;
}

.lm-users-head::before,
.lm-dispatch-head::before,
.lm-breakdown-summary::before {
  flex: 0 0 auto;
  margin-top: 0;
}

.lm-users-subtitle,
.lm-dispatch-subtitle {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-users-total,
.lm-dispatch-total {
  flex: 0 0 auto;
  padding: 2px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-secondary);
}

.lm-users-block[open] .lm-users-tags,
.lm-dispatch-block[open] .lm-dispatch-body {
  padding: 0 12px 12px;
}

.lm-users-tags {
  align-items: stretch;
}

.lm-user-tag {
  flex: 1 1 230px;
  grid-template-columns: 8px minmax(46px, 88px) minmax(0, 1fr);
  max-width: 360px;
  min-width: 0;
  border-radius: 8px;
}

.lm-user-name,
.lm-user-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lm-dispatch-top {
  align-items: stretch;
}

.lm-dispatch-pick {
  max-width: 260px;
  min-width: 0;
}

.lm-dispatch-pick span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-dispatch-row {
  grid-template-columns: minmax(116px, 160px) minmax(0, 1fr);
}

.lm-dispatch-server span {
  min-width: 0;
}

.lm-breakdown-panel {
  padding: 0;
  overflow: hidden;
}

.lm-breakdown-summary {
  color: var(--text-primary);
  font-weight: 700;
}

#lm-breakdown-table {
  padding: 0 12px 12px;
  overflow-x: auto;
}

.lm-bd-table {
  width: 100%;
  min-width: 460px;
}

.lm-summary-section {
  padding: 8px 12px;
}

.lm-summary-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.lm-summary-toolbar .section-title {
  margin-bottom: 0;
  margin-right: 4px;
}

.lm-summary-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lm-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  align-items: start;
}

.lm-server-card {
  min-width: 0;
  overflow: hidden;
}

.lm-server-header {
  flex-wrap: wrap;
  row-gap: 6px;
}

.lm-server-name {
  min-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-server-meta {
  min-width: 0;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-status-chip {
  margin-left: auto;
  flex-shrink: 0;
}

.lm-server-users {
  margin: 6px 0 6px;
  padding-left: 26px;
  min-width: 0;
}

.lm-server-user-chip {
  max-width: 170px;
  min-width: 0;
}

.lm-server-user-chip span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-summary-bar {
  gap: 5px;
  min-width: 0;
}

.lm-summary-bar span {
  max-width: 100%;
}

.lm-gpu-row {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.lm-gpu-mini {
  width: auto;
  min-width: 0;
}

.lm-gpu-name {
  max-width: 100%;
}

.lm-gauge-row {
  display: grid;
  grid-template-columns: 30px minmax(44px, 1fr) minmax(44px, auto);
  gap: 5px;
}

.lm-gauge-label,
.lm-gauge-val {
  min-width: 0;
}

.lm-gauge-val {
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.lm-proc-list {
  overflow: hidden;
}

.lm-proc-row {
  flex-wrap: wrap;
  row-gap: 4px;
}

.lm-proc-owner {
  width: 58px;
}

.lm-proc-pid {
  width: 58px;
}

.lm-proc-cmd {
  flex: 1 1 190px;
  min-width: 120px;
}

.lm-disk-row {
  flex-wrap: wrap;
}

.lm-disk-mount {
  flex: 1 1 120px;
  min-width: 0;
}

.lm-disk-row .lm-gauge-bar-wrap {
  min-width: 90px;
}

.lm-disk-stat,
.lm-disk-avail {
  min-width: auto;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .lm-stats-block,
  .lm-users-block,
  .lm-dispatch-block,
  .lm-breakdown-panel {
    margin-left: 8px;
    margin-right: 8px;
  }

  .lm-stats-block {
    gap: 9px;
  }

  .lm-stat-divider {
    display: none;
  }

  .lm-users-head,
  .lm-dispatch-head {
    align-items: flex-start;
  }

  .lm-users-total,
  .lm-dispatch-total {
    margin-top: 1px;
  }

  .lm-user-tag {
    flex-basis: 100%;
    max-width: 100%;
  }

  .lm-dispatch-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 3px 0;
  }

  .lm-dispatch-server {
    justify-content: flex-start;
  }

  .lm-grid {
    gap: 10px;
    padding: 0 8px 16px;
  }

  .lm-summary-section {
    padding: 8px;
  }

  .lm-summary-toolbar {
    gap: 7px;
  }

  .lm-summary-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .lm-server-card {
    padding: 11px 10px;
  }

  .lm-server-users {
    padding-left: 0;
  }

  .lm-server-meta {
    max-width: 100%;
  }

  .lm-gpu-row {
    grid-template-columns: 1fr;
  }

  .lm-proc-cmd {
    flex-basis: 100%;
    order: 4;
  }
}

/* ── Lab monitor nav + card uniformity ──────────────────────────────────── */
.app-top-nav {
  gap: 10px;
  min-width: 0;
}

.app-top-nav__left {
  flex: 0 1 230px;
}

.app-top-nav__center {
  flex: 0 1 180px;
  min-width: 0;
}

.app-top-nav__right {
  flex: 1 1 520px;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: center;
  row-gap: 4px;
  overflow: hidden;
}

.app-top-nav__right > .btn {
  height: 30px;
  min-height: 30px;
  padding: 0 9px;
}

.lm-nav-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 190px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-raised);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.lm-nav-status #lm-last-poll {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lm-nav-status #lm-conn-badge {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
}

.app-top-nav__right > #clock {
  height: 30px;
  min-height: 30px;
  min-width: 74px;
  flex: 0 0 auto;
}

.app-top-nav__settings {
  flex: 0 0 38px;
  width: 38px !important;
  min-width: 38px;
  max-width: 38px;
  height: 38px !important;
  min-height: 38px;
  max-height: 38px;
  margin-left: 0;
}

.lm-grid {
  align-items: start;
}

.lm-card-gpus-8,
.lm-card-gpus-5 {
  display: flex;
  flex-direction: column;
}

.lm-card-gpus-8 .lm-gpu-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(112px, auto);
  align-content: start;
}

.lm-card-gpus-5 .lm-gpu-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(112px, auto);
  align-content: start;
}

.lm-card-gpus-8 .lm-gpu-row {
  min-height: 472px;
}

.lm-card-gpus-5 .lm-gpu-row {
  min-height: 352px;
}

.lm-card-gpus-8 details.lm-details[data-section="disk"],
.lm-card-gpus-5 details.lm-details[data-section="disk"] {
  margin-top: auto;
}

@media (max-width: 1100px) {
  .app-top-nav {
    height: auto;
    min-height: 64px;
    padding-top: 8px;
    padding-bottom: 8px;
    flex-wrap: wrap;
  }

  .app-top-nav__right {
    flex-basis: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-top-nav__left {
    flex: 1 1 180px;
  }

  .app-top-nav__right {
    gap: 6px;
  }

  .app-top-nav__right > .btn {
    flex: 1 1 auto;
    min-width: 112px;
  }

  .lm-nav-status {
    flex: 1 1 170px;
    max-width: none;
  }

  .lm-card-gpus-8 .lm-gpu-row,
  .lm-card-gpus-5 .lm-gpu-row {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

/* ── Top collapsible panel title alignment ──────────────────────────────── */
.lm-users-head,
.lm-dispatch-head,
.lm-breakdown-summary {
  height: 42px;
  min-height: 42px;
  box-sizing: border-box;
  justify-content: flex-start;
  text-align: left;
}

.lm-users-head > div:first-child,
.lm-dispatch-head > div:first-child {
  flex: 1 1 auto;
}

.lm-users-title,
.lm-dispatch-title,
.lm-breakdown-summary {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.lm-breakdown-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lm-users-total,
.lm-dispatch-total {
  margin-left: auto;
}

/* ── Group 섹션 (Tier 2 registry) ─────────────────────────────────────────── */
.lm-group-section {
  margin: 0 0 8px;
}
.lm-group-section > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  outline: none;
}
.lm-group-section > summary::-webkit-details-marker { display: none; }

.lm-group-summary {
  padding: 0 12px;
}
.lm-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-ui);
  border-radius: var(--r-md);
  margin-bottom: 0;
  transition: background 0.15s;
}
.lm-group-section[open] > summary .lm-group-header {
  border-radius: var(--r-md) var(--r-md) 0 0;
  border-bottom-color: transparent;
  margin-bottom: -1px;
  z-index: 1;
  position: relative;
}
.lm-group-header:hover {
  background: var(--bg-hover, var(--bg-surface));
}
.lm-group-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-primary);
}
.lm-group-meta {
  font-size: 11px;
  flex: 1 1 auto;
}
.lm-group-toggle-hint {
  font-size: 10px;
  transition: transform 0.15s;
}
.lm-group-section[open] .lm-group-toggle-hint {
  transform: rotate(0deg);
}
.lm-group-section:not([open]) .lm-group-toggle-hint {
  transform: rotate(-90deg);
}
.lm-group-self-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent-blue, #3b82f6);
  color: #fff;
  opacity: 0.85;
}
.lm-group-content {
  border: 1px solid var(--border-ui);
  border-radius: 0 0 var(--r-md) var(--r-md);
  padding-top: 10px;
  background: var(--bg-base, transparent);
}

/* self 서버 강조 테두리 */
.lm-server-card.lm-card-self {
  border-color: var(--accent-blue, #3b82f6);
  box-shadow: 0 0 0 1px var(--accent-blue, #3b82f6);
}
