/* ── Hidden attribute override fix ── */
[hidden] {
  display: none !important;
}

/* ── Maintenance banner (SPEC-MAINT-001 M5) ──
 * Sticky at top of viewport so it stays visible while users scroll. Color
 * encodes severity: amber for DRAINING (user jobs draining, normal submit
 * still rejected; backfill still active), darker orange for BACKFILL_RECOVERY
 * (drain done, backfill being scancel'd; submit blocked), red for ACTIVE
 * (full maintenance window). Banner stays mounted in DOM so screen readers
 * picking up the aria-live region see updates without re-attach.
 */
.maintenance-banner {
  position: sticky;
  top: 0;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #fff;
  z-index: 200;
  white-space: pre-line;
}

.maintenance-banner[data-state="DRAINING"]           { background-color: #d97706; }
.maintenance-banner[data-state="BACKFILL_RECOVERY"]  { background-color: #ea580c; }
.maintenance-banner[data-state="ACTIVE"]             { background-color: #dc2626; }

/* ── Console widens the page-shell over the global 1120px cap ── */
/* On console.html the layout has a 220px fixed sidebar, so the global */
/* shell makes the usable area only ~900px on 1440px screens. Widen it. */
.page-shell {
  width: min(1600px, calc(100% - 32px));
}

/* ── Section heading: drop the global 62ch cap inside the console ── */
/* The global rule from styles.css constrains heading rows to ~480px, */
/* which forces the heading + right-side controls to wrap. */
.console-card .section-heading {
  max-width: none;
}

/* ── Console Layout ── */
.console-layout {
  display: flex;
  min-height: 100vh;
}

.console-main {
  flex: 1;
  min-width: 0;
  padding: 24px 32px;
  margin-left: 220px;
}

.console-page {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 50;
  padding: 20px 0;
}

.sidebar-top {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-logo {
  font-family: "Space Grotesk", "IBM Plex Sans KR", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: rgba(22, 34, 38, 0.06);
  color: var(--ink-soft);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}

.sidebar-toggle:hover {
  background: rgba(22, 34, 38, 0.12);
  color: var(--ink);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 200ms ease;
}

/* ── Collapsed Sidebar ── */
.console-layout.sidebar-collapsed .sidebar {
  width: 60px;
}

.console-layout.sidebar-collapsed .console-main {
  margin-left: 60px;
}

.console-layout.sidebar-collapsed .sidebar-top {
  padding: 0 0 20px;
  justify-content: center;
}

.console-layout.sidebar-collapsed .sidebar-logo,
.console-layout.sidebar-collapsed .sidebar-link span,
.console-layout.sidebar-collapsed .sidebar-user,
.console-layout.sidebar-collapsed .sidebar-logout {
  display: none;
}

.console-layout.sidebar-collapsed .sidebar-toggle {
  background: transparent;
}

.console-layout.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.console-layout.sidebar-collapsed .sidebar-nav {
  padding: 12px 6px;
}

.console-layout.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}

.console-layout.sidebar-collapsed .sidebar-bottom {
  padding: 12px 6px;
  align-items: center;
}

.console-layout.sidebar-collapsed .sidebar-bottom::before {
  /* a tiny dot to indicate user is logged in even when name is hidden */
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-strong);
  opacity: 0.7;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 12px 10px;
  flex: 1;
}

.sidebar-nav li {
  margin-bottom: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 120ms ease;
}

.sidebar-link:hover {
  background: rgba(15, 118, 110, 0.06);
  color: var(--ink);
}

.sidebar-link.active {
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-bottom {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout {
  width: 100%;
  text-align: center;
}

/* ── Mobile Nav ── */
.mobile-nav {
  display: none;
}

/* ── Remove old console header ── */
.console-header {
  display: none;
}

/* ── Login ── */
.login-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
  background: transparent;
  border: none;
  box-shadow: none;
}

.login-card {
  width: min(420px, 100%);
  padding: 36px;
  border-radius: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 2rem;
  margin: 0 0 8px;
}

.login-card .section-text {
  margin: 0 0 24px;
}

.back-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  color: var(--accent);
}

/* ── Forms ── */
label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.optional {
  font-weight: 400;
  color: var(--ink-soft);
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  display: block;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 180ms ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.form-error {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  font-size: 0.88rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.form-group {
  margin-bottom: 4px;
}

.file-upload {
  position: relative;
  padding: 28px 20px;
  border: 2px dashed var(--line);
  border-radius: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.file-upload:hover,
.file-upload.dragover {
  border-color: var(--accent);
  background: var(--accent-pale);
}

.file-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-text {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.file-selected {
  margin: 8px 0 0;
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 600;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress-bar {
  position: relative;
  flex: 1;
  min-width: 160px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
}

.upload-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 120ms ease;
}

#upload-progress-text {
  min-width: 116px;
  font-size: 0.8rem;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.form-actions .button {
  cursor: pointer;
  border: none;
  font-size: 0.95rem;
}

.submit-status {
  font-size: 0.88rem;
  color: var(--accent-strong);
}

.submit-status.error {
  color: #b91c1c;
}

.submit-status.warning {
  color: #92400e;
  white-space: pre-line;
}

/* ── Console Header ── */
.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
}

.console-logo {
  font-family: "Space Grotesk", "IBM Plex Sans KR", sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.console-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-pale);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
  cursor: pointer;
  border: none;
}

/* ── Console Cards ── */
.console-card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.section-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.job-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.job-controls select {
  width: auto;
  margin-bottom: 0;
  min-width: 140px;
}

/* ── Job Table ── */
.job-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.job-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.job-table td {
  padding: 12px 14px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(22, 34, 38, 0.06);
  vertical-align: middle;
}

.job-table tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

.job-table tbody tr:hover {
  background: rgba(15, 118, 110, 0.04);
}

.job-id-cell {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.state-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.state-badge.running     { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.state-badge.succeeded   { background: rgba(22, 163, 74, 0.12);  color: #15803d; }
.state-badge.failed      { background: rgba(220, 38, 38, 0.1);   color: #b91c1c; }
.state-badge.cancelled   { background: rgba(107, 114, 128, 0.12); color: #4b5563; }
.state-badge.waiting     { background: rgba(217, 119, 6, 0.12);  color: #b45309; }
.state-badge.assigned    { background: rgba(139, 92, 246, 0.12); color: #6d28d9; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 34, 38, 0.4);
  backdrop-filter: blur(4px);
}

.modal-content {
  width: min(720px, calc(100% - 32px));
  max-height: 85vh;
  overflow-y: auto;
  margin: 0;
  animation: rise 0.3s ease both;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-header .eyebrow {
  margin-bottom: 6px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(22, 34, 38, 0.06);
}

.detail-item .detail-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.detail-item .detail-value {
  font-size: 0.92rem;
  font-weight: 600;
  word-break: break-all;
}

.detail-sub-heading {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 20px 0 10px;
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.event-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(22, 34, 38, 0.06);
  font-size: 0.85rem;
}

.event-list li:last-child {
  border-bottom: none;
}

.event-time {
  flex-shrink: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.event-type {
  font-weight: 600;
}

.modal-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
}

.btn-danger {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.18);
}

/* ── Live Indicator ── */
.live-indicator {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  animation: pulse-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Results Tabs ── */
.recent-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.result-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 150ms ease;
}

.result-tab:hover {
  background: rgba(15, 118, 110, 0.04);
  border-color: rgba(15, 118, 110, 0.2);
}

.result-tab-active {
  background: rgba(15, 118, 110, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.15);
}

.result-tab-name {
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Results ── */
.result-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(22, 34, 38, 0.06);
}

.result-file-list li:last-child {
  border-bottom: none;
}

.result-file-info {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.result-file-name {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
  font-weight: 600;
}

.result-file-size {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.result-download-btn {
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease;
}

.result-download-btn:hover {
  background: var(--accent-pale);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.result-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.download-progress {
  font-size: 0.82rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.result-retention-hint {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.result-file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.result-view-btn {
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  background: rgba(15, 118, 110, 0.06);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease;
}

.result-view-btn:hover {
  background: var(--accent-pale);
}

.live-log-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.04);
}

.live-log-controls span {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.result-viewer {
  margin-top: 14px;
  border-radius: 16px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.result-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(15, 118, 110, 0.06);
  border-bottom: 1px solid rgba(15, 118, 110, 0.12);
}

.result-viewer-content {
  margin: 0;
  padding: 14px 16px;
  font-family: "IBM Plex Mono", "Menlo", monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
}

/* ── Guide ── */
.guide-section .section-heading {
  margin-bottom: 0;
}

.guide-section .section-heading-row {
  margin-bottom: 0;
}

#guide-body {
  margin-top: 16px;
}

#guide-body.collapsed {
  display: none;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.guide-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(22, 34, 38, 0.08);
}

.guide-card h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.guide-card p {
  margin: 6px 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.guide-card-wide {
  grid-column: 1 / -1;
}

.guide-code {
  margin: 10px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(22, 34, 38, 0.04);
  border: 1px solid rgba(22, 34, 38, 0.06);
  font-family: "IBM Plex Mono", "Menlo", monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

.guide-note {
  margin: 10px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.06);
  border: 1px solid rgba(15, 118, 110, 0.12);
  font-size: 0.84rem !important;
  color: var(--ink) !important;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 0.85rem;
}

.guide-table th {
  text-align: left;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.guide-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(22, 34, 38, 0.06);
  vertical-align: top;
}

.guide-table code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(22, 34, 38, 0.06);
  font-size: 0.82rem;
}

.guide-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

.guide-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.guide-flow-step {
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.guide-flow-step-accent {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.2);
  color: var(--accent-strong);
}

.guide-flow-arrow {
  width: 20px;
  height: 2px;
  background: rgba(15, 118, 110, 0.3);
  flex-shrink: 0;
}

/* ── Workspace ── */
.ws-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(22, 34, 38, 0.08);
  transition: border-color 150ms ease;
}

.ws-card:last-child {
  margin-bottom: 0;
}

.ws-card-active {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.04);
}

.ws-card-default {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.ws-badge-default {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 9px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  vertical-align: middle;
  margin-left: 6px;
}

.ws-card-info {
  flex: 1;
  min-width: 0;
}

.ws-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.ws-card-meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.ws-card-packages {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", monospace;
  margin-top: 4px;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-card-hint {
  margin-top: 6px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #92400e;
}

.ws-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 16px;
}

.ws-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ws-status-ready {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.ws-status-building {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  animation: pulse-live 1.5s ease-in-out infinite;
}

.ws-status-failed {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.ws-form {
  margin-top: 16px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(22, 34, 38, 0.08);
}

.ws-form textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  font-family: "IBM Plex Mono", "Menlo", monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
  outline: none;
  resize: vertical;
  transition: border-color 180ms ease;
}

.ws-form textarea:focus {
  border-color: var(--accent);
}

/* ── Monitor Dashboard ── */
.monitor-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.monitor-refresh-btn {
  font-variant-numeric: tabular-nums;
  min-width: 110px;
}

.monitor-refresh-btn.is-stale {
  background: rgba(185, 28, 28, 0.08);
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.3);
}

.monitor-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.monitor-stat {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(22, 34, 38, 0.08);
  text-align: center;
}

.monitor-stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  font-family: "Space Grotesk", "IBM Plex Sans KR", sans-serif;
}

.monitor-stat-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.monitor-sub-heading {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.monitor-idle-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(217, 119, 6, 0.22);
  border-left: 4px solid #d97706;
  border-radius: 10px;
  background: rgba(255, 251, 235, 0.92);
}

.monitor-idle-alert[hidden] {
  display: none;
}

.monitor-idle-alert-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.monitor-idle-alert-copy strong {
  font-size: 0.88rem;
  color: #92400e;
}

.monitor-idle-alert-copy span {
  font-size: 0.82rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.monitor-idle-alert-close {
  border: 1px solid rgba(217, 119, 6, 0.28);
  background: rgba(255, 255, 255, 0.75);
  color: #92400e;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.monitor-gpu-grid {
  margin-bottom: 20px;
}

.gpu-status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.gpu-status-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.gpu-status-table td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(22, 34, 38, 0.06);
  white-space: nowrap;
}

.gpu-role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.gpu-role-serving  { background: rgba(22, 163, 74, 0.12);  color: #15803d; }
.gpu-role-research { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.gpu-role-loading  { background: rgba(217, 119, 6, 0.12);  color: #b45309; }
.gpu-role-idle     { background: rgba(107, 114, 128, 0.12); color: #4b5563; }

.gpu-card-port {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.monitor-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(22, 34, 38, 0.08);
  margin-bottom: 8px;
}

.monitor-model-row:last-child {
  margin-bottom: 0;
}

.monitor-model-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.monitor-model-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.monitor-model-count {
  font-weight: 700;
  color: var(--accent-strong);
}

/* ── Tier Queue Grid ── */
.monitor-tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.tier-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(22, 34, 38, 0.1);
}

.tier-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  gap: 6px;
}

.tier-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tier-card-vram {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.tier-gpu-slots {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.tier-gpu-slot {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1.5px solid rgba(22, 34, 38, 0.18);
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
  transition: transform 120ms ease;
  cursor: default;
  position: relative;
}

.tier-gpu-slot:hover {
  transform: scale(1.15);
}

.tier-gpu-slot.occupied {
  border-color: transparent;
}

.tier-gpu-slot.is-self::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.15);
}

.tier-gpu-slot.assigned {
  opacity: 0.6;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.4) 3px,
    rgba(255, 255, 255, 0.4) 6px
  );
}

.tier-gpu-count {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink);
}

.tier-gpu-count.full {
  color: #b45309;
}

.tier-gpu-count.warn {
  color: #b91c1c;
}

.tier-job-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tier-job-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  padding: 2px 0;
  color: var(--ink);
}

.tier-job-mini-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tier-job-mini.assigned {
  opacity: 0.55;
}

.tier-job-mini-lab {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.tier-job-mini-self {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(22, 163, 74, 0.18);
  color: #15803d;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.tier-job-mini-gpus {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.tier-empty-mini {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-style: italic;
  padding: 2px 0;
}

/* ── Global Queue ── */
.monitor-global-queue {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(22, 34, 38, 0.1);
  margin-bottom: 20px;
}

.global-queue-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.global-queue-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.global-queue-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
}

.global-queue-stat-value.self {
  color: #15803d;
}

.global-queue-stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.global-queue-by-lab {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.global-queue-lab-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(22, 34, 38, 0.06);
  color: var(--ink);
}

.global-queue-lab-chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.global-queue-lab-chip strong {
  font-weight: 800;
}

.global-queue-self-jobs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed rgba(22, 34, 38, 0.1);
}

.global-queue-self-jobs-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.global-queue-self-job-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(22, 163, 74, 0.08);
  border-left: 3px solid #15803d;
  font-size: 0.8rem;
}

/* ── User Queue (own positions) ── */
.user-queue-self {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed rgba(22, 34, 38, 0.1);
}

.user-queue-self-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.user-queue-self-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(217, 119, 6, 0.06);
  border-left: 3px solid #d97706;
  font-size: 0.8rem;
}

.user-queue-position-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(217, 119, 6, 0.18);
  color: #b45309;
  flex-shrink: 0;
}

.user-queue-self-row .tier-job-mini-owner {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Tier card: ASSIGNED with slurm reason rows ── */
.tier-job-assigned {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  padding: 2px 0;
  color: var(--ink-soft);
  opacity: 0.85;
}

.tier-job-assigned-icon {
  flex-shrink: 0;
}

.tier-job-assigned-lab {
  font-weight: 600;
  color: var(--ink);
}

.tier-job-assigned-reason {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

.tier-job-assigned-gpus {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  flex-shrink: 0;
}

.tier-gpu-count-detail {
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-family: "IBM Plex Sans KR", sans-serif;
  letter-spacing: 0.02em;
}

/* ── Lab Fair-share ── */
.monitor-fair-share {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(22, 34, 38, 0.1);
  margin-bottom: 20px;
}

.fair-share-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fair-share-row {
  display: grid;
  grid-template-columns: 14px minmax(180px, 240px) 1fr 110px;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
}

.fair-share-row.is-self {
  font-weight: 700;
}

.fair-share-row.next-priority .fair-share-bar-fill {
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.25);
}

.fair-share-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  justify-self: center;
}

.fair-share-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fair-share-self-mark {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(22, 163, 74, 0.18);
  color: #15803d;
  letter-spacing: 0.04em;
}

.fair-share-next-mark {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(217, 119, 6, 0.18);
  color: #b45309;
  letter-spacing: 0.04em;
}

.fair-share-bar-track {
  height: 8px;
  background: rgba(22, 34, 38, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.fair-share-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 200ms ease;
}

.fair-share-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  text-align: right;
  color: var(--ink-soft);
  white-space: nowrap;
}

.fair-share-empty {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
  padding: 6px;
}

/* ── Recent Research Jobs ── */
.monitor-recent-jobs {
  margin-bottom: 20px;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(22, 34, 38, 0.1);
  background: rgba(255, 255, 255, 0.65);
}

.recent-jobs-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.recent-jobs-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-soft);
  border-bottom: 1px solid rgba(22, 34, 38, 0.1);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.recent-jobs-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(22, 34, 38, 0.06);
  color: var(--ink);
  white-space: nowrap;
}

.recent-jobs-table tr:last-child td {
  border-bottom: 0;
}

.recent-job-lab-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 3px;
  vertical-align: middle;
}

.recent-job-lab {
  font-weight: 700;
}

.recent-job-gpus {
  margin-left: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.recent-job-state {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
  font-size: 0.72rem;
  font-weight: 800;
}

.recent-job-state.running {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

/* ── Grafana Embed ── */
.monitor-charts-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  margin-bottom: 10px;
}

.monitor-charts {
  margin-bottom: 8px;
}

.monitor-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.grafana-panel {
  width: 100%;
  height: 280px;
  border: 1px solid rgba(22, 34, 38, 0.08);
  border-radius: 14px;
  background: #fff;
}

.monitor-charts-link {
  text-align: right;
  margin: 8px 0 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .mobile-nav-link {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-soft);
    text-decoration: none;
    white-space: nowrap;
    transition: all 120ms ease;
  }

  .mobile-nav-link.active {
    background: rgba(15, 118, 110, 0.1);
    color: var(--accent-strong);
  }

  .console-main {
    margin-left: 0;
    padding: 16px;
  }

  .form-grid,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .guide-card-wide {
    grid-column: auto;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .section-heading-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .monitor-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .gpu-status-table {
    font-size: 0.8rem;
  }

  .monitor-chart-row {
    grid-template-columns: 1fr;
  }
}

/* ── Data tables (lab/admin) ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.data-table th,
.data-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.data-table tbody tr:hover {
  background: var(--surface-hover, rgba(255, 255, 255, 0.03));
}
.mb-1 { margin-bottom: 1rem; }

/* Lab member add button (+) */
.lab-add-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--accent, #7c6cff);
  background: transparent;
  color: var(--accent, #7c6cff);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.lab-add-btn:hover {
  background: var(--accent, #7c6cff);
  color: #fff;
}

/* Lab member remove (x) */
.lab-remove-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #888);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}
.lab-remove-btn:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.75rem;
}
.pagination-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border, #333);
  background: transparent;
  color: var(--text-secondary, #aaa);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.15s, color 0.15s;
}
.pagination-btn:hover:not(:disabled) {
  background: var(--surface-hover, rgba(255,255,255,0.06));
  color: var(--text-primary, #fff);
}
.pagination-btn.active {
  background: var(--accent, #7c6cff);
  color: #fff;
  border-color: var(--accent, #7c6cff);
}
.pagination-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ── Member jobs modal overlay ── */
.member-jobs-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.member-jobs-modal-content {
  background: var(--surface, #1e1e3a);
  border: 1px solid var(--border, #333);
  border-radius: 12px;
  padding: 1.5rem;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}
